@wowok/agent-mcp 3.4.1 → 3.4.2

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 (47) hide show
  1. package/dist/chain-semantics/composition-truth.js +1 -1
  2. package/dist/extensions/capability.js +1 -1
  3. package/dist/extensions/industry-pack.js +1 -1
  4. package/dist/extensions/modes.js +1 -1
  5. package/dist/harness/recover.js +1 -1
  6. package/dist/knowledge/arbitration-templates.js +1 -1
  7. package/dist/knowledge/audit-rules.d.ts +2 -1
  8. package/dist/knowledge/audit-rules.js +1 -1
  9. package/dist/knowledge/builtin-templates.d.ts +17 -1
  10. package/dist/knowledge/builtin-templates.js +1 -1
  11. package/dist/knowledge/fee-param-bindings.js +1 -1
  12. package/dist/knowledge/guard-bindings.js +1 -1
  13. package/dist/knowledge/guard-field-cognition.js +1 -1
  14. package/dist/knowledge/guard-templates.js +1 -1
  15. package/dist/knowledge/param-schema.js +1 -1
  16. package/dist/knowledge/pattern-resolutions.js +1 -1
  17. package/dist/knowledge/scenario-modes.js +1 -1
  18. package/dist/knowledge/template-scanner.js +1 -1
  19. package/dist/knowledge/template-test-profiles.js +1 -1
  20. package/dist/participation/customer-interest.d.ts +4 -0
  21. package/dist/participation/customer-interest.js +1 -1
  22. package/dist/participation/node-action-advisor.d.ts +4 -0
  23. package/dist/participation/node-action-advisor.js +1 -1
  24. package/dist/participation/time-window.d.ts +11 -0
  25. package/dist/participation/time-window.js +1 -1
  26. package/dist/playbooks/service-build/participation-radar.js +1 -1
  27. package/dist/schema/benchmark-migration/index.js +1 -1
  28. package/dist/schema/call/allocation.js +1 -1
  29. package/dist/schema/call/proof.js +1 -1
  30. package/dist/schema/call/service.d.ts +15 -5
  31. package/dist/schema/call/service.js +1 -1
  32. package/dist/schema/operations.d.ts +3 -1
  33. package/dist/schema/query/index.js +1 -1
  34. package/dist/schemas/benchmark_migration_operation.schema.json +1 -1
  35. package/dist/schemas/index.json +1 -1
  36. package/dist/schemas/onchain_operations.schema.json +16 -6
  37. package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
  38. package/dist/schemas/onchain_operations_guard.schema.json +2 -2
  39. package/dist/schemas/onchain_operations_proof.schema.json +1 -1
  40. package/dist/schemas/onchain_operations_service.schema.json +12 -2
  41. package/dist/schemas/query_toolkit.output.json +1 -1
  42. package/dist/tools/handlers/benchmark-migration.d.ts +9 -0
  43. package/dist/tools/handlers/benchmark-migration.js +1 -1
  44. package/dist/tools/handlers/onchain.d.ts +10 -0
  45. package/dist/tools/handlers/onchain.js +1 -1
  46. package/dist/tools/wrap.js +1 -1
  47. package/package.json +1 -1
@@ -1 +1 @@
1
- import{readFileSync,writeFileSync,existsSync,mkdirSync}from'fs';import{resolve,dirname,join}from'path';import{getWowMcpDir,WowClient,getFullnodeUrl}from'@wowok/wowok';import{diagnose_passport_failure,verifyGuardFailureLegs,CallService,CallMachine,CallProgress,CallGuard,CallArbitration,CallRepository,CallContact,CallTreasury,CallReward,CallAllocation,CallPersonal,CallPayment,CallDemand,CallOrder,gen_passport,CallProof,gen_proof,ResponseData,LocalMark,query_objects,query_table,query_serviceContext,parseGuardFile,formatGuardParseErrors,transformRewardInput,transformPersonalInput,GetAccountOrMark_Address,Config,query_events,ObjectType,objectTypeFromAddress,isValidWowAddress,bcs,deriveDynamicFieldID,PackageAddress}from'@wowok/wowok';import{buildReceipt}from'../../schema/call/receipt.js';import{buildOrderFundFacts}from'../../knowledge/arb-fund-facts.js';import{recordMachineCreation}from'../../knowledge/machine-fork-watch.js';import{TASK_BINDING_SLOT}from'../../knowledge/onchain-constants.js';import{getCreationCycleRule}from'../../knowledge/object-dependency.js';import{computeFundListingWall}from'../../graph/onchain/facts.js';import{renderGuardLegMap}from'../../knowledge/guard-leg-map.js';import{beginInFlight,recordInFlightOutcome,consumeInFlightMarker,describeLastInFlight,inFlightParamsHash,lastInFlightMarker,matchOrderLandedEvent,matchRecentOrder,pendingInFlightResend,attachInFlightDigest,parkUnknownOutcomeMarker,markerOpFor,isDeterministicOutcomeMessage,idempotencyKeyGate,idempotencyKeyObserveUnknown,idempotencyKeyClear}from'../../composition/inflight.js';import{bindAuditPlan,bindAuditReport,bindRecoveryList,preflightPlan}from'../../composition/materialize.js';import{OnchainOperationsSchema,strictParse,getEnvConfig,handleCallResult,checkClientSchemaCompatibility,parseMachineNodesFromText,formatNodeErrors as a562a,machinePublishGateViolation,transformSubmission,isSubmissionMissingEcho,buildAutoFilledSubmission}from'../../schema/index.js';import{handlePermissionOperations}from'../../schema/call/permission-handler.js';import{resolveNetwork}from'./network.js';import{collectPermissionIndexes,checkPermissionAuthorization,formatPermissionWarning,permissionGrantPayloadJson}from'../../schema/utils/permission-machine-check.js';import{getSkillsHintForOnchain}from'../../schema/utils/skills-recommendation.js';import{fetchEntityPermissions}from'../../playbooks/service-build/participation-radar.js';import{prepareFundOperation,parseAmount,generateSkillsHint as a562b,formatChainValue,fundWaterReminder,buildClaimLedgerEcho}from'../../knowledge/fund-layer.js';import{generateGuardSubmissionPrompt,formatSubmissionPrompt}from'../../knowledge/guard-submission-prompt.js';import{classifyRecipient,classifyDualPayoutTrack}from'../../knowledge/recipient-constraint.js';import{auditService,formatTaskBindingAdvisory,lintTaskBindingAdvisories,REFUND_RAIL_NODE_REGEX}from'../../knowledge/audit-rules.js';import{oracleDisclosureBlockersFor}from'../../knowledge/path-oracle/index.js';import{translateGuardTypeError}from'../../knowledge/guard-lint.js';import{lintGuardNodeGates,lintMachineGuardBindings,parseGuardNodeGates,recordCreatedGuard,recordMachineNodeNames}from'../../knowledge/guard-node-gates.js';import{getGuardQueryByIdOrName}from'../../schema/utils/guard-query-utils.js';import{checkArbitrationVenueOrder,venueOperatingDoctrine}from'../../knowledge/arbitration-venue-order.js';import{assessAllocationRisks,STUCK_POOL_REMEDY}from'../../knowledge/allocation-risk.js';import{disputeFeeReconciliation}from'../../knowledge/arbitration-risk.js';import{ENTITY_RECIPIENT_RULE_ID,checkEntityRecipients,describeEntityRecipients,formatEntityRecipientViolation}from'../../knowledge/entity-recipient-guard.js';import{checkDiscountThresholdBeforeBuy,checkDiscountFloorBeforeIssue,describeBenchmarkIssueRisk}from'../../knowledge/discount-threshold.js';import{priorProofConsumptions,recordProofConsumption}from'../../communication/proof-reuse.js';import{evaluateServiceFromGraph}from'../../playbooks/service-build/topology-query.js';import{isEnabled as a562c,isDualPayoutPreauthorized,getStoreDualPayoutPolicy}from'../../config/index.js';import{buildSubmissionConfirmation,diffGuardSpecVsChain,loadGuardJsonFromChain,OPERATION_GUARD_ACTION}from'../../knowledge/guard-submission-brief.js';import{enrichWorkflowGuidance,mergeGuidanceIntoOutput,resolveHoldableEdges,extractObjectVersionFromTx,extractProgressEventNodeFromTx}from'../../knowledge/workflow-guidance.js';import{runReviewChain,runReviewRepositoryWrite,runReviewRewardClaim,mergeReviewStepsIntoOutput}from'./review-chain.js';import{parseGuardTimeBounds,recordGuardTimeProfile,checkGuardAnchorReachability,formatGuardAnchorWarnings}from'../../knowledge/guard-anchor-reach.js';import{batchQueryObjectsByIds,batchQueryTableItems,batchReadAddressKeyedFields,fetchMachineNodes,fetchServiceOrders}from'../../graph/onchain/sdk-batch.js';import{deriveTimeWindow}from'../../participation/time-window.js';import{normAddr,rootOf}from'../../graph/onchain/extract.js';import{classifyWipPath,probeWipReachability}from'../wip-deploy-assist.js';import{declareDispatchExpectation}from'./dispatch-expectations.js';import{stableOperationId}from'../../harness/operation-id.js';import{collectOnChainNamedObjectRequests,registerLocalMarksForCreatedObjects,planAutoLocalMark,operationPrimaryType,autoLocalMarkName}from'./onchain-name-registration.js';import{goalEngine}from'../../goal/GoalEngine.js';async function buildGuardSubmissionPrompt(a,b,c){if(!a||typeof a!=='object'||!('submission'in a))return undefined;const d=a['submission'];if(!Array['isArray'](d)||d['length']===0x0)return undefined;const f=d[0x0]?.['guard'];if(!f)return undefined;try{const g=await generateGuardSubmissionPrompt(f,{'operation':b,...c});return g?formatSubmissionPrompt(g):undefined;}catch(h){return'SUBMISSION\x20REQUIRED\x20—\x20the\x20Guard\x20needs\x20data\x20you\x20have\x20not\x20supplied\x20yet\x20(detailed\x20prompt\x20generation\x20'+('failed:\x20'+(h?.['message']??String(h))+').\x20Retry\x20with\x20the\x20submission\x20envelope\x20per\x20')+'SubmissionCallSchema:\x20{type:\x22submission\x22,\x20guard:[{object:\x22<guard\x20id>\x22,\x20impack:true}],\x20'+'submission:[{identifier:<n>,\x20value:\x22<value>\x22}]}\x20—\x20the\x20identifiers\x20above\x20name\x20every\x20required\x20field.';}}function treeUsesRewardRecords(a){if(!a||typeof a!=='object')return![];if(a['type']==='query_reward_record_exists')return!![];if(a['type']==='query'&&typeof a['query']==='string'&&/^reward\.record\.(exists_where|count_where|find_where|exists|count|find)$/['test'](a['query']))return!![];const b=[...Array['isArray'](a['nodes'])?a['nodes']:[],...Array['isArray'](a['and'])?a['and']:[],...Array['isArray'](a['or'])?a['or']:[],a['node'],a['left'],a['right']];return b['some'](d=>d&&typeof d==='object'&&treeUsesRewardRecords(d));}function treePinsRecordStamp(a){if(!a||typeof a!=='object')return![];const b=a['type']==='query_reward_record_exists'||a['type']==='query'&&typeof a['query']==='string'&&/^reward\.record\.(exists_where|count_where|find_where|exists|count|find)$/['test'](a['query']);if(b&&(a['where']?.['storeFromId']!=null||a['storeFromId']!=null))return!![];const c=[...Array['isArray'](a['nodes'])?a['nodes']:[],...Array['isArray'](a['and'])?a['and']:[],...Array['isArray'](a['or'])?a['or']:[],a['node'],a['left'],a['right']];return c['some'](d=>d&&typeof d==='object'&&treePinsRecordStamp(d));}export async function assertRewardReplayStamp(a,b,c=[]){if(!Array['isArray'](a))return;for(const d of a){if(!d||typeof d!=='object'||d['store_from_id']!=null)continue;let e,f;try{const h=await loadGuardJsonFromChain(String(d['guard']),b);h&&(e=treeUsesRewardRecords((h['json']??{})['root']),f=treePinsRecordStamp((h['json']??{})['root']));}catch{e=undefined;}if(e===!![]&&f===!![])throw new Error('reward.guard_add\x20REJECTED:\x20guard\x20\x27'+String(d['guard'])+'\x27\x20pins\x20a\x20storeFromId\x20predicate\x20'+'(order-scoped\x20record\x20query)\x20but\x20the\x20entry\x20omits\x20store_from_id\x20—\x20claim\x20records\x20are\x20written\x20'+'unstamped\x20and\x20match\x20NO\x20store_from\x20predicate,\x20so\x20the\x20per-order\x20leg\x20silently\x20never\x20fires\x20'+'(the\x20protocol\x20claim\x20key\x20still\x20bounds\x20each\x20recipient\x20to\x20one\x20claim,\x20but\x20the\x20once-per-order\x20'+'economics\x20the\x20tree\x20declares\x20are\x20dead).\x20Re-submit\x20with\x20store_from_id\x20=\x20the\x20table\x20identifier\x20'+'whose\x20submitted\x20value\x20identifies\x20the\x20claim\x20(slot\x200\x20—\x20the\x20submitted\x20Order\x20address\x20—\x20is\x20the\x20'+'conventional\x20once-per-order\x20stamp);\x20re-adding\x20the\x20SAME\x20guard\x20overwrites\x20its\x20slot\x20in\x20place.');if(e===!![]){c['push']('RECIPIENT-ONCE\x20REWARD\x20GUARD:\x20guard_add\x20for\x20\x27'+String(d['guard'])+'\x27\x20omits\x20store_from_id\x20and\x20its\x20record\x20'+'queries\x20pin\x20no\x20storeFromId\x20predicate\x20—\x20claims\x20are\x20bounded\x20by\x20the\x20protocol\x20claim\x20key\x20to\x20once\x20'+'per\x20recipient\x20for\x20life\x20(query\x20record-exists\x20is\x20recipient-scoped,\x20defaulting\x20to\x20the\x20signer;\x20the\x20'+'order.owner\x20identity\x20leg\x20is\x20what\x20decides\x20WHO\x20may\x20claim\x20—\x20keep\x20it).\x20If\x20once-per-ORDER\x20economics\x20'+'are\x20intended\x20instead,\x20re-add\x20with\x20store_from_id\x20pinned\x20(slot\x200\x20=\x20submitted\x20Order\x20address)\x20and\x20'+'an\x20order-scoped\x20where:{storeFromId:{identifier:<slot>}}\x20leg;\x20re-adding\x20the\x20SAME\x20guard\x20overwrites\x20'+'its\x20slot\x20in\x20place.\x20If\x20once-per-recipient\x20is\x20intended,\x20ignore\x20this\x20warning.');continue;}c['push']('REPLAY-OPEN\x20REWARD\x20GUARD:\x20guard_add\x20for\x20\x27'+String(d['guard'])+'\x27\x20omits\x20store_from_id\x20—\x20equality-based\x20per-order\x20dedup\x20can\x20never\x20'+'match\x20(records\x20without\x20the\x20pinned\x20value\x20match\x20NO\x20store_from_id\x20predicate;\x20slot-less\x20guards\x20can\x20only\x20dedup\x20'+'lifetime-once\x20via\x20record\x20count/exists\x20with\x20an\x20empty\x20where).\x20If\x20per-order\x20protection\x20is\x20intended,\x20re-add\x20'+'with\x20store_from_id\x20pinned\x20(slot\x200\x20=\x20submitted\x20Order\x20address\x20is\x20the\x20conventional\x20per-order\x20stamp;\x20re-adding\x20'+'the\x20SAME\x20guard\x20overwrites\x20its\x20slot\x20in\x20place,\x20so\x20existing\x20pools\x20can\x20be\x20repaired\x20without\x20a\x20new\x20guard);\x20'+'if\x20unlimited\x20repeat\x20claims\x20are\x20intended,\x20ignore\x20this\x20warning.');}}function recordStampSlots(a,b=[]){if(!a||typeof a!=='object')return b;const d=a['type']==='query_reward_record_exists'||a['type']==='query'&&typeof a['query']==='string'&&/^reward\.record\.(exists_where|count_where|find_where|exists|count|find)$/['test'](a['query']);if(d){const f=a['where']?.['storeFromId']??a['storeFromId'],g=f&&typeof f==='object'?f['identifier']:f;if(typeof g==='number'&&Number['isFinite'](g))b['push'](g);}const e=[...Array['isArray'](a['nodes'])?a['nodes']:[],...Array['isArray'](a['and'])?a['and']:[],...Array['isArray'](a['or'])?a['or']:[],a['node'],a['left'],a['right']];for(const h of e){if(h&&typeof h==='object')recordStampSlots(h,b);}return b;}export function rewardWindowTimingAdvisory(a,b,c,d){try{const e=parseGuardTimeBounds(b,c);if(!e||e['lowerOffsetMs']==null||e['lowerOffsetMs']<=0x0)return;const f=e['lowerOffsetMs']/0x5265c00,g=Number['isInteger'](f)&&f>0x0?f+'\x20day(s)':Math['round'](e['lowerOffsetMs']/0x3e8)+'\x20seconds';let h='REWARD_WINDOW_DELAYED\x20(advisory,\x20never\x20blocking):\x20claim\x20guard\x20\x27'+a+'\x27\x20does\x20NOT\x20pay\x20at\x20the\x20'+('claim-allowed\x20node\x20entry\x20—\x20the\x20bounty\x20OPENS\x20only\x20'+g+'\x20AFTER\x20it\x20(Clock\x20>=\x20anchor\x20+\x20delay,\x20')+'anchor:\x20'+(e['anchor']+').\x20This\x20is\x20the\x20anti-arbitrage\x20floor\x20(tbs7\x20F-04)\x20or\x20a\x20delayed-vesting\x20design\x20—\x20')+'legitimate,\x20but\x20it\x20contradicts\x20an\x20\x22instant\x20rebate\x22\x20promise:\x20disclose\x20the\x20delay\x20to\x20buyers\x20BEFORE\x20'+'checkout\x20(service_quote.reward_terms\x20carries\x20the\x20decoded\x20opens/closes\x20window).';e['upperWindowMs']==null&&(h+='\x20The\x20window\x20also\x20NEVER\x20CLOSES\x20(no\x20Clock\x20<=\x20upper\x20bound):\x20any\x20\x22N\x20days\x20to\x20claim\x22\x20wording\x20is\x20'+'fictional\x20(bsw4\x20F-11\x20—\x20the\x20v76\x20archetype\x20shipped\x20opens-only).\x20Add\x20the\x20closes\x20leg\x20'+'(tpl_reward_one_time_claim\x27s\x20closes_after_days,\x20Clock\x20<=\x20anchor\x20+\x20opens\x20+\x20span)\x20or\x20disclose\x20the\x20'+'open-ended\x20bounty\x20explicitly.'),d['push'](h);}catch{}}export async function checkRewardOnceArming(a,b,c=[]){if(!a||typeof a!=='object')return;const e=a,f=Array['isArray'](e['guard_add'])?e['guard_add']:[];for(const h of f){if(!h||typeof h!=='object')continue;const i=h;let j,k;try{const n=await loadGuardJsonFromChain(String(i['guard']),b);if(!n)continue;j=(n['json']??{})['root'],k=(n['json']??{})['table'];}catch{continue;}rewardWindowTimingAdvisory(String(i['guard']),j,k,c);if(i['store_from_id']==null)continue;const l=recordStampSlots(j);if(l['includes'](Number(i['store_from_id'])))continue;const m=l['length']>0x0?l['join'](',\x20'):'none';c['push']('REWARD\x20ONCE\x20ARM\x20NOT\x20DETECTED\x20(advisory,\x20never\x20blocking):\x20reward.guard_add\x20for\x20\x27'+String(i['guard'])+'\x27\x20'+('pins\x20store_from_id='+String(i['store_from_id'])+',\x20but\x20the\x20guard\x20tree\x20carries\x20no\x20matching\x20order-scoped\x20')+('record\x20leg\x20(storeFromId\x20slots\x20found:\x20'+m+').\x20The\x20stamp\x20alone\x20is\x20not\x20a\x20claim\x20boundary:\x20reward.claim\x20')+'keys\x20every\x20payout\x20on\x20RewardClaimKey{recipient,\x20guard,\x20store_from},\x20the\x20stamped\x20value\x20comes\x20from\x20the\x20'+'claimant\x27s\x20own\x20submission,\x20and\x20with\x20an\x20EMPTY\x20store_from\x20slot\x20the\x20payout\x20degrades\x20to\x20ONE\x20claim\x20per\x20'+'(recipient,\x20guard)\x20for\x20life\x20—\x20the\x20buyer\x27s\x20second\x20order\x20aborts\x2013\x20(E_CLAIM_ALREADY_MADE).\x20'+'Remediation:\x20(1)\x20add\x20logic_not({type:\x27query_reward_record_exists\x27,\x20object:{identifier:<reward\x20slot>},\x20'+('where:{storeFromId:{identifier:'+String(i['store_from_id'])+'}}})\x20to\x20the\x20guard\x20root\x20and\x20keep\x20the\x20SAME\x20')+'slot\x20stamped\x20on\x20guard_add\x20(re-adding\x20the\x20guard\x20overwrites\x20its\x20slot\x20in\x20place;\x20guards\x20are\x20immutable\x20but\x20'+'the\x20Reward\x27s\x20guard\x20entry\x20is\x20not);\x20(2)\x20for\x20a\x20per-order\x20once\x20the\x20chain\x20itself\x20enforces,\x20route\x20the\x20'+('incentive\x20through\x20an\x20Allocation\x20leg\x20that\x20declares\x20protocol\x20slot\x20'+TASK_BINDING_SLOT+'\x20')+'(the\x20once\x20key\x20derives\x20from\x20bcs(payment_info.for_object);\x20a\x20second\x20alloc\x20aborts\x2016).\x20'+'If\x20this\x20guard\x20deliberately\x20dedups\x20on\x20another\x20state,\x20ignore\x20this\x20warning.');}f['length']===0x0&&e['coin_add']!=null&&await warnFundingOnUnarmedReward(e['object'],b,c);}async function warnFundingOnUnarmedReward(a,b,c){try{if(typeof a!=='string'||a['length']===0x0)return;let d=a;!d['startsWith']('0x')&&(d=await LocalMark['Instance']()['get_address'](d));if(!d)return;const e=await query_objects({'objects':[d],'network':b}),f=Array['isArray'](e?.['objects'])?e['objects'][0x0]:undefined,h=Array['isArray'](f?.['guards'])?f['guards']:[];for(const i of h){if(!i||typeof i!=='object'||i['store_from_id']!=null)continue;c['push']('REWARD\x20FUNDING\x20ON\x20A\x20LIFETIME-ONCE\x20POOL\x20(advisory,\x20never\x20blocking):\x20reward\x20'+('\x27'+d+'\x27\x20is\x20funded\x20while\x20mounted\x20guard\x20\x27'+String(i['guard'])+'\x27\x20carries\x20NO\x20store_from_id.\x20')+'reward.claim\x20keys\x20every\x20payout\x20on\x20RewardClaimKey{recipient,\x20guard,\x20store_from}:\x20an\x20empty\x20'+'store_from\x20slot\x20is\x20ONE\x20claim\x20per\x20(recipient,\x20guard)\x20for\x20LIFE,\x20so\x20the\x20same\x20buyer\x27s\x20second\x20order\x20'+'aborts\x2013\x20(E_CLAIM_ALREADY_MADE)\x20and\x20the\x20bounty\x20silently\x20pays\x20once.\x20'+'Remediation:\x20re-add\x20the\x20SAME\x20guard\x20with\x20store_from_id\x20pinned\x20(slot\x200\x20=\x20the\x20submitted\x20Order\x20'+'address\x20is\x20the\x20conventional\x20per-order\x20stamp;\x20re-adding\x20overwrites\x20its\x20slot\x20in\x20place)\x20plus\x20an\x20'+'order-scoped\x20where:{storeFromId:{identifier:<slot>}}\x20record\x20leg,\x20or\x20route\x20the\x20incentive\x20through\x20'+('an\x20Allocation\x20leg\x20armed\x20with\x20protocol\x20slot\x20'+TASK_BINDING_SLOT+'.\x20Funding\x20does\x20not\x20repair\x20the\x20claim\x20shape.'));}}catch{}}function assertRewardRecipientSemantics(a){if(!Array['isArray'](a))return;for(const b of a){if(!b||typeof b!=='object')continue;const c=b['recipient'];if(c!==null&&typeof c==='object'&&'GuardIdentifier'in c)throw new Error('reward.guard_add\x20REJECTED:\x20the\x20entry\x20for\x20guard\x20\x27'+String(b['guard'])+'\x27\x20'+'declares\x20recipient\x20{GuardIdentifier:\x20N}\x20—\x20the\x20claim\x20entry\x20requires\x20recipient\x20==\x20the\x20transaction\x20'+'sender\x20(reward\x20rail\x20abort\x2014,\x20E_CLAIM_RECIPIENT_NOT_SIGNER),\x20and\x20a\x20GuardIdentifier\x20resolves\x20from\x20'+'the\x20passport\x20submission\x20(conventionally\x20the\x20submitted\x20Order\x20address),\x20which\x20can\x20never\x20be\x20the\x20'+'signer:\x20the\x20entry\x20is\x20structurally\x20unpayable,\x20every\x20claim\x20aborts\x20(crs-mn-261015\x20F-12,\x20live\x20mainnet).\x20'+'Use\x20recipient\x20{Signer:\x20\x27signer\x27}\x20—\x20the\x20claim\x20guard\x27s\x20order.owner\x20identity\x20leg\x20keeps\x20it\x20buyer-bound\x20—\x20'+'or\x20an\x20{Entity}\x20recipient\x20(the\x20SDK\x20replaces\x20it\x20with\x20the\x20claimant\x27s\x20local\x20account\x20at\x20claim\x20time).\x20'+'The\x20GuardIdentifier\x20order-anchor\x20idiom\x20belongs\x20to\x20ALLOCATION\x20rails\x20only\x20(money\x20lands\x20ON\x20the\x20Order).');}}export async function verifyRewardEvidenceBindings(a,b,c,d){const e=[];if(!Array['isArray'](c))return e;const f=c['filter'](p=>p&&typeof p==='object'&&p['evidence']!=null);if(f['length']===0x0)return e;const h=buildReceipt(a);if(h['kind']!=='transaction'||!h['executed'])return e;const i=async p=>{if(typeof p!=='string'||!p)return undefined;if(p['startsWith']('0x'))return p;try{return await LocalMark['Instance']()['get_address'](p)??undefined;}catch{return undefined;}},j=p=>{if(typeof p==='string')return'\x22'+p+'\x22';if(Array['isArray'](p))try{return'\x22'+new TextDecoder()['decode'](new Uint8Array(p))+'\x22';}catch{return'bytes['+p['length']+']';}return'?';},k=await i(typeof b==='string'?b:b&&typeof b==='object'?b['object']:undefined);if(!k)return e['push']('EVIDENCE\x20BINDING\x20READBACK\x20INCOMPLETE\x20(ksr-tn-261026\x20Q8-F04\x20contract):\x20the\x20call\x20requested\x20a\x20native\x20'+'evidence\x20pin\x20but\x20the\x20reward\x20object\x20reference\x20was\x20not\x20resolvable\x20on\x20this\x20process,\x20so\x20the\x20pin\x20could\x20'+'NOT\x20be\x20verified.\x20Do\x20not\x20treat\x20the\x20request\x20as\x20honored\x20—\x20verify\x20the\x20pin\x20on\x20chain\x20(query\x20the\x20reward\x20'+'object\x27s\x20dynamic\x20fields\x20for\x20the\x20evidence\x20key)\x20before\x20relying\x20on\x20claim-time\x20evidence\x20counting.'),e;const l=[];for(const p of f){const q=p,s=await i(q['guard']);if(!s)continue;const t=deriveDynamicFieldID(k,PackageAddress+'::reward::EvidenceKey',bcs['Address']['serialize'](s)['toBytes']())['toLowerCase']();l['push']({'guardLabel':String(q['guard']),'fieldId':t,'key':j(q['evidence']['key'])});}if(l['length']===0x0)return e['push']('EVIDENCE\x20BINDING\x20READBACK\x20INCOMPLETE\x20(ksr-tn-261026\x20Q8-F04\x20contract):\x20the\x20call\x20requested\x20a\x20native\x20'+'evidence\x20pin\x20but\x20the\x20guard\x20reference\x20was\x20not\x20resolvable\x20on\x20this\x20process,\x20so\x20the\x20pin\x20could\x20NOT\x20be\x20'+'verified.\x20Do\x20not\x20treat\x20the\x20request\x20as\x20honored\x20—\x20verify\x20the\x20pin\x20on\x20chain\x20before\x20relying\x20on\x20'+'claim-time\x20evidence\x20counting.'),e;const m=new Set();let n=![];try{const u=await query_objects({'objects':l['map'](v=>v['fieldId']),'network':d});for(const v of u?.['objects']??[]){const x=String(v?.['object']??'')['toLowerCase']();if(x)m['add'](x);}}catch{n=!![];}if(n)return e['push']('EVIDENCE\x20BINDING\x20UNVERIFIED\x20(ksr-tn-261026\x20Q8-F04\x20contract):\x20the\x20read-back\x20query\x20failed,\x20so\x20the\x20'+'requested\x20evidence\x20pin(s)\x20on\x20reward\x20'+k+'\x20could\x20not\x20be\x20confirmed.\x20Verify\x20on\x20chain\x20'+'(query\x20the\x20reward\x20object\x27s\x20dynamic\x20fields)\x20before\x20relying\x20on\x20claim-time\x20evidence\x20counting;\x20a\x20'+'silently-dropped\x20pin\x20is\x20a\x20KNOWN\x20failure\x20mode\x20on\x20packages\x20without\x20the\x20native\x20evidence-pinning\x20entry.'),e;for(const y of l){m['has'](y['fieldId'])?e['push']('EVIDENCE\x20BINDING\x20VERIFIED\x20(ksr-tn-261026\x20Q8-F04\x20contract):\x20guard\x20'+y['guardLabel']+'\x20on\x20reward\x20'+k+'\x20carries\x20its\x20on-chain\x20evidence\x20pin\x20(key\x20'+y['key']+')\x20—\x20claim-time\x20counting\x20is\x20'+'native\x20and\x20only\x20repository\x20rows\x20tied\x20to\x20THIS\x20claim\x27s\x20own\x20store_from\x20value\x20can\x20satisfy\x20it.'):e['push']('EVIDENCE\x20BINDING\x20NOT\x20ON\x20CHAIN\x20(ksr-tn-261026\x20Q8-F04\x20contract):\x20guard\x20'+y['guardLabel']+'\x20on\x20reward\x20'+k+'\x20requested\x20an\x20evidence\x20pin\x20(key\x20'+y['key']+')\x20but\x20the\x20reward\x20object\x20carries\x20NO\x20'+'evidence\x20field\x20for\x20it.\x20On\x20the\x20currently\x20deployed\x20package\x20the\x20native\x20evidence-pinning\x20capability\x20'+'is\x20unavailable:\x20batch\x20submissions\x20SILENTLY\x20DROP\x20the\x20pin\x20and\x20the\x20direct\x20face\x20fails\x20with\x20a\x20'+'missing-entry\x20error\x20(classified\x20capability_unavailable,\x20non-retryable).\x20The\x20claim\x20still\x20passes\x20'+'on\x20the\x20repository-floor\x20guard\x20leg,\x20which\x20proves\x20only\x20\x27a\x20qualifying\x20repository\x20row\x20exists\x20for\x20'+'this\x20order\x27\x20—\x20NOT\x20who\x20wrote\x20it\x20or\x20that\x20the\x20attested\x20event\x20really\x20happened;\x20disclose\x20that\x20'+'boundary\x20wherever\x20the\x20bounty\x20is\x20advertised.\x20Do\x20NOT\x20re-send\x20guard_add\x20to\x20\x27fix\x27\x20this\x20—\x20re-enable\x20'+'the\x20pin\x20only\x20after\x20the\x20network\x27s\x20package\x20ships\x20the\x20capability\x20(release\x20notes,\x20not\x20the\x20runtime).');}return e;}function chainForwardGuardRef(a){const b=a?.['guard'];return typeof b==='string'?b:typeof b?.['guard']==='string'?b['guard']:'';}async function fetchChainAnchorContext(a,b){try{if(typeof a!=='string'||a['trim']()==='')return undefined;let c=a['trim']();if(!c['startsWith']('0x')){const j=await LocalMark['Instance']()['get'](c);if(!j?.['address'])return undefined;c=j['address'];}const d=await query_table({'parent':c,'network':b?.['network']}),e=(d?.['items']??[])['map'](k=>k?.['object'])['filter'](k=>typeof k==='string'&&k['length']>0x0);if(e['length']===0x0)return undefined;const f=await query_objects({'objects':e,'network':b?.['network']}),g=(f?.['objects']??[])['filter'](k=>k?.['type']==='TableItem_MachineNode')['map'](k=>({'name':k['name'],'pairs':k['value']}));if(g['length']===0x0)return undefined;const h=new Set();for(const k of g){for(const l of k['pairs']??[]){for(const m of l?.['forwards']??[]){const o=chainForwardGuardRef(m);if(o)h['add'](o);}}}const i=new Map();for(const q of h){try{let r=q;if(!r['startsWith']('0x')){const v=await LocalMark['Instance']()['get'](r);if(!v?.['address'])continue;r=v['address'];}const s=await query_objects({'objects':[r],'network':b?.['network']}),t=s?.['objects']?.[0x0];if(!t||t['type']!=='Guard')continue;const u=parseGuardTimeBounds(t['root'],t['table']);if(!u)continue;i['set'](r['toLowerCase'](),u),i['set'](q['trim']()['toLowerCase'](),u);}catch{}}return{'nodes':g,'profiles':i};}catch{return undefined;}}async function maybeGuardSubmissionConfirmation(a,b){const d=[],e=a['submission'];if(e&&typeof e==='object'&&Array['isArray'](e['submission']))for(const l of e['submission']){l?.['guard']&&Array['isArray'](l['submission'])&&l['submission']['length']>0x0&&d['push']({'guardRef':String(l['guard']),'items':l['submission']});}const f=a['info'];if(f&&typeof f==='object'&&Array['isArray'](f['submission'])&&f['submission']['length']>0x0){const m=Array['isArray'](f['guard'])?f['guard']['map'](o=>o?.['object'])['filter'](Boolean):[],n=m[0x0]?String(m[0x0]):a['guard'];if(n)d['push']({'guardRef':String(n),'items':f['submission']});}if(d['length']===0x0)return undefined;const g=OPERATION_GUARD_ACTION[a['operation_type']],h=[];for(const o of d){const q=await buildSubmissionConfirmation({'guard_ref':o['guardRef'],'submission':o['items'],...g?{'action':g}:{},'network':b['network']});if(q)h['push'](q);}if(h['length']===0x0)return undefined;const i=h['map'](r=>r['confirmation_text'])['join']('\x0a\x0a'),j=[];for(const r of h){r['missing_identifiers']['length']>0x0&&j['push']('Guard\x20'+(r['guard_name']??r['guard'])+':\x20missing\x20required\x20identifier(s)\x20'+r['missing_identifiers']['join'](',\x20'));for(const s of r['items']){for(const t of s['issues']){j['push']('Guard\x20'+(r['guard_name']??r['guard'])+'\x20['+(s['identifier']??'?')+']:\x20'+t);}}}const k={'message':i,'result':{'type':'pending_confirmation','preview':{'level':'standard','operation':a['operation_type'],'object':h[0x0]['guard_name']??h[0x0]['guard'],'network':b['network'],...j['length']>0x0?{'warnings':j}:{}},'rule_id':'guard_submission_confirm'},'semantic':{'intent':a['operation_type']+'_guard_submission_awaiting_confirmation','status':'pending_input','summary':'Guard\x20submission\x20composed-confirmation\x20(G1):\x20the\x20complete\x20semantics\x20of\x20your\x20submission\x20'+'(guard\x20rules\x20+\x20your\x20values\x20+\x20pass/fail\x20consequences)\x20are\x20shown\x20in\x20the\x20message.\x20'+'The\x20operation\x20was\x20NOT\x20executed.\x20Re-call\x20with\x20env.confirmed=true\x20to\x20proceed.','next_actions':[{'action':'confirm:\x20re-call\x20the\x20SAME\x20operation\x20with\x20env.confirmed=true','reason':'Guard\x20submission\x20confirmation\x20—\x20'+h['length']+'\x20guard(s),\x20'+d['reduce']((u,v)=>u+v['items']['length'],0x0)+'\x20submitted\x20item(s).','tool':'onchain_operations','priority':'required'}],...j['length']>0x0?{'warnings':j}:{}}};return{'content':[{'type':'text','text':i}],'structuredContent':k};}const REFERRER_FILE=join(getWowMcpDir(),'referrer');function readStoredReferrer(){try{if(!existsSync(REFERRER_FILE))return null;const a=readFileSync(REFERRER_FILE,'utf8')['trim']();return a||null;}catch{return null;}}const PROJECT_SKILL_DIRS=['.claude/skills','.agents/skills','.cursor/rules','.github/prompts','.windsurf/skills','.codex/skills','.qoder/skills','.roo/skills','.codebuddy/skills'],PROJECT_SKILL_MARKERS=['wowok-provider','wowok-supplier','wowok-collaborator','wowok-arbitrator','wowok-order','wowok-messenger','wowok-machine','wowok-output','wowok-onboard','wowok-planner','wowok-auditor','wowok-governance'],SKILLS_HINT_FILE=join(getWowMcpDir(),'skills-hint-asked.json');function projectHasSkills(a){for(const b of PROJECT_SKILL_DIRS){for(const c of PROJECT_SKILL_MARKERS){if(existsSync(join(a,b,c)))return!![];}}return![];}function loadSkillsAsked(){try{if(!existsSync(SKILLS_HINT_FILE))return{};return JSON['parse'](readFileSync(SKILLS_HINT_FILE,'utf8'))??{};}catch{return{};}}function persistSkillsAsked(a){try{const b=loadSkillsAsked();b[a]=!![],mkdirSync(dirname(SKILLS_HINT_FILE),{'recursive':!![]}),writeFileSync(SKILLS_HINT_FILE,JSON['stringify'](b,null,0x2),'utf8');}catch{}}function getProjectSkillsHint(){try{const a=process['cwd']();if(!a||projectHasSkills(a))return null;const b=loadSkillsAsked();if(b[a])return null;return persistSkillsAsked(a),'WoWok\x20skills\x20are\x20not\x20installed\x20in\x20this\x20project.\x20Run\x20`wowok-skills\x20init`\x20'+'here\x20to\x20install\x20them\x20(the\x20MCP\x20works\x20regardless;\x20skills\x20improve\x20AI\x20orchestration).';}catch{return null;}}function formatRecipientLabel(a){if(!a)return'unknown';if(typeof a==='string')return a;const b=classifyRecipient(a);if(!b)return JSON['stringify'](a);if(b['kind']==='submission')return'submitted\x20object\x20slot\x20'+b['identifier']+'\x20(object\x20receipt\x20=\x20owner\x20receipt)';if(b['kind']==='signer')return'Signer\x20(caller\x20of\x20the\x20guard-gated\x20alloc)';const c=b['address'];if(c['length']>0x10)return'Entity('+c['slice'](0x0,0x8)+'...'+c['slice'](-0x4)+')';return'Entity('+c+')';}function formatMistAmount(a){const b=Number(a)/0x3b9aca00;if(b===0x0)return'0\x20WOW';const c=b['toFixed'](0x9)['replace'](/\.?0+$/,'');return c+'\x20WOW\x20('+a['toString']()+'\x20MIST)';}function extractNodesForCheck(a){if(!a?.['node'])return[];if(a['node']['nodes']&&Array['isArray'](a['node']['nodes']))return a['node']['nodes'];return[];}function resolvePermissionRef(a){if(!a?.['object'])return null;if(typeof a['object']==='string')return null;const b=a['object'];if(b['permission']){if(typeof b['permission']==='string')return b['permission'];return null;}return null;}function warnPermissionAutoCreation(a,b,c){const d=a?.['object'];d!==null&&typeof d==='object'&&d['permission']===undefined&&c['push']('PERMISSION\x20AUTO-CREATION:\x20no\x20\x27permission\x27\x20specified\x20in\x20the\x20'+b+'\x20creation\x20payload\x20—\x20a\x20NEW\x20Permission\x20object\x20is\x20created\x20automatically.\x20'+'To\x20reuse\x20an\x20existing\x20Permission\x20(recommended\x20when\x20one\x20owner\x20governs\x20several\x20objects),\x20set\x20object.permission\x20to\x20its\x20address\x20or\x20LocalMark\x20name.');}export function permissionEchoWarning(a,b,c){if(!a||typeof a!=='object'||!a['digest'])return null;const d=ResponseData(a)['find'](f=>String(f?.['type']??'')==='Permission'||String(f?.['type']??'')['endsWith']('::Permission'));if(d?.['object'])return'PERMISSION\x20ECHO:\x20this\x20'+b+'\x20creation\x20minted/auto-created\x20its\x20governing\x20Permission\x20object\x20'+(String(d['object'])+'\x20—\x20record\x20it.\x20To\x20keep\x20one\x20owner\x20=\x20one\x20Permission,\x20pass\x20this\x20address\x20')+'as\x20object.permission\x20on\x20sibling\x20object\x20creations\x20(an\x20unspecified\x20permission\x20silently\x20mints\x20a\x20new\x20orphan\x20Permission\x20per\x20object).';const e=resolvePermissionRef(c);if(e)return'PERMISSION\x20ECHO:\x20this\x20'+b+'\x20is\x20governed\x20by\x20the\x20explicitly\x20specified\x20Permission\x20'+String(e)+'\x20—\x20'+'siblings\x20should\x20reuse\x20it\x20(object.permission)\x20instead\x20of\x20minting\x20new\x20Permissions.';return null;}export async function warnMerchantCompensationFundLow(a,b,c){const d=a?.['object'];if(typeof d!=='string'||!d['trim']())return;let e;try{const r=await query_objects({'objects':[d],'network':b,'no_cache':!![]});e=r?.['objects']?.[0x0];}catch{return;}if(!e||e['type']!=='Service')return;const f=s=>{if(typeof s==='number'&&Number['isFinite'](s)&&s>=0x0)return BigInt(Math['trunc'](s));if(typeof s==='string'&&/^\d+$/['test'](s['trim']()))return BigInt(s['trim']());return undefined;},g=(String(e['type']??e['type_raw']??'')['match'](/<(.+)>$/)??[])[0x1]??'',h=Array['isArray'](e['sales'])?e['sales']:[],i=h['map'](t=>f(t?.['price']))['filter'](s=>s!==undefined),j=f(e['compensation_fund']);if(j===undefined||i['length']===0x0)return;const k=i['reduce']((s,t)=>t>s?t:s);let l=j;const m=a?.['compensation_fund_add']?.['balance'];if(m!=null){const s=f(m);if(s!==undefined)l=j+s;else{if(!g)return;try{const t=await parseAmount(String(m),g,b);l=j+t['smallestUnit'];}catch{return;}}}const n=a?.['compensation_fund_withdraw']!=null;if(n)l=0x0n;const o=0x3n;if(l>=o*k)return undefined;const p=async u=>{try{return g?(await formatChainValue(u,g,b))['display']:u['toString']();}catch{return u['toString']();}},q='Service\x20\x27'+d+'\x27\x20compensation_fund\x20holds\x20'+await p(l)+'\x20(raw\x20'+l+')\x20—\x20below\x20the\x20'+('award\x20ceiling\x20of\x20'+o+'x\x20the\x20highest\x20SKU\x20price\x20=\x20')+(await p(o*k)+'\x20(raw\x20'+o*k+';\x20the\x20highest\x20')+('SKU\x20price\x20itself\x20is\x20'+await p(k)+').\x20A\x20valid\x20')+'arbitration\x20award\x20above\x20the\x20current\x20balance\x20aborts\x20the\x20buyer\x27s\x20payout\x20with\x20code\x2027\x20'+'(E_COMPENSATION_NOT_MATCH);\x20the\x20abort\x20does\x20NOT\x20consume\x20the\x20claim,\x20and\x20the\x20pool\x20is\x20NEVER\x20auto-refilled.';if(a?.['publish']===!![])return c['push']('MERCHANT\x20FUND\x20DISCLOSURE\x20(publish\x20proceeding\x20—\x20per-order\x20coverage\x20is\x20warned\x20at\x20BUY\x20time):\x20'+q+'\x20'+'Each\x20incoming\x20order\x20will\x20be\x20checked\x20against\x203x\x20ITS\x20OWN\x20amount,\x20not\x203x\x20the\x20highest\x20SKU.\x20Top\x20up\x20via\x20'+'service.compensation_fund_add\x20to\x20widen\x20the\x20payout\x20pool\x20—\x20until\x20then\x20awards\x20beyond\x20the\x20fund\x20abort\x20'+'the\x20buyer\x27s\x20claim\x20with\x20code\x2027\x20(the\x20abort\x20does\x20NOT\x20consume\x20the\x20claim)\x20and\x20the\x20merchant\x20wallet\x20'+'is\x20the\x20backstop.'),undefined;return c['push']('MERCHANT\x20FUND\x20REMINDER\x20(operational):\x20'+q+'\x20Top\x20up\x20via\x20'+'service.compensation_fund_add\x20—\x20each\x20incoming\x20order\x20is\x20checked\x20against\x203x\x20ITS\x20OWN\x20amount\x20at\x20buy\x20time,\x20'+'so\x20size\x20the\x20fund\x20for\x20your\x20typical\x20single\x20order\x20(3x\x20covers\x20any\x20single\x20ruling;\x20more\x20only\x20buys\x20headroom\x20'+'for\x20several\x20concurrent\x20claims).'+(n?'\x20NOTE:\x20this\x20call\x20withdraws\x20the\x20fund\x20—\x20buyers\x20lose\x20payout\x20protection\x20entirely.':'')),undefined;}async function resolveStringRef(a){if(typeof a!=='string')return undefined;const b=a['trim']();if(!b)return undefined;if(/^0x[0-9a-fA-F]{1,64}$/['test'](b))return b['toLowerCase']();try{return await GetAccountOrMark_Address(b)??undefined;}catch{return undefined;}}const ADDR_RE=/^0x[0-9a-fA-F]{1,64}$/;async function assertReferencesResolve(a,b){const c=a?.['data'];if(!c||typeof c!=='object')return;const d=b?.['network']?'\x20(network:\x20'+b['network']+')':'';if(typeof c['object']==='string'&&c['object']['trim']()&&!ADDR_RE['test'](c['object']['trim']())){const g=await resolveStringRef(c['object']);if(!g)throw new Error('invalid\x20parameter:object\x20\x27'+c['object']+'\x27\x20not\x20found\x20locally'+d+'\x20—\x20check\x20local_mark_list\x20/\x20account_list,\x20or\x20pass\x20the\x20on-chain\x20object\x20ID');}const e=typeof c['object']==='object'&&c['object']!==null?c['object']:undefined,f=e?.['permission'];if(typeof f==='string'&&f['trim']()&&!ADDR_RE['test'](f['trim']())){const h=await resolveStringRef(f);if(!h)throw new Error('invalid\x20parameter:permission\x20\x27'+f+'\x27\x20not\x20found\x20locally'+d+'\x20—\x20pass\x20the\x20Permission\x27s\x20object\x20ID,\x20register\x20the\x20mark\x20first,\x20or\x20use\x20the\x20object\x20form\x20permission:{name:\x22'+f+'\x22}\x20to\x20CREATE\x20a\x20new\x20Permission');}}async function checkMachinePermissionBeforePublish(a,b){if(a?.['publish']!==!![])return'';const c=extractNodesForCheck(a);if(c['length']===0x0)return'';const d=collectPermissionIndexes(c);if(d['requiredIndexes']['length']===0x0)return'';let e='';if(d['missingRefs']['length']>0x0){e+='WARNING:\x20Some\x20forwards\x20have\x20NEITHER\x20permissionIndex\x20nor\x20namedOperator.\x20'+'These\x20forwards\x20cannot\x20be\x20executed.\x20Add\x20one\x20or\x20the\x20other:\x0a';for(const k of d['missingRefs']){e+='\x20\x20-\x20Node\x20\x22'+k['nodeName']+'\x22,\x20pair\x20prev_node=\x22'+k['prevNode']+'\x22,\x20forward\x20\x22'+k['forwardName']+'\x22\x0a';}e+='\x0a';}const f=resolvePermissionRef(a);if(!f)return d['requiredIndexes']['length']>0x0&&(e+='PRE-PUBLISH\x20REMINDER:\x20This\x20Machine\x20uses\x20'+d['requiredIndexes']['length']+'\x20custom\x20permission\x20index(es):\x20['+d['requiredIndexes']['join'](',\x20')+'].\x20'+'After\x20creating\x20the\x20Permission\x20object,\x20grant\x20entities\x20for\x20each\x20index\x20via\x20'+'operation_type=\x27permission\x27,\x20e.g.\x20{\x20operation_type:\x27permission\x27,\x20data:'+permissionGrantPayloadJson('<permission_object>',d['requiredIndexes'][0x0],['<entity_address>'])+'}\x20(one\x20call\x20per\x20index),\x20BEFORE\x20publishing\x20the\x20Machine.\x20'+'Otherwise,\x20forwards\x20using\x20these\x20indexes\x20will\x20be\x20un-executable.\x0a'),e;let g=f;if(!f['startsWith']('0x'))try{const l=await LocalMark['Instance']()['get'](f);if(l?.['address'])g=l['address'];else return e+'PRE-PUBLISH:\x20Could\x20not\x20resolve\x20Permission\x20name\x20\x27'+f+'\x27\x20to\x20an\x20address.\x20Ensure\x20the\x20Permission\x20object\x20exists\x20and\x20is\x20marked.\x20'+'Required\x20indexes:\x20['+d['requiredIndexes']['join'](',\x20')+']\x0a';}catch{return e+'PRE-PUBLISH:\x20Failed\x20to\x20lookup\x20Permission\x20name\x20\x27'+f+'\x27.\x20Required\x20indexes:\x20['+d['requiredIndexes']['join'](',\x20')+']\x0a';}const h=await resolveNetwork(b?.['network']);let i=null;try{const m=await query_objects({'objects':[g],'network':h}),n=m?.['objects']?.[0x0];if(n){i={'address':g,'entity_count':n['entity_count'],'perm_remark':n['perm_remark'],'owner':n['owner']??n['builder'],'admin':n['admin']};try{i['entityPermissions']=await fetchEntityPermissions(g,h);}catch{}}}catch{return e+'PRE-PUBLISH:\x20Failed\x20to\x20query\x20Permission\x20object\x20'+g+'.\x20Required\x20indexes:\x20['+d['requiredIndexes']['join'](',\x20')+']\x0a';}if(!i)return e+'PRE-PUBLISH:\x20Permission\x20object\x20'+g+'\x20not\x20found\x20on-chain.\x20Required\x20indexes:\x20['+d['requiredIndexes']['join'](',\x20')+']\x0a';const j=checkPermissionAuthorization(d['requiredIndexes'],i);return(!j['allAuthorized']||!j['allVerified'])&&(e+=formatPermissionWarning(j)+'\x0a'),e;}async function detectServiceGuardCircularDependency(a){const b=getCreationCycleRule('service','guard','order_allocators');if(!b)return null;if(!a||typeof a['object']!=='object'||a['object']===null)return null;const c=a['order_allocators'];if(!c||typeof c!=='object')return null;const d=Array['isArray'](c['allocators'])?c['allocators']:[];if(d['length']===0x0)return null;const e=[],f=new Set();for(const l of d){const m=l?.['guard'];if(typeof m==='string'&&!m['startsWith']('0x')){if(f['has'](m))continue;f['add'](m);try{const n=await LocalMark['Instance']()['get_address'](m);!n&&e['push'](m);}catch{e['push'](m);}}}if(e['length']===0x0)return null;const g=e['map'](o=>'\x27'+o+'\x27')['join'](',\x20'),h=a['object'],i=h['name']??'<service_name>',j=b['remedy']['steps']['map']((o,p)=>{if(o==='draft_without_field')return{'step':p+0x1,'action':'onchain_operations','operation_type':b['dependent'],'params':{...a,[b['remedy']['strip_field']]:null,'publish':b['remedy']['draft_publish']},'purpose':'Create\x20Service\x20\x27'+i+'\x27\x20WITHOUT\x20'+b['remedy']['strip_field']+'\x20to\x20establish\x20'+('its\x20LocalMark\x20entry.\x20After\x20this\x20step,\x20the\x20name\x20\x27'+i+'\x27\x20resolves\x20')+'to\x20an\x20on-chain\x20address.'};if(o==='create_providers')return{'step':p+0x1,'action':'onchain_operations','operation_type':b['provider'],'params':e['map'](q=>({'object':{'name':q,'type':'Guard'},'_hint':'Table\x20items\x20may\x20reference\x20Service\x20\x27'+i+'\x27\x20by\x20name'})),'purpose':'Create\x20Guard(s)\x20'+g+'.\x20Their\x20table\x20items\x20can\x20now\x20resolve\x20'+('Service\x20\x27'+i+'\x27\x20by\x20name\x20(LocalMark\x20entry\x20from\x20step\x201).')};return{'step':p+0x1,'action':'onchain_operations','operation_type':b['dependent'],'params':{'object':i,[b['remedy']['strip_field']]:c,'publish':a['publish']??!![]},'purpose':'Update\x20Service\x20with\x20'+b['remedy']['strip_field']+'\x20(referencing\x20Guards\x20created\x20in\x20'+'step\x202)\x20and\x20publish.\x20After\x20publish,\x20order_allocators\x20becomes\x20SDK-LOCKED.'};}),k='⚠️\x20Circular\x20dependency\x20detected:\x20Service\x20↔\x20Guard\x0a\x0a'+('Cannot\x20create\x20Service\x20with\x20order_allocators\x20referencing\x20non-existent\x20Guard(s):\x20'+g+'.\x0a\x0a')+'Explanation:\x20Guard\x20table\x20items\x20may\x20reference\x20the\x20Service\x20by\x20name,\x20creating\x20a\x20circular\x20'+'dependency:\x20the\x20Service\x20must\x20exist\x20as\x20a\x20LocalMark\x20before\x20the\x20Guard\x20can\x20resolve\x20it,\x20'+'but\x20the\x20Guard\x20must\x20exist\x20before\x20the\x20Service\x20can\x20reference\x20it\x20in\x20order_allocators.\x20'+'The\x20SDK\x20would\x20fail\x20with\x20a\x20BCS\x20serialization\x20error:\x20\x22Expected\x20valid\x20Address\x20for\x20'+'ValueType.Address,\x20but\x20failed\x20to\x20resolve\x20string:\x20<name>\x22.\x0a\x0a'+'Recommended\x20steps:\x0a'+j['map'](o=>'\x20\x20Step\x20'+o['step']+'\x20('+o['operation_type']+'):\x20'+o['purpose'])['join']('\x0a')+'\x0a\x0aHint:\x20This\x20is\x20the\x20canonical\x20Service↔Guard\x20circular\x20dependency.\x20The\x203-step\x20'+'pattern\x20above\x20is\x20the\x20documented\x20solution\x20(see\x20SCHEMA-03\x20/\x20P0-01\x20in\x20the\x20'+'Service\x20publish\x20field\x20description).';return{'content':[{'type':'text','text':k}],'structuredContent':{'result':{'type':'error','error':'Cannot\x20create\x20Service\x20with\x20order_allocators\x20referencing\x20non-existent\x20Guard(s):\x20'+g+'.\x20Circular\x20dependency:\x20Service↔Guard.','error_code':'circular_dependency_detected','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':JSON['stringify'](j),'related_object':i},'message':'Circular\x20dependency\x20detected:\x20Service\x20↔\x20Guard.\x20See\x20recovery_hint\x20for\x20the\x203-step\x20creation\x20pattern.'}};}function buildFundBlockResult(a,b){const c=a['matchErrors']['length']>0x0,d=a['errors']['length']>0x0,e=a['blockingErrors']['some'](k=>k['includes']('TOKEN\x20CHOICE\x20REQUIRED')),f=c&&d?'FUND\x20OPERATION\x20BLOCKED':c?'TOKEN\x20TYPE\x20MISMATCH\x20—\x20operation\x20blocked':e?'TOKEN\x20CHOICE\x20REQUIRED\x20—\x20operation\x20blocked,\x20awaiting\x20user\x20selection':'FUND\x20INPUT\x20BLOCKED\x20—\x20operation\x20blocked',g=c&&d?'fund_blocked':c?'token_type_mismatch':e?'token_choice_required':'fund_input_error',h=c?'\x0a\x0aThe\x20token\x20type\x20of\x20a\x20generic\x20on-chain\x20object\x20(e.g.\x20Treasury<T>,\x20Service<T>)\x20is\x20'+'determined\x20at\x20creation\x20and\x20can\x20NEVER\x20be\x20changed,\x20and\x20monetary\x20input\x20is\x20never\x20'+('processed\x20with\x20unknown\x20token\x20precision.\x20This\x20'+b+'\x20operation\x20was\x20')+'NOT\x20executed.\x20Fix\x20the\x20errors\x20above\x20and\x20re-issue\x20the\x20operation'+(a['objectTokenType']?'\x20(object\x20token\x20type:\x20'+a['objectTokenType']+')':'')+'.':e?'\x0a\x0aMultiple\x20on-chain\x20tokens\x20may\x20legally\x20share\x20the\x20same\x20symbol\x20(several\x20'+'issuers\x20can\x20each\x20publish\x20a\x20\x22USDT\x22),\x20so\x20a\x20bare\x20symbol\x20can\x20never\x20identify\x20'+('the\x20issuer.\x20This\x20'+b+'\x20operation\x20was\x20NOT\x20executed\x20and\x20no\x20')+'on-chain\x20action\x20was\x20taken.\x20Present\x20the\x20numbered\x20candidate\x20list\x20above\x20to\x20'+'the\x20USER,\x20wait\x20for\x20their\x20choice,\x20then\x20re-issue\x20with\x20the\x20chosen\x20token\x27s\x20'+'full\x20type.':'\x0a\x0aMonetary\x20input\x20is\x20never\x20processed\x20with\x20unknown\x20token\x20precision\x20or\x20an\x20'+('unparseable\x20amount.\x20This\x20'+b+'\x20operation\x20was\x20NOT\x20executed\x20and\x20')+'no\x20on-chain\x20action\x20was\x20taken.\x20Follow\x20the\x20recovery\x20steps\x20in\x20the\x20error\x20'+'above\x20and\x20re-issue\x20the\x20operation.',i='⛔\x20'+f+'\x0a\x0a'+a['blockingErrors']['map'](k=>'\x20\x20•\x20'+k)['join']('\x0a')+h,j=e?'Present\x20the\x20numbered\x20token\x20candidate\x20list\x20from\x20the\x20error\x20message\x20to\x20the\x20USER\x20'+'(full\x20type,\x20name,\x20decimals,\x20verified\x20tag\x20are\x20all\x20shown)\x20—\x20do\x20NOT\x20pick\x20an\x20'+'issuer\x20yourself.\x20After\x20the\x20user\x20chooses\x20(by\x20number\x20or\x20by\x20pasting\x20the\x20full\x20'+('type),\x20re-issue\x20this\x20'+b+'\x20operation\x20with\x20that\x20token\x27s\x20FULL\x20type\x20')+'string\x20(package::module::Name)\x20in\x20type_parameter\x20(object.type_parameter\x20for\x20'+'service\x20creation;\x20root\x20type_parameter\x20for\x20payment\x20receive).\x20Also\x20verify\x20the\x20'+'WOW\x20network\x20selection\x20is\x20correct.':'Use\x20token\x20type\x20'+(a['objectTokenType']??'<the\x20object\x27s\x20generic\x20token\x20type>')+'\x20for\x20all\x20'+('amounts,\x20coins,\x20and\x20receive\x20records\x20in\x20this\x20'+b+'\x20operation.\x20')+'Query\x20the\x20object\x20via\x20query_toolkit\x20onchain_objects\x20to\x20confirm\x20its\x20generic\x20'+'token\x20type\x20(type_raw,\x20e.g.\x20\x220x2::treasury::Treasury<0x2::wow::WOW>\x22).\x20'+'For\x20precision-unavailable\x20tokens,\x20retry\x20the\x20operation\x20—\x20the\x20on-chain\x20'+'metadata\x20lookup\x20may\x20have\x20been\x20transient.';return{'content':[{'type':'text','text':i}],'structuredContent':{'result':{'type':'error','error':a['blockingErrors']['join']('\x20|\x20'),'error_code':g,'retryable':!![],'recovery_hint':j},'message':'Fund\x20operation\x20blocked\x20before\x20execution.'}};}async function checkSalesWipNetworkDeployment(a,b,c){const d=a?.['sales'];if(!d||typeof d!=='object')return null;if(d['op']!=='add'&&d['op']!=='set')return null;const e=Array['isArray'](d['sales'])?d['sales']:[];if(e['length']===0x0)return null;const f=b?.['network']==='localnet';for(const g of e){const h=g?.['wip'];if(typeof h!=='string'||h==='')continue;const i=classifyWipPath(h),j=!i['is_local']&&i['is_network']&&!f&&(i['type']==='http_url'||i['type']==='ipfs'&&/^https?:/i['test'](h));if(j){const m=await probeWipReachability(h)['catch'](()=>({'ok':![],'reason':'probe\x20failed'}));if(!m['ok']){const n=m['status']?'HTTP\x20'+m['status']:m['reason']??'unreachable',o='⛔\x20WIP\x20HOST\x20UNREACHABLE\x20—\x20sales\x20NOT\x20submitted\x0a\x0a'+('Sale\x20\x22'+g['name']+'\x22\x20has\x20wip\x20=\x20\x22'+h+'\x22,\x20but\x20the\x20host\x20is\x20not\x20reachable\x20('+n+').\x0a\x0a')+'Every\x20customer\x20order_new\x20fetches\x20this\x20URL\x20to\x20verify\x20the\x20WIP\x20file\x20—\x20while\x20it\x20is\x20'+'down,\x20ALL\x20purchases\x20on\x20this\x20Service\x20abort\x20100%\x20(F-27:\x20WIP\x20single-host\x20outage\x20'+'famously\x20took\x20every\x20listing\x20down\x20at\x20once).\x0a\x0a'+'This\x20is\x20NOT\x20a\x20wrong-network\x20problem\x20—\x20do\x20NOT\x20switch\x20networks.\x0a\x0a'+'Fix:\x0a'+'\x20\x20•\x20Transient\x20outage:\x20wait\x20for\x20the\x20host\x20to\x20recover,\x20then\x20re-run\x20this\x20operation.\x0a'+'\x20\x20•\x20Permanent:\x20redeploy\x20the\x20.wip\x20file\x20to\x20another\x20public\x20endpoint\x20and\x20update\x20'+'sale.wip\x20+\x20wip_hash\x20(GitHub\x20Pages\x20/\x20IPFS\x20/\x20your\x20own\x20site,\x20or\x20wip_file\x20'+'type=\x27upload\x27\x20for\x20the\x20official\x20store).\x0a'+'\x20\x20•\x20Testing\x20only:\x20set\x20sale.wip\x20=\x20\x22\x22\x20(empty)\x20to\x20skip\x20WIP\x20verification.';return{'content':[{'type':'text','text':o}],'structuredContent':{'result':{'type':'error','error':'Sale\x20\x22'+g['name']+'\x22\x20wip\x20host\x20unreachable\x20('+n+'):\x20'+h+'.\x20Customer\x20order_new\x20would\x20abort\x20100%\x20while\x20the\x20WIP\x20file\x20cannot\x20be\x20fetched\x20(F-27).\x20Not\x20a\x20wrong-network\x20problem.','error_code':'wip_host_unreachable','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Transient\x20outage:\x20retry\x20after\x20the\x20host\x20recovers.\x20Permanent:\x20redeploy\x20the\x20.wip\x20'+'file\x20to\x20another\x20public\x20endpoint\x20and\x20set\x20sale.wip\x20to\x20the\x20new\x20URL\x20(update\x20'+'wip_hash\x20too);\x20or\x20set\x20sale.wip\x20=\x20\x22\x22\x20(empty)\x20to\x20skip\x20WIP\x20verification\x20(TESTING\x20ONLY).','related_object':g['name']},'message':'WIP\x20host\x20unreachable\x20—\x20sales\x20not\x20submitted.\x20See\x20recovery_hint.'}};}}if(!i['is_local'])continue;if(i['type']==='local_http'){if(f){c['push']('WIP\x20INTERNAL-TEST-ONLY\x20REMINDER\x20(sale\x20\x22'+g['name']+'\x22):\x20wip\x20=\x20\x22'+h+'\x22\x20is\x20a\x20'+('local-network\x20URL\x20('+i['description']+').\x20It\x20is\x20reachable\x20ONLY\x20on\x20the\x20')+'local\x20machine\x20/\x20LAN\x20where\x20a\x20local\x20WIP\x20server\x20runs.\x20This\x20is\x20acceptable\x20for\x20LOCALNET\x20'+'internal\x20testing,\x20but\x20customers\x20and\x20on-chain\x20verifiers\x20on\x20OTHER\x20machines\x20CANNOT\x20'+'reach\x20it\x20—\x20on\x20testnet/mainnet,\x20every\x20customer\x20order_new\x20would\x20fail\x20100%\x20because\x20the\x20'+'WIP\x20file\x20cannot\x20be\x20verified.\x20For\x20any\x20non-localnet\x20deployment,\x20replace\x20this\x20URL\x20with\x20'+'a\x20public\x20endpoint\x20(GitHub\x20Pages\x20/\x20IPFS\x20/\x20your\x20own\x20website)\x20or\x20leave\x20sale.wip\x20empty.');continue;}const p='a\x20local-network\x20URL\x20('+i['description']+')',q='⛔\x20WIP\x20IS\x20NOT\x20NETWORK-DEPLOYABLE\x20—\x20sales\x20NOT\x20submitted\x0a\x0a'+('Sale\x20\x22'+g['name']+'\x22\x20has\x20wip\x20=\x20\x22'+h+'\x22,\x20which\x20is\x20'+p+'.\x0a\x0a')+'INTERNAL\x20TEST\x20USE\x20ONLY:\x20this\x20URL\x20is\x20reachable\x20only\x20from\x20the\x20merchant\x27s\x20own\x20machine/LAN.\x20'+'Customers\x20on\x20other\x20machines\x20cannot\x20reach\x20it,\x20so\x20verifying\x20the\x20WIP\x20file\x20at\x20order\x20time\x20'+'fails\x20and\x20order_new\x20aborts\x20100%.\x20Local-network\x20WIP\x20URLs\x20are\x20allowed\x20ONLY\x20for\x20'+('localnet\x20internal\x20testing\x20(env.network\x20=\x20\x22localnet\x22);\x20on\x20'+(b?.['network']??'this\x20network')+'\x20')+'they\x20must\x20never\x20be\x20stored\x20on-chain.\x0a\x0a'+'Fix:\x20deploy\x20the\x20.wip\x20file\x20to\x20a\x20publicly\x20reachable\x20endpoint,\x20then\x20re-run\x20with\x20'+'sale.wip\x20=\x20\x22<public\x20URL>\x22\x20(e.g.\x20GitHub\x20Pages,\x20IPFS\x20gateway,\x20or\x20your\x20own\x20website).\x0a'+'\x20\x20•\x20GitHub\x20Pages:\x20https://<user>.github.io/<repo>/<file>.wip\x0a'+'\x20\x20•\x20IPFS:\x20\x20\x20\x20\x20\x20\x20\x20https://ipfs.io/ipfs/<CID>\x20\x20(or\x20ipfs://<CID>)\x0a'+'\x20\x20•\x20Your\x20site:\x20\x20\x20https://<your-domain>/<path>/<file>.wip\x0a'+'Alternatively,\x20set\x20sale.wip\x20=\x20\x22\x22\x20(empty)\x20to\x20SKIP\x20WIP\x20verification\x20—\x20'+'TESTING\x20ONLY,\x20not\x20recommended\x20for\x20production.';return{'content':[{'type':'text','text':q}],'structuredContent':{'result':{'type':'error','error':'Sale\x20\x22'+g['name']+'\x22\x20wip\x20is\x20'+p+':\x20'+h+'.\x20Local-network\x20URLs\x20are\x20INTERNAL\x20TEST\x20USE\x20ONLY\x20—\x20customers\x20cannot\x20verify\x20them,\x20aborting\x20order_new\x20100%.','error_code':'wip_not_network_deployed','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Deploy\x20the\x20.wip\x20file\x20to\x20a\x20public\x20endpoint\x20(GitHub\x20Pages\x20/\x20IPFS\x20/\x20your\x20own\x20website)\x20'+'and\x20set\x20sale.wip\x20to\x20the\x20public\x20URL;\x20or\x20set\x20sale.wip\x20=\x20\x22\x22\x20(empty)\x20to\x20skip\x20WIP\x20'+'verification\x20(TESTING\x20ONLY).','related_object':g['name']},'message':'WIP\x20is\x20a\x20local-network\x20URL\x20(INTERNAL\x20TEST\x20USE\x20ONLY)\x20—\x20sales\x20not\x20submitted.\x20See\x20recovery_hint.'}};}const k='a\x20LOCAL\x20'+i['type']+'\x20path',l='⛔\x20WIP\x20IS\x20NOT\x20NETWORK-DEPLOYABLE\x20—\x20sales\x20NOT\x20submitted\x0a\x0a'+('Sale\x20\x22'+g['name']+'\x22\x20has\x20wip\x20=\x20\x22'+h+'\x22,\x20which\x20is\x20'+k+'.\x0a\x0a')+'Why\x20this\x20is\x20fatal:\x20the\x20WIP\x20path\x20is\x20stored\x20ON-CHAIN\x20and\x20every\x20customer\x20'+'(on\x20a\x20different\x20machine)\x20fetches\x20it\x20when\x20placing\x20an\x20order.\x20A\x20local\x20path\x20/\x20'+'localhost\x20/\x20LAN\x20URL\x20is\x20reachable\x20only\x20from\x20YOUR\x20machine\x20—\x20it\x20passes\x20the\x20'+'merchant-side\x20set-time\x20verification\x20but\x20makes\x20order_new\x20abort\x20100%\x20for\x20customers.\x0a\x0a'+'Fix:\x20deploy\x20the\x20.wip\x20file\x20to\x20a\x20publicly\x20reachable\x20endpoint,\x20then\x20re-run\x20with\x20'+'sale.wip\x20=\x20\x22<public\x20URL>\x22\x20(e.g.\x20GitHub\x20Pages,\x20IPFS\x20gateway,\x20or\x20your\x20own\x20website).\x0a'+'\x20\x20•\x20GitHub\x20Pages:\x20https://<user>.github.io/<repo>/<file>.wip\x0a'+'\x20\x20•\x20IPFS:\x20\x20\x20\x20\x20\x20\x20\x20https://ipfs.io/ipfs/<CID>\x20\x20(or\x20ipfs://<CID>)\x0a'+'\x20\x20•\x20Your\x20site:\x20\x20\x20https://<your-domain>/<path>/<file>.wip\x0a'+'Alternatively,\x20set\x20sale.wip\x20=\x20\x22\x22\x20(empty)\x20to\x20SKIP\x20WIP\x20verification\x20—\x20'+'TESTING\x20ONLY,\x20not\x20recommended\x20for\x20production.';return{'content':[{'type':'text','text':l}],'structuredContent':{'result':{'type':'error','error':'Sale\x20\x22'+g['name']+'\x22\x20wip\x20is\x20'+k+':\x20'+h+'.\x20Local\x20WIP\x20paths\x20are\x20unreachable\x20by\x20customers\x20and\x20abort\x20order_new\x20100%.','error_code':'wip_not_network_deployed','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Deploy\x20the\x20.wip\x20file\x20to\x20a\x20public\x20endpoint\x20(GitHub\x20Pages\x20/\x20IPFS\x20/\x20your\x20own\x20website)\x20'+'and\x20set\x20sale.wip\x20to\x20the\x20public\x20URL;\x20or\x20set\x20sale.wip\x20=\x20\x22\x22\x20(empty)\x20to\x20skip\x20WIP\x20'+'verification\x20(TESTING\x20ONLY).','related_object':g['name']},'message':'WIP\x20is\x20not\x20network-deployable\x20—\x20sales\x20not\x20submitted.\x20See\x20recovery_hint.'}};}return null;}function checkSalesZeroPrice(a){const b=a?.['sales'];if(!b||typeof b!=='object')return null;if(b['op']!=='add'&&b['op']!=='set')return null;const c=Array['isArray'](b['sales'])?b['sales']:[];for(const d of c){const e=d?.['price']?.['balance']??d?.['price'],f=typeof e==='string'?e['trim']():String(e??'');if(!/^\d+$/['test'](f)||BigInt(f)!==0x0n)continue;const g='⛔\x20ZERO-PRICE\x20SKU\x20REFUSED\x20—\x20sales\x20NOT\x20submitted\x20(F-BS-76)\x0a\x0a'+('Sale\x20\x22'+d['name']+'\x22\x20has\x20price\x200.\x20A\x20zero-priced\x20SKU\x20is\x20LISTABLE\x20but\x20PERMANENTLY\x20UNBUYABLE:\x20')+'the\x20chain\x20refuses\x20zero-total\x20orders\x20(client\x20order_new_zero_total_dead_order,\x20on-chain\x20abort\x2042),\x20'+'so\x20no\x20buyer\x20can\x20ever\x20purchase\x20it\x20—\x20and\x20the\x20listing\x20is\x20immutable\x20on\x20those\x20points\x20that\x20matter\x20'+'(removing\x20it\x20costs\x20gas;\x20repricing\x20needs\x20a\x20fresh\x20set).\x0a\x0a'+'Fixes\x20(pick\x20one):\x0a'+'\x20\x20•\x20Price\x20it\x20at\x201\x20smallest\x20unit\x20(the\x20minimum\x20buyable\x20price)\x20—\x20the\x20standard\x20way\x20to\x20express\x20a\x20free\x20tier.\x0a'+'\x20\x20•\x20If\x20the\x20item\x20is\x20not\x20actually\x20for\x20sale,\x20do\x20not\x20add\x20it\x20to\x20sales.\x0a'+'\x20\x20•\x20Testing\x20an\x20unbuyable\x20listing\x20deliberately?\x20Re-run\x20with\x20price\x20\x221\x22\x20—\x20the\x20gate\x20arithmetic\x20is\x20identical\x20from\x20price\x201\x20upward.';return{'content':[{'type':'text','text':g}],'structuredContent':{'result':{'type':'error','error':'Sale\x20\x22'+d['name']+'\x22\x20price\x200:\x20zero-priced\x20SKUs\x20are\x20permanently\x20unbuyable\x20(zero-total\x20gate,\x20abort\x2042)\x20—\x20F-BS-76.','error_code':'invalid_parameter','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'Set\x20price\x20to\x20at\x20least\x201\x20smallest\x20unit\x20(a\x20free\x20tier\x20is\x20priced\x20at\x201,\x20not\x200)\x20and\x20resubmit;\x20'+'or\x20drop\x20the\x20item\x20from\x20sales\x20if\x20it\x20is\x20not\x20for\x20sale.','related_object':d['name']},'message':'Zero-price\x20SKU\x20refused\x20—\x20sales\x20not\x20submitted.\x20See\x20recovery_hint.'}};}return null;}function extractObjectOnlyRef(a){const b=a;if(b['submission'])return undefined;const c=b['data'];if(!c||typeof c!=='object'||Array['isArray'](c))return undefined;const d=c,e=Object['keys'](d);if(e['length']!==0x1||e[0x0]!=='object')return undefined;const f=d['object'];return typeof f==='string'&&f['trim']()['length']>0x0?f['trim']():undefined;}async function preflightDemandFeedback(a,b,c){try{const d=typeof a?.['object']==='string'?a['object']:undefined;if(!d||!Array['isArray'](a?.['feedback'])||a['feedback']['length']===0x0)return undefined;const f=d['startsWith']('0x')?d:await LocalMark['Instance']()['get_address'](d)['catch'](()=>undefined);if(typeof f!=='string'||!f['startsWith']('0x'))return c['push']('FEEDBACK\x20PREFLIGHT\x20UNRESOLVED:\x20the\x20Demand\x20reference\x20could\x20not\x20be\x20resolved\x20to\x20an\x20on-chain\x20address;\x20the\x20presenter\x20pre-check\x20was\x20skipped\x20(the\x20chain\x20remains\x20the\x20truth).'),undefined;const {items:g}=await batchQueryTableItems(f,{'network':b?.['network'],'noCache':!![],'maxItems':0xc8}),h=(g??[])['map'](i=>i['object'])['filter'](i=>i?.['type']==='TableItem_DemandPresenter');for(const i of a['feedback']){let j=typeof i?.['who']==='string'?i['who']:undefined;j&&!j['startsWith']('0x')&&(j=await LocalMark['Instance']()['get_address'](j)['catch'](()=>undefined)??undefined);if(typeof j!=='string'||!j['startsWith']('0x')){c['push']('FEEDBACK\x20PREFLIGHT\x20UNRESOLVED:\x20feedback\x20who\x20\x27'+i?.['who']+'\x27\x20could\x20not\x20be\x20resolved\x20to\x20an\x20address;\x20its\x20presenter\x20pre-check\x20was\x20skipped.');continue;}const k=h['find'](l=>normAddr(String(l?.['address']??''))===normAddr(j));if(!k)return{'content':[{'type':'text','text':'FEEDBACK\x20REFUSED\x20(non-presenter)\x20—\x20no\x20transaction\x20was\x20sent.\x20Account\x20'+j+'\x20has\x20NEVER\x20presented\x20to\x20Demand\x20'+f+'\x20'+'(the\x20demand\x27s\x20on-chain\x20presenter\x20table\x20holds\x20no\x20row\x20for\x20it).\x20Move\x20truth:\x20demand\x20feedback\x20for\x20a\x20non-presenter\x20is\x20a\x20SILENT\x20no-op\x20'+'—\x20the\x20presenter-membership\x20check\x20gates\x20every\x20write\x20with\x20NO\x20abort\x20and\x20NO\x20event,\x20so\x20this\x20tx\x20would\x20burn\x20gas\x20and\x20record\x20nothing.'}],'structuredContent':{'result':{'type':'error','error':'Demand\x20feedback\x20for\x20\x27'+i?.['who']+'\x27\x20on\x20'+d+'\x20refused:\x20the\x20account\x20never\x20presented\x20to\x20this\x20demand,\x20and\x20on-chain\x20feedback\x20for\x20non-presenters\x20is\x20silently\x20ignored\x20(no\x20abort,\x20no\x20event).','error_code':'demand_feedback_not_presenter','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'The\x20presenter\x20row\x20is\x20created\x20by\x20the\x20PRESENT\x20path:\x20the\x20presenter\x20account\x20runs\x20demand\x20present\x20(operation_type\x20\x27demand\x27,\x20data.present\x20{recommend,\x20service})\x20signed\x20by\x20THAT\x20account.\x20After\x20it\x20presents,\x20re-send\x20this\x20feedback\x20call.\x20If\x20you\x20meant\x20to\x20rate\x20the\x20DEMAND\x20OWNER\x20instead,\x20order/progress\x20feedback\x20rails\x20are\x20separate\x20surfaces.'},'message':'Refused:\x20demand\x20feedback\x20targets\x20an\x20account\x20that\x20never\x20presented\x20—\x20the\x20chain\x20would\x20silently\x20drop\x20it.\x20Present\x20first,\x20then\x20give\x20feedback.'}};i?.['acceptance_score']!=null&&k?.['feedback_time']!=null&&k?.['acceptance_score']!=null&&Number(k['acceptance_score'])!==Number(i['acceptance_score'])&&c['push']('FEEDBACK\x20SCORE\x20OVERWRITE\x20(F-20\x20advisory):\x20presenter\x20'+j+'\x20already\x20holds\x20acceptance_score='+k['acceptance_score']+'\x20'+('(feedback\x20recorded\x20at\x20'+k['feedback_time']+');\x20this\x20call\x20sets\x20acceptance_score='+i['acceptance_score']+'.\x20Move\x20has\x20NO\x20once-gate\x20—\x20')+'the\x20bare\x20assignment\x20WILL\x20overwrite\x20the\x20prior\x20score.\x20Confirm\x20this\x20revision\x20is\x20intended.');}return undefined;}catch(l){return c['push']('FEEDBACK\x20PREFLIGHT\x20FAILED\x20(proceeding\x20—\x20the\x20chain\x20remains\x20the\x20truth):\x20'+(l?.['message']??String(l))),undefined;}}async function queryObjectOnlyResult(a,b,c){let d=[],f;try{const j=await query_objects({'objects':[b],'network':c?.['network'],'no_cache':!![]});d=j['objects']??[],d['length']===0x0&&(f='Object\x20\x27'+b+'\x27\x20not\x20found\x20on-chain.\x20It\x20may\x20never\x20have\x20been\x20created,\x20'+'its\x20local\x20mark\x20may\x20be\x20missing\x20(register\x20it\x20via\x20local_mark_operation),\x20'+'or\x20it\x20may\x20live\x20on\x20a\x20different\x20network.');}catch(k){const l=k?.['message']??String(k);f='Query\x20failed\x20for\x20\x27'+b+'\x27:\x20'+l;}const g=d['map'](m=>({...m,'change':'queried'})),h=f?'Object-only\x20payload\x20for\x20'+a+'\x20—\x20nothing\x20to\x20mutate,\x20no\x20transaction\x20was\x20sent\x20(no\x20gas\x20used).\x20'+f:'Object-only\x20payload\x20for\x20'+a+'\x20—\x20nothing\x20to\x20mutate,\x20no\x20transaction\x20was\x20sent\x20(no\x20gas\x20used).\x20Current\x20on-chain\x20state\x20of\x20\x27'+b+'\x27:',i={'message':h,'result':f?{'type':'error','error':f,'error_code':'object_not_found','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'Check\x20the\x20name\x20spelling\x20(local_mark_operation\x20list),\x20the\x20env.network\x20value,\x20or\x20create\x20the\x20object\x20first.'}:{'type':'data','data':g},'semantic':{'intent':a+'_read','status':f?'failed':'success','summary':h,'next_actions':[{'action':'Use\x20query_toolkit\x20(onchain_objects)\x20for\x20richer\x20inspection\x20—\x20content\x20fields,\x20ownership,\x20dynamic\x20tables.','reason':'Object-only\x20onchain_operations\x20payloads\x20are\x20answered\x20by\x20a\x20pure\x20query;\x20they\x20never\x20mutate\x20on-chain\x20state.','tool':'query_toolkit','priority':'recommended'}],'warnings':['Payload\x20contained\x20only\x20data.object\x20—\x20interpreted\x20as\x20a\x20READ\x20request,\x20not\x20a\x20transaction.']}};return{'content':[{'type':'text','text':h}],'structuredContent':i};}function checkOrderAllocatorsPrePublish(b,c){if(!b||typeof b!=='object')return null;let d,f;try{const h=assessAllocationRisks({'allocators_config':b,'operation_type':'create','trigger_source':'service_order_allocators'}),i=new Set(['R-A-1-01','R-A-1-02','R-A-1-03','R-A-2-03']);d=h['risks']['filter'](j=>i['has'](j['id']))['map'](j=>({'id':j['id'],'title':j['title'],'mitigation':j['mitigation']+'\x20'+STUCK_POOL_REMEDY})),f=h['risks']['filter'](j=>!i['has'](j['id'])&&(j['level']==='critical'||j['level']==='high'))['map'](j=>({'id':j['id'],'title':j['title'],'mitigation':j['mitigation']}));}catch(j){return c['push']('pre-publish\x20allocators\x20risk\x20scan\x20failed\x20(non-blocking):\x20'+(j instanceof Error?j['message']:String(j))+'\x20—\x20'+'run\x20the\x20recipient\x20constraint\x20audit\x20via\x20query_toolkit\x20service_panorama\x20before\x20publish.'),null;}for(const k of f){c['push']('ALLOCATOR\x20RISK\x20'+k['id']+'\x20(advisory\x20—\x20needs\x20full-evidence\x20review\x20before\x20publish):\x20'+k['title']+'\x20—\x20'+k['mitigation']);}try{const l=Array['isArray'](b?.['allocators'])?b['allocators']:[],m=l['map']((n,o)=>{const p=Array['isArray'](n?.['sharing'])?n['sharing']:[];return p['some'](q=>q?.['who']&&typeof q['who']==='object'&&'GuardIdentifier'in q['who'])?o:-0x1;})['filter'](n=>n>=0x0);m['length']>0x0&&c['push']('REFUND\x20TRACK\x20GUARD\x20GATING\x20(advisory):\x20Allocator(s)\x20['+m['join'](',\x20')+']\x20pay\x20a\x20'+'GuardIdentifier\x20recipient\x20—\x20the\x20order-anchored\x20refund\x20track.\x20Verify\x20the\x20bound\x20guard\x20is\x20'+'NODE-GATED:\x20AND[progress.node==<X>]\x20per\x20refundable\x20node\x20(per-node\x20tracks\x20are\x20the\x20'+'default\x20form\x20—\x20a\x20node\x20set\x20is\x20also\x20expressible\x20via\x20the\x20relies\x20two-level\x20tree:\x20'+'OR-subguard\x20per\x20node\x20under\x20an\x20AND\x20parent).\x20A\x20signer==order.owner\x20leg\x20is\x20OPTIONAL\x20here,\x20'+'not\x20a\x20safety\x20requirement:\x20with\x20a\x20GuardIdentifier\x20recipient\x20the\x20payee\x20is\x20already\x20hard-bound\x20to\x20the\x20'+'order\x20(funds\x20land\x20in\x20the\x20order\x20no\x20matter\x20who\x20triggers),\x20so\x20the\x20signer\x20leg\x20only\x20restricts\x20who\x20may\x20'+'fire\x20the\x20trigger\x20—\x20drop\x20it\x20when\x20keepers\x20or\x20the\x20service\x20should\x20be\x20able\x20to\x20trigger\x20refunds.\x20There\x20is\x20'+'NO\x20on-chain\x20seal\x20between\x20the\x20refund\x20track\x20and\x20a\x20compensation\x20ruling\x20—\x20a\x20claim\x20settling\x20does\x20NOT\x20close\x20'+'this\x20track;\x20enforce\x20any\x20refund-vs-compensation\x20exclusion\x20by\x20gating\x20the\x20guard\x20(e.g.\x20on\x20arb/settlement\x20'+'state)\x20at\x20configuration\x20time.\x20Declare\x20the\x20identifier-254\x20once\x20slot\x20on\x20the\x20'+'refund\x20guard\x20(chain\x20derives\x20the\x20key\x20from\x20payment_info.for_object\x20—\x20unwidenable\x20per-order\x20replay\x20'+'protection;\x20reserve\x20identifier\x20255\x20with\x20a\x20period\x20key\x20for\x20rails\x20that\x20legitimately\x20repeat\x20per\x20period)\x20'+'so\x20a\x20consumed\x20claim\x20cannot\x20re-split\x20the\x20residual.');}catch{}if(d['length']===0x0)return null;const g='⛔\x20SERVICE\x20PUBLISH\x20BLOCKED\x20—\x20order_allocators\x20fails\x20the\x20pre-publish\x20risk\x20scan\x20'+'(the\x20allocation\x20rule\x20kernel,\x20same\x20rules\x20as\x20the\x20template\x20scan).\x0a\x0a'+d['map'](n=>'\x20\x20•\x20'+n['id']+':\x20'+n['title']+'\x0a\x20\x20\x20\x20Fix:\x20'+n['mitigation'])['join']('\x0a')+'\x0a\x0aorder_allocators\x20is\x20PERMANENTLY\x20IMMUTABLE\x20after\x20publish\x20(E_ALREADY_PUBLISHED,\x20'+'no\x20pause+lock\x20exception)\x20—\x20a\x20published\x20misconfiguration\x20locks\x20order\x20funds\x20or\x20aborts\x20'+'every\x20alloc()\x20transaction\x20for\x20the\x20lifetime\x20of\x20this\x20Service.\x20Fix\x20the\x20allocator\x20table\x20'+'and\x20re-issue\x20this\x20operation.\x20This\x20call\x20was\x20NOT\x20executed\x20and\x20no\x20on-chain\x20action\x20was\x20taken.';return{'content':[{'type':'text','text':g}],'structuredContent':{'result':{'type':'error','error':d['map'](n=>n['id']+':\x20'+n['title'])['join']('\x20|\x20'),'error_code':'allocators_risk_blocked','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':JSON['stringify'](d)},'message':'Service\x20publish\x20blocked\x20by\x20the\x20pre-publish\x20allocators\x20risk\x20scan.'}};}async function checkEntityRecipientGate(a,b,c){let d;try{d=await checkEntityRecipients(a);}catch(i){return c?.['push']('R-RECIPIENT-03\x20recipient\x20gate\x20failed\x20(non-blocking):\x20'+(i instanceof Error?i['message']:String(i))),null;}if(d['length']===0x0)return null;const f=d['filter'](j=>j['severity']==='critical'),g=d['filter'](j=>j['severity']!=='critical');for(const j of g){c?.['push'](formatEntityRecipientViolation(j)+'\x20—\x20fix\x20before\x20committing\x20this\x20allocator\x20table.');}if(f['length']===0x0)return null;const h='⛔\x20OPERATION\x20BLOCKED\x20—\x20'+b+'\x20violates\x20'+ENTITY_RECIPIENT_RULE_ID+'\x20'+'(direct-sales\x20Entity\x20recipient\x20rule).\x0a\x0a'+f['map'](k=>'\x20\x20•\x20'+formatEntityRecipientViolation(k))['join']('\x0a')+(g['length']>0x0?'\x0a\x0aAlso\x20reported\x20(non-blocking):\x0a'+g['map'](k=>'\x20\x20•\x20'+formatEntityRecipientViolation(k))['join']('\x0a'):'')+('\x0a\x0a'+describeEntityRecipients(f)+'\x0a\x0a')+'order_allocators\x20is\x20PERMANENTLY\x20IMMUTABLE\x20after\x20publish\x20(no\x20pause+lock\x20escape)\x20—\x20'+'an\x20empty\x20Entity\x20recipient\x20published\x20now\x20silently\x20pays\x20the\x20builder\x20forever.\x20Fix\x20the\x20'+'recipient\x20table\x20and\x20re-issue\x20this\x20operation.\x20This\x20call\x20was\x20NOT\x20executed\x20and\x20no\x20on-chain\x20'+'action\x20was\x20taken.';return{'content':[{'type':'text','text':h}],'structuredContent':{'result':{'type':'error','error':f['map'](k=>k['rule_id']+'\x20allocator['+k['allocator_index']+'].sharing['+k['sharing_index']+']:\x20'+k['reason'])['join']('\x20|\x20'),'error_code':'entity_recipient_invalid','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':describeEntityRecipients(f)},'message':'Operation\x20blocked\x20by\x20'+ENTITY_RECIPIENT_RULE_ID+':\x20an\x20Entity\x20recipient\x20is\x20empty,\x20omitted,\x20or\x20resolves\x20to\x20the\x20deploying\x20account.'}};}function warnAmountEscrowDeadlock(a,b,c){try{const d=Array['isArray'](a?.['allocators'])?a['allocators']:[],e=d['map'](k=>(Array['isArray'](k?.['sharing'])?k['sharing']:[])['filter'](l=>l?.['mode']==='Amount')['reduce']((l,m)=>l+(Number(m?.['sharing']?.['balance'])||0x0),0x0)),f=e['some'](k=>k>0x0);if(!f)return;const g=Array['isArray'](b?.['sales'])?b['sales']:[],h=g['map'](k=>Number(k?.['price']?.['balance']))['filter'](k=>Number['isFinite'](k)&&k>0x0);if(h['length']===0x0)return;const j=h['reduce']((k,l)=>k+l,0x0);for(let k=0x0;k<e['length'];k++){e[k]>j&&c['push']('FIXED-AMOUNT\x20DEADLOCK\x20RISK\x20(advisory):\x20Allocator['+k+']\x20Amount\x20sum='+e[k]+'\x20exceeds\x20the\x20'+('minimum\x20single-order\x20escrow\x20Σ(price×1)='+j+'\x20(sales\x20configured\x20in\x20this\x20call;\x20quantity\x20fixed\x20at\x20buy\x20time).\x20')+'An\x20order\x20smaller\x20than\x20the\x20Amount\x20aborts\x20alloc()\x20with\x20Insufficient\x20balance\x20—\x20if\x20this\x20allocator\x20is\x20the\x20only\x20'+'match\x20on\x20a\x20terminal\x20forward,\x20that\x20order\x27s\x20balance\x20is\x20permanently\x20stranded.\x20Use\x20Rate\x20sharing\x20for\x20'+'penalty/proportional\x20rules\x20(scales\x20with\x20the\x20order),\x20or\x20bound\x20the\x20Amount\x20below\x20the\x20smallest\x20expected\x20order.');}}catch{}}async function checkArbitrationsBeforePublish(a,b,c){if(!Array['isArray'](a)||a['length']===0x0)return null;const d=await resolveNetwork(b?.['network']),e=[],f=[],g=[],h=[];for(const i of a){let j;if(typeof i==='string')j=i['startsWith']('0x')?i:await LocalMark['Instance']()['get_address'](i)['catch'](()=>undefined)??undefined;else{if(i&&typeof i==='object'){const k=i['name']??i['object']??i['address'];typeof k==='string'&&(j=k['startsWith']('0x')?k:await LocalMark['Instance']()['get_address'](k)['catch'](()=>undefined)??undefined);}}if(!j){g['push'](typeof i==='string'?i:JSON['stringify'](i));continue;}try{const l=await query_objects({'objects':[j],'network':d,'no_cache':!![]}),m=l?.['objects']?.[0x0];if(!m||m['type']!=='Arbitration'){g['push'](j);continue;}const n=m['data']??m;if(n['bPaused']===!![])e['push'](j);const o=Array['isArray'](n['voting_guard'])?n['voting_guard']['length']:0x0;if(o===0x0)f['push'](j);const p=typeof n['permission']==='string'?n['permission']:undefined;if(p){const s=await query_objects({'objects':[p],'network':d,'no_cache':!![]}),t=s?.['objects']?.[0x0],u=t?.['data']??t,v=Array['isArray'](u?.['admin'])?u['admin']:[],w=await fetchEntityPermissions(p,d);w['size']===0x0&&h['push'](j+'\x20(admin:\x20'+(v['length']>0x0?v['join'](',\x20'):'unresolved')+')');}}catch{g['push'](j);}}g['length']>0x0&&c['push']('PRE-PUBLISH:\x20Could\x20not\x20resolve/query\x20bound\x20Arbitration(s)\x20['+g['join'](',\x20')+']\x20—\x20'+'verify\x20each\x20is\x20UNPAUSED\x20(new\x20Arbitrations\x20default\x20to\x20bPaused=true;\x20disputes\x20abort\x20with\x20E_PAUSED)\x20'+'and\x20that\x20voting\x20can\x20actually\x20happen:\x20an\x20empty\x20voting_guard\x20means\x20EQUAL\x20vote\x20weight\x20(1\x20person\x201\x20vote),\x20'+'but\x20plain\x20voting\x20still\x20asserts\x20permission\x20358\x20—\x20only\x20the\x20arbitration\x27s\x20bound\x20Permission\x20admin\x20'+'(its\x20creator,\x20by\x20default)\x20and\x20explicit\x20358\x20grantees\x20can\x20vote,\x20so\x20grant\x20358\x20to\x20the\x20disputing\x20'+'parties\x20or\x20configure\x20a\x20voting_guard\x20before\x20relying\x20on\x20a\x20working\x20vote.');f['length']>0x0&&c['push']('C7\x20RISK\x20(concentrated\x20voting):\x20Arbitration(s)\x20['+f['join'](',\x20')+']\x20have\x20an\x20EMPTY\x20voting_guard\x20—\x20'+'this\x20means\x20EQUAL\x20vote\x20weight\x20(1\x20person\x201\x20vote),\x20NOT\x20permissionless.\x20Plain\x20voting\x20asserts\x20'+'permission\x20358\x20on\x20the\x20arbitration\x27s\x20bound\x20Permission,\x20whose\x20admin\x20ALWAYS\x20passes\x20the\x20assert\x20'+'(a\x20fresh\x20Permission\x20seeds\x20its\x20creator\x20as\x20the\x20sole\x20admin;\x20the\x20permission\x20table\x20itself\x20starts\x20empty).\x20'+'So\x20without\x20explicit\x20grants\x20the\x20disputing\x20CUSTOMER\x20can\x20never\x20vote\x20(aborts\x20with\x20code\x205)\x20and\x20every\x20'+'dispute\x20devolves\x20to\x20admin-only\x20voting\x20—\x20the\x20arb\x20admin\x20is\x20both\x20the\x20only\x20voter\x20AND\x20the\x20judge.\x20The\x20'+'service\x20publish\x20gate\x20blocks\x20this\x20shape\x20outright\x20(R-ARB-VOTE-LOCK)\x20when\x20the\x20arb\x20admin\x20also\x20controls\x20'+'the\x20service\x20side;\x20this\x20warning\x20covers\x20the\x20general\x20case.\x20Fix:\x20'+'(1)\x20grant\x20permission\x20358\x20to\x20each\x20disputing\x20party\x20(equal-weight\x20vote\x20among\x20the\x20granted\x20parties),\x20'+'and\x20grant\x20the\x20non-admin\x20operator\x20slots\x20separately\x20—\x20359\x20(ruling)\x20+\x20361\x20(confirm\x20materials)\x20to\x20an\x20'+'EXTERNAL\x20arbitrator,\x20356/357/362-366\x20to\x20any\x20non-admin\x20manager\x20(the\x20creator-admin\x20needs\x20no\x20grants);\x20'+'or\x20(2)\x20for\x20weighted\x20voting,\x20set\x20voting_guard\x20via\x20arbitration\x20voting_guard\x20op=\x22add\x22\x20with\x20'+'a\x20verifier\x20Guard\x20+\x20vote_weight\x20(GuardIdentifier\x20for\x20submitted\x20weights,\x20or\x20FixedValue)\x20—\x20weighted\x20'+'voters\x20then\x20call\x20vote\x20WITH\x20data.vote.voting_guard\x20(plain\x20vote\x20aborts\x20E_VOTING_GUARD_USED\x20once\x20a\x20'+'voting_guard\x20exists;\x20the\x20weighted\x20path\x20authorizes\x20via\x20the\x20guard\x20and\x20does\x20NOT\x20require\x20358).');h['length']>0x0&&c['push']('ADJUDICABILITY\x20RISK\x20(F-34,\x20nnd-tn-261025):\x20bound\x20Arbitration(s)\x20['+h['join'](',\x20')+']\x20hold\x20'+'ZERO\x20adjudication\x20entities\x20on\x20their\x20Permission\x20—\x20the\x20entity\x20table\x20is\x20empty,\x20so\x20NOBODY\x20except\x20the\x20'+'admin\x20can\x20confirm\x20materials,\x20vote,\x20or\x20rule.\x20Disputes\x20can\x20still\x20be\x20FILED\x20(the\x20fee\x20escrows),\x20but\x20'+'there\x20is\x20no\x20on-chain\x20timeout\x20fallback:\x20with\x20an\x20unreachable\x20admin\x20a\x20case\x20stalls\x20forever\x20and\x20the\x20'+'escrowed\x20fee\x20is\x20stranded\x20(nnd-arb\x20live\x20case:\x20a\x20case\x20was\x20filed\x20and\x20paid,\x20no\x20ruling\x20was\x20ever\x20'+'possible).\x20Remedy\x20BEFORE\x20relying\x20on\x20disputes:\x20if\x20the\x20admin\x20account\x20is\x20yours,\x20grant\x20at\x20least\x20one\x20'+'adjudication\x20entity\x20(permission\x20add\x20perm\x20on\x20the\x20arb\x27s\x20Permission:\x20358\x20vote\x20/\x20359\x20ruling\x20/\x20'+'361\x20confirm\x20materials);\x20if\x20the\x20admin\x20is\x20an\x20external\x20third\x20party,\x20confirm\x20they\x20have\x20configured\x20'+'their\x20entity\x20table\x20—\x20otherwise\x20bind\x20an\x20adjudicable\x20arbitration\x20instead.\x20Entities\x20can\x20also\x20be\x20'+'granted\x20after\x20publish,\x20so\x20this\x20is\x20a\x20disclosure,\x20not\x20a\x20blocker\x20—\x20but\x20publishing\x20a\x20Service\x20whose\x20'+'only\x20dispute\x20path\x20is\x20a\x20dead\x20arbitration\x20is\x20a\x20commercial\x20hole\x20buyers\x20inherit.');if(e['length']>0x0){const x='⛔\x20SERVICE\x20PUBLISH\x20BLOCKED\x20—\x20bound\x20Arbitration(s)\x20['+e['join'](',\x20')+']\x20are\x20PAUSED.\x0a\x0a'+'A\x20newly\x20created\x20Arbitration\x20defaults\x20to\x20bPaused=true;\x20while\x20paused,\x20EVERY\x20dispute\x20filing\x20aborts\x20'+'with\x20E_PAUSED\x20—\x20the\x20arbitration\x20mounted\x20on\x20this\x20Service\x20would\x20be\x20decorative\x20(buyers\x20have\x20no\x20'+'working\x20dispute\x20path,\x20and\x20compensation_fund\x20payouts\x20could\x20never\x20be\x20triggered).\x20The\x20on-chain\x20'+'publish\x20check\x20only\x20verifies\x20the\x20arbitrations\x20list\x20is\x20non-empty,\x20NOT\x20that\x20each\x20Arbitration\x20is\x20'+'active\x20—\x20this\x20scan\x20closes\x20that\x20gap.\x0a'+'Fix:\x20issue\x20{operation_type:\x27arbitration\x27,\x20data:{object:\x27<arb>\x27,\x20pause:false}}\x20for\x20each\x20paused\x20'+'Arbitration\x20above,\x20then\x20retry\x20publish=true.\x20This\x20call\x20was\x20NOT\x20executed\x20and\x20no\x20on-chain\x20action\x20was\x20taken.';return{'content':[{'type':'text','text':x}],'structuredContent':{'result':{'type':'error','error':'arbitration_paused:\x20'+e['join'](',\x20'),'error_code':'arbitrations_paused','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':JSON['stringify']({'paused':e,'unpaused_hint':'arbitration\x20data:{object,\x20pause:false}'})},'message':'Service\x20publish\x20blocked:\x20bound\x20Arbitration(s)\x20are\x20paused.'}};}return null;}async function checkRefundRecipientSatisfiability(a,b,c){if(!a||typeof a!=='object')return null;const d=Array['isArray'](a?.['allocators'])?a['allocators']:[],e=[];for(let l=0x0;l<d['length'];l++){const m=Array['isArray'](d[l]?.['sharing'])?d[l]['sharing']:[],n=d[l]?.['guard'];if(typeof n!=='string'||n['length']===0x0)continue;for(const o of m){const p=o?.['who'];p&&typeof p==='object'&&'GuardIdentifier'in p&&e['push']({'allocIdx':l,'guardRef':n,'identifier':p['GuardIdentifier']});}}if(e['length']===0x0)return null;const f=await resolveNetwork(b?.['network']),g=[],h=[],j=new Map();for(const r of e){try{let u=j['get'](r['guardRef']);if(u===undefined){let w=r['guardRef'];!w['startsWith']('0x')&&(w=await LocalMark['Instance']()['get_address'](w)['catch'](()=>undefined)??'');if(!w['startsWith']('0x')){h['push'](r['guardRef']);continue;}const x=await query_objects({'objects':[w],'network':f,'no_cache':!![]}),y=x?.['objects']?.[0x0];if(!y||y['type']!=='Guard'){h['push'](r['guardRef']);continue;}u=y['data']??y,j['set'](r['guardRef'],u);}const v=Array['isArray'](u['table'])?u['table']['find'](z=>z?.['identifier']===r['identifier']):undefined;if(!v||v['b_submission']!==!![])continue;pinsIdentifierToSigner(u['root'],r['identifier'])&&g['push']('Allocator['+r['allocIdx']+']\x20guard\x20'+r['guardRef']+'\x20pins\x20recipient\x20identifier\x20'+r['identifier']+'\x20to\x20context(Signer)');}catch{h['push'](r['guardRef']);}}h['length']>0x0&&c['push']('PRE-PUBLISH:\x20could\x20not\x20fetch\x20Guard(s)\x20['+h['join'](',\x20')+']\x20referenced\x20by\x20GuardIdentifier\x20'+'recipient\x20rows\x20—\x20manually\x20verify\x20each\x20refund\x20guard\x20does\x20NOT\x20pin\x20its\x20recipient\x20identifier\x20to\x20'+'context(Signer)\x20(unsatisfiable\x20against\x20the\x20order-anchored\x20escrow:\x20the\x20submission\x20must\x20equal\x20the\x20'+'Order\x20address,\x20never\x20the\x20signer\x20EOA).');if(g['length']===0x0)return null;const k='⛔\x20SERVICE\x20PUBLISH\x20BLOCKED\x20—\x20refund\x20recipient\x20unsatisfiable\x20(GuardIdentifier\x20x\x20for_object\x20x\x20Guard\x20equality).\x0a\x0a'+g['map'](z=>'\x20\x20•\x20'+z)['join']('\x0a')+'\x0a\x0aThe\x20framework-created\x20order\x20escrow\x20anchors\x20PaymentInfo.for_object\x20to\x20the\x20ORDER\x20object\x20address\x20and\x20'+'the\x20chain\x20asserts\x20every\x20GuardIdentifier\x20recipient\x20submission\x20==\x20that\x20address\x20(ERECIPIENT_NOT_FOR_OBJECT,\x20'+'code\x2015).\x20The\x20guard(s)\x20above\x20ALSO\x20require\x20the\x20same\x20submitted\x20value\x20==\x20context(Signer)\x20—\x20an\x20Order\x20address\x20'+'is\x20never\x20the\x20signer\x20EOA,\x20so\x20the\x20allocator\x20can\x20NEVER\x20execute\x20and\x20order\x20funds\x20strand\x20permanently\x20'+'(order_allocators\x20is\x20immutable\x20after\x20publish;\x20test/10\x20T10-10/T10-18\x20stranded\x200.79\x20WOW\x20this\x20way).\x0a'+'Fix\x20(verified\x20ORDER\x20PATTERN,\x20test/10\x20T10-17):\x20keep\x20the\x20recipient\x20GuardIdentifier(n)\x20as-is,\x20and\x20in\x20the\x20'+'GUARD\x20replace\x20logic_equal(context(Signer),\x20identifier[n])\x20with\x20an\x20ORDER\x20FIELD\x20query\x20binding\x20—\x20'+'logic_equal(order.owner,\x20context(Signer))\x20—\x20then\x20submit\x20the\x20ORDER\x20ADDRESS\x20for\x20identifier\x20n.\x20Funds\x20land\x20'+'in\x20the\x20Order\x20object\x20and\x20the\x20buyer\x20withdraws\x20via\x20order\x20receive:\x27recently\x27.\x0a'+'This\x20call\x20was\x20NOT\x20executed\x20and\x20no\x20on-chain\x20action\x20was\x20taken.';return{'content':[{'type':'text','text':k}],'structuredContent':{'result':{'type':'error','error':'refund_recipient_unsatisfiable:\x20'+g['join'](';\x20'),'error_code':'refund_recipient_unsatisfiable','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Rebuild\x20the\x20refund\x20Guard\x20with\x20order.owner==context(Signer)\x20identity\x20binding\x20and\x20submit\x20the\x20Order\x20address\x20for\x20the\x20recipient\x20identifier;\x20then\x20re-issue\x20service\x20publish'},'message':'Service\x20publish\x20blocked:\x20refund\x20recipient\x20guard\x20contradicts\x20the\x20order-anchored\x20escrow\x20binding.'}};}function pinsIdentifierToSigner(a,b){const c=f=>f?.['type']==='context'&&f?.['context']==='Signer',d=f=>f?.['type']==='identifier'&&f?.['identifier']===b,e=f=>{if(!f||typeof f!=='object')return![];if(f['type']==='logic_equal'||f['type']==='logic_as_u256_equal'){const g=Array['isArray'](f['nodes'])?f['nodes']:[];for(let h=0x0;h<g['length'];h++){for(let k=h+0x1;k<g['length'];k++){if(c(g[h])&&d(g[k]))return!![];if(d(g[h])&&c(g[k]))return!![];}}}if(Array['isArray'](f['nodes'])&&f['nodes']['some'](e))return!![];if(f['node']&&e(f['node']))return!![];if(Array['isArray'](f['parameters'])&&f['parameters']['some'](e))return!![];return![];};return e(a);}function describeArbitrationPayload(a){if(Array['isArray'](a))return a['length']+'\x20item(s)';if(a&&typeof a==='object'&&Array['isArray'](a['objects']))return a['objects']['length']+'\x20item(s)';return'<none>';}function canonicalRecipientKey(a){if(typeof a==='string')return a;const b=classifyRecipient(a);if(b?.['kind']==='entity')return'Entity:'+b['address'];if(b?.['kind']==='signer')return'Signer';if(b?.['kind']==='submission')return'GuardIdentifier:'+b['identifier'];return a!=null?JSON['stringify'](a):undefined;}function normHexAddr(b){return b['toLowerCase']()['replace'](/^0x/,'')['padStart'](0x40,'0');}async function describeAllocatorsNotExtensionDiff(a,b,c){try{if(!a||typeof a!=='object')return undefined;const d=a['object']??a['name'],e=typeof d==='string'?/^0x[0-9a-fA-F]{1,64}$/['test'](d)?d:await LocalMark['Instance']()['get_address'](d):undefined;if(!e)return undefined;const f=b,g=Array['isArray'](f?.['allocators'])?f['allocators']:null;if(!g)return undefined;const h=await query_objects({'objects':[e],'network':c}),k=(h?.['objects']??[])['find'](r=>r?.['object']===e),m=k?.['order_allocators'],n=Array['isArray'](m?.['allocators'])?m['allocators']:null;if(!n)return undefined;const o=[],p=readRawOnchainAmount(m?.['threshold']),q=readRawOnchainAmount(f?.['threshold']);p!==undefined&&q!==undefined&&p!==q&&o['push']('threshold\x20mismatch:\x20submitted\x20'+q+'\x20vs\x20live\x20'+p+'\x20(append\x20requires\x20the\x20SAME\x20threshold)');g['length']<n['length']&&o['push']('length\x20mismatch:\x20submitted\x20'+g['length']+'\x20rail(s)\x20vs\x20live\x20'+n['length']+'\x20(append\x20requires\x20length-or-longer\x20with\x20the\x20live\x20prefix\x20preserved)');if(o['length']===0x0){const r=Math['min'](g['length'],n['length']);for(let t=0x0;t<r&&o['length']===0x0;t++){const u=g[t],v=n[t],w=typeof u?.['guard']==='string'?u['guard']:undefined,x=typeof v?.['guard']==='string'?v['guard']:undefined;if(w&&x&&normHexAddr(w)!==normHexAddr(x)){o['push']('rail\x20'+t+'\x20guard\x20rewritten:\x20submitted\x20'+w+'\x20vs\x20live\x20'+x+'\x20(existing\x20allocators\x20must\x20be\x20preserved\x20verbatim\x20as\x20a\x20prefix)');break;}const y=Array['isArray'](u?.['sharing'])?u['sharing']:[],z=Array['isArray'](v?.['sharing'])?v['sharing']:[];if(y['length']!==z['length']){o['push']('rail\x20'+t+'\x20sharing\x20rows:\x20submitted\x20'+y['length']+'\x20vs\x20live\x20'+z['length']);break;}for(let A=0x0;A<Math['min'](y['length'],z['length'])&&o['length']===0x0;A++){const B=canonicalRecipientKey(y[A]?.['who']),C=canonicalRecipientKey(z[A]?.['who']);if(B&&C&&B!==C){o['push']('rail\x20'+t+'\x20row\x20'+A+'\x20recipient\x20rewritten:\x20submitted\x20'+B+'\x20vs\x20live\x20'+C);break;}const D=readRawOnchainAmount(y[A]?.['sharing']),E=readRawOnchainAmount(z[A]?.['sharing']);if(D!==undefined&&E!==undefined&&D!==E){o['push']('rail\x20'+t+'\x20row\x20'+A+'\x20share\x20rewritten:\x20submitted\x20'+D+'\x20vs\x20live\x20'+E);break;}}}}return o['length']===0x0&&o['push']('no\x20field-level\x20divergence\x20found\x20against\x20the\x20live\x20plan\x20—\x20rebuild\x20the\x20payload\x20from\x20the\x20LIVE\x20plan\x20(query_toolkit\x20service_panorama\x20→\x20result.service.order_allocators,\x20authoring\x20form)\x20and\x20re-submit'),'APPEND\x20REJECTED\x20(EALLOCATORS_NOT_EXTENSION):\x20the\x20submitted\x20plan\x20is\x20NOT\x20a\x20pure\x20extension\x20of\x20the\x20live\x20order_allocators.\x20First\x20divergence:\x20'+o['join'](';\x20')+'.\x20'+'Append\x20shape:\x20same\x20threshold,\x20length-or-longer,\x20every\x20existing\x20allocator\x20preserved\x20verbatim\x20as\x20a\x20prefix,\x20new\x20rails\x20appended\x20after.';}catch{return undefined;}}function readRawOnchainAmount(a){if(typeof a==='number'&&Number['isFinite'](a))return a;if(typeof a==='string'&&/^\d+$/['test'](a['trim']()))return Number(a['trim']());if(a&&typeof a==='object')for(const b of['value','balance','amount']){const c=a[b];if(typeof c==='number'&&Number['isFinite'](c))return c;if(typeof c==='string'&&/^\d+$/['test'](c['trim']()))return Number(c['trim']());}return undefined;}async function expandBareReceiveIds(a,b){const c=a?.['data'];if(!c||typeof c!=='object')return;const d=['receive','owner_receive'],e=[],f=[];for(const l of d){const m=c[l];typeof m==='string'&&/^0x[0-9a-fA-F]{8,}$/['test'](m)&&(e['push'](m),f['push']({'field':l}));}if(e['length']===0x0)return;const g=b??undefined,h=await Config['Instance']()['network_get'](g),j=new WowClient({'url':getFullnodeUrl(h),'network':h}),{objects:k}=await j['core']['getObjects']({'objectIds':e,'include':{'json':!![]}});for(let n=0x0;n<e['length'];n++){const p=f[n]['field'],q=k[n];if(!q||typeof q!=='object'||!q?.['objectId']||!q?.['type'])throw new Error('receive:\x20bare\x20object\x20id\x20\x27'+e[n]+'\x27\x20(field\x20\x27'+p+'\x27)\x20could\x20not\x20be\x20resolved\x20'+('on\x20'+h+'\x20—\x20pass\x20the\x20full\x20received\x20record\x20({id,\x20type,\x20version,\x20digest}),\x20')+'or\x20\x27recently\x27\x20to\x20sweep\x20everything\x20the\x20object\x20received.');c[p]=[{'id':String(q['objectId']),'type':String(q['type']),'content_raw':q['json']??undefined,'version':q['version']!=null?String(q['version']):undefined,'digest':q['digest']!=null?String(q['digest']):undefined}];}}export async function deriveTotalPayIfOmitted(a,b){const c=a?.['order_new']?.['buy'];if(!c)return undefined;if(c['total_pay']!=null){if(c['discount']!=null)return undefined;const e=await catalogTotalWalk(c,a,b)['catch'](()=>null);if(e===null||'error'in e)return undefined;const f=parseTotalPayRaw(c);if(f===undefined||f===e['total'])return undefined;const g=f>e['total']?f-e['total']:e['total']-f;return'total_pay\x20OVERRIDE:\x20explicit\x20'+f+'\x20replaces\x20the\x20catalog\x20derivation\x20'+('Σ\x20price×quantity\x20=\x20'+e['total']+'\x20('+e['lines']['join']('\x20+\x20')+')\x20—\x20drift\x20'+g+'\x20')+(f>e['total']?'ABOVE\x20the\x20catalog\x20total;\x20the\x20excess\x20escrows\x20with\x20the\x20order.\x20Confirm\x20this\x20is\x20intended.':'BELOW\x20the\x20catalog\x20total\x20—\x20without\x20a\x20discount\x20the\x20on-chain\x20quote\x20rejects\x20underpayment\x20(the\x20buy\x20aborts).');}if(c['discount']!=null)throw new Error('buy.total_pay\x20is\x20REQUIRED\x20when\x20a\x20discount\x20is\x20applied\x20—\x20the\x20discounted\x20final\x20total\x20depends\x20on\x20the\x20'+'coupon\x27s\x20live\x20value\x20and\x20must\x20be\x20stated\x20explicitly.\x20Run\x20query_toolkit\x20query_type=\x27service_quote\x27\x20'+'and\x20pass\x20total_pay.balance\x20=\x20the\x20quoted\x20final_total.');const d=await catalogTotalWalk(c,a,b);if('error'in d)throw new Error(d['error']);return c['total_pay']={'balance':d['total']['toString']()},'total_pay\x20auto-derived\x20=\x20'+d['total']['toString']()+'\x20(smallest\x20unit;\x20Σ\x20price×quantity:\x20'+d['lines']['join']('\x20+\x20')+';\x20'+'no\x20discount).\x20Pass\x20total_pay\x20explicitly\x20to\x20pin\x20the\x20amount\x20—\x20REQUIRED\x20when\x20using\x20a\x20discount.';}async function catalogTotalWalk(a,b,c){const d=Array['isArray'](a['items'])?a['items']:[];if(d['length']===0x0)return{'error':'buy.total_pay\x20is\x20omitted\x20and\x20the\x20cart\x20has\x20NO\x20items\x20—\x20there\x20is\x20nothing\x20to\x20derive\x20the\x20payment\x20from'};const e=b?.['object'];if(typeof e!=='string'||e['length']===0x0)return{'error':'buy.total_pay\x20is\x20omitted\x20but\x20the\x20Service\x20reference\x20(data.object)\x20is\x20missing\x20—\x20cannot\x20derive\x20the\x20payment'};const f=e['startsWith']('0x')?e:await LocalMark['Instance']()['get_address'](e)??undefined;if(!f)return{'error':'Service\x20\x27'+e+'\x27\x20could\x20not\x20be\x20resolved\x20—\x20cannot\x20derive\x20total_pay'};const g=await query_serviceContext({'service':f,'network':c}),h=g?.['service'];if(!h)return{'error':'Service\x20\x27'+e+'\x27\x20not\x20found\x20—\x20cannot\x20derive\x20total_pay'};const i=Array['isArray'](h['sales'])?h['sales']:[];let j=0x0n;const k=[];for(const l of d){const m=l?.['name'],n=i['find'](q=>q?.['name']===m);if(!n)return{'error':'cannot\x20derive\x20total_pay:\x20item\x20\x27'+m+'\x27\x20matches\x20NO\x20sale\x20on\x20service\x20\x27'+e+'\x27\x20'+('(available:\x20'+(i['map'](q=>q?.['name'])['filter'](Boolean)['join'](',\x20')||'<none>')+')')};if(n?.['suspension']===!![])return{'error':'cannot\x20derive\x20total_pay:\x20item\x20\x27'+m+'\x27\x20is\x20suspended\x20on\x20service\x20\x27'+e+'\x27'};const o=BigInt(String(n?.['price']?.['balance']??n?.['price']??'0')),p=BigInt(String(l?.['quantity']??l?.['stock']??'1'));if(p<=0x0n)return{'error':'cannot\x20derive\x20total_pay:\x20item\x20\x27'+m+'\x27\x20has\x20non-positive\x20quantity\x20'+p};j+=o*p,k['push'](m+'\x20x'+p+'\x20@\x20'+o);}if(j<=0x0n)return{'error':'derived\x20total_pay\x20would\x20be\x200\x20(all\x20matched\x20sales\x20priced\x200)\x20—\x20pass\x20total_pay\x20explicitly'};return{'total':j,'lines':k};}async function probeOrderNewWipReachability(a,b){const c=a?.['order_new']?.['buy'],d=Array['isArray'](c?.['items'])?c['items']:[];if(d['length']===0x0)return null;const e=a?.['object'];if(typeof e!=='string'||e['length']===0x0)return null;try{const f=e['startsWith']('0x')?e:await LocalMark['Instance']()['get_address'](e)??undefined;if(!f)return null;const g=await query_serviceContext({'service':f,'network':b}),h=Array['isArray'](g?.['service']?.['sales'])?g['service']['sales']:[],i=new Map();for(const j of d){const k=h['find'](o=>o?.['name']===j?.['name']),l=typeof k?.['wip']==='string'?k['wip']:'';if(!l)continue;const m=classifyWipPath(l),n=!m['is_local']&&m['is_network']&&(m['type']==='http_url'||m['type']==='ipfs'&&/^https?:/i['test'](l));if(n)i['set'](String(k['name']??j?.['name']??''),l);}for(const [o,p]of i){const q=await probeWipReachability(p)['catch'](()=>({'ok':![],'reason':'probe\x20failed'}));if(q['ok'])continue;const r=q['status']?'HTTP\x20'+q['status']:q['reason']??'unreachable',s='⛔\x20WIP\x20HOST\x20UNREACHABLE\x20—\x20order\x20NOT\x20created\x20(no\x20money\x20moved)\x0a\x0a'+('The\x20WIP\x20file\x20for\x20sale\x20\x22'+o+'\x22\x20('+p+')\x20is\x20not\x20reachable\x20('+r+').\x20')+'Creating\x20this\x20order\x20would\x20abort\x20100%\x20inside\x20the\x20WIP\x20verification\x20step\x20(F-27:\x20'+'WIP\x20single-host\x20outage\x20—\x20when\x20the\x20host\x20is\x20down,\x20NOBODY\x20can\x20buy\x20from\x20this\x20Service).\x0a\x0a'+'This\x20is\x20NOT\x20a\x20wrong-network\x20problem\x20—\x20do\x20NOT\x20switch\x20networks\x20and\x20do\x20NOT\x20retry\x20blindly.\x0a\x0a'+'Fix:\x0a'+'\x20\x20•\x20Transient\x20outage:\x20retry\x20this\x20order\x20after\x20the\x20host\x20recovers.\x0a'+'\x20\x20•\x20Otherwise:\x20the\x20MERCHANT\x20must\x20redeploy\x20the\x20.wip\x20file\x20to\x20another\x20public\x20endpoint\x20'+'and\x20update\x20sale.wip\x20+\x20wip_hash\x20(GitHub\x20Pages\x20/\x20IPFS\x20/\x20their\x20own\x20site,\x20or\x20wip_file\x20'+'type=\x27upload\x27\x20for\x20the\x20official\x20store).\x0a'+'\x20\x20•\x20Testing\x20only:\x20the\x20merchant\x20can\x20set\x20sale.wip\x20=\x20\x22\x22\x20(empty)\x20to\x20skip\x20WIP\x20verification.';return{'content':[{'type':'text','text':s}],'structuredContent':{'result':{'type':'error','error':'Sale\x20\x22'+o+'\x22\x20wip\x20host\x20unreachable\x20('+r+'):\x20'+p+'.\x20order_new\x20would\x20abort\x20100%\x20in\x20WIP\x20verification\x20(F-27).\x20Not\x20a\x20wrong-network\x20problem.','error_code':'wip_host_unreachable','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Retry\x20after\x20the\x20host\x20recovers\x20(transient\x20outage),\x20or\x20have\x20the\x20merchant\x20redeploy\x20'+'the\x20.wip\x20file\x20to\x20another\x20public\x20endpoint\x20and\x20update\x20sale.wip\x20+\x20wip_hash.\x20'+'Do\x20NOT\x20switch\x20networks.','related_object':o},'message':'WIP\x20host\x20unreachable\x20—\x20order\x20not\x20created.\x20See\x20recovery_hint.'}};}return null;}catch{return null;}}export async function warnOrderNewFundCoverage(a,b){const c=a?.['order_new']?.['buy'];if(!c)return null;const d=parseTotalPayRaw(c);if(d===undefined)return null;if(d<=0x0n)return null;const e=a?.['object'];if(typeof e!=='string'||e['length']===0x0)return null;try{const f=e['startsWith']('0x')?e:await LocalMark['Instance']()['get_address'](e)??undefined;if(!f)return null;const g=await query_serviceContext({'service':f,'network':b}),h=g?.['service'];if(!h)return null;const i=q=>{if(typeof q==='number'&&Number['isFinite'](q)&&q>=0x0)return BigInt(Math['trunc'](q));if(typeof q==='string'&&/^\d+$/['test'](q['trim']()))return BigInt(q['trim']());if(typeof q==='object'&&q!==null){const r=q?.['balance'];if(typeof r==='string'&&/^\d+$/['test'](r['trim']()))return BigInt(r['trim']());}return undefined;},j=i(h?.['compensation_fund']);if(j===undefined||j<=0x0n)return null;const k=0x3n,l=k*d;if(j>=l)return null;const m=(String(h?.['type']??h?.['type_raw']??'')['match'](/<(.+)>$/)??[])[0x1]??'',n=async q=>{try{return m?(await formatChainValue(q,m,b))['display']:q['toString']();}catch{return q['toString']();}},o=j/k,p=l-j;return'FUND\x20COVERAGE\x20WARNING\x20(compensation_fund_below_order_ceiling)\x20—\x20the\x20buy\x20PROCEEDS,\x20'+'but\x20this\x20Service\x27s\x20compensation\x20pool\x20cannot\x20cover\x20a\x20maximum\x20award\x20on\x20this\x20order.\x0a'+('compensation_fund\x20holds\x20'+await n(j)+'\x20(raw\x20'+j+');\x20the\x20payout\x20requirement\x20for\x20THIS\x20')+('order\x20is\x203x\x20'+await n(d)+'\x20=\x20'+await n(l)+'\x20(raw\x20'+l+')\x20—\x20shortfall\x20')+(await n(p)+'\x20(raw\x20'+p+').\x20Consequence\x20if\x20a\x20ruling\x20awards\x20at\x20the\x20cap:\x20settlement\x20')+'is\x20ALL-OR-NOTHING\x20—\x20the\x20claim\x20aborts\x20with\x20code\x2027\x20(E_COMPENSATION_NOT_MATCH),\x20nothing\x20is\x20paid,\x20'+'the\x20claim\x20is\x20NOT\x20consumed,\x20and\x20the\x20winner\x20retries\x20after\x20the\x20merchant\x20tops\x20up.\x20Standing\x20storefront\x20'+('ceiling:\x20at\x20the\x20current\x20fund\x20the\x20largest\x20fully-covered\x20order\x20amount\x20is\x20'+await n(o)+'\x20')+('(raw\x20'+o+',\x20fund/3).\x0a')+('Fix\x20(merchant):\x20service.compensation_fund_add\x20by\x20'+await n(p)+'\x20to\x20fully\x20cover\x20this\x20')+'basket.\x20Alternative\x20(merchant):\x20run\x20WITHOUT\x20pool\x20protection\x20via\x20service.compensation_fund_withdraw\x20—\x20'+'allowed,\x20but\x20it\x20must\x20be\x20a\x20decision,\x20not\x20an\x20accident.';}catch{return null;}}export async function warnBuyCustomerRequiredSelfAttested(a,b){if(!a?.['order_new']?.['buy'])return null;const c=a?.['object'];if(typeof c!=='string'||c['length']===0x0)return null;try{const d=c['startsWith']('0x')?c:await LocalMark['Instance']()['get_address'](c)??undefined;if(!d)return null;const e=await query_serviceContext({'service':d,'network':b}),f=e?.['service']?.['customer_required'];if(!Array['isArray'](f))return null;const g=f['filter'](h=>typeof h==='string'&&h['trim']()!=='');if(g['length']===0x0)return null;return'CUSTOMER\x20INFO\x20REQUEST\x20—\x20SELF-ATTESTED\x20(buyer\x20disclosure):\x20this\x20service\x20declares\x20customer_required\x20'+('and\x20asks\x20you\x20to\x20provide:\x20'+g['join'](',\x20')+'.\x20The\x20chain\x20stores\x20the\x20buyer\x27s\x20claim\x20verbatim\x20and\x20')+'nothing\x20verifies\x20it\x20—\x20the\x20bind\x20path\x20only\x20proves\x20the\x20claim\x20came\x20from\x20this\x20order\x27s\x20owner.\x20There\x20is\x20NO\x20'+'credential\x20check\x20at\x20buy\x20or\x20delivery\x20unless\x20the\x20merchant\x20wired\x20a\x20Proof-backed\x20delivery\x20guard\x20'+'(not\x20wired\x20by\x20default).\x20Treat\x20the\x20information\x20you\x20submit\x20as\x20a\x20self-attested\x20claim,\x20not\x20a\x20'+'chain-verified\x20fact\x20—\x20share\x20only\x20what\x20you\x20are\x20comfortable\x20attesting.';}catch{return null;}}export async function warnBuyGuardTimeCutoff(a,b){if(!a?.['order_new']?.['buy'])return null;const c=a?.['object'];if(typeof c!=='string'||c['length']===0x0)return null;const d=e=>{const f=e?.['data']??e,h=f?.['root'];if(h===undefined||h===null)return undefined;const i=Array['isArray'](f?.['table'])?f['table']:undefined;return{'address':typeof e?.['object']==='string'?e['object']:undefined,'root':h,...i?{'table':i}:{}};};try{const e=c['startsWith']('0x')?c:await LocalMark['Instance']()['get_address'](c)??undefined;if(!e)return null;const f=await query_serviceContext({'service':e,'network':b}),g=f?.['buy_guard'];if(!g?.['object'])return null;const h=[g['object'],...Array['isArray'](g['relies'])?g['relies']:[]]['filter'](s=>typeof s==='string'&&s['length']>0x0);if(h['length']===0x0)return null;const i=await batchQueryObjectsByIds(h,b,!![]),j=(i??[])['filter'](s=>s?.['type']==='Guard')['map'](d)['filter'](s=>s!==undefined);if(j['length']===0x0)return null;const k=deriveTimeWindow({'guards':j['map'](s=>({'guard':s['address']??null,'def':s}))}),l=Date['now'](),m=s=>new Date(s)['toISOString'](),n=s=>s['length']===0x1?'guard\x20'+s[0x0]:'guards\x20'+s['join'](',\x20'),o=k['boundaries']['filter'](s=>s['anchor']!=='absolute')['length'],p=o>0x0?o+'\x20further\x20time\x20leg(s)\x20are\x20node-entry\x20anchored\x20and\x20were\x20NOT\x20evaluated\x20pre-buy\x20(no\x20Progress\x20exists\x20before\x20the\x20order\x20—\x20they\x20verify\x20only\x20after\x20creation).\x20':'',q=0xa*0xea60,r=k['boundaries']['filter'](s=>s['direction']==='closes'&&s['anchor']==='absolute');if(k['deadline_ms']!==null&&l>=k['deadline_ms']&&r['length']>0x0){const s=n(r['map'](t=>String(t['guard']??'?')));return'BUY\x20WINDOW\x20ALREADY\x20CLOSED\x20(S12-④(a)\x20cutoff\x20check)\x20—\x20this\x20buy\x20will\x20very\x20likely\x20ABORT\x20with\x20'+'passport\x20E_VERIFY_FAILED\x20(abort\x207).\x0a'+('The\x20mounted\x20buy_guard\x20carries\x20an\x20ABSOLUTE\x20closing\x20boundary\x20at\x20'+m(k['deadline_ms'])+'\x20')+('(raw\x20'+k['deadline_ms']+'\x20ms),\x20already\x20past\x20the\x20local\x20clock\x20('+m(l)+');\x20read\x20from\x20')+(s+'.\x20'+p)+'Caveat:\x20if\x20the\x20clock\x20leg\x20sits\x20under\x20an\x20OR\x20root,\x20another\x20branch\x20may\x20still\x20admit\x20the\x20buy\x20—\x20'+'the\x20on-chain\x20verify\x20is\x20final.\x0a'+'Fix\x20(merchant):\x20guards\x20are\x20immutable\x20after\x20publish\x20—\x20build\x20a\x20NEW\x20guard\x20with\x20a\x20fresh\x20window\x20'+'and\x20remount\x20it\x20via\x20service.buy_guard.\x20Fix\x20(buyer):\x20pick\x20a\x20service\x20whose\x20buy\x20window\x20is\x20open.';}if(k['earliest_allowed_ms']!==null&&l<k['earliest_allowed_ms']&&k['boundaries']['some'](t=>t['direction']==='opens'&&t['anchor']==='absolute')){const t=Math['round']((k['earliest_allowed_ms']-l)/0xea60);return'BUY\x20WINDOW\x20NOT\x20OPEN\x20YET\x20(S12-④(a)\x20cutoff\x20check)\x20—\x20this\x20buy\x20will\x20very\x20likely\x20ABORT\x20with\x20'+'passport\x20E_VERIFY_FAILED\x20(abort\x207).\x0a'+('The\x20mounted\x20buy_guard\x20opens\x20at\x20'+m(k['earliest_allowed_ms'])+'\x20(raw\x20'+k['earliest_allowed_ms']+'\x20ms)\x20—\x20')+('~'+t+'\x20min\x20from\x20the\x20local\x20clock\x20('+m(l)+').\x20'+p)+'Caveat:\x20if\x20the\x20opening\x20leg\x20sits\x20under\x20an\x20OR\x20root,\x20another\x20branch\x20may\x20still\x20admit\x20the\x20buy\x20—\x20'+'the\x20on-chain\x20verify\x20is\x20final.\x0a'+'Fix:\x20wait\x20until\x20the\x20window\x20opens,\x20or\x20ask\x20the\x20merchant\x20to\x20remount\x20an\x20already-open\x20guard.';}if(k['deadline_ms']!==null&&k['deadline_ms']>l&&k['deadline_ms']-l<=q)return'BUY\x20CUTOFF\x20IMMINENT\x20(S12-④(a)\x20cutoff\x20check):\x20the\x20buy_guard\x27s\x20absolute\x20closing\x20boundary\x20is\x20'+(m(k['deadline_ms'])+'\x20—\x20~'+Math['max'](0x1,Math['round']((k['deadline_ms']-l)/0xea60))+'\x20min\x20from\x20')+('the\x20local\x20clock\x20('+m(l)+').\x20A\x20buy\x20submitted\x20after\x20the\x20cutoff\x20aborts\x20with\x20passport\x20')+'E_VERIFY_FAILED\x20(abort\x207).\x20If\x20this\x20purchase\x20may\x20need\x20more\x20than\x20one\x20attempt,\x20land\x20it\x20before\x20'+'the\x20cutoff.';return null;}catch{return null;}}export async function gateServiceBuyGuardMount(a,b){const c=a?.['buy_guard'];if(typeof c!=='string'||c['trim']()==='')return null;try{const d=c['startsWith']('0x')?c:await LocalMark['Instance']()['get_address'](c)??undefined;if(!d)return null;const e=await batchQueryObjectsByIds([d],b,!![]),f=e?.[0x0];if(!f||f?.['type']!=='Guard')return null;const g=f?.['data']??f,h=Array['isArray'](g?.['table'])?g['table']:[],i=h['some'](k=>Number(k?.['identifier'])===0x0&&k?.['b_submission']===!![]);if(!i)return null;const j='⛔\x20BUY\x20GUARD\x20NOT\x20MOUNTED\x20—\x20this\x20guard\x20can\x20never\x20pass\x20a\x20buy\x20(no\x20state\x20changed)\x0a\x0a'+('Guard\x20\x27'+c+'\x27\x20declares\x20identifier\x200\x20as\x20a\x20SUBMISSION\x20row\x20(b_submission:\x20true).\x20Identifier\x200\x20carries\x20')+'the\x20transacted\x20Order\x20address\x20by\x20protocol\x20convention,\x20and\x20at\x20buy\x20time\x20the\x20order\x20does\x20not\x20exist\x20yet\x20—\x20'+'the\x20purchase\x20verifies\x20the\x20passport\x20BEFORE\x20the\x20order\x20is\x20created,\x20and\x20guard\x20tables\x20are\x20frozen\x20before\x20'+'the\x20call.\x20Mathematically\x20NO\x20passport\x20can\x20satisfy\x20the\x20check,\x20so\x20every\x20buy\x20aborts:\x20the\x20store\x20would\x20be\x20'+'unbuyable\x20while\x20looking\x20open.\x20The\x20chain\x20refuses\x20this\x20mount\x20with\x20code\x2043;\x20this\x20check\x20'+'refuses\x20it\x20here\x20for\x20the\x20same\x20reason.\x0a\x0a'+'Fix:\x20mount\x20a\x20guard\x20that\x20does\x20NOT\x20consume\x20slot\x200.\x20Guards\x20that\x20verify\x20OTHER\x20objects\x20(supply-chain:\x20'+'the\x20buyer\x20submits\x20the\x20MAIN\x20order\x20as\x20evidence)\x20use\x20other\x20slots\x20and\x20stay\x20legal\x20—\x20check\x20the\x20guard\x27s\x20'+'table\x20(query_toolkit\x20query_type=\x27guard_panorama\x27)\x20and\x20remount\x20via\x20service.buy_guard\x20with\x20a\x20compliant\x20guard.';return{'content':[{'type':'text','text':j}],'structuredContent':{'result':{'type':'error','error':'buy_guard\x20\x27'+c+'\x27\x20declares\x20slot\x200\x20as\x20a\x20submission\x20row\x20—\x20a\x20buy\x20can\x20never\x20pass\x20it\x20'+'(slot\x200\x20=\x20the\x20transacted\x20Order\x20address,\x20which\x20does\x20not\x20exist\x20at\x20passport-verify\x20time).','error_code':'buy_guard_order_slot_mount_refused','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Mount\x20a\x20guard\x20whose\x20table\x20does\x20NOT\x20declare\x20identifier\x200\x20as\x20a\x20submission\x20row\x20'+'(b_submission:\x20true).\x20Guards\x20verifying\x20other\x20objects\x20use\x20other\x20slots\x20and\x20stay\x20legal.','related_object':d},'message':'buy_guard\x20not\x20mounted:\x20the\x20guard\x20consumes\x20slot\x200\x20(the\x20transacted\x20Order\x20slot)\x20—\x20no\x20buy\x20could\x20ever\x20pass.\x20See\x20recovery_hint.'}};}catch{return null;}}export function parseTotalPayRaw(a){if(!a)return undefined;const b=c=>{if(typeof c==='string'&&/^\d+$/['test'](c['trim']()))return BigInt(c['trim']());if(typeof c==='number'&&Number['isFinite'](c)&&c>=0x0)return BigInt(Math['trunc'](c));return undefined;};if(typeof a==='object'&&a!==null&&a['total_pay']!==undefined){const c=a['total_pay'];if(typeof c==='object'&&c!==null)return b(c['balance']);return b(c);}return undefined;}export function gateOrderNewZeroTotal(a){const b=a?.['order_new']?.['buy'];if(!b)return null;const c=parseTotalPayRaw(b);if(c===undefined)return null;if(c!==0x0n)return null;const d=typeof a?.['sale']==='string'?a['sale']:undefined,e='⛔\x20ORDER\x20NOT\x20CREATED\x20—\x20the\x20on-chain\x20buy\x20refuses\x20zero-total\x20orders\x20(abort\x2042)\x0a\x0a'+'This\x20buy\x27s\x20total_pay\x20cleared\x20to\x200\x20(100%-off\x20coupon\x20/\x20zero-priced\x20sale'+(d?'\x20on\x20sale\x20\x22'+d+'\x22':'')+').\x20The\x20buy\x20entry\x20asserts\x20total\x20>\x200\x20on-chain\x20'+'(E_ZERO_TOTAL_ORDER,\x20abort\x2042)\x20and\x20rejects\x20the\x20order\x20with\x20a\x20FULL\x20rollback\x20—\x20no\x20order\x20'+'object,\x20no\x20escrow,\x20nothing\x20moves.\x20This\x20client\x20gate\x20mirrors\x20that\x20refusal\x20BEFORE\x20gas\x20is\x20spent.\x0a\x0a'+'Fix\x20(buyer):\x20keep\x20at\x20least\x201\x20raw\x20unit\x20of\x20total_pay\x20—\x20use\x20a\x20smaller\x20coupon\x20so\x20the\x20order\x20total\x20stays\x20'+'above\x20zero,\x20then\x20retry.\x0a'+'Fix\x20(merchant):\x20set\x20a\x20coupon\x20floor\x20so\x20promotions\x20cannot\x20clear\x20the\x20total\x20to\x20zero,\x20and\x20reprice\x20any\x20'+'zero-priced\x20sale\x20to\x20>=\x201\x20raw\x20unit\x20(a\x20zero-priced\x20sale\x20is\x20permanently\x20unbuyable\x20—\x20F-BS-76).\x0a'+'(allow_zero_total\x20does\x20NOT\x20waive\x20the\x20coupon-issuance\x20gate\x20and\x20does\x20NOT\x20unlock\x20a\x20zero-total\x20buy\x20—\x20BSX-F07.)';return{'content':[{'type':'text','text':e}],'structuredContent':{'result':{'type':'error','error':'order\x20total_pay\x20is\x200:\x20the\x20on-chain\x20buy\x20entry\x20refuses\x20zero-total\x20orders\x20(E_ZERO_TOTAL_ORDER,\x20abort\x2042)\x20with\x20full\x20rollback\x20—\x20nothing\x20is\x20created\x20(F-OF2-07\x20/\x20F-azq9-44).','error_code':'order_new_zero_total_dead_order','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'Buyer:\x20retry\x20with\x20a\x20coupon\x20that\x20leaves\x20total_pay\x20>=\x201\x20raw.\x20Merchant:\x20set\x20a\x20coupon\x20floor\x20on\x20the\x20sale\x20so\x20promotions\x20cannot\x20clear\x20the\x20total\x20to\x20zero,\x20and\x20reprice\x20zero-priced\x20sales\x20to\x20>=\x201\x20raw.','related_object':d},'message':'Order\x20not\x20created:\x20the\x20chain\x20refuses\x20zero-total\x20buys\x20(abort\x2042).\x20See\x20recovery_hint.'}};}const REFUND_TERMINAL_REGEX=/(cancel|return|withdraw|refund|exit|expired)/i;export function minCompletionFixedFloor(a,b){const c=new Map(),d=new Map(),h=[];for(const l of b){const m=String(l?.['name']??'');if(!m)continue;for(const o of Array['isArray'](l?.['pairs'])?l['pairs']:[]){const q=String(o?.['prev_node']??'');let r=c['get'](q);!r&&(r=[],c['set'](q,r));r['push'](m);if(q==='')h['push'](m);let s=d['get'](m);!s&&(s=new Set(),d['set'](m,s));for(const t of Array['isArray'](o?.['forwards'])?o['forwards']:[]){if(typeof t?.['guard']==='string'&&t['guard'])s['add'](t['guard']['toLowerCase']());}}}if(h['length']===0x0)return undefined;const i=[],j=(u,v)=>{if(i['length']>=0x100)return;if(v['includes'](u)){i['push']({'nodes':[...v,u],'cycle':!![]});return;}const w=c['get'](u)??[];if(w['length']===0x0){i['push']({'nodes':[...v,u],'cycle':![]});return;}for(const x of w)j(x,[...v,u]);};for(const u of h)j(u,[]);if(i['length']===0x0)return undefined;let k;for(const v of i){if(!v['cycle']&&REFUND_TERMINAL_REGEX['test'](v['nodes'][v['nodes']['length']-0x1]??''))continue;const w=new Set();for(const y of v['nodes']){for(const z of d['get'](y)??[])w['add'](z);}let x=0x0n;for(const A of a){if(A['guard']&&w['has'](A['guard']))x+=A['sum'];}if(k===undefined||x<k)k=x;}return k;}export const KEEPER_DUAL_PAYOUT_DIRECTIVE='KEEPER\x20DIRECTIVE\x20(automation):\x20this\x20refusal\x20is\x20a\x20HARD\x20STOP.\x20(1)\x20Never\x20retry\x20this\x20call\x20unchanged\x20—\x20'+'the\x20gate\x20re-fires\x20on\x20the\x20same\x20on-chain\x20facts\x20every\x20time.\x20(2)\x20NEVER\x20set\x20acknowledge_dual_payout\x20yourself\x20'+'to\x20push\x20the\x20call\x20through\x20—\x20the\x20flag\x20is\x20the\x20HUMAN\x20operator\x27s\x20netting\x20decision,\x20not\x20an\x20automation\x20input,\x20and\x20'+'since\x20D-1\x20it\x20is\x20honored\x20ONLY\x20when\x20the\x20store\x20already\x20carries\x20a\x20human-recorded\x20preauthorization\x20'+'(config_operation\x20store_dual_payout_get\x20shows\x20preauthorized=true).\x20(3)\x20End\x20this\x20keeper\x20step\x20for\x20this\x20order\x20'+'and\x20escalate\x20to\x20the\x20human\x20operator,\x20attaching\x20this\x20refusal\x20plus\x20the\x20facts\x20it\x20names\x20(order\x20address,\x20arb\x20case,\x20'+'claimed_by,\x20indemnity,\x20escrow\x20balance).\x20The\x20human\x20operator\x20then\x20either\x20(a)\x20records\x20the\x20store-level\x20'+'preauthorization\x20ONCE\x20via\x20config_operation\x20store_dual_payout_set\x20{account,\x20confirm:true}\x20—\x20the\x20merchant\x27s\x20'+'standing\x20netting\x20decision\x20—\x20and\x20the\x20same\x20call\x20with\x20acknowledge_dual_payout:true\x20then\x20proceeds,\x20or\x20(b)\x20cancels\x20'+'the\x20step.\x20Retrying\x20in\x20a\x20loop\x20wastes\x20gas;\x20exiting\x20silently\x20strands\x20the\x20payout.';export async function storeDualPayoutVerdict(a){const b=typeof a?.['account']==='string'?a['account']['trim']():'';if(b==='')return{'account':undefined,'authorized':![]};let c;if(/^0x[0-9a-fA-F]{64}$/['test'](b))c=b['toLowerCase']();else try{const e=await LocalMark['Instance']()['get_address'](b)['catch'](()=>undefined)??undefined;c=typeof e==='string'&&/^0x[0-9a-fA-F]{64}$/['test'](e)?e['toLowerCase']():undefined;}catch{}if(!c||!isDualPayoutPreauthorized(c))return{'account':c,'authorized':![]};const d=getStoreDualPayoutPolicy(c);return{'account':c,'authorized':d?.['preauthorized']===!![],...d?.['authorized_at']?{'authorized_at':d['authorized_at']}:{}};}export function arbClaimEscrowEmptyDualPayout(a){const {orderAmount:b,escrowBalance:c,poolValue:d,acknowledged:e}=a;if(b===undefined||b<=0x0)return null;if(c!==0x0)return null;if(d!==undefined&&d<=0x0)return null;return e?'acknowledged':'refuse';}export function awardPoolCapacityPosture(a){const {indemnity:b,pool:c,orderAmount:d}=a;if(!Number['isFinite'](b))return'pool_unknown';if(b===0x0)return'zero_award';if(d!==undefined&&d>0x0&&b>0x3*d)return'over_ceiling';if(c===0x0)return'pool_empty';if(c!==undefined&&c<b)return'pool_underfunded';if(c!==undefined)return'covered';return'pool_unknown';}export function awardPoolCapacityReceipt(a,b){const {indemnity:c,pool:d,orderAmount:e}=b,f='AWARD\x20≠\x20RECEIPT:\x20a\x20ruling\x20writes\x20the\x20indemnity\x20on\x20the\x20Arb\x20case\x20and\x20moves\x20NO\x20funds\x20—\x20the\x20buyer\x20is\x20paid\x20'+'only\x20when\x20order.arb_claim_compensation\x20executes\x20against\x20the\x20Service\x27s\x20merchant-prepaid\x20compensation_fund.';switch(a){case'zero_award':return'ZERO-AMOUNT\x20RULING\x20(award\x20≠\x20receipt):\x20indemnity\x200\x20records\x20a\x20DENIAL\x20—\x20this\x20ruling\x20pays\x20nothing\x20'+'now\x20and\x20its\x20claim\x20path\x20pays\x20nothing\x20either\x20(the\x20claim\x20only\x20closes\x20the\x20case\x20and\x20consumes\x20its\x20'+'one-shot\x20latch).\x20State\x20the\x20zero\x20award\x20in\x20the\x20feedback\x20so\x20the\x20parties\x20do\x20not\x20read\x20the\x20ruling\x20'+'success\x20as\x20a\x20payout.';case'over_ceiling':return'RULING\x20WILL\x20ABORT\x20(3x\x20ceiling):\x20indemnity\x20'+c+'\x20exceeds\x20the\x20on-chain\x20award\x20cap\x20of\x20'+('3x\x20the\x20order\x20amount\x20('+e+')\x20=\x20'+0x3*(e??0x0)+'\x20raw\x20units\x20—\x20the\x20ruling\x20entry\x20')+'aborts\x20on-chain.\x20Re-issue\x20with\x20indemnity\x20<=\x20the\x20cap.';case'pool_empty':return'AWARD\x20POOL\x20EMPTY\x20—\x20UNPAYABLE\x20AWARD:\x20the\x20Service\x27s\x20compensation_fund\x20reads\x200;\x20the\x20pool\x20can\x20'+('currently\x20pay\x200\x20and\x20this\x20case\x20needs\x20'+c+'\x20(raw\x20units).\x20The\x20ruling\x20itself\x20still\x20succeeds\x20')+'(state\x20only),\x20but\x20the\x20buyer\x27s\x20later\x20arb_claim_compensation\x20aborts\x20with\x20code\x2027\x20'+'(E_COMPENSATION_NOT_MATCH)\x20until\x20the\x20merchant\x20tops\x20up\x20via\x20service\x20compensation_fund_add\x20'+('(>=\x20'+c+').\x20'+f+'\x20Either\x20top\x20up\x20before\x20ruling,\x20or\x20record\x20the\x20shortfall\x20in\x20the\x20feedback.');case'pool_underfunded':return'AWARD\x20EXCEEDS\x20POOL\x20CAPACITY:\x20the\x20pool\x20can\x20currently\x20pay\x20'+d+'\x20(raw\x20units)\x20and\x20this\x20case\x20'+('needs\x20'+c+'.\x20The\x20ruling\x20succeeds\x20(state\x20only),\x20but\x20the\x20claim\x20aborts\x20with\x20code\x2027\x20until\x20')+('the\x20merchant\x20tops\x20up\x20via\x20service\x20compensation_fund_add\x20(>=\x20'+c+').\x20'+f);case'covered':return'AWARD\x20POOL\x20COVERED:\x20the\x20pool\x20can\x20currently\x20pay\x20'+d+'\x20and\x20this\x20case\x20needs\x20'+c+'\x20'+'(raw\x20units).\x20Concurrent\x20claims\x20share\x20the\x20same\x20per-Service\x20pool\x20—\x20the\x20balance\x20is\x20not\x20reserved\x20'+('for\x20this\x20case.\x20'+f);default:return'AWARD\x20≠\x20RECEIPT:\x20this\x20ruling\x20writes\x20indemnity\x20'+c+'\x20(raw\x20units)\x20on\x20the\x20case\x20and\x20moves\x20'+'NO\x20funds\x20—\x20the\x20buyer\x20is\x20paid\x20only\x20at\x20order.arb_claim_compensation\x20from\x20the\x20Service\x27s\x20'+'merchant-prepaid\x20compensation_fund.\x20The\x20pool\x20balance\x20could\x20not\x20be\x20probed\x20this\x20session;\x20verify\x20'+'the\x20fund\x20covers\x20the\x20award\x20before\x20relying\x20on\x20the\x20payout.';}}export function claimPoolInsufficient(a){const {indemnity:b,pool:c}=a;return b!==undefined&&b>0x0&&c!==undefined&&c<b;}export function disputeFeeReceipt(a){const {venueFee:b}=a;if(b===0x0)return'CASE\x20FEE\x20=\x200\x20(venue\x20fee\x20unset):\x20this\x20case\x20escrows\x20NOTHING\x20—\x20the\x20entire\x20dispute.fee\x20coin\x20refunds\x20'+'to\x20the\x20filer\x20in\x20the\x20same\x20transaction,\x20the\x20created\x20Arb\x27s\x20fee\x20reads\x200,\x20and\x20the\x20arbitrator\x20earns\x20no\x20'+'per-case\x20fee\x20(arb_withdraw\x20later\x20has\x20nothing\x20to\x20pull).\x20To\x20charge\x20a\x20real\x20fee,\x20the\x20VENUE\x20sets\x20it\x20'+'first:\x20{operation_type:\x27arbitration\x27,\x20data:{object:\x27<venue>\x27,\x20fee:<amount>}}\x20(permission\x20357);\x20'+'filing\x20then\x20requires\x20balance\x20>=\x20that\x20fee.';if(b!==undefined&&b>0x0)return'CASE\x20FEE\x20'+b+'\x20(raw\x20units):\x20the\x20case\x20escrows\x20the\x20VENUE\x27s\x20configured\x20fee\x20—\x20NOT\x20the\x20'+'dispute.fee\x20amount;\x20any\x20excess\x20attached\x20above\x20the\x20venue\x20fee\x20refunds\x20to\x20the\x20filer\x20in\x20the\x20same\x20'+'transaction.\x20Fee\x20cash-out\x20path:\x20arb_withdraw\x20→\x20fees_transfer\x20→\x20treasury\x20receive.';return undefined;}export async function gateOrderNewAmountLegCoverage(b,c){const d=b?.['order_new']?.['buy'];if(!d)return null;const e=parseTotalPayRaw(d);if(e===undefined)return null;if(e<=0x0n)return null;const f=b?.['object'];if(typeof f!=='string'||f['length']===0x0)return null;try{const g=f['startsWith']('0x')?f:await LocalMark['Instance']()['get_address'](f)??undefined;if(!g)return null;const h=await query_objects({'objects':[g],'network':c}),i=(h?.['objects']??[])['find'](o=>o?.['object']===g||o?.['type']==='Service');if(!i||i['type']!=='Service')return null;const j=i?.['order_allocators'],k=Array['isArray'](j?.['allocators'])?j['allocators']:null;if(!k)return null;const l=[];for(const o of k){const p=Array['isArray'](o?.['sharing'])?o['sharing']:[];let q=0x0n;for(const s of p){const t=typeof s?.['sharing']==='string'&&/^\d+$/['test'](s['sharing']['trim']())?BigInt(s['sharing']['trim']()):undefined;if(s?.['mode']===0x0&&t!==undefined)q+=t;}if(q>0x0n)l['push']({'guard':String(o?.['guard']??'')['toLowerCase'](),'sum':q});}if(l['length']===0x0)return null;let m;try{const u=i?.['machine']??i?.['data']?.['machine'];if(typeof u==='string'&&u['length']>0x0){const v=await fetchMachineNodes(String(u),c,![]);m=minCompletionFixedFloor(l,Array['isArray'](v)?v:[]);}}catch{m=undefined;}if(m===undefined)return null;if(e>=m)return null;const n='⛔\x20ORDER\x20NOT\x20CREATED\x20—\x20the\x20escrow\x20can\x20never\x20cover\x20this\x20Service\x27s\x20fixed\x20settlement\x20legs\x20(no\x20money\x20moved)\x0a\x0a'+('Service\x20\x27'+f+'\x27\x20order_allocators\x20carry\x20fixed-Amount\x20legs\x20totalling\x20'+m+'\x20(raw)\x20on\x20EVERY\x20')+'completion\x20route,\x20'+('but\x20THIS\x20order\x20anchors\x20only\x20'+e+'\x20(raw).\x20The\x20on-chain\x20allocation\x20requires\x20the\x20balance\x20to\x20')+'cover\x20each\x20fixed\x20leg\x20at\x20every\x20fire,\x20so\x20a\x20release\x20would\x20abort\x20EINSUFFICIENT_BALANCE\x20and\x20the\x20order\x20would\x20deadlock\x20'+'mid-journey\x20with\x20money\x20already\x20escrowed.\x0a\x0a'+'Fix:\x0a'+('\x20\x20•\x20Buyer:\x20pay\x20the\x20full\x20listed\x20price\x20(order\x20amount\x20>=\x20'+m+'\x20raw)\x20—\x20partial/discounted\x20amounts\x20')+'cannot\x20complete\x20this\x20Service\x27s\x20staged\x20releases.\x0a'+'\x20\x20•\x20Merchant:\x20to\x20sell\x20at\x20a\x20lower\x20price,\x20reprice\x20the\x20SKUs\x20(sales\x20price)\x20—\x20the\x20fixed\x20legs\x20are\x20'+'immutable\x20after\x20publish\x20(order_allocators\x20append-only),\x20so\x20the\x20LEGS\x20define\x20the\x20floor,\x20not\x20the\x20sticker.';return{'content':[{'type':'text','text':n}],'structuredContent':{'result':{'type':'error','error':'Fixed-Amount\x20settlement\x20legs\x20total\x20'+m+'\x20raw\x20on\x20every\x20completion\x20route\x20but\x20the\x20order\x20anchors\x20'+e+'\x20raw\x20—\x20a\x20release\x20would\x20abort\x20EINSUFFICIENT_BALANCE\x20and\x20deadlock\x20the\x20order\x20mid-journey.','error_code':'order_below_fixed_leg_sum','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Pay\x20at\x20least\x20the\x20fixed-leg\x20total,\x20or\x20have\x20the\x20merchant\x20reprice\x20the\x20SKUs.\x20The\x20legs\x20are\x20'+'immutable\x20after\x20publish\x20(order_allocators\x20append-only)\x20—\x20they\x20define\x20the\x20price\x20floor.','related_object':g},'message':'Order\x20not\x20created:\x20the\x20order\x20amount\x20is\x20below\x20the\x20Service\x27s\x20fixed\x20settlement-leg\x20total.\x20See\x20recovery_hint.'}};}catch{return null;}}const SALE_ITEM_OPS=new Set(['price_add','price_reduce','stock_add','stock_reduce','sale_suspension']);function salePriceRaw(a){const b=a?.['price']?.['balance']??a?.['price'];if(typeof b==='string'&&/^\d+$/['test'](b['trim']()))return BigInt(b['trim']());if(typeof b==='number'&&Number['isFinite'](b)&&b>=0x0)return BigInt(Math['trunc'](b));return undefined;}function saleStockRaw(a){const b=a?.['stock'];if(typeof b==='string'&&/^\d+$/['test'](b['trim']()))return BigInt(b['trim']());if(typeof b==='number'&&Number['isFinite'](b)&&b>=0x0)return BigInt(Math['trunc'](b));return undefined;}export async function prepareSaleItemOp(a,b){const c=a?.['sales']?.['op'],d=typeof c==='string'&&SALE_ITEM_OPS['has'](c)?c:a?.['restock']?.['op']==='flag'?'restock_flag':undefined;if(!d)return null;const e=d==='restock_flag'?a?.['restock']?.['sale_name']:a?.['sales']?.['sale_name'];if(typeof e!=='string'||e['length']===0x0)return null;const f=a?.['object'];if(typeof f!=='string'||f['length']===0x0)return null;try{const g=f['startsWith']('0x')?f:await LocalMark['Instance']()['get_address'](f)??undefined;if(!g)return null;const h=await query_serviceContext({'service':g,'network':b}),i=Array['isArray'](h?.['service']?.['sales'])?h['service']['sales']:[],j=i['find'](k=>typeof k?.['name']==='string'&&k['name']===e);if(!j){const k=i['map'](o=>String(o?.['name']??''))['filter'](o=>o['length']>0x0),l=e['trim']()['toLowerCase'](),m=k['find'](o=>o['trim']()['toLowerCase']()===l),n='⛔\x20SALE\x20OP\x20NOT\x20SENT\x20—\x20unknown\x20sale_name\x20(no\x20money\x20moved,\x20no\x20gas\x20spent)\x0a\x0a'+('\x22'+d+'\x22\x20names\x20sale\x20\x22'+e+'\x22,\x20which\x20does\x20NOT\x20exist\x20on\x20service\x20\x27'+f+'\x27.\x20')+'On-chain\x20this\x20op\x20would\x20abort\x20(code\x2032)\x20after\x20burning\x20gas\x20—\x20the\x20MCP\x20refuses\x20it\x20here\x20instead.\x0a\x0a'+('Available\x20sales:\x20'+(k['length']>0x0?k['map'](o=>'\x22'+o+'\x22')['join'](',\x20'):'<none>')+'\x0a')+(m?'Did\x20you\x20mean\x20\x22'+m+'\x22?\x0a':'')+'Fix:\x20copy\x20the\x20sale_name\x20EXACTLY\x20from\x20the\x20live\x20sales\x20list\x20(query_toolkit\x20/\x20service\x20context),\x20then\x20retry.';return{'block':{'content':[{'type':'text','text':n}],'structuredContent':{'result':{'type':'error','error':'sale_name\x20\x22'+e+'\x22\x20matches\x20no\x20sale\x20on\x20service\x20\x27'+f+'\x27;\x20the\x20on-chain\x20op\x20would\x20abort\x20with\x20code\x2032.\x20'+('Available\x20sales:\x20'+(k['length']>0x0?k['map'](o=>'\x22'+o+'\x22')['join'](',\x20'):'<none>')+'.')+(m?'\x20Did\x20you\x20mean\x20\x22'+m+'\x22?':''),'error_code':'sale_item_op_unknown_sale_name','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Copy\x20the\x20sale_name\x20exactly\x20from\x20the\x20live\x20sales\x20list'+(m?'\x20(did\x20you\x20mean\x20\x22'+m+'\x22?)':'')+',\x20then\x20retry.','related_object':g},'message':'Sale\x20op\x20not\x20sent:\x20unknown\x20sale_name.\x20See\x20recovery_hint.'}}};}return{'prep':{'op':d,'saleName':e,'before':{'price':salePriceRaw(j),'stock':saleStockRaw(j),'suspension':typeof j?.['suspension']==='boolean'?j['suspension']:undefined,'restock':typeof j?.['restock_on_refund']==='boolean'?j['restock_on_refund']:undefined}}};}catch{return null;}}export async function prepareRestockOrderOp(a,b){if(a?.['restock']?.['op']!=='order')return null;const c=a?.['restock']?.['order'],d=a?.['object'];if(typeof c!=='string'||c['length']===0x0)return null;if(typeof d!=='string'||d['length']===0x0)return null;try{const [e,f]=await Promise['all']([d['startsWith']('0x')?Promise['resolve'](d):LocalMark['Instance']()['get_address'](d),c['startsWith']('0x')?Promise['resolve'](c):LocalMark['Instance']()['get_address'](c)]),g=normAddr(e),h=normAddr(f);if(!g||!h)return null;const i=await batchQueryObjectsByIds([h],b,!![]),j=normAddr(rootOf(i[0x0])['service']);if(i['length']>0x0&&j!==undefined&&j!==g){const l='⛔\x20RESTOCK\x20NOT\x20SENT\x20—\x20foreign\x20order\x20(no\x20money\x20moved,\x20no\x20gas\x20spent)\x0a\x0a'+('restock\x20op:\x27order\x27\x20targets\x20order\x20\x27'+c+'\x27,\x20which\x20belongs\x20to\x20service\x20')+('\x27'+j+'\x27,\x20NOT\x20\x27'+d+'\x27.\x20On-chain\x20this\x20call\x20would\x20abort\x20(code\x2026)\x20')+'after\x20burning\x20gas\x20—\x20the\x20MCP\x20refuses\x20it\x20here\x20instead.\x0a\x0a'+'Why:\x20restock\x20is\x20ownership-bound\x20—\x20only\x20an\x20order\x20of\x20THIS\x20service\x20can\x20put\x20its\x20units\x20'+'back\x20on\x20this\x20storefront\x20(a\x20merchant\x20feeding\x20any\x20visible\x20order\x20into\x20its\x20own\x20store\x20'+'would\x20inflate\x20stock).\x0a'+'Fix:\x20run\x20the\x20restock\x20against\x20the\x20order\x27s\x20OWN\x20service.';return{'content':[{'type':'text','text':l}],'structuredContent':{'result':{'type':'error','error':'order\x20\x27'+c+'\x27\x20belongs\x20to\x20service\x20\x27'+j+'\x27,\x20not\x20\x27'+d+'\x27;\x20the\x20on-chain\x20restock\x20would\x20abort\x20with\x20code\x2026.','error_code':'restock_order_foreign_service','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'Run\x20restock\x20op:\x27order\x27\x20against\x20the\x20service\x20the\x20order\x20was\x20placed\x20on\x20(the\x20order\x27s\x20service\x20binding).','related_object':g},'message':'Restock\x20not\x20sent:\x20foreign\x20order.\x20See\x20recovery_hint.'}};}const k=await batchReadAddressKeyedFields(g,[h],b,!![]);if(k['has'](h)){const m='⛔\x20RESTOCK\x20NOT\x20SENT\x20—\x20already\x20applied\x20(no\x20money\x20moved,\x20no\x20gas\x20spent)\x0a\x0a'+('The\x20purchased\x20units\x20of\x20order\x20\x27'+c+'\x27\x20were\x20ALREADY\x20put\x20back\x20on\x20the\x20shelf\x20of\x20')+('\x27'+d+'\x27\x20—\x20restock\x20is\x20once-per-order,\x20and\x20a\x20second\x20call\x20would\x20stack\x20the\x20')+'quantity\x20again.\x20On-chain\x20this\x20call\x20would\x20abort\x20(code\x2049)\x20after\x20burning\x20gas;\x20the\x20'+'MCP\x20refuses\x20it\x20here\x20instead.\x0a\x0a'+'No\x20retry\x20will\x20succeed\x20—\x20the\x20stock\x20restoration\x20for\x20this\x20order\x20is\x20complete.\x20'+'Query\x20the\x20item\x27s\x20current\x20stock\x20to\x20confirm\x20the\x20units\x20are\x20back.';return{'content':[{'type':'text','text':m}],'structuredContent':{'result':{'type':'error','error':'order\x20\x27'+c+'\x27\x20was\x20already\x20restocked\x20on\x20\x27'+d+'\x27;\x20restock\x20is\x20once-per-order\x20and\x20the\x20on-chain\x20replay\x20would\x20abort\x20with\x20code\x2049.','error_code':'restock_order_already_applied','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'No\x20retry\x20will\x20succeed\x20—\x20the\x20restoration\x20is\x20already\x20complete.\x20Check\x20the\x20sale\x20item\x27s\x20stock\x20to\x20confirm.','related_object':g},'message':'Restock\x20not\x20sent:\x20already\x20applied\x20for\x20this\x20order.\x20See\x20recovery_hint.'}};}return null;}catch{return null;}}export async function emitSaleItemOpReadback(a,b,c,d){try{const e=b?.['object'];if(typeof e!=='string'||e['length']===0x0)return;const f=e['startsWith']('0x')?e:await LocalMark['Instance']()['get_address'](e)??undefined;if(!f)return;const g=await query_serviceContext({'service':f,'network':c}),h=Array['isArray'](g?.['service']?.['sales'])?g['service']['sales']:[],i=h['find'](p=>typeof p?.['name']==='string'&&p['name']===a['saleName']);if(!i){d['push']('SALE\x20OP\x20READ-BACK:\x20\x22'+a['op']+'\x22\x20on\x20\x22'+a['saleName']+'\x22\x20—\x20the\x20sale\x20is\x20GONE\x20from\x20the\x20live\x20list\x20after\x20the\x20tx\x20'+'(removed\x20concurrently?).\x20Verify\x20with\x20query_toolkit\x20before\x20relying\x20on\x20it.');return;}const j={'price':salePriceRaw(i),'stock':saleStockRaw(i),'suspension':typeof i?.['suspension']==='boolean'?i['suspension']:undefined,'restock':typeof i?.['restock_on_refund']==='boolean'?i['restock_on_refund']:undefined},k=a['op']==='sale_suspension'?'suspension':a['op']==='restock_flag'?'restock':a['op']['startsWith']('price')?'price':'stock',l=p=>p===undefined?'<unreadable>':p['toString'](),m=p=>p===undefined?'<unreadable>':String(p),n=k==='price'?'price:\x20'+l(a['before']['price'])+'\x20→\x20'+l(j['price'])+'\x20(raw)':k==='stock'?'stock:\x20'+l(a['before']['stock'])+'\x20→\x20'+l(j['stock'])+'\x20(units)':k==='restock'?'restock_on_refund:\x20'+m(a['before']['restock'])+'\x20→\x20'+m(j['restock']):'suspension:\x20'+m(a['before']['suspension'])+'\x20→\x20'+m(j['suspension']),o=k==='price'?a['before']['price']!==undefined&&j['price']!==undefined&&a['before']['price']!==j['price']:k==='stock'?a['before']['stock']!==undefined&&j['stock']!==undefined&&a['before']['stock']!==j['stock']:k==='restock'?a['before']['restock']!==undefined&&j['restock']!==undefined&&a['before']['restock']!==j['restock']:a['before']['suspension']!==undefined&&j['suspension']!==undefined&&a['before']['suspension']!==j['suspension'];d['push'](o?'SALE\x20OP\x20READ-BACK:\x20\x22'+a['op']+'\x22\x20landed\x20on\x20\x22'+a['saleName']+'\x22\x20—\x20'+n+'.':'SALE\x20OP\x20READ-BACK:\x20\x22'+a['op']+'\x22\x20on\x20\x22'+a['saleName']+'\x22\x20left\x20the\x20target\x20field\x20UNCHANGED\x20('+n+')\x20—\x20'+'a\x20saturated\x20stock\x20reduce\x20or\x20a\x20same-value\x20write;\x20confirm\x20this\x20is\x20intended.');}catch{}}async function emitMachineNodeReadback(a,b,c,d,e,f,g){const h=e?.['digest'];if(typeof h!=='string'||!h)return;const i=ResponseData(e)['filter'](q=>typeof q?.['type_raw']==='string'&&q['type_raw']['includes']('::machine::Machine')),j=i['filter'](q=>q?.['change']==='created'&&typeof q?.['object']==='string'),k=i['filter'](q=>q?.['change']==='mutated'&&typeof q?.['object']==='string'),l=j[0x0]?.['object']??k[0x0]?.['object'];if(j['length']>0x0&&a){const q=recordMachineCreation(a,j[0x0]['object']);if(q['length']>0x0){const r=q[q['length']-0x1];g['push']('MACHINE\x20FORK\x20(chunked-publish\x20split-brain,\x20gf29\x20F-16):\x20this\x20call\x20CREATED\x20Machine\x20'+j[0x0]['object']+'\x20'+('but\x20\x22'+r['label']+'\x22\x20already\x20created\x20Machine\x20'+r['address']+'\x20earlier\x20in\x20this\x20session\x20')+('('+q['length']+'\x20prior\x20creation(s)\x20under\x20this\x20ref).\x20An\x20unresolvable\x20object\x20ref\x20means\x20CREATE\x20on-chain\x20—\x20')+'a\x20chunked\x20publish\x20that\x20re-sends\x20the\x20same\x20{name}\x20ref\x20forks\x20again\x20per\x20chunk,\x20and\x20the\x20Service\x20binds\x20'+'whichever\x20machine\x20you\x20point\x20it\x20at\x20while\x20the\x20others\x27\x20nodes\x20are\x20orphaned.\x20Every\x20continuation\x20chunk\x20'+'must\x20reference\x20the\x20machine\x20ADDRESS\x20(0x...),\x20or\x20carry\x20the\x20full\x20node\x20set\x20in\x20ONE\x20call.\x20Before\x20going\x20'+'further:\x20query\x20both\x20machines,\x20keep\x20the\x20one\x20holding\x20the\x20complete\x20node\x20set,\x20and\x20bind\x20THAT\x20address.');}}if(!l)return;const m=Array['isArray'](d)?d['map'](s=>s&&typeof s==='object'&&typeof s['name']==='string'?s['name']:'')['filter'](Boolean):[];if(m['length']===0x0&&b['beforeCount']===undefined)return;let n;try{n=(await fetchMachineNodes(l,f,!![]))['map'](s=>s['name']);}catch{return;}if(n['length']===0x0)return;const o=b['beforeCount']!==undefined?'nodes\x20'+b['beforeCount']+'\x20→\x20'+n['length']:'nodes\x20now\x20'+n['length'];if(c==='remove'){const s=m['filter'](t=>n['includes'](t));m['length']>0x0&&s['length']>0x0&&g['push']('MACHINE\x20NODE\x20READ-BACK\x20(gf29\x20F-16):\x20PARTIAL\x20REMOVE\x20—\x20machine\x20'+l+'\x20('+o+')\x20still\x20holds\x20'+('['+s['join'](',\x20')+']\x20after\x20this\x20remove.\x20Re-read\x20before\x20concluding\x20(index\x20lag\x20is\x20possible)\x20')+'and\x20re-send\x20the\x20missing\x20removes\x20referencing\x20the\x20machine\x20ADDRESS.');return;}const p=m['filter'](t=>!n['includes'](t));if(m['length']>0x0&&p['length']>0x0)g['push']('MACHINE\x20NODE\x20READ-BACK\x20(gf29\x20F-16):\x20PARTIAL\x20WRITE\x20—\x20machine\x20'+l+'\x20holds\x20'+n['length']+'\x20node(s)\x20'+('('+o+')\x20but\x20this\x20payload\x27s\x20node(s)\x20['+p['join'](',\x20')+']\x20are\x20NOT\x20in\x20the\x20live\x20table.\x20The\x20chunk\x20')+'did\x20not\x20fully\x20land\x20(index\x20lag\x20is\x20possible\x20—\x20re-read\x20before\x20concluding);\x20verify\x20with\x20query_toolkit\x20and\x20'+'re-send\x20ONLY\x20the\x20missing\x20nodes\x20referencing\x20the\x20machine\x20ADDRESS\x20before\x20publish/bind.');else m['length']>0x0&&g['push']('MACHINE\x20NODE\x20READ-BACK\x20(gf29\x20F-16):\x20machine\x20'+l+'\x20holds\x20'+n['length']+'\x20node(s)\x20('+o+')\x20—\x20'+('all\x20'+m['length']+'\x20node\x20name(s)\x20from\x20this\x20payload\x20verified\x20present\x20in\x20the\x20live\x20table.'));}export async function prepareSalesAddDuplicateGate(a,b,c){if(a?.['sales']?.['op']!=='add')return null;if(c?.['confirmed']===!![])return null;const d=Array['isArray'](a?.['sales']?.['sales'])?a['sales']['sales']:[];if(d['length']===0x0)return null;const e=a?.['object'];if(typeof e!=='string'||e['length']===0x0)return null;try{const f=e['startsWith']('0x')?e:await LocalMark['Instance']()['get_address'](e)??undefined;if(!f)return null;const g=await query_serviceContext({'service':f,'network':b}),h=Array['isArray'](g?.['service']?.['sales'])?g['service']['sales']:[],i=new Map();for(const p of h){if(typeof p?.['name']==='string')i['set'](p['name'],p);}const j=d['filter'](q=>typeof q?.['name']==='string'&&i['has'](q['name']));if(j['length']===0x0)return null;const k=q=>{const r=q?.['balance']??q;if(typeof r==='string'&&/^\d+$/['test'](r['trim']()))return r['trim']();if(typeof r==='number'&&Number['isFinite'](r)&&r>=0x0)return String(Math['trunc'](r));return'<unset>';},l=(q,r)=>{const t=saleStockRaw(q),u=saleStockRaw({'stock':r?.['stock']});return t!==undefined&&u!==undefined&&u<t;},m=j['map'](q=>{const r=i['get'](q['name']),t=l(r,q);return'\x20\x20•\x20\x22'+q['name']+'\x22\x0a'+('\x20\x20\x20\x20\x20\x20price:\x20\x20\x20\x20\x20\x20'+k(r?.['price'])+'\x20→\x20'+k(q?.['price'])+'\x20(raw\x20units)\x0a')+('\x20\x20\x20\x20\x20\x20stock:\x20\x20\x20\x20\x20\x20'+k(r?.['stock'])+'\x20→\x20'+k(q?.['stock'])+'\x20(units)')+(t?'\x20\x20⚠️\x20STOCK\x20LOSS\x20—\x20the\x20new\x20value\x20REPLACES\x20the\x20remaining\x20inventory':'')+'\x0a'+('\x20\x20\x20\x20\x20\x20suspension:\x20'+String(r?.['suspension']??'<unset>')+'\x20→\x20'+String(q?.['suspension']??'<unset>')+'\x0a')+'\x20\x20\x20\x20\x20\x20wip/wip_hash:\x20also\x20replaced\x20by\x20the\x20incoming\x20values';}),n=j['some'](q=>l(i['get'](q['name']),q)),o='⏸\x20SALES\x20ADD\x20HELD\x20FOR\x20CONFIRMATION\x20—\x20same-name\x20overwrite\x20(nothing\x20sent\x20yet)\x0a\x0a'+('op:add\x20on\x20service\x20\x27'+e+'\x27\x20re-declares\x20'+j['length']+'\x20existing\x20product\x20name(s).\x20')+'On-chain\x20this\x20is\x20a\x20FULL\x20ROW\x20REPLACEMENT\x20(an\x20exact\x20name\x20match\x20replaces\x20the\x20entire\x20stored\x20row\x20with\x20the\x20incoming\x20sale)\x20—\x20'+'price,\x20stock,\x20suspension\x20and\x20the\x20wip\x20binding\x20all\x20take\x20the\x20NEW\x20values;\x20it\x20is\x20NOT\x20an\x20append.\x0a\x0a'+(m['join']('\x0a')+'\x0a\x0a')+(n?'⚠️\x20At\x20least\x20one\x20product\x27s\x20remaining\x20stock\x20would\x20DROP\x20—\x20buyers\x20mid-purchase\x20can\x20hit\x20an\x20abort\x20when\x20stock\x20runs\x20out.\x0a\x0a':'')+'If\x20the\x20overwrite\x20is\x20INTENDED,\x20re-send\x20the\x20SAME\x20call\x20with\x20env.confirmed=true\x20and\x20it\x20will\x20proceed\x20as\x20declared.\x0a'+'If\x20not,\x20rename\x20the\x20incoming\x20product(s)\x20or\x20use\x20the\x20per-item\x20ops\x20(price_add\x20/\x20stock_add\x20/\x20sale_suspension)\x20to\x20change\x20one\x20field.';return{'content':[{'type':'text','text':o}],'structuredContent':{'outcome':'pending_input','message':o,'result':{'type':'pending_confirmation','preview':{'operation_type':'service_sales_add','duplicates':j['map'](q=>{const r=i['get'](q['name']);return{'sale_name':q['name'],'before':{'price':k(r?.['price']),'stock':k(r?.['stock']),'suspension':r?.['suspension']},'after':{'price':k(q?.['price']),'stock':k(q?.['stock']),'suspension':q?.['suspension']},'stock_loss':l(r,q)};})},'rule_id':'sales_add_same_name_replace'},'semantic':{'intent':'service_sales_add_awaiting_confirmation','status':'pending_input','summary':'sales\x20op:add\x20would\x20OVERWRITE\x20'+j['length']+'\x20existing\x20product(s)\x20(full\x20row\x20replacement\x20incl.\x20stock).\x20NOT\x20executed.\x20Re-send\x20with\x20env.confirmed=true\x20to\x20proceed,\x20or\x20rename\x20/\x20use\x20per-item\x20ops.','next_actions':[{'action':'confirm:\x20re-send\x20the\x20SAME\x20sales\x20op:add\x20with\x20env.confirmed=true','reason':'The\x20same-name\x20overwrite\x20is\x20intended;\x20review\x20the\x20diff\x20above\x20before\x20confirming.','tool':'onchain_operations','priority':'required'},{'action':'alternative:\x20rename\x20incoming\x20products\x20or\x20use\x20per-item\x20ops\x20(price_add\x20/\x20stock_add\x20/\x20stock_reduce\x20/\x20sale_suspension)','reason':'Per-item\x20ops\x20change\x20one\x20field\x20without\x20replacing\x20the\x20row.','tool':'onchain_operations','priority':'optional'}],'warnings':n?['At\x20least\x20one\x20product\x27s\x20remaining\x20stock\x20would\x20drop\x20under\x20the\x20incoming\x20values.']:[]}}};}catch{return null;}}export async function prepareSaleWipSetOp(a,b){if(a?.['sales']?.['op']!=='wip_set')return null;const c=a?.['sales']?.['sale_name'];if(typeof c!=='string'||c['length']===0x0)return null;const d=typeof a?.['sales']?.['wip']==='string'?a['sales']['wip']:undefined;if(d===undefined)return null;const f=typeof a?.['sales']?.['wip_hash']==='string'?a['sales']['wip_hash']:'',g=a?.['object'];if(typeof g!=='string'||g['length']===0x0)return null;try{const h=g['startsWith']('0x')?g:await LocalMark['Instance']()['get_address'](g)??undefined;if(!h){const n='⛔\x20WIP\x20SET\x20NOT\x20SENT\x20—\x20service\x20\x27'+g+'\x27\x20could\x20not\x20be\x20resolved\x20to\x20an\x20address\x20'+'(no\x20money\x20moved,\x20no\x20gas\x20spent)\x0a\x0a'+'\x22wip_set\x22\x20is\x20an\x20MCP\x20composite\x20(read\x20live\x20sales\x20→\x20merge\x20→\x20replay\x20as\x20op:set):\x20without\x20the\x20'+'live\x20sales\x20list\x20it\x20CANNOT\x20be\x20executed,\x20and\x20the\x20chain\x20has\x20no\x20native\x20wip\x20entry\x20point\x20—\x20'+'letting\x20it\x20through\x20would\x20be\x20a\x20silent\x20no-op.\x20The\x20MCP\x20refuses\x20it\x20here\x20instead.\x0a\x0a'+'Fix:\x20check\x20the\x20service\x20name/address\x20(query_toolkit),\x20then\x20retry.';return{'content':[{'type':'text','text':n}],'structuredContent':{'result':{'type':'error','error':n,'error_code':'sale_wip_set_service_unresolved','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Verify\x20the\x20service\x20name/address\x20with\x20query_toolkit,\x20then\x20retry\x20the\x20wip_set\x20op.'},'message':'wip_set\x20not\x20sent:\x20service\x20unresolved.\x20See\x20recovery_hint.'}};}const i=await query_serviceContext({'service':h,'network':b}),j=Array['isArray'](i?.['service']?.['sales'])?i['service']['sales']:[],k=j['find'](o=>typeof o?.['name']==='string'&&o['name']===c);if(!k){const o=j['map'](t=>String(t?.['name']??''))['filter'](s=>s['length']>0x0),p=c['trim']()['toLowerCase'](),q=o['find'](s=>s['trim']()['toLowerCase']()===p),r='⛔\x20WIP\x20SET\x20NOT\x20SENT\x20—\x20unknown\x20sale_name\x20(no\x20money\x20moved,\x20no\x20gas\x20spent)\x0a\x0a'+('\x22wip_set\x22\x20names\x20sale\x20\x22'+c+'\x22,\x20which\x20does\x20NOT\x20exist\x20on\x20service\x20\x27'+g+'\x27.\x20')+'The\x20composite\x20would\x20replay\x20the\x20full\x20table\x20and\x20abort\x20on\x20chain\x20(code\x2032)\x20after\x20burning\x20gas\x20—\x20'+'the\x20MCP\x20refuses\x20it\x20here\x20instead.\x0a\x0a'+('Available\x20sales:\x20'+(o['length']>0x0?o['map'](s=>'\x22'+s+'\x22')['join'](',\x20'):'<none>')+'\x0a')+(q?'Did\x20you\x20mean\x20\x22'+q+'\x22?\x0a':'')+'Fix:\x20copy\x20the\x20sale_name\x20EXACTLY\x20from\x20the\x20live\x20sales\x20list\x20(query_toolkit\x20/\x20service\x20context),\x20then\x20retry.';return{'content':[{'type':'text','text':r}],'structuredContent':{'result':{'type':'error','error':'sale_name\x20\x22'+c+'\x22\x20matches\x20no\x20sale\x20on\x20service\x20\x27'+g+'\x27;\x20the\x20on-chain\x20replay\x20would\x20abort\x20with\x20code\x2032.\x20'+('Available\x20sales:\x20'+(o['length']>0x0?o['map'](s=>'\x22'+s+'\x22')['join'](',\x20'):'<none>')+'.')+(q?'\x20Did\x20you\x20mean\x20\x22'+q+'\x22?':''),'error_code':'sale_wip_set_unknown_sale_name','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Copy\x20the\x20sale_name\x20exactly\x20from\x20the\x20live\x20sales\x20list'+(q?'\x20(did\x20you\x20mean\x20\x22'+q+'\x22?)':'')+',\x20then\x20retry.','related_object':h},'message':'wip_set\x20not\x20sent:\x20unknown\x20sale_name.\x20See\x20recovery_hint.'}};}const l=s=>{const t=s?.['balance']??s;if(typeof t==='string'&&/^\d+$/['test'](t['trim']()))return t['trim']();if(typeof t==='number'&&Number['isFinite'](t)&&t>=0x0)return String(Math['trunc'](t));return'0';},m=j['map'](t=>t?.['name']===c?{'name':c,'price':l(t?.['price']),'stock':l(t?.['stock']),'suspension':t?.['suspension']===!![],'wip':d,'wip_hash':f}:{'name':String(t?.['name']??''),'price':l(t?.['price']),'stock':l(t?.['stock']),'suspension':t?.['suspension']===!![],'wip':typeof t?.['wip']==='string'?t['wip']:'','wip_hash':typeof t?.['wip_hash']==='string'?t['wip_hash']:''});return a['sales']={'op':'set','sales':m},null;}catch(s){const t='⛔\x20WIP\x20SET\x20NOT\x20SENT\x20—\x20the\x20live\x20sales\x20list\x20could\x20not\x20be\x20read\x20'+('('+(s?.['message']??String(s))+')\x0a\x0a')+'\x22wip_set\x22\x20is\x20an\x20MCP\x20composite\x20(read\x20live\x20sales\x20→\x20merge\x20→\x20replay\x20as\x20op:set);\x20without\x20the\x20'+'live\x20list\x20it\x20CANNOT\x20be\x20executed,\x20and\x20the\x20chain\x20has\x20no\x20native\x20wip\x20entry\x20point\x20—\x20letting\x20it\x20'+'through\x20would\x20be\x20a\x20silent\x20no-op.\x20The\x20MCP\x20refuses\x20it\x20here\x20instead.\x20Retry\x20once\x20(index\x20lag\x20is\x20'+'possible),\x20then\x20verify\x20the\x20service\x20with\x20query_toolkit.';return{'content':[{'type':'text','text':t}],'structuredContent':{'result':{'type':'error','error':t,'error_code':'sale_wip_set_live_read_failed','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Retry\x20once\x20(possible\x20index\x20lag),\x20then\x20verify\x20the\x20service\x20with\x20query_toolkit\x20before\x20re-sending.'},'message':'wip_set\x20not\x20sent:\x20live\x20sales\x20list\x20unreadable.\x20See\x20recovery_hint.'}};}}export async function gateBuyWipPinDoctrine(a,b,c){const d=a?.['order_new']?.['buy']??a?.['buy'],e=Array['isArray'](d?.['items'])?d['items']:[];if(e['length']===0x0)return null;const f=e['filter'](i=>typeof i?.['name']==='string'&&String(i?.['wip_hash']??'')==='');if(f['length']===0x0)return null;const g=a?.['object'];if(typeof g!=='string'||g['length']===0x0)return null;const h=d?.['derive_wip_from_listing']===!![];try{const i=g['startsWith']('0x')?g:await LocalMark['Instance']()['get_address'](g)??undefined;if(!i)return null;const j=await query_serviceContext({'service':i,'network':b}),k=Array['isArray'](j?.['service']?.['sales'])?j['service']['sales']:[],l=new Map();for(const p of k){if(typeof p?.['name']==='string')l['set'](p['name'],p);}const m=f['filter'](q=>{const r=l['get'](q['name']);return r!=null&&String(r?.['wip_hash']??'')!=='';});if(m['length']===0x0)return null;if(h)return c['push']('wip_pin:\x20auto-filled\x20—\x20no\x20WYSIWYG\x20guarantee.\x20The\x20following\x20item(s)\x20were\x20sent\x20WITHOUT\x20a\x20wip_hash\x20'+'while\x20their\x20listing\x20carries\x20a\x20pin;\x20the\x20CURRENT\x20listing\x20hash\x20is\x20injected\x20at\x20order\x20time\x20'+'(derive_wip_from_listing\x20opt-in):\x20'+m['map'](q=>'\x22'+q['name']+'\x22')['join'](',\x20')+'.\x20'+'An\x20injected\x20hash\x20follows\x20the\x20listing\x20—\x20if\x20the\x20merchant\x20rebinds\x20the\x20.wip\x20file\x20later,\x20deliveries\x20run\x20'+'under\x20the\x20NEW\x20file.\x20An\x20explicitly\x20passed\x20hash\x20stays\x20pinned\x20instead.'),null;const n=m['map'](q=>{const r=l['get'](q['name']);return'\x20\x20•\x20\x22'+q['name']+'\x22\x20—\x20listing\x20pin:\x20'+String(r['wip_hash']);})['join']('\x0a'),o='⛔\x20ORDER\x20NOT\x20SENT\x20—\x20wip\x20pin\x20required\x20(h1z9\x20card\x2013\x20#17,\x20unified\x20doctrine)\x0a\x0a'+(m['length']+'\x20item(s)\x20were\x20sent\x20with\x20an\x20EMPTY\x20wip_hash\x20while\x20their\x20listing\x20carries\x20a\x20pin.\x20')+'The\x20SDK\x20auto-fills\x20such\x20items\x20with\x20the\x20listing\x27s\x20CURRENT\x20hash\x20silently\x20—\x20convenient,\x20but\x20it\x20drops\x20the\x20'+'WYSIWYG\x20guarantee\x20(the\x20merchant\x20may\x20rebind\x20the\x20.wip\x20file\x20later,\x20and\x20an\x20injected\x20hash\x20follows\x20the\x20'+('listing).\x20The\x20MCP\x20refuses\x20this\x20pre-send:\x0a\x0a'+n+'\x0a\x0a')+'Two\x20fixes:\x0a'+'\x20\x201.\x20PIN:\x20pass\x20each\x20item\x27s\x20wip_hash\x20EXACTLY\x20as\x20the\x20listing\x20value\x20above\x20—\x20what\x20you\x20verified\x20is\x20what\x20you\x20'+'get\x20(a\x20later\x20legitimate\x20merchant\x20update\x20is\x20detected\x20at\x20quote:\x20E_WIP_HASH_NOT_MATCH).\x0a'+'\x20\x202.\x20OPT\x20IN:\x20re-send\x20with\x20derive_wip_from_listing:true\x20on\x20the\x20buy\x20object\x20to\x20accept\x20the\x20auto-fill\x20'+'(the\x20response\x20then\x20warns\x20\x27wip_pin:\x20auto-filled\x20—\x20no\x20WYSIWYG\x20guarantee\x27).';return{'content':[{'type':'text','text':o}],'structuredContent':{'result':{'type':'error','error':o,'error_code':'buy_wip_pin_required','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Pass\x20each\x20item\x27s\x20listing\x20wip_hash\x20exactly,\x20or\x20re-send\x20with\x20derive_wip_from_listing:true\x20on\x20the\x20buy\x20object\x20to\x20accept\x20the\x20auto-fill.','related_object':i},'message':'Order\x20not\x20sent:\x20empty\x20wip_hash\x20against\x20a\x20pinned\x20listing.\x20See\x20recovery_hint.'}};}catch{return null;}}export function gateServicePublishPreflight(a){if(a?.['publish']!==!![])return null;const b=a?.['creation_plan'];if(b==null)return null;const c=(h,i,j,k)=>({'content':[{'type':'text','text':'⛔\x20SERVICE\x20NOT\x20PUBLISHED\x20—\x20'+i+'\x0a\x0a'+j}],'structuredContent':{'result':{'type':'error','error':i,'error_code':h,'retryable':!![],'recovery_hint':j,...k},'message':'Service\x20not\x20published:\x20the\x20creation_plan\x20gate\x20rejected\x20the\x20publish.\x20See\x20recovery_hint.'}});if(typeof b!=='object'||Array['isArray'](b)||!Array['isArray'](b['steps']))return c('creation_plan_malformed','creation_plan\x20is\x20present\x20but\x20malformed\x20(expected\x20the\x20merchant_guide\x20Plan\x20JSON\x20with\x20a\x20steps\x20array).','Pass\x20the\x20plan\x20object\x20EXACTLY\x20as\x20merchant_guide\x20delivered\x20it\x20(its\x20creation_plan\x20field),\x20or\x20omit\x20'+'creation_plan\x20entirely\x20to\x20publish\x20the\x20manual\x20way.\x20Do\x20not\x20hand-edit\x20the\x20plan.');const d=b,f=d['steps']['filter'](h=>h?.['op']==='publish');if(f['length']===0x0)return c('creation_plan_malformed','creation_plan\x20carries\x20no\x20publish\x20step\x20—\x20it\x20is\x20not\x20the\x20plan\x20merchant_guide\x20handed\x20out\x20for\x20this\x20build.','Pass\x20the\x20plan\x20object\x20EXACTLY\x20as\x20merchant_guide\x20delivered\x20it\x20(its\x20creation_plan\x20field),\x20or\x20omit\x20'+'creation_plan\x20entirely\x20to\x20publish\x20the\x20manual\x20way.');const g=typeof a?.['object']==='string'?a['object']:a?.['object']?.['name'];if(typeof g==='string'&&g['length']>0x0&&!g['startsWith']('0x')){const h=f['map'](i=>{const j=i?.['target']?.['$ref'],k=typeof j==='string'?d['steps']['find'](m=>m['id']===j):undefined,l=k?.['op']==='create'&&typeof k['params']?.['name']==='string'?k['params']['name']:undefined;return typeof l==='string'&&!l['startsWith']('0x')?l:undefined;})['filter'](i=>typeof i==='string'&&i['length']>0x0);if(h['length']>0x0&&!h['includes'](g))return c('creation_plan_target_mismatch','creation_plan\x27s\x20publish\x20step(s)\x20target\x20'+h['map'](i=>'\x27'+i+'\x27')['join'](',\x20')+'\x20'+('but\x20this\x20call\x20operates\x20on\x20\x27'+g+'\x27\x20—\x20the\x20plan\x20does\x20not\x20describe\x20this\x20Service.'),'Publish\x20the\x20Service\x20named\x20in\x20the\x20plan,\x20or\x20go\x20back\x20to\x20merchant_guide\x20and\x20rebuild\x20the\x20plan\x20for\x20'+'this\x20Service.\x20Never\x20attach\x20another\x20build\x27s\x20plan\x20to\x20a\x20publish\x20call.');}try{const {plan:i,audit:j}=preflightPlan(d),k=j['issues']['length']===0x0&&!j['findings']['some'](n=>n['level']==='critical'),l=[];for(const n of i['steps']){if(n['op']!=='publish')continue;for(const o of n['preflight']){if(o['status']==='fail')l['push'](n['id']+':\x20'+o['check']);}}if(!k||l['length']>0x0){const p=j['findings']['filter'](t=>t['level']==='critical'||l['some'](u=>u['endsWith'](t['rule_id'])))['slice'](0x0,0x8)['map'](t=>'\x20\x20•\x20['+t['level']+']\x20'+t['rule_id']+':\x20'+t['title']+'\x20—\x20'+t['description']+(t['mitigation']?'\x20Fix:\x20'+t['mitigation']:'')),q=j['issues']['slice'](0x0,0x5)['map'](t=>'\x20\x20•\x20['+t['code']+']'+(t['step']?'\x20(step\x20'+t['step']+')':'')+'\x20'+t['detail']),r=(q['length']>0x0?'Structural\x20issues:\x0a'+q['join']('\x0a')+'\x0a':'')+(p['length']>0x0?'Audit\x20findings:\x0a'+p['join']('\x0a')+'\x0a':'')+(l['length']>0x0?'Failed\x20freeze\x20gates:\x20'+l['join'](';\x20')+'.':'');return c('creation_plan_preflight_failed','the\x20creation_plan\x20freeze\x20matrix\x20has\x20failed\x20gates\x20—\x20publishing\x20it\x20would\x20go\x20live\x20against\x20a\x20plan\x20'+'merchant_guide\x27s\x20audit\x20rejected:\x0a'+r,'Fix\x20the\x20plan\x20and\x20re-run\x20merchant_guide\x20(the\x20audit\x20findings\x20above\x20name\x20the\x20rule\x20and\x20the\x20fix),\x20'+'then\x20pass\x20the\x20NEW\x20plan\x20back\x20here.\x20Do\x20not\x20publish\x20with\x20failed\x20gates:\x20order_allocators\x20and\x20the\x20'+'machine\x20binding\x20are\x20immutable\x20after\x20publish.');}const m=bindAuditPlan(d);if(m['length']>0x0){const t=bindRecoveryList(d);return c('PLAN_BIND_AUDIT_FAILED','the\x20creation_plan\x20binds\x20plan-created\x20objects\x20by\x20global-namespace\x20NAME\x20instead\x20of\x20{\x22$ref\x22:\x20stepId}\x20'+'(or\x20carries\x20an\x20undeclared\x20external\x20local_name).\x20Publishing\x20would\x20freeze\x20cross-run\x20mis-bindings\x20'+'into\x20immutable\x20Guards\x20—\x20the\x20W5-05\x20whole-store-loss\x20class:\x0a'+bindAuditReport(m,t),'Do\x20NOT\x20publish\x20this\x20plan.\x20Re-run\x20template_generate\x20against\x20the\x20current\x20catalog\x20(its\x20compile\x20emits\x20'+'{\x22$ref\x22:\x20stepId}\x20for\x20every\x20plan-internal\x20object),\x20then\x20pass\x20the\x20NEW\x20plan\x20here.\x20The\x20recovery\x20'+'list\x20above\x20names\x20each\x20object\x20this\x20build\x20already\x20created\x20so\x20its\x20funds/objects\x20can\x20be\x20recovered.',{'bind_offenses':m,'recovery_list':t});}if(typeof d['templateId']==='string'){const u=oracleDisclosureBlockersFor(d['templateId']);if(u['length']>0x0)return c('oracle_disclosure_incomplete','Template\x20\x27'+d['templateId']+'\x27\x20carries\x20undisclosed\x20chain\x20limits\x20for\x20its\x20product\x20'+('(path-oracle\x20steps:\x20'+u['join'](',\x20')+')\x20—\x20the\x20Service\x20would\x20silently\x20')+'break\x20behaviors\x20the\x20benchmark\x20product\x20promises.','Add\x20one\x20English\x20sole-truth\x20build_note\x20per\x20listed\x20step\x20id\x20whose\x20wording\x20discloses\x20the\x20'+'chain\x20limit\x20(see\x20the\x20ORACLE-DISC-01\x20finding\x20in\x20the\x20template\x20scan\x20for\x20the\x20exact\x20per-step\x20'+'remedy),\x20re-scan\x20the\x20template\x20until\x20disclosure_coverage\x20=\x201,\x20then\x20rebuild\x20the\x20plan.');}return null;}catch(v){return c('creation_plan_malformed','creation_plan\x20could\x20not\x20be\x20audited\x20('+(v['message']??String(v))+').','Pass\x20the\x20plan\x20object\x20EXACTLY\x20as\x20merchant_guide\x20delivered\x20it,\x20or\x20omit\x20creation_plan\x20entirely\x20to\x20'+'publish\x20the\x20manual\x20way.');}}async function applyInitialForwardAfterOrderNew(a,b){const c=a?.['object'];if(typeof c!=='string'||c['length']===0x0)return undefined;if(b?.['dry_run']===!![])return undefined;try{const d=c['startsWith']('0x')?c:await LocalMark['Instance']()['get_address'](c)??undefined;if(!d)return undefined;const g=await query_objects({'objects':[d],'network':b?.['network'],'no_cache':!![]}),h=g?.['objects']?.[0x0]?.['data']??g?.['objects']?.[0x0],i=typeof h?.['progress']==='string'?h['progress']:undefined;if(!i)return undefined;const j=await query_objects({'objects':[i],'network':b?.['network'],'no_cache':!![]}),k=j?.['objects']?.[0x0]?.['data']??j?.['objects']?.[0x0],l=typeof k?.['machine']==='string'?k['machine']:undefined;if(!l)return undefined;const m=await fetchMachineNodes(l,b?.['network'],![]),o=[];for(const u of m){for(const v of u['pairs']){if(v['prev_node']!=='')continue;for(const w of v['forwards']){if(!w['name'])continue;o['push']({'forward':w,'target':u['name'],'threshold':v['threshold']});}}}if(o['length']===0x0)return undefined;const r=o['map'](x=>'\x22'+x['forward']['name']+'\x22\x20→\x20\x22'+x['target']+'\x22'+(x['forward']['guard']?'\x20[guarded]':''))['join'](';\x20'),s='onchain_operations\x20{\x20operation_type:\x20\x27progress\x27,\x20data:\x20{\x20object:\x20\x27'+i+'\x27,\x20'+('task:\x20\x27'+d+'\x27,\x20operate:\x20{\x20op:\x20\x27next\x27,\x20operation:\x20{\x20forward:\x20\x27<entry\x20forward>\x27,\x20')+'next_node_name:\x20\x27<target>\x27\x20}\x20}\x20}\x20}',t=o['length']===0x1&&!o[0x0]['forward']['guard']&&o[0x0]['forward']['namedOperator']===''&&o[0x0]['forward']['weight']>=o[0x0]['threshold'];if(t){const x=new CallProgress({'object':i,'task':d,'operate':{'op':'next','operation':{'forward':o[0x0]['forward']['name'],'next_node_name':o[0x0]['target']}}}),y=await x['call'](b),z=!!y&&typeof y==='object'&&y?.['effects']?.['status']?.['status']==='success';if(z)return'INITIAL\x20FORWARD\x20AUTO-APPLIED:\x20\x22'+o[0x0]['forward']['name']+'\x22\x20→\x20\x22'+o[0x0]['target']+'\x22\x20'+('(digest\x20'+(y?.['digest']??'n/a')+').\x20The\x20order\x20is\x20OPEN\x20for\x20business\x20—\x20the\x20')+'workflow\x20has\x20started,\x20counterparties\x20can\x20see\x20and\x20act\x20on\x20it\x20now.';const A=y&&typeof y==='object'?String(y?.['effects']?.['status']?.['error']??y?.['error']??'unknown\x20rejection'):'unknown\x20rejection';return'PENDING\x20INITIAL\x20FORWARD\x20(auto-apply\x20was\x20REJECTED,\x20funds\x20are\x20SAFE):\x20the\x20order\x20is\x20funded\x20but\x20'+('still\x20at\x20the\x20empty\x20entry\x20state\x20—\x20the\x20workflow\x20has\x20NOT\x20started.\x20Entry\x20forward:\x20'+r+'.\x20')+('Rejection:\x20'+A['slice'](0x0,0x12c)+'.\x20Apply\x20it\x20manually\x20once\x20the\x20cause\x20is\x20fixed:\x20'+s);}return'PENDING\x20INITIAL\x20FORWARD:\x20the\x20order\x20is\x20funded\x20but\x20still\x20at\x20the\x20empty\x20entry\x20state\x20—\x20the\x20workflow\x20'+('has\x20NOT\x20started\x20(abnb7\x20F37).\x20Entry\x20forward(s):\x20'+r+'.\x20This\x20MCP\x20auto-applies\x20only\x20an\x20')+('unguarded\x20single-forward\x20holder\x20entry;\x20this\x20entry\x20needs\x20a\x20manual\x20call:\x20'+s);}catch(B){return'PENDING\x20INITIAL\x20FORWARD\x20(auto-apply\x20probe\x20failed:\x20'+String(B?.['message']??B)['slice'](0x0,0xc8)+'):\x20the\x20'+'order\x20may\x20still\x20be\x20at\x20the\x20empty\x20entry\x20state\x20—\x20check\x20the\x20Progress\x27s\x20current\x20node\x20and\x20apply\x20the\x20'+'entry\x20forward\x20if\x20the\x20workflow\x20has\x20not\x20started\x20(query\x20the\x20order,\x20then\x20progress\x20operate\x20\x27next\x27).';}}async function resolveOrderRefForBackfill(a){if(typeof a!=='string'||a['length']===0x0)return undefined;if(a['startsWith']('0x'))return a;try{return await LocalMark['Instance']()['get_address'](a)??undefined;}catch{return undefined;}}async function snapshotProgressNodePreAdvance(a,b){try{if(b?.['dry_run']===!![])return undefined;const c=a?.['operate'];if(!c||c['op']!=='next')return undefined;const d=a?.['object'];if(typeof d!=='string'||d['length']===0x0)return undefined;const e=d['startsWith']('0x')?d:await LocalMark['Instance']()['get_address'](d)??undefined;if(!e)return undefined;const f=await query_objects({'objects':[e],'network':b?.['network'],'no_cache':!![]}),g=f?.['objects']?.[0x0]?.['data']??f?.['objects']?.[0x0],h=typeof g?.['current']==='string'?g['current']:undefined;if(h===undefined)return undefined;const i=typeof g?.['machine']==='string'?g['machine']:undefined;return{'progressAddr':e,'preNode':h,'machineAddr':i};}catch{return undefined;}}async function annotateProgressAdvanceOutcome(a,b,c,d){try{if(!b||!a)return;const e=extractProgressEventNodeFromTx(c,b['progressAddr']);if(e!==undefined&&e!==b['preNode'])return;const f=async()=>{const s=await query_objects({'objects':[b['progressAddr']],'network':d?.['network'],'no_cache':!![]});return s?.['objects']?.[0x0]?.['data']??s?.['objects']?.[0x0];};let g=await f();const h=extractObjectVersionFromTx(c,b['progressAddr']);for(let s=0x0;h!==undefined&&g&&String(g?.['version']??'')!==h&&s<0x2;s++){await new Promise(t=>setTimeout(t,0x258)),g=await f();}if(!g||h!==undefined&&String(g?.['version']??'')!==h)return;const i=typeof g?.['current']==='string'?g['current']:undefined;if(i===undefined||i!==b['preNode'])return;let j='unavailable\x20(machine\x20topology\x20read\x20failed)',k;if(b['machineAddr']){const t=await fetchMachineNodes(b['machineAddr'],d?.['network'],![]),u=[];for(const v of t){for(const w of v['pairs']){if(w['prev_node']!==b['preNode'])continue;if(k===undefined)k=w['threshold'];const x=w['forwards']['filter'](y=>!!y['name'])['map'](y=>'\x22'+y['name']+'\x22'+(y['guard']?'\x20[guarded]':'\x20[unguarded]'))['join'](',\x20');if(x)u['push']('→\x20\x22'+v['name']+'\x22\x20(threshold\x20'+w['threshold']+'):\x20'+x);}}if(u['length']>0x0)j=u['join'](';\x20');}const l=Array['isArray'](g?.['session'])?g['session']['slice'](-0x1)[0x0]:undefined,m=l&&Array['isArray'](l['forwards'])?l['forwards']['length']:undefined,o=typeof l?.['weights']==='number'?l['weights']:undefined,q=[];q['push']('ADVANCED:\x20false\x20—\x20the\x20transaction\x20succeeded\x20but\x20the\x20Progress\x20node\x20did\x20NOT\x20move;\x20it\x20is\x20still\x20\x22'+b['preNode']+'\x22.'),q['push']('Outgoing\x20edges\x20from\x20\x22'+b['preNode']+'\x22:\x20'+j+'.');const r=[];if(k!==undefined)r['push']('pair\x20threshold\x20'+k);if(m!==undefined)r['push'](m+'\x20forward\x20submission(s)\x20recorded\x20this\x20session\x20(COUNT,\x20not\x20weight)');if(o!==undefined)r['push']('accumulated\x20weight\x20'+o);if(r['length']>0x0)q['push']('Session:\x20'+r['join'](';\x20')+'.');q['push']('Threshold\x20not\x20met\x20—\x20more\x20submissions/weight\x20needed;\x20funds\x20and\x20state\x20unchanged.');Array['isArray'](a['content'])&&a['content']['push']({'type':'text','text':q['join']('\x20')});try{const y=a['structuredContent'];if(y&&typeof y==='object'){if(!y['semantic']||typeof y['semantic']!=='object')y['semantic']={};y['semantic']['forward_outcome']={'advanced':![],'current_node':b['preNode'],...k!==undefined?{'threshold':k}:{},...m!==undefined?{'session_submission_count':m}:{},...o!==undefined?{'accumulated_weight':o}:{}};}}catch{}}catch{}}function orderOwnerAddr(a){const b=a,c=b?.['builder']??b?.['owner'];if(typeof c==='string'&&c['startsWith']('0x'))return c;const d=c;if(d&&typeof d==='object'){if(typeof d['AddressOwner']==='string')return d['AddressOwner'];if(typeof d['ObjectOwner']==='string')return d['ObjectOwner'];}return undefined;}async function verifyOrderNewLanded(a,b){const c=lastInFlightMarker('order_new',b);if(!c)return undefined;try{const d=await query_events({'type':'NewOrderEvent','order':'descending','limit':0x32,'network':a,'no_cache':!![]});for(const e of d?.['data']??[]){if(e?.['type']!=='NewOrderEvent')continue;const f=matchOrderLandedEvent(c,{'order':e['order'],'progress':e['progress'],'service':e['service'],'sender':e['sender'],'time':e['time'],'amount':e['amount'],'digest':e?.['id']?.['txDigest']??e?.['id']?.['tx_digest']});if(f)return f;}}catch{}if(!c['service'])return undefined;try{const g=a,h=await fetchServiceOrders(c['service'],g,!![]),j=(h?.['items']??[])['filter'](p=>typeof p?.['who']==='string'&&p['who']['startsWith']('0x'))['slice'](-0x19);if(j['length']===0x0)return undefined;const k=await batchQueryObjectsByIds(j['map'](p=>p['who']),g,!![])['catch'](()=>[]),l=new Map();for(const p of k){p&&p['type']===ObjectType['Order']&&typeof p['object']==='string'&&l['set'](p['object']['toLowerCase'](),p);}let m,n=0x0;for(const q of j){const r=l['get'](q['who']['toLowerCase']()),s=matchRecentOrder(c,{'order':q['who'],'owner':r?orderOwnerAddr(r):undefined,'time':q['time'],'amount':r?.['amount'],'items':r?.['items']});s&&(m=s,n++);}if(!m)return undefined;return n>0x1?m+'\x20('+n+'\x20candidates\x20inside\x20the\x20adoption\x20window\x20—\x20verify\x20items/amount\x20against\x20THIS\x20call\x27s\x20payload\x20before\x20adopting)':m;}catch{return undefined;}}const resolvedNameCache=new Map();export function invalidateResolvedNameCache(){resolvedNameCache['clear']();}async function resolveNamedObjectsInPlace(a){if(!a||typeof a!=='object')return;const b=['object','machine','arb','arbitration_object','permission','contact','um','required_info'],c=['objects','repositories','allocators','guards','items','entities','agents'],d=async e=>{if(typeof e!=='string')return e;const f=e['trim']();if(f===''||f['startsWith']('0x'))return e;const g=resolvedNameCache['get'](f);if(g)return g;try{const h=await LocalMark['Instance']()['get_address'](f);if(h)return resolvedNameCache['set'](f,h),h;return e;}catch{return e;}};for(const e of b){if(!(e in a))continue;a[e]=await d(a[e]);}for(const f of c){const g=a[f];if(!Array['isArray'](g))continue;for(let h=0x0;h<g['length'];h++){const j=g[h];if(j&&typeof j==='object'){for(const k of b){if(k in j)j[k]=await d(j[k]);}if(typeof j['name']==='string'&&!('type_parameter'in j)&&!('permission'in j)){const l=await d(j['name']);if(l!==j['name'])g[h]=l;}}else g[h]=await d(j);}}}async function collectArbitrationRefsForPublish(a,b){const c=a?.['arbitrations'];if(c&&typeof c==='object'&&(c['op']==='add'||c['op']==='set')&&Array['isArray'](c['objects'])&&c['objects']['length']>0x0)return c['objects'];const d=typeof a?.['object']==='string'?a['object']:undefined;if(d)try{const e=d['startsWith']('0x')?d:await LocalMark['Instance']()['get_address'](d)['catch'](()=>undefined)??undefined;if(e){const f=await resolveNetwork(b?.['network']),g=await query_objects({'objects':[e],'network':f,'no_cache':!![]}),h=g?.['objects']?.[0x0];if(h&&h['type']==='Service'){const i=h['data']??h;if(Array['isArray'](i['arbitrations']))return i['arbitrations'];}}}catch{}return[];}export function isPassportVerifyFailure(a,b){if(/Identifier\("passport"\)/['test'](a)&&/MoveAbort\([\s\S]*,\s*7\s*\)/['test'](a))return!![];if(/::passport::/['test'](a)&&/abort code:\s*7\b/['test'](a))return!![];return b&&/abort code:\s*7\b/['test'](a);}function pickSubmissionCallForDiagnosis(a){for(const b of[a?.['submission'],a?.['info']]){if(b&&typeof b==='object'&&Array['isArray'](b['guard'])&&Array['isArray'](b['submission']))return b;}return undefined;}async function diagnoseGuardFailure(a,b){let c=pickSubmissionCallForDiagnosis(a),e=![];!c&&isBuyGuardAbortContext(a,b)&&(c=await synthesizeBuyGuardSubmissionForDiagnosis(a),e=c!==undefined);if(!isPassportVerifyFailure(b,c!==undefined))return undefined;if(!c)return undefined;const f=getEnvConfig(a?.['env']),g=await diagnose_passport_failure(f,c);if(g['failed_index']===null||g['failed_guard']===null)return'Guard\x20diagnosis\x20(dry-run):\x20'+g['hint'];const h=e?'Guard\x20diagnosis\x20(dry-run):\x20this\x20buy\x20was\x20gated\x20by\x20the\x20service\x27s\x20on-chain\x20buy_guard;\x20'+('the\x20first\x20failing\x20impact\x20guard\x20is\x20#'+g['failed_index']+'\x20('+g['failed_guard']+').\x20'+g['hint']):'Guard\x20diagnosis\x20(dry-run):\x20the\x20first\x20failing\x20impact\x20guard\x20is\x20#'+g['failed_index']+'\x20'+('('+g['failed_guard']+').\x20'+g['hint']);try{const i=await submissionItemsForGuard(g['failed_guard'],c),j=await loadGuardJsonFromChain(g['failed_guard'],f?.['network']),k=[];if(j){const l=renderGuardLegMap(j['json']['root'],j['json']['table'],i);k['push'](...l);}if(j){const m=(i??[])['map'](p=>{const q=Number(p['identifier']);if(!Number['isInteger'](q)||q<0x0||q>0xff)return undefined;const r=j['json']['table']['find'](s=>s['identifier']===q);if(!r||r['value_type']===undefined)return undefined;return{'identifier':q,'value_type':r['value_type'],'value':p['value']};})['filter'](p=>p!==undefined),n=(c['guard']??[])['map'](p=>typeof p?.['object']==='string'&&p['object']['startsWith']('0x')?p['object']:undefined)['filter'](p=>typeof p==='string'),o=await verifyGuardFailureLegs(f,g['failed_guard'],m,n);if(o['verdict']==='pass')k['push']('On-chain\x20leg\x20evaluation\x20(production\x20evaluator):\x20this\x20guard\x20PASSES\x20with\x20the\x20supplied\x20submission\x20—\x20the\x20E_VERIFY_FAILED\x20came\x20from\x20a\x20different\x20guard\x20or\x20a\x20different\x20submission\x20state.');else o['root_logic']?k['push']('On-chain\x20leg\x20evaluation\x20(production\x20evaluator):\x20legs\x20['+o['false_legs']['join'](',\x20')+']\x20of\x20the\x20'+o['root_logic']['toUpperCase']()+'\x20root\x20are\x20FALSE.\x20'+o['hint']):k['push']('On-chain\x20leg\x20evaluation\x20(production\x20evaluator):\x20the\x20single\x20root\x20condition\x20is\x20FALSE.\x20'+o['hint']);}if(k['length']>0x0)return h+'\x0a'+k['join']('\x0a');}catch{}return h;}async function submissionItemsForGuard(a,b){for(const c of Array['isArray'](b['submission'])?b['submission']:[]){let d=typeof c?.['guard']==='string'?c['guard']:undefined;if(!d)continue;!d['startsWith']('0x')&&(d=await LocalMark['Instance']()['get_address'](d)['catch'](()=>undefined)??d);if(d===a&&Array['isArray'](c['submission']))return c['submission'];}return undefined;}export async function synthesizeBuyGuardSubmissionForDiagnosis(a){try{const b=a?.['data']?.['object'];if(typeof b!=='string'||b['trim']()==='')return undefined;const c=getEnvConfig(a?.['env']),d=await query_serviceContext({'service':b,'no_cache':!![],'network':c?.['network']}),e=d?.['buy_guard'];if(!e?.['object'])return undefined;const f=[{'object':e['object'],'impack':!![]}];for(const g of Array['isArray'](e['relies'])?e['relies']:[]){typeof g==='string'&&!f['some'](h=>h['object']===g)&&f['push']({'object':g,'impack':![]});}return{'guard':f,'submission':[]};}catch{return undefined;}}export function isBuyGuardAbortContext(a,b){return a?.['operation_type']==='service'&&a?.['data']?.['order_new']!=null&&/abort code:\s*7\b/['test'](b);}async function autoHoldAfterClaim(a,b,c){if(typeof c!=='string'||!c)return undefined;const d=await resolveHoldableEdges({'progressRef':c,'accountName':a?.['account']??'','network':a?.['network'],'noCache':!![]});if(!d||d['edges']['length']===0x0)return undefined;const f=[],g=[],h=[];for(const i of d['edges']){const j=i['forward']+'\x20->\x20'+i['next_node'];if(!i['holdable']){h['push'](j);continue;}try{const k=new CallOrder({'object':b,'progress':{'op':'hold','operation':{'next_node_name':i['next_node'],'forward':i['forward']},'message':'arbitration\x20claimed\x20-\x20settlement\x20held\x20(E-17a)'}}),l=await k['call'](a);if(l&&typeof l==='object'&&!('error'in l))f['push'](j);else g['push'](j);}catch{g['push'](j);}}return{'held':f,'failed':g,'notHoldable':h};}export async function handleOnchainOperations(b){let c,h=[],k;async function l(m,p,u,x,y){const z=new Set(['service','machine','progress','repository','arbitration','contact','treasury','reward','allocation','permission','guard','personal','demand','order','proof']);if(!z['has'](u))return;if(!x||typeof x!=='object'||'error'in x)return;if(!x['digest'])return;if(y!==undefined)try{const A=collectOnChainNamedObjectRequests(y);if(A['length']>0x0){const B=await registerLocalMarksForCreatedObjects(A,ResponseData(x),u,{'getAddress':C=>LocalMark['Instance']()['get_address'](C,p),'put':C=>LocalMark['Instance']()['put'](C,p)});B['failed']['length']>0x0&&console['warn']('[nameRegistration]\x20'+B['failed']['length']+'\x20name(s)\x20could\x20not\x20be\x20registered\x20locally:\x20'+B['failed']['map'](C=>C['name']+'\x20('+C['error']+')')['join'](',\x20'));}}catch{}try{const C=operationPrimaryType(u),D=C?ResponseData(x)['find'](E=>E['change']==='created'&&E['object']&&String(E['type'])===String(C)):undefined;if(C&&D?.['object']){const E=D['object'],[F,G]=await Promise['all']([LocalMark['Instance']()['list']({'address':E}),LocalMark['Instance']()['get_address'](autoLocalMarkName(String(C),E),p)['catch'](()=>undefined)]),H=planAutoLocalMark({'operationType':u,'created':ResponseData(x),'existingNamesForAddress':F??[],'existingAddressForName':G});H&&(await LocalMark['Instance']()['put']([{'name':H['name'],'address':H['address'],'tags':H['tags']}],p),console['warn']('[autoMark]\x20created\x20'+u+'\x20registered\x20locally\x20as\x20'+H['note']));}}catch{}if(!m)return;try{const I=ResponseData(x),J=I['filter'](K=>K['change']==='created'&&K['object']);if(m&&J['length']>0x0){const K=J['filter'](L=>typeof L['type_raw']==='string'&&L['type_raw']['includes']('::'))['map'](L=>({'type':L['type_raw']['split']('::')['pop'](),'object':L['object']}));if(K['length']>0x0){const L=await goalEngine['registerActObjects'](m,K,p??'default');L>0x0&&console['warn']('[autoRegisterResults]\x20'+L+'\x20created\x20object(s)\x20registered\x20to\x20goal\x20'+m+'\x20(ACT\x20station)');}}}catch{}}try{if(typeof b==='object'&&b!==null&&'description'in b&&!('operation_type'in b)){const F=b['description'],G=typeof F==='string'&&(F['includes']('operation_type')||F['includes']('data'));if(G)throw new Error('Invalid\x20parameter\x20structure.\x20Parameters\x20should\x20NOT\x20be\x20wrapped\x20in\x20\x27description\x27\x20field.\x0a'+'Correct\x20format:\x20{\x20operation_type:\x20\x27...\x27,\x20data:\x20{...}\x20}\x0a'+'Incorrect\x20format:\x20{\x20description:\x20\x27{\x20operation_type:\x20...\x20}\x27\x20}');}c=strictParse(OnchainOperationsSchema,b,'onchain_operations\x20input');const m=getEnvConfig(c['env']);await expandBareReceiveIds(c,m?.['network']);const n=extractObjectOnlyRef(c);if(n!==undefined)return await queryObjectOnlyResult(c['operation_type'],n,m);try{const H=c['data']?.['object'];if(H&&typeof H==='object'&&H['replaceExistName']===!![]&&typeof H['name']==='string'&&H['name']['trim']()['length']>0x0){const I=await LocalMark['Instance']()['get'](H['name']['trim']());I?.['address']&&h['push']('NAME\x20REBIND:\x20local\x20name\x20\x27'+H['name']+'\x27\x20is\x20currently\x20bound\x20to\x20'+I['address']+'.\x20'+'replaceExistName=true\x20will\x20unbind\x20it\x20and\x20rebind\x20the\x20name\x20to\x20the\x20object\x20created/updated\x20by\x20this\x20'+('call\x20—\x20references\x20resolving\x20\x27'+H['name']+'\x27\x20will\x20point\x20to\x20the\x20NEW\x20object.\x20')+'If\x20this\x20is\x20unintentional,\x20drop\x20replaceExistName\x20or\x20choose\x20another\x20name.');}}catch{}if(!m['referrer']){const J=readStoredReferrer();if(J)m['referrer']=J;}if(m['network']==null)try{const K=await Config['Instance']()['network_get']();h['push']('env.network\x20not\x20set\x20—\x20routing\x20via\x20session\x20default\x20\x27'+String(K)+'\x27.\x20Pass\x20env.network\x20'+'explicitly\x20on\x20every\x20call\x20for\x20deterministic\x20routing\x20(the\x20response\x20network_source\x20echo\x20confirms\x20'+'which\x20network\x20served\x20the\x20call).');}catch{}if(m['dry_run']===!![]&&m['network']!=null)try{const L=await Config['Instance']()['network_get']();L&&L!==m['network']&&h['push']('NETWORK\x20DRIFT\x20(dry\x20run):\x20this\x20simulation\x20targets\x20\x27'+m['network']+'\x27\x20while\x20the\x20session\x20'+('default\x20is\x20\x27'+L+'\x27.\x20The\x20simulation\x20executed\x20(dry\x20runs\x20mutate\x20nothing),\x20but\x20the\x20')+('real\x20execution\x20WILL\x20land\x20on\x20\x27'+m['network']+'\x27\x20—\x20confirm\x20that\x20is\x20intended\x20before\x20dropping\x20dry_run.'));}catch{}const p=m['client_schema_version'],u=m['schema_strict_mode'],x=p?checkClientSchemaCompatibility(p,{'mode':u?'strict':'warn'}):undefined,y=(M,N,O)=>({'operation_type':c['operation_type'],'data':M,'expected':declareDispatchExpectation(c['operation_type'],M),'operation_id':stableOperationId(c['operation_type'],M),'pre_warnings':h['length']?h:undefined,'schema_check':x,'response_level':B,...N?{'evaluation':N}:{},...O?{'passport_test':O}:{}}),z=m['plan_approval'],A=m['network'],B=m['response_level'];if(m['confirmed']!==!![]&&m['dry_run']!==!![]){const M=await maybeGuardSubmissionConfirmation(c,m);if(M)return M;}delete m['confirmed'],delete m['user_intent_phrases'],delete m['client_schema_version'],delete m['response_level'],delete m['schema_strict_mode'],await resolveNamedObjectsInPlace(c['data']);const C=getSkillsHintForOnchain(c['operation_type'],c['data']);C&&h['push'](C);const D=getProjectSkillsHint();D&&h['push'](D);await assertReferencesResolve(c,m);{const N=c?.['idempotency_key'];if(typeof N==='string'&&N['length']>=0x8){k=N;const O=c?.['env']?.['dry_run']===!![],P=idempotencyKeyGate(N,c['operation_type'],O);if(P){const Q=P['status']==='unknown',R=(Q&&P['digests']['length']>0x0?'\x20Known\x20digests\x20from\x20that\x20attempt:\x20'+P['digests']['join'](',\x20')+'\x20—\x20verify\x20THEM\x20FIRST\x20via\x20onchain_transaction.':'')+(Q&&P['sender']?'\x20Sender\x20to\x20query\x20(onchain_events):\x20'+P['sender']+(P['verify_events_since']?',\x20events\x20since\x20'+P['verify_events_since']:'')+'.':''),S='IDEMPOTENT-REPLAY\x20HELD\x20(F-RQ-13A\x20⑨):\x20idempotency_key\x20\x22'+N+'\x22\x20already\x20names\x20an\x20attempt\x20of\x20'+('operation\x20\x22'+P['op']+'\x22\x20on\x20this\x20process\x20(')+(Q?'outcome\x20UNKNOWN\x20—\x20the\x20transaction\x20may\x20have\x20committed':'dispatched;\x20it\x20may\x20have\x20committed\x20or\x20succeeded')+(').\x20This\x20call\x20was\x20NOT\x20submitted.'+R+'\x20')+(Q?'Verify\x20the\x20outcome\x20first\x20(onchain_transaction\x20for\x20any\x20digest\x20/\x20onchain_events\x20for\x20the\x20sender\x20/\x20query\x20the\x20expected\x20object):\x20if\x20it\x20LANDED,\x20adopt\x20it\x20—\x20never\x20resubmit.\x20If\x20confirmed\x20ABSENT,\x20retry\x20with\x20a\x20NEW\x20idempotency_key\x20(the\x20verified\x20retry\x20is\x20a\x20new\x20attempt).\x20The\x20hold\x20expires\x20in\x2015\x20minutes.':'If\x20the\x20earlier\x20call\x20already\x20returned\x20a\x20successful\x20receipt,\x20adopt\x20it\x20—\x20never\x20resubmit\x20under\x20the\x20same\x20key.\x20If\x20it\x20never\x20returned,\x20verify\x20the\x20outcome\x20on-chain,\x20then\x20retry\x20with\x20a\x20NEW\x20idempotency_key.\x20The\x20hold\x20expires\x20in\x201\x20hour.');return{'content':[{'type':'text','text':S}],'structuredContent':{'result':{'type':'error','error':S,'error_code':'state_conflict','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':S,'onchain_state':'unknown',...Q?{'submission_state':'unknown'}:{},'idempotency_key':N,...Q&&P['sender']?{'submission_verification':{'sender':P['sender'],'failed_at':new Date()['toISOString'](),'verify_events_since':P['verify_events_since']??new Date(Date['now']()-0x5a*0x3e8)['toISOString'](),'digests':P['digests'],'idempotency_key':N}}:{}}}};}}}{const T=markerOpFor(c['operation_type'],c['data']),U=c['data']!==undefined?c['data']:c,V=pendingInFlightResend(T,U,c['submission'],c['env']);if(V)return{'content':[{'type':'text','text':V}],'structuredContent':{'result':{'type':'error','error':V,'error_code':'state_conflict','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':V}}};}switch(c['operation_type']){case'service':{const W=c['data'],X=await detectServiceGuardCircularDependency(W);if(X)return X;const Y=await prepareSaleWipSetOp(W,m?.['network']);if(Y)return Y;const Z=await checkSalesWipNetworkDeployment(W,m,h);if(Z)return Z;const a0=checkSalesZeroPrice(W);if(a0)return a0;const a1=await gateBuyWipPinDoctrine(W,m?.['network'],h);if(a1)return a1;const a2=describeBenchmarkIssueRisk(W?.['discount']?.['benchmark']);a2&&h['push'](a2);if(typeof W?.['discount']?.['time_ms_start']==='number'&&W['discount']['time_ms_start']>Date['now']()){const at=Math['round']((W['discount']['time_ms_start']-Date['now']())/0xea60);h['push']('COUPON\x20NOT\x20YET\x20LIVE:\x20this\x20discount\x27s\x20window\x20opens\x20at\x20'+new Date(W['discount']['time_ms_start'])['toISOString']()+'\x20'+('(in\x20~'+at+'\x20min).\x20Until\x20then\x20every\x20spend\x20attempt\x20aborts\x20with\x20E_DISCOUNT_TIME_INVALID\x20')+'(buy\x20dry_run\x20code\x2035)\x20even\x20though\x20the\x20coupon\x20is\x20already\x20minted\x20and\x20listed\x20as\x20usable\x20—\x20'+'do\x20NOT\x20distribute\x20it\x20to\x20recipients\x20before\x20the\x20window\x20opens.');}const a3=await checkDiscountFloorBeforeIssue(W,m?.['network'],{'resolveAddress':async au=>LocalMark['Instance']()['get_address'](au)['catch'](()=>undefined)??undefined,'fetchObjects':async(au,av)=>{const aw=await query_objects({'objects':au,'network':av});return aw?.['objects']??[];}});if(a3['block'])return{'content':[{'type':'text','text':a3['block']}],'structuredContent':{'result':{'type':'error','error':a3['block'],'error_code':'discount_zero_floor','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'Lower\x20discount_value\x20so\x20the\x20cheapest\x20SKU\x20still\x20pays\x20>=\x201\x20smallest\x20unit,\x20'+'switch\x20the\x20coupon\x20to\x20RATES\x20(type\x200)\x20with\x20a\x20value\x20below\x2010000,\x20or\x20price\x20a\x20'+'deliberate\x20free\x20tier\x20at\x201\x20smallest\x20unit\x20/\x20deliver\x20it\x20outside\x20the\x20sales\x20rails\x20'+'(allow_zero_total\x20waives\x20nothing\x20—\x20BSX-F07).'},'message':a3['block']}};a3['warning']&&h['push'](a3['warning']);const a4=await prepareFundOperation(W,'service',m?.['network']);if(a4['blockingErrors']['length']>0x0)return buildFundBlockResult(a4,'service');h['push'](...a4['warnings']);if(a4['confirmation']){h['push'](a4['confirmation']['message']);const au=a562b(a4['confirmation']);if(au)h['push'](au);}await warnMerchantCompensationFundLow(W,m?.['network'],h);const a5=W?.['order_allocators'];if(a5&&typeof a5==='object'){const av=Array['isArray'](a5['allocators'])?a5['allocators']:[];for(let aw=0x0;aw<av['length'];aw++){const ax=av[aw],ay=Array['isArray'](ax?.['sharing'])?ax['sharing']:[];if(ay['length']<=0x1)continue;const az=new Map();for(let aA=0x0;aA<ay['length'];aA++){const aB=ay[aA]?.['who'];let aC=typeof aB==='string'?aB:'';if(!aC){const aE=classifyRecipient(aB);if(aE?.['kind']==='entity')aC='Entity:'+aE['address'];else{if(aE?.['kind']==='signer')aC='Signer';else{if(aE?.['kind']==='submission')aC='Guard:'+aE['identifier'];else{if(aB)aC=JSON['stringify'](aB);}}}}if(!aC)continue;const aD=az['get'](aC)??0x0;az['set'](aC,aD+0x1);}for(const [aF,aG]of az){aG>0x1&&h['push']('DUPLICATE\x20SHARING\x20ENTITY:\x20Allocator['+aw+']\x20has\x20entity\x20\x22'+aF+'\x22\x20appearing\x20'+aG+'\x20times\x20'+'in\x20the\x20sharing\x20array.\x20This\x20is\x20likely\x20a\x20configuration\x20error\x20—\x20each\x20entity\x20should\x20appear\x20'+('at\x20most\x20once\x20per\x20allocator.\x20Total\x20sharing:\x20'+aG*0x64+'%\x20to\x20the\x20same\x20entity.\x20')+'If\x20intentional,\x20ignore\x20this\x20warning.');}}}if(a5){const aH=checkOrderAllocatorsPrePublish(a5,h);if(aH)return aH;const aI=await checkEntityRecipientGate(a5,'service.order_allocators',h);if(aI)return aI;warnAmountEscrowDeadlock(a5,W?.['sales'],h);}const a6=c['data']?.['order_new']?.['buy']?.['items'];if(Array['isArray'](a6))for(const aJ of a6){aJ&&typeof aJ==='object'&&'quantity'in aJ&&!('stock'in aJ)&&(aJ['stock']=aJ['quantity'],delete aJ['quantity']);}const a7=c['data']?.['order_new']?.['order_required_info'],a8=typeof a7==='string'?priorProofConsumptions(a7):[];a8['length']>0x0&&h['push']('PROOF\x20REUSE\x20(informational):\x20the\x20WTS\x20Proof\x20\x27'+a7+'\x27\x20already\x20anchored\x20'+('order_required_info\x20'+a8['length']+'\x20time(s)\x20earlier\x20this\x20session')+(a8[0x0]?.['service']?'\x20(service:\x20'+a8[0x0]['service']+')':'')+'.\x20Reuse\x20is\x20acceptable\x20and\x20privacy-preserving\x20—\x20a\x20Proof\x20records\x20the\x20contact\x20channel,\x20'+'not\x20an\x20order;\x20do\x20NOT\x20mint\x20a\x20per-order\x20proof\x20(that\x20would\x20publicly\x20link\x20orders).\x20'+'Acceptance\x20of\x20the\x20delivered\x20info\x20is\x20the\x20merchant\x27s\x20confirming\x20forward\x20on\x20this\x20order.');const a9=await checkDiscountThresholdBeforeBuy(c['data']??W,m?.['network'],{'resolveAddress':async aK=>LocalMark['Instance']()['get_address'](aK)['catch'](()=>undefined)??undefined,'fetchObjects':async(aK,aL)=>{const aM=await query_objects({'objects':aK,'network':aL});return aM?.['objects']??[];}});if(a9)return{'content':[{'type':'text','text':a9}],'structuredContent':{'result':{'type':'error','error':a9,'error_code':'discount_benchmark_unmet','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'The\x20coupon\x20would\x20be\x20consumed\x20with\x20no\x20discount\x20because\x20this\x20order\x27s\x20total\x20is\x20'+'below\x20the\x20coupon\x27s\x20threshold.\x20Raise\x20the\x20order\x20total\x20above\x20the\x20threshold,\x20omit\x20'+'\x27discount\x27\x20to\x20pay\x20the\x20list\x20price\x20and\x20keep\x20the\x20coupon,\x20or\x20use\x20a\x20coupon\x20issued\x20'+'without\x20a\x20threshold.'},'message':a9}};let aa=[];if(W?.['publish']===!![]){aa=await collectArbitrationRefsForPublish(W,m);const aK=await checkArbitrationsBeforePublish(aa,m,h);if(aK)return aK;if(a5){const aL=await checkRefundRecipientSatisfiability(a5,m,h);if(aL)return aL;}}warnPermissionAutoCreation(c['data'],'Service',h);let ab;if(c['data']?.['order_new']){const aM=await probeOrderNewWipReachability(c['data'],m?.['network']);if(aM)return aM;const aN=await deriveTotalPayIfOmitted(c['data'],m?.['network']);if(aN)h['push'](aN);const aO=gateOrderNewZeroTotal(c['data']);if(aO)return aO;const aP=await warnOrderNewFundCoverage(c['data'],m?.['network']);aP&&h['push'](aP);h['push']('FUND\x20COVERAGE\x20NOTE\x20(warn-only):\x20the\x20on-chain\x20buy\x20does\x20NOT\x20read\x20the\x20compensation\x20fund\x20—\x20'+'coverage\x20is\x20not\x20enforced\x20at\x20buy\x20time.\x20The\x20advisory\x20FUND\x20COVERAGE\x20warning\x20in\x20this\x20response\x20'+'(when\x20present)\x20is\x20the\x20only\x20pre-transaction\x20signal;\x20a\x20won\x20award\x20above\x20the\x20fund\x20still\x20aborts\x20'+'the\x20buyer\x27s\x20payout\x20with\x20code\x2027\x20at\x20claim\x20time\x20(the\x20claim\x20is\x20NOT\x20consumed;\x20settlement\x20is\x20'+'all-or-nothing).\x20Buyers:\x20check\x20the\x20fund\x20balance\x20before\x20paying.\x20Merchants:\x20keep\x20the\x20fund\x20'+'>=\x203x\x20expected\x20per-order\x20amounts.');const aQ=await gateOrderNewAmountLegCoverage(c['data'],m?.['network']);if(aQ)return aQ;const aR=await warnBuyGuardTimeCutoff(c['data'],m?.['network']);aR&&h['push'](aR);const aS=await warnBuyCustomerRequiredSelfAttested(c['data'],m?.['network']);aS&&h['push'](aS),ab=beginInFlight('order_new',c['data'],m);}const ac=await prepareSaleItemOp(W,m?.['network']);if(ac&&'block'in ac)return ac['block'];const ad=await prepareRestockOrderOp(W,m?.['network']);if(ad)return ad;W?.['restock']&&h['push']('RESTOCK\x20/\x20REFUND-WINDOW\x20DISCLOSURE:\x20restock\x20puts\x20a\x20refunded\x20order\x27s\x20purchased\x20units\x20back\x20on\x20'+'shelf\x20and\x20reopens\x20that\x20stock\x20for\x20sale\x20(the\x20order\x20path\x20is\x20two-pass\x20all-or-nothing\x20and\x20'+'once-per-order).\x20If\x20this\x20Service\x27s\x20machine\x20(or\x20its\x20template)\x20has\x20NO\x20refund-terminal\x20gate\x20—\x20'+'an\x20edge/guard\x20that\x20still\x20lets\x20orders\x20reach\x20a\x20refund\x20terminal\x20state\x20—\x20orders\x20inside\x20their\x20'+'refund\x20window\x20may\x20lose\x20refund\x20eligibility\x20or\x20create\x20fund-accounting\x20ambiguity\x20once\x20the\x20'+'restocked\x20units\x20are\x20resold.\x20Before\x20relisting,\x20confirm\x20the\x20machine\x27s\x20refund\x20rail\x20remains\x20'+'reachable\x20after\x20this\x20restock.');const ae=await prepareSalesAddDuplicateGate(W,m?.['network'],m);if(ae)return ae;const af=await gateServiceBuyGuardMount(c['data'],m?.['network']);if(af)return af;const {reentry_kind:ag,...ah}=c['data'],ai=ah['order_new']?.['buy']??ah['buy'];ai&&typeof ai==='object'&&'derive_wip_from_listing'in ai&&delete ai['derive_wip_from_listing'];const aj=new CallService(ah);let ak;try{ak=c['submission']?await aj['call_with_submission'](m,await transformSubmission(c['submission'])):await aj['call'](m);}catch(aT){const aU=aT['message']??String(aT);if(W?.['order_allocators_append']!=null&&(/allocation/i['test'](aU)&&(/MoveAbort\(.*,\s*20\s*\)/['test'](aU)||/abort code:\s*20\b/['test'](aU))||/EALLOCATORS_NOT_EXTENSION/i['test'](aU))){const aV=await describeAllocatorsNotExtensionDiff(W?.['object'],W['order_allocators_append'],m?.['network']);if(aV)throw new Error(aV+'\x0aOriginal\x20error:\x20'+aU);}if((W?.['order_new']?.['buy']?.['items']?.['length']??0x0)>0x0&&/coin not enough|E_COIN_NOT_ENOUGH|abort.*\b20\b/i['test'](aU))throw new Error('PURCHASE\x20ABORTED\x20(E_COIN_NOT_ENOUGH\x20/\x20abort\x2020):\x20the\x20payment\x20'+'total_pay\x20is\x20LESS\x20THAN\x20the\x20order\x20total.\x20On-chain\x20order\x20total\x20=\x20'+'sale.price\x20x\x20per-item\x20QUANTITY.\x20Common\x20cause:\x20the\x20inventory\x20number\x20'+'was\x20passed\x20as\x20the\x20purchase\x20quantity\x20(the\x20buy\x20item\x20field\x20is\x20the\x20'+'number\x20of\x20units\x20to\x20buy,\x20NOT\x20the\x20product\x27s\x20available\x20stock).\x20'+'Check\x20each\x20item\x27s\x20quantity\x20and\x20ensure\x20total_pay\x20>=\x20sum(price\x20x\x20quantity).\x20'+('Original\x20error:\x20'+aU));if(/not found|GetObjectExisted|resolve|LocalMark|failed to resolve/i['test'](aU)){const aW=typeof W?.['object']==='object'&&W?.['object']!==null?W['object']['permission']:undefined;throw new Error('DEPENDENCY\x20RESOLUTION\x20FAILED:\x20One\x20or\x20more\x20referenced\x20objects\x20could\x20not\x20be\x20resolved.\x0a'+('Original\x20error:\x20'+aU+'\x0a')+'Common\x20causes:\x0a'+'\x20\x201.\x20Object\x20name\x20typo\x20—\x20check\x20spelling\x20in\x20LocalMark\x0a'+'\x20\x202.\x20Object\x20not\x20yet\x20created\x20—\x20create\x20dependencies\x20first\x0a'+'\x20\x203.\x20Object\x20on\x20different\x20network\x20—\x20check\x20env.network\x0a'+('Referenced\x20objects\x20in\x20this\x20call:\x20machine='+(W?.['machine']??'<none>')+',\x20')+('buy_guard='+(W?.['buy_guard']??'<none>')+',\x20')+('permission='+(aW??'<inline/new>')+',\x20')+('arbitrations='+describeArbitrationPayload(W?.['arbitrations'])));}throw aT;}if(ab)recordInFlightOutcome(ab,ak);ac&&'prep'in ac&&ak?.['digest']&&await emitSaleItemOpReadback(ac['prep'],W,m?.['network'],h);if(W?.['discount']!=null&&ak?.['digest'])try{const aX=ResponseData(ak)['filter'](aY=>aY?.['change']==='created'&&typeof aY?.['type_raw']==='string'&&aY['type_raw']['includes']('::service::Discount')&&typeof aY?.['object']==='string');if(aX['length']>0x0){const aY=W['discount'],aZ=aY?.['time_ms_end']!=null?new Date(Number(aY['time_ms_end']))['toISOString']():'n/a';if(aX['length']===0x1&&typeof aY?.['name']==='string'&&aY['name']['length']>0x0){const b0=aX[0x0]['object'],b1=await LocalMark['Instance']()['get_address'](aY['name'],m['network']);!b1||b1['toLowerCase']()===b0['toLowerCase']()?(await LocalMark['Instance']()['put']([{'name':{'value':aY['name']},'address':b0}],m['network']),h['push']('DISCOUNT\x20ISSUED:\x20coupon\x20\x22'+aY['name']+'\x22\x20is\x20live\x20at\x20'+b0+'\x20(bound\x20to\x20this\x20service,\x20expires\x20'+aZ+',\x20single-use\x20—\x20burned\x20at\x20buy).\x20Reference\x20it\x20as\x20order_new.buy.discount:\x20\x22'+aY['name']+'\x22\x20or\x20by\x20the\x20object\x20ID.')):h['push']('DISCOUNT\x20ISSUED:\x20coupon\x20\x22'+aY['name']+'\x22\x20is\x20live\x20at\x20'+b0+'\x20(expires\x20'+aZ+',\x20single-use).\x20LocalMark\x20name\x20\x22'+aY['name']+'\x22\x20already\x20points\x20elsewhere\x20('+b1+')\x20—\x20reference\x20the\x20coupon\x20by\x20its\x20object\x20ID\x20in\x20order_new.buy.discount.');}else h['push']('DISCOUNT\x20ISSUED:\x20'+aX['length']+'\x20coupon(s)\x20live\x20(expires\x20'+aZ+',\x20single-use\x20—\x20burned\x20at\x20buy):\x20'+(''+aX['slice'](0x0,0x5)['map'](b2=>b2['object'])['join'](',\x20')+(aX['length']>0x5?',\x20...':'')+'.\x20')+'Each\x20recipient\x20holds\x20their\x20own\x20copy;\x20reference\x20one\x20by\x20its\x20object\x20ID\x20in\x20order_new.buy.discount.');}}catch(b2){h['push']('DISCOUNT\x20ISSUED:\x20the\x20transaction\x20succeeded\x20but\x20coupon\x20disclosure\x20failed:\x20'+(b2?.['message']??String(b2)));}W?.['order_new']&&typeof a7==='string'&&recordProofConsumption(a7,typeof W?.['object']==='string'?W['object']:undefined);const al=W?.['object']!=null&&typeof W['object']==='object',am=W?.['compensation_fund_add']!=null;al&&!am&&h['push']('Service.compensation_fund\x20balance\x20is\x200\x20—\x20no\x20refund\x20protection\x20for\x20buyers.\x20'+'If\x20buyers\x20need\x20refund\x20protection,\x20call\x20service.compensation_fund_add\x20with\x20a\x20Coin<T>\x20'+'to\x20deposit.\x20Without\x20deposit,\x20arbitration\x20rulings\x20cannot\x20withdraw\x20compensation\x20'+'from\x20this\x20Service.\x20(Note:\x20some\x20industries\x20like\x20freelance\x20do\x20not\x20require\x20this;\x20'+'the\x20evaluation\x20engine\x20will\x20check\x20industry-specific\x20requirements.)');if(al&&am&&W?.['compensation_fund_add']?.['balance']!=null){const b3=W['compensation_fund_add']['balance'],b4=Array['isArray'](W?.['sales'])?W['sales']:Array['isArray'](W?.['sales']?.['sales'])?W['sales']['sales']:[],b5=bi=>{if(typeof bi==='number'&&Number['isFinite'](bi))return bi;if(typeof bi==='string'&&/^\d+$/['test'](bi['trim']()))return Number(bi['trim']());return undefined;},b6=bi=>typeof bi==='string'&&/^\d*\.?\d+\s*[A-Za-z]{2,10}$/['test'](bi['trim']())?Number['parseFloat'](bi['trim']()):undefined,b7=b4['map'](bi=>bi?.['price'])['filter'](bi=>bi!=null),b8=b5(b3),b9=b6(b3),ba=b7['map'](b5),bb=b7['map'](b6),bc=b7['length']>0x0&&ba['every'](bi=>bi!==undefined)&&b8!==undefined,bd=b7['length']>0x0&&bb['every'](bi=>bi!==undefined)&&b9!==undefined,be=bc?b8:bd?b9:undefined,bf=bc?ba:bd?bb:[],bg=bf['length']>0x0?Math['max'](...bf):undefined,bh=0x3;be!==undefined&&bg!==undefined&&bg>0x0&&be<bh*bg&&h['push']('COMPENSATION\x20COVERAGE\x20BELOW\x20CEILING:\x20compensation_fund\x20deposit\x20('+be+')\x20is\x20less\x20than\x20'+(bh+'x\x20the\x20highest\x20SKU\x20price\x20=\x20'+bh*bg+'\x20')+('(highest\x20SKU\x20price\x20itself:\x20'+bg+').\x20The\x20chain\x20caps\x20any\x20award\x20at\x20')+(bh+'x\x20the\x20order\x20amount\x20(the\x20MAX_INDEMNITY_MULTIPLE\x20cap,\x20enforced\x20at\x20')+'ruling\x20time),\x20so\x20a\x20ruling\x20at\x20the\x20ceiling\x20would\x20abort\x20the\x20buyer\x27s\x20payout\x20with\x20code\x2027\x20'+'(E_COMPENSATION_NOT_MATCH)\x20even\x20though\x20the\x20ruling\x20is\x20valid.\x20'+('Recommend\x20depositing\x20>=\x20'+bh+'x\x20the\x20highest\x20price\x20via\x20compensation_fund_add.\x20')+'Above\x203x\x20is\x20optional\x20(it\x20only\x20buys\x20headroom\x20for\x20several\x20CONCURRENT\x20claims\x20against\x20the\x20same\x20'+'per-Service\x20pool,\x20which\x20is\x20empty\x20of\x20any\x20on-chain\x20concurrency\x20limit).');}const an=W?.['publish']===!![];if(an){const bi=gateServicePublishPreflight(W);if(bi)return bi;}if(an){const bj=new Set(['audit_compensation_fund','audit_arbitrations']),bk=auditService(W,{'network':m?.['network']})['filter'](bl=>!bj['has'](bl['rule_id']));for(const bl of bk){const bm=bl['severity']==='error'?'[AUDIT\x20ERROR]\x20':bl['severity']==='warning'?'[AUDIT]\x20':'[INFO]\x20';h['push'](bm+bl['message']+(bl['recommendation']?'\x20—\x20'+bl['recommendation']:''));}}let ao=an&&aa['length']>0x0;if(!an&&!ao&&am){const bn=await collectArbitrationRefsForPublish(W,m);ao=bn['length']>0x0;}if(an&&!ao&&am)throw new Error('HARD\x20PRE-CHECK\x20FAILED:\x20Cannot\x20publish\x20Service\x20with\x20compensation_fund\x20>\x200\x20but\x20no\x20Arbitration\x20bound.\x0a'+'On-chain\x20rule:\x20assert!(arbitration_count\x20>\x200,\x20E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND).\x0a'+'The\x20transaction\x20WILL\x20ABORT\x20on-chain\x20if\x20you\x20proceed.\x0a'+'Fix:\x20(1)\x20Create\x20an\x20Arbitration\x20object\x20first\x20(onchain_operations\x20with\x20operation_type=\x27arbitration\x27).\x0a'+'\x20\x20\x20\x20\x20(2)\x20Bind\x20it\x20in\x20this\x20same\x20call:\x20data.arbitrations={op:\x27add\x27,\x20objects:[<arbitration_name_or_id>]}\x0a'+'\x20\x20\x20\x20\x20\x20\x20\x20\x20(array\x20shorthand\x20data.arbitrations=[...]\x20is\x20also\x20accepted),\x20or\x20bind\x20it\x20in\x20a\x20prior\x0a'+'\x20\x20\x20\x20\x20\x20\x20\x20\x20call\x20—\x20arbitrations\x20already\x20bound\x20on\x20an\x20existing\x20Service\x20are\x20detected\x20automatically.\x0a'+'\x20\x20\x20\x20\x20(3)\x20Then\x20call\x20publish=true.\x0a'+'Note:\x20After\x20publish,\x20arbitrations\x20can\x20still\x20be\x20ADDED\x20(but\x20not\x20removed\x20without\x20pause+lock).');an&&!ao&&!am&&h['push']('WARNING:\x20Publishing\x20Service\x20without\x20arbitrations.\x20If\x20compensation_fund\x20was\x20'+'deposited\x20in\x20a\x20prior\x20call,\x20the\x20contract\x20WILL\x20ABORT\x20with\x20'+'E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND.\x20If\x20compensation_fund\x20is\x200,\x20'+'publish\x20will\x20succeed\x20but\x20buyers\x20have\x20no\x20dispute\x20resolution\x20path.\x20'+'Recommended:\x20bind\x20arbitrations\x20before\x20publish.');!an&&am&&!ao&&h['push']('WARNING:\x20Depositing\x20compensation_fund\x20on\x20a\x20Service\x20without\x20arbitrations\x20bound.\x20'+'If\x20this\x20Service\x20is\x20already\x20published,\x20arbitration\x20rulings\x20will\x20not\x20be\x20able\x20to\x20'+'withdraw\x20compensation\x20from\x20this\x20Service.\x20Recommended:\x20bind\x20arbitrations\x20first,\x20'+'then\x20deposit\x20compensation_fund.');const ap=await buildGuardSubmissionPrompt(ak,'service',{'network':m?.['network'],'signer':m?.['account'],'service_address':typeof W?.['object']==='string'?W['object']:undefined});if(ap)h['push'](ap);let aq;if(W?.['order_new']&&typeof W?.['object']==='string'&&a562c('customer_intelligence'))try{aq=await evaluateServiceFromGraph(W['object'],{'context_network':m?.['network']});}catch{}const ar=permissionEchoWarning(ak,'Service',W);if(ar)h['push'](ar);const as=handleCallResult(ak,y(W,aq));return l(z,A,c['operation_type'],ak,c['data'])['catch'](()=>{}),as;}case'machine':{if(c['data']['node']&&typeof c['data']['node']==='object'&&'json_or_markdown_file'in c['data']['node']){const bB=c['data']['node']['json_or_markdown_file'];let bC;try{const bE=resolve(bB);bC=readFileSync(bE,'utf-8');}catch(bF){throw new Error('Failed\x20to\x20read\x20file\x20\x27'+bB+'\x27:\x20'+bF['message']);}const bD=parseMachineNodesFromText(bC);if(!bD['success']){const bG=a562a(bD['errors']);throw new Error('Machine\x20node\x20validation\x20failed\x20for\x20file\x20\x27'+bB+'\x27:\x0a\x0a'+bG);}if(!bD['data'])throw new Error('No\x20nodes\x20found\x20in\x20file\x20\x27'+bB+'\x27');h['push']('json_or_markdown_file\x20mode:\x20file\x20\x27'+bB+'\x27\x20parsed\x20to\x20'+bD['data']['length']+'\x20node(s)\x20and\x20'+'mapped\x20to\x20op:\x27add\x27\x20+\x20bReplace:true\x20(complete\x20in-place\x20replacement).\x20op:\x27set\x27\x20is\x20not\x20used\x20because\x20'+'it\x20is\x20rejected\x20on\x20an\x20existing\x20Machine;\x20on\x20a\x20fresh\x20Machine\x20the\x20two\x20are\x20equivalent.'),c['data']['node']={'op':'add','nodes':bD['data'],'bReplace':!![]};if(c['data']?.['publish']===!![]){const bH=machinePublishGateViolation(bD['data']);if(bH)throw new Error('Machine\x20publish\x20pre-check\x20failed\x20for\x20file\x20\x27'+bB+'\x27:\x0a\x0a'+bH);}}const bo=c['data'],bp=await checkMachinePermissionBeforePublish(bo,m);bp&&h['push'](bp);const bq=bo?.['node']?.['nodes']??bo?.['node'];try{const bI=typeof bo?.['object']==='object'&&bo?.['object']!==null?bo['object']?.['name']:bo?.['object'];recordMachineNodeNames(bI,bq);}catch{}if(Array['isArray'](bq)){const bJ=/^(dispute|disputed|arbitration|arb_|arb\.|resolve_dispute|start_arbitration|open_dispute)/i;for(const bK of bq){const bL=typeof bK==='object'?bK?.['name']:'';typeof bL==='string'&&bJ['test'](bL)&&h['push']('ARBITRATION\x20SEPARATION\x20WARNING:\x20Machine\x20node\x20\x22'+bL+'\x22\x20appears\x20to\x20be\x20an\x20arbitration-related\x20node.\x0a'+'CORE\x20PRINCIPLE:\x20A\x20merchant\x20cannot\x20handle\x20disputes\x20fairly\x20—\x20they\x20would\x20be\x20\x27both\x20player\x20and\x20referee\x27.\x0a'+'The\x20WoWok\x20smart\x20contract\x20design\x20makes\x20Arbitration\x20a\x20completely\x20separate\x20object:\x0a'+'\x20\x20-\x20Arbitration\x20has\x20its\x20own\x20Permission,\x20voting_guard,\x20usage_guard,\x20and\x20balance\x0a'+'\x20\x20-\x20Arb\x20instances\x20have\x20a\x207-state\x20lifecycle\x20managed\x20by\x20Arbitration,\x20not\x20by\x20Machine\x0a'+'\x20\x20-\x20The\x20Order\x20object\x20is\x20the\x20bridge:\x20it\x20has\x20\x27progress\x27\x20(Machine)\x20and\x20\x27dispute\x27\x20(Arb\x20list)\x20fields\x0a'+'\x20\x20-\x20When\x20Arb\x20rules,\x20the\x20Order\x20executes\x20the\x20compensation\x20—\x20the\x20ONLY\x20connection\x20to\x20the\x20business\x20flow\x0a\x0a'+'CORRECT\x20PATTERN:\x0a'+'\x20\x20-\x20Machine:\x20business\x20states\x20only\x20(ordered\x20->\x20shipped\x20->\x20delivered\x20->\x20completed)\x0a'+'\x20\x20-\x20Arbitration:\x20separate\x20object\x20with\x20its\x20own\x20Permission\x20(NOT\x20shared\x20with\x20Service)\x0a'+'\x20\x20-\x20Arb:\x207-state\x20lifecycle\x20(Principal_confirming\x20->\x20Arbitrator_confirming\x20->\x20Voting\x20->\x20Arbitrated\x20->\x20Objectionable\x20->\x20Finished\x20->\x20Withdrawn)\x0a'+'\x20\x20-\x20R-M1-11:\x20NEVER\x20name\x20nodes\x20\x27refunded\x27/\x27disputed\x27/\x27arb\x27/\x27refund\x27\x20—\x20use\x20business\x20states\x20(\x27cancelled\x27/\x27returned\x27)\x20for\x20dispute\x20OUTCOMES;\x20refunds\x20route\x20via\x20Allocator\x20triggered\x20by\x20those\x20states,\x20disputes\x20via\x20the\x20separate\x20Arbitration\x20object\x0a\x0a'+'If\x20this\x20node\x20name\x20is\x20a\x20legitimate\x20business\x20state\x20(not\x20arbitration),\x20ignore\x20this\x20warning.');}}if(Array['isArray'](bq)){const bM=bq['map'](bN=>bN&&typeof bN==='object'&&bN['role']?bN['name']+'='+bN['role']:null)['filter'](Boolean);bM['length']>0x0&&h['push']('NODE\x20ROLES\x20(metadata):\x20'+bM['join'](',\x20')+'.\x20Roles\x20are\x20display-layer\x20semantics\x20'+'(draft/active/delivered/final/cancelled)\x20—\x20they\x20are\x20NOT\x20stored\x20on-chain\x20(nodes\x20carry\x20'+'name+pairs\x20only).\x20Consumers:\x20render\x20state\x20icons/colors\x20from\x20roles;\x20nodes\x20tagged\x20'+'\x27final\x27/\x27cancelled\x27\x20are\x20settlement\x20endpoints\x20—\x20advancing\x20to\x20them\x20should\x20trigger\x20the\x20'+'fund-release\x20reminder\x20(Allocation\x20trigger),\x20not\x20further\x20business\x20steps.');}try{let bN=Array['isArray'](bq)?bq:undefined,bO;if(!bN&&bo?.['publish']===!![]){const bP=await fetchChainAnchorContext(bo?.['object'],m);bP&&(bN=bP['nodes'],bO=bP['profiles']);}if(!bq&&bo?.['publish']===!![]&&bN){const bQ=machinePublishGateViolation(bN);bQ&&h['push']('PUBLISH\x20GATE\x20(on-chain\x20publish\x20check):\x20'+bQ);}if(bN){const bR=checkGuardAnchorReachability(bN,bO),bS=formatGuardAnchorWarnings(bR);if(bS)h['push'](bS);}if(bo?.['publish']===!![]&&bN){const bT=lintMachineGuardBindings(bN);if(bT)h['push'](bT);}}catch{}warnPermissionAutoCreation(c['data'],'Machine',h);const br=c['data']?.['object'],bs=typeof br==='string'?br:typeof br?.['name']==='string'?br['name']:undefined,bt={};try{if(typeof br==='string'&&br['startsWith']('0x'))bt['resolvedAddress']=br;else bs&&(bt['resolvedAddress']=await LocalMark['Instance']()['get_address'](bs)['catch'](()=>undefined)??undefined);bt['resolvedAddress']&&(bt['beforeCount']=(await fetchMachineNodes(bt['resolvedAddress'],m?.['network'],!![]))['length']);}catch{}const {reentry_kind:bu,...bv}=c['data'],bw=new CallMachine(bv),bx=c['submission']?await bw['call_with_submission'](m,await transformSubmission(c['submission'])):await bw['call'](m),by=await buildGuardSubmissionPrompt(bx,'machine',{'network':m?.['network'],'signer':m?.['account'],'machine_address':c['data']?.['object']});if(by)h['push'](by);try{await emitMachineNodeReadback(bs,bt,c['data']?.['node']?.['op'],bq,bx,m?.['network'],h);}catch{}const bz=permissionEchoWarning(bx,'Machine',c['data']);if(bz)h['push'](bz);const bA=handleCallResult(bx,y(c['data']));return l(z,A,c['operation_type'],bx,c['data'])['catch'](()=>{}),bA;}case'progress':{if(c['data']?.['operate']){h['push']('Progress\x20routing\x20fact:\x20on\x20an\x20order-bound\x20Progress\x20this\x20operate\x20call\x20'+'auto-routes\x20to\x20the\x20order-bound\x20path,\x20so\x20namedOperator=\x22\x22\x20(order\x20payer)\x20'+'forwards\x20execute\x20here\x20directly\x20—\x20switching\x20to\x20order.progress\x20is\x20NOT\x20required.\x20'+'If\x20this\x20Progress\x20is\x20standalone\x20(no\x20task\x20binding),\x20namedOperator=\x22\x22\x20forwards\x20'+'cannot\x20be\x20advanced\x20by\x20anyone\x20(no\x20order\x20payer\x20exists);\x20use\x20a\x20non-empty\x20'+'namedOperator\x20or\x20a\x20permissionIndex\x20forward\x20instead.');const c0=String(c['data']?.['operate']?.['operation']?.['forward']??'');/review/i['test'](c0)&&!c['data']?.['operate']?.['message']&&h['push']('Review-forward\x20hint:\x20the\x20real\x20exec\x20path\x20de-facto\x20requires\x20operate.message\x20for\x20Review-type\x20'+'forwards\x20(schema\x20marks\x20it\x20optional;\x20a\x20no-message\x20Review\x20failed\x20repeatedly\x20on\x20mainnet\x20until\x20the\x20'+'message\x20was\x20added).\x20Include\x20message:\x20\x27<review\x20text>\x27\x20in\x20this\x20call');const c1=c0+'\x20'+String(c['data']?.['operate']?.['operation']?.['next_node_name']??'');(/return.*(recv|receive|inspect)/i['test'](c1)||/^returned$/i['test'](String(c['data']?.['operate']?.['operation']?.['next_node_name']??'')))&&h['push']('NO-RESTOCK\x20reminder:\x20on-chain\x20stock\x20is\x20never\x20auto-restocked\x20—\x20a\x20return\x20only\x20moves\x20the\x20'+'Progress,\x20the\x20inventory\x20listing\x20is\x20not\x20refilled\x20automatically.\x20If\x20the\x20returned\x20goods\x20are\x20'+'resellable,\x20restock\x20the\x20sellable\x20item\x20via\x20the\x20sales\x20listing\x20before\x20relisting.');}const bU=typeof c['data']?.['review']?.['orderRef']==='string'?c['data']['review']['orderRef']:typeof c['data']?.['task']==='string'?c['data']['task']:undefined,bV=c['data']?.['review']&&c['submission']?await runReviewRepositoryWrite({'env':m,'submission':c['submission'],'review':c['data']['review'],'orderRef':bU}):[],bW=await snapshotProgressNodePreAdvance(c['data'],m),bX=new CallProgress(c['data']);let bY=c['submission']?await bX['call_with_submission'](m,await transformSubmission(c['submission'])):await bX['call'](m);if(!c['submission']&&isSubmissionMissingEcho(bY)){const c2=await resolveOrderRefForBackfill(c['data']?.['task']),c3=buildAutoFilledSubmission(bY,c2);c3&&(bY=await bX['call_with_submission'](m,await transformSubmission(c3)),h['push']('254\x20AUTO-BACKFILL:\x20the\x20pending\x20input\x20was\x20the\x20protocol\x20order\x20slot\x20(254)\x20—\x20filled\x20from\x20'+('this\x20operation\x27s\x20order\x20reference\x20('+c2+')\x20and\x20the\x20forward\x20was\x20re-driven\x20in-process,\x20')+'saving\x20the\x20manual\x20refill\x20round-trip.'));}if(!c['submission']&&bY&&typeof bY==='object'&&'submission'in bY){const c4=bY['submission'];if(Array['isArray'](c4)&&c4['length']>0x0){const c5=c4[0x0]?.['guard'];if(c5){const c6={'operation':'progress_next','network':m?.['network'],'signer':m?.['account'],'progress_address':c['data']?.['object'],'order_address':c['data']?.['task']},c7=await generateGuardSubmissionPrompt(c5,c6);c7&&h['push'](formatSubmissionPrompt(c7));}}}const bZ=handleCallResult(bY,y(c['data']));bV['length']>0x0&&!(bY&&typeof bY==='object'&&'digest'in bY&&bY?.['effects']?.['status']?.['status']==='success')&&mergeReviewStepsIntoOutput(bZ,bV,{'forwardOutcome':'failed\x20or\x20unconfirmed\x20—\x20the\x20pre-forward\x20review\x20write\x20MAY\x20have\x20landed\x20already\x20'+'(verify\x20via\x20the\x20repository\x20row\x20before\x20any\x20retry;\x20the\x20write\x20is\x20write-once)'});if(bY&&typeof bY==='object'&&'digest'in bY&&bY?.['effects']?.['status']?.['status']==='success'&&typeof c['data']?.['object']==='string'){const c8=c['data']?.['operate'],c9=c8?.['operation'],ca=await enrichWorkflowGuidance({'progressRef':c['data']['object'],'network':m?.['network'],'accountName':m?.['account'],'noCache':!![],'txResult':bY,'dryRun':m?.['dry_run']===!![],'compact':m?.['response_level']!=='full','operate':c9?.['forward']&&c9?.['next_node_name']?{'forward':c9['forward'],'next_node_name':c9['next_node_name'],'op':c8?.['op']}:undefined});mergeGuidanceIntoOutput(bZ,ca,{'responseLevel':m?.['response_level']});}bY&&typeof bY==='object'&&'digest'in bY&&bY?.['effects']?.['status']?.['status']==='success'&&await annotateProgressAdvanceOutcome(bZ,bW,bY,m);if(bY&&typeof bY==='object'&&'digest'in bY&&bY?.['effects']?.['status']?.['status']==='success'&&c['data']?.['review']){const cb={'env':m,'submission':c['submission'],'review':c['data']['review'],'orderRef':bU},cc=c['submission']?await runReviewRewardClaim(cb):await runReviewChain(cb),cd=[...bV,...cc];if(cd['length']>0x0)mergeReviewStepsIntoOutput(bZ,cd);else{if(c['data']?.['review'])try{if(bZ?.['structuredContent']&&typeof bZ['structuredContent']==='object'){const ce=bZ['structuredContent'];if(!ce['semantic']||typeof ce['semantic']!=='object')ce['semantic']={};ce['semantic']['warnings']=[...Array['isArray'](ce['semantic']['warnings'])?ce['semantic']['warnings']:[],'data.review\x20was\x20declared\x20but\x20produced\x20no\x20chained\x20steps\x20(missing\x20repository\x20and\x20reward_claim)\x20—\x20no\x20review\x20was\x20written\x20and\x20no\x20reward\x20was\x20claimed.'];}}catch{}}}return l(z,A,c['operation_type'],bY,c['data'])['catch'](()=>{}),bZ;}case'repository':{const cf=new CallRepository(c['data']),cg=c['submission']?await cf['call_with_submission'](m,await transformSubmission(c['submission'])):await cf['call'](m),ch=await buildGuardSubmissionPrompt(cg,'repository',{'network':m?.['network'],'signer':m?.['account'],'extra':{'repository':c['data']?.['object']}});if(ch)h['push'](ch);const ci=handleCallResult(cg,y(c['data']));return l(z,A,c['operation_type'],cg,c['data'])['catch'](()=>{}),ci;}case'arbitration':{const cj=await prepareFundOperation(c['data'],'arbitration',m?.['network']);if(cj['blockingErrors']['length']>0x0)return buildFundBlockResult(cj,'arbitration');h['push'](...cj['warnings']);if(cj['confirmation']){h['push'](cj['confirmation']['message']);const cs=a562b(cj['confirmation']);if(cs)h['push'](cs);}{const ct=c['data']['voting_deadline_change'],cu=ct?.['voting_deadline'];if(typeof cu==='number'&&cu<=Date['now']())return{'content':[{'type':'text','text':'voting_deadline_change\x20refused:\x20the\x20requested\x20deadline\x20is\x20not\x20in\x20the\x20future.\x20No\x20transaction\x20was\x20sent.'}],'structuredContent':{'result':{'type':'error','error':'voting_deadline\x20'+cu+'\x20is\x20<=\x20now\x20('+Date['now']()+').','error_code':'invalid_parameter','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'Set\x20voting_deadline_change.voting_deadline\x20to\x20an\x20ms-epoch\x20timestamp\x20STRICTLY\x20in\x20the\x20future\x20and\x20resubmit.\x20Moving\x20the\x20deadline\x20into\x20the\x20past\x20is\x20refused\x20client-side:\x20it\x20would\x20silently\x20revoke\x20every\x20other\x20arbitrator\x27s\x20remaining\x20vote\x20window\x20(instant-sovereignty\x20loophole).'},'message':'voting_deadline_change\x20refused\x20—\x20the\x20new\x20deadline\x20must\x20be\x20strictly\x20in\x20the\x20future.'}};}try{const cv=c['data']?.['dispute'];if(cv&&typeof c['data']?.['object']==='string'){const cw=c['data']['object'],cx=cw['startsWith']('0x')?cw:await LocalMark['Instance']()['get_address'](cw)??undefined;if(cx){const cy=await query_objects({'objects':[cx],'no_cache':!![],'network':m?.['network']}),cz=readRawOnchainAmount(((cy?.['objects']?.[0x0])?.['data']??cy?.['objects']?.[0x0])?.['fee']),cA=disputeFeeReceipt({'venueFee':cz});if(cA)h['push'](cA);}}}catch{}try{const cB=c['data']?.['arbitration'],cC=typeof cB?.['indemnity']==='number'?cB['indemnity']:undefined;if(cB&&typeof cB['arb']==='string'&&cC!==undefined){const cD=cB['arb']['startsWith']('0x')?cB['arb']:await LocalMark['Instance']()['get_address'](cB['arb'])??undefined;if(cD){const cE=await query_objects({'objects':[cD],'no_cache':!![],'network':m?.['network']}),cF=(cE?.['objects']?.[0x0])?.['data']??cE?.['objects']?.[0x0],cG=typeof cF?.['order']==='string'&&cF['order']['startsWith']('0x')?cF['order']:undefined;let cH,cI;if(cG){const cK=await query_objects({'objects':[cG],'no_cache':!![],'network':m?.['network']}),cL=(cK?.['objects']?.[0x0])?.['data']??cK?.['objects']?.[0x0];cH=readRawOnchainAmount(cL?.['amount']);if(typeof cL?.['service']==='string'&&cL['service']['startsWith']('0x')){const cM=await query_objects({'objects':[cL['service']],'no_cache':!![],'network':m?.['network']});cI=readRawOnchainAmount(((cM?.['objects']?.[0x0])?.['data']??cM?.['objects']?.[0x0])?.['compensation_fund']);}}const cJ=awardPoolCapacityPosture({'indemnity':cC,'pool':cI,'orderAmount':cH});h['push'](awardPoolCapacityReceipt(cJ,{'indemnity':cC,'pool':cI,'orderAmount':cH}));}}}catch{}const ck=new CallArbitration(c['data']),cl=c['submission']?await ck['call_with_submission'](m,await transformSubmission(c['submission'])):await ck['call'](m),cm=await buildGuardSubmissionPrompt(cl,'arbitration',{'network':m?.['network'],'signer':m?.['account'],'extra':{'arbitration':c['data']?.['object']}});if(cm)h['push'](cm);const cn=c['data']?.['object'],co=cn!==null&&typeof cn==='object';co&&c['data']?.['pause']!==![]&&(h['push']('ARBITRATION\x20ACTIVATION\x20REQUIRED:\x20a\x20newly\x20created\x20Arbitration\x20defaults\x20to\x20bPaused=true\x20—\x20'+'dispute\x20filing\x20aborts\x20with\x20E_PAUSED\x20until\x20unpaused.\x20Issue\x20'+'{operation_type:\x27arbitration\x27,\x20data:{object:\x27<arb>\x27,\x20pause:false}}\x20before\x20binding\x20it\x20'+'to\x20a\x20Service\x20or\x20accepting\x20disputes.\x20NOTE:\x20unpausing\x20requires\x20permission\x20356\x20—\x20'+'the\x20creator\x20passes\x20this\x20check\x20as\x20the\x20new\x20Permission\x27s\x20admin\x20(admins\x20are\x20exempt\x20'+'from\x20permission\x20checks);\x20any\x20OTHER\x20operator\x20needs\x20an\x20explicit\x20356\x20grant\x20first.'),h['push']('PERMISSION\x20INITIALIZATION\x20REQUIRED:\x20a\x20freshly\x20created\x20Arbitration\x20has\x20NO\x20permission\x20'+'grants\x20(350-368\x20all\x20unassigned)\x20—\x20every\x20NON-admin\x20caller\x20aborts\x20with\x20\x27Missing\x20permission\x27\x20'+'(code\x205);\x20the\x20new\x20Permission\x27s\x20admin\x20(its\x20creator)\x20always\x20passes\x20and\x20needs\x20no\x20grants.\x20'+'OPEN\x20VOTING\x20IS\x20NOT\x20PERMISSIONLESS:\x20an\x20empty\x20voting_guard\x20means\x20every\x20358\x20(vote)\x20grantee\x20'+'votes\x20with\x20EQUAL\x20weight\x20(1\x20person\x201\x20vote)\x20—\x20vote()\x20asserts\x20358\x20unconditionally:\x20only\x20the\x20'+'arb\x27s\x20Permission\x20admin\x20(its\x20creator,\x20by\x20default)\x20and\x20explicit\x20358\x20grantees\x20can\x20vote,\x20so\x20'+'grant\x20358\x20to\x20BOTH\x20disputing\x20parties\x20and\x20every\x20intended\x20non-admin\x20voter,\x20or\x20voting\x20collapses\x20'+'to\x20admin-only\x20(the\x20arb\x20admin\x20is\x20the\x20sole\x20voter\x20AND\x20judge).\x20'+'Recommended\x20grants\x20via\x20the\x20Arbitration\x27s\x20Permission\x20object\x20(permission_index_add)\x20for\x20'+'NON-admin\x20operators:\x20356\x20(pause/unpause),\x20357\x20(fee),\x20362\x20(voting\x20deadline),\x20363\x20(reset),\x20'+'364-366\x20(withdraw/fees\x20alloc/transfer),\x20367-368\x20(owner\x20receive/UM);\x20'+'arbitrator:\x20361\x20(confirm\x20materials,\x20starts\x20voting)\x20+\x20359\x20(issue\x20ruling).'));if(co)try{const cN=c['data'],cO=Array['isArray'](cN?.['voting_guard']?.['guards'])?cN['voting_guard']['guards']:[],cP=[];for(const cS of cO){const cT=cS?.['vote_weight']?.['FixedValue'];if(typeof cT==='number'&&Number['isFinite'](cT)&&cT>=0x0)cP['push'](cT);}const cQ=cP['reduce']((cU,cV)=>cU+cV,0x0),cR=checkArbitrationVenueOrder({'unpaused_at_creation':cN?.['pause']===![]?!![]:undefined,'voting_guard_count':cO['length'],'max_weight_share':cO['length']>0x0&&cP['length']===cO['length']&&cQ>0x0?Math['max'](...cP)/cQ:undefined,'fee':cN?.['fee'],'has_description':typeof cN?.['description']==='string'&&cN['description']['trim']()!==''?!![]:cN?.['description']===undefined?![]:undefined})['filter'](cU=>cU['order_id']!=='V1-activation');for(const cU of cR)h['push'](cU['message']);h['push'](venueOperatingDoctrine());}catch{}const cp=c['data'],cq=cn!==null&&typeof cn==='string'&&cp?.['pause']===![];if(cq){const cV=ck['content']?.['fee'],cW=cp?.['fee']??cV,cX=cW===0x0||cW==='0'||cW==='0.0'||cW==='0WOW';cW!=null&&cX&&h['push']('FREE\x20ARBITRATION:\x20this\x20Arbitration\x20activates\x20with\x20fee\x20=\x200\x20—\x20dispute\x20filers\x20pay\x20nothing\x20'+'(any\x20coin\x20they\x20send\x20is\x20refunded\x20on\x20filing;\x20only\x20self.fee\x20is\x20escrowed\x20for\x20the\x20arbitrator).\x20'+'The\x20arbitrator\x20earns\x20no\x20per-case\x20income\x20from\x20this\x20service.\x20If\x20this\x20is\x20intentional\x20'+'(e.g.\x20a\x20free-dispute\x20commercial\x20model),\x20ignore\x20this\x20warning;\x20to\x20charge\x20per\x20case,\x20set\x20'+'a\x20fee:\x20{operation_type:\x27arbitration\x27,\x20data:{object:\x27<arb>\x27,\x20fee:<amount>}}.');}if(cp?.['dispute']!=null){const cY=cp['dispute']?.['fee']?.['balance'],cZ=ck['content']?.['fee'];h['push'](disputeFeeReconciliation(cZ,cY));}if(typeof cp?.['vote']?.['arb']==='string'&&typeof m?.['account']==='string')try{const d0=cp['vote']['arb']['startsWith']('0x')?cp['vote']['arb']:await LocalMark['Instance']()['get_address'](cp['vote']['arb'])??undefined;if(d0){const d1=await query_objects({'objects':[d0],'no_cache':!![],'network':m?.['network']}),d2=d1?.['objects']?.[0x0],d3=d2?.['data']??d2,d4=Array['isArray'](d3?.['voting_guard'])?d3['voting_guard']['filter'](Boolean):[];if(d4['length']===0x0){const d5=typeof d3?.['permission']==='string'?d3['permission']:undefined;if(d5){const d6=await query_objects({'objects':[d5],'no_cache':!![],'network':m?.['network']}),d7=d6?.['objects']?.[0x0],d8=d7?.['data']??d7,d9=Array['isArray'](d8?.['admin'])?d8['admin']:[];if(!d9['includes'](m['account'])){const da=await fetchEntityPermissions(d5,m?.['network']),db=da['get'](m['account'])??[];!db['includes'](0x166)&&h['push']('VOTE\x20PRE-FLIGHT:\x20account\x20'+m['account']+'\x20holds\x20NO\x20permission\x20358\x20on\x20this\x20Arbitration\x27s\x20'+'Permission\x20('+d5+'),\x20and\x20the\x20arb\x20has\x20no\x20voting_guard\x20(plain-vote\x20mode\x20asserts\x20358\x20'+'unconditionally)\x20—\x20this\x20vote\x20will\x20be\x20REFUSED\x20before\x20any\x20transaction\x20is\x20sent.\x20Remedy:\x20the\x20arb\x27s\x20'+'Permission\x20admin\x20grants\x20358\x20(permission_index_add\x20on\x20'+d5+';\x20equal-weight\x201-person-1-vote),\x20'+'or\x20the\x20voter\x20uses\x20the\x20weighted\x20path\x20vote.voting_guard=<registered\x20guard>\x20(passport-authorized,\x20no\x20358).\x20'+'NOTE:\x20if\x20a\x20transport\x20\x27fetch\x20failed\x27\x20surfaces\x20during\x20the\x20permission\x20read,\x20the\x20vote\x20was\x20NOT\x20submitted\x20—\x20'+'nothing\x20is\x20sent\x20until\x20the\x20permission\x20check\x20passes;\x20do\x20not\x20run\x20commit-state\x20verification.');}}}else{if(cp['vote']['voting_guard']==null){const dc=d4['map'](dd=>String(dd?.['guard']??dd))['join'](',\x20');h['push']('VOTE\x20PRE-FLIGHT\x20(B-38):\x20this\x20Arbitration\x20carries\x20'+d4['length']+'\x20registered\x20voting_guard(s)\x20['+dc+']\x20—\x20a\x20PLAIN\x20vote\x20(no\x20data.vote.voting_guard)\x20'+'aborts\x20on-chain\x20with\x20E_VOTING_GUARD_USED\x20(abort\x202)\x20and\x20the\x20transaction\x20is\x20LOST.\x20Resubmit\x20with\x20'+'the\x20two-step\x20shape:\x20{operation_type:\x27arbitration\x27,\x20data:{vote:{arb:\x27<arb>\x27,\x20voting_guard:\x27<one\x20of\x20the\x20guards\x20above>\x27,\x20...}}}\x20'+'(the\x20weighted\x20path\x20authorizes\x20via\x20the\x20guard\x27s\x20passport\x20and\x20does\x20NOT\x20require\x20permission\x20358).');}}}}catch{}c['data']?.['arbitration']&&(h['push']('RULING\x20DOES\x20NOT\x20SETTLE\x20ESCROW:\x20this\x20ruling\x20records\x20the\x20feedback\x20+\x20indemnity\x20on\x20the\x20Arb\x20case\x20'+'object\x20ONLY\x20—\x20it\x20moves\x20no\x20funds\x20and\x20does\x20NOT\x20adjust\x20the\x20order\x27s\x20escrow\x20(the\x20Machine\x20workflow\x20'+'and\x20its\x20Allocation\x20are\x20independent\x20of\x20arbitration;\x20there\x20is\x20no\x20on-chain\x20linkage).\x20To\x20actually\x20'+'pay\x20the\x20buyer,\x20the\x20dispute\x20must\x20be\x20confirmed\x20and\x20then\x20claimed\x20via\x20'+'{operation_type:\x27order\x27,\x20data:{object:\x27<order>\x27,\x20arb_claim_compensation:{...}}}\x20—\x20the\x20indemnity\x20'+'is\x20paid\x20from\x20the\x20Service\x27s\x20merchant-prepaid\x20compensation_fund\x20(NOT\x20from\x20escrow),\x20capped\x20at\x203x\x20the\x20'+'order\x20amount,\x20and\x20it\x20does\x20NOT\x20re-split\x20the\x20allocator\x20ratios\x20(partial\x20/\x20proportional\x20refunds\x20via\x20a\x20'+'verdict\x20are\x20not\x20expressible\x20on-chain).\x20Because\x20the\x20two\x20tracks\x20are\x20independent,\x20the\x20buyer\x20can\x20still\x20'+'be\x20paid\x20the\x20FULL\x20escrow\x20AND\x20the\x20indemnity:\x20to\x20prevent\x20the\x20dual\x20payout,\x20freeze\x20the\x20settlement\x20by\x20'+'holding\x20the\x20order\x27s\x20edge\x20to\x20\x27completed\x27\x20before\x20it\x20settles\x20(hold\x20permission\x20=\x20the\x20forward\x27s\x20execute\x20'+'permission;\x20a\x20merchant-only\x20edge\x20needs\x20the\x20merchant\x20or\x20keeper\x20to\x20hold\x20it),\x20or\x20explicitly\x20accept\x20both\x20payouts.'),h['push']('ESCROW\x20FORENSICS\x20(refund-then-claim):\x20the\x20reverse\x20ordering\x20—\x20escrow\x20refund\x20first,\x20indemnity\x20'+'claim\x20second\x20—\x20is\x20NOT\x20on-chain\x20blocked,\x20but\x20it\x20IS\x20on-chain\x20distinguishable.\x20The\x20order-side\x20fund\x20'+'facts\x20(amount,\x20escrow\x20balance,\x20withdraw\x20history\x20with\x20per-payout\x20recipient\x20polarity,\x20claimed_by,\x20'+'workflow\x20node)\x20are\x20attached\x20to\x20this\x20result\x20as\x20order_fund_facts,\x20and\x20to\x20every\x20query\x20of\x20this\x20Arb\x20case\x20'+'as\x20_order_fund_facts\x20—\x20read\x20them\x20before\x20finalizing\x20the\x20indemnity.\x20POLARITY\x20DECIDES\x20THE\x20NETTING\x20'+'(rex5\x20B-66):\x20payouts\x20released\x20TO\x20THE\x20ORDER\x20(buyer-side\x20refund\x20rail)\x20→\x20net\x20the\x20award\x20against\x20the\x20'+'refunded\x20principal,\x20compensate\x20the\x20delta;\x20payouts\x20released\x20to\x20NON-order\x20recipients\x20(merchant/Entity\x20'+'side\x20—\x20settlement\x20or\x20recover)\x20→\x20the\x20buyer\x20received\x20nothing\x20from\x20those,\x20their\x20loss\x20is\x20the\x20FULL\x20price\x20'+'and\x20the\x20award\x20must\x20NOT\x20be\x20reduced.\x20A\x20positive\x20escrow_deficit\x20alone\x20proves\x20only\x20that\x20money\x20LEFT\x20the\x20'+'escrow,\x20never\x20who\x20received\x20it.\x20The\x20defendant\x20can\x20attach\x20the\x20same\x20forensics\x20to\x20the\x20case\x20statement.'));const cr=handleCallResult(cl,y(c['data']));try{const dd=!!cl&&typeof cl==='object'&&cl?.['effects']?.['status']?.['status']==='success';if(dd){const de=c['data'],df=de?.['vote']?.['arb']??de?.['confirm']?.['arb']??de?.['arbitration']?.['arb']??de?.['reset']?.['arb']??de?.['feedback']?.['arb']??de?.['arb_withdraw']?.['arb']??de?.['voting_deadline_change']?.['arb'],dg=de?.['dispute']?.['order'];if(df||dg){const dh=await buildOrderFundFacts({'arbRef':df,'orderRef':dg,'network':m?.['network']});dh&&(cr['structuredContent']['order_fund_facts']=dh['structured'],cr['content']['push']({'type':'text','text':dh['text']}));}}}catch{}try{const di=c['data'],dj=!!cl&&typeof cl==='object'&&cl?.['effects']?.['status']?.['status']==='success',dk=!!(di?.['confirm']||di?.['vote']||di?.['arbitration']);dj&&dk&&Array['isArray'](cr['content'])&&cr['content']['push']({'type':'text','text':'MONEY-MOVEMENT\x20CHECKLIST\x20—\x20this\x20adjudication\x20step\x20wrote\x20case\x20STATE\x20only\x20'+'(status\x20/\x20feedback\x20/\x20indemnity);\x20it\x20moved\x20NO\x20funds\x20and\x20paid\x20no\x20one:\x20no\x20wallet\x20balance\x20changed\x20'+'and\x20the\x20escrowed\x20case\x20fee\x20is\x20still\x20in\x20the\x20Arb\x20case.\x20To\x20actually\x20move\x20the\x20arbitration\x20fee,\x20'+'continue\x20in\x20order:\x20(1)\x20arb_withdraw\x20—\x20pulls\x20the\x20case\x20fee\x20into\x20the\x20Arbitration\x20(Registration)\x20'+'object\x27s\x20balance\x20pool\x20(immediately\x20from\x20state\x205\x20Finished;\x20from\x20state\x203\x20only\x20after\x20the\x2030-day\x20'+'no-objection\x20window;\x20refused\x20in\x20states\x200/1/2,\x20never\x20in\x20state\x204);\x20'+'(2)\x20fees_transfer\x20—\x20moves\x20the\x20Arbitration\x27s\x20ENTIRE\x20balance\x20pool\x20in\x20ONE\x20call\x20to\x20'+'to.allocation\x20(an\x20Allocation\x20object)\x20or\x20to.treasury\x20(a\x20Treasury\x20object),\x20single-key\x20\x27to\x27\x20'+'shape,\x20payment_index\x20required\x20(see\x20the\x20fees_transfer\x20field\x20description);\x20'+'(3)\x20treasury\x20target\x20only\x20—\x20treasury\x20receive:\x20\x22recently\x22\x20(permission\x20253)\x20intakes\x20the\x20'+'arrived\x20CoinWrapper,\x20then\x20treasury\x20withdraw\x20pays\x20out.\x20A\x20successful\x20arb_withdraw\x20with\x20no\x20'+'wallet\x20balance\x20change\x20is\x20EXPECTED\x20—\x20the\x20fee\x20sits\x20in\x20the\x20Arbitration\x20object\x27s\x20pool\x20until\x20'+'step\x20(2).\x20The\x20order-escrow\x20/\x20indemnity\x20track\x20is\x20independent\x20of\x20this\x20fee\x20track.'});}catch{}return l(z,A,c['operation_type'],cl,c['data'])['catch'](()=>{}),cr;}case'contact':{warnPermissionAutoCreation(c['data'],'Contact',h);const dl=new CallContact(c['data']),dm=c['submission']?await dl['call_with_submission'](m,await transformSubmission(c['submission'])):await dl['call'](m),dn=await buildGuardSubmissionPrompt(dm,'contact',{'network':m?.['network'],'signer':m?.['account']});if(dn)h['push'](dn);const dp=handleCallResult(dm,y(c['data']));return l(z,A,c['operation_type'],dm,c['data'])['catch'](()=>{}),dp;}case'treasury':{const dq=await prepareFundOperation(c['data'],'treasury',m?.['network']);if(dq['blockingErrors']['length']>0x0)return buildFundBlockResult(dq,'treasury');h['push'](...dq['warnings']);if(dq['confirmation']){h['push'](dq['confirmation']['message']);const dv=a562b(dq['confirmation']);if(dv)h['push'](dv);}const dr=new CallTreasury(c['data']),ds=c['submission']?await dr['call_with_submission'](m,await transformSubmission(c['submission'])):await dr['call'](m),dt=await buildGuardSubmissionPrompt(ds,'treasury',{'network':m?.['network'],'signer':m?.['account'],'extra':{'treasury':c['data']?.['object']}});if(dt)h['push'](dt);const du=handleCallResult(ds,y(c['data']));return l(z,A,c['operation_type'],ds,c['data'])['catch'](()=>{}),du;}case'reward':{const dw=await prepareFundOperation(c['data'],'reward',m?.['network']);if(dw['blockingErrors']['length']>0x0)return buildFundBlockResult(dw,'reward');h['push'](...dw['warnings']);if(dw['confirmation']){h['push'](dw['confirmation']['message']);const dC=a562b(dw['confirmation']);if(dC)h['push'](dC);}assertRewardRecipientSemantics(c['data']?.['guard_add']),await assertRewardReplayStamp(c['data']?.['guard_add'],m?.['network'],h),await checkRewardOnceArming(c['data'],m?.['network'],h);const dx=transformRewardInput(c['data']),dy=new CallReward(dx),dz=c['submission']?await dy['call_with_submission'](m,await transformSubmission(c['submission'])):await dy['call'](m);try{h['push'](...await verifyRewardEvidenceBindings(dz,c['data']?.['object'],c['data']?.['guard_add'],m?.['network']));}catch{}const dA=await buildGuardSubmissionPrompt(dz,'reward',{'network':m?.['network'],'signer':m?.['account'],'extra':{'reward':c['data']?.['object']}});if(dA)h['push'](dA);try{const dD=dz?.['digest'];if(c['data']?.['claim']!=null&&typeof dD==='string'&&dD!==''){const dE=await query_events({'type':'RewardClaimEvent','order':'descending','limit':0x5,'network':m?.['network'],'no_cache':!![]}),dF=buildClaimLedgerEcho(dE,dD);if(dF)h['push'](dF);}}catch{}const dB=handleCallResult(dz,y(c['data']));return l(z,A,c['operation_type'],dz,c['data'])['catch'](()=>{}),dB;}case'allocation':{const dG=await prepareFundOperation(c['data'],'allocation',m?.['network']);if(dG['blockingErrors']['length']>0x0)return buildFundBlockResult(dG,'allocation');h['push'](...dG['warnings']);if(dG['confirmation']){h['push'](dG['confirmation']['message']);const dO=a562b(dG['confirmation']);if(dO)h['push'](dO);}const dH=[];if(c['data']?.['alloc_by_guard']&&c['submission']){const dP=new Set();for(const dQ of c['submission']['submission']||[]){for(const dR of dQ?.['submission']||[]){const dS=typeof dR?.['value']==='string'?dR['value']:'';if(/^0x[0-9a-fA-F]{64}$/['test'](dS))dP['add'](dS);}}if(dP['size']>0x0)try{const dT=(await batchQueryObjectsByIds([...dP],m?.['network'],!![]))['filter'](dX=>dX?.['type']==='Order'),dU=c['data']?.['acknowledge_dual_payout']===!![],dV=await storeDualPayoutVerdict(m);let dW={'track':'unknown'};try{const dX=c['data'],dY=dX?.['alloc_batch'],dZ=Array['isArray'](dY)&&dY['length']>0x0?dY:[dX?.['object']],e0=[];for(const e1 of dZ){if(typeof e1!=='string')continue;if(/^0x[0-9a-fA-F]{64}$/['test'](e1)){e0['push'](e1);continue;}const e2=await LocalMark['Instance']()['get_address'](e1)['catch'](()=>undefined)??undefined;if(typeof e2==='string'&&e2['startsWith']('0x'))e0['push'](e2);}if(e0['length']>0x0){let e3;const e4=dX?.['alloc_by_guard'];if(typeof e4==='string'&&/^0x[0-9a-fA-F]{64}$/['test'](e4))e3=e4;else typeof e4==='string'&&(e3=await LocalMark['Instance']()['get_address'](e4)['catch'](()=>undefined)??undefined);const e5=await batchQueryObjectsByIds(e0,m?.['network'],!![]),e6=e9=>e9['track']==='entity-directed'?0x0:e9['track']==='unknown'?0x1:0x2;let e7;const e8=new Set();for(const e9 of e5??[]){if(!e9)continue;const ea=classifyDualPayoutTrack(e9?.['allocators'],e3);if(!e7||e6(ea)>e6(e7))e7=ea;if(ea['track']==='entity-directed'){for(const eb of ea['recipients']??[])e8['add'](eb);}}e7&&(dW=e7['track']==='entity-directed'?{'track':'entity-directed','recipients':Array['from'](e8)}:e7);}}catch{}for(const ec of dT){if(typeof ec['claimed_by']==='string'&&ec['claimed_by']['startsWith']('0x')){let ed;try{ed=(await batchQueryObjectsByIds([ec['claimed_by']],m?.['network'],!![]))?.['find'](eg=>eg?.['type']==='Arb');}catch{}const ee=ed?ed['indemnity']:undefined,ef=ed!=null&&(ee==null||String(ee['amount']??'0')==='0');if(ef){h['push']('DUAL\x20PAYOUT\x20N/A\x20(zero\x20indemnity):\x20Order\x20'+ec['object']+'\x27s\x20arbitration\x20case\x20'+ec['claimed_by']+'\x20CONCLUDED\x20with\x20ZERO\x20compensation\x20'+'(indemnity\x20none/0\x20—\x20nothing\x20was\x20paid\x20from\x20the\x20compensation\x20fund),\x20so\x20this\x20escrow\x20release\x20can\x20never\x20be\x20a\x20double\x20payout\x20'+'and\x20no\x20acknowledge_dual_payout\x20is\x20needed.\x20'+'Note:\x20on\x20LEGACY\x20rails\x20still\x20carrying\x20a\x20claimed_by\x20pairing\x20(pre-decision-11\x20shape)\x20the\x20on-chain\x20guard\x20may\x20REJECT\x20the\x20claimed_by-gated\x20leg\x20(guard_rejected);\x20decision-11\x20node-gated\x20rails\x20are\x20unaffected.');continue;}if(!dU){if(dW['track']==='entity-directed'){const eg=ee!=null?String(ee['amount']??'?'):'unreadable';h['push']('DUAL\x20PAYOUT\x20ADVISORY\x20(entity-directed\x20release):\x20Order\x20'+ec['object']+'\x20carries\x20a\x20recorded\x20arbitration\x20indemnity\x20award\x20'+('(claimed_by='+ec['claimed_by']+';\x20indemnity\x20amount\x20'+eg+')\x20and\x20this\x20alloc_by_guard\x20releases\x20its\x20escrow\x20to\x20FIXED\x20')+('ENTITY\x20recipients\x20('+dW['recipients']['join'](',\x20')+')\x20—\x20no\x20buyer-receivable\x20leg,\x20so\x20the\x20buyer\x20')+'double-dip\x20block\x20does\x20not\x20apply.\x20Note\x20the\x20compensation\x20recipient\x20may\x20still\x20net\x20compensation\x20+\x20escrow\x20'+'(merchant\x20stacking);\x20verify\x20that\x20is\x20the\x20intended\x20commercial\x20outcome.\x20'+'Direction-blind\x20protocol:\x20the\x20order-move\x20entrypoint\x20exposes\x20NO\x20winner/direction\x20field,\x20so\x20the\x20ruling\x27s\x20beneficiary\x20is\x20not\x20machine-verifiable\x20—\x20'+'a\x20buyer-won\x20case\x20would\x20have\x20its\x20refund\x20leg\x20hard-blocked\x20while\x20THIS\x20leg\x20passes;\x20the\x20same\x20facts\x20ride\x20this\x20'+'response\x20as\x20structured\x20semantic.red_flags\x20(F-RQD2-05).'),dH['push']({'code':'merchant_stacking_possible','order':ec['object'],'arb_case':ec['claimed_by'],'indemnity_amount':eg,'escrow_recipients':dW['recipients'],'note':'entity-directed\x20escrow\x20release\x20passed\x20while\x20an\x20arbitration\x20indemnity\x20is\x20recorded\x20on\x20the\x20same\x20order;\x20the\x20protocol\x20exposes\x20no\x20winner/direction\x20field\x20so\x20the\x20ruling\x27s\x20beneficiary\x20is\x20not\x20machine-verifiable'});continue;}if(dW['track']==='order-directed'&&ed!=null&&!ef){const eh=ee!=null?String(ee['amount']??'?'):'?';h['push']('DUAL\x20PAYOUT\x20N/A\x20(buyer-win\x20principal\x20return):\x20Order\x20'+ec['object']+'\x27s\x20arbitration\x20case\x20'+ec['claimed_by']+'\x20recorded\x20a\x20non-zero\x20indemnity\x20'+('('+eh+'\x20—\x20ALREADY\x20PAID\x20from\x20the\x20merchant-funded\x20compensation\x20pool),\x20and\x20this\x20alloc_by_guard\x20releases\x20the\x20escrow\x20along\x20')+'order-directed\x20recipients\x20(on\x20refund\x20rails:\x20the\x20buyer\x20reclaiming\x20their\x20PRINCIPAL).\x20Two\x20independent\x20pools\x20each\x20paying\x20once\x20—\x20'+'compensation\x20from\x20the\x20merchant\x20fund,\x20principal\x20back\x20to\x20the\x20buyer\x20—\x20is\x20the\x20legitimate\x20arbitration\x20completion,\x20not\x20a\x20double\x20payout;\x20'+'no\x20acknowledge_dual_payout\x20is\x20demanded.\x20Note:\x20on\x20LEGACY\x20claimed_by-pairing\x20rails\x20(pre-decision-11\x20shape)\x20the\x20on-chain\x20guard\x20may\x20still\x20reject\x20the\x20claimed_by-gated\x20leg\x20'+'(guard_rejected);\x20decision-11\x20node-gated\x20rails\x20are\x20unaffected.');continue;}return{'content':[{'type':'text','text':'DUAL\x20PAYOUT\x20REFUSED\x20—\x20no\x20transaction\x20was\x20sent.\x20Order\x20'+ec['object']+'\x20carries\x20a\x20recorded\x20arbitration\x20indemnity\x20award\x20(claimed_by='+ec['claimed_by']+');\x20this\x20alloc_by_guard\x20would\x20ALSO\x20release\x20its\x20escrow'+(dW['track']==='order-directed'?'\x20to\x20order-directed\x20(guard-submitted)\x20recipients\x20—\x20on\x20refund\x20rails\x20that\x20is\x20the\x20buyer':'')+'\x20(escrow\x20+\x20compensation\x20stacked\x20on\x20the\x20same\x20order).\x0a\x0a'+KEEPER_DUAL_PAYOUT_DIRECTIVE}],'structuredContent':{'result':{'type':'error','error':'Order\x20'+ec['object']+'\x20carries\x20a\x20recorded\x20arbitration\x20indemnity\x20award\x20(claimed_by='+ec['claimed_by']+');\x20releasing\x20its\x20escrow\x20stacks\x20both\x20independent\x20payout\x20tracks\x20on\x20one\x20order'+(dW['track']==='order-directed'?'\x20(allocation\x20pays\x20order-directed\x20recipients)':'')+'\x20—\x20a\x20netting\x20decision\x20reserved\x20for\x20the\x20operator\x20via\x20acknowledge_dual_payout.','error_code':'dual_payout_unconfirmed','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'The\x20two\x20payout\x20tracks\x20are\x20independent\x20by\x20design:\x20the\x20chain\x20never\x20nets\x20them\x20and\x20the\x20escrow\x20receive\x20path\x20has\x20no\x20claimed_by\x20gate\x20—\x20but\x20if\x20this\x20service\x27s\x20rails\x20use\x20the\x20LEGACY\x20claimed_by\x20pairing\x20(pre-decision-11\x20shape:\x20refund\x20rail\x20claimed_by\x20none\x20/\x20paired\x20recover\x20rail\x20claimed_by\x20some),\x20the\x20on-chain\x20guard\x20may\x20REJECT\x20this\x20alloc\x20(guard_rejected);\x20that\x20rejection\x20is\x20the\x20legacy\x20pairing\x20working,\x20and\x20the\x20escrow\x20exits\x20via\x20the\x20paired\x20rail\x20instead\x20(decision-11\x20node-gated\x20rails\x20are\x20unaffected).\x20Re-send\x20the\x20SAME\x20call\x20with\x20acknowledge_dual_payout:true\x20ONLY\x20if\x20this\x20distribution\x20is\x20an\x20intentional\x20commercial\x20decision\x20(buyer\x20NET\x20=\x20compensation\x20+\x20escrow\x20refund).\x20If\x20this\x20is\x20a\x20plain\x20refund\x20of\x20an\x20un-awarded\x20order,\x20the\x20order\x20you\x20submitted\x20is\x20the\x20wrong\x20one\x20—\x20verify\x20the\x20order\x20address\x20before\x20retrying.\x20'+KEEPER_DUAL_PAYOUT_DIRECTIVE},'message':'Refused:\x20this\x20release\x20would\x20stack\x20an\x20escrow\x20release\x20on\x20top\x20of\x20a\x20recorded\x20arbitration\x20indemnity\x20award.\x20Set\x20acknowledge_dual_payout:true\x20to\x20accept\x20explicitly\x20(HUMAN\x20operator\x20decision\x20—\x20keepers\x20must\x20escalate,\x20never\x20self-ack).'}};}if(dU&&!dV['authorized'])return{'content':[{'type':'text','text':'DUAL\x20PAYOUT\x20REFUSED\x20(preauthorization\x20missing)\x20—\x20no\x20transaction\x20was\x20sent.\x20Order\x20'+ec['object']+'\x20carries\x20a\x20recorded\x20arbitration\x20indemnity\x20award\x20(claimed_by='+ec['claimed_by']+')\x20and\x20this\x20alloc_by_guard\x20would\x20ALSO\x20release\x20its\x20escrow,\x20but\x20acknowledge_dual_payout\x20is\x20honored\x20ONLY\x20for\x20a\x20store\x20whose\x20human\x20merchant\x20recorded\x20the\x20standing\x20netting\x20decision\x20(config_operation\x20store_dual_payout_set\x20{account,\x20confirm:true});\x20the\x20executing\x20account\x20'+(dV['account']??'(unresolved)')+'\x20has\x20none.\x0a\x0a'+KEEPER_DUAL_PAYOUT_DIRECTIVE}],'structuredContent':{'result':{'type':'error','error':'acknowledge_dual_payout\x20on\x20Order\x20'+ec['object']+'\x20requires\x20a\x20store-level\x20dual-payout\x20preauthorization\x20for\x20account\x20'+(dV['account']??'(unresolved)')+'\x20—\x20the\x20per-call\x20flag\x20alone\x20is\x20the\x20self-ack\x20form\x20D-1\x20retired\x20(a\x20synthetic-store\x20agent\x20set\x20it\x20for\x20itself\x20in\x20the\x20ksr\x20round).','error_code':'dual_payout_preauthorization_required','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'The\x20human\x20merchant\x20records\x20the\x20standing\x20netting\x20decision\x20ONCE\x20per\x20store\x20via\x20config_operation\x20store_dual_payout_set\x20{account:\x20<store\x20signing\x20account>,\x20confirm:\x20true,\x20note};\x20after\x20that\x20the\x20SAME\x20call\x20with\x20acknowledge_dual_payout:true\x20proceeds.\x20Automated\x20agents\x20must\x20NEVER\x20record\x20the\x20preauthorization\x20themselves\x20—\x20that\x20confirmation\x20is\x20the\x20human\x27s,\x20escalate\x20instead.\x20'+KEEPER_DUAL_PAYOUT_DIRECTIVE},'message':'Refused:\x20acknowledge_dual_payout\x20requires\x20the\x20store-level\x20preauthorization\x20(D-1).\x20The\x20merchant\x20records\x20it\x20via\x20config_operation\x20store_dual_payout_set\x20{account,\x20confirm:true};\x20automated\x20agents\x20escalate\x20instead\x20of\x20recording\x20it\x20themselves.'}};h['push']('DUAL\x20PAYOUT\x20ACKNOWLEDGED:\x20Order\x20'+ec['object']+'\x20carries\x20a\x20recorded\x20arbitration\x20indemnity\x20award\x20'+('(claimed_by='+ec['claimed_by']+';\x20compensation-fund\x20claim\x20state\x20per\x20the\x20Arb\x20case)\x20and\x20this\x20call\x20ALSO\x20releases\x20its\x20escrow'+(dW['track']==='entity-directed'?'\x20to\x20fixed\x20entity\x20recipients\x20('+dW['recipients']['join'](',\x20')+')':'')+'\x20—\x20verify\x20the\x20net\x20payout\x20per\x20party\x20is\x20the\x20intended\x20commercial\x20outcome.\x20Proceeding\x20on\x20the\x20explicit\x20acknowledge_dual_payout\x20flag\x20backed\x20by\x20the\x20store-level\x20preauthorization'+(dV['authorized_at']?'\x20recorded\x20'+dV['authorized_at']:'')+'\x20(D-1).'));}}}catch{}}if(c['data']?.['allocators']){const ei=await checkEntityRecipientGate(c['data']?.['allocators'],'allocation.allocators',h);if(ei)return ei;}let dI='';const dJ=new CallAllocation(c['data']);c['data']?.['alloc_by_guard']&&(dI=beginInFlight('alloc_by_guard',c['data'],m,c['submission']));const dK=c['submission']?await dJ['call_with_submission'](m,await transformSubmission(c['submission'])):await dJ['call'](m);if(dI)recordInFlightOutcome(dI,dK);const dL=await buildGuardSubmissionPrompt(dK,'allocation',{'network':m?.['network'],'signer':m?.['account'],'allocation_address':c['data']?.['object']});if(dL)h['push'](dL);const dM=c['data'];if(dM?.['alloc_by_guard']){const ej=ResponseData(dK)['filter'](ek=>ek?.['type']==='Payment'&&ek?.['change']==='created');if(ej['length']>0x0){const ek=ej['map'](el=>el['object'])['join'](',\x20');try{const el=await batchQueryObjectsByIds(ej['map'](eq=>eq['object']),m?.['network'],!![]),em=[];let en=BigInt(0x0);const eo=[];let ep=![];for(const eq of el){if(eq?.['type']==='Payment'&&eq?.['record']){for(const er of eq['record']){const es=formatRecipientLabel(er['recipient']),et=typeof er['amount']==='string'?er['amount']:String(er['amount']),eu=BigInt(et);en+=eu,em['push']('\x20\x20•\x20'+es+':\x20'+formatMistAmount(eu));const ev=classifyRecipient(er['recipient']);if(ev?.['kind']==='entity'&&m?.['account']&&ev['address']['toLowerCase']()===String(m['account'])['toLowerCase']())ep=!![],eo['push']('\x20\x20•\x20'+es+':\x20ALREADY\x20SPENDABLE\x20by\x20you\x20(caller\x20==\x20recipient\x20—\x20the\x20SDK\x27s\x20follow-up\x20auto-claim\x20transaction\x20right\x20after\x20this\x20alloc\x20unwraps\x20it;\x20this\x20alloc\x20tx\x20itself\x20only\x20created\x20the\x20wrapper,\x20no\x20claim\x20step\x20remains;\x20a\x20follow-up\x20payment\x20receive\x20will\x20correctly\x20report\x20no\x20pending\x20claim)');else{if(ev?.['kind']==='submission')eo['push']('\x20\x20•\x20'+es+':\x20the\x20ORDER\x20OWNER\x20receives\x20—\x20call\x20the\x20order\x27s\x20receive/claim\x20entry');else{if(ev?.['kind']==='signer')eo['push']('\x20\x20•\x20'+es+':\x20the\x20CALLER\x20receives\x20—\x20payment\x20receive\x20as\x20the\x20caller');else ev?.['kind']==='entity'?eo['push']('\x20\x20•\x20'+es+':\x20that\x20account\x20receives\x20—\x20payment\x20receive\x20as\x20'+formatRecipientLabel(er['recipient'])):eo['push']('\x20\x20•\x20'+es+':\x20query\x20the\x20Payment\x20object\x27s\x20record\x20for\x20the\x20claim\x20path');}}}eq['object']&&em['push']('\x20\x20•\x20Payment\x20object:\x20'+eq['object']);}}if(em['length']>0x0){em['unshift']('DISTRIBUTION\x20DETAILS\x20(alloc_by_guard):'),em['push']('\x20\x20─────────────────','\x20\x20•\x20Total\x20distributed:\x20'+formatMistAmount(en));const ew=el['some'](ex=>ex?.['type']==='Payment'&&ex?.['info']?.['for_object']);if(ew){en===BigInt(0x0)?em['push']('','ESCROW\x20MODE\x20(nothing\x20owed):\x20total\x20distributed\x20is\x200\x20—\x20'+'nothing\x20is\x20being\x20held\x20for\x20claiming\x20and\x20no\x20distribution\x20is\x20pending.'):em['push']('','ESCROW\x20MODE:\x20funds\x20are\x20held\x20in\x20the\x20Payment\x20wrapper(s)\x20above\x20'+'(Payment.for_object\x20points\x20to\x20an\x20Order)\x20—\x20claim\x20entry\x20PER\x20ROW:',...eo,'Note:\x20the\x20slot\x20number\x20shown\x20per\x20row\x20is\x20that\x20rail\x27s\x20DECLARED\x20'+'GuardIdentifier\x20(a\x20254\x20rail\x20legitimately\x20shows\x20254)\x20—\x20do\x20NOT\x20'+'infer\x20slot\x200\x20from\x20this\x20receipt.');if(ep){const ex=dK?.['auto_claim']?.['digest'];em['push']('AUTO-CLAIMED\x20(SDK\x20follow-up\x20transaction):\x20at\x20least\x20one\x20row\x20had\x20caller\x20==\x20recipient\x20—\x20'+'a\x20SEPARATE\x20receive\x20transaction\x20fired\x20immediately\x20AFTER\x20this\x20alloc\x20unwrapped\x20that\x20share'+(ex?'\x20(claim\x20digest:\x20'+ex+')':'\x20(no\x20claim\x20digest\x20attached\x20—\x20the\x20alloc\x20caller\x27s\x20SDK\x20build\x20may\x20predate\x20auto_claim\x20attachment)')+';\x20THIS\x20alloc\x20transaction\x20itself\x20only\x20created\x20the\x20wrappers.\x20'+'The\x20share\x20is\x20already\x20spendable;\x20no\x20claim\x20step\x20remains.\x20A\x20follow-up\x20receive\x20reporting\x20'+'\x22already\x20unwrapped\x20or\x20auto-claimed\x22\x20is\x20the\x20EXPECTED\x20post-settlement\x20state,\x20not\x20a\x20failure.');}}h['push'](em['join']('\x0a'));}}catch{h['push']('alloc_by_guard\x20created\x20Payment\x20object(s)\x20['+ek+'].\x20'+'Query\x20these\x20Payment\x20objects\x20to\x20see\x20the\x20distribution\x20details\x20and\x20check\x20for_object\x20for\x20escrow\x20mode.');}}else m?.['dry_run']===!![]?h['push']('DRY\x20RUN\x20(alloc_by_guard\x20'+dM['alloc_by_guard']+'):\x20simulation\x20succeeded.\x20'+'No\x20Payment\x20objects\x20exist\x20because\x20dry\x20runs\x20materialize\x20nothing\x20—\x20this\x20is\x20NOT\x20a\x20'+'\x22nothing\x20distributed\x22\x20signal.\x20Evaluate\x20the\x20sharing\x20plan\x20from\x20the\x20dry-run\x20balance\x20'+'output\x20above;\x20re-run\x20without\x20dry_run\x20to\x20execute.'):h['push']('NOTHING\x20DISTRIBUTED\x20(alloc_by_guard\x20'+dM['alloc_by_guard']+'):\x20the\x20transaction\x20'+'succeeded\x20but\x20created\x20NO\x20Payment\x20object,\x20so\x20no\x20funds\x20moved.\x20'+'The\x20guard\x20is\x20bound\x20to\x20this\x20allocation,\x20so\x20this\x20is\x20not\x20a\x20wrong-guard\x20mistake\x20—\x20the\x20'+'distribution\x20evaluated\x20to\x20zero.\x20Usual\x20causes:\x20the\x20sharing\x20plan\x20computes\x200\x20for\x20the\x20'+'remaining\x20balance,\x20the\x20pool\x20is\x20already\x20fully\x20distributed,\x20or\x20the\x20guard\x27s\x20once-slot\x20'+'was\x20already\x20consumed.\x20Do\x20NOT\x20report\x20this\x20allocation\x20as\x20executed.');}const dN=handleCallResult(dK,y(c['data']));if(dH['length']>0x0&&dN?.['structuredContent']&&typeof dN['structuredContent']==='object')try{const ey=dN['structuredContent'];if(!ey['semantic']||typeof ey['semantic']!=='object')ey['semantic']={};ey['semantic']['red_flags']=[...Array['isArray'](ey['semantic']['red_flags'])?ey['semantic']['red_flags']:[],...dH];}catch{}return l(z,A,c['operation_type'],dK,c['data'])['catch'](()=>{}),dN;}case'permission':{const ez=c['operation_type'],eA=handlePermissionOperations(c['data'],m,y,h);return eA&&typeof eA==='object'&&'then'in eA&&eA['then'](eB=>{eB?.['structuredContent']?.['result']&&l(z,A,ez,eB['structuredContent']['result'],c['data'])['catch'](()=>{});})['catch'](()=>{}),eA;}case'guard':{const eB=c['data'],eC=eB['root'];if(eC?.['type']==='file'){const eH=eC,eI=resolve(eH['file_path']);let eJ;try{eJ=readFileSync(eI,'utf-8');}catch(eM){throw new Error('Failed\x20to\x20read\x20Guard\x20definition\x20file\x20\x27'+eH['file_path']+'\x27:\x20'+eM['message']);}const eK=parseGuardFile(eJ,eH['format']);if(!eK['success']){const eN=formatGuardParseErrors(eK['errors']);throw new Error('Guard\x20validation\x20failed\x20for\x20file\x20\x27'+eH['file_path']+'\x27:\x0a\x0a'+eN);}const eL=eK['data'];eB['root']={'type':'node','node':eL['root']},eL['table']!==undefined&&eB['table']===undefined&&(eB['table']=eL['table']),eL['description']!==undefined&&eB['description']===undefined&&(eB['description']=eL['description']),eL['rely']!==undefined&&eB['rely']===undefined&&(eB['rely']=eL['rely']),eL['namedNew']!==undefined&&eB['namedNew']===undefined&&(eB['namedNew']=eL['namedNew']);}if(eB['root']&&typeof eB['root']==='object'){const eO=eB['root'];eO['type']==='node'&&eO['node']&&(eB['root']=eO['node']);}if(!eB['table']||eB['table']['length']===0x0)throw new Error('Guard\x20\x27table\x27\x20field\x20is\x20required\x20and\x20cannot\x20be\x20empty');if(!eB['root'])throw new Error('Guard\x20\x27root\x27\x20field\x20is\x20required');const eD=eB['table']['filter'](eP=>eP['b_submission']===![]&&Array['isArray'](eP['value'])&&eP['value']['length']===0x0);if(eD['length']>0x0)throw new Error('Guard\x20creation\x20blocked:\x20static\x20table\x20slot(s)\x20'+eD['map'](eP=>eP['identifier'])['join'](',\x20')+'\x20'+'carry\x20an\x20EMPTY\x20array\x20value.\x20Guard\x20table\x20construction\x20silently\x20DROPS\x20empty\x20vectors\x20—\x20these\x20rows\x20would\x20be\x20'+'MISSING\x20from\x20the\x20created\x20Guard\x20while\x20creation\x20still\x20succeeds.\x20Give\x20each\x20slot\x20a\x20non-empty\x20static\x20value,\x20'+'or\x20flip\x20it\x20to\x20b_submission=true\x20and\x20supply\x20the\x20value\x20at\x20Guard\x20trigger\x20time\x20'+'(protocol\x20once-slots:\x20255\x20keys\x20on\x20the\x20submitted\x20bytes,\x20254\x20on\x20the\x20chain-derived\x20object\x20key).');try{const eP=lintGuardNodeGates(parseGuardNodeGates(eB['root'],eB['table']));if(eP)h['push'](eP);}catch{}try{const eQ=Array['isArray'](eB['table'])?eB['table']:[],eR=eB['binding_hint'],eS=parseGuardNodeGates(eB['root'],eB['table']),eT=eS['some'](eX=>REFUND_RAIL_NODE_REGEX['test'](eX)),eU=eQ['some'](eX=>{const eY=eX;return Number(eY?.['identifier'])===0x0&&eY?.['b_submission']===!![];}),eV=eR?.['action']==='allocate'||eR?.['binding_field']==='order_allocators',eW=lintTaskBindingAdvisories({'guardRef':eB['namedNew']?.['name'],'table':eQ,'allocatorBound':!eT&&(eV||eU),'refundReentry':eT});for(const eX of eW){h['push'](formatTaskBindingAdvisory(eX,'guard\x20create'));}}catch{}try{const eY=[],eZ=f0=>{if(!f0||typeof f0!=='object')return;const f1=f0;if(f1['type']==='query'&&typeof f1['query']==='number'){const f2=getGuardQueryByIdOrName(f1['query']);eY['push']('query('+f1['query']+')\x20->\x20\x27'+(f2?.['name']??'NOT\x20IN\x20CATALOG')+'\x27');}for(const f3 of['parameters','nodes']){const f4=f1[f3];if(Array['isArray'](f4))f4['forEach'](eZ);}};eZ(eB['root']),eY['length']>0x0&&h['push']('NUMERIC\x20QUERY\x20ID\x20RESOLUTION\x20(rndb58d8d\x20A2\x20—\x20verify\x20BEFORE\x20the\x20immutable\x20create):\x20'+(eY['join'](';\x20')+'.\x20A\x20numeric\x20ID\x20is\x20resolved\x20VERBATIM\x20at\x20runtime:\x20if\x20any\x20resolution\x20')+'above\x20is\x20NOT\x20the\x20field\x20you\x20intended,\x20STOP\x20and\x20rebuild\x20—\x20Guards\x20are\x20immutable,\x20and\x20a\x20'+'wrong-but-existing\x20ID\x20silently\x20checks\x20a\x20different\x20field\x20(it\x20only\x20fails\x20at\x20trigger\x20time,\x20'+'abort\x207,\x20without\x20naming\x20the\x20leg).\x20Prefer\x20the\x20NAMED\x20form\x20(e.g.\x20\x27order.amount\x27):\x20a\x20wrong\x20'+'name\x20fails\x20loudly\x20at\x20validation\x20instead\x20of\x20creating\x20a\x20mis-wired\x20Guard.');}catch{}const eE=new CallGuard(eB);let eF;try{eF=await eE['call'](m);}catch(f0){const f1=f0 instanceof Error?f0['message']:String(f0),f2=translateGuardTypeError(f1);throw f2?new Error(f2):f0;}if(eF&&typeof eF==='object'&&'digest'in eF&&eF?.['effects']?.['status']?.['status']==='success'){try{const f3=ResponseData(eF)['filter'](f5=>f5['change']==='created'&&typeof f5['type_raw']==='string'&&f5['type_raw']['includes']('::guard::'))['map'](f5=>String(f5['object']))[0x0],f4=eB['namedNew']?.['name'];console['warn']('[ConfirmGate]\x20guard\x20created\x20—\x20name='+(f4??'<unnamed>')+(f3!==undefined?'\x20address='+f3:'')+('\x20digest='+(eF['digest']??'?')));}catch{}try{const f5=ResponseData(eF)['filter'](f6=>f6['change']==='created'&&typeof f6['type_raw']==='string'&&f6['type_raw']['includes']('::guard::'))['map'](f6=>String(f6['object']))[0x0];recordCreatedGuard(eB['namedNew']?.['name'],f5);}catch{}try{const f6=eB['root']?.['type']??'<unknown>',f7=Array['isArray'](eB['table'])?eB['table']:[],f8=f7['length'],f9=f7['filter'](ff=>ff?.['b_submission']===!![])['length'],fa=eB['rely']?.['guards'],fb=Array['isArray'](fa)?fa['length']:0x0,fc=eB['rely']?.['logic_or']===!![]?'OR':eB['rely']?.['logic_or']===![]?'AND':'none',fd=['GUARD\x20LOGIC\x20SUMMARY:','\x20\x20•\x20root\x20type:\x20'+f6,'\x20\x20•\x20table\x20entries:\x20'+f8+'\x20('+f9+'\x20require\x20runtime\x20submission)'],fe=f7['filter'](ff=>ff?.['b_submission']===!![]);for(const ff of fe){const fg=typeof ff?.['value_type']==='string'?ff['value_type']:String(ff?.['value_type']??'?');fd['push']('\x20\x20•\x20submission\x20slot\x20'+ff?.['identifier']+':\x20value_type='+fg+'\x20—\x20forwards\x20bound\x20to\x20this\x20Guard\x20'+('must\x20advance\x20with\x20submissions:[{identifier:'+ff?.['identifier']+',\x20value_type:\x22'+fg+'\x22}]\x20')+'(Address\x20slots:\x20pass\x20the\x20Order\x20object\x20address)');}fb>0x0&&fd['push']('\x20\x20•\x20relies\x20on:\x20'+fb+'\x20guard(s)\x20(mode:\x20'+fc+')');if(eB['description']){const fh=String(eB['description'])['slice'](0x0,0x50);fd['push']('\x20\x20•\x20description:\x20\x22'+fh+'\x22');}h['push'](fd['join']('\x0a'));}catch{}try{const fi=parseGuardTimeBounds(eB['root'],eB['table']);if(fi){const fj=[],fk=eB['namedNew']?.['name'];typeof fk==='string'&&fk['trim']()&&fj['push'](fk['trim']());try{const fm=ResponseData(eF)['filter'](fn=>fn['change']==='created'&&fn['object']&&typeof fn['type_raw']==='string'&&fn['type_raw']['includes']('::guard::'))['map'](fn=>String(fn['object']));fj['push'](...fm);}catch{}if(fj['length']>0x0)recordGuardTimeProfile(fj,fi);const fl=fi['upperWindowMs']!==undefined?'Clock\x20<=\x20'+fi['anchor']+'\x20+\x20'+fi['upperWindowMs']+'ms':'Clock\x20>=\x20'+fi['anchor']+'\x20+\x20'+fi['lowerOffsetMs']+'ms';h['push']('TIME\x20ANCHOR:\x20this\x20Guard\x20uses\x20'+fl+'.\x20'+(fi['anchor']==='order.time'?'order.time\x20anchor\x20=\x20ORDER\x20CREATION\x20time\x20—\x20upper\x20windows\x20on\x20POST-checkout\x20branches\x20must\x20instead\x20anchor\x20progress.current_time\x20(query\x201272,\x20OrderProgress\x20witness),\x20otherwise\x20the\x20window\x20may\x20expire\x20before\x20the\x20branch\x20is\x20reachable\x20(§5.5\x20dead\x20branch).\x20':'witness-derived\x20anchor\x20—\x20the\x20window\x20counts\x20from\x20entering\x20the\x20source\x20node\x20(serves\x20all\x20orders).\x20')+'The\x20Machine-side\x20reachability\x20check\x20will\x20cross-verify\x20when\x20these\x20Guards\x20are\x20bound\x20to\x20forwards.');}}catch{}try{const fn=ResponseData(eF)['filter'](fo=>fo['change']==='created'&&typeof fo['type_raw']==='string'&&fo['type_raw']['includes']('::guard::'))['map'](fo=>String(fo['object']));for(const fo of fn){const fp=await loadGuardJsonFromChain(fo,m?.['network']);if(!fp)continue;const fq=diffGuardSpecVsChain({'table':eB['table'],'root':eB['root'],'rely':eB['rely']},fp['json']);h['push'](fq['summary']);}}catch{}}const eG=handleCallResult(eF,y(c['data']));return l(z,A,c['operation_type'],eF,c['data'])['catch'](()=>{}),eG;}case'personal':{const fr=transformPersonalInput(c['data']),fs=new CallPersonal(fr),ft=await fs['call'](m),fu=handleCallResult(ft,y(c['data']));return l(z,A,c['operation_type'],ft,c['data'])['catch'](()=>{}),fu;}case'payment':{const fv=await prepareFundOperation(c['data'],'payment',m?.['network']);if(fv['blockingErrors']['length']>0x0)return buildFundBlockResult(fv,'payment');h['push'](...fv['warnings']);if(fv['confirmation']){h['push'](fv['confirmation']['message']);const fA=a562b(fv['confirmation']);if(fA)h['push'](fA);}const fw=c['data'];if(fw?.['receive']===!![]){const fB=typeof fw?.['object']==='string'&&fw['object']['length']>0x0;h['push']('RECEIVE\x20MODE\x20(order_claim):\x20You\x20are\x20unwrapping\x20CoinWrapper(s)\x20to\x20your\x20wallet.\x20'+'This\x20is\x20the\x20final\x20step\x20of\x20the\x20escrow\x20flow:\x0a'+'\x20\x201.\x20Allocation\x27s\x20alloc_by_guard\x20created\x20a\x20Payment\x20object\x20with\x20your\x20address\x20as\x20a\x20recipient\x0a'+'\x20\x202.\x20The\x20Payment\x27s\x20revenue\x20split\x20transferred\x20CoinWrapper(s)\x20to\x20your\x20wallet\x20(owned\x20but\x20not\x20spendable)\x0a'+'\x20\x203.\x20'+(fB?'THIS\x20operation\x20unwraps\x20the\x20specified\x20CoinWrapper\x20to\x20your\x20wallet':'AUTO-RECEIVE:\x20this\x20operation\x20unwraps\x20EVERY\x20CoinWrapper\x20currently\x20owned\x20by\x20you\x20in\x20a\x20single\x20transaction')+',\x20deleting\x20the\x20CoinWrapper(s)\x20and\x20transferring\x20the\x20underlying\x20coin\x20to\x20tx_context::sender\x0a'+'Requirements:\x0a'+'\x20\x20-\x20You\x20MUST\x20be\x20the\x20CoinWrapper\x27s\x20owner\x20(the\x20recipient\x20specified\x20in\x20the\x20Allocation)\x0a'+'\x20\x20-\x20type_parameter\x20is\x20OPTIONAL:\x20when\x20omitted\x20it\x20is\x20auto-derived\x20from\x20the\x20CoinWrapper\x27s\x20'+'own\x20on-chain\x20type\x20(the\x20inner\x20T\x20of\x20CoinWrapper<T>)\x0a'+(fB?'\x20\x20-\x20object\x20can\x20be\x20a\x20CoinWrapper\x20ID\x20(0x...)\x20or\x20a\x20local\x20mark\x20name\x0a':'\x20\x20-\x20When\x20\x27object\x27\x20is\x20omitted,\x20no\x20wrapper\x20lookup\x20is\x20needed\x20—\x20all\x20your\x20CoinWrappers\x20are\x20unwrapped\x20at\x20once\x0a')+'To\x20find\x20received\x20CoinWrappers:\x20call\x20query_toolkit\x20with\x20query_type=\x27onchain_received\x27\x20'+'and\x20type=\x27CoinWrapper\x27\x20for\x20your\x20account.\x20'+'xk9\x20F-44:\x20when\x20onchain_received\x20is\x20empty,\x20AUTO-RECEIVE\x20no\x20longer\x20trusts\x20\x27already\x20claimed\x27\x20—\x20it\x20backtracks\x20your\x20recent\x20received\x20transactions\x20for\x20TxBuffer-stuck\x20wrappers\x20and\x20claims\x20them\x20in\x20the\x20same\x20call;\x20only\x20a\x20scan-confirmed\x20empty\x20state\x20reports\x20auto_claimed.\x0a'+'After\x20success:\x20verify\x20your\x20balance\x20increased\x20via\x20account_balance\x20query.');}else{if(fw?.['revenue']){h['push']('CREATE\x20MODE:\x20Creating\x20a\x20new\x20Payment\x20object.\x20Payments\x20are\x20IMMUTABLE\x20after\x20creation\x20—\x20'+'they\x20cannot\x20be\x20modified.\x20The\x20\x27revenue\x27\x20array\x20defines\x20the\x20recipients\x20and\x20amounts;\x20'+'ensure\x20correctness\x20before\x20submitting.\x20The\x20\x27info.for_guard\x27\x20field\x20(if\x20set)\x20binds\x20this\x20'+'Payment\x20to\x20a\x20Guard\x20for\x20conditional\x20release\x20(common\x20in\x20escrow\x20workflows).');for(let fD=0x0;fD<fw['revenue']['length'];fD++){const fE=fw['revenue'][fD],fF=classifyRecipient(fE?.['recipient']),fG=fF?.['kind']==='entity'?fF['address']:undefined;if(!fG||!isValidWowAddress(fG))continue;if(objectTypeFromAddress(fG)!==ObjectType['Allocation'])continue;const fH=fE?.['amount']?.['balance'];h['push']('P0\x20ALLOCATION-RECIPIENT\x20LEG\x20(irreversible\x20stranding):\x20revenue\x20leg\x20'+fD+'\x20sends\x20'+((fH!=null?String(fH):'(unspecified\x20amount)')+'\x20to\x20Allocation\x20'+fG+'.\x20')+'A\x20plain\x20payment\x20delivers\x20the\x20CoinWrapper\x20OWNED\x20BY\x20the\x20Allocation\x20object\x20itself,\x20and\x20'+'no\x20allocation\x20entry\x20can\x20ever\x20unwrap\x20it\x20—\x20these\x20funds\x20have\x20NO\x20user-triggerable\x20exit\x20'+'(verified\x20precedent:\x200.01\x20permanently\x20frozen\x20inside\x20Allocation\x200x1dcf3f3a…).\x20'+'To\x20fund\x20an\x20Allocation\x27s\x20pool,\x20use\x20the\x20renewal\x20intake\x20instead\x20'+'(create\x20the\x20escrowed\x20payment\x20record,\x20have\x20the\x20allocation\x20receive\x20it,\x20then\x20create\x20the\x20payment\x20in\x20ONE\x20PTB).\x20'+'To\x20pay\x20a\x20beneficiary,\x20target\x20a\x20user\x20account\x20or\x20an\x20object\x20with\x20its\x20own\x20receive\x20entry\x20'+'(Order/Treasury).\x20Confirm\x20this\x20is\x20intentional\x20before\x20submitting\x20—\x20this\x20cannot\x20be\x20undone.');}const fC=fw?.['object']?.['type_parameter']??'0x2::wow::WOW';for(const fI of fw['revenue']){const fJ=fI?.['amount'];if(fJ&&typeof fJ==='object'&&typeof fJ['balance']==='string'){const fK=await parseAmount(fJ['balance'],fC,m?.['network']);fK?.['smallestUnit']!=null&&(fJ['balance']=fK['smallestUnit']<=BigInt(Number['MAX_SAFE_INTEGER'])?Number(fK['smallestUnit']):fK['smallestUnit']['toString']());}}}}const fx=new CallPayment(c['data']);let fy;try{fy=await fx['call'](m);}catch(fL){const fM=fL instanceof Error?fL['message']:String(fL);if(/is not a CoinWrapper/i['test'](fM)&&/already unwrapped or auto-claimed/i['test'](fM)){const fN=typeof c['data']?.['object']==='string'?c['data']['object']:'(unknown)';return{'content':[{'type':'text','text':'No\x20live\x20CoinWrapper\x20at\x20'+fN+'\x20—\x20this\x20id\x20is\x20NOT\x20proof\x20of\x20arrival,\x20and\x20this\x20receive\x20is\x20a\x20no-op.\x20'+'Two\x20possible\x20states,\x20discriminate\x20BEFORE\x20reporting\x20anything\x20to\x20anyone:\x20'+'(a)\x20CLAIMED:\x20it\x20was\x20a\x20CoinWrapper\x20already\x20unwrapped/claimed\x20—\x20funds\x20are\x20spendable\x20in\x20the\x20wallet;\x20'+'(b)\x20WRONG\x20ID:\x20it\x20is\x20a\x20Payment\x20(or\x20other\x20non-wrapper\x20object)\x20—\x20a\x20settlement\x20Payment\x20holds\x20'+'per-recipient\x20CoinWrappers\x20that\x20must\x20be\x20claimed\x20INDIVIDUALLY,\x20and\x20unclaimed\x20wrappers\x20hold\x20the\x20funds.\x20'+'Discriminate\x20with\x20query_toolkit\x20onchain_received\x20(lists\x20unclaimed\x20wrappers\x20owned\x20by\x20the\x20signer\x20—\x20'+'any\x20wrapper\x20under\x20a\x20Payment\x20appears\x20here\x20until\x20claimed)\x20or\x20onchain_objects\x20on\x20the\x20id\x20to\x20read\x20its\x20type.\x20'+'Do\x20NOT\x20retry\x20the\x20same\x20receive\x20and\x20do\x20NOT\x20report\x20funds\x20as\x20arrived\x20on\x20this\x20response\x20alone.'}],'structuredContent':{'outcome':'executed','result':{'type':'null'},'message':'No\x20live\x20CoinWrapper\x20at\x20'+fN+':\x20either\x20already\x20claimed\x20(funds\x20spendable)\x20or\x20a\x20non-wrapper\x20id\x20such\x20as\x20a\x20Payment\x20whose\x20per-recipient\x20CoinWrappers\x20still\x20need\x20individual\x20claims\x20—\x20discriminate\x20via\x20onchain_received\x20before\x20reporting\x20arrival.','semantic':{'intent':'payment_receive','status':'success','summary':'No-op\x20receive\x20at\x20'+fN+':\x20not\x20a\x20live\x20wrapper.\x20Arrival\x20is\x20NOT\x20proven\x20—\x20check\x20for\x20unclaimed\x20per-recipient\x20wrappers\x20(onchain_received)\x20or\x20confirm\x20the\x20prior\x20claim\x20(account_balance).','next_actions':[{'action':'List\x20unclaimed\x20wrappers','reason':'If\x20a\x20Payment\x20id\x20was\x20passed,\x20its\x20per-recipient\x20CoinWrappers\x20are\x20the\x20real\x20claim\x20targets\x20and\x20may\x20still\x20hold\x20the\x20funds','tool':'query_toolkit','priority':'critical'},{'action':'Verify\x20the\x20arrival','reason':'Only\x20account_balance\x20/\x20onchain_received\x20prove\x20funds\x20arrived\x20—\x20this\x20no-op\x20response\x20does\x20not','tool':'account_operation','priority':'recommended'}],'warnings':['Receive\x20skipped\x20for\x20'+fN+':\x20no\x20live\x20CoinWrapper\x20remains\x20under\x20this\x20id.\x20This\x20response\x20is\x20NOT\x20proof\x20that\x20funds\x20arrived\x20—\x20a\x20Payment\x20id\x20means\x20the\x20per-recipient\x20wrappers\x20were\x20never\x20touched.']}}};}throw fL;}const fz=handleCallResult(fy,y(c['data']));return l(z,A,c['operation_type'],fy,c['data'])['catch'](()=>{}),fz;}case'demand':{const fO=await preflightDemandFeedback(c['data'],m,h);if(fO)return fO;const fP=new CallDemand(c['data']),fQ=c['submission']?await fP['call_with_submission'](m,await transformSubmission(c['submission'])):await fP['call'](m),fR=await buildGuardSubmissionPrompt(fQ,'demand',{'network':m?.['network'],'signer':m?.['account'],'extra':{'demand':c['data']?.['object']}});if(fR)h['push'](fR);const fS=handleCallResult(fQ,y(c['data']));return l(z,A,c['operation_type'],fQ,c['data'])['catch'](()=>{}),fS;}case'order':{c['data']?.['progress']&&(h['push']('Order\x20routing\x20fact:\x20order.progress\x20runs\x20the\x20order-bound\x20path\x20—\x20it\x20passes\x20'+'namedOperator=\x22\x22\x20forwards\x20for\x20the\x20order\x20payer/agents,\x20and\x20non-empty\x20'+'namedOperator\x20or\x20permissionIndex\x20forwards\x20for\x20senders\x20entitled\x20by\x20them\x20'+'(same\x20checks\x20as\x20the\x20Progress-level\x20path).\x20On\x20an\x20order-bound\x20Progress,\x20'+'workflow_operation\x20operate\x20auto-routes\x20to\x20this\x20same\x20path.'),h['push']('Allocation\x20hint:\x20if\x20this\x20operation\x20advances\x20the\x20order\x20to\x20a\x20terminal\x20'+'state\x20(e.g.\x20Completed/Cancelled/Refunded),\x20funds\x20remain\x20in\x20the\x20'+'Allocation\x20object\x20and\x20are\x20NOT\x20auto-distributed.\x20To\x20release\x20funds,\x20'+'trigger\x20the\x20corresponding\x20Guard\x20verification\x20via\x20allocation\x20operation\x20'+'(the\x20Guard\x20bound\x20to\x20the\x20matching\x20Allocator\x20will\x20verify\x20and\x20distribute).\x20'+'Refunds\x20are\x20TWO-STEP\x20(E-4):\x20the\x20refund\x20alloc\x20pays\x20into\x20the\x20ORDER\x20object\x20'+'(only\x20the\x20order\x20owner\x20can\x20extract)\x20—\x20after\x20the\x20alloc,\x20the\x20order\x20owner\x20'+'must\x20run\x20order\x20receive\x20(e.g.\x20receive:\x27recently\x27)\x20to\x20unwrap\x20to\x20the\x20wallet;\x20'+'treat\x20\x27cancelled/refunded\x20+\x20unclaimed\x20balance\x27\x20as\x20a\x20standard\x20pending\x20task.'));const fT=c['data']?.['arb_claim_compensation'];if(fT&&typeof c['data']?.['object']==='string')try{const fY=c['data']['object'],fZ=fY['startsWith']('0x')?fY:await LocalMark['Instance']()['get_address'](fY)??undefined;if(fZ){const g0=await query_objects({'objects':[fZ],'no_cache':!![],'network':m?.['network']}),g1=g0?.['objects']?.[0x0],g2=g1?.['data']??g1,g3=g2?.['service'],g4=readRawOnchainAmount(g2?.['amount']);let g5;if(typeof g2?.['allocation']==='string'&&g2['allocation']['startsWith']('0x'))try{const gb=await query_objects({'objects':[g2['allocation']],'no_cache':!![],'network':m?.['network']}),gc=gb?.['objects']?.[0x0];g5=readRawOnchainAmount(gc?.['data']?.['balance']??gc?.['balance']);}catch{}const g6=c['data']?.['acknowledge_dual_payout']===!![];let g7;if(g3){const gd=await query_objects({'objects':[g3],'no_cache':!![],'network':m?.['network']}),ge=gd?.['objects']?.[0x0];g7=readRawOnchainAmount((ge?.['data']??ge)?.['compensation_fund']);}let g8;const g9=fT?.['arb'];if(typeof g9==='string'){const gf=g9['startsWith']('0x')?g9:await LocalMark['Instance']()['get_address'](g9)??undefined;if(gf){const gg=await query_objects({'objects':[gf],'no_cache':!![],'network':m?.['network']});g8=readRawOnchainAmount(gg?.['objects']?.[0x0]?.['data']?.['indemnity']);}}if(claimPoolInsufficient({'indemnity':g8,'pool':g7}))return{'content':[{'type':'text','text':'COMPENSATION\x20CLAIM\x20REFUSED\x20—\x20the\x20pool\x20cannot\x20cover\x20the\x20award\x20(no\x20transaction\x20was\x20'+('sent).\x20The\x20Service\x27s\x20merchant-prepaid\x20compensation_fund\x20reads\x20'+g7+'\x20raw\x20units\x20')+('and\x20the\x20ruled\x20indemnity\x20is\x20'+g8+':\x20the\x20pool\x20can\x20currently\x20pay\x20'+g7+';\x20')+('this\x20case\x20needs\x20'+g8+'.\x20Sent\x20as-is,\x20the\x20chain\x20aborts\x20with\x20code\x2027\x20')+'(E_COMPENSATION_NOT_MATCH)\x20BEFORE\x20any\x20transfer\x20—\x20the\x20claim\x20is\x20not\x20consumed\x20(the\x20Arb\x20'+'stays\x20Arbitrated).\x20AWARD\x20≠\x20RECEIPT:\x20a\x20claim\x20only\x20pays\x20when\x20the\x20pool\x20covers\x20it.'}],'structuredContent':{'result':{'type':'error','error':'compensation_fund\x20'+g7+'\x20<\x20ruled\x20indemnity\x20'+g8,'error_code':'compensation_pool_insufficient','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'The\x20merchant\x20tops\x20up\x20the\x20Service\x20pool\x20first:\x20'+'{operation_type:\x27service\x27,\x20data:{object:\x27<service>\x27,\x20compensation_fund_add:{...}}}\x20'+('with\x20an\x20amount\x20>=\x20the\x20ruled\x20indemnity\x20('+g8+')\x20—\x20then\x20re-run\x20this\x20exact\x20')+'arb_claim_compensation.\x20The\x20abort/refusal\x20does\x20NOT\x20consume\x20the\x20claim;\x20verify\x20'+'the\x20fund\x20truth\x20via\x20order_fund_facts\x20before\x20retrying.'},'message':'Refused:\x20the\x20compensation\x20pool\x20cannot\x20cover\x20the\x20ruled\x20indemnity.\x20Top\x20up\x20via\x20service\x20compensation_fund_add,\x20then\x20re-claim.'}};const ga=arbClaimEscrowEmptyDualPayout({'orderAmount':g4,'escrowBalance':g5,'poolValue':g7,'acknowledged':g6});if(ga==='refuse')return{'content':[{'type':'text','text':'DUAL\x20PAYOUT\x20REFUSED\x20—\x20no\x20transaction\x20was\x20sent.\x20Order\x20'+fZ+'\x27s\x20escrow\x20is\x20ALREADY\x20FULLY\x20RELEASED\x20(allocation\x20balance\x200\x20of\x20'+g4+')\x20and\x20this\x20arb_claim_compensation\x20would\x20stack\x20the\x20arbitration\x20compensation'+(g8!==undefined?'\x20('+g8+'\x20raw\x20units)':'')+'\x20from\x20the\x20merchant-funded\x20pool\x20on\x20top\x20of\x20that\x20completed\x20escrow\x20track.\x0a\x0a'+KEEPER_DUAL_PAYOUT_DIRECTIVE}],'structuredContent':{'result':{'type':'error','error':'Order\x20'+fZ+':\x20the\x20escrow\x20track\x20already\x20completed\x20(allocation\x20balance\x200\x20of\x20'+g4+')\x20and\x20this\x20claim\x20pays\x20the\x20arbitration\x20compensation\x20on\x20top\x20—\x20the\x20recipient\x27s\x20net\x20becomes\x20compensation\x20+\x20a\x20completed\x20escrow\x20track.\x20Confirm\x20the\x20netting\x20intent\x20before\x20the\x20chain\x20pays\x20the\x20second\x20track.','error_code':'dual_payout_unconfirmed','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'The\x20escrow\x20track\x20and\x20the\x20compensation\x20track\x20are\x20independent\x20by\x20design:\x20the\x20chain\x20will\x20not\x20block\x20the\x20second\x20one,\x20though\x20a\x20rail\x20paired\x20on\x20order.claimed_by\x20may\x20guard-reject\x20the\x20post-claim\x20refund\x20leg\x20—\x20that\x20rejection\x20is\x20the\x20designed\x20mutual\x20exclusion,\x20not\x20a\x20malfunction.\x20State\x20the\x20decision\x20explicitly:\x20re-send\x20the\x20SAME\x20call\x20with\x20acknowledge_dual_payout:true\x20ONLY\x20if\x20paying\x20the\x20compensation\x20on\x20top\x20of\x20the\x20fully-released\x20escrow\x20is\x20the\x20intended\x20commercial\x20outcome\x20(e.g.\x20the\x20award\x20covers\x20a\x20loss\x20the\x20escrow\x20release\x20did\x20not).\x20If\x20the\x20escrow\x20release\x20already\x20settled\x20this\x20order,\x20do\x20not\x20claim\x20—\x20verify\x20the\x20order\x20address\x20before\x20retrying.\x20'+KEEPER_DUAL_PAYOUT_DIRECTIVE},'message':'Refused:\x20this\x20compensation\x20claim\x20would\x20stack\x20on\x20a\x20fully-released\x20escrow.\x20Set\x20acknowledge_dual_payout:true\x20to\x20accept\x20explicitly\x20(HUMAN\x20operator\x20decision\x20—\x20keepers\x20must\x20escalate,\x20never\x20self-ack).'}};if(ga==='acknowledged'){const gh=await storeDualPayoutVerdict(m);if(!gh['authorized'])return{'content':[{'type':'text','text':'DUAL\x20PAYOUT\x20REFUSED\x20(preauthorization\x20missing)\x20—\x20no\x20transaction\x20was\x20sent.\x20Order\x20'+fZ+'\x27s\x20escrow\x20is\x20ALREADY\x20FULLY\x20RELEASED\x20(allocation\x20balance\x200\x20of\x20'+g4+')\x20and\x20this\x20arb_claim_compensation\x20would\x20stack\x20the\x20compensation\x20on\x20top,\x20but\x20acknowledge_dual_payout\x20is\x20honored\x20ONLY\x20for\x20a\x20store\x20whose\x20human\x20merchant\x20recorded\x20the\x20standing\x20netting\x20decision\x20(config_operation\x20store_dual_payout_set\x20{account,\x20confirm:true});\x20the\x20executing\x20account\x20'+(gh['account']??'(unresolved)')+'\x20has\x20none.\x0a\x0a'+KEEPER_DUAL_PAYOUT_DIRECTIVE}],'structuredContent':{'result':{'type':'error','error':'acknowledge_dual_payout\x20on\x20Order\x20'+fZ+'\x20requires\x20a\x20store-level\x20dual-payout\x20preauthorization\x20for\x20account\x20'+(gh['account']??'(unresolved)')+'\x20—\x20the\x20per-call\x20flag\x20alone\x20is\x20the\x20self-ack\x20form\x20D-1\x20retired.','error_code':'dual_payout_preauthorization_required','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'The\x20human\x20merchant\x20records\x20the\x20standing\x20netting\x20decision\x20ONCE\x20per\x20store\x20via\x20config_operation\x20store_dual_payout_set\x20{account:\x20<store\x20signing\x20account>,\x20confirm:\x20true,\x20note};\x20after\x20that\x20the\x20SAME\x20call\x20with\x20acknowledge_dual_payout:true\x20proceeds.\x20Automated\x20agents\x20must\x20NEVER\x20record\x20the\x20preauthorization\x20themselves\x20—\x20escalate\x20instead.\x20'+KEEPER_DUAL_PAYOUT_DIRECTIVE},'message':'Refused:\x20acknowledge_dual_payout\x20requires\x20the\x20store-level\x20preauthorization\x20(D-1).\x20The\x20merchant\x20records\x20it\x20via\x20config_operation\x20store_dual_payout_set\x20{account,\x20confirm:true};\x20automated\x20agents\x20escalate\x20instead\x20of\x20recording\x20it\x20themselves.'}};h['push']('DUAL\x20PAYOUT\x20ACKNOWLEDGED:\x20order\x20'+fZ+'\x27s\x20escrow\x20is\x20already\x20fully\x20released\x20(allocation\x20balance\x200\x20of\x20'+g4+')\x20and\x20this\x20claim\x20pays\x20the\x20arbitration\x20compensation\x20on\x20top\x20—\x20proceeding\x20on\x20the\x20explicit\x20acknowledge_dual_payout\x20flag\x20backed\x20by\x20the\x20store-level\x20preauthorization'+(gh['authorized_at']?'\x20recorded\x20'+gh['authorized_at']:'')+'\x20(D-1);\x20verify\x20the\x20net\x20payout\x20per\x20party\x20is\x20the\x20intended\x20commercial\x20outcome.');}if(g7!==undefined&&g4!==undefined&&g4>0x0&&g7<0x3*g4)h['push']('COMPENSATION\x20COVERAGE\x20BELOW\x20CEILING:\x20compensation_fund\x20('+g7+')\x20is\x20less\x20than\x20'+('3x\x20the\x20order\x20amount\x20('+g4+')\x20—\x20the\x20chain\x20caps\x20any\x20award\x20at\x203x\x20')+'(the\x20MAX_INDEMNITY_MULTIPLE\x20on-chain\x20cap),\x20so\x20a\x20ruling\x20at\x20the\x20ceiling\x20would\x20abort\x20this\x20'+'buyer\x27s\x20payout.\x20Recommend\x20the\x20merchant\x20top\x20up\x20the\x20pool\x20via\x20service\x20'+'compensation_fund_add.\x20(Above\x203x\x20only\x20buys\x20headroom\x20for\x20concurrent\x20claims\x20—\x20'+'the\x20pool\x20is\x20per-Service\x20and\x20has\x20no\x20on-chain\x20concurrency\x20limit.)');else g7!==undefined&&g7>0x0&&h['push']('Reminder:\x20this\x20claim\x20pays\x20from\x20the\x20Service\x27s\x20merchant-prepaid\x20compensation_fund\x20pool\x20'+'(not\x20the\x20order\x20escrow).\x20Pool\x20balance\x20is\x20sufficient\x20for\x20now.\x20A\x20settled\x20claim\x20does\x20NOT\x20'+'seal\x20the\x20order:\x20a\x20later\x20refund-track\x20alloc\x20can\x20still\x20split\x20AND\x20pay\x20out\x20the\x20escrow\x20'+'(the\x20owner\x20receive\x20entries\x20are\x20deliberately\x20ungated\x20on-chain).\x20TWO-RAIL\x20INDEPENDENCE\x20'+'(decision\x2011):\x20refund\x20and\x20award\x20are\x20independent\x20commercial\x20tracks\x20—\x20the\x20overlap\x20is\x20'+'LEGAL\x20and\x20disclosed\x20at\x20the\x20acknowledge_dual_payout\x20gate;\x20fund\x20rails\x20are\x20node-gated\x20'+'and\x20NEVER\x20add\x20an\x20order.claimed_by\x20leg\x20(RAIL_CLAIMED_BY_LEG\x20/\x20R-FUND-RAIL-CLAIMED-BY\x20'+'critical).\x20The\x20provider\x20release\x20track\x20(direct\x20transfer)\x20'+'stays\x20usable.');}}catch{}const fU=new CallOrder(c['data']);let fV=c['submission']?await fU['call_with_submission'](m,await transformSubmission(c['submission'])):await fU['call'](m);if(!c['submission']&&isSubmissionMissingEcho(fV)){const gi=await resolveOrderRefForBackfill(c['data']?.['object']),gj=buildAutoFilledSubmission(fV,gi);gj&&(fV=await fU['call_with_submission'](m,await transformSubmission(gj)),h['push']('254\x20AUTO-BACKFILL:\x20the\x20pending\x20input\x20was\x20the\x20protocol\x20order\x20slot\x20(254)\x20—\x20filled\x20from\x20'+('this\x20operation\x27s\x20order\x20reference\x20('+gi+')\x20and\x20the\x20call\x20was\x20re-driven\x20in-process,\x20')+'saving\x20the\x20manual\x20refill\x20round-trip.'));}if(c['data']?.['receive']!=null&&fV&&typeof fV==='object'&&fV?.['effects']?.['status']?.['status']==='success'){const gk=fV['effects'],gl=Array['isArray'](gk?.['objectChanges'])?gk['objectChanges']:Array['isArray'](fV?.['objectChanges'])?fV['objectChanges']:[],gm=gr=>String(gr??'')['includes']('::coin::Coin'),gn=gl['filter'](gr=>gr?.['type']==='created'&&gm(gr?.['objectType'])),go=gl['filter'](gr=>gr?.['type']==='mutated'&&gm(gr?.['objectType'])),gp=Array['isArray'](gk?.['balanceChanges'])?gk['balanceChanges']:[],gq=gp['length']?'Balance\x20delta\x20this\x20tx:\x20'+gp['map'](gr=>{const gs=typeof gr?.['owner']==='object'&&gr?.['owner']!==null?String(gr['owner']['AddressOwner']??gr['owner']['ObjectOwner']??''):String(gr?.['owner']??'');return(gs||'(unknown)')+'\x20'+(gr?.['amount']??'?')+'\x20('+(String(gr?.['coinType']??'')['split']('::')['pop']()??'')+')';})['join'](';\x20'):'';h['push']('RECEIVE\x20RECEIPT:\x20claimed\x20'+gn['length']+'\x20object(s)\x20into\x20the\x20wallet'+(gn['length']?'\x20('+gn['map'](gr=>gr?.['objectId'])['join'](',\x20')+')':'')+(gq?'.\x20'+gq+'.':'')+(go['length']?'\x20'+go['length']+'\x20existing\x20coin(s)\x20consolidated/used\x20for\x20gas\x20(mutations,\x20NOT\x20new\x20funds).':'')+(gn['length']===0x0?'\x20NO_PENDING_CLAIM:\x20this\x20enumeration\x20found\x20nothing\x20claimable\x20—\x20a\x20coin\x20merge\x20may\x20still\x20have\x20run,\x20so\x20verify\x20arrival\x20on\x20the\x20AGGREGATE\x20balance\x20(account_balance),\x20never\x20on\x20created[].':'\x20A\x20claimed\x20refund\x20typically\x20arrives\x20as\x20its\x20OWN\x20Coin\x20object\x20—\x20the\x20balance\x20aggregate\x20may\x20show\x20it\x20as\x20a\x20second\x20coin,\x20so\x20consolidate\x20before\x20pricing\x20the\x20next\x20payment.'));}if(fT){const gr=!!fV&&typeof fV==='object'&&fV?.['effects']?.['status']?.['status']==='success';if(gr)try{const gu=fV['effects'],gv=Array['isArray'](gu?.['objectChanges'])?gu['objectChanges']:Array['isArray'](fV?.['objectChanges'])?fV['objectChanges']:[],gw=gB=>String(gB??'')['includes']('::coin::Coin'),gx=Array['isArray'](gu?.['balanceChanges'])?gu['balanceChanges']:[],gy=gv['some'](gB=>(gB?.['type']==='created'||gB?.['type']==='transferred')&&gw(gB?.['objectType']))||gx['some'](gB=>Number(gB?.['amount']??0x0)>0x0);let gz;const gA=fT?.['arb'];if(typeof gA==='string'){const gB=gA['startsWith']('0x')?gA:await LocalMark['Instance']()['get_address'](gA)??undefined;if(gB){const gC=await query_objects({'objects':[gB],'no_cache':!![],'network':m?.['network']});gz=readRawOnchainAmount(((gC?.['objects']?.[0x0])?.['data']??gC?.['objects']?.[0x0])?.['indemnity']);}}if(gz===0x0)h['push']('CLAIM\x20PAID\x20NOTHING\x20(award\x20≠\x20receipt):\x20this\x20arb_claim_compensation\x20succeeded\x20and\x20CLOSED\x20the\x20'+'case,\x20but\x20the\x20ruled\x20indemnity\x20reads\x200\x20—\x20a\x20dismissal\x20award.\x20No\x20coin\x20was\x20paid\x20and\x20none\x20will\x20'+'be:\x20the\x20claim\x27s\x20only\x20effect\x20was\x20closing\x20the\x20case\x20and\x20consuming\x20its\x20one-shot\x20latch.\x20If\x20a\x20'+'payout\x20was\x20intended,\x20the\x20award\x20must\x20be\x20RE-RULED\x20(arbitration\x20reset\x20→\x20order.arb_confirm\x20→\x20'+'new\x20ruling),\x20not\x20re-claimed\x20—\x20the\x20zero-indemnity\x20gate\x20aborts\x20a\x20re-claim.');else gz!==undefined&&!gy&&h['push']('CLAIM\x20RECEIPT\x20—\x20ZERO\x20MOVEMENT:\x20the\x20claim\x20succeeded\x20with\x20ruled\x20indemnity\x20'+gz+'\x20'+'(raw\x20units)\x20but\x20this\x20receipt\x20shows\x20no\x20created/transferred\x20coin\x20object\x20and\x20no\x20positive\x20'+'balance\x20change.\x20AWARD\x20≠\x20RECEIPT\x20until\x20the\x20money\x20is\x20on\x20the\x20recipient\x27s\x20balance\x20—\x20verify\x20'+'via\x20account_balance\x20/\x20order_fund_facts\x20before\x20treating\x20the\x20award\x20as\x20received.');}catch{}let gs;if(gr&&typeof c['data']?.['object']==='string')try{const gD=c['data']['object'],gE=gD['startsWith']('0x')?gD:await LocalMark['Instance']()['get_address'](gD)??undefined;let gF;if(gE){const gG=await query_objects({'objects':[gE],'no_cache':!![],'network':m?.['network']}),gH=gG?.['objects']?.[0x0];gF=(gH?.['data']??gH)?.['progress'];}gs=await autoHoldAfterClaim(m,gD,gF);}catch{}const gt=['DUAL-TRACK\x20NOTICE\x20(NET\x20view):\x20claiming\x20compensation\x20does\x20NOT\x20adjust\x20the\x20allocation\x20—\x20'+'compensation\x20(Service\x20compensation_fund)\x20and\x20escrow\x20settlement\x20(Allocation)\x20are\x20independent\x20'+'tracks,\x20and\x20claim/objection\x20remain\x20mutually\x20exclusive\x20(claim\x20closes\x20the\x20case).\x20Buyer\x20NET\x20'+'across\x20BOTH\x20tracks\x20=\x20compensation\x20+\x20any\x20escrow\x20still\x20released\x20via\x20the\x20refund\x20track;\x20to\x20keep\x20'+'the\x20total\x20at\x20the\x20actual\x20loss,\x20keep\x20the\x20settlement\x20sealed\x20(auto-hold\x20below)\x20or\x20release\x20the\x20'+'escrow\x20only\x20through\x20acknowledge_dual_payout\x20on\x20the\x20alloc_by_guard\x20call.'];if(gs&&(gs['held']['length']||gs['notHoldable']['length']||gs['failed']['length']))gs['held']['length']&&gt['push']('Auto-hold\x20applied\x20to:\x20'+gs['held']['join'](',\x20')+'\x20—\x20a\x20courtesy\x20Progress\x20hold,\x20NOT\x20a\x20chain-level\x20freeze.\x20Forwards\x20may\x20still\x20be\x20executable\x20by\x20other\x20permissioned\x20operators\x20and\x20the\x20machine\x20keeps\x20advancing;\x20the\x20post-claim\x20posture\x20is\x20two-rail\x20independence\x20(decision\x2011\x20—\x20payouts\x20follow\x20node\x20gates,\x20never\x20claim\x20state;\x20any\x20escrow\x20release\x20after\x20a\x20claim\x20goes\x20through\x20the\x20acknowledge_dual_payout\x20gate),\x20not\x20a\x20settlement\x20freeze.'),gs['notHoldable']['length']&&gt['push']('NOT\x20holdable\x20by\x20this\x20account\x20(needs\x20merchant\x20or\x20keeper\x20to\x20run\x20order\x20hold):\x20'+gs['notHoldable']['join'](',\x20')+'.'),gs['failed']['length']&&gt['push']('Hold\x20attempted\x20but\x20failed\x20(retry,\x20or\x20have\x20merchant\x20or\x20keeper\x20hold\x20manually):\x20'+gs['failed']['join'](',\x20')+'.'),gs['held']['length']===0x0&&gt['push']('No\x20outgoing\x20edge\x20could\x20be\x20auto-held\x20—\x20the\x20escrow\x20settlement\x20track\x20is\x20STILL\x20OPEN;\x20'+'have\x20the\x20merchant\x20or\x20keeper\x20hold\x20the\x20edge(s)\x20above\x20before\x20the\x20order\x20reaches\x20completed.');else gr?gt['push']('No\x20outgoing\x20edge\x20to\x20freeze\x20at\x20the\x20current\x20node\x20(order\x20likely\x20at\x20a\x20terminal\x20node),\x20or\x20'+'edge\x20resolution\x20was\x20unavailable\x20—\x20verify\x20the\x20settlement\x20state\x20manually.'):gt['push']('The\x20claim\x20did\x20not\x20succeed,\x20so\x20no\x20hold\x20was\x20attempted;\x20rerun\x20after\x20fixing\x20the\x20cause\x20above.');h['push'](gt['join']('\x20'));if(gr&&typeof c['data']?.['object']==='string')try{const gI=c['data']['object'],gJ=gI['startsWith']('0x')?gI:await LocalMark['Instance']()['get_address'](gI)??undefined;if(gJ){const gK=await query_objects({'objects':[gJ],'no_cache':!![],'network':m?.['network']}),gL=gK?.['objects']?.[0x0]?.['data']??gK?.['objects']?.[0x0],gM=typeof gL?.['service']==='string'?gL['service']:undefined;if(gM){const gN=await query_objects({'objects':[gM],'no_cache':!![],'network':m?.['network']}),gO=gN?.['objects']?.[0x0]?.['data']??gN?.['objects']?.[0x0],gP=gO?.['compensation_fund'],gQ=typeof gP==='string'&&/^\d+$/['test'](gP['trim']())?BigInt(gP['trim']()):typeof gP==='number'&&Number['isFinite'](gP)?BigInt(Math['trunc'](gP)):undefined;if(gQ===0x0n){const gR=fundWaterReminder('depleted',{'balance':'0','threshold':'0'});if(gR)h['push'](gR);}else{if(gQ!==undefined&&gQ>0x0n&&Array['isArray'](gO?.['sales'])){const gS=gO['sales']['filter'](gU=>!gU?.['suspension']&&/^\d+$/['test'](String(gU?.['price']??'')['trim']()))['map'](gU=>({'name':String(gU?.['name']??''),'price':BigInt(String(gU['price'])['trim']())})),gT=computeFundListingWall(gQ,gS);gT['walled']&&h['push']('FUND\x20LISTING\x20WALL\x20AFTER\x20AWARD:\x20this\x20claim\x20spent\x20the\x20Service\x27s\x20compensation\x20fund\x20—\x20the\x20live\x20fund\x20now\x20backs\x20single\x20orders\x20up\x20to\x20'+(gT['coverCap']['toString']()+'\x20base\x20units,\x20and\x20'+gT['blocked']['length']+'\x20listing(s)\x20are\x20priced\x20ABOVE\x20that\x20and\x20now\x20check\x20out\x20UNDER-COVERED\x20')+('(highest\x20first:\x20'+gT['blocked']['map'](gU=>gU['name']||'(unnamed)')['join'](',\x20')+').\x20The\x20order\x20still\x20proceeds\x20with\x20a\x20buy-time\x20warning\x20(拍板⑤\x20dm-mtw-261027\x20demoted\x20the\x20refusal),\x20')+'but\x20a\x20max-award\x20ruling\x20aborts\x20code\x2027\x20until\x20the\x20fund\x20is\x20topped\x20above\x203x\x20their\x20price\x20(service.compensation_fund_add)\x20or\x20the\x20price\x20is\x20cut.\x20'+'The\x20merchant\x20should\x20re-check\x20the\x20storefront\x20—\x20service_panorama\x20carries\x20the\x20live\x20wall\x20under\x20compensation_fund_listing_wall.');}}}}}catch{}}const fW=await buildGuardSubmissionPrompt(fV,'order',{'network':m?.['network'],'signer':m?.['account'],'order_address':c['data']?.['object']});if(fW)h['push'](fW);if(c['data']?.['order_new']&&fV&&typeof fV==='object'&&fV?.['effects']?.['status']?.['status']==='success'&&fV?.['digest']){const gU=await applyInitialForwardAfterOrderNew(c['data'],m);if(gU)h['push'](gU);}const fX=handleCallResult(fV,y(c['data']));if(fV&&typeof fV==='object'&&'digest'in fV&&fV?.['effects']?.['status']?.['status']==='success'&&c['data']?.['progress']&&typeof c['data']?.['object']==='string')try{const gV=c['data']['object'],gW=gV['startsWith']('0x')?gV:await LocalMark['Instance']()['get_address'](gV)??undefined;let gX;if(gW){const gY=await query_objects({'objects':[gW],'no_cache':!![],'network':m?.['network']}),gZ=gY?.['objects']?.[0x0];gX=(gZ?.['data']??gZ)?.['progress'];}if(gX){const h0=c['data']['progress']?.['operation'],h1=await enrichWorkflowGuidance({'progressRef':gX,'network':m?.['network'],'accountName':m?.['account'],'noCache':!![],'txResult':fV,'dryRun':m?.['dry_run']===!![],'compact':m?.['response_level']!=='full','operate':h0?.['forward']&&h0?.['next_node_name']?{'forward':h0['forward'],'next_node_name':h0['next_node_name'],'op':c['data']['progress']?.['op']}:undefined});mergeGuidanceIntoOutput(fX,h1,{'responseLevel':m?.['response_level']});}}catch{}return l(z,A,c['operation_type'],fV,c['data'])['catch'](()=>{}),fX;}case'gen_passport':{const h2=await gen_passport(m,c['guard'],c['info']);let h3;try{const h5=Array['isArray'](h2?.['objectChanges'])?h2['objectChanges']:[],h6=h5['find'](h8=>h8?.['type']==='created'&&typeof h8?.['objectType']==='string'&&/::passport::Passport$/['test'](h8['objectType'])),h7=h6?.['objectId'];if(h7){const h8=await query_objects({'objects':[h7],'no_cache':!![],'network':m?.['network']}),h9=h8?.['objects']?.[0x0],ha=h9?.['data']??h9;ha&&typeof ha==='object'&&typeof ha['result']==='boolean'&&(h3={'passport_id':h7,'result':ha['result']===!![],'has_verified':ha['has_verified']===!![],'info':Array['isArray'](ha['guard'])?ha['guard']['map'](hb=>({'guard':String(hb?.['guard']??hb??''),'result':hb?.['result']===!![],...typeof hb?.['impack']==='boolean'?{'impack':hb['impack']}:{}})):undefined});}}catch{}const h4=handleCallResult(h2,y(c['data'],undefined,h3));try{for(const hb of c['guard']??[]){const hc=typeof hb==='string'?hb:hb?.['object'];if(typeof hc!=='string'||hc==='')continue;const hd=await loadGuardJsonFromChain(hc,m?.['network']);if(!hd)continue;const he=(hd['json']['table']??[])['some'](hf=>hf?.['identifier']===TASK_BINDING_SLOT&&hf?.['b_submission']===!![]&&hf?.['value_type']==='Address');!he&&h['push']('PROTOCOL\x20SLOT\x20'+TASK_BINDING_SLOT+'\x20MISSING\x20on\x20Guard\x20\x27'+(hd['name']??hd['guard'])+'\x27:\x20the\x20table\x20declares\x20no\x20{identifier:\x20'+TASK_BINDING_SLOT+',\x20b_submission:\x20true,\x20value_type:\x20\x22Address\x22}\x20row\x20(task\x20binding).\x20A\x20passport\x20built\x20now\x20can\x20never\x20satisfy\x20the\x20on-chain\x20task-binding\x20check\x20on\x20an\x20order-driven\x20Progress\x20forward\x20(abort\x20code\x2011)\x20—\x20the\x20passport\x20only\x20emits\x20DECLARED\x20table\x20rows.\x20Fix\x20BEFORE\x20binding/publishing:\x20export\x20the\x20guard\x20(guard2file),\x20add\x20the\x20'+TASK_BINDING_SLOT+'\x20declaration,\x20create\x20a\x20NEW\x20Guard,\x20and\x20rebind\x20—\x20tables\x20freeze\x20at\x20creation.');}}catch{}return l(z,A,c['operation_type'],h2,c['data'])['catch'](()=>{}),h4;}case'proof':{const hf=new CallProof(c['data']),hg=c['submission']?await hf['call_with_submission'](m,await transformSubmission(c['submission'])):await hf['call'](m),hh=await buildGuardSubmissionPrompt(hg,'proof',{'network':m?.['network'],'signer':m?.['account']});if(hh)h['push'](hh);const hi=handleCallResult(hg,y(c['data']));return l(z,A,c['operation_type'],hg,c['data'])['catch'](()=>{}),hi;}case'gen_proof':{const hj=await gen_proof(m,c['proof'],c['server_pubkey'],c['server_signature'],c['proof_type'],c['description'],c['item_count'],c['about_address']),hk=handleCallResult(hj,y(c['data']));return l(z,A,c['operation_type'],hj,c['data'])['catch'](()=>{}),hk;}}const E=c;throw new Error('Unknown\x20on-chain\x20operation\x20type:\x20'+String(E['operation_type']));}catch(hl){let hm=hl instanceof Error?hl['message']:String(hl);const hn=c?.['operation_type'],ho=c&&'data'in c?c['data']:undefined,hp=c&&c['env']?c['env']['network']:undefined;try{const hu=await diagnoseGuardFailure(c,hm);if(hu)hm=hm+'\x0a'+hu;}catch{}const hq=hl?.['digest'],hr=typeof hq==='string'&&hq?hq:undefined;let hs;const ht=c?.['env']?.['dry_run']===!![]||isDeterministicOutcomeMessage(hm);if(hn&&!ht){const hv=markerOpFor(hn,ho),hw=c?.['env'],hx=ho!==undefined?ho:c,hy=c?.['submission'];parkUnknownOutcomeMarker(hv,hx,hw,hy);const hz=lastInFlightMarker(hv,inFlightParamsHash(hx,hy,hw?.['account'])),hA=[...hr?[hr]:[],...hz?.['digests']??[]]['filter']((hB,hC,hD)=>hD['indexOf'](hB)===hC);hw?.['account']&&(hs={'sender':hw['account'],'failed_at':new Date()['toISOString'](),'verify_events_since':new Date(Date['now']()-0x5a*0x3e8)['toISOString'](),'digests':hA,...k?{'idempotency_key':k}:{}}),k&&idempotencyKeyObserveUnknown(k,hn,{'sender':hw?.['account'],'verify_events_since':hs?.['verify_events_since'],'digests':hA});}else{if(hn&&ht){consumeInFlightMarker(markerOpFor(hn,ho),inFlightParamsHash(ho!==undefined?ho:c,c?.['submission'],c?.['env']?.['account']));if(k)idempotencyKeyClear(k);}}if(hn==='service'&&ho?.['order_new']){if(!ht){const hB=inFlightParamsHash(ho,undefined,c?.['env']?.['account']),hC=markerOpFor(hn,ho);if(hr)attachInFlightDigest(hC,hB,hr);const hD=await verifyOrderNewLanded(hp,hB)['catch'](()=>undefined),hE=hD??describeLastInFlight(hC,hB);if(hE)hm=hm+'\x0a'+hE;}}if(hn==='allocation'&&ho?.['alloc_by_guard']){if(!ht){const hF=inFlightParamsHash(ho,c['submission'],c['env']?.['account']),hG=markerOpFor(hn,ho);if(hr)attachInFlightDigest(hG,hF,hr);const hH=describeLastInFlight(hG,hF);if(hH)hm=hm+'\x0a'+hH;}}try{const hI=await resolveNetwork(hp);hm+=hp?'\x0a[network:\x20attempted\x20=\x20'+hI+'\x20(explicitly\x20requested)]':'\x0a[network:\x20attempted\x20=\x20'+hI+'\x20(session\x20default\x20—\x20pass\x20env.network\x20to\x20pin\x20a\x20specific\x20network)]';}catch{}return handleCallResult({'error':hm},hn?{'operation_type':hn,'data':ho,'operation_id':stableOperationId(hn,ho),'submission_verification':hs}:undefined);}}export async function onchainTimeoutVerify(a){try{const b=strictParse(OnchainOperationsSchema,a,'onchain_operations\x20timeout\x20re-parse'),c=b['operation_type'];if(!c)return undefined;if(b['env']?.['dry_run']===!![])return undefined;const d='data'in b?b['data']:undefined,e=b['env']?.['network'];let f;if(c==='service'&&d?.['order_new']){const j=inFlightParamsHash(d,undefined,b['env']?.['account']),k=markerOpFor(c,d);f=await verifyOrderNewLanded(e,j)['catch'](()=>undefined)??describeLastInFlight(k,j);}else{if(c==='allocation'&&d?.['alloc_by_guard']){const l=inFlightParamsHash(d,b['submission'],b['env']?.['account']),m=markerOpFor(c,d);f=describeLastInFlight(m,l);}else{const n=markerOpFor(c,d),o=d!==undefined?d:b,p=b['submission'];parkUnknownOutcomeMarker(n,o,b['env'],p),f=describeLastInFlight(n,inFlightParamsHash(o,p,b['env']?.['account']));}}if(!f)return undefined;const g=b['env']?.['account'],h=typeof d?.['object']==='string'?d['object']:undefined,i='OUTCOME\x20UNKNOWN\x20(the\x20wrapper\x20stopped\x20waiting\x20after\x20submission\x20—\x20the\x20transaction\x20MAY\x20have\x20committed).\x20'+('sender='+(g??'unspecified'))+(''+(h?',\x20target='+h:''))+((e?',\x20network='+e:'')+'.\x20')+'Verify\x20before\x20ANY\x20retry:\x20query_toolkit\x20recover_created_objects\x20for\x20this\x20sender,\x20or\x20'+'onchain_address_activity\x20(direction=\x27sent\x27)\x20in\x20the\x20failure\x20window\x20—\x20adopt\x20what\x20landed,\x20'+'resubmit\x20only\x20when\x20confirmed\x20absent.';return i+'\x0a'+f;}catch{return undefined;}}
1
+ import{readFileSync,writeFileSync,existsSync,mkdirSync}from'fs';import{resolve,dirname,join}from'path';import{getWowMcpDir,WowClient,getFullnodeUrl}from'@wowok/wowok';import{diagnose_passport_failure,verifyGuardFailureLegs,CallService,CallMachine,CallProgress,CallGuard,CallArbitration,CallRepository,CallContact,CallTreasury,CallReward,CallAllocation,CallPersonal,CallPayment,CallDemand,CallOrder,gen_passport,CallProof,gen_proof,ResponseData,LocalMark,query_objects,query_table,query_serviceContext,parseGuardFile,formatGuardParseErrors,transformRewardInput,transformPersonalInput,GetAccountOrMark_Address,Config,query_events,ObjectType,objectTypeFromAddress,isValidWowAddress,bcs,deriveDynamicFieldID,PackageAddress}from'@wowok/wowok';import{buildReceipt}from'../../schema/call/receipt.js';import{buildOrderFundFacts}from'../../knowledge/arb-fund-facts.js';import{recordMachineCreation}from'../../knowledge/machine-fork-watch.js';import{TASK_BINDING_SLOT}from'../../knowledge/onchain-constants.js';import{getCreationCycleRule}from'../../knowledge/object-dependency.js';import{computeFundListingWall}from'../../graph/onchain/facts.js';import{renderGuardLegMap}from'../../knowledge/guard-leg-map.js';import{beginInFlight,recordInFlightOutcome,consumeInFlightMarker,describeLastInFlight,inFlightParamsHash,lastInFlightMarker,matchOrderLandedEvent,matchRecentOrder,pendingInFlightResend,attachInFlightDigest,parkUnknownOutcomeMarker,markerOpFor,isDeterministicOutcomeMessage,idempotencyKeyGate,idempotencyKeyObserveUnknown,idempotencyKeyClear}from'../../composition/inflight.js';import{bindAuditPlan,bindAuditReport,bindRecoveryList,preflightPlan}from'../../composition/materialize.js';import{OnchainOperationsSchema,strictParse,getEnvConfig,handleCallResult,checkClientSchemaCompatibility,parseMachineNodesFromText,formatNodeErrors as a562a,machinePublishGateViolation,transformSubmission,isSubmissionMissingEcho,buildAutoFilledSubmission}from'../../schema/index.js';import{handlePermissionOperations}from'../../schema/call/permission-handler.js';import{resolveNetwork}from'./network.js';import{collectPermissionIndexes,checkPermissionAuthorization,formatPermissionWarning,permissionGrantPayloadJson}from'../../schema/utils/permission-machine-check.js';import{getSkillsHintForOnchain}from'../../schema/utils/skills-recommendation.js';import{fetchEntityPermissions}from'../../playbooks/service-build/participation-radar.js';import{prepareFundOperation,parseAmount,generateSkillsHint as a562b,formatChainValue,fundWaterReminder,buildClaimLedgerEcho}from'../../knowledge/fund-layer.js';import{generateGuardSubmissionPrompt,formatSubmissionPrompt}from'../../knowledge/guard-submission-prompt.js';import{classifyRecipient,classifyDualPayoutTrack}from'../../knowledge/recipient-constraint.js';import{auditService,formatTaskBindingAdvisory,lintTaskBindingAdvisories,REFUND_RAIL_NODE_REGEX}from'../../knowledge/audit-rules.js';import{oracleDisclosureBlockersFor}from'../../knowledge/path-oracle/index.js';import{translateGuardTypeError}from'../../knowledge/guard-lint.js';import{lintGuardNodeGates,lintMachineGuardBindings,parseGuardNodeGates,recordCreatedGuard,recordMachineNodeNames}from'../../knowledge/guard-node-gates.js';import{getGuardQueryByIdOrName}from'../../schema/utils/guard-query-utils.js';import{checkArbitrationVenueOrder,venueOperatingDoctrine}from'../../knowledge/arbitration-venue-order.js';import{assessAllocationRisks,STUCK_POOL_REMEDY}from'../../knowledge/allocation-risk.js';import{disputeFeeReconciliation}from'../../knowledge/arbitration-risk.js';import{ENTITY_RECIPIENT_RULE_ID,checkEntityRecipients,describeEntityRecipients,formatEntityRecipientViolation}from'../../knowledge/entity-recipient-guard.js';import{checkDiscountThresholdBeforeBuy,checkDiscountFloorBeforeIssue,describeBenchmarkIssueRisk}from'../../knowledge/discount-threshold.js';import{priorProofConsumptions,recordProofConsumption}from'../../communication/proof-reuse.js';import{evaluateServiceFromGraph}from'../../playbooks/service-build/topology-query.js';import{isEnabled as a562c,isDualPayoutPreauthorized,getStoreDualPayoutPolicy}from'../../config/index.js';import{buildSubmissionConfirmation,diffGuardSpecVsChain,loadGuardJsonFromChain,OPERATION_GUARD_ACTION}from'../../knowledge/guard-submission-brief.js';import{enrichWorkflowGuidance,mergeGuidanceIntoOutput,resolveHoldableEdges,extractObjectVersionFromTx,extractProgressEventNodeFromTx}from'../../knowledge/workflow-guidance.js';import{runReviewChain,runReviewRepositoryWrite,runReviewRewardClaim,mergeReviewStepsIntoOutput}from'./review-chain.js';import{parseGuardTimeBounds,recordGuardTimeProfile,checkGuardAnchorReachability,formatGuardAnchorWarnings}from'../../knowledge/guard-anchor-reach.js';import{batchQueryObjectsByIds,batchQueryTableItems,batchReadAddressKeyedFields,fetchMachineNodes,fetchServiceOrders}from'../../graph/onchain/sdk-batch.js';import{deriveTimeWindow}from'../../participation/time-window.js';import{normAddr,rootOf}from'../../graph/onchain/extract.js';import{classifyWipPath,probeWipReachability}from'../wip-deploy-assist.js';import{declareDispatchExpectation}from'./dispatch-expectations.js';import{stableOperationId}from'../../harness/operation-id.js';import{collectOnChainNamedObjectRequests,registerLocalMarksForCreatedObjects,planAutoLocalMark,operationPrimaryType,autoLocalMarkName}from'./onchain-name-registration.js';import{goalEngine}from'../../goal/GoalEngine.js';async function buildGuardSubmissionPrompt(a,b,c){if(!a||typeof a!=='object'||!('submission'in a))return undefined;const d=a['submission'];if(!Array['isArray'](d)||d['length']===0x0)return undefined;const f=d[0x0]?.['guard'];if(!f)return undefined;try{const g=await generateGuardSubmissionPrompt(f,{'operation':b,...c});return g?formatSubmissionPrompt(g):undefined;}catch(h){return'SUBMISSION\x20REQUIRED\x20—\x20the\x20Guard\x20needs\x20data\x20you\x20have\x20not\x20supplied\x20yet\x20(detailed\x20prompt\x20generation\x20'+('failed:\x20'+(h?.['message']??String(h))+').\x20Retry\x20with\x20the\x20submission\x20envelope\x20per\x20')+'SubmissionCallSchema:\x20{type:\x22submission\x22,\x20guard:[{object:\x22<guard\x20id>\x22,\x20impack:true}],\x20'+'submission:[{identifier:<n>,\x20value:\x22<value>\x22}]}\x20—\x20the\x20identifiers\x20above\x20name\x20every\x20required\x20field.';}}function treeUsesRewardRecords(a){if(!a||typeof a!=='object')return![];if(a['type']==='query_reward_record_exists')return!![];if(a['type']==='query'&&typeof a['query']==='string'&&/^reward\.record\.(exists_where|count_where|find_where|exists|count|find)$/['test'](a['query']))return!![];const b=[...Array['isArray'](a['nodes'])?a['nodes']:[],...Array['isArray'](a['and'])?a['and']:[],...Array['isArray'](a['or'])?a['or']:[],a['node'],a['left'],a['right']];return b['some'](d=>d&&typeof d==='object'&&treeUsesRewardRecords(d));}function treePinsRecordStamp(a){if(!a||typeof a!=='object')return![];const b=a['type']==='query_reward_record_exists'||a['type']==='query'&&typeof a['query']==='string'&&/^reward\.record\.(exists_where|count_where|find_where|exists|count|find)$/['test'](a['query']);if(b&&(a['where']?.['storeFromId']!=null||a['storeFromId']!=null))return!![];const c=[...Array['isArray'](a['nodes'])?a['nodes']:[],...Array['isArray'](a['and'])?a['and']:[],...Array['isArray'](a['or'])?a['or']:[],a['node'],a['left'],a['right']];return c['some'](d=>d&&typeof d==='object'&&treePinsRecordStamp(d));}export async function assertRewardReplayStamp(a,b,c=[]){if(!Array['isArray'](a))return;for(const d of a){if(!d||typeof d!=='object'||d['store_from_id']!=null)continue;let e,f;try{const h=await loadGuardJsonFromChain(String(d['guard']),b);h&&(e=treeUsesRewardRecords((h['json']??{})['root']),f=treePinsRecordStamp((h['json']??{})['root']));}catch{e=undefined;}if(e===!![]&&f===!![])throw new Error('reward.guard_add\x20REJECTED:\x20guard\x20\x27'+String(d['guard'])+'\x27\x20pins\x20a\x20storeFromId\x20predicate\x20'+'(order-scoped\x20record\x20query)\x20but\x20the\x20entry\x20omits\x20store_from_id\x20—\x20claim\x20records\x20are\x20written\x20'+'unstamped\x20and\x20match\x20NO\x20store_from\x20predicate,\x20so\x20the\x20per-order\x20leg\x20silently\x20never\x20fires\x20'+'(the\x20protocol\x20claim\x20key\x20still\x20bounds\x20each\x20recipient\x20to\x20one\x20claim,\x20but\x20the\x20once-per-order\x20'+'economics\x20the\x20tree\x20declares\x20are\x20dead).\x20Re-submit\x20with\x20store_from_id\x20=\x20the\x20table\x20identifier\x20'+'whose\x20submitted\x20value\x20identifies\x20the\x20claim\x20(slot\x200\x20—\x20the\x20submitted\x20Order\x20address\x20—\x20is\x20the\x20'+'conventional\x20once-per-order\x20stamp);\x20re-adding\x20the\x20SAME\x20guard\x20overwrites\x20its\x20slot\x20in\x20place.');if(e===!![]){c['push']('RECIPIENT-ONCE\x20REWARD\x20GUARD:\x20guard_add\x20for\x20\x27'+String(d['guard'])+'\x27\x20omits\x20store_from_id\x20and\x20its\x20record\x20'+'queries\x20pin\x20no\x20storeFromId\x20predicate\x20—\x20claims\x20are\x20bounded\x20by\x20the\x20protocol\x20claim\x20key\x20to\x20once\x20'+'per\x20recipient\x20for\x20life\x20(query\x20record-exists\x20is\x20recipient-scoped,\x20defaulting\x20to\x20the\x20signer;\x20the\x20'+'order.owner\x20identity\x20leg\x20is\x20what\x20decides\x20WHO\x20may\x20claim\x20—\x20keep\x20it).\x20If\x20once-per-ORDER\x20economics\x20'+'are\x20intended\x20instead,\x20re-add\x20with\x20store_from_id\x20pinned\x20(slot\x200\x20=\x20submitted\x20Order\x20address)\x20and\x20'+'an\x20order-scoped\x20where:{storeFromId:{identifier:<slot>}}\x20leg;\x20re-adding\x20the\x20SAME\x20guard\x20overwrites\x20'+'its\x20slot\x20in\x20place.\x20If\x20once-per-recipient\x20is\x20intended,\x20ignore\x20this\x20warning.');continue;}c['push']('REPLAY-OPEN\x20REWARD\x20GUARD:\x20guard_add\x20for\x20\x27'+String(d['guard'])+'\x27\x20omits\x20store_from_id\x20—\x20equality-based\x20per-order\x20dedup\x20can\x20never\x20'+'match\x20(records\x20without\x20the\x20pinned\x20value\x20match\x20NO\x20store_from_id\x20predicate;\x20slot-less\x20guards\x20can\x20only\x20dedup\x20'+'lifetime-once\x20via\x20record\x20count/exists\x20with\x20an\x20empty\x20where).\x20If\x20per-order\x20protection\x20is\x20intended,\x20re-add\x20'+'with\x20store_from_id\x20pinned\x20(slot\x200\x20=\x20submitted\x20Order\x20address\x20is\x20the\x20conventional\x20per-order\x20stamp;\x20re-adding\x20'+'the\x20SAME\x20guard\x20overwrites\x20its\x20slot\x20in\x20place,\x20so\x20existing\x20pools\x20can\x20be\x20repaired\x20without\x20a\x20new\x20guard);\x20'+'if\x20unlimited\x20repeat\x20claims\x20are\x20intended,\x20ignore\x20this\x20warning.');}}function recordStampSlots(a,b=[]){if(!a||typeof a!=='object')return b;const d=a['type']==='query_reward_record_exists'||a['type']==='query'&&typeof a['query']==='string'&&/^reward\.record\.(exists_where|count_where|find_where|exists|count|find)$/['test'](a['query']);if(d){const f=a['where']?.['storeFromId']??a['storeFromId'],g=f&&typeof f==='object'?f['identifier']:f;if(typeof g==='number'&&Number['isFinite'](g))b['push'](g);}const e=[...Array['isArray'](a['nodes'])?a['nodes']:[],...Array['isArray'](a['and'])?a['and']:[],...Array['isArray'](a['or'])?a['or']:[],a['node'],a['left'],a['right']];for(const h of e){if(h&&typeof h==='object')recordStampSlots(h,b);}return b;}export function rewardWindowTimingAdvisory(a,b,c,d){try{const e=parseGuardTimeBounds(b,c);if(!e||e['lowerOffsetMs']==null||e['lowerOffsetMs']<=0x0)return;const f=e['lowerOffsetMs']/0x5265c00,g=Number['isInteger'](f)&&f>0x0?f+'\x20day(s)':Math['round'](e['lowerOffsetMs']/0x3e8)+'\x20seconds';let h='REWARD_WINDOW_DELAYED\x20(advisory,\x20never\x20blocking):\x20claim\x20guard\x20\x27'+a+'\x27\x20does\x20NOT\x20pay\x20at\x20the\x20'+('claim-allowed\x20node\x20entry\x20—\x20the\x20bounty\x20OPENS\x20only\x20'+g+'\x20AFTER\x20it\x20(Clock\x20>=\x20anchor\x20+\x20delay,\x20')+'anchor:\x20'+(e['anchor']+').\x20This\x20is\x20the\x20anti-arbitrage\x20floor\x20(tbs7\x20F-04)\x20or\x20a\x20delayed-vesting\x20design\x20—\x20')+'legitimate,\x20but\x20it\x20contradicts\x20an\x20\x22instant\x20rebate\x22\x20promise:\x20disclose\x20the\x20delay\x20to\x20buyers\x20BEFORE\x20'+'checkout\x20(service_quote.reward_terms\x20carries\x20the\x20decoded\x20opens/closes\x20window).';e['upperWindowMs']==null&&(h+='\x20The\x20window\x20also\x20NEVER\x20CLOSES\x20(no\x20Clock\x20<=\x20upper\x20bound):\x20any\x20\x22N\x20days\x20to\x20claim\x22\x20wording\x20is\x20'+'fictional\x20(bsw4\x20F-11\x20—\x20the\x20v76\x20archetype\x20shipped\x20opens-only).\x20Add\x20the\x20closes\x20leg\x20'+'(tpl_reward_one_time_claim\x27s\x20closes_after_days,\x20Clock\x20<=\x20anchor\x20+\x20opens\x20+\x20span)\x20or\x20disclose\x20the\x20'+'open-ended\x20bounty\x20explicitly.'),d['push'](h);}catch{}}export async function checkRewardOnceArming(a,b,c=[]){if(!a||typeof a!=='object')return;const e=a,f=Array['isArray'](e['guard_add'])?e['guard_add']:[];for(const h of f){if(!h||typeof h!=='object')continue;const j=h;let k,l;try{const o=await loadGuardJsonFromChain(String(j['guard']),b);if(!o)continue;k=(o['json']??{})['root'],l=(o['json']??{})['table'];}catch{continue;}rewardWindowTimingAdvisory(String(j['guard']),k,l,c);if(j['store_from_id']==null)continue;const m=recordStampSlots(k);if(m['includes'](Number(j['store_from_id'])))continue;const n=m['length']>0x0?m['join'](',\x20'):'none';c['push']('REWARD\x20ONCE\x20ARM\x20NOT\x20DETECTED\x20(advisory,\x20never\x20blocking):\x20reward.guard_add\x20for\x20\x27'+String(j['guard'])+'\x27\x20'+('pins\x20store_from_id='+String(j['store_from_id'])+',\x20but\x20the\x20guard\x20tree\x20carries\x20no\x20matching\x20order-scoped\x20')+('record\x20leg\x20(storeFromId\x20slots\x20found:\x20'+n+').\x20The\x20stamp\x20alone\x20is\x20not\x20a\x20claim\x20boundary:\x20reward.claim\x20')+'keys\x20every\x20payout\x20on\x20RewardClaimKey{recipient,\x20guard,\x20store_from},\x20the\x20stamped\x20value\x20comes\x20from\x20the\x20'+'claimant\x27s\x20own\x20submission,\x20and\x20with\x20an\x20EMPTY\x20store_from\x20slot\x20the\x20payout\x20degrades\x20to\x20ONE\x20claim\x20per\x20'+'(recipient,\x20guard)\x20for\x20life\x20—\x20the\x20buyer\x27s\x20second\x20order\x20aborts\x2013\x20(E_CLAIM_ALREADY_MADE).\x20'+'Remediation:\x20(1)\x20add\x20logic_not({type:\x27query_reward_record_exists\x27,\x20object:{identifier:<reward\x20slot>},\x20'+('where:{storeFromId:{identifier:'+String(j['store_from_id'])+'}}})\x20to\x20the\x20guard\x20root\x20and\x20keep\x20the\x20SAME\x20')+'slot\x20stamped\x20on\x20guard_add\x20(re-adding\x20the\x20guard\x20overwrites\x20its\x20slot\x20in\x20place;\x20guards\x20are\x20immutable\x20but\x20'+'the\x20Reward\x27s\x20guard\x20entry\x20is\x20not);\x20(2)\x20for\x20a\x20per-order\x20once\x20the\x20chain\x20itself\x20enforces,\x20route\x20the\x20'+('incentive\x20through\x20an\x20Allocation\x20leg\x20that\x20declares\x20protocol\x20slot\x20'+TASK_BINDING_SLOT+'\x20')+'(the\x20once\x20key\x20derives\x20from\x20bcs(payment_info.for_object);\x20a\x20second\x20alloc\x20aborts\x2016).\x20'+'If\x20this\x20guard\x20deliberately\x20dedups\x20on\x20another\x20state,\x20ignore\x20this\x20warning.');}f['length']===0x0&&e['coin_add']!=null&&await warnFundingOnUnarmedReward(e['object'],b,c);}async function warnFundingOnUnarmedReward(a,b,c){try{if(typeof a!=='string'||a['length']===0x0)return;let d=a;!d['startsWith']('0x')&&(d=await LocalMark['Instance']()['get_address'](d));if(!d)return;const e=await query_objects({'objects':[d],'network':b}),f=Array['isArray'](e?.['objects'])?e['objects'][0x0]:undefined,h=Array['isArray'](f?.['guards'])?f['guards']:[];for(const j of h){if(!j||typeof j!=='object'||j['store_from_id']!=null)continue;c['push']('REWARD\x20FUNDING\x20ON\x20A\x20LIFETIME-ONCE\x20POOL\x20(advisory,\x20never\x20blocking):\x20reward\x20'+('\x27'+d+'\x27\x20is\x20funded\x20while\x20mounted\x20guard\x20\x27'+String(j['guard'])+'\x27\x20carries\x20NO\x20store_from_id.\x20')+'reward.claim\x20keys\x20every\x20payout\x20on\x20RewardClaimKey{recipient,\x20guard,\x20store_from}:\x20an\x20empty\x20'+'store_from\x20slot\x20is\x20ONE\x20claim\x20per\x20(recipient,\x20guard)\x20for\x20LIFE,\x20so\x20the\x20same\x20buyer\x27s\x20second\x20order\x20'+'aborts\x2013\x20(E_CLAIM_ALREADY_MADE)\x20and\x20the\x20bounty\x20silently\x20pays\x20once.\x20'+'Remediation:\x20re-add\x20the\x20SAME\x20guard\x20with\x20store_from_id\x20pinned\x20(slot\x200\x20=\x20the\x20submitted\x20Order\x20'+'address\x20is\x20the\x20conventional\x20per-order\x20stamp;\x20re-adding\x20overwrites\x20its\x20slot\x20in\x20place)\x20plus\x20an\x20'+'order-scoped\x20where:{storeFromId:{identifier:<slot>}}\x20record\x20leg,\x20or\x20route\x20the\x20incentive\x20through\x20'+('an\x20Allocation\x20leg\x20armed\x20with\x20protocol\x20slot\x20'+TASK_BINDING_SLOT+'.\x20Funding\x20does\x20not\x20repair\x20the\x20claim\x20shape.'));}}catch{}}function assertRewardRecipientSemantics(a){if(!Array['isArray'](a))return;for(const b of a){if(!b||typeof b!=='object')continue;const c=b['recipient'];if(c!==null&&typeof c==='object'&&'GuardIdentifier'in c)throw new Error('reward.guard_add\x20REJECTED:\x20the\x20entry\x20for\x20guard\x20\x27'+String(b['guard'])+'\x27\x20'+'declares\x20recipient\x20{GuardIdentifier:\x20N}\x20—\x20the\x20claim\x20entry\x20requires\x20recipient\x20==\x20the\x20transaction\x20'+'sender\x20(reward\x20rail\x20abort\x2014,\x20E_CLAIM_RECIPIENT_NOT_SIGNER),\x20and\x20a\x20GuardIdentifier\x20resolves\x20from\x20'+'the\x20passport\x20submission\x20(conventionally\x20the\x20submitted\x20Order\x20address),\x20which\x20can\x20never\x20be\x20the\x20'+'signer:\x20the\x20entry\x20is\x20structurally\x20unpayable,\x20every\x20claim\x20aborts\x20(crs-mn-261015\x20F-12,\x20live\x20mainnet).\x20'+'Use\x20recipient\x20{Signer:\x20\x27signer\x27}\x20—\x20the\x20claim\x20guard\x27s\x20order.owner\x20identity\x20leg\x20keeps\x20it\x20buyer-bound\x20—\x20'+'or\x20an\x20{Entity}\x20recipient\x20(the\x20SDK\x20replaces\x20it\x20with\x20the\x20claimant\x27s\x20local\x20account\x20at\x20claim\x20time).\x20'+'The\x20GuardIdentifier\x20order-anchor\x20idiom\x20belongs\x20to\x20ALLOCATION\x20rails\x20only\x20(money\x20lands\x20ON\x20the\x20Order).');}}export async function verifyRewardEvidenceBindings(a,b,c,d){const e=[];if(!Array['isArray'](c))return e;const f=c['filter'](q=>q&&typeof q==='object'&&q['evidence']!=null);if(f['length']===0x0)return e;const h=buildReceipt(a);if(h['kind']!=='transaction'||!h['executed'])return e;const j=async q=>{if(typeof q!=='string'||!q)return undefined;if(q['startsWith']('0x'))return q;try{return await LocalMark['Instance']()['get_address'](q)??undefined;}catch{return undefined;}},k=q=>{if(typeof q==='string')return'\x22'+q+'\x22';if(Array['isArray'](q))try{return'\x22'+new TextDecoder()['decode'](new Uint8Array(q))+'\x22';}catch{return'bytes['+q['length']+']';}return'?';},l=await j(typeof b==='string'?b:b&&typeof b==='object'?b['object']:undefined);if(!l)return e['push']('EVIDENCE\x20BINDING\x20READBACK\x20INCOMPLETE\x20(ksr-tn-261026\x20Q8-F04\x20contract):\x20the\x20call\x20requested\x20a\x20native\x20'+'evidence\x20pin\x20but\x20the\x20reward\x20object\x20reference\x20was\x20not\x20resolvable\x20on\x20this\x20process,\x20so\x20the\x20pin\x20could\x20'+'NOT\x20be\x20verified.\x20Do\x20not\x20treat\x20the\x20request\x20as\x20honored\x20—\x20verify\x20the\x20pin\x20on\x20chain\x20(query\x20the\x20reward\x20'+'object\x27s\x20dynamic\x20fields\x20for\x20the\x20evidence\x20key)\x20before\x20relying\x20on\x20claim-time\x20evidence\x20counting.'),e;const m=[];for(const q of f){const t=q,u=await j(t['guard']);if(!u)continue;const v=deriveDynamicFieldID(l,PackageAddress+'::reward::EvidenceKey',bcs['Address']['serialize'](u)['toBytes']())['toLowerCase']();m['push']({'guardLabel':String(t['guard']),'fieldId':v,'key':k(t['evidence']['key'])});}if(m['length']===0x0)return e['push']('EVIDENCE\x20BINDING\x20READBACK\x20INCOMPLETE\x20(ksr-tn-261026\x20Q8-F04\x20contract):\x20the\x20call\x20requested\x20a\x20native\x20'+'evidence\x20pin\x20but\x20the\x20guard\x20reference\x20was\x20not\x20resolvable\x20on\x20this\x20process,\x20so\x20the\x20pin\x20could\x20NOT\x20be\x20'+'verified.\x20Do\x20not\x20treat\x20the\x20request\x20as\x20honored\x20—\x20verify\x20the\x20pin\x20on\x20chain\x20before\x20relying\x20on\x20'+'claim-time\x20evidence\x20counting.'),e;const n=new Set();let p=![];try{const x=await query_objects({'objects':m['map'](y=>y['fieldId']),'network':d});for(const y of x?.['objects']??[]){const z=String(y?.['object']??'')['toLowerCase']();if(z)n['add'](z);}}catch{p=!![];}if(p)return e['push']('EVIDENCE\x20BINDING\x20UNVERIFIED\x20(ksr-tn-261026\x20Q8-F04\x20contract):\x20the\x20read-back\x20query\x20failed,\x20so\x20the\x20'+'requested\x20evidence\x20pin(s)\x20on\x20reward\x20'+l+'\x20could\x20not\x20be\x20confirmed.\x20Verify\x20on\x20chain\x20'+'(query\x20the\x20reward\x20object\x27s\x20dynamic\x20fields)\x20before\x20relying\x20on\x20claim-time\x20evidence\x20counting;\x20a\x20'+'silently-dropped\x20pin\x20is\x20a\x20KNOWN\x20failure\x20mode\x20on\x20packages\x20without\x20the\x20native\x20evidence-pinning\x20entry.'),e;for(const A of m){n['has'](A['fieldId'])?e['push']('EVIDENCE\x20BINDING\x20VERIFIED\x20(ksr-tn-261026\x20Q8-F04\x20contract):\x20guard\x20'+A['guardLabel']+'\x20on\x20reward\x20'+l+'\x20carries\x20its\x20on-chain\x20evidence\x20pin\x20(key\x20'+A['key']+')\x20—\x20claim-time\x20counting\x20is\x20'+'native\x20and\x20only\x20repository\x20rows\x20tied\x20to\x20THIS\x20claim\x27s\x20own\x20store_from\x20value\x20can\x20satisfy\x20it.'):e['push']('EVIDENCE\x20BINDING\x20NOT\x20ON\x20CHAIN\x20(ksr-tn-261026\x20Q8-F04\x20contract):\x20guard\x20'+A['guardLabel']+'\x20on\x20reward\x20'+l+'\x20requested\x20an\x20evidence\x20pin\x20(key\x20'+A['key']+')\x20but\x20the\x20reward\x20object\x20carries\x20NO\x20'+'evidence\x20field\x20for\x20it.\x20On\x20the\x20currently\x20deployed\x20package\x20the\x20native\x20evidence-pinning\x20capability\x20'+'is\x20unavailable:\x20batch\x20submissions\x20SILENTLY\x20DROP\x20the\x20pin\x20and\x20the\x20direct\x20face\x20fails\x20with\x20a\x20'+'missing-entry\x20error\x20(classified\x20capability_unavailable,\x20non-retryable).\x20The\x20claim\x20still\x20passes\x20'+'on\x20the\x20repository-floor\x20guard\x20leg,\x20which\x20proves\x20only\x20\x27a\x20qualifying\x20repository\x20row\x20exists\x20for\x20'+'this\x20order\x27\x20—\x20NOT\x20who\x20wrote\x20it\x20or\x20that\x20the\x20attested\x20event\x20really\x20happened;\x20disclose\x20that\x20'+'boundary\x20wherever\x20the\x20bounty\x20is\x20advertised.\x20Do\x20NOT\x20re-send\x20guard_add\x20to\x20\x27fix\x27\x20this\x20—\x20re-enable\x20'+'the\x20pin\x20only\x20after\x20the\x20network\x27s\x20package\x20ships\x20the\x20capability\x20(release\x20notes,\x20not\x20the\x20runtime).');}return e;}function chainForwardGuardRef(a){const b=a?.['guard'];return typeof b==='string'?b:typeof b?.['guard']==='string'?b['guard']:'';}async function fetchChainAnchorContext(a,b){try{if(typeof a!=='string'||a['trim']()==='')return undefined;let c=a['trim']();if(!c['startsWith']('0x')){const k=await LocalMark['Instance']()['get'](c);if(!k?.['address'])return undefined;c=k['address'];}const d=await query_table({'parent':c,'network':b?.['network']}),e=(d?.['items']??[])['map'](l=>l?.['object'])['filter'](l=>typeof l==='string'&&l['length']>0x0);if(e['length']===0x0)return undefined;const f=await query_objects({'objects':e,'network':b?.['network']}),g=(f?.['objects']??[])['filter'](l=>l?.['type']==='TableItem_MachineNode')['map'](l=>({'name':l['name'],'pairs':l['value']}));if(g['length']===0x0)return undefined;const h=new Set();for(const l of g){for(const m of l['pairs']??[]){for(const o of m?.['forwards']??[]){const q=chainForwardGuardRef(o);if(q)h['add'](q);}}}const j=new Map();for(const r of h){try{let t=r;if(!t['startsWith']('0x')){const x=await LocalMark['Instance']()['get'](t);if(!x?.['address'])continue;t=x['address'];}const u=await query_objects({'objects':[t],'network':b?.['network']}),v=u?.['objects']?.[0x0];if(!v||v['type']!=='Guard')continue;const w=parseGuardTimeBounds(v['root'],v['table']);if(!w)continue;j['set'](t['toLowerCase'](),w),j['set'](r['trim']()['toLowerCase'](),w);}catch{}}return{'nodes':g,'profiles':j};}catch{return undefined;}}async function maybeGuardSubmissionConfirmation(a,b){const d=[],e=a['submission'];if(e&&typeof e==='object'&&Array['isArray'](e['submission']))for(const m of e['submission']){m?.['guard']&&Array['isArray'](m['submission'])&&m['submission']['length']>0x0&&d['push']({'guardRef':String(m['guard']),'items':m['submission']});}const f=a['info'];if(f&&typeof f==='object'&&Array['isArray'](f['submission'])&&f['submission']['length']>0x0){const n=Array['isArray'](f['guard'])?f['guard']['map'](q=>q?.['object'])['filter'](Boolean):[],o=n[0x0]?String(n[0x0]):a['guard'];if(o)d['push']({'guardRef':String(o),'items':f['submission']});}if(d['length']===0x0)return undefined;const g=OPERATION_GUARD_ACTION[a['operation_type']],h=[];for(const q of d){const r=await buildSubmissionConfirmation({'guard_ref':q['guardRef'],'submission':q['items'],...g?{'action':g}:{},'network':b['network']});if(r)h['push'](r);}if(h['length']===0x0)return undefined;const j=h['map'](t=>t['confirmation_text'])['join']('\x0a\x0a'),k=[];for(const t of h){t['missing_identifiers']['length']>0x0&&k['push']('Guard\x20'+(t['guard_name']??t['guard'])+':\x20missing\x20required\x20identifier(s)\x20'+t['missing_identifiers']['join'](',\x20'));for(const u of t['items']){for(const v of u['issues']){k['push']('Guard\x20'+(t['guard_name']??t['guard'])+'\x20['+(u['identifier']??'?')+']:\x20'+v);}}}const l={'message':j,'result':{'type':'pending_confirmation','preview':{'level':'standard','operation':a['operation_type'],'object':h[0x0]['guard_name']??h[0x0]['guard'],'network':b['network'],...k['length']>0x0?{'warnings':k}:{}},'rule_id':'guard_submission_confirm'},'semantic':{'intent':a['operation_type']+'_guard_submission_awaiting_confirmation','status':'pending_input','summary':'Guard\x20submission\x20composed-confirmation\x20(G1):\x20the\x20complete\x20semantics\x20of\x20your\x20submission\x20'+'(guard\x20rules\x20+\x20your\x20values\x20+\x20pass/fail\x20consequences)\x20are\x20shown\x20in\x20the\x20message.\x20'+'The\x20operation\x20was\x20NOT\x20executed.\x20Re-call\x20with\x20env.confirmed=true\x20to\x20proceed.','next_actions':[{'action':'confirm:\x20re-call\x20the\x20SAME\x20operation\x20with\x20env.confirmed=true','reason':'Guard\x20submission\x20confirmation\x20—\x20'+h['length']+'\x20guard(s),\x20'+d['reduce']((w,x)=>w+x['items']['length'],0x0)+'\x20submitted\x20item(s).','tool':'onchain_operations','priority':'required'}],...k['length']>0x0?{'warnings':k}:{}}};return{'content':[{'type':'text','text':j}],'structuredContent':l};}const REFERRER_FILE=join(getWowMcpDir(),'referrer');function readStoredReferrer(){try{if(!existsSync(REFERRER_FILE))return null;const a=readFileSync(REFERRER_FILE,'utf8')['trim']();return a||null;}catch{return null;}}const PROJECT_SKILL_DIRS=['.claude/skills','.agents/skills','.cursor/rules','.github/prompts','.windsurf/skills','.codex/skills','.qoder/skills','.roo/skills','.codebuddy/skills'],PROJECT_SKILL_MARKERS=['wowok-provider','wowok-supplier','wowok-collaborator','wowok-arbitrator','wowok-order','wowok-messenger','wowok-machine','wowok-output','wowok-onboard','wowok-planner','wowok-auditor','wowok-governance'],SKILLS_HINT_FILE=join(getWowMcpDir(),'skills-hint-asked.json');function projectHasSkills(a){for(const b of PROJECT_SKILL_DIRS){for(const c of PROJECT_SKILL_MARKERS){if(existsSync(join(a,b,c)))return!![];}}return![];}function loadSkillsAsked(){try{if(!existsSync(SKILLS_HINT_FILE))return{};return JSON['parse'](readFileSync(SKILLS_HINT_FILE,'utf8'))??{};}catch{return{};}}function persistSkillsAsked(a){try{const b=loadSkillsAsked();b[a]=!![],mkdirSync(dirname(SKILLS_HINT_FILE),{'recursive':!![]}),writeFileSync(SKILLS_HINT_FILE,JSON['stringify'](b,null,0x2),'utf8');}catch{}}function getProjectSkillsHint(){try{const a=process['cwd']();if(!a||projectHasSkills(a))return null;const b=loadSkillsAsked();if(b[a])return null;return persistSkillsAsked(a),'WoWok\x20skills\x20are\x20not\x20installed\x20in\x20this\x20project.\x20Run\x20`wowok-skills\x20init`\x20'+'here\x20to\x20install\x20them\x20(the\x20MCP\x20works\x20regardless;\x20skills\x20improve\x20AI\x20orchestration).';}catch{return null;}}function formatRecipientLabel(a){if(!a)return'unknown';if(typeof a==='string')return a;const b=classifyRecipient(a);if(!b)return JSON['stringify'](a);if(b['kind']==='submission')return'submitted\x20object\x20slot\x20'+b['identifier']+'\x20(object\x20receipt\x20=\x20owner\x20receipt)';if(b['kind']==='signer')return'Signer\x20(caller\x20of\x20the\x20guard-gated\x20alloc)';const c=b['address'];if(c['length']>0x10)return'Entity('+c['slice'](0x0,0x8)+'...'+c['slice'](-0x4)+')';return'Entity('+c+')';}function formatMistAmount(a){const b=Number(a)/0x3b9aca00;if(b===0x0)return'0\x20WOW';const c=b['toFixed'](0x9)['replace'](/\.?0+$/,'');return c+'\x20WOW\x20('+a['toString']()+'\x20MIST)';}function extractNodesForCheck(a){if(!a?.['node'])return[];if(a['node']['nodes']&&Array['isArray'](a['node']['nodes']))return a['node']['nodes'];return[];}function resolvePermissionRef(a){if(!a?.['object'])return null;if(typeof a['object']==='string')return null;const b=a['object'];if(b['permission']){if(typeof b['permission']==='string')return b['permission'];return null;}return null;}function warnPermissionAutoCreation(a,b,c){const d=a?.['object'];d!==null&&typeof d==='object'&&d['permission']===undefined&&c['push']('PERMISSION\x20AUTO-CREATION:\x20no\x20\x27permission\x27\x20specified\x20in\x20the\x20'+b+'\x20creation\x20payload\x20—\x20a\x20NEW\x20Permission\x20object\x20is\x20created\x20automatically.\x20'+'To\x20reuse\x20an\x20existing\x20Permission\x20(recommended\x20when\x20one\x20owner\x20governs\x20several\x20objects),\x20set\x20object.permission\x20to\x20its\x20address\x20or\x20LocalMark\x20name.');}export function permissionEchoWarning(a,b,c){if(!a||typeof a!=='object'||!a['digest'])return null;const d=ResponseData(a)['find'](f=>String(f?.['type']??'')==='Permission'||String(f?.['type']??'')['endsWith']('::Permission'));if(d?.['object'])return'PERMISSION\x20ECHO:\x20this\x20'+b+'\x20creation\x20minted/auto-created\x20its\x20governing\x20Permission\x20object\x20'+(String(d['object'])+'\x20—\x20record\x20it.\x20To\x20keep\x20one\x20owner\x20=\x20one\x20Permission,\x20pass\x20this\x20address\x20')+'as\x20object.permission\x20on\x20sibling\x20object\x20creations\x20(an\x20unspecified\x20permission\x20silently\x20mints\x20a\x20new\x20orphan\x20Permission\x20per\x20object).';const e=resolvePermissionRef(c);if(e)return'PERMISSION\x20ECHO:\x20this\x20'+b+'\x20is\x20governed\x20by\x20the\x20explicitly\x20specified\x20Permission\x20'+String(e)+'\x20—\x20'+'siblings\x20should\x20reuse\x20it\x20(object.permission)\x20instead\x20of\x20minting\x20new\x20Permissions.';return null;}export async function warnMerchantCompensationFundLow(a,b,c){const d=a?.['object'];if(typeof d!=='string'||!d['trim']())return;let e;try{const t=await query_objects({'objects':[d],'network':b,'no_cache':!![]});e=t?.['objects']?.[0x0];}catch{return;}if(!e||e['type']!=='Service')return;const f=u=>{if(typeof u==='number'&&Number['isFinite'](u)&&u>=0x0)return BigInt(Math['trunc'](u));if(typeof u==='string'&&/^\d+$/['test'](u['trim']()))return BigInt(u['trim']());return undefined;},g=(String(e['type']??e['type_raw']??'')['match'](/<(.+)>$/)??[])[0x1]??'',h=Array['isArray'](e['sales'])?e['sales']:[],j=h['map'](u=>f(u?.['price']))['filter'](u=>u!==undefined),k=f(e['compensation_fund']);if(k===undefined||j['length']===0x0)return;const l=j['reduce']((u,v)=>v>u?v:u);let m=k;const n=a?.['compensation_fund_add']?.['balance'];if(n!=null){const u=f(n);if(u!==undefined)m=k+u;else{if(!g)return;try{const v=await parseAmount(String(n),g,b);m=k+v['smallestUnit'];}catch{return;}}}const o=a?.['compensation_fund_withdraw']!=null;if(o)m=0x0n;const p=0x3n;if(m>=p*l)return undefined;const q=async w=>{try{return g?(await formatChainValue(w,g,b))['display']:w['toString']();}catch{return w['toString']();}},r='Service\x20\x27'+d+'\x27\x20compensation_fund\x20holds\x20'+await q(m)+'\x20(raw\x20'+m+')\x20—\x20below\x20the\x20'+('award\x20ceiling\x20of\x20'+p+'x\x20the\x20highest\x20LISTED\x20SKU\x20price\x20(the\x20Service\x27s\x20LIVE\x20sales-list\x20')+'listing\x20prices\x20—\x20not\x20deposits\x20paid,\x20not\x20order\x20totals)\x20=\x20'+(await q(p*l)+'\x20(raw\x20'+p*l+';\x20the\x20highest\x20')+('listed\x20SKU\x20price\x20itself\x20is\x20'+await q(l)+').\x20A\x20valid\x20')+'arbitration\x20award\x20above\x20the\x20current\x20balance\x20aborts\x20the\x20buyer\x27s\x20payout\x20with\x20code\x2027\x20'+'(E_COMPENSATION_NOT_MATCH);\x20the\x20abort\x20does\x20NOT\x20consume\x20the\x20claim,\x20and\x20the\x20pool\x20is\x20NEVER\x20auto-refilled.';if(a?.['publish']===!![])return c['push']('MERCHANT\x20FUND\x20DISCLOSURE\x20(publish\x20proceeding\x20—\x20per-order\x20coverage\x20is\x20warned\x20at\x20BUY\x20time):\x20'+r+'\x20'+'Each\x20incoming\x20order\x20will\x20be\x20checked\x20against\x203x\x20ITS\x20OWN\x20amount,\x20not\x203x\x20the\x20highest\x20SKU.\x20Top\x20up\x20via\x20'+'service.compensation_fund_add\x20to\x20widen\x20the\x20payout\x20pool\x20—\x20until\x20then\x20awards\x20beyond\x20the\x20fund\x20abort\x20'+'the\x20buyer\x27s\x20claim\x20with\x20code\x2027\x20(the\x20abort\x20does\x20NOT\x20consume\x20the\x20claim)\x20and\x20the\x20merchant\x20wallet\x20'+'is\x20the\x20backstop.'),undefined;return c['push']('MERCHANT\x20FUND\x20REMINDER\x20(operational):\x20'+r+'\x20Top\x20up\x20via\x20'+'service.compensation_fund_add\x20—\x20each\x20incoming\x20order\x20is\x20checked\x20against\x203x\x20ITS\x20OWN\x20amount\x20at\x20buy\x20time,\x20'+'so\x20size\x20the\x20fund\x20for\x20your\x20typical\x20single\x20order\x20(3x\x20covers\x20any\x20single\x20ruling;\x20more\x20only\x20buys\x20headroom\x20'+'for\x20several\x20concurrent\x20claims).'+(o?'\x20NOTE:\x20this\x20call\x20withdraws\x20the\x20fund\x20—\x20buyers\x20lose\x20payout\x20protection\x20entirely.':'')),undefined;}export async function checkUmContactHasIm(a,b){let c;try{const f=await query_objects({'objects':[a],'network':b,'no_cache':!![]});c=f?.['objects']?.[0x0];}catch{return undefined;}if(!c||c['type']!=='Contact')return undefined;const d=Array['isArray'](c['ims'])?c['ims']:[];if(d['length']>0x0)return undefined;const e='REFUSED:\x20the\x20Contact\x20bound\x20as\x20um\x20(\x27'+a+'\x27)\x20has\x20NO\x20IM\x20addresses\x20—\x20Messenger\x20routes\x20'+'encrypted\x20messages\x20to\x20the\x20Contact\x27s\x20ims\x20members,\x20so\x20with\x20an\x20empty\x20ims\x20vector\x20the\x20'+'customer-service\x20channel\x20is\x20dead:\x20pre-order\x20negotiation,\x20customer_required\x20private-info\x20'+'delivery\x20and\x20post-sale\x20support\x20all\x20have\x20nowhere\x20to\x20arrive.\x20Add\x20one\x20first\x20via\x20'+'{operation_type:\x27contact\x27,\x20data:{object:\x27<the\x20contact>\x27,\x20ims:{op:\x27add\x27,\x20im:[{at:\x27<address-or-name>\x27}]}}}\x20'+'(contact\x20ims\x20add),\x20then\x20re-bind\x20um\x20on\x20this\x20Service.';return{'content':[{'type':'text','text':e}],'structuredContent':{'result':{'type':'error','error':e,'error_code':'um_contact_no_im','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'contact\x20ims\x20add\x20{object:\x27<the\x20contact>\x27,\x20ims:{op:\x27add\x27,\x20im:[{at:\x27<address-or-name>\x27}]}}\x20first,\x20'+'then\x20re-send\x20this\x20service\x20operation\x20with\x20the\x20same\x20um\x20binding.'},'message':e}};}async function resolveStringRef(a){if(typeof a!=='string')return undefined;const b=a['trim']();if(!b)return undefined;if(/^0x[0-9a-fA-F]{1,64}$/['test'](b))return b['toLowerCase']();try{return await GetAccountOrMark_Address(b)??undefined;}catch{return undefined;}}const ADDR_RE=/^0x[0-9a-fA-F]{1,64}$/;async function assertReferencesResolve(a,b){const c=a?.['data'];if(!c||typeof c!=='object')return;const d=b?.['network']?'\x20(network:\x20'+b['network']+')':'';if(typeof c['object']==='string'&&c['object']['trim']()&&!ADDR_RE['test'](c['object']['trim']())){const g=await resolveStringRef(c['object']);if(!g)throw new Error('invalid\x20parameter:object\x20\x27'+c['object']+'\x27\x20not\x20found\x20locally'+d+'\x20—\x20check\x20local_mark_list\x20/\x20account_list,\x20or\x20pass\x20the\x20on-chain\x20object\x20ID');}const e=typeof c['object']==='object'&&c['object']!==null?c['object']:undefined,f=e?.['permission'];if(typeof f==='string'&&f['trim']()&&!ADDR_RE['test'](f['trim']())){const h=await resolveStringRef(f);if(!h)throw new Error('invalid\x20parameter:permission\x20\x27'+f+'\x27\x20not\x20found\x20locally'+d+'\x20—\x20pass\x20the\x20Permission\x27s\x20object\x20ID,\x20register\x20the\x20mark\x20first,\x20or\x20use\x20the\x20object\x20form\x20permission:{name:\x22'+f+'\x22}\x20to\x20CREATE\x20a\x20new\x20Permission');}}async function checkMachinePermissionBeforePublish(a,b){if(a?.['publish']!==!![])return'';const c=extractNodesForCheck(a);if(c['length']===0x0)return'';const d=collectPermissionIndexes(c);if(d['requiredIndexes']['length']===0x0)return'';let e='';if(d['missingRefs']['length']>0x0){e+='WARNING:\x20Some\x20forwards\x20have\x20NEITHER\x20permissionIndex\x20nor\x20namedOperator.\x20'+'These\x20forwards\x20cannot\x20be\x20executed.\x20Add\x20one\x20or\x20the\x20other:\x0a';for(const l of d['missingRefs']){e+='\x20\x20-\x20Node\x20\x22'+l['nodeName']+'\x22,\x20pair\x20prev_node=\x22'+l['prevNode']+'\x22,\x20forward\x20\x22'+l['forwardName']+'\x22\x0a';}e+='\x0a';}const f=resolvePermissionRef(a);if(!f)return d['requiredIndexes']['length']>0x0&&(e+='PRE-PUBLISH\x20REMINDER:\x20This\x20Machine\x20uses\x20'+d['requiredIndexes']['length']+'\x20custom\x20permission\x20index(es):\x20['+d['requiredIndexes']['join'](',\x20')+'].\x20'+'After\x20creating\x20the\x20Permission\x20object,\x20grant\x20entities\x20for\x20each\x20index\x20via\x20'+'operation_type=\x27permission\x27,\x20e.g.\x20{\x20operation_type:\x27permission\x27,\x20data:'+permissionGrantPayloadJson('<permission_object>',d['requiredIndexes'][0x0],['<entity_address>'])+'}\x20(one\x20call\x20per\x20index),\x20BEFORE\x20publishing\x20the\x20Machine.\x20'+'Otherwise,\x20forwards\x20using\x20these\x20indexes\x20will\x20be\x20un-executable.\x0a'),e;let g=f;if(!f['startsWith']('0x'))try{const m=await LocalMark['Instance']()['get'](f);if(m?.['address'])g=m['address'];else return e+'PRE-PUBLISH:\x20Could\x20not\x20resolve\x20Permission\x20name\x20\x27'+f+'\x27\x20to\x20an\x20address.\x20Ensure\x20the\x20Permission\x20object\x20exists\x20and\x20is\x20marked.\x20'+'Required\x20indexes:\x20['+d['requiredIndexes']['join'](',\x20')+']\x0a';}catch{return e+'PRE-PUBLISH:\x20Failed\x20to\x20lookup\x20Permission\x20name\x20\x27'+f+'\x27.\x20Required\x20indexes:\x20['+d['requiredIndexes']['join'](',\x20')+']\x0a';}const h=await resolveNetwork(b?.['network']);let j=null;try{const n=await query_objects({'objects':[g],'network':h}),o=n?.['objects']?.[0x0];if(o){j={'address':g,'entity_count':o['entity_count'],'perm_remark':o['perm_remark'],'owner':o['owner']??o['builder'],'admin':o['admin']};try{j['entityPermissions']=await fetchEntityPermissions(g,h);}catch{}}}catch{return e+'PRE-PUBLISH:\x20Failed\x20to\x20query\x20Permission\x20object\x20'+g+'.\x20Required\x20indexes:\x20['+d['requiredIndexes']['join'](',\x20')+']\x0a';}if(!j)return e+'PRE-PUBLISH:\x20Permission\x20object\x20'+g+'\x20not\x20found\x20on-chain.\x20Required\x20indexes:\x20['+d['requiredIndexes']['join'](',\x20')+']\x0a';const k=checkPermissionAuthorization(d['requiredIndexes'],j);return(!k['allAuthorized']||!k['allVerified'])&&(e+=formatPermissionWarning(k)+'\x0a'),e;}async function detectServiceGuardCircularDependency(a){const b=getCreationCycleRule('service','guard','order_allocators');if(!b)return null;if(!a||typeof a['object']!=='object'||a['object']===null)return null;const c=a['order_allocators'];if(!c||typeof c!=='object')return null;const d=Array['isArray'](c['allocators'])?c['allocators']:[];if(d['length']===0x0)return null;const e=[],f=new Set();for(const m of d){const n=m?.['guard'];if(typeof n==='string'&&!n['startsWith']('0x')){if(f['has'](n))continue;f['add'](n);try{const o=await LocalMark['Instance']()['get_address'](n);!o&&e['push'](n);}catch{e['push'](n);}}}if(e['length']===0x0)return null;const g=e['map'](p=>'\x27'+p+'\x27')['join'](',\x20'),h=a['object'],j=h['name']??'<service_name>',k=b['remedy']['steps']['map']((p,q)=>{if(p==='draft_without_field')return{'step':q+0x1,'action':'onchain_operations','operation_type':b['dependent'],'params':{...a,[b['remedy']['strip_field']]:null,'publish':b['remedy']['draft_publish']},'purpose':'Create\x20Service\x20\x27'+j+'\x27\x20WITHOUT\x20'+b['remedy']['strip_field']+'\x20to\x20establish\x20'+('its\x20LocalMark\x20entry.\x20After\x20this\x20step,\x20the\x20name\x20\x27'+j+'\x27\x20resolves\x20')+'to\x20an\x20on-chain\x20address.'};if(p==='create_providers')return{'step':q+0x1,'action':'onchain_operations','operation_type':b['provider'],'params':e['map'](r=>({'object':{'name':r,'type':'Guard'},'_hint':'Table\x20items\x20may\x20reference\x20Service\x20\x27'+j+'\x27\x20by\x20name'})),'purpose':'Create\x20Guard(s)\x20'+g+'.\x20Their\x20table\x20items\x20can\x20now\x20resolve\x20'+('Service\x20\x27'+j+'\x27\x20by\x20name\x20(LocalMark\x20entry\x20from\x20step\x201).')};return{'step':q+0x1,'action':'onchain_operations','operation_type':b['dependent'],'params':{'object':j,[b['remedy']['strip_field']]:c,'publish':a['publish']??!![]},'purpose':'Update\x20Service\x20with\x20'+b['remedy']['strip_field']+'\x20(referencing\x20Guards\x20created\x20in\x20'+'step\x202)\x20and\x20publish.\x20After\x20publish,\x20order_allocators\x20becomes\x20SDK-LOCKED.'};}),l='⚠️\x20Circular\x20dependency\x20detected:\x20Service\x20↔\x20Guard\x0a\x0a'+('Cannot\x20create\x20Service\x20with\x20order_allocators\x20referencing\x20non-existent\x20Guard(s):\x20'+g+'.\x0a\x0a')+'Explanation:\x20Guard\x20table\x20items\x20may\x20reference\x20the\x20Service\x20by\x20name,\x20creating\x20a\x20circular\x20'+'dependency:\x20the\x20Service\x20must\x20exist\x20as\x20a\x20LocalMark\x20before\x20the\x20Guard\x20can\x20resolve\x20it,\x20'+'but\x20the\x20Guard\x20must\x20exist\x20before\x20the\x20Service\x20can\x20reference\x20it\x20in\x20order_allocators.\x20'+'The\x20SDK\x20would\x20fail\x20with\x20a\x20BCS\x20serialization\x20error:\x20\x22Expected\x20valid\x20Address\x20for\x20'+'ValueType.Address,\x20but\x20failed\x20to\x20resolve\x20string:\x20<name>\x22.\x0a\x0a'+'Recommended\x20steps:\x0a'+k['map'](p=>'\x20\x20Step\x20'+p['step']+'\x20('+p['operation_type']+'):\x20'+p['purpose'])['join']('\x0a')+'\x0a\x0aHint:\x20This\x20is\x20the\x20canonical\x20Service↔Guard\x20circular\x20dependency.\x20The\x203-step\x20'+'pattern\x20above\x20is\x20the\x20documented\x20solution\x20(see\x20SCHEMA-03\x20/\x20P0-01\x20in\x20the\x20'+'Service\x20publish\x20field\x20description).';return{'content':[{'type':'text','text':l}],'structuredContent':{'result':{'type':'error','error':'Cannot\x20create\x20Service\x20with\x20order_allocators\x20referencing\x20non-existent\x20Guard(s):\x20'+g+'.\x20Circular\x20dependency:\x20Service↔Guard.','error_code':'circular_dependency_detected','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':JSON['stringify'](k),'related_object':j},'message':'Circular\x20dependency\x20detected:\x20Service\x20↔\x20Guard.\x20See\x20recovery_hint\x20for\x20the\x203-step\x20creation\x20pattern.'}};}function buildFundBlockResult(a,b){const c=a['matchErrors']['length']>0x0,d=a['errors']['length']>0x0,e=a['blockingErrors']['some'](l=>l['includes']('TOKEN\x20CHOICE\x20REQUIRED')),f=c&&d?'FUND\x20OPERATION\x20BLOCKED':c?'TOKEN\x20TYPE\x20MISMATCH\x20—\x20operation\x20blocked':e?'TOKEN\x20CHOICE\x20REQUIRED\x20—\x20operation\x20blocked,\x20awaiting\x20user\x20selection':'FUND\x20INPUT\x20BLOCKED\x20—\x20operation\x20blocked',g=c&&d?'fund_blocked':c?'token_type_mismatch':e?'token_choice_required':'fund_input_error',h=c?'\x0a\x0aThe\x20token\x20type\x20of\x20a\x20generic\x20on-chain\x20object\x20(e.g.\x20Treasury<T>,\x20Service<T>)\x20is\x20'+'determined\x20at\x20creation\x20and\x20can\x20NEVER\x20be\x20changed,\x20and\x20monetary\x20input\x20is\x20never\x20'+('processed\x20with\x20unknown\x20token\x20precision.\x20This\x20'+b+'\x20operation\x20was\x20')+'NOT\x20executed.\x20Fix\x20the\x20errors\x20above\x20and\x20re-issue\x20the\x20operation'+(a['objectTokenType']?'\x20(object\x20token\x20type:\x20'+a['objectTokenType']+')':'')+'.':e?'\x0a\x0aMultiple\x20on-chain\x20tokens\x20may\x20legally\x20share\x20the\x20same\x20symbol\x20(several\x20'+'issuers\x20can\x20each\x20publish\x20a\x20\x22USDT\x22),\x20so\x20a\x20bare\x20symbol\x20can\x20never\x20identify\x20'+('the\x20issuer.\x20This\x20'+b+'\x20operation\x20was\x20NOT\x20executed\x20and\x20no\x20')+'on-chain\x20action\x20was\x20taken.\x20Present\x20the\x20numbered\x20candidate\x20list\x20above\x20to\x20'+'the\x20USER,\x20wait\x20for\x20their\x20choice,\x20then\x20re-issue\x20with\x20the\x20chosen\x20token\x27s\x20'+'full\x20type.':'\x0a\x0aMonetary\x20input\x20is\x20never\x20processed\x20with\x20unknown\x20token\x20precision\x20or\x20an\x20'+('unparseable\x20amount.\x20This\x20'+b+'\x20operation\x20was\x20NOT\x20executed\x20and\x20')+'no\x20on-chain\x20action\x20was\x20taken.\x20Follow\x20the\x20recovery\x20steps\x20in\x20the\x20error\x20'+'above\x20and\x20re-issue\x20the\x20operation.',j='⛔\x20'+f+'\x0a\x0a'+a['blockingErrors']['map'](l=>'\x20\x20•\x20'+l)['join']('\x0a')+h,k=e?'Present\x20the\x20numbered\x20token\x20candidate\x20list\x20from\x20the\x20error\x20message\x20to\x20the\x20USER\x20'+'(full\x20type,\x20name,\x20decimals,\x20verified\x20tag\x20are\x20all\x20shown)\x20—\x20do\x20NOT\x20pick\x20an\x20'+'issuer\x20yourself.\x20After\x20the\x20user\x20chooses\x20(by\x20number\x20or\x20by\x20pasting\x20the\x20full\x20'+('type),\x20re-issue\x20this\x20'+b+'\x20operation\x20with\x20that\x20token\x27s\x20FULL\x20type\x20')+'string\x20(package::module::Name)\x20in\x20type_parameter\x20(object.type_parameter\x20for\x20'+'service\x20creation;\x20root\x20type_parameter\x20for\x20payment\x20receive).\x20Also\x20verify\x20the\x20'+'WOW\x20network\x20selection\x20is\x20correct.':'Use\x20token\x20type\x20'+(a['objectTokenType']??'<the\x20object\x27s\x20generic\x20token\x20type>')+'\x20for\x20all\x20'+('amounts,\x20coins,\x20and\x20receive\x20records\x20in\x20this\x20'+b+'\x20operation.\x20')+'Query\x20the\x20object\x20via\x20query_toolkit\x20onchain_objects\x20to\x20confirm\x20its\x20generic\x20'+'token\x20type\x20(type_raw,\x20e.g.\x20\x220x2::treasury::Treasury<0x2::wow::WOW>\x22).\x20'+'For\x20precision-unavailable\x20tokens,\x20retry\x20the\x20operation\x20—\x20the\x20on-chain\x20'+'metadata\x20lookup\x20may\x20have\x20been\x20transient.';return{'content':[{'type':'text','text':j}],'structuredContent':{'result':{'type':'error','error':a['blockingErrors']['join']('\x20|\x20'),'error_code':g,'retryable':!![],'recovery_hint':k},'message':'Fund\x20operation\x20blocked\x20before\x20execution.'}};}async function checkSalesWipNetworkDeployment(a,b,c){const d=a?.['sales'];if(!d||typeof d!=='object')return null;if(d['op']!=='add'&&d['op']!=='set')return null;const e=Array['isArray'](d['sales'])?d['sales']:[];if(e['length']===0x0)return null;const f=b?.['network']==='localnet';for(const g of e){const h=g?.['wip'];if(typeof h!=='string'||h==='')continue;const j=classifyWipPath(h),k=!j['is_local']&&j['is_network']&&!f&&(j['type']==='http_url'||j['type']==='ipfs'&&/^https?:/i['test'](h));if(k){const n=await probeWipReachability(h)['catch'](()=>({'ok':![],'reason':'probe\x20failed'}));if(!n['ok']){const o=n['status']?'HTTP\x20'+n['status']:n['reason']??'unreachable',p='⛔\x20WIP\x20HOST\x20UNREACHABLE\x20—\x20sales\x20NOT\x20submitted\x0a\x0a'+('Sale\x20\x22'+g['name']+'\x22\x20has\x20wip\x20=\x20\x22'+h+'\x22,\x20but\x20the\x20host\x20is\x20not\x20reachable\x20('+o+').\x0a\x0a')+'Every\x20customer\x20order_new\x20fetches\x20this\x20URL\x20to\x20verify\x20the\x20WIP\x20file\x20—\x20while\x20it\x20is\x20'+'down,\x20ALL\x20purchases\x20on\x20this\x20Service\x20abort\x20100%\x20(F-27:\x20WIP\x20single-host\x20outage\x20'+'famously\x20took\x20every\x20listing\x20down\x20at\x20once).\x0a\x0a'+'This\x20is\x20NOT\x20a\x20wrong-network\x20problem\x20—\x20do\x20NOT\x20switch\x20networks.\x0a\x0a'+'Fix:\x0a'+'\x20\x20•\x20Transient\x20outage:\x20wait\x20for\x20the\x20host\x20to\x20recover,\x20then\x20re-run\x20this\x20operation.\x0a'+'\x20\x20•\x20Permanent:\x20redeploy\x20the\x20.wip\x20file\x20to\x20another\x20public\x20endpoint\x20and\x20update\x20'+'sale.wip\x20+\x20wip_hash\x20(GitHub\x20Pages\x20/\x20IPFS\x20/\x20your\x20own\x20site,\x20or\x20wip_file\x20'+'type=\x27upload\x27\x20for\x20the\x20official\x20store).\x0a'+'\x20\x20•\x20Testing\x20only:\x20set\x20sale.wip\x20=\x20\x22\x22\x20(empty)\x20to\x20skip\x20WIP\x20verification.';return{'content':[{'type':'text','text':p}],'structuredContent':{'result':{'type':'error','error':'Sale\x20\x22'+g['name']+'\x22\x20wip\x20host\x20unreachable\x20('+o+'):\x20'+h+'.\x20Customer\x20order_new\x20would\x20abort\x20100%\x20while\x20the\x20WIP\x20file\x20cannot\x20be\x20fetched\x20(F-27).\x20Not\x20a\x20wrong-network\x20problem.','error_code':'wip_host_unreachable','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Transient\x20outage:\x20retry\x20after\x20the\x20host\x20recovers.\x20Permanent:\x20redeploy\x20the\x20.wip\x20'+'file\x20to\x20another\x20public\x20endpoint\x20and\x20set\x20sale.wip\x20to\x20the\x20new\x20URL\x20(update\x20'+'wip_hash\x20too);\x20or\x20set\x20sale.wip\x20=\x20\x22\x22\x20(empty)\x20to\x20skip\x20WIP\x20verification\x20(TESTING\x20ONLY).','related_object':g['name']},'message':'WIP\x20host\x20unreachable\x20—\x20sales\x20not\x20submitted.\x20See\x20recovery_hint.'}};}}if(!j['is_local'])continue;if(j['type']==='local_http'){if(f){c['push']('WIP\x20INTERNAL-TEST-ONLY\x20REMINDER\x20(sale\x20\x22'+g['name']+'\x22):\x20wip\x20=\x20\x22'+h+'\x22\x20is\x20a\x20'+('local-network\x20URL\x20('+j['description']+').\x20It\x20is\x20reachable\x20ONLY\x20on\x20the\x20')+'local\x20machine\x20/\x20LAN\x20where\x20a\x20local\x20WIP\x20server\x20runs.\x20This\x20is\x20acceptable\x20for\x20LOCALNET\x20'+'internal\x20testing,\x20but\x20customers\x20and\x20on-chain\x20verifiers\x20on\x20OTHER\x20machines\x20CANNOT\x20'+'reach\x20it\x20—\x20on\x20testnet/mainnet,\x20every\x20customer\x20order_new\x20would\x20fail\x20100%\x20because\x20the\x20'+'WIP\x20file\x20cannot\x20be\x20verified.\x20For\x20any\x20non-localnet\x20deployment,\x20replace\x20this\x20URL\x20with\x20'+'a\x20public\x20endpoint\x20(GitHub\x20Pages\x20/\x20IPFS\x20/\x20your\x20own\x20website)\x20or\x20leave\x20sale.wip\x20empty.');continue;}const q='a\x20local-network\x20URL\x20('+j['description']+')',r='⛔\x20WIP\x20IS\x20NOT\x20NETWORK-DEPLOYABLE\x20—\x20sales\x20NOT\x20submitted\x0a\x0a'+('Sale\x20\x22'+g['name']+'\x22\x20has\x20wip\x20=\x20\x22'+h+'\x22,\x20which\x20is\x20'+q+'.\x0a\x0a')+'INTERNAL\x20TEST\x20USE\x20ONLY:\x20this\x20URL\x20is\x20reachable\x20only\x20from\x20the\x20merchant\x27s\x20own\x20machine/LAN.\x20'+'Customers\x20on\x20other\x20machines\x20cannot\x20reach\x20it,\x20so\x20verifying\x20the\x20WIP\x20file\x20at\x20order\x20time\x20'+'fails\x20and\x20order_new\x20aborts\x20100%.\x20Local-network\x20WIP\x20URLs\x20are\x20allowed\x20ONLY\x20for\x20'+('localnet\x20internal\x20testing\x20(env.network\x20=\x20\x22localnet\x22);\x20on\x20'+(b?.['network']??'this\x20network')+'\x20')+'they\x20must\x20never\x20be\x20stored\x20on-chain.\x0a\x0a'+'Fix:\x20deploy\x20the\x20.wip\x20file\x20to\x20a\x20publicly\x20reachable\x20endpoint,\x20then\x20re-run\x20with\x20'+'sale.wip\x20=\x20\x22<public\x20URL>\x22\x20(e.g.\x20GitHub\x20Pages,\x20IPFS\x20gateway,\x20or\x20your\x20own\x20website).\x0a'+'\x20\x20•\x20GitHub\x20Pages:\x20https://<user>.github.io/<repo>/<file>.wip\x0a'+'\x20\x20•\x20IPFS:\x20\x20\x20\x20\x20\x20\x20\x20https://ipfs.io/ipfs/<CID>\x20\x20(or\x20ipfs://<CID>)\x0a'+'\x20\x20•\x20Your\x20site:\x20\x20\x20https://<your-domain>/<path>/<file>.wip\x0a'+'Alternatively,\x20set\x20sale.wip\x20=\x20\x22\x22\x20(empty)\x20to\x20SKIP\x20WIP\x20verification\x20—\x20'+'TESTING\x20ONLY,\x20not\x20recommended\x20for\x20production.';return{'content':[{'type':'text','text':r}],'structuredContent':{'result':{'type':'error','error':'Sale\x20\x22'+g['name']+'\x22\x20wip\x20is\x20'+q+':\x20'+h+'.\x20Local-network\x20URLs\x20are\x20INTERNAL\x20TEST\x20USE\x20ONLY\x20—\x20customers\x20cannot\x20verify\x20them,\x20aborting\x20order_new\x20100%.','error_code':'wip_not_network_deployed','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Deploy\x20the\x20.wip\x20file\x20to\x20a\x20public\x20endpoint\x20(GitHub\x20Pages\x20/\x20IPFS\x20/\x20your\x20own\x20website)\x20'+'and\x20set\x20sale.wip\x20to\x20the\x20public\x20URL;\x20or\x20set\x20sale.wip\x20=\x20\x22\x22\x20(empty)\x20to\x20skip\x20WIP\x20'+'verification\x20(TESTING\x20ONLY).','related_object':g['name']},'message':'WIP\x20is\x20a\x20local-network\x20URL\x20(INTERNAL\x20TEST\x20USE\x20ONLY)\x20—\x20sales\x20not\x20submitted.\x20See\x20recovery_hint.'}};}const l='a\x20LOCAL\x20'+j['type']+'\x20path',m='⛔\x20WIP\x20IS\x20NOT\x20NETWORK-DEPLOYABLE\x20—\x20sales\x20NOT\x20submitted\x0a\x0a'+('Sale\x20\x22'+g['name']+'\x22\x20has\x20wip\x20=\x20\x22'+h+'\x22,\x20which\x20is\x20'+l+'.\x0a\x0a')+'Why\x20this\x20is\x20fatal:\x20the\x20WIP\x20path\x20is\x20stored\x20ON-CHAIN\x20and\x20every\x20customer\x20'+'(on\x20a\x20different\x20machine)\x20fetches\x20it\x20when\x20placing\x20an\x20order.\x20A\x20local\x20path\x20/\x20'+'localhost\x20/\x20LAN\x20URL\x20is\x20reachable\x20only\x20from\x20YOUR\x20machine\x20—\x20it\x20passes\x20the\x20'+'merchant-side\x20set-time\x20verification\x20but\x20makes\x20order_new\x20abort\x20100%\x20for\x20customers.\x0a\x0a'+'Fix:\x20deploy\x20the\x20.wip\x20file\x20to\x20a\x20publicly\x20reachable\x20endpoint,\x20then\x20re-run\x20with\x20'+'sale.wip\x20=\x20\x22<public\x20URL>\x22\x20(e.g.\x20GitHub\x20Pages,\x20IPFS\x20gateway,\x20or\x20your\x20own\x20website).\x0a'+'\x20\x20•\x20GitHub\x20Pages:\x20https://<user>.github.io/<repo>/<file>.wip\x0a'+'\x20\x20•\x20IPFS:\x20\x20\x20\x20\x20\x20\x20\x20https://ipfs.io/ipfs/<CID>\x20\x20(or\x20ipfs://<CID>)\x0a'+'\x20\x20•\x20Your\x20site:\x20\x20\x20https://<your-domain>/<path>/<file>.wip\x0a'+'Alternatively,\x20set\x20sale.wip\x20=\x20\x22\x22\x20(empty)\x20to\x20SKIP\x20WIP\x20verification\x20—\x20'+'TESTING\x20ONLY,\x20not\x20recommended\x20for\x20production.';return{'content':[{'type':'text','text':m}],'structuredContent':{'result':{'type':'error','error':'Sale\x20\x22'+g['name']+'\x22\x20wip\x20is\x20'+l+':\x20'+h+'.\x20Local\x20WIP\x20paths\x20are\x20unreachable\x20by\x20customers\x20and\x20abort\x20order_new\x20100%.','error_code':'wip_not_network_deployed','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Deploy\x20the\x20.wip\x20file\x20to\x20a\x20public\x20endpoint\x20(GitHub\x20Pages\x20/\x20IPFS\x20/\x20your\x20own\x20website)\x20'+'and\x20set\x20sale.wip\x20to\x20the\x20public\x20URL;\x20or\x20set\x20sale.wip\x20=\x20\x22\x22\x20(empty)\x20to\x20skip\x20WIP\x20'+'verification\x20(TESTING\x20ONLY).','related_object':g['name']},'message':'WIP\x20is\x20not\x20network-deployable\x20—\x20sales\x20not\x20submitted.\x20See\x20recovery_hint.'}};}return null;}function checkSalesZeroPrice(a){const b=a?.['sales'];if(!b||typeof b!=='object')return null;if(b['op']!=='add'&&b['op']!=='set')return null;const c=Array['isArray'](b['sales'])?b['sales']:[];for(const d of c){const e=d?.['price']?.['balance']??d?.['price'],f=typeof e==='string'?e['trim']():String(e??'');if(!/^\d+$/['test'](f)||BigInt(f)!==0x0n)continue;const g='⛔\x20ZERO-PRICE\x20SKU\x20REFUSED\x20—\x20sales\x20NOT\x20submitted\x20(F-BS-76)\x0a\x0a'+('Sale\x20\x22'+d['name']+'\x22\x20has\x20price\x200.\x20A\x20zero-priced\x20SKU\x20is\x20LISTABLE\x20but\x20PERMANENTLY\x20UNBUYABLE:\x20')+'the\x20chain\x20refuses\x20zero-total\x20orders\x20(client\x20order_new_zero_total_dead_order,\x20on-chain\x20abort\x2042),\x20'+'so\x20no\x20buyer\x20can\x20ever\x20purchase\x20it\x20—\x20and\x20the\x20listing\x20is\x20immutable\x20on\x20those\x20points\x20that\x20matter\x20'+'(removing\x20it\x20costs\x20gas;\x20repricing\x20needs\x20a\x20fresh\x20set).\x0a\x0a'+'Fixes\x20(pick\x20one):\x0a'+'\x20\x20•\x20Price\x20it\x20at\x201\x20smallest\x20unit\x20(the\x20minimum\x20buyable\x20price)\x20—\x20the\x20standard\x20way\x20to\x20express\x20a\x20free\x20tier.\x0a'+'\x20\x20•\x20If\x20the\x20item\x20is\x20not\x20actually\x20for\x20sale,\x20do\x20not\x20add\x20it\x20to\x20sales.\x0a'+'\x20\x20•\x20Testing\x20an\x20unbuyable\x20listing\x20deliberately?\x20Re-run\x20with\x20price\x20\x221\x22\x20—\x20the\x20gate\x20arithmetic\x20is\x20identical\x20from\x20price\x201\x20upward.';return{'content':[{'type':'text','text':g}],'structuredContent':{'result':{'type':'error','error':'Sale\x20\x22'+d['name']+'\x22\x20price\x200:\x20zero-priced\x20SKUs\x20are\x20permanently\x20unbuyable\x20(zero-total\x20gate,\x20abort\x2042)\x20—\x20F-BS-76.','error_code':'invalid_parameter','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'Set\x20price\x20to\x20at\x20least\x201\x20smallest\x20unit\x20(a\x20free\x20tier\x20is\x20priced\x20at\x201,\x20not\x200)\x20and\x20resubmit;\x20'+'or\x20drop\x20the\x20item\x20from\x20sales\x20if\x20it\x20is\x20not\x20for\x20sale.','related_object':d['name']},'message':'Zero-price\x20SKU\x20refused\x20—\x20sales\x20not\x20submitted.\x20See\x20recovery_hint.'}};}return null;}function extractObjectOnlyRef(a){const b=a;if(b['submission'])return undefined;const c=b['data'];if(!c||typeof c!=='object'||Array['isArray'](c))return undefined;const d=c,e=Object['keys'](d);if(e['length']!==0x1||e[0x0]!=='object')return undefined;const f=d['object'];return typeof f==='string'&&f['trim']()['length']>0x0?f['trim']():undefined;}async function preflightDemandFeedback(a,b,c){try{const d=typeof a?.['object']==='string'?a['object']:undefined;if(!d||!Array['isArray'](a?.['feedback'])||a['feedback']['length']===0x0)return undefined;const f=d['startsWith']('0x')?d:await LocalMark['Instance']()['get_address'](d)['catch'](()=>undefined);if(typeof f!=='string'||!f['startsWith']('0x'))return c['push']('FEEDBACK\x20PREFLIGHT\x20UNRESOLVED:\x20the\x20Demand\x20reference\x20could\x20not\x20be\x20resolved\x20to\x20an\x20on-chain\x20address;\x20the\x20presenter\x20pre-check\x20was\x20skipped\x20(the\x20chain\x20remains\x20the\x20truth).'),undefined;const {items:g}=await batchQueryTableItems(f,{'network':b?.['network'],'noCache':!![],'maxItems':0xc8}),h=(g??[])['map'](j=>j['object'])['filter'](j=>j?.['type']==='TableItem_DemandPresenter');for(const j of a['feedback']){let k=typeof j?.['who']==='string'?j['who']:undefined;k&&!k['startsWith']('0x')&&(k=await LocalMark['Instance']()['get_address'](k)['catch'](()=>undefined)??undefined);if(typeof k!=='string'||!k['startsWith']('0x')){c['push']('FEEDBACK\x20PREFLIGHT\x20UNRESOLVED:\x20feedback\x20who\x20\x27'+j?.['who']+'\x27\x20could\x20not\x20be\x20resolved\x20to\x20an\x20address;\x20its\x20presenter\x20pre-check\x20was\x20skipped.');continue;}const l=h['find'](m=>normAddr(String(m?.['address']??''))===normAddr(k));if(!l)return{'content':[{'type':'text','text':'FEEDBACK\x20REFUSED\x20(non-presenter)\x20—\x20no\x20transaction\x20was\x20sent.\x20Account\x20'+k+'\x20has\x20NEVER\x20presented\x20to\x20Demand\x20'+f+'\x20'+'(the\x20demand\x27s\x20on-chain\x20presenter\x20table\x20holds\x20no\x20row\x20for\x20it).\x20Move\x20truth:\x20demand\x20feedback\x20for\x20a\x20non-presenter\x20is\x20a\x20SILENT\x20no-op\x20'+'—\x20the\x20presenter-membership\x20check\x20gates\x20every\x20write\x20with\x20NO\x20abort\x20and\x20NO\x20event,\x20so\x20this\x20tx\x20would\x20burn\x20gas\x20and\x20record\x20nothing.'}],'structuredContent':{'result':{'type':'error','error':'Demand\x20feedback\x20for\x20\x27'+j?.['who']+'\x27\x20on\x20'+d+'\x20refused:\x20the\x20account\x20never\x20presented\x20to\x20this\x20demand,\x20and\x20on-chain\x20feedback\x20for\x20non-presenters\x20is\x20silently\x20ignored\x20(no\x20abort,\x20no\x20event).','error_code':'demand_feedback_not_presenter','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'The\x20presenter\x20row\x20is\x20created\x20by\x20the\x20PRESENT\x20path:\x20the\x20presenter\x20account\x20runs\x20demand\x20present\x20(operation_type\x20\x27demand\x27,\x20data.present\x20{recommend,\x20service})\x20signed\x20by\x20THAT\x20account.\x20After\x20it\x20presents,\x20re-send\x20this\x20feedback\x20call.\x20If\x20you\x20meant\x20to\x20rate\x20the\x20DEMAND\x20OWNER\x20instead,\x20order/progress\x20feedback\x20rails\x20are\x20separate\x20surfaces.'},'message':'Refused:\x20demand\x20feedback\x20targets\x20an\x20account\x20that\x20never\x20presented\x20—\x20the\x20chain\x20would\x20silently\x20drop\x20it.\x20Present\x20first,\x20then\x20give\x20feedback.'}};j?.['acceptance_score']!=null&&l?.['feedback_time']!=null&&l?.['acceptance_score']!=null&&Number(l['acceptance_score'])!==Number(j['acceptance_score'])&&c['push']('FEEDBACK\x20SCORE\x20OVERWRITE\x20(F-20\x20advisory):\x20presenter\x20'+k+'\x20already\x20holds\x20acceptance_score='+l['acceptance_score']+'\x20'+('(feedback\x20recorded\x20at\x20'+l['feedback_time']+');\x20this\x20call\x20sets\x20acceptance_score='+j['acceptance_score']+'.\x20Move\x20has\x20NO\x20once-gate\x20—\x20')+'the\x20bare\x20assignment\x20WILL\x20overwrite\x20the\x20prior\x20score.\x20Confirm\x20this\x20revision\x20is\x20intended.');}return undefined;}catch(m){return c['push']('FEEDBACK\x20PREFLIGHT\x20FAILED\x20(proceeding\x20—\x20the\x20chain\x20remains\x20the\x20truth):\x20'+(m?.['message']??String(m))),undefined;}}async function queryObjectOnlyResult(a,b,c){let d=[],f;try{const k=await query_objects({'objects':[b],'network':c?.['network'],'no_cache':!![]});d=k['objects']??[],d['length']===0x0&&(f='Object\x20\x27'+b+'\x27\x20not\x20found\x20on-chain.\x20It\x20may\x20never\x20have\x20been\x20created,\x20'+'its\x20local\x20mark\x20may\x20be\x20missing\x20(register\x20it\x20via\x20local_mark_operation),\x20'+'or\x20it\x20may\x20live\x20on\x20a\x20different\x20network.');}catch(l){const m=l?.['message']??String(l);f='Query\x20failed\x20for\x20\x27'+b+'\x27:\x20'+m;}const g=d['map'](n=>({...n,'change':'queried'})),h=f?'Object-only\x20payload\x20for\x20'+a+'\x20—\x20nothing\x20to\x20mutate,\x20no\x20transaction\x20was\x20sent\x20(no\x20gas\x20used).\x20'+f:'Object-only\x20payload\x20for\x20'+a+'\x20—\x20nothing\x20to\x20mutate,\x20no\x20transaction\x20was\x20sent\x20(no\x20gas\x20used).\x20Current\x20on-chain\x20state\x20of\x20\x27'+b+'\x27:',j={'message':h,'result':f?{'type':'error','error':f,'error_code':'object_not_found','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'Check\x20the\x20name\x20spelling\x20(local_mark_operation\x20list),\x20the\x20env.network\x20value,\x20or\x20create\x20the\x20object\x20first.'}:{'type':'data','data':g},'semantic':{'intent':a+'_read','status':f?'failed':'success','summary':h,'next_actions':[{'action':'Use\x20query_toolkit\x20(onchain_objects)\x20for\x20richer\x20inspection\x20—\x20content\x20fields,\x20ownership,\x20dynamic\x20tables.','reason':'Object-only\x20onchain_operations\x20payloads\x20are\x20answered\x20by\x20a\x20pure\x20query;\x20they\x20never\x20mutate\x20on-chain\x20state.','tool':'query_toolkit','priority':'recommended'}],'warnings':['Payload\x20contained\x20only\x20data.object\x20—\x20interpreted\x20as\x20a\x20READ\x20request,\x20not\x20a\x20transaction.']}};return{'content':[{'type':'text','text':h}],'structuredContent':j};}function checkOrderAllocatorsPrePublish(b,c){if(!b||typeof b!=='object')return null;let d,f;try{const h=assessAllocationRisks({'allocators_config':b,'operation_type':'create','trigger_source':'service_order_allocators'}),j=new Set(['R-A-1-01','R-A-1-02','R-A-1-03','R-A-2-03']);d=h['risks']['filter'](k=>j['has'](k['id']))['map'](k=>({'id':k['id'],'title':k['title'],'mitigation':k['mitigation']+'\x20'+STUCK_POOL_REMEDY})),f=h['risks']['filter'](k=>!j['has'](k['id'])&&(k['level']==='critical'||k['level']==='high'))['map'](k=>({'id':k['id'],'title':k['title'],'mitigation':k['mitigation']}));}catch(k){return c['push']('pre-publish\x20allocators\x20risk\x20scan\x20failed\x20(non-blocking):\x20'+(k instanceof Error?k['message']:String(k))+'\x20—\x20'+'run\x20the\x20recipient\x20constraint\x20audit\x20via\x20query_toolkit\x20service_panorama\x20before\x20publish.'),null;}for(const l of f){c['push']('ALLOCATOR\x20RISK\x20'+l['id']+'\x20(advisory\x20—\x20needs\x20full-evidence\x20review\x20before\x20publish):\x20'+l['title']+'\x20—\x20'+l['mitigation']);}try{const m=Array['isArray'](b?.['allocators'])?b['allocators']:[],n=m['map']((o,p)=>{const q=Array['isArray'](o?.['sharing'])?o['sharing']:[];return q['some'](r=>r?.['who']&&typeof r['who']==='object'&&'GuardIdentifier'in r['who'])?p:-0x1;})['filter'](o=>o>=0x0);n['length']>0x0&&c['push']('REFUND\x20TRACK\x20GUARD\x20GATING\x20(advisory):\x20Allocator(s)\x20['+n['join'](',\x20')+']\x20pay\x20a\x20'+'GuardIdentifier\x20recipient\x20—\x20the\x20order-anchored\x20refund\x20track.\x20Verify\x20the\x20bound\x20guard\x20is\x20'+'NODE-GATED:\x20AND[progress.node==<X>]\x20per\x20refundable\x20node\x20(per-node\x20tracks\x20are\x20the\x20'+'default\x20form\x20—\x20a\x20node\x20set\x20is\x20also\x20expressible\x20via\x20the\x20relies\x20two-level\x20tree:\x20'+'OR-subguard\x20per\x20node\x20under\x20an\x20AND\x20parent).\x20A\x20signer==order.owner\x20leg\x20is\x20OPTIONAL\x20here,\x20'+'not\x20a\x20safety\x20requirement:\x20with\x20a\x20GuardIdentifier\x20recipient\x20the\x20payee\x20is\x20already\x20hard-bound\x20to\x20the\x20'+'order\x20(funds\x20land\x20in\x20the\x20order\x20no\x20matter\x20who\x20triggers),\x20so\x20the\x20signer\x20leg\x20only\x20restricts\x20who\x20may\x20'+'fire\x20the\x20trigger\x20—\x20drop\x20it\x20when\x20keepers\x20or\x20the\x20service\x20should\x20be\x20able\x20to\x20trigger\x20refunds.\x20There\x20is\x20'+'NO\x20on-chain\x20seal\x20between\x20the\x20refund\x20track\x20and\x20a\x20compensation\x20ruling\x20—\x20a\x20claim\x20settling\x20does\x20NOT\x20close\x20'+'this\x20track;\x20enforce\x20any\x20refund-vs-compensation\x20exclusion\x20by\x20gating\x20the\x20guard\x20(e.g.\x20on\x20arb/settlement\x20'+'state)\x20at\x20configuration\x20time.\x20Declare\x20the\x20identifier-254\x20once\x20slot\x20on\x20the\x20'+'refund\x20guard\x20(chain\x20derives\x20the\x20key\x20from\x20payment_info.for_object\x20—\x20unwidenable\x20per-order\x20replay\x20'+'protection;\x20reserve\x20identifier\x20255\x20with\x20a\x20period\x20key\x20for\x20rails\x20that\x20legitimately\x20repeat\x20per\x20period)\x20'+'so\x20a\x20consumed\x20claim\x20cannot\x20re-split\x20the\x20residual.');}catch{}if(d['length']===0x0)return null;const g='⛔\x20SERVICE\x20PUBLISH\x20BLOCKED\x20—\x20order_allocators\x20fails\x20the\x20pre-publish\x20risk\x20scan\x20'+'(the\x20allocation\x20rule\x20kernel,\x20same\x20rules\x20as\x20the\x20template\x20scan).\x0a\x0a'+d['map'](o=>'\x20\x20•\x20'+o['id']+':\x20'+o['title']+'\x0a\x20\x20\x20\x20Fix:\x20'+o['mitigation'])['join']('\x0a')+'\x0a\x0aorder_allocators\x20is\x20PERMANENTLY\x20IMMUTABLE\x20after\x20publish\x20(E_ALREADY_PUBLISHED,\x20'+'no\x20pause+lock\x20exception)\x20—\x20a\x20published\x20misconfiguration\x20locks\x20order\x20funds\x20or\x20aborts\x20'+'every\x20alloc()\x20transaction\x20for\x20the\x20lifetime\x20of\x20this\x20Service.\x20Fix\x20the\x20allocator\x20table\x20'+'and\x20re-issue\x20this\x20operation.\x20This\x20call\x20was\x20NOT\x20executed\x20and\x20no\x20on-chain\x20action\x20was\x20taken.';return{'content':[{'type':'text','text':g}],'structuredContent':{'result':{'type':'error','error':d['map'](o=>o['id']+':\x20'+o['title'])['join']('\x20|\x20'),'error_code':'allocators_risk_blocked','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':JSON['stringify'](d)},'message':'Service\x20publish\x20blocked\x20by\x20the\x20pre-publish\x20allocators\x20risk\x20scan.'}};}async function checkEntityRecipientGate(a,b,c){let d;try{d=await checkEntityRecipients(a);}catch(j){return c?.['push']('R-RECIPIENT-03\x20recipient\x20gate\x20failed\x20(non-blocking):\x20'+(j instanceof Error?j['message']:String(j))),null;}if(d['length']===0x0)return null;const f=d['filter'](k=>k['severity']==='critical'),g=d['filter'](k=>k['severity']!=='critical');for(const k of g){c?.['push'](formatEntityRecipientViolation(k)+'\x20—\x20fix\x20before\x20committing\x20this\x20allocator\x20table.');}if(f['length']===0x0)return null;const h='⛔\x20OPERATION\x20BLOCKED\x20—\x20'+b+'\x20violates\x20'+ENTITY_RECIPIENT_RULE_ID+'\x20'+'(direct-sales\x20Entity\x20recipient\x20rule).\x0a\x0a'+f['map'](l=>'\x20\x20•\x20'+formatEntityRecipientViolation(l))['join']('\x0a')+(g['length']>0x0?'\x0a\x0aAlso\x20reported\x20(non-blocking):\x0a'+g['map'](l=>'\x20\x20•\x20'+formatEntityRecipientViolation(l))['join']('\x0a'):'')+('\x0a\x0a'+describeEntityRecipients(f)+'\x0a\x0a')+'order_allocators\x20is\x20PERMANENTLY\x20IMMUTABLE\x20after\x20publish\x20(no\x20pause+lock\x20escape)\x20—\x20'+'an\x20empty\x20Entity\x20recipient\x20published\x20now\x20silently\x20pays\x20the\x20builder\x20forever.\x20Fix\x20the\x20'+'recipient\x20table\x20and\x20re-issue\x20this\x20operation.\x20This\x20call\x20was\x20NOT\x20executed\x20and\x20no\x20on-chain\x20'+'action\x20was\x20taken.';return{'content':[{'type':'text','text':h}],'structuredContent':{'result':{'type':'error','error':f['map'](l=>l['rule_id']+'\x20allocator['+l['allocator_index']+'].sharing['+l['sharing_index']+']:\x20'+l['reason'])['join']('\x20|\x20'),'error_code':'entity_recipient_invalid','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':describeEntityRecipients(f)},'message':'Operation\x20blocked\x20by\x20'+ENTITY_RECIPIENT_RULE_ID+':\x20an\x20Entity\x20recipient\x20is\x20empty,\x20omitted,\x20or\x20resolves\x20to\x20the\x20deploying\x20account.'}};}function warnAmountEscrowDeadlock(a,b,c){try{const d=Array['isArray'](a?.['allocators'])?a['allocators']:[],e=d['map'](k=>(Array['isArray'](k?.['sharing'])?k['sharing']:[])['filter'](l=>l?.['mode']==='Amount')['reduce']((l,m)=>l+(Number(m?.['sharing']?.['balance'])||0x0),0x0)),f=e['some'](k=>k>0x0);if(!f)return;const g=Array['isArray'](b?.['sales'])?b['sales']:[],h=g['map'](k=>Number(k?.['price']?.['balance']))['filter'](k=>Number['isFinite'](k)&&k>0x0);if(h['length']===0x0)return;const j=h['reduce']((k,l)=>k+l,0x0);for(let k=0x0;k<e['length'];k++){e[k]>j&&c['push']('FIXED-AMOUNT\x20DEADLOCK\x20RISK\x20(advisory):\x20Allocator['+k+']\x20Amount\x20sum='+e[k]+'\x20exceeds\x20the\x20'+('minimum\x20single-order\x20escrow\x20Σ(price×1)='+j+'\x20(sales\x20configured\x20in\x20this\x20call;\x20quantity\x20fixed\x20at\x20buy\x20time).\x20')+'An\x20order\x20smaller\x20than\x20the\x20Amount\x20aborts\x20alloc()\x20with\x20Insufficient\x20balance\x20—\x20if\x20this\x20allocator\x20is\x20the\x20only\x20'+'match\x20on\x20a\x20terminal\x20forward,\x20that\x20order\x27s\x20balance\x20is\x20permanently\x20stranded.\x20Use\x20Rate\x20sharing\x20for\x20'+'penalty/proportional\x20rules\x20(scales\x20with\x20the\x20order),\x20or\x20bound\x20the\x20Amount\x20below\x20the\x20smallest\x20expected\x20order.');}}catch{}}async function checkArbitrationsBeforePublish(a,b,c){if(!Array['isArray'](a)||a['length']===0x0)return null;const d=await resolveNetwork(b?.['network']),e=[],f=[],g=[],h=[];for(const j of a){let k;if(typeof j==='string')k=j['startsWith']('0x')?j:await LocalMark['Instance']()['get_address'](j)['catch'](()=>undefined)??undefined;else{if(j&&typeof j==='object'){const l=j['name']??j['object']??j['address'];typeof l==='string'&&(k=l['startsWith']('0x')?l:await LocalMark['Instance']()['get_address'](l)['catch'](()=>undefined)??undefined);}}if(!k){g['push'](typeof j==='string'?j:JSON['stringify'](j));continue;}try{const m=await query_objects({'objects':[k],'network':d,'no_cache':!![]}),n=m?.['objects']?.[0x0];if(!n||n['type']!=='Arbitration'){g['push'](k);continue;}const o=n['data']??n;if(o['bPaused']===!![])e['push'](k);const p=Array['isArray'](o['voting_guard'])?o['voting_guard']['length']:0x0;if(p===0x0)f['push'](k);const t=typeof o['permission']==='string'?o['permission']:undefined;if(t){const u=await query_objects({'objects':[t],'network':d,'no_cache':!![]}),v=u?.['objects']?.[0x0],w=v?.['data']??v,x=Array['isArray'](w?.['admin'])?w['admin']:[],y=await fetchEntityPermissions(t,d);y['size']===0x0&&h['push'](k+'\x20(admin:\x20'+(x['length']>0x0?x['join'](',\x20'):'unresolved')+')');}}catch{g['push'](k);}}g['length']>0x0&&c['push']('PRE-PUBLISH:\x20Could\x20not\x20resolve/query\x20bound\x20Arbitration(s)\x20['+g['join'](',\x20')+']\x20—\x20'+'verify\x20each\x20is\x20UNPAUSED\x20(new\x20Arbitrations\x20default\x20to\x20bPaused=true;\x20disputes\x20abort\x20with\x20E_PAUSED)\x20'+'and\x20that\x20voting\x20can\x20actually\x20happen:\x20an\x20empty\x20voting_guard\x20means\x20EQUAL\x20vote\x20weight\x20(1\x20person\x201\x20vote),\x20'+'but\x20plain\x20voting\x20still\x20asserts\x20permission\x20358\x20—\x20only\x20the\x20arbitration\x27s\x20bound\x20Permission\x20admin\x20'+'(its\x20creator,\x20by\x20default)\x20and\x20explicit\x20358\x20grantees\x20can\x20vote,\x20so\x20grant\x20358\x20to\x20the\x20disputing\x20'+'parties\x20or\x20configure\x20a\x20voting_guard\x20before\x20relying\x20on\x20a\x20working\x20vote.');f['length']>0x0&&c['push']('C7\x20RISK\x20(concentrated\x20voting):\x20Arbitration(s)\x20['+f['join'](',\x20')+']\x20have\x20an\x20EMPTY\x20voting_guard\x20—\x20'+'this\x20means\x20EQUAL\x20vote\x20weight\x20(1\x20person\x201\x20vote),\x20NOT\x20permissionless.\x20Plain\x20voting\x20asserts\x20'+'permission\x20358\x20on\x20the\x20arbitration\x27s\x20bound\x20Permission,\x20whose\x20admin\x20ALWAYS\x20passes\x20the\x20assert\x20'+'(a\x20fresh\x20Permission\x20seeds\x20its\x20creator\x20as\x20the\x20sole\x20admin;\x20the\x20permission\x20table\x20itself\x20starts\x20empty).\x20'+'So\x20without\x20explicit\x20grants\x20the\x20disputing\x20CUSTOMER\x20can\x20never\x20vote\x20(aborts\x20with\x20code\x205)\x20and\x20every\x20'+'dispute\x20devolves\x20to\x20admin-only\x20voting\x20—\x20the\x20arb\x20admin\x20is\x20both\x20the\x20only\x20voter\x20AND\x20the\x20judge.\x20The\x20'+'service\x20publish\x20gate\x20blocks\x20this\x20shape\x20outright\x20(R-ARB-VOTE-LOCK)\x20when\x20the\x20arb\x20admin\x20also\x20controls\x20'+'the\x20service\x20side;\x20this\x20warning\x20covers\x20the\x20general\x20case.\x20Fix:\x20'+'(1)\x20grant\x20permission\x20358\x20to\x20each\x20disputing\x20party\x20(equal-weight\x20vote\x20among\x20the\x20granted\x20parties),\x20'+'and\x20grant\x20the\x20non-admin\x20operator\x20slots\x20separately\x20—\x20359\x20(ruling)\x20+\x20361\x20(confirm\x20materials)\x20to\x20an\x20'+'EXTERNAL\x20arbitrator,\x20356/357/362-366\x20to\x20any\x20non-admin\x20manager\x20(the\x20creator-admin\x20needs\x20no\x20grants);\x20'+'or\x20(2)\x20for\x20weighted\x20voting,\x20set\x20voting_guard\x20via\x20arbitration\x20voting_guard\x20op=\x22add\x22\x20with\x20'+'a\x20verifier\x20Guard\x20+\x20vote_weight\x20(GuardIdentifier\x20for\x20submitted\x20weights,\x20or\x20FixedValue)\x20—\x20weighted\x20'+'voters\x20then\x20call\x20vote\x20WITH\x20data.vote.voting_guard\x20(plain\x20vote\x20aborts\x20E_VOTING_GUARD_USED\x20once\x20a\x20'+'voting_guard\x20exists;\x20the\x20weighted\x20path\x20authorizes\x20via\x20the\x20guard\x20and\x20does\x20NOT\x20require\x20358).');h['length']>0x0&&c['push']('ADJUDICABILITY\x20RISK\x20(F-34,\x20nnd-tn-261025):\x20bound\x20Arbitration(s)\x20['+h['join'](',\x20')+']\x20hold\x20'+'ZERO\x20adjudication\x20entities\x20on\x20their\x20Permission\x20—\x20the\x20entity\x20table\x20is\x20empty,\x20so\x20NOBODY\x20except\x20the\x20'+'admin\x20can\x20confirm\x20materials,\x20vote,\x20or\x20rule.\x20Disputes\x20can\x20still\x20be\x20FILED\x20(the\x20fee\x20escrows),\x20but\x20'+'there\x20is\x20no\x20on-chain\x20timeout\x20fallback:\x20with\x20an\x20unreachable\x20admin\x20a\x20case\x20stalls\x20forever\x20and\x20the\x20'+'escrowed\x20fee\x20is\x20stranded\x20(nnd-arb\x20live\x20case:\x20a\x20case\x20was\x20filed\x20and\x20paid,\x20no\x20ruling\x20was\x20ever\x20'+'possible).\x20Remedy\x20BEFORE\x20relying\x20on\x20disputes:\x20if\x20the\x20admin\x20account\x20is\x20yours,\x20grant\x20at\x20least\x20one\x20'+'adjudication\x20entity\x20(permission\x20add\x20perm\x20on\x20the\x20arb\x27s\x20Permission:\x20358\x20vote\x20/\x20359\x20ruling\x20/\x20'+'361\x20confirm\x20materials);\x20if\x20the\x20admin\x20is\x20an\x20external\x20third\x20party,\x20confirm\x20they\x20have\x20configured\x20'+'their\x20entity\x20table\x20—\x20otherwise\x20bind\x20an\x20adjudicable\x20arbitration\x20instead.\x20Entities\x20can\x20also\x20be\x20'+'granted\x20after\x20publish,\x20so\x20this\x20is\x20a\x20disclosure,\x20not\x20a\x20blocker\x20—\x20but\x20publishing\x20a\x20Service\x20whose\x20'+'only\x20dispute\x20path\x20is\x20a\x20dead\x20arbitration\x20is\x20a\x20commercial\x20hole\x20buyers\x20inherit.');if(e['length']>0x0){const z='⛔\x20SERVICE\x20PUBLISH\x20BLOCKED\x20—\x20bound\x20Arbitration(s)\x20['+e['join'](',\x20')+']\x20are\x20PAUSED.\x0a\x0a'+'A\x20newly\x20created\x20Arbitration\x20defaults\x20to\x20bPaused=true;\x20while\x20paused,\x20EVERY\x20dispute\x20filing\x20aborts\x20'+'with\x20E_PAUSED\x20—\x20the\x20arbitration\x20mounted\x20on\x20this\x20Service\x20would\x20be\x20decorative\x20(buyers\x20have\x20no\x20'+'working\x20dispute\x20path,\x20and\x20compensation_fund\x20payouts\x20could\x20never\x20be\x20triggered).\x20The\x20on-chain\x20'+'publish\x20check\x20only\x20verifies\x20the\x20arbitrations\x20list\x20is\x20non-empty,\x20NOT\x20that\x20each\x20Arbitration\x20is\x20'+'active\x20—\x20this\x20scan\x20closes\x20that\x20gap.\x0a'+'Fix:\x20issue\x20{operation_type:\x27arbitration\x27,\x20data:{object:\x27<arb>\x27,\x20pause:false}}\x20for\x20each\x20paused\x20'+'Arbitration\x20above,\x20then\x20retry\x20publish=true.\x20This\x20call\x20was\x20NOT\x20executed\x20and\x20no\x20on-chain\x20action\x20was\x20taken.';return{'content':[{'type':'text','text':z}],'structuredContent':{'result':{'type':'error','error':'arbitration_paused:\x20'+e['join'](',\x20'),'error_code':'arbitrations_paused','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':JSON['stringify']({'paused':e,'unpaused_hint':'arbitration\x20data:{object,\x20pause:false}'})},'message':'Service\x20publish\x20blocked:\x20bound\x20Arbitration(s)\x20are\x20paused.'}};}return null;}async function checkRefundRecipientSatisfiability(a,b,c){if(!a||typeof a!=='object')return null;const d=Array['isArray'](a?.['allocators'])?a['allocators']:[],e=[];for(let l=0x0;l<d['length'];l++){const m=Array['isArray'](d[l]?.['sharing'])?d[l]['sharing']:[],n=d[l]?.['guard'];if(typeof n!=='string'||n['length']===0x0)continue;for(const o of m){const p=o?.['who'];p&&typeof p==='object'&&'GuardIdentifier'in p&&e['push']({'allocIdx':l,'guardRef':n,'identifier':p['GuardIdentifier']});}}if(e['length']===0x0)return null;const f=await resolveNetwork(b?.['network']),g=[],h=[],j=new Map();for(const r of e){try{let u=j['get'](r['guardRef']);if(u===undefined){let w=r['guardRef'];!w['startsWith']('0x')&&(w=await LocalMark['Instance']()['get_address'](w)['catch'](()=>undefined)??'');if(!w['startsWith']('0x')){h['push'](r['guardRef']);continue;}const x=await query_objects({'objects':[w],'network':f,'no_cache':!![]}),y=x?.['objects']?.[0x0];if(!y||y['type']!=='Guard'){h['push'](r['guardRef']);continue;}u=y['data']??y,j['set'](r['guardRef'],u);}const v=Array['isArray'](u['table'])?u['table']['find'](z=>z?.['identifier']===r['identifier']):undefined;if(!v||v['b_submission']!==!![])continue;pinsIdentifierToSigner(u['root'],r['identifier'])&&g['push']('Allocator['+r['allocIdx']+']\x20guard\x20'+r['guardRef']+'\x20pins\x20recipient\x20identifier\x20'+r['identifier']+'\x20to\x20context(Signer)');}catch{h['push'](r['guardRef']);}}h['length']>0x0&&c['push']('PRE-PUBLISH:\x20could\x20not\x20fetch\x20Guard(s)\x20['+h['join'](',\x20')+']\x20referenced\x20by\x20GuardIdentifier\x20'+'recipient\x20rows\x20—\x20manually\x20verify\x20each\x20refund\x20guard\x20does\x20NOT\x20pin\x20its\x20recipient\x20identifier\x20to\x20'+'context(Signer)\x20(unsatisfiable\x20against\x20the\x20order-anchored\x20escrow:\x20the\x20submission\x20must\x20equal\x20the\x20'+'Order\x20address,\x20never\x20the\x20signer\x20EOA).');if(g['length']===0x0)return null;const k='⛔\x20SERVICE\x20PUBLISH\x20BLOCKED\x20—\x20refund\x20recipient\x20unsatisfiable\x20(GuardIdentifier\x20x\x20for_object\x20x\x20Guard\x20equality).\x0a\x0a'+g['map'](z=>'\x20\x20•\x20'+z)['join']('\x0a')+'\x0a\x0aThe\x20framework-created\x20order\x20escrow\x20anchors\x20PaymentInfo.for_object\x20to\x20the\x20ORDER\x20object\x20address\x20and\x20'+'the\x20chain\x20asserts\x20every\x20GuardIdentifier\x20recipient\x20submission\x20==\x20that\x20address\x20(ERECIPIENT_NOT_FOR_OBJECT,\x20'+'code\x2015).\x20The\x20guard(s)\x20above\x20ALSO\x20require\x20the\x20same\x20submitted\x20value\x20==\x20context(Signer)\x20—\x20an\x20Order\x20address\x20'+'is\x20never\x20the\x20signer\x20EOA,\x20so\x20the\x20allocator\x20can\x20NEVER\x20execute\x20and\x20order\x20funds\x20strand\x20permanently\x20'+'(order_allocators\x20is\x20immutable\x20after\x20publish;\x20test/10\x20T10-10/T10-18\x20stranded\x200.79\x20WOW\x20this\x20way).\x0a'+'Fix\x20(verified\x20ORDER\x20PATTERN,\x20test/10\x20T10-17):\x20keep\x20the\x20recipient\x20GuardIdentifier(n)\x20as-is,\x20and\x20in\x20the\x20'+'GUARD\x20replace\x20logic_equal(context(Signer),\x20identifier[n])\x20with\x20an\x20ORDER\x20FIELD\x20query\x20binding\x20—\x20'+'logic_equal(order.owner,\x20context(Signer))\x20—\x20then\x20submit\x20the\x20ORDER\x20ADDRESS\x20for\x20identifier\x20n.\x20Funds\x20land\x20'+'in\x20the\x20Order\x20object\x20and\x20the\x20buyer\x20withdraws\x20via\x20order\x20receive:\x27recently\x27.\x0a'+'This\x20call\x20was\x20NOT\x20executed\x20and\x20no\x20on-chain\x20action\x20was\x20taken.';return{'content':[{'type':'text','text':k}],'structuredContent':{'result':{'type':'error','error':'refund_recipient_unsatisfiable:\x20'+g['join'](';\x20'),'error_code':'refund_recipient_unsatisfiable','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Rebuild\x20the\x20refund\x20Guard\x20with\x20order.owner==context(Signer)\x20identity\x20binding\x20and\x20submit\x20the\x20Order\x20address\x20for\x20the\x20recipient\x20identifier;\x20then\x20re-issue\x20service\x20publish'},'message':'Service\x20publish\x20blocked:\x20refund\x20recipient\x20guard\x20contradicts\x20the\x20order-anchored\x20escrow\x20binding.'}};}function pinsIdentifierToSigner(a,b){const c=f=>f?.['type']==='context'&&f?.['context']==='Signer',d=f=>f?.['type']==='identifier'&&f?.['identifier']===b,e=f=>{if(!f||typeof f!=='object')return![];if(f['type']==='logic_equal'||f['type']==='logic_as_u256_equal'){const g=Array['isArray'](f['nodes'])?f['nodes']:[];for(let h=0x0;h<g['length'];h++){for(let k=h+0x1;k<g['length'];k++){if(c(g[h])&&d(g[k]))return!![];if(d(g[h])&&c(g[k]))return!![];}}}if(Array['isArray'](f['nodes'])&&f['nodes']['some'](e))return!![];if(f['node']&&e(f['node']))return!![];if(Array['isArray'](f['parameters'])&&f['parameters']['some'](e))return!![];return![];};return e(a);}function describeArbitrationPayload(a){if(Array['isArray'](a))return a['length']+'\x20item(s)';if(a&&typeof a==='object'&&Array['isArray'](a['objects']))return a['objects']['length']+'\x20item(s)';return'<none>';}function canonicalRecipientKey(a){if(typeof a==='string')return a;const b=classifyRecipient(a);if(b?.['kind']==='entity')return'Entity:'+b['address'];if(b?.['kind']==='signer')return'Signer';if(b?.['kind']==='submission')return'GuardIdentifier:'+b['identifier'];return a!=null?JSON['stringify'](a):undefined;}function normHexAddr(b){return b['toLowerCase']()['replace'](/^0x/,'')['padStart'](0x40,'0');}async function describeAllocatorsNotExtensionDiff(a,b,c){try{if(!a||typeof a!=='object')return undefined;const d=a['object']??a['name'],e=typeof d==='string'?/^0x[0-9a-fA-F]{1,64}$/['test'](d)?d:await LocalMark['Instance']()['get_address'](d):undefined;if(!e)return undefined;const f=b,g=Array['isArray'](f?.['allocators'])?f['allocators']:null;if(!g)return undefined;const h=await query_objects({'objects':[e],'network':c}),k=(h?.['objects']??[])['find'](r=>r?.['object']===e),m=k?.['order_allocators'],n=Array['isArray'](m?.['allocators'])?m['allocators']:null;if(!n)return undefined;const o=[],p=readRawOnchainAmount(m?.['threshold']),q=readRawOnchainAmount(f?.['threshold']);p!==undefined&&q!==undefined&&p!==q&&o['push']('threshold\x20mismatch:\x20submitted\x20'+q+'\x20vs\x20live\x20'+p+'\x20(append\x20requires\x20the\x20SAME\x20threshold)');g['length']<n['length']&&o['push']('length\x20mismatch:\x20submitted\x20'+g['length']+'\x20rail(s)\x20vs\x20live\x20'+n['length']+'\x20(append\x20requires\x20length-or-longer\x20with\x20the\x20live\x20prefix\x20preserved)');if(o['length']===0x0){const r=Math['min'](g['length'],n['length']);for(let t=0x0;t<r&&o['length']===0x0;t++){const u=g[t],v=n[t],w=typeof u?.['guard']==='string'?u['guard']:undefined,x=typeof v?.['guard']==='string'?v['guard']:undefined;if(w&&x&&normHexAddr(w)!==normHexAddr(x)){o['push']('rail\x20'+t+'\x20guard\x20rewritten:\x20submitted\x20'+w+'\x20vs\x20live\x20'+x+'\x20(existing\x20allocators\x20must\x20be\x20preserved\x20verbatim\x20as\x20a\x20prefix)');break;}const y=Array['isArray'](u?.['sharing'])?u['sharing']:[],z=Array['isArray'](v?.['sharing'])?v['sharing']:[];if(y['length']!==z['length']){o['push']('rail\x20'+t+'\x20sharing\x20rows:\x20submitted\x20'+y['length']+'\x20vs\x20live\x20'+z['length']);break;}for(let A=0x0;A<Math['min'](y['length'],z['length'])&&o['length']===0x0;A++){const B=canonicalRecipientKey(y[A]?.['who']),C=canonicalRecipientKey(z[A]?.['who']);if(B&&C&&B!==C){o['push']('rail\x20'+t+'\x20row\x20'+A+'\x20recipient\x20rewritten:\x20submitted\x20'+B+'\x20vs\x20live\x20'+C);break;}const D=readRawOnchainAmount(y[A]?.['sharing']),E=readRawOnchainAmount(z[A]?.['sharing']);if(D!==undefined&&E!==undefined&&D!==E){o['push']('rail\x20'+t+'\x20row\x20'+A+'\x20share\x20rewritten:\x20submitted\x20'+D+'\x20vs\x20live\x20'+E);break;}}}}return o['length']===0x0&&o['push']('no\x20field-level\x20divergence\x20found\x20against\x20the\x20live\x20plan\x20—\x20rebuild\x20the\x20payload\x20from\x20the\x20LIVE\x20plan\x20(query_toolkit\x20service_panorama\x20→\x20result.service.order_allocators,\x20authoring\x20form)\x20and\x20re-submit'),'APPEND\x20REJECTED\x20(EALLOCATORS_NOT_EXTENSION):\x20the\x20submitted\x20plan\x20is\x20NOT\x20a\x20pure\x20extension\x20of\x20the\x20live\x20order_allocators.\x20First\x20divergence:\x20'+o['join'](';\x20')+'.\x20'+'Append\x20shape:\x20same\x20threshold,\x20length-or-longer,\x20every\x20existing\x20allocator\x20preserved\x20verbatim\x20as\x20a\x20prefix,\x20new\x20rails\x20appended\x20after.';}catch{return undefined;}}function readRawOnchainAmount(a){if(typeof a==='number'&&Number['isFinite'](a))return a;if(typeof a==='string'&&/^\d+$/['test'](a['trim']()))return Number(a['trim']());if(a&&typeof a==='object')for(const b of['value','balance','amount']){const c=a[b];if(typeof c==='number'&&Number['isFinite'](c))return c;if(typeof c==='string'&&/^\d+$/['test'](c['trim']()))return Number(c['trim']());}return undefined;}async function expandBareReceiveIds(a,b){const c=a?.['data'];if(!c||typeof c!=='object')return;const d=['receive','owner_receive'],e=[],f=[];for(const l of d){const m=c[l];typeof m==='string'&&/^0x[0-9a-fA-F]{8,}$/['test'](m)&&(e['push'](m),f['push']({'field':l}));}if(e['length']===0x0)return;const g=b??undefined,h=await Config['Instance']()['network_get'](g),j=new WowClient({'url':getFullnodeUrl(h),'network':h}),{objects:k}=await j['core']['getObjects']({'objectIds':e,'include':{'json':!![]}});for(let n=0x0;n<e['length'];n++){const p=f[n]['field'],q=k[n];if(!q||typeof q!=='object'||!q?.['objectId']||!q?.['type'])throw new Error('receive:\x20bare\x20object\x20id\x20\x27'+e[n]+'\x27\x20(field\x20\x27'+p+'\x27)\x20could\x20not\x20be\x20resolved\x20'+('on\x20'+h+'\x20—\x20pass\x20the\x20full\x20received\x20record\x20({id,\x20type,\x20version,\x20digest}),\x20')+'or\x20\x27recently\x27\x20to\x20sweep\x20everything\x20the\x20object\x20received.');c[p]=[{'id':String(q['objectId']),'type':String(q['type']),'content_raw':q['json']??undefined,'version':q['version']!=null?String(q['version']):undefined,'digest':q['digest']!=null?String(q['digest']):undefined}];}}export async function deriveTotalPayIfOmitted(a,b){const c=a?.['order_new']?.['buy'];if(!c)return undefined;if(c['total_pay']!=null){if(c['discount']!=null)return undefined;const e=await catalogTotalWalk(c,a,b)['catch'](()=>null);if(e===null||'error'in e)return undefined;const f=parseTotalPayRaw(c);if(f===undefined||f===e['total'])return undefined;const g=f>e['total']?f-e['total']:e['total']-f;return'total_pay\x20OVERRIDE:\x20explicit\x20'+f+'\x20replaces\x20the\x20catalog\x20derivation\x20'+('Σ\x20price×quantity\x20=\x20'+e['total']+'\x20('+e['lines']['join']('\x20+\x20')+')\x20—\x20drift\x20'+g+'\x20')+(f>e['total']?'ABOVE\x20the\x20catalog\x20total;\x20the\x20excess\x20escrows\x20with\x20the\x20order.\x20Confirm\x20this\x20is\x20intended.':'BELOW\x20the\x20catalog\x20total\x20—\x20without\x20a\x20discount\x20the\x20on-chain\x20quote\x20rejects\x20underpayment\x20(the\x20buy\x20aborts).');}if(c['discount']!=null)throw new Error('buy.total_pay\x20is\x20REQUIRED\x20when\x20a\x20discount\x20is\x20applied\x20—\x20the\x20discounted\x20final\x20total\x20depends\x20on\x20the\x20'+'coupon\x27s\x20live\x20value\x20and\x20must\x20be\x20stated\x20explicitly.\x20Run\x20query_toolkit\x20query_type=\x27service_quote\x27\x20'+'and\x20pass\x20total_pay.balance\x20=\x20the\x20quoted\x20final_total.');const d=await catalogTotalWalk(c,a,b);if('error'in d)throw new Error(d['error']);return c['total_pay']={'balance':d['total']['toString']()},'total_pay\x20auto-derived\x20=\x20'+d['total']['toString']()+'\x20(smallest\x20unit;\x20Σ\x20price×quantity:\x20'+d['lines']['join']('\x20+\x20')+';\x20'+'no\x20discount).\x20Pass\x20total_pay\x20explicitly\x20to\x20pin\x20the\x20amount\x20—\x20REQUIRED\x20when\x20using\x20a\x20discount.';}async function catalogTotalWalk(a,b,c){const d=Array['isArray'](a['items'])?a['items']:[];if(d['length']===0x0)return{'error':'buy.total_pay\x20is\x20omitted\x20and\x20the\x20cart\x20has\x20NO\x20items\x20—\x20there\x20is\x20nothing\x20to\x20derive\x20the\x20payment\x20from'};const e=b?.['object'];if(typeof e!=='string'||e['length']===0x0)return{'error':'buy.total_pay\x20is\x20omitted\x20but\x20the\x20Service\x20reference\x20(data.object)\x20is\x20missing\x20—\x20cannot\x20derive\x20the\x20payment'};const f=e['startsWith']('0x')?e:await LocalMark['Instance']()['get_address'](e)??undefined;if(!f)return{'error':'Service\x20\x27'+e+'\x27\x20could\x20not\x20be\x20resolved\x20—\x20cannot\x20derive\x20total_pay'};const g=await query_serviceContext({'service':f,'network':c}),h=g?.['service'];if(!h)return{'error':'Service\x20\x27'+e+'\x27\x20not\x20found\x20—\x20cannot\x20derive\x20total_pay'};const j=Array['isArray'](h['sales'])?h['sales']:[];let k=0x0n;const l=[];for(const m of d){const n=m?.['name'],o=j['find'](r=>r?.['name']===n);if(!o)return{'error':'cannot\x20derive\x20total_pay:\x20item\x20\x27'+n+'\x27\x20matches\x20NO\x20sale\x20on\x20service\x20\x27'+e+'\x27\x20'+('(available:\x20'+(j['map'](r=>r?.['name'])['filter'](Boolean)['join'](',\x20')||'<none>')+')')};if(o?.['suspension']===!![])return{'error':'cannot\x20derive\x20total_pay:\x20item\x20\x27'+n+'\x27\x20is\x20suspended\x20on\x20service\x20\x27'+e+'\x27'};const p=BigInt(String(o?.['price']?.['balance']??o?.['price']??'0')),q=BigInt(String(m?.['quantity']??m?.['stock']??'1'));if(q<=0x0n)return{'error':'cannot\x20derive\x20total_pay:\x20item\x20\x27'+n+'\x27\x20has\x20non-positive\x20quantity\x20'+q};k+=p*q,l['push'](n+'\x20x'+q+'\x20@\x20'+p);}if(k<=0x0n)return{'error':'derived\x20total_pay\x20would\x20be\x200\x20(all\x20matched\x20sales\x20priced\x200)\x20—\x20pass\x20total_pay\x20explicitly'};return{'total':k,'lines':l};}async function probeOrderNewWipReachability(a,b){const c=a?.['order_new']?.['buy'],d=Array['isArray'](c?.['items'])?c['items']:[];if(d['length']===0x0)return null;const e=a?.['object'];if(typeof e!=='string'||e['length']===0x0)return null;try{const f=e['startsWith']('0x')?e:await LocalMark['Instance']()['get_address'](e)??undefined;if(!f)return null;const g=await query_serviceContext({'service':f,'network':b}),h=Array['isArray'](g?.['service']?.['sales'])?g['service']['sales']:[],j=new Map();for(const k of d){const l=h['find'](p=>p?.['name']===k?.['name']),m=typeof l?.['wip']==='string'?l['wip']:'';if(!m)continue;const n=classifyWipPath(m),o=!n['is_local']&&n['is_network']&&(n['type']==='http_url'||n['type']==='ipfs'&&/^https?:/i['test'](m));if(o)j['set'](String(l['name']??k?.['name']??''),m);}for(const [p,q]of j){const r=await probeWipReachability(q)['catch'](()=>({'ok':![],'reason':'probe\x20failed'}));if(r['ok'])continue;const t=r['status']?'HTTP\x20'+r['status']:r['reason']??'unreachable',u='⛔\x20WIP\x20HOST\x20UNREACHABLE\x20—\x20order\x20NOT\x20created\x20(no\x20money\x20moved)\x0a\x0a'+('The\x20WIP\x20file\x20for\x20sale\x20\x22'+p+'\x22\x20('+q+')\x20is\x20not\x20reachable\x20('+t+').\x20')+'Creating\x20this\x20order\x20would\x20abort\x20100%\x20inside\x20the\x20WIP\x20verification\x20step\x20(F-27:\x20'+'WIP\x20single-host\x20outage\x20—\x20when\x20the\x20host\x20is\x20down,\x20NOBODY\x20can\x20buy\x20from\x20this\x20Service).\x0a\x0a'+'This\x20is\x20NOT\x20a\x20wrong-network\x20problem\x20—\x20do\x20NOT\x20switch\x20networks\x20and\x20do\x20NOT\x20retry\x20blindly.\x0a\x0a'+'Fix:\x0a'+'\x20\x20•\x20Transient\x20outage:\x20retry\x20this\x20order\x20after\x20the\x20host\x20recovers.\x0a'+'\x20\x20•\x20Otherwise:\x20the\x20MERCHANT\x20must\x20redeploy\x20the\x20.wip\x20file\x20to\x20another\x20public\x20endpoint\x20'+'and\x20update\x20sale.wip\x20+\x20wip_hash\x20(GitHub\x20Pages\x20/\x20IPFS\x20/\x20their\x20own\x20site,\x20or\x20wip_file\x20'+'type=\x27upload\x27\x20for\x20the\x20official\x20store).\x0a'+'\x20\x20•\x20Testing\x20only:\x20the\x20merchant\x20can\x20set\x20sale.wip\x20=\x20\x22\x22\x20(empty)\x20to\x20skip\x20WIP\x20verification.';return{'content':[{'type':'text','text':u}],'structuredContent':{'result':{'type':'error','error':'Sale\x20\x22'+p+'\x22\x20wip\x20host\x20unreachable\x20('+t+'):\x20'+q+'.\x20order_new\x20would\x20abort\x20100%\x20in\x20WIP\x20verification\x20(F-27).\x20Not\x20a\x20wrong-network\x20problem.','error_code':'wip_host_unreachable','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Retry\x20after\x20the\x20host\x20recovers\x20(transient\x20outage),\x20or\x20have\x20the\x20merchant\x20redeploy\x20'+'the\x20.wip\x20file\x20to\x20another\x20public\x20endpoint\x20and\x20update\x20sale.wip\x20+\x20wip_hash.\x20'+'Do\x20NOT\x20switch\x20networks.','related_object':p},'message':'WIP\x20host\x20unreachable\x20—\x20order\x20not\x20created.\x20See\x20recovery_hint.'}};}return null;}catch{return null;}}export async function warnOrderNewFundCoverage(a,b){const c=a?.['order_new']?.['buy'];if(!c)return null;const d=parseTotalPayRaw(c);if(d===undefined)return null;if(d<=0x0n)return null;const e=a?.['object'];if(typeof e!=='string'||e['length']===0x0)return null;try{const f=e['startsWith']('0x')?e:await LocalMark['Instance']()['get_address'](e)??undefined;if(!f)return null;const g=await query_serviceContext({'service':f,'network':b}),h=g?.['service'];if(!h)return null;const j=r=>{if(typeof r==='number'&&Number['isFinite'](r)&&r>=0x0)return BigInt(Math['trunc'](r));if(typeof r==='string'&&/^\d+$/['test'](r['trim']()))return BigInt(r['trim']());if(typeof r==='object'&&r!==null){const t=r?.['balance'];if(typeof t==='string'&&/^\d+$/['test'](t['trim']()))return BigInt(t['trim']());}return undefined;},k=j(h?.['compensation_fund']);if(k===undefined||k<=0x0n)return null;const l=0x3n,m=l*d;if(k>=m)return null;const n=(String(h?.['type']??h?.['type_raw']??'')['match'](/<(.+)>$/)??[])[0x1]??'',o=async r=>{try{return n?(await formatChainValue(r,n,b))['display']:r['toString']();}catch{return r['toString']();}},p=k/l,q=m-k;return'FUND\x20COVERAGE\x20WARNING\x20(compensation_fund_below_order_ceiling)\x20—\x20the\x20buy\x20PROCEEDS,\x20'+'but\x20this\x20Service\x27s\x20compensation\x20pool\x20cannot\x20cover\x20a\x20maximum\x20award\x20on\x20this\x20order.\x0a'+('compensation_fund\x20holds\x20'+await o(k)+'\x20(raw\x20'+k+');\x20the\x20payout\x20requirement\x20for\x20THIS\x20')+('order\x20is\x203x\x20'+await o(d)+'\x20=\x20'+await o(m)+'\x20(raw\x20'+m+')\x20—\x20shortfall\x20')+(await o(q)+'\x20(raw\x20'+q+').\x20Consequence\x20if\x20a\x20ruling\x20awards\x20at\x20the\x20cap:\x20settlement\x20')+'is\x20ALL-OR-NOTHING\x20—\x20the\x20claim\x20aborts\x20with\x20code\x2027\x20(E_COMPENSATION_NOT_MATCH),\x20nothing\x20is\x20paid,\x20'+'the\x20claim\x20is\x20NOT\x20consumed,\x20and\x20the\x20winner\x20retries\x20after\x20the\x20merchant\x20tops\x20up.\x20Standing\x20storefront\x20'+('ceiling:\x20at\x20the\x20current\x20fund\x20the\x20largest\x20fully-covered\x20order\x20amount\x20is\x20'+await o(p)+'\x20')+('(raw\x20'+p+',\x20fund/3).\x0a')+('Fix\x20(merchant):\x20service.compensation_fund_add\x20by\x20'+await o(q)+'\x20to\x20fully\x20cover\x20this\x20')+'basket.\x20Alternative\x20(merchant):\x20run\x20WITHOUT\x20pool\x20protection\x20via\x20service.compensation_fund_withdraw\x20—\x20'+'allowed,\x20but\x20it\x20must\x20be\x20a\x20decision,\x20not\x20an\x20accident.';}catch{return null;}}export async function warnBuyCustomerRequiredSelfAttested(a,b){if(!a?.['order_new']?.['buy'])return null;const c=a?.['object'];if(typeof c!=='string'||c['length']===0x0)return null;try{const d=c['startsWith']('0x')?c:await LocalMark['Instance']()['get_address'](c)??undefined;if(!d)return null;const e=await query_serviceContext({'service':d,'network':b}),f=e?.['service']?.['customer_required'];if(!Array['isArray'](f))return null;const g=f['filter'](h=>typeof h==='string'&&h['trim']()!=='');if(g['length']===0x0)return null;return'CUSTOMER\x20INFO\x20REQUEST\x20—\x20SELF-ATTESTED\x20(buyer\x20disclosure):\x20this\x20service\x20declares\x20customer_required\x20'+('and\x20asks\x20you\x20to\x20provide:\x20'+g['join'](',\x20')+'.\x20The\x20chain\x20stores\x20the\x20buyer\x27s\x20claim\x20verbatim\x20and\x20')+'nothing\x20verifies\x20it\x20—\x20the\x20bind\x20path\x20only\x20proves\x20the\x20claim\x20came\x20from\x20this\x20order\x27s\x20owner.\x20There\x20is\x20NO\x20'+'credential\x20check\x20at\x20buy\x20or\x20delivery\x20unless\x20the\x20merchant\x20wired\x20a\x20Proof-backed\x20delivery\x20guard\x20'+'(not\x20wired\x20by\x20default).\x20Treat\x20the\x20information\x20you\x20submit\x20as\x20a\x20self-attested\x20claim,\x20not\x20a\x20'+'chain-verified\x20fact\x20—\x20share\x20only\x20what\x20you\x20are\x20comfortable\x20attesting.';}catch{return null;}}export async function resolveOrderNewSaleRefs(a,b){const c=a?.['order_new']?.['buy'],d=Array['isArray'](c?.['items'])?c['items']:[],e=d['filter'](m=>m?.['sale_id']!=null||typeof m?.['sale_name']==='string'&&m['sale_name']['trim']()!=='');if(e['length']===0x0)return undefined;const f=(m,n)=>({'content':[{'type':'text','text':'SALE\x20REF\x20UNRESOLVED\x20—\x20no\x20transaction\x20was\x20sent.\x20'+m+'\x20'+'The\x20on-chain\x20buy\x20matches\x20cart\x20lines\x20by\x20EXACT\x20sale\x20name,\x20so\x20buy\x20by\x20'+'sale_id\x20(0-based\x20index\x20into\x20the\x20LIVE\x20sales\x20list)\x20instead\x20of\x20a\x20transport-fragile\x20name.\x0a'+('LIVE\x20sales\x20index\x20table:\x20'+n)}],'structuredContent':{'result':{'type':'error','error':m,'error_code':'sale_ref_unresolved','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':n?'Re-send\x20the\x20SAME\x20order\x20with\x20each\x20item\x27s\x20sale_id\x20set\x20to\x20the\x200-based\x20index\x20from\x20the\x20LIVE\x20sales\x20index\x20table:\x20'+n:'Resolve\x20the\x20Service\x20first\x20(query\x20its\x20sales\x20list),\x20then\x20retry\x20with\x20sale_id.'},'message':'Refused:\x20'+m}}),g=a?.['object'];if(typeof g!=='string'||g['length']===0x0)return{'block':f('order_new.buy.items[].sale_id/sale_name\x20needs\x20the\x20Service\x20reference\x20(data.object)\x20—\x20it\x20is\x20missing','')};let h=[];try{const m=g['startsWith']('0x')?g:await LocalMark['Instance']()['get_address'](g)??undefined;if(m){const n=await query_serviceContext({'service':m,'network':b});if(Array['isArray'](n?.['service']?.['sales']))h=n['service']['sales'];}}catch{h=[];}const j=o=>o+':\x20\x22'+(h[o]?.['name']??'?')+'\x22\x20@\x20'+String(h[o]?.['price']?.['balance']??h[o]?.['price']??'?')+'\x20(raw)',k=h['length']>0x0?h['map']((o,p)=>j(p))['join'](';\x20'):'<live\x20sales\x20list\x20unreadable>';if(h['length']===0x0){for(const p of e){delete p['sale_id'],delete p['sale_name'];}const o=d['filter'](q=>typeof q?.['name']!=='string'||q['name']['trim']()==='');if(o['length']>0x0)return{'block':f('the\x20Service\x27s\x20live\x20sales\x20list\x20could\x20not\x20be\x20read\x20this\x20session,\x20and\x20a\x20cart\x20item\x20carries\x20'+'sale_id/sale_name\x20with\x20NO\x20usable\x20name\x20to\x20match\x20on-chain',k)};return{'note':'SALE\x20REF\x20SKIPPED\x20(fail-soft):\x20the\x20Service\x27s\x20live\x20sales\x20list\x20was\x20unreadable\x20this\x20session;\x20'+'sale_id/sale_name\x20references\x20were\x20dropped\x20and\x20the\x20buy\x20proceeds\x20on\x20the\x20literal\x20item\x20names.'};}const l=[];for(const q of e){let r,t;if(q['sale_id']!=null){const u=Number(q['sale_id']);!Number['isInteger'](u)||u<0x0||u>=h['length']?t='sale_id\x20'+q['sale_id']+'\x20is\x20out\x20of\x20range\x20—\x20the\x20Service\x27s\x20LIVE\x20sales\x20list\x20has\x20'+h['length']+'\x20row(s)':r={'idx':u,'name':String(h[u]?.['name']??''),'priceRaw':String(h[u]?.['price']?.['balance']??h[u]?.['price']??'?')};}else{const v=String(q['sale_name']);let w=h['map']((x,y)=>({'s':x,'i':y}))['filter'](({s:x})=>x?.['name']===v);if(w['length']===0x0){const x=y=>y['replace'](/\s+/g,'')['toLowerCase']();w=h['map']((y,z)=>({'s':y,'i':z}))['filter'](({s:y})=>typeof y?.['name']==='string'&&(x(y['name'])===x(v)||y['name']['includes'](v)||v['includes'](y['name'])));}if(w['length']===0x1){const {s:y,i:z}=w[0x0];r={'idx':z,'name':String(y?.['name']??''),'priceRaw':String(y?.['price']?.['balance']??y?.['price']??'?')};}else w['length']>0x1?t='sale_name\x20\x22'+v+'\x22\x20is\x20AMBIGUOUS\x20—\x20'+w['length']+'\x20live\x20sales\x20match:\x20'+w['map'](({i:A})=>j(A))['join'](';\x20'):t='sale_name\x20\x22'+v+'\x22\x20matches\x20NO\x20sale\x20on\x20the\x20LIVE\x20sales\x20list';}if(!r)return{'block':f(t+'.',k)};q['name']=r['name'],delete q['sale_id'],delete q['sale_name'],l['push']('sale_index\x20'+r['idx']+'\x20→\x20\x22'+r['name']+'\x22\x20@\x20'+r['priceRaw']+'\x20(raw)');}return{'note':'SALE\x20REF\x20RESOLVED\x20(CHAN-P1-16):\x20'+l['join'](';\x20')+'\x20—\x20item\x20names\x20were\x20filled\x20from\x20the\x20Service\x27s\x20LIVE\x20sales\x20list;\x20the\x20on-chain\x20buy\x20matches\x20'+'cart\x20lines\x20by\x20exact\x20sale\x20name,\x20so\x20the\x20resolved\x20names\x20(not\x20the\x20transport-mangled\x20spellings)\x20are\x20what\x20the\x20chain\x20sees.'};}export async function warnBuyGuardTimeCutoff(a,b){if(!a?.['order_new']?.['buy'])return null;const c=a?.['object'];if(typeof c!=='string'||c['length']===0x0)return null;const d=e=>{const f=e?.['data']??e,h=f?.['root'];if(h===undefined||h===null)return undefined;const j=Array['isArray'](f?.['table'])?f['table']:undefined;return{'address':typeof e?.['object']==='string'?e['object']:undefined,'root':h,...j?{'table':j}:{}};};try{const e=c['startsWith']('0x')?c:await LocalMark['Instance']()['get_address'](c)??undefined;if(!e)return null;const f=await query_serviceContext({'service':e,'network':b}),g=f?.['buy_guard'];if(!g?.['object'])return null;const h=[g['object'],...Array['isArray'](g['relies'])?g['relies']:[]]['filter'](u=>typeof u==='string'&&u['length']>0x0);if(h['length']===0x0)return null;const j=await batchQueryObjectsByIds(h,b,!![]),k=(j??[])['filter'](u=>u?.['type']==='Guard')['map'](d)['filter'](u=>u!==undefined);if(k['length']===0x0)return null;const l=deriveTimeWindow({'guards':k['map'](u=>({'guard':u['address']??null,'def':u}))}),m=Date['now'](),n=u=>new Date(u)['toISOString'](),o=u=>u['length']===0x1?'guard\x20'+u[0x0]:'guards\x20'+u['join'](',\x20'),p=l['boundaries']['filter'](u=>u['anchor']!=='absolute')['length'],q=p>0x0?p+'\x20further\x20time\x20leg(s)\x20are\x20node-entry\x20anchored\x20and\x20were\x20NOT\x20evaluated\x20pre-buy\x20(no\x20Progress\x20exists\x20before\x20the\x20order\x20—\x20they\x20verify\x20only\x20after\x20creation).\x20':'',r=0xa*0xea60,t=l['boundaries']['filter'](u=>u['direction']==='closes'&&u['anchor']==='absolute');if(l['deadline_ms']!==null&&m>=l['deadline_ms']&&t['length']>0x0){const u=o(t['map'](v=>String(v['guard']??'?')));return'BUY\x20WINDOW\x20ALREADY\x20CLOSED\x20(S12-④(a)\x20cutoff\x20check)\x20—\x20this\x20buy\x20will\x20very\x20likely\x20ABORT\x20with\x20'+'passport\x20E_VERIFY_FAILED\x20(abort\x207).\x0a'+('The\x20mounted\x20buy_guard\x20carries\x20an\x20ABSOLUTE\x20closing\x20boundary\x20at\x20'+n(l['deadline_ms'])+'\x20')+('(raw\x20'+l['deadline_ms']+'\x20ms),\x20already\x20past\x20the\x20local\x20clock\x20('+n(m)+');\x20read\x20from\x20')+(u+'.\x20'+q)+'Caveat:\x20if\x20the\x20clock\x20leg\x20sits\x20under\x20an\x20OR\x20root,\x20another\x20branch\x20may\x20still\x20admit\x20the\x20buy\x20—\x20'+'the\x20on-chain\x20verify\x20is\x20final.\x0a'+'Fix\x20(merchant):\x20guards\x20are\x20immutable\x20after\x20publish\x20—\x20build\x20a\x20NEW\x20guard\x20with\x20a\x20fresh\x20window\x20'+'and\x20remount\x20it\x20via\x20service.buy_guard.\x20Fix\x20(buyer):\x20pick\x20a\x20service\x20whose\x20buy\x20window\x20is\x20open.';}if(l['earliest_allowed_ms']!==null&&m<l['earliest_allowed_ms']&&l['boundaries']['some'](v=>v['direction']==='opens'&&v['anchor']==='absolute')){const v=Math['round']((l['earliest_allowed_ms']-m)/0xea60);return'BUY\x20WINDOW\x20NOT\x20OPEN\x20YET\x20(S12-④(a)\x20cutoff\x20check)\x20—\x20this\x20buy\x20will\x20very\x20likely\x20ABORT\x20with\x20'+'passport\x20E_VERIFY_FAILED\x20(abort\x207).\x0a'+('The\x20mounted\x20buy_guard\x20opens\x20at\x20'+n(l['earliest_allowed_ms'])+'\x20(raw\x20'+l['earliest_allowed_ms']+'\x20ms)\x20—\x20')+('~'+v+'\x20min\x20from\x20the\x20local\x20clock\x20('+n(m)+').\x20'+q)+'Caveat:\x20if\x20the\x20opening\x20leg\x20sits\x20under\x20an\x20OR\x20root,\x20another\x20branch\x20may\x20still\x20admit\x20the\x20buy\x20—\x20'+'the\x20on-chain\x20verify\x20is\x20final.\x0a'+'Fix:\x20wait\x20until\x20the\x20window\x20opens,\x20or\x20ask\x20the\x20merchant\x20to\x20remount\x20an\x20already-open\x20guard.';}if(l['deadline_ms']!==null&&l['deadline_ms']>m&&l['deadline_ms']-m<=r)return'BUY\x20CUTOFF\x20IMMINENT\x20(S12-④(a)\x20cutoff\x20check):\x20the\x20buy_guard\x27s\x20absolute\x20closing\x20boundary\x20is\x20'+(n(l['deadline_ms'])+'\x20—\x20~'+Math['max'](0x1,Math['round']((l['deadline_ms']-m)/0xea60))+'\x20min\x20from\x20')+('the\x20local\x20clock\x20('+n(m)+').\x20A\x20buy\x20submitted\x20after\x20the\x20cutoff\x20aborts\x20with\x20passport\x20')+'E_VERIFY_FAILED\x20(abort\x207).\x20If\x20this\x20purchase\x20may\x20need\x20more\x20than\x20one\x20attempt,\x20land\x20it\x20before\x20'+'the\x20cutoff.';return null;}catch{return null;}}export async function gateServiceBuyGuardMount(a,b){const c=a?.['buy_guard'];if(typeof c!=='string'||c['trim']()==='')return null;try{const d=c['startsWith']('0x')?c:await LocalMark['Instance']()['get_address'](c)??undefined;if(!d)return null;const e=await batchQueryObjectsByIds([d],b,!![]),f=e?.[0x0];if(!f||f?.['type']!=='Guard')return null;const g=f?.['data']??f,h=Array['isArray'](g?.['table'])?g['table']:[],j=h['some'](l=>Number(l?.['identifier'])===0x0&&l?.['b_submission']===!![]);if(!j)return null;const k='⛔\x20BUY\x20GUARD\x20NOT\x20MOUNTED\x20—\x20this\x20guard\x20can\x20never\x20pass\x20a\x20buy\x20(no\x20state\x20changed)\x0a\x0a'+('Guard\x20\x27'+c+'\x27\x20declares\x20identifier\x200\x20as\x20a\x20SUBMISSION\x20row\x20(b_submission:\x20true).\x20Identifier\x200\x20carries\x20')+'the\x20transacted\x20Order\x20address\x20by\x20protocol\x20convention,\x20and\x20at\x20buy\x20time\x20the\x20order\x20does\x20not\x20exist\x20yet\x20—\x20'+'the\x20purchase\x20verifies\x20the\x20passport\x20BEFORE\x20the\x20order\x20is\x20created,\x20and\x20guard\x20tables\x20are\x20frozen\x20before\x20'+'the\x20call.\x20Mathematically\x20NO\x20passport\x20can\x20satisfy\x20the\x20check,\x20so\x20every\x20buy\x20aborts:\x20the\x20store\x20would\x20be\x20'+'unbuyable\x20while\x20looking\x20open.\x20The\x20chain\x20refuses\x20this\x20mount\x20with\x20code\x2043;\x20this\x20check\x20'+'refuses\x20it\x20here\x20for\x20the\x20same\x20reason.\x0a\x0a'+'Fix:\x20mount\x20a\x20guard\x20that\x20does\x20NOT\x20consume\x20slot\x200.\x20Guards\x20that\x20verify\x20OTHER\x20objects\x20(supply-chain:\x20'+'the\x20buyer\x20submits\x20the\x20MAIN\x20order\x20as\x20evidence)\x20use\x20other\x20slots\x20and\x20stay\x20legal\x20—\x20check\x20the\x20guard\x27s\x20'+'table\x20(query_toolkit\x20query_type=\x27guard_panorama\x27)\x20and\x20remount\x20via\x20service.buy_guard\x20with\x20a\x20compliant\x20guard.';return{'content':[{'type':'text','text':k}],'structuredContent':{'result':{'type':'error','error':'buy_guard\x20\x27'+c+'\x27\x20declares\x20slot\x200\x20as\x20a\x20submission\x20row\x20—\x20a\x20buy\x20can\x20never\x20pass\x20it\x20'+'(slot\x200\x20=\x20the\x20transacted\x20Order\x20address,\x20which\x20does\x20not\x20exist\x20at\x20passport-verify\x20time).','error_code':'buy_guard_order_slot_mount_refused','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Mount\x20a\x20guard\x20whose\x20table\x20does\x20NOT\x20declare\x20identifier\x200\x20as\x20a\x20submission\x20row\x20'+'(b_submission:\x20true).\x20Guards\x20verifying\x20other\x20objects\x20use\x20other\x20slots\x20and\x20stay\x20legal.','related_object':d},'message':'buy_guard\x20not\x20mounted:\x20the\x20guard\x20consumes\x20slot\x200\x20(the\x20transacted\x20Order\x20slot)\x20—\x20no\x20buy\x20could\x20ever\x20pass.\x20See\x20recovery_hint.'}};}catch{return null;}}export function parseTotalPayRaw(a){if(!a)return undefined;const b=c=>{if(typeof c==='string'&&/^\d+$/['test'](c['trim']()))return BigInt(c['trim']());if(typeof c==='number'&&Number['isFinite'](c)&&c>=0x0)return BigInt(Math['trunc'](c));return undefined;};if(typeof a==='object'&&a!==null&&a['total_pay']!==undefined){const c=a['total_pay'];if(typeof c==='object'&&c!==null)return b(c['balance']);return b(c);}return undefined;}export function gateOrderNewZeroTotal(a){const b=a?.['order_new']?.['buy'];if(!b)return null;const c=parseTotalPayRaw(b);if(c===undefined)return null;if(c!==0x0n)return null;const d=typeof a?.['sale']==='string'?a['sale']:undefined,e='⛔\x20ORDER\x20NOT\x20CREATED\x20—\x20the\x20on-chain\x20buy\x20refuses\x20zero-total\x20orders\x20(abort\x2042)\x0a\x0a'+'This\x20buy\x27s\x20total_pay\x20cleared\x20to\x200\x20(100%-off\x20coupon\x20/\x20zero-priced\x20sale'+(d?'\x20on\x20sale\x20\x22'+d+'\x22':'')+').\x20The\x20buy\x20entry\x20asserts\x20total\x20>\x200\x20on-chain\x20'+'(E_ZERO_TOTAL_ORDER,\x20abort\x2042)\x20and\x20rejects\x20the\x20order\x20with\x20a\x20FULL\x20rollback\x20—\x20no\x20order\x20'+'object,\x20no\x20escrow,\x20nothing\x20moves.\x20This\x20client\x20gate\x20mirrors\x20that\x20refusal\x20BEFORE\x20gas\x20is\x20spent.\x0a\x0a'+'Fix\x20(buyer):\x20keep\x20at\x20least\x201\x20raw\x20unit\x20of\x20total_pay\x20—\x20use\x20a\x20smaller\x20coupon\x20so\x20the\x20order\x20total\x20stays\x20'+'above\x20zero,\x20then\x20retry.\x0a'+'Fix\x20(merchant):\x20set\x20a\x20coupon\x20floor\x20so\x20promotions\x20cannot\x20clear\x20the\x20total\x20to\x20zero,\x20and\x20reprice\x20any\x20'+'zero-priced\x20sale\x20to\x20>=\x201\x20raw\x20unit\x20(a\x20zero-priced\x20sale\x20is\x20permanently\x20unbuyable\x20—\x20F-BS-76).\x0a'+'(allow_zero_total\x20does\x20NOT\x20waive\x20the\x20coupon-issuance\x20gate\x20and\x20does\x20NOT\x20unlock\x20a\x20zero-total\x20buy\x20—\x20BSX-F07.)';return{'content':[{'type':'text','text':e}],'structuredContent':{'result':{'type':'error','error':'order\x20total_pay\x20is\x200:\x20the\x20on-chain\x20buy\x20entry\x20refuses\x20zero-total\x20orders\x20(E_ZERO_TOTAL_ORDER,\x20abort\x2042)\x20with\x20full\x20rollback\x20—\x20nothing\x20is\x20created\x20(F-OF2-07\x20/\x20F-azq9-44).','error_code':'order_new_zero_total_dead_order','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'Buyer:\x20retry\x20with\x20a\x20coupon\x20that\x20leaves\x20total_pay\x20>=\x201\x20raw.\x20Merchant:\x20set\x20a\x20coupon\x20floor\x20on\x20the\x20sale\x20so\x20promotions\x20cannot\x20clear\x20the\x20total\x20to\x20zero,\x20and\x20reprice\x20zero-priced\x20sales\x20to\x20>=\x201\x20raw.','related_object':d},'message':'Order\x20not\x20created:\x20the\x20chain\x20refuses\x20zero-total\x20buys\x20(abort\x2042).\x20See\x20recovery_hint.'}};}const REFUND_TERMINAL_REGEX=/(cancel|return|withdraw|refund|exit|expired)/i;export function minCompletionFixedFloor(a,b){const c=new Map(),d=new Map(),h=[];for(const m of b){const o=String(m?.['name']??'');if(!o)continue;for(const q of Array['isArray'](m?.['pairs'])?m['pairs']:[]){const r=String(q?.['prev_node']??'');let t=c['get'](r);!t&&(t=[],c['set'](r,t));t['push'](o);if(r==='')h['push'](o);let u=d['get'](o);!u&&(u=new Set(),d['set'](o,u));for(const v of Array['isArray'](q?.['forwards'])?q['forwards']:[]){if(typeof v?.['guard']==='string'&&v['guard'])u['add'](v['guard']['toLowerCase']());}}}if(h['length']===0x0)return undefined;const j=[],k=(w,x)=>{if(j['length']>=0x100)return;if(x['includes'](w)){j['push']({'nodes':[...x,w],'cycle':!![]});return;}const y=c['get'](w)??[];if(y['length']===0x0){j['push']({'nodes':[...x,w],'cycle':![]});return;}for(const z of y)k(z,[...x,w]);};for(const w of h)k(w,[]);if(j['length']===0x0)return undefined;let l;for(const x of j){if(!x['cycle']&&REFUND_TERMINAL_REGEX['test'](x['nodes'][x['nodes']['length']-0x1]??''))continue;const y=new Set();for(const A of x['nodes']){for(const B of d['get'](A)??[])y['add'](B);}let z=0x0n;for(const C of a){if(C['guard']&&y['has'](C['guard']))z+=C['sum'];}if(l===undefined||z<l)l=z;}return l;}export const KEEPER_DUAL_PAYOUT_DIRECTIVE='KEEPER\x20DIRECTIVE\x20(automation):\x20this\x20refusal\x20is\x20a\x20HARD\x20STOP.\x20(1)\x20Never\x20retry\x20this\x20call\x20unchanged\x20—\x20'+'the\x20gate\x20re-fires\x20on\x20the\x20same\x20on-chain\x20facts\x20every\x20time.\x20(2)\x20NEVER\x20set\x20acknowledge_dual_payout\x20yourself\x20'+'to\x20push\x20the\x20call\x20through\x20—\x20the\x20flag\x20is\x20the\x20HUMAN\x20operator\x27s\x20netting\x20decision,\x20not\x20an\x20automation\x20input,\x20and\x20'+'since\x20D-1\x20it\x20is\x20honored\x20ONLY\x20when\x20the\x20store\x20already\x20carries\x20a\x20human-recorded\x20preauthorization\x20'+'(config_operation\x20store_dual_payout_get\x20shows\x20preauthorized=true).\x20(3)\x20End\x20this\x20keeper\x20step\x20for\x20this\x20order\x20'+'and\x20escalate\x20to\x20the\x20human\x20operator,\x20attaching\x20this\x20refusal\x20plus\x20the\x20facts\x20it\x20names\x20(order\x20address,\x20arb\x20case,\x20'+'claimed_by,\x20indemnity,\x20escrow\x20balance).\x20The\x20human\x20operator\x20then\x20either\x20(a)\x20records\x20the\x20store-level\x20'+'preauthorization\x20ONCE\x20via\x20config_operation\x20store_dual_payout_set\x20{account,\x20confirm:true}\x20—\x20the\x20merchant\x27s\x20'+'standing\x20netting\x20decision\x20—\x20and\x20the\x20same\x20call\x20with\x20acknowledge_dual_payout:true\x20then\x20proceeds,\x20or\x20(b)\x20cancels\x20'+'the\x20step.\x20Retrying\x20in\x20a\x20loop\x20wastes\x20gas;\x20exiting\x20silently\x20strands\x20the\x20payout.';export async function storeDualPayoutVerdict(a){const b=typeof a?.['account']==='string'?a['account']['trim']():'';if(b==='')return{'account':undefined,'authorized':![]};let c;if(/^0x[0-9a-fA-F]{64}$/['test'](b))c=b['toLowerCase']();else try{const e=await LocalMark['Instance']()['get_address'](b)['catch'](()=>undefined)??undefined;c=typeof e==='string'&&/^0x[0-9a-fA-F]{64}$/['test'](e)?e['toLowerCase']():undefined;}catch{}if(!c||!isDualPayoutPreauthorized(c))return{'account':c,'authorized':![]};const d=getStoreDualPayoutPolicy(c);return{'account':c,'authorized':d?.['preauthorized']===!![],...d?.['authorized_at']?{'authorized_at':d['authorized_at']}:{}};}export function arbClaimEscrowEmptyDualPayout(a){const {orderAmount:b,escrowBalance:c,poolValue:d,acknowledged:e}=a;if(b===undefined||b<=0x0)return null;if(c!==0x0)return null;if(d!==undefined&&d<=0x0)return null;return e?'acknowledged':'refuse';}export async function dualPayoutReleaseGuidance(a){const b='the\x20allocation\x20gate\x20will\x20DECIDE\x20at\x20release\x20time\x20(the\x20future\x20alloc_by_guard\x27s\x20track\x20is\x20not\x20yet\x20classifiable):\x20'+'if\x20the\x20release\x20exits\x20along\x20ORDER-DIRECTED\x20refund\x20rails,\x20no\x20acknowledge_dual_payout\x20is\x20demanded\x20after\x20a\x20paid\x20'+'indemnity\x20(buyer-win\x20principal\x20return\x20—\x20two\x20pools\x20each\x20paying\x20once)\x20or\x20after\x20a\x20zero-indemnity\x20stamp;\x20'+'if\x20the\x20release\x20would\x20actually\x20STACK\x20both\x20tracks\x20on\x20one\x20order,\x20the\x20human\x20merchant\x20must\x20first\x20record\x20the\x20'+'standing\x20netting\x20decision\x20ONCE\x20per\x20store\x20via\x20config_operation\x20store_dual_payout_set\x20'+'{account:\x20<store\x20signing\x20account>,\x20confirm:\x20true,\x20note},\x20and\x20only\x20then\x20does\x20the\x20SAME\x20call\x20with\x20'+'acknowledge_dual_payout:true\x20proceed\x20—\x20automated\x20keepers\x20must\x20NEVER\x20record\x20that\x20preauthorization\x20or\x20set\x20'+'the\x20flag\x20themselves;\x20escalate\x20instead.',c=typeof a['allocAddr']==='string'&&a['allocAddr']['startsWith']('0x')?a['allocAddr']:undefined;if(!c)return b;let d;try{const f=await query_objects({'objects':[c],'no_cache':!![],'network':a['network']});d=(f?.['objects']?.[0x0]?.['data']??f?.['objects']?.[0x0])?.['allocators'];}catch{return b;}let e;try{e=classifyDualPayoutTrack(d,undefined);}catch{return b;}if(e['track']==='entity-directed')return'NO\x20acknowledge_dual_payout\x20is\x20demanded:\x20this\x20allocation\x27s\x20rows\x20release\x20to\x20FIXED\x20ENTITY\x20recipients\x20'+('('+(e['recipients']??[])['join'](',\x20')+'),\x20no\x20buyer-receivable\x20leg\x20—\x20the\x20gate\x20passes\x20such\x20a\x20release\x20as\x20')+'an\x20advisory\x20(merchant-stacking\x20note),\x20not\x20a\x20netting\x20decision\x20(F-OF2-03).';if(e['track']==='order-directed')return'NO\x20acknowledge_dual_payout\x20is\x20demanded:\x20this\x20allocation\x20releases\x20along\x20ORDER-DIRECTED\x20(guard-submitted)\x20'+'recipients,\x20so\x20after\x20a\x20PAID\x20non-zero\x20indemnity\x20the\x20gate\x20classifies\x20the\x20release\x20as\x20the\x20buyer-win\x20principal\x20'+'return\x20—\x20two\x20independent\x20pools\x20each\x20paying\x20once\x20(compensation\x20from\x20the\x20merchant\x20fund,\x20principal\x20back\x20'+'along\x20the\x20order\x20rail;\x20w3k7\x20F-01);\x20after\x20a\x20zero-indemnity\x20stamp\x20it\x20is\x20the\x20zero-compensation\x20case.\x20'+'Either\x20way\x20the\x20release\x20proceeds\x20without\x20the\x20flag\x20(keep\x20the\x20LEGACY\x20claimed_by-pairing\x20caveat\x20in\x20mind:\x20'+'a\x20pre-decision-11\x20rail\x20may\x20guard-reject\x20the\x20claimed_by-gated\x20leg\x20—\x20decision-11\x20node-gated\x20rails\x20are\x20unaffected).';return b;}export function awardPoolCapacityPosture(a){const {indemnity:b,pool:c,orderAmount:d}=a;if(!Number['isFinite'](b))return'pool_unknown';if(b===0x0)return'zero_award';if(d!==undefined&&d>0x0&&b>0x3*d)return'over_ceiling';if(c===0x0)return'pool_empty';if(c!==undefined&&c<b)return'pool_underfunded';if(c!==undefined)return'covered';return'pool_unknown';}export function awardPoolCapacityReceipt(a,b){const {indemnity:c,pool:d,orderAmount:e}=b,f='AWARD\x20≠\x20RECEIPT:\x20a\x20ruling\x20writes\x20the\x20indemnity\x20on\x20the\x20Arb\x20case\x20and\x20moves\x20NO\x20funds\x20—\x20the\x20buyer\x20is\x20paid\x20'+'only\x20when\x20order.arb_claim_compensation\x20executes\x20against\x20the\x20Service\x27s\x20merchant-prepaid\x20compensation_fund.';switch(a){case'zero_award':return'ZERO-AMOUNT\x20RULING\x20(award\x20≠\x20receipt):\x20indemnity\x200\x20records\x20a\x20DENIAL\x20—\x20this\x20ruling\x20pays\x20nothing\x20'+'now\x20and\x20its\x20claim\x20path\x20pays\x20nothing\x20either\x20(the\x20claim\x20only\x20closes\x20the\x20case\x20and\x20consumes\x20its\x20'+'one-shot\x20latch).\x20State\x20the\x20zero\x20award\x20in\x20the\x20feedback\x20so\x20the\x20parties\x20do\x20not\x20read\x20the\x20ruling\x20'+'success\x20as\x20a\x20payout.';case'over_ceiling':return'RULING\x20WILL\x20ABORT\x20(3x\x20ceiling):\x20indemnity\x20'+c+'\x20exceeds\x20the\x20on-chain\x20award\x20cap\x20of\x20'+('3x\x20the\x20order\x20amount\x20('+e+')\x20=\x20'+0x3*(e??0x0)+'\x20raw\x20units\x20—\x20the\x20ruling\x20entry\x20')+'aborts\x20on-chain.\x20Re-issue\x20with\x20indemnity\x20<=\x20the\x20cap.';case'pool_empty':return'AWARD\x20POOL\x20EMPTY\x20—\x20UNPAYABLE\x20AWARD:\x20the\x20Service\x27s\x20compensation_fund\x20reads\x200;\x20the\x20pool\x20can\x20'+('currently\x20pay\x200\x20and\x20this\x20case\x20needs\x20'+c+'\x20(raw\x20units).\x20The\x20ruling\x20itself\x20still\x20succeeds\x20')+'(state\x20only),\x20but\x20the\x20buyer\x27s\x20later\x20arb_claim_compensation\x20aborts\x20with\x20code\x2027\x20'+'(E_COMPENSATION_NOT_MATCH)\x20until\x20the\x20merchant\x20tops\x20up\x20via\x20service\x20compensation_fund_add\x20'+('(>=\x20'+c+').\x20'+f+'\x20Either\x20top\x20up\x20before\x20ruling,\x20or\x20record\x20the\x20shortfall\x20in\x20the\x20feedback.');case'pool_underfunded':return'AWARD\x20EXCEEDS\x20POOL\x20CAPACITY:\x20the\x20pool\x20can\x20currently\x20pay\x20'+d+'\x20(raw\x20units)\x20and\x20this\x20case\x20'+('needs\x20'+c+'.\x20The\x20ruling\x20succeeds\x20(state\x20only),\x20but\x20the\x20claim\x20aborts\x20with\x20code\x2027\x20until\x20')+('the\x20merchant\x20tops\x20up\x20via\x20service\x20compensation_fund_add\x20(>=\x20'+c+').\x20'+f);case'covered':return'AWARD\x20POOL\x20COVERED:\x20the\x20pool\x20can\x20currently\x20pay\x20'+d+'\x20and\x20this\x20case\x20needs\x20'+c+'\x20'+'(raw\x20units).\x20Concurrent\x20claims\x20share\x20the\x20same\x20per-Service\x20pool\x20—\x20the\x20balance\x20is\x20not\x20reserved\x20'+('for\x20this\x20case.\x20'+f);default:return'AWARD\x20≠\x20RECEIPT:\x20this\x20ruling\x20writes\x20indemnity\x20'+c+'\x20(raw\x20units)\x20on\x20the\x20case\x20and\x20moves\x20'+'NO\x20funds\x20—\x20the\x20buyer\x20is\x20paid\x20only\x20at\x20order.arb_claim_compensation\x20from\x20the\x20Service\x27s\x20'+'merchant-prepaid\x20compensation_fund.\x20The\x20pool\x20balance\x20could\x20not\x20be\x20probed\x20this\x20session;\x20verify\x20'+'the\x20fund\x20covers\x20the\x20award\x20before\x20relying\x20on\x20the\x20payout.';}}export function claimPoolInsufficient(a){const {indemnity:b,pool:c}=a;return b!==undefined&&b>0x0&&c!==undefined&&c<b;}export function disputeFeeReceipt(a){const {venueFee:b}=a;if(b===0x0)return'CASE\x20FEE\x20=\x200\x20(venue\x20fee\x20unset):\x20this\x20case\x20escrows\x20NOTHING\x20—\x20the\x20entire\x20dispute.fee\x20coin\x20refunds\x20'+'to\x20the\x20filer\x20in\x20the\x20same\x20transaction,\x20the\x20created\x20Arb\x27s\x20fee\x20reads\x200,\x20and\x20the\x20arbitrator\x20earns\x20no\x20'+'per-case\x20fee\x20(arb_withdraw\x20later\x20has\x20nothing\x20to\x20pull).\x20To\x20charge\x20a\x20real\x20fee,\x20the\x20VENUE\x20sets\x20it\x20'+'first:\x20{operation_type:\x27arbitration\x27,\x20data:{object:\x27<venue>\x27,\x20fee:<amount>}}\x20(permission\x20357);\x20'+'filing\x20then\x20requires\x20balance\x20>=\x20that\x20fee.';if(b!==undefined&&b>0x0)return'CASE\x20FEE\x20'+b+'\x20(raw\x20units):\x20the\x20case\x20escrows\x20the\x20VENUE\x27s\x20configured\x20fee\x20—\x20NOT\x20the\x20'+'dispute.fee\x20amount;\x20any\x20excess\x20attached\x20above\x20the\x20venue\x20fee\x20refunds\x20to\x20the\x20filer\x20in\x20the\x20same\x20'+'transaction.\x20Fee\x20cash-out\x20path:\x20arb_withdraw\x20→\x20fees_transfer\x20→\x20treasury\x20receive.';return undefined;}export async function gateOrderNewAmountLegCoverage(b,c){const d=b?.['order_new']?.['buy'];if(!d)return null;const e=parseTotalPayRaw(d);if(e===undefined)return null;if(e<=0x0n)return null;const f=b?.['object'];if(typeof f!=='string'||f['length']===0x0)return null;try{const g=f['startsWith']('0x')?f:await LocalMark['Instance']()['get_address'](f)??undefined;if(!g)return null;const h=await query_objects({'objects':[g],'network':c}),j=(h?.['objects']??[])['find'](p=>p?.['object']===g||p?.['type']==='Service');if(!j||j['type']!=='Service')return null;const k=j?.['order_allocators'],l=Array['isArray'](k?.['allocators'])?k['allocators']:null;if(!l)return null;const m=[];for(const p of l){const q=Array['isArray'](p?.['sharing'])?p['sharing']:[];let t=0x0n;for(const u of q){const v=typeof u?.['sharing']==='string'&&/^\d+$/['test'](u['sharing']['trim']())?BigInt(u['sharing']['trim']()):undefined;if(u?.['mode']===0x0&&v!==undefined)t+=v;}if(t>0x0n)m['push']({'guard':String(p?.['guard']??'')['toLowerCase'](),'sum':t});}if(m['length']===0x0)return null;let n;try{const w=j?.['machine']??j?.['data']?.['machine'];if(typeof w==='string'&&w['length']>0x0){const x=await fetchMachineNodes(String(w),c,![]);n=minCompletionFixedFloor(m,Array['isArray'](x)?x:[]);}}catch{n=undefined;}if(n===undefined)return null;if(e>=n)return null;const o='⛔\x20ORDER\x20NOT\x20CREATED\x20—\x20the\x20escrow\x20can\x20never\x20cover\x20this\x20Service\x27s\x20fixed\x20settlement\x20legs\x20(no\x20money\x20moved)\x0a\x0a'+('Service\x20\x27'+f+'\x27\x20order_allocators\x20carry\x20fixed-Amount\x20legs\x20totalling\x20'+n+'\x20(raw)\x20on\x20EVERY\x20')+'completion\x20route,\x20'+('but\x20THIS\x20order\x20anchors\x20only\x20'+e+'\x20(raw).\x20The\x20on-chain\x20allocation\x20requires\x20the\x20balance\x20to\x20')+'cover\x20each\x20fixed\x20leg\x20at\x20every\x20fire,\x20so\x20a\x20release\x20would\x20abort\x20EINSUFFICIENT_BALANCE\x20and\x20the\x20order\x20would\x20deadlock\x20'+'mid-journey\x20with\x20money\x20already\x20escrowed.\x0a\x0a'+'Fix:\x0a'+('\x20\x20•\x20Buyer:\x20pay\x20the\x20full\x20listed\x20price\x20(order\x20amount\x20>=\x20'+n+'\x20raw)\x20—\x20partial/discounted\x20amounts\x20')+'cannot\x20complete\x20this\x20Service\x27s\x20staged\x20releases.\x0a'+'\x20\x20•\x20Merchant:\x20to\x20sell\x20at\x20a\x20lower\x20price,\x20reprice\x20the\x20SKUs\x20(sales\x20price)\x20—\x20the\x20fixed\x20legs\x20are\x20'+'immutable\x20after\x20publish\x20(order_allocators\x20append-only),\x20so\x20the\x20LEGS\x20define\x20the\x20floor,\x20not\x20the\x20sticker.';return{'content':[{'type':'text','text':o}],'structuredContent':{'result':{'type':'error','error':'Fixed-Amount\x20settlement\x20legs\x20total\x20'+n+'\x20raw\x20on\x20every\x20completion\x20route\x20but\x20the\x20order\x20anchors\x20'+e+'\x20raw\x20—\x20a\x20release\x20would\x20abort\x20EINSUFFICIENT_BALANCE\x20and\x20deadlock\x20the\x20order\x20mid-journey.','error_code':'order_below_fixed_leg_sum','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Pay\x20at\x20least\x20the\x20fixed-leg\x20total,\x20or\x20have\x20the\x20merchant\x20reprice\x20the\x20SKUs.\x20The\x20legs\x20are\x20'+'immutable\x20after\x20publish\x20(order_allocators\x20append-only)\x20—\x20they\x20define\x20the\x20price\x20floor.','related_object':g},'message':'Order\x20not\x20created:\x20the\x20order\x20amount\x20is\x20below\x20the\x20Service\x27s\x20fixed\x20settlement-leg\x20total.\x20See\x20recovery_hint.'}};}catch{return null;}}const SALE_ITEM_OPS=new Set(['price_add','price_reduce','stock_add','stock_reduce','sale_suspension']);function salePriceRaw(a){const b=a?.['price']?.['balance']??a?.['price'];if(typeof b==='string'&&/^\d+$/['test'](b['trim']()))return BigInt(b['trim']());if(typeof b==='number'&&Number['isFinite'](b)&&b>=0x0)return BigInt(Math['trunc'](b));return undefined;}function saleStockRaw(a){const b=a?.['stock'];if(typeof b==='string'&&/^\d+$/['test'](b['trim']()))return BigInt(b['trim']());if(typeof b==='number'&&Number['isFinite'](b)&&b>=0x0)return BigInt(Math['trunc'](b));return undefined;}export async function prepareSaleItemOp(a,b){const c=a?.['sales']?.['op'],d=typeof c==='string'&&SALE_ITEM_OPS['has'](c)?c:a?.['restock']?.['op']==='flag'?'restock_flag':undefined;if(!d)return null;const e=d==='restock_flag'?a?.['restock']?.['sale_name']:a?.['sales']?.['sale_name'];if(typeof e!=='string'||e['length']===0x0)return null;const f=a?.['object'];if(typeof f!=='string'||f['length']===0x0)return null;try{const g=f['startsWith']('0x')?f:await LocalMark['Instance']()['get_address'](f)??undefined;if(!g)return null;const h=await query_serviceContext({'service':g,'network':b}),j=Array['isArray'](h?.['service']?.['sales'])?h['service']['sales']:[],k=j['find'](l=>typeof l?.['name']==='string'&&l['name']===e);if(!k){const l=j['map'](p=>String(p?.['name']??''))['filter'](p=>p['length']>0x0),m=e['trim']()['toLowerCase'](),n=l['find'](p=>p['trim']()['toLowerCase']()===m),o='⛔\x20SALE\x20OP\x20NOT\x20SENT\x20—\x20unknown\x20sale_name\x20(no\x20money\x20moved,\x20no\x20gas\x20spent)\x0a\x0a'+('\x22'+d+'\x22\x20names\x20sale\x20\x22'+e+'\x22,\x20which\x20does\x20NOT\x20exist\x20on\x20service\x20\x27'+f+'\x27.\x20')+'On-chain\x20this\x20op\x20would\x20abort\x20(code\x2032)\x20after\x20burning\x20gas\x20—\x20the\x20MCP\x20refuses\x20it\x20here\x20instead.\x0a\x0a'+('Available\x20sales:\x20'+(l['length']>0x0?l['map'](p=>'\x22'+p+'\x22')['join'](',\x20'):'<none>')+'\x0a')+(n?'Did\x20you\x20mean\x20\x22'+n+'\x22?\x0a':'')+'Fix:\x20copy\x20the\x20sale_name\x20EXACTLY\x20from\x20the\x20live\x20sales\x20list\x20(query_toolkit\x20/\x20service\x20context),\x20then\x20retry.';return{'block':{'content':[{'type':'text','text':o}],'structuredContent':{'result':{'type':'error','error':'sale_name\x20\x22'+e+'\x22\x20matches\x20no\x20sale\x20on\x20service\x20\x27'+f+'\x27;\x20the\x20on-chain\x20op\x20would\x20abort\x20with\x20code\x2032.\x20'+('Available\x20sales:\x20'+(l['length']>0x0?l['map'](p=>'\x22'+p+'\x22')['join'](',\x20'):'<none>')+'.')+(n?'\x20Did\x20you\x20mean\x20\x22'+n+'\x22?':''),'error_code':'sale_item_op_unknown_sale_name','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Copy\x20the\x20sale_name\x20exactly\x20from\x20the\x20live\x20sales\x20list'+(n?'\x20(did\x20you\x20mean\x20\x22'+n+'\x22?)':'')+',\x20then\x20retry.','related_object':g},'message':'Sale\x20op\x20not\x20sent:\x20unknown\x20sale_name.\x20See\x20recovery_hint.'}}};}return{'prep':{'op':d,'saleName':e,'before':{'price':salePriceRaw(k),'stock':saleStockRaw(k),'suspension':typeof k?.['suspension']==='boolean'?k['suspension']:undefined,'restock':typeof k?.['restock_on_refund']==='boolean'?k['restock_on_refund']:undefined}}};}catch{return null;}}export async function prepareRestockOrderOp(a,b){if(a?.['restock']?.['op']!=='order')return null;const c=a?.['restock']?.['order'],d=a?.['object'];if(typeof c!=='string'||c['length']===0x0)return null;if(typeof d!=='string'||d['length']===0x0)return null;try{const [e,f]=await Promise['all']([d['startsWith']('0x')?Promise['resolve'](d):LocalMark['Instance']()['get_address'](d),c['startsWith']('0x')?Promise['resolve'](c):LocalMark['Instance']()['get_address'](c)]),g=normAddr(e),h=normAddr(f);if(!g||!h)return null;const j=await batchQueryObjectsByIds([h],b,!![]),k=normAddr(rootOf(j[0x0])['service']);if(j['length']>0x0&&k!==undefined&&k!==g){const m='⛔\x20RESTOCK\x20NOT\x20SENT\x20—\x20foreign\x20order\x20(no\x20money\x20moved,\x20no\x20gas\x20spent)\x0a\x0a'+('restock\x20op:\x27order\x27\x20targets\x20order\x20\x27'+c+'\x27,\x20which\x20belongs\x20to\x20service\x20')+('\x27'+k+'\x27,\x20NOT\x20\x27'+d+'\x27.\x20On-chain\x20this\x20call\x20would\x20abort\x20(code\x2026)\x20')+'after\x20burning\x20gas\x20—\x20the\x20MCP\x20refuses\x20it\x20here\x20instead.\x0a\x0a'+'Why:\x20restock\x20is\x20ownership-bound\x20—\x20only\x20an\x20order\x20of\x20THIS\x20service\x20can\x20put\x20its\x20units\x20'+'back\x20on\x20this\x20storefront\x20(a\x20merchant\x20feeding\x20any\x20visible\x20order\x20into\x20its\x20own\x20store\x20'+'would\x20inflate\x20stock).\x0a'+'Fix:\x20run\x20the\x20restock\x20against\x20the\x20order\x27s\x20OWN\x20service.';return{'content':[{'type':'text','text':m}],'structuredContent':{'result':{'type':'error','error':'order\x20\x27'+c+'\x27\x20belongs\x20to\x20service\x20\x27'+k+'\x27,\x20not\x20\x27'+d+'\x27;\x20the\x20on-chain\x20restock\x20would\x20abort\x20with\x20code\x2026.','error_code':'restock_order_foreign_service','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'Run\x20restock\x20op:\x27order\x27\x20against\x20the\x20service\x20the\x20order\x20was\x20placed\x20on\x20(the\x20order\x27s\x20service\x20binding).','related_object':g},'message':'Restock\x20not\x20sent:\x20foreign\x20order.\x20See\x20recovery_hint.'}};}const l=await batchReadAddressKeyedFields(g,[h],b,!![]);if(l['has'](h)){const n='⛔\x20RESTOCK\x20NOT\x20SENT\x20—\x20already\x20applied\x20(no\x20money\x20moved,\x20no\x20gas\x20spent)\x0a\x0a'+('The\x20purchased\x20units\x20of\x20order\x20\x27'+c+'\x27\x20were\x20ALREADY\x20put\x20back\x20on\x20the\x20shelf\x20of\x20')+('\x27'+d+'\x27\x20—\x20restock\x20is\x20once-per-order,\x20and\x20a\x20second\x20call\x20would\x20stack\x20the\x20')+'quantity\x20again.\x20On-chain\x20this\x20call\x20would\x20abort\x20(code\x2049)\x20after\x20burning\x20gas;\x20the\x20'+'MCP\x20refuses\x20it\x20here\x20instead.\x0a\x0a'+'No\x20retry\x20will\x20succeed\x20—\x20the\x20stock\x20restoration\x20for\x20this\x20order\x20is\x20complete.\x20'+'Query\x20the\x20item\x27s\x20current\x20stock\x20to\x20confirm\x20the\x20units\x20are\x20back.';return{'content':[{'type':'text','text':n}],'structuredContent':{'result':{'type':'error','error':'order\x20\x27'+c+'\x27\x20was\x20already\x20restocked\x20on\x20\x27'+d+'\x27;\x20restock\x20is\x20once-per-order\x20and\x20the\x20on-chain\x20replay\x20would\x20abort\x20with\x20code\x2049.','error_code':'restock_order_already_applied','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'No\x20retry\x20will\x20succeed\x20—\x20the\x20restoration\x20is\x20already\x20complete.\x20Check\x20the\x20sale\x20item\x27s\x20stock\x20to\x20confirm.','related_object':g},'message':'Restock\x20not\x20sent:\x20already\x20applied\x20for\x20this\x20order.\x20See\x20recovery_hint.'}};}return null;}catch{return null;}}export async function emitSaleItemOpReadback(a,b,c,d){try{const e=b?.['object'];if(typeof e!=='string'||e['length']===0x0)return;const f=e['startsWith']('0x')?e:await LocalMark['Instance']()['get_address'](e)??undefined;if(!f)return;const g=await query_serviceContext({'service':f,'network':c}),h=Array['isArray'](g?.['service']?.['sales'])?g['service']['sales']:[],j=h['find'](q=>typeof q?.['name']==='string'&&q['name']===a['saleName']);if(!j){d['push']('SALE\x20OP\x20READ-BACK:\x20\x22'+a['op']+'\x22\x20on\x20\x22'+a['saleName']+'\x22\x20—\x20the\x20sale\x20is\x20GONE\x20from\x20the\x20live\x20list\x20after\x20the\x20tx\x20'+'(removed\x20concurrently?).\x20Verify\x20with\x20query_toolkit\x20before\x20relying\x20on\x20it.');return;}const k={'price':salePriceRaw(j),'stock':saleStockRaw(j),'suspension':typeof j?.['suspension']==='boolean'?j['suspension']:undefined,'restock':typeof j?.['restock_on_refund']==='boolean'?j['restock_on_refund']:undefined},l=a['op']==='sale_suspension'?'suspension':a['op']==='restock_flag'?'restock':a['op']['startsWith']('price')?'price':'stock',m=q=>q===undefined?'<unreadable>':q['toString'](),n=q=>q===undefined?'<unreadable>':String(q),o=l==='price'?'price:\x20'+m(a['before']['price'])+'\x20→\x20'+m(k['price'])+'\x20(raw)':l==='stock'?'stock:\x20'+m(a['before']['stock'])+'\x20→\x20'+m(k['stock'])+'\x20(units)':l==='restock'?'restock_on_refund:\x20'+n(a['before']['restock'])+'\x20→\x20'+n(k['restock']):'suspension:\x20'+n(a['before']['suspension'])+'\x20→\x20'+n(k['suspension']),p=l==='price'?a['before']['price']!==undefined&&k['price']!==undefined&&a['before']['price']!==k['price']:l==='stock'?a['before']['stock']!==undefined&&k['stock']!==undefined&&a['before']['stock']!==k['stock']:l==='restock'?a['before']['restock']!==undefined&&k['restock']!==undefined&&a['before']['restock']!==k['restock']:a['before']['suspension']!==undefined&&k['suspension']!==undefined&&a['before']['suspension']!==k['suspension'];d['push'](p?'SALE\x20OP\x20READ-BACK:\x20\x22'+a['op']+'\x22\x20landed\x20on\x20\x22'+a['saleName']+'\x22\x20—\x20'+o+'.':'SALE\x20OP\x20READ-BACK:\x20\x22'+a['op']+'\x22\x20on\x20\x22'+a['saleName']+'\x22\x20left\x20the\x20target\x20field\x20UNCHANGED\x20('+o+')\x20—\x20'+'a\x20saturated\x20stock\x20reduce\x20or\x20a\x20same-value\x20write;\x20confirm\x20this\x20is\x20intended.');}catch{}}async function emitMachineNodeReadback(a,b,c,d,e,f,g){const h=e?.['digest'];if(typeof h!=='string'||!h)return;const j=ResponseData(e)['filter'](t=>typeof t?.['type_raw']==='string'&&t['type_raw']['includes']('::machine::Machine')),k=j['filter'](t=>t?.['change']==='created'&&typeof t?.['object']==='string'),l=j['filter'](t=>t?.['change']==='mutated'&&typeof t?.['object']==='string'),m=k[0x0]?.['object']??l[0x0]?.['object'];if(k['length']>0x0&&a){const r=recordMachineCreation(a,k[0x0]['object']);if(r['length']>0x0){const t=r[r['length']-0x1];g['push']('MACHINE\x20FORK\x20(chunked-publish\x20split-brain,\x20gf29\x20F-16):\x20this\x20call\x20CREATED\x20Machine\x20'+k[0x0]['object']+'\x20'+('but\x20\x22'+t['label']+'\x22\x20already\x20created\x20Machine\x20'+t['address']+'\x20earlier\x20in\x20this\x20session\x20')+('('+r['length']+'\x20prior\x20creation(s)\x20under\x20this\x20ref).\x20An\x20unresolvable\x20object\x20ref\x20means\x20CREATE\x20on-chain\x20—\x20')+'a\x20chunked\x20publish\x20that\x20re-sends\x20the\x20same\x20{name}\x20ref\x20forks\x20again\x20per\x20chunk,\x20and\x20the\x20Service\x20binds\x20'+'whichever\x20machine\x20you\x20point\x20it\x20at\x20while\x20the\x20others\x27\x20nodes\x20are\x20orphaned.\x20Every\x20continuation\x20chunk\x20'+'must\x20reference\x20the\x20machine\x20ADDRESS\x20(0x...),\x20or\x20carry\x20the\x20full\x20node\x20set\x20in\x20ONE\x20call.\x20Before\x20going\x20'+'further:\x20query\x20both\x20machines,\x20keep\x20the\x20one\x20holding\x20the\x20complete\x20node\x20set,\x20and\x20bind\x20THAT\x20address.');}}if(!m)return;const n=Array['isArray'](d)?d['map'](u=>u&&typeof u==='object'&&typeof u['name']==='string'?u['name']:'')['filter'](Boolean):[];if(n['length']===0x0&&b['beforeCount']===undefined)return;let o;try{o=(await fetchMachineNodes(m,f,!![]))['map'](u=>u['name']);}catch{return;}if(o['length']===0x0)return;const p=b['beforeCount']!==undefined?'nodes\x20'+b['beforeCount']+'\x20→\x20'+o['length']:'nodes\x20now\x20'+o['length'];if(c==='remove'){const u=n['filter'](v=>o['includes'](v));n['length']>0x0&&u['length']>0x0&&g['push']('MACHINE\x20NODE\x20READ-BACK\x20(gf29\x20F-16):\x20PARTIAL\x20REMOVE\x20—\x20machine\x20'+m+'\x20('+p+')\x20still\x20holds\x20'+('['+u['join'](',\x20')+']\x20after\x20this\x20remove.\x20Re-read\x20before\x20concluding\x20(index\x20lag\x20is\x20possible)\x20')+'and\x20re-send\x20the\x20missing\x20removes\x20referencing\x20the\x20machine\x20ADDRESS.');return;}const q=n['filter'](v=>!o['includes'](v));if(n['length']>0x0&&q['length']>0x0)g['push']('MACHINE\x20NODE\x20READ-BACK\x20(gf29\x20F-16):\x20PARTIAL\x20WRITE\x20—\x20machine\x20'+m+'\x20holds\x20'+o['length']+'\x20node(s)\x20'+('('+p+')\x20but\x20this\x20payload\x27s\x20node(s)\x20['+q['join'](',\x20')+']\x20are\x20NOT\x20in\x20the\x20live\x20table.\x20The\x20chunk\x20')+'did\x20not\x20fully\x20land\x20(index\x20lag\x20is\x20possible\x20—\x20re-read\x20before\x20concluding);\x20verify\x20with\x20query_toolkit\x20and\x20'+'re-send\x20ONLY\x20the\x20missing\x20nodes\x20referencing\x20the\x20machine\x20ADDRESS\x20before\x20publish/bind.');else n['length']>0x0&&g['push']('MACHINE\x20NODE\x20READ-BACK\x20(gf29\x20F-16):\x20machine\x20'+m+'\x20holds\x20'+o['length']+'\x20node(s)\x20('+p+')\x20—\x20'+('all\x20'+n['length']+'\x20node\x20name(s)\x20from\x20this\x20payload\x20verified\x20present\x20in\x20the\x20live\x20table.'));}export async function prepareSalesAddDuplicateGate(a,b,c){if(a?.['sales']?.['op']!=='add')return null;if(c?.['confirmed']===!![])return null;const d=Array['isArray'](a?.['sales']?.['sales'])?a['sales']['sales']:[];if(d['length']===0x0)return null;const e=a?.['object'];if(typeof e!=='string'||e['length']===0x0)return null;try{const f=e['startsWith']('0x')?e:await LocalMark['Instance']()['get_address'](e)??undefined;if(!f)return null;const g=await query_serviceContext({'service':f,'network':b}),h=Array['isArray'](g?.['service']?.['sales'])?g['service']['sales']:[],j=new Map();for(const q of h){if(typeof q?.['name']==='string')j['set'](q['name'],q);}const k=d['filter'](r=>typeof r?.['name']==='string'&&j['has'](r['name']));if(k['length']===0x0)return null;const l=r=>{const t=r?.['balance']??r;if(typeof t==='string'&&/^\d+$/['test'](t['trim']()))return t['trim']();if(typeof t==='number'&&Number['isFinite'](t)&&t>=0x0)return String(Math['trunc'](t));return'<unset>';},m=(r,t)=>{const u=saleStockRaw(r),v=saleStockRaw({'stock':t?.['stock']});return u!==undefined&&v!==undefined&&v<u;},n=k['map'](r=>{const t=j['get'](r['name']),u=m(t,r);return'\x20\x20•\x20\x22'+r['name']+'\x22\x0a'+('\x20\x20\x20\x20\x20\x20price:\x20\x20\x20\x20\x20\x20'+l(t?.['price'])+'\x20→\x20'+l(r?.['price'])+'\x20(raw\x20units)\x0a')+('\x20\x20\x20\x20\x20\x20stock:\x20\x20\x20\x20\x20\x20'+l(t?.['stock'])+'\x20→\x20'+l(r?.['stock'])+'\x20(units)')+(u?'\x20\x20⚠️\x20STOCK\x20LOSS\x20—\x20the\x20new\x20value\x20REPLACES\x20the\x20remaining\x20inventory':'')+'\x0a'+('\x20\x20\x20\x20\x20\x20suspension:\x20'+String(t?.['suspension']??'<unset>')+'\x20→\x20'+String(r?.['suspension']??'<unset>')+'\x0a')+'\x20\x20\x20\x20\x20\x20wip/wip_hash:\x20also\x20replaced\x20by\x20the\x20incoming\x20values';}),o=k['some'](r=>m(j['get'](r['name']),r)),p='⏸\x20SALES\x20ADD\x20HELD\x20FOR\x20CONFIRMATION\x20—\x20same-name\x20overwrite\x20(nothing\x20sent\x20yet)\x0a\x0a'+('op:add\x20on\x20service\x20\x27'+e+'\x27\x20re-declares\x20'+k['length']+'\x20existing\x20product\x20name(s).\x20')+'On-chain\x20this\x20is\x20a\x20FULL\x20ROW\x20REPLACEMENT\x20(an\x20exact\x20name\x20match\x20replaces\x20the\x20entire\x20stored\x20row\x20with\x20the\x20incoming\x20sale)\x20—\x20'+'price,\x20stock,\x20suspension\x20and\x20the\x20wip\x20binding\x20all\x20take\x20the\x20NEW\x20values;\x20it\x20is\x20NOT\x20an\x20append.\x0a\x0a'+(n['join']('\x0a')+'\x0a\x0a')+(o?'⚠️\x20At\x20least\x20one\x20product\x27s\x20remaining\x20stock\x20would\x20DROP\x20—\x20buyers\x20mid-purchase\x20can\x20hit\x20an\x20abort\x20when\x20stock\x20runs\x20out.\x0a\x0a':'')+'If\x20the\x20overwrite\x20is\x20INTENDED,\x20re-send\x20the\x20SAME\x20call\x20with\x20env.confirmed=true\x20and\x20it\x20will\x20proceed\x20as\x20declared.\x0a'+'If\x20not,\x20rename\x20the\x20incoming\x20product(s)\x20or\x20use\x20the\x20per-item\x20ops\x20(price_add\x20/\x20stock_add\x20/\x20sale_suspension)\x20to\x20change\x20one\x20field.';return{'content':[{'type':'text','text':p}],'structuredContent':{'outcome':'pending_input','message':p,'result':{'type':'pending_confirmation','preview':{'operation_type':'service_sales_add','duplicates':k['map'](r=>{const t=j['get'](r['name']);return{'sale_name':r['name'],'before':{'price':l(t?.['price']),'stock':l(t?.['stock']),'suspension':t?.['suspension']},'after':{'price':l(r?.['price']),'stock':l(r?.['stock']),'suspension':r?.['suspension']},'stock_loss':m(t,r)};})},'rule_id':'sales_add_same_name_replace'},'semantic':{'intent':'service_sales_add_awaiting_confirmation','status':'pending_input','summary':'sales\x20op:add\x20would\x20OVERWRITE\x20'+k['length']+'\x20existing\x20product(s)\x20(full\x20row\x20replacement\x20incl.\x20stock).\x20NOT\x20executed.\x20Re-send\x20with\x20env.confirmed=true\x20to\x20proceed,\x20or\x20rename\x20/\x20use\x20per-item\x20ops.','next_actions':[{'action':'confirm:\x20re-send\x20the\x20SAME\x20sales\x20op:add\x20with\x20env.confirmed=true','reason':'The\x20same-name\x20overwrite\x20is\x20intended;\x20review\x20the\x20diff\x20above\x20before\x20confirming.','tool':'onchain_operations','priority':'required'},{'action':'alternative:\x20rename\x20incoming\x20products\x20or\x20use\x20per-item\x20ops\x20(price_add\x20/\x20stock_add\x20/\x20stock_reduce\x20/\x20sale_suspension)','reason':'Per-item\x20ops\x20change\x20one\x20field\x20without\x20replacing\x20the\x20row.','tool':'onchain_operations','priority':'optional'}],'warnings':o?['At\x20least\x20one\x20product\x27s\x20remaining\x20stock\x20would\x20drop\x20under\x20the\x20incoming\x20values.']:[]}}};}catch{return null;}}export async function prepareSaleWipSetOp(a,b){if(a?.['sales']?.['op']!=='wip_set')return null;const c=a?.['sales']?.['sale_name'];if(typeof c!=='string'||c['length']===0x0)return null;const d=typeof a?.['sales']?.['wip']==='string'?a['sales']['wip']:undefined;if(d===undefined)return null;const f=typeof a?.['sales']?.['wip_hash']==='string'?a['sales']['wip_hash']:'',g=a?.['object'];if(typeof g!=='string'||g['length']===0x0)return null;try{const h=g['startsWith']('0x')?g:await LocalMark['Instance']()['get_address'](g)??undefined;if(!h){const o='⛔\x20WIP\x20SET\x20NOT\x20SENT\x20—\x20service\x20\x27'+g+'\x27\x20could\x20not\x20be\x20resolved\x20to\x20an\x20address\x20'+'(no\x20money\x20moved,\x20no\x20gas\x20spent)\x0a\x0a'+'\x22wip_set\x22\x20is\x20an\x20MCP\x20composite\x20(read\x20live\x20sales\x20→\x20merge\x20→\x20replay\x20as\x20op:set):\x20without\x20the\x20'+'live\x20sales\x20list\x20it\x20CANNOT\x20be\x20executed,\x20and\x20the\x20chain\x20has\x20no\x20native\x20wip\x20entry\x20point\x20—\x20'+'letting\x20it\x20through\x20would\x20be\x20a\x20silent\x20no-op.\x20The\x20MCP\x20refuses\x20it\x20here\x20instead.\x0a\x0a'+'Fix:\x20check\x20the\x20service\x20name/address\x20(query_toolkit),\x20then\x20retry.';return{'content':[{'type':'text','text':o}],'structuredContent':{'result':{'type':'error','error':o,'error_code':'sale_wip_set_service_unresolved','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Verify\x20the\x20service\x20name/address\x20with\x20query_toolkit,\x20then\x20retry\x20the\x20wip_set\x20op.'},'message':'wip_set\x20not\x20sent:\x20service\x20unresolved.\x20See\x20recovery_hint.'}};}const j=await query_serviceContext({'service':h,'network':b}),k=Array['isArray'](j?.['service']?.['sales'])?j['service']['sales']:[],l=k['find'](p=>typeof p?.['name']==='string'&&p['name']===c);if(!l){const p=k['map'](u=>String(u?.['name']??''))['filter'](u=>u['length']>0x0),q=c['trim']()['toLowerCase'](),r=p['find'](u=>u['trim']()['toLowerCase']()===q),t='⛔\x20WIP\x20SET\x20NOT\x20SENT\x20—\x20unknown\x20sale_name\x20(no\x20money\x20moved,\x20no\x20gas\x20spent)\x0a\x0a'+('\x22wip_set\x22\x20names\x20sale\x20\x22'+c+'\x22,\x20which\x20does\x20NOT\x20exist\x20on\x20service\x20\x27'+g+'\x27.\x20')+'The\x20composite\x20would\x20replay\x20the\x20full\x20table\x20and\x20abort\x20on\x20chain\x20(code\x2032)\x20after\x20burning\x20gas\x20—\x20'+'the\x20MCP\x20refuses\x20it\x20here\x20instead.\x0a\x0a'+('Available\x20sales:\x20'+(p['length']>0x0?p['map'](u=>'\x22'+u+'\x22')['join'](',\x20'):'<none>')+'\x0a')+(r?'Did\x20you\x20mean\x20\x22'+r+'\x22?\x0a':'')+'Fix:\x20copy\x20the\x20sale_name\x20EXACTLY\x20from\x20the\x20live\x20sales\x20list\x20(query_toolkit\x20/\x20service\x20context),\x20then\x20retry.';return{'content':[{'type':'text','text':t}],'structuredContent':{'result':{'type':'error','error':'sale_name\x20\x22'+c+'\x22\x20matches\x20no\x20sale\x20on\x20service\x20\x27'+g+'\x27;\x20the\x20on-chain\x20replay\x20would\x20abort\x20with\x20code\x2032.\x20'+('Available\x20sales:\x20'+(p['length']>0x0?p['map'](u=>'\x22'+u+'\x22')['join'](',\x20'):'<none>')+'.')+(r?'\x20Did\x20you\x20mean\x20\x22'+r+'\x22?':''),'error_code':'sale_wip_set_unknown_sale_name','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Copy\x20the\x20sale_name\x20exactly\x20from\x20the\x20live\x20sales\x20list'+(r?'\x20(did\x20you\x20mean\x20\x22'+r+'\x22?)':'')+',\x20then\x20retry.','related_object':h},'message':'wip_set\x20not\x20sent:\x20unknown\x20sale_name.\x20See\x20recovery_hint.'}};}const m=u=>{const w=u?.['balance']??u;if(typeof w==='string'&&/^\d+$/['test'](w['trim']()))return w['trim']();if(typeof w==='number'&&Number['isFinite'](w)&&w>=0x0)return String(Math['trunc'](w));return'0';},n=k['map'](u=>u?.['name']===c?{'name':c,'price':m(u?.['price']),'stock':m(u?.['stock']),'suspension':u?.['suspension']===!![],'wip':d,'wip_hash':f}:{'name':String(u?.['name']??''),'price':m(u?.['price']),'stock':m(u?.['stock']),'suspension':u?.['suspension']===!![],'wip':typeof u?.['wip']==='string'?u['wip']:'','wip_hash':typeof u?.['wip_hash']==='string'?u['wip_hash']:''});return a['sales']={'op':'set','sales':n},null;}catch(u){const v='⛔\x20WIP\x20SET\x20NOT\x20SENT\x20—\x20the\x20live\x20sales\x20list\x20could\x20not\x20be\x20read\x20'+('('+(u?.['message']??String(u))+')\x0a\x0a')+'\x22wip_set\x22\x20is\x20an\x20MCP\x20composite\x20(read\x20live\x20sales\x20→\x20merge\x20→\x20replay\x20as\x20op:set);\x20without\x20the\x20'+'live\x20list\x20it\x20CANNOT\x20be\x20executed,\x20and\x20the\x20chain\x20has\x20no\x20native\x20wip\x20entry\x20point\x20—\x20letting\x20it\x20'+'through\x20would\x20be\x20a\x20silent\x20no-op.\x20The\x20MCP\x20refuses\x20it\x20here\x20instead.\x20Retry\x20once\x20(index\x20lag\x20is\x20'+'possible),\x20then\x20verify\x20the\x20service\x20with\x20query_toolkit.';return{'content':[{'type':'text','text':v}],'structuredContent':{'result':{'type':'error','error':v,'error_code':'sale_wip_set_live_read_failed','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Retry\x20once\x20(possible\x20index\x20lag),\x20then\x20verify\x20the\x20service\x20with\x20query_toolkit\x20before\x20re-sending.'},'message':'wip_set\x20not\x20sent:\x20live\x20sales\x20list\x20unreadable.\x20See\x20recovery_hint.'}};}}export async function gateBuyWipPinDoctrine(a,b,c){const d=a?.['order_new']?.['buy']??a?.['buy'],e=Array['isArray'](d?.['items'])?d['items']:[];if(e['length']===0x0)return null;const f=e['filter'](j=>typeof j?.['name']==='string'&&String(j?.['wip_hash']??'')==='');if(f['length']===0x0)return null;const g=a?.['object'];if(typeof g!=='string'||g['length']===0x0)return null;const h=d?.['derive_wip_from_listing']===!![];try{const j=g['startsWith']('0x')?g:await LocalMark['Instance']()['get_address'](g)??undefined;if(!j)return null;const k=await query_serviceContext({'service':j,'network':b}),l=Array['isArray'](k?.['service']?.['sales'])?k['service']['sales']:[],m=new Map();for(const q of l){if(typeof q?.['name']==='string')m['set'](q['name'],q);}const n=f['filter'](r=>{const t=m['get'](r['name']);return t!=null&&String(t?.['wip_hash']??'')!=='';});if(n['length']===0x0)return null;if(h)return c['push']('wip_pin:\x20auto-filled\x20—\x20no\x20WYSIWYG\x20guarantee.\x20The\x20following\x20item(s)\x20were\x20sent\x20WITHOUT\x20a\x20wip_hash\x20'+'while\x20their\x20listing\x20carries\x20a\x20pin;\x20the\x20CURRENT\x20listing\x20hash\x20is\x20injected\x20at\x20order\x20time\x20'+'(derive_wip_from_listing\x20opt-in):\x20'+n['map'](r=>'\x22'+r['name']+'\x22')['join'](',\x20')+'.\x20'+'An\x20injected\x20hash\x20follows\x20the\x20listing\x20—\x20if\x20the\x20merchant\x20rebinds\x20the\x20.wip\x20file\x20later,\x20deliveries\x20run\x20'+'under\x20the\x20NEW\x20file.\x20An\x20explicitly\x20passed\x20hash\x20stays\x20pinned\x20instead.'),null;const o=n['map'](r=>{const t=m['get'](r['name']);return'\x20\x20•\x20\x22'+r['name']+'\x22\x20—\x20listing\x20pin:\x20'+String(t['wip_hash']);})['join']('\x0a'),p='⛔\x20ORDER\x20NOT\x20SENT\x20—\x20wip\x20pin\x20required\x20(h1z9\x20card\x2013\x20#17,\x20unified\x20doctrine)\x0a\x0a'+(n['length']+'\x20item(s)\x20were\x20sent\x20with\x20an\x20EMPTY\x20wip_hash\x20while\x20their\x20listing\x20carries\x20a\x20pin.\x20')+'The\x20SDK\x20auto-fills\x20such\x20items\x20with\x20the\x20listing\x27s\x20CURRENT\x20hash\x20silently\x20—\x20convenient,\x20but\x20it\x20drops\x20the\x20'+'WYSIWYG\x20guarantee\x20(the\x20merchant\x20may\x20rebind\x20the\x20.wip\x20file\x20later,\x20and\x20an\x20injected\x20hash\x20follows\x20the\x20'+('listing).\x20The\x20MCP\x20refuses\x20this\x20pre-send:\x0a\x0a'+o+'\x0a\x0a')+'Two\x20fixes:\x0a'+'\x20\x201.\x20PIN:\x20pass\x20each\x20item\x27s\x20wip_hash\x20EXACTLY\x20as\x20the\x20listing\x20value\x20above\x20—\x20what\x20you\x20verified\x20is\x20what\x20you\x20'+'get\x20(a\x20later\x20legitimate\x20merchant\x20update\x20is\x20detected\x20at\x20quote:\x20E_WIP_HASH_NOT_MATCH).\x0a'+'\x20\x202.\x20OPT\x20IN:\x20re-send\x20with\x20derive_wip_from_listing:true\x20on\x20the\x20buy\x20object\x20to\x20accept\x20the\x20auto-fill\x20'+'(the\x20response\x20then\x20warns\x20\x27wip_pin:\x20auto-filled\x20—\x20no\x20WYSIWYG\x20guarantee\x27).';return{'content':[{'type':'text','text':p}],'structuredContent':{'result':{'type':'error','error':p,'error_code':'buy_wip_pin_required','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'Pass\x20each\x20item\x27s\x20listing\x20wip_hash\x20exactly,\x20or\x20re-send\x20with\x20derive_wip_from_listing:true\x20on\x20the\x20buy\x20object\x20to\x20accept\x20the\x20auto-fill.','related_object':j},'message':'Order\x20not\x20sent:\x20empty\x20wip_hash\x20against\x20a\x20pinned\x20listing.\x20See\x20recovery_hint.'}};}catch{return null;}}export function gateServicePublishPreflight(a){if(a?.['publish']!==!![])return null;const b=a?.['creation_plan'];if(b==null)return null;const c=(h,j,k,l)=>({'content':[{'type':'text','text':'⛔\x20SERVICE\x20NOT\x20PUBLISHED\x20—\x20'+j+'\x0a\x0a'+k}],'structuredContent':{'result':{'type':'error','error':j,'error_code':h,'retryable':!![],'recovery_hint':k,...l},'message':'Service\x20not\x20published:\x20the\x20creation_plan\x20gate\x20rejected\x20the\x20publish.\x20See\x20recovery_hint.'}});if(typeof b!=='object'||Array['isArray'](b)||!Array['isArray'](b['steps']))return c('creation_plan_malformed','creation_plan\x20is\x20present\x20but\x20malformed\x20(expected\x20the\x20merchant_guide\x20Plan\x20JSON\x20with\x20a\x20steps\x20array).','Pass\x20the\x20plan\x20object\x20EXACTLY\x20as\x20merchant_guide\x20delivered\x20it\x20(its\x20creation_plan\x20field),\x20or\x20omit\x20'+'creation_plan\x20entirely\x20to\x20publish\x20the\x20manual\x20way.\x20Do\x20not\x20hand-edit\x20the\x20plan.');const d=b,f=d['steps']['filter'](h=>h?.['op']==='publish');if(f['length']===0x0)return c('creation_plan_malformed','creation_plan\x20carries\x20no\x20publish\x20step\x20—\x20it\x20is\x20not\x20the\x20plan\x20merchant_guide\x20handed\x20out\x20for\x20this\x20build.','Pass\x20the\x20plan\x20object\x20EXACTLY\x20as\x20merchant_guide\x20delivered\x20it\x20(its\x20creation_plan\x20field),\x20or\x20omit\x20'+'creation_plan\x20entirely\x20to\x20publish\x20the\x20manual\x20way.');const g=typeof a?.['object']==='string'?a['object']:a?.['object']?.['name'];if(typeof g==='string'&&g['length']>0x0&&!g['startsWith']('0x')){const h=f['map'](j=>{const k=j?.['target']?.['$ref'],l=typeof k==='string'?d['steps']['find'](n=>n['id']===k):undefined,m=l?.['op']==='create'&&typeof l['params']?.['name']==='string'?l['params']['name']:undefined;return typeof m==='string'&&!m['startsWith']('0x')?m:undefined;})['filter'](j=>typeof j==='string'&&j['length']>0x0);if(h['length']>0x0&&!h['includes'](g))return c('creation_plan_target_mismatch','creation_plan\x27s\x20publish\x20step(s)\x20target\x20'+h['map'](j=>'\x27'+j+'\x27')['join'](',\x20')+'\x20'+('but\x20this\x20call\x20operates\x20on\x20\x27'+g+'\x27\x20—\x20the\x20plan\x20does\x20not\x20describe\x20this\x20Service.'),'Publish\x20the\x20Service\x20named\x20in\x20the\x20plan,\x20or\x20go\x20back\x20to\x20merchant_guide\x20and\x20rebuild\x20the\x20plan\x20for\x20'+'this\x20Service.\x20Never\x20attach\x20another\x20build\x27s\x20plan\x20to\x20a\x20publish\x20call.');}try{const {plan:j,audit:k}=preflightPlan(d),l=k['issues']['length']===0x0&&!k['findings']['some'](o=>o['level']==='critical'),m=[];for(const o of j['steps']){if(o['op']!=='publish')continue;for(const p of o['preflight']){if(p['status']==='fail')m['push'](o['id']+':\x20'+p['check']);}}if(!l||m['length']>0x0){const q=k['findings']['filter'](u=>u['level']==='critical'||m['some'](v=>v['endsWith'](u['rule_id'])))['slice'](0x0,0x8)['map'](u=>'\x20\x20•\x20['+u['level']+']\x20'+u['rule_id']+':\x20'+u['title']+'\x20—\x20'+u['description']+(u['mitigation']?'\x20Fix:\x20'+u['mitigation']:'')),r=k['issues']['slice'](0x0,0x5)['map'](u=>'\x20\x20•\x20['+u['code']+']'+(u['step']?'\x20(step\x20'+u['step']+')':'')+'\x20'+u['detail']),t=(r['length']>0x0?'Structural\x20issues:\x0a'+r['join']('\x0a')+'\x0a':'')+(q['length']>0x0?'Audit\x20findings:\x0a'+q['join']('\x0a')+'\x0a':'')+(m['length']>0x0?'Failed\x20freeze\x20gates:\x20'+m['join'](';\x20')+'.':'');return c('creation_plan_preflight_failed','the\x20creation_plan\x20freeze\x20matrix\x20has\x20failed\x20gates\x20—\x20publishing\x20it\x20would\x20go\x20live\x20against\x20a\x20plan\x20'+'merchant_guide\x27s\x20audit\x20rejected:\x0a'+t,'Fix\x20the\x20plan\x20and\x20re-run\x20merchant_guide\x20(the\x20audit\x20findings\x20above\x20name\x20the\x20rule\x20and\x20the\x20fix),\x20'+'then\x20pass\x20the\x20NEW\x20plan\x20back\x20here.\x20Do\x20not\x20publish\x20with\x20failed\x20gates:\x20order_allocators\x20and\x20the\x20'+'machine\x20binding\x20are\x20immutable\x20after\x20publish.');}const n=bindAuditPlan(d);if(n['length']>0x0){const u=bindRecoveryList(d);return c('PLAN_BIND_AUDIT_FAILED','the\x20creation_plan\x20binds\x20plan-created\x20objects\x20by\x20global-namespace\x20NAME\x20instead\x20of\x20{\x22$ref\x22:\x20stepId}\x20'+'(or\x20carries\x20an\x20undeclared\x20external\x20local_name).\x20Publishing\x20would\x20freeze\x20cross-run\x20mis-bindings\x20'+'into\x20immutable\x20Guards\x20—\x20the\x20W5-05\x20whole-store-loss\x20class:\x0a'+bindAuditReport(n,u),'Do\x20NOT\x20publish\x20this\x20plan.\x20Re-run\x20template_generate\x20against\x20the\x20current\x20catalog\x20(its\x20compile\x20emits\x20'+'{\x22$ref\x22:\x20stepId}\x20for\x20every\x20plan-internal\x20object),\x20then\x20pass\x20the\x20NEW\x20plan\x20here.\x20The\x20recovery\x20'+'list\x20above\x20names\x20each\x20object\x20this\x20build\x20already\x20created\x20so\x20its\x20funds/objects\x20can\x20be\x20recovered.',{'bind_offenses':n,'recovery_list':u});}if(typeof d['templateId']==='string'){const v=oracleDisclosureBlockersFor(d['templateId']);if(v['length']>0x0)return c('oracle_disclosure_incomplete','Template\x20\x27'+d['templateId']+'\x27\x20carries\x20undisclosed\x20chain\x20limits\x20for\x20its\x20product\x20'+('(path-oracle\x20steps:\x20'+v['join'](',\x20')+')\x20—\x20the\x20Service\x20would\x20silently\x20')+'break\x20behaviors\x20the\x20benchmark\x20product\x20promises.','Add\x20one\x20English\x20sole-truth\x20build_note\x20per\x20listed\x20step\x20id\x20whose\x20wording\x20discloses\x20the\x20'+'chain\x20limit\x20(see\x20the\x20ORACLE-DISC-01\x20finding\x20in\x20the\x20template\x20scan\x20for\x20the\x20exact\x20per-step\x20'+'remedy),\x20re-scan\x20the\x20template\x20until\x20disclosure_coverage\x20=\x201,\x20then\x20rebuild\x20the\x20plan.');}return null;}catch(w){return c('creation_plan_malformed','creation_plan\x20could\x20not\x20be\x20audited\x20('+(w['message']??String(w))+').','Pass\x20the\x20plan\x20object\x20EXACTLY\x20as\x20merchant_guide\x20delivered\x20it,\x20or\x20omit\x20creation_plan\x20entirely\x20to\x20'+'publish\x20the\x20manual\x20way.');}}async function applyInitialForwardAfterOrderNew(a,b){const c=a?.['object'];if(typeof c!=='string'||c['length']===0x0)return undefined;if(b?.['dry_run']===!![])return undefined;try{const d=c['startsWith']('0x')?c:await LocalMark['Instance']()['get_address'](c)??undefined;if(!d)return undefined;const g=await query_objects({'objects':[d],'network':b?.['network'],'no_cache':!![]}),h=g?.['objects']?.[0x0]?.['data']??g?.['objects']?.[0x0],j=typeof h?.['progress']==='string'?h['progress']:undefined;if(!j)return undefined;const k=await query_objects({'objects':[j],'network':b?.['network'],'no_cache':!![]}),l=k?.['objects']?.[0x0]?.['data']??k?.['objects']?.[0x0],m=typeof l?.['machine']==='string'?l['machine']:undefined;if(!m)return undefined;const o=await fetchMachineNodes(m,b?.['network'],![]),r=[];for(const w of o){for(const x of w['pairs']){if(x['prev_node']!=='')continue;for(const y of x['forwards']){if(!y['name'])continue;r['push']({'forward':y,'target':w['name'],'threshold':x['threshold']});}}}if(r['length']===0x0)return undefined;const t=r['map'](z=>'\x22'+z['forward']['name']+'\x22\x20→\x20\x22'+z['target']+'\x22'+(z['forward']['guard']?'\x20[guarded]':''))['join'](';\x20'),u='onchain_operations\x20{\x20operation_type:\x20\x27progress\x27,\x20data:\x20{\x20object:\x20\x27'+j+'\x27,\x20'+('task:\x20\x27'+d+'\x27,\x20operate:\x20{\x20op:\x20\x27next\x27,\x20operation:\x20{\x20forward:\x20\x27<entry\x20forward>\x27,\x20')+'next_node_name:\x20\x27<target>\x27\x20}\x20}\x20}\x20}',v=r['length']===0x1&&!r[0x0]['forward']['guard']&&r[0x0]['forward']['namedOperator']===''&&r[0x0]['forward']['weight']>=r[0x0]['threshold'];if(v){const z=new CallProgress({'object':j,'task':d,'operate':{'op':'next','operation':{'forward':r[0x0]['forward']['name'],'next_node_name':r[0x0]['target']}}}),A=await z['call'](b),B=!!A&&typeof A==='object'&&A?.['effects']?.['status']?.['status']==='success';if(B)return'INITIAL\x20FORWARD\x20AUTO-APPLIED:\x20\x22'+r[0x0]['forward']['name']+'\x22\x20→\x20\x22'+r[0x0]['target']+'\x22\x20'+('(digest\x20'+(A?.['digest']??'n/a')+').\x20The\x20order\x20is\x20OPEN\x20for\x20business\x20—\x20the\x20')+'workflow\x20has\x20started,\x20counterparties\x20can\x20see\x20and\x20act\x20on\x20it\x20now.';const C=A&&typeof A==='object'?String(A?.['effects']?.['status']?.['error']??A?.['error']??'unknown\x20rejection'):'unknown\x20rejection';return'PENDING\x20INITIAL\x20FORWARD\x20(auto-apply\x20was\x20REJECTED,\x20funds\x20are\x20SAFE):\x20the\x20order\x20is\x20funded\x20but\x20'+('still\x20at\x20the\x20empty\x20entry\x20state\x20—\x20the\x20workflow\x20has\x20NOT\x20started.\x20Entry\x20forward:\x20'+t+'.\x20')+('Rejection:\x20'+C['slice'](0x0,0x12c)+'.\x20Apply\x20it\x20manually\x20once\x20the\x20cause\x20is\x20fixed:\x20'+u);}return'PENDING\x20INITIAL\x20FORWARD:\x20the\x20order\x20is\x20funded\x20but\x20still\x20at\x20the\x20empty\x20entry\x20state\x20—\x20the\x20workflow\x20'+('has\x20NOT\x20started\x20(abnb7\x20F37).\x20Entry\x20forward(s):\x20'+t+'.\x20This\x20MCP\x20auto-applies\x20only\x20an\x20')+('unguarded\x20single-forward\x20holder\x20entry;\x20this\x20entry\x20needs\x20a\x20manual\x20call:\x20'+u);}catch(D){return'PENDING\x20INITIAL\x20FORWARD\x20(auto-apply\x20probe\x20failed:\x20'+String(D?.['message']??D)['slice'](0x0,0xc8)+'):\x20the\x20'+'order\x20may\x20still\x20be\x20at\x20the\x20empty\x20entry\x20state\x20—\x20check\x20the\x20Progress\x27s\x20current\x20node\x20and\x20apply\x20the\x20'+'entry\x20forward\x20if\x20the\x20workflow\x20has\x20not\x20started\x20(query\x20the\x20order,\x20then\x20progress\x20operate\x20\x27next\x27).';}}async function resolveOrderRefForBackfill(a){if(typeof a!=='string'||a['length']===0x0)return undefined;if(a['startsWith']('0x'))return a;try{return await LocalMark['Instance']()['get_address'](a)??undefined;}catch{return undefined;}}async function snapshotProgressNodePreAdvance(a,b){try{if(b?.['dry_run']===!![])return undefined;const c=a?.['operate'];if(!c||c['op']!=='next')return undefined;const d=a?.['object'];if(typeof d!=='string'||d['length']===0x0)return undefined;const e=d['startsWith']('0x')?d:await LocalMark['Instance']()['get_address'](d)??undefined;if(!e)return undefined;const f=await query_objects({'objects':[e],'network':b?.['network'],'no_cache':!![]}),g=f?.['objects']?.[0x0]?.['data']??f?.['objects']?.[0x0],h=typeof g?.['current']==='string'?g['current']:undefined;if(h===undefined)return undefined;const j=typeof g?.['machine']==='string'?g['machine']:undefined;return{'progressAddr':e,'preNode':h,'machineAddr':j};}catch{return undefined;}}async function annotateProgressAdvanceOutcome(a,b,c,d){try{if(!b||!a)return;const e=extractProgressEventNodeFromTx(c,b['progressAddr']);if(e!==undefined&&e!==b['preNode'])return;const f=async()=>{const u=await query_objects({'objects':[b['progressAddr']],'network':d?.['network'],'no_cache':!![]});return u?.['objects']?.[0x0]?.['data']??u?.['objects']?.[0x0];};let g=await f();const h=extractObjectVersionFromTx(c,b['progressAddr']);for(let u=0x0;h!==undefined&&g&&String(g?.['version']??'')!==h&&u<0x2;u++){await new Promise(v=>setTimeout(v,0x258)),g=await f();}if(!g||h!==undefined&&String(g?.['version']??'')!==h)return;const j=typeof g?.['current']==='string'?g['current']:undefined;if(j===undefined||j!==b['preNode'])return;let k='unavailable\x20(machine\x20topology\x20read\x20failed)',l;if(b['machineAddr']){const v=await fetchMachineNodes(b['machineAddr'],d?.['network'],![]),w=[];for(const x of v){for(const y of x['pairs']){if(y['prev_node']!==b['preNode'])continue;if(l===undefined)l=y['threshold'];const z=y['forwards']['filter'](A=>!!A['name'])['map'](A=>'\x22'+A['name']+'\x22'+(A['guard']?'\x20[guarded]':'\x20[unguarded]'))['join'](',\x20');if(z)w['push']('→\x20\x22'+x['name']+'\x22\x20(threshold\x20'+y['threshold']+'):\x20'+z);}}if(w['length']>0x0)k=w['join'](';\x20');}const m=Array['isArray'](g?.['session'])?g['session']['slice'](-0x1)[0x0]:undefined,o=m&&Array['isArray'](m['forwards'])?m['forwards']['length']:undefined,q=typeof m?.['weights']==='number'?m['weights']:undefined,r=[];r['push']('ADVANCED:\x20false\x20—\x20the\x20transaction\x20succeeded\x20but\x20the\x20Progress\x20node\x20did\x20NOT\x20move;\x20it\x20is\x20still\x20\x22'+b['preNode']+'\x22.'),r['push']('Outgoing\x20edges\x20from\x20\x22'+b['preNode']+'\x22:\x20'+k+'.');const t=[];if(l!==undefined)t['push']('pair\x20threshold\x20'+l);if(o!==undefined)t['push'](o+'\x20forward\x20submission(s)\x20recorded\x20this\x20session\x20(COUNT,\x20not\x20weight)');if(q!==undefined)t['push']('accumulated\x20weight\x20'+q);if(t['length']>0x0)r['push']('Session:\x20'+t['join'](';\x20')+'.');r['push']('Threshold\x20not\x20met\x20—\x20more\x20submissions/weight\x20needed;\x20funds\x20and\x20state\x20unchanged.');Array['isArray'](a['content'])&&a['content']['push']({'type':'text','text':r['join']('\x20')});try{const A=a['structuredContent'];if(A&&typeof A==='object'){if(!A['semantic']||typeof A['semantic']!=='object')A['semantic']={};A['semantic']['forward_outcome']={'advanced':![],'current_node':b['preNode'],...l!==undefined?{'threshold':l}:{},...o!==undefined?{'session_submission_count':o}:{},...q!==undefined?{'accumulated_weight':q}:{}};}}catch{}}catch{}}function orderOwnerAddr(a){const b=a,c=b?.['builder']??b?.['owner'];if(typeof c==='string'&&c['startsWith']('0x'))return c;const d=c;if(d&&typeof d==='object'){if(typeof d['AddressOwner']==='string')return d['AddressOwner'];if(typeof d['ObjectOwner']==='string')return d['ObjectOwner'];}return undefined;}async function verifyOrderNewLanded(a,b){const c=lastInFlightMarker('order_new',b);if(!c)return undefined;try{const d=await query_events({'type':'NewOrderEvent','order':'descending','limit':0x32,'network':a,'no_cache':!![]});for(const e of d?.['data']??[]){if(e?.['type']!=='NewOrderEvent')continue;const f=matchOrderLandedEvent(c,{'order':e['order'],'progress':e['progress'],'service':e['service'],'sender':e['sender'],'time':e['time'],'amount':e['amount'],'digest':e?.['id']?.['txDigest']??e?.['id']?.['tx_digest']});if(f)return f;}}catch{}if(!c['service'])return undefined;try{const g=a,h=await fetchServiceOrders(c['service'],g,!![]),j=(h?.['items']??[])['filter'](p=>typeof p?.['who']==='string'&&p['who']['startsWith']('0x'))['slice'](-0x19);if(j['length']===0x0)return undefined;const k=await batchQueryObjectsByIds(j['map'](p=>p['who']),g,!![])['catch'](()=>[]),l=new Map();for(const p of k){p&&p['type']===ObjectType['Order']&&typeof p['object']==='string'&&l['set'](p['object']['toLowerCase'](),p);}let m,n=0x0;for(const q of j){const r=l['get'](q['who']['toLowerCase']()),t=matchRecentOrder(c,{'order':q['who'],'owner':r?orderOwnerAddr(r):undefined,'time':q['time'],'amount':r?.['amount'],'items':r?.['items']});t&&(m=t,n++);}if(!m)return undefined;return n>0x1?m+'\x20('+n+'\x20candidates\x20inside\x20the\x20adoption\x20window\x20—\x20verify\x20items/amount\x20against\x20THIS\x20call\x27s\x20payload\x20before\x20adopting)':m;}catch{return undefined;}}const resolvedNameCache=new Map();export function invalidateResolvedNameCache(){resolvedNameCache['clear']();}async function resolveNamedObjectsInPlace(a){if(!a||typeof a!=='object')return;const b=['object','machine','arb','arbitration_object','permission','contact','um','required_info'],c=['objects','repositories','allocators','guards','items','entities','agents'],d=async e=>{if(typeof e!=='string')return e;const f=e['trim']();if(f===''||f['startsWith']('0x'))return e;const g=resolvedNameCache['get'](f);if(g)return g;try{const h=await LocalMark['Instance']()['get_address'](f);if(h)return resolvedNameCache['set'](f,h),h;return e;}catch{return e;}};for(const e of b){if(!(e in a))continue;a[e]=await d(a[e]);}for(const f of c){const g=a[f];if(!Array['isArray'](g))continue;for(let h=0x0;h<g['length'];h++){const j=g[h];if(j&&typeof j==='object'){for(const k of b){if(k in j)j[k]=await d(j[k]);}if(typeof j['name']==='string'&&!('type_parameter'in j)&&!('permission'in j)){const l=await d(j['name']);if(l!==j['name'])g[h]=l;}}else g[h]=await d(j);}}}async function collectArbitrationRefsForPublish(a,b){const c=a?.['arbitrations'];if(c&&typeof c==='object'&&(c['op']==='add'||c['op']==='set')&&Array['isArray'](c['objects'])&&c['objects']['length']>0x0)return c['objects'];const d=typeof a?.['object']==='string'?a['object']:undefined;if(d)try{const e=d['startsWith']('0x')?d:await LocalMark['Instance']()['get_address'](d)['catch'](()=>undefined)??undefined;if(e){const f=await resolveNetwork(b?.['network']),g=await query_objects({'objects':[e],'network':f,'no_cache':!![]}),h=g?.['objects']?.[0x0];if(h&&h['type']==='Service'){const j=h['data']??h;if(Array['isArray'](j['arbitrations']))return j['arbitrations'];}}}catch{}return[];}export function isPassportVerifyFailure(a,b){if(/Identifier\("passport"\)/['test'](a)&&/MoveAbort\([\s\S]*,\s*7\s*\)/['test'](a))return!![];if(/::passport::/['test'](a)&&/abort code:\s*7\b/['test'](a))return!![];return b&&/abort code:\s*7\b/['test'](a);}function pickSubmissionCallForDiagnosis(a){for(const b of[a?.['submission'],a?.['info']]){if(b&&typeof b==='object'&&Array['isArray'](b['guard'])&&Array['isArray'](b['submission']))return b;}return undefined;}async function diagnoseGuardFailure(a,b){let c=pickSubmissionCallForDiagnosis(a),e=![];!c&&isBuyGuardAbortContext(a,b)&&(c=await synthesizeBuyGuardSubmissionForDiagnosis(a),e=c!==undefined);if(!isPassportVerifyFailure(b,c!==undefined))return undefined;if(!c)return undefined;const f=getEnvConfig(a?.['env']),g=await diagnose_passport_failure(f,c);if(g['failed_index']===null||g['failed_guard']===null)return'Guard\x20diagnosis\x20(dry-run):\x20'+g['hint'];const h=e?'Guard\x20diagnosis\x20(dry-run):\x20this\x20buy\x20was\x20gated\x20by\x20the\x20service\x27s\x20on-chain\x20buy_guard;\x20'+('the\x20first\x20failing\x20impact\x20guard\x20is\x20#'+g['failed_index']+'\x20('+g['failed_guard']+').\x20'+g['hint']):'Guard\x20diagnosis\x20(dry-run):\x20the\x20first\x20failing\x20impact\x20guard\x20is\x20#'+g['failed_index']+'\x20'+('('+g['failed_guard']+').\x20'+g['hint']);try{const j=await submissionItemsForGuard(g['failed_guard'],c),k=await loadGuardJsonFromChain(g['failed_guard'],f?.['network']),l=[];if(k){const m=renderGuardLegMap(k['json']['root'],k['json']['table'],j);l['push'](...m);}if(k){const n=(j??[])['map'](q=>{const r=Number(q['identifier']);if(!Number['isInteger'](r)||r<0x0||r>0xff)return undefined;const t=k['json']['table']['find'](u=>u['identifier']===r);if(!t||t['value_type']===undefined)return undefined;return{'identifier':r,'value_type':t['value_type'],'value':q['value']};})['filter'](q=>q!==undefined),o=(c['guard']??[])['map'](q=>typeof q?.['object']==='string'&&q['object']['startsWith']('0x')?q['object']:undefined)['filter'](q=>typeof q==='string'),p=await verifyGuardFailureLegs(f,g['failed_guard'],n,o);if(p['verdict']==='pass')l['push']('On-chain\x20leg\x20evaluation\x20(production\x20evaluator):\x20this\x20guard\x20PASSES\x20with\x20the\x20supplied\x20submission\x20—\x20the\x20E_VERIFY_FAILED\x20came\x20from\x20a\x20different\x20guard\x20or\x20a\x20different\x20submission\x20state.');else p['root_logic']?l['push']('On-chain\x20leg\x20evaluation\x20(production\x20evaluator):\x20legs\x20['+p['false_legs']['join'](',\x20')+']\x20of\x20the\x20'+p['root_logic']['toUpperCase']()+'\x20root\x20are\x20FALSE.\x20'+p['hint']):l['push']('On-chain\x20leg\x20evaluation\x20(production\x20evaluator):\x20the\x20single\x20root\x20condition\x20is\x20FALSE.\x20'+p['hint']);}if(l['length']>0x0)return h+'\x0a'+l['join']('\x0a');}catch{}return h;}async function submissionItemsForGuard(a,b){for(const c of Array['isArray'](b['submission'])?b['submission']:[]){let d=typeof c?.['guard']==='string'?c['guard']:undefined;if(!d)continue;!d['startsWith']('0x')&&(d=await LocalMark['Instance']()['get_address'](d)['catch'](()=>undefined)??d);if(d===a&&Array['isArray'](c['submission']))return c['submission'];}return undefined;}export async function synthesizeBuyGuardSubmissionForDiagnosis(a){try{const b=a?.['data']?.['object'];if(typeof b!=='string'||b['trim']()==='')return undefined;const c=getEnvConfig(a?.['env']),d=await query_serviceContext({'service':b,'no_cache':!![],'network':c?.['network']}),e=d?.['buy_guard'];if(!e?.['object'])return undefined;const f=[{'object':e['object'],'impack':!![]}];for(const g of Array['isArray'](e['relies'])?e['relies']:[]){typeof g==='string'&&!f['some'](h=>h['object']===g)&&f['push']({'object':g,'impack':![]});}return{'guard':f,'submission':[]};}catch{return undefined;}}export function isBuyGuardAbortContext(a,b){return a?.['operation_type']==='service'&&a?.['data']?.['order_new']!=null&&/abort code:\s*7\b/['test'](b);}async function autoHoldAfterClaim(a,b,c){if(typeof c!=='string'||!c)return undefined;const d=await resolveHoldableEdges({'progressRef':c,'accountName':a?.['account']??'','network':a?.['network'],'noCache':!![]});if(!d||d['edges']['length']===0x0)return undefined;const f=[],g=[],h=[];for(const j of d['edges']){const k=j['forward']+'\x20->\x20'+j['next_node'];if(!j['holdable']){h['push'](k);continue;}try{const l=new CallOrder({'object':b,'progress':{'op':'hold','operation':{'next_node_name':j['next_node'],'forward':j['forward']},'message':'arbitration\x20claimed\x20-\x20settlement\x20held\x20(E-17a)'}}),m=await l['call'](a);if(m&&typeof m==='object'&&!('error'in m))f['push'](k);else g['push'](k);}catch{g['push'](k);}}return{'held':f,'failed':g,'notHoldable':h};}export async function handleOnchainOperations(b){let c,h=[],k;async function l(m,p,u,x,y){const z=new Set(['service','machine','progress','repository','arbitration','contact','treasury','reward','allocation','permission','guard','personal','demand','order','proof']);if(!z['has'](u))return;if(!x||typeof x!=='object'||'error'in x)return;if(!x['digest'])return;if(y!==undefined)try{const A=collectOnChainNamedObjectRequests(y);if(A['length']>0x0){const B=await registerLocalMarksForCreatedObjects(A,ResponseData(x),u,{'getAddress':C=>LocalMark['Instance']()['get_address'](C,p),'put':C=>LocalMark['Instance']()['put'](C,p)});B['failed']['length']>0x0&&console['warn']('[nameRegistration]\x20'+B['failed']['length']+'\x20name(s)\x20could\x20not\x20be\x20registered\x20locally:\x20'+B['failed']['map'](C=>C['name']+'\x20('+C['error']+')')['join'](',\x20'));}}catch{}try{const C=operationPrimaryType(u),D=C?ResponseData(x)['find'](E=>E['change']==='created'&&E['object']&&String(E['type'])===String(C)):undefined;if(C&&D?.['object']){const E=D['object'],[F,G]=await Promise['all']([LocalMark['Instance']()['list']({'address':E}),LocalMark['Instance']()['get_address'](autoLocalMarkName(String(C),E),p)['catch'](()=>undefined)]),H=planAutoLocalMark({'operationType':u,'created':ResponseData(x),'existingNamesForAddress':F??[],'existingAddressForName':G});H&&(await LocalMark['Instance']()['put']([{'name':H['name'],'address':H['address'],'tags':H['tags']}],p),console['warn']('[autoMark]\x20created\x20'+u+'\x20registered\x20locally\x20as\x20'+H['note']));}}catch{}if(!m)return;try{const I=ResponseData(x),J=I['filter'](K=>K['change']==='created'&&K['object']);if(m&&J['length']>0x0){const K=J['filter'](L=>typeof L['type_raw']==='string'&&L['type_raw']['includes']('::'))['map'](L=>({'type':L['type_raw']['split']('::')['pop'](),'object':L['object']}));if(K['length']>0x0){const L=await goalEngine['registerActObjects'](m,K,p??'default');L>0x0&&console['warn']('[autoRegisterResults]\x20'+L+'\x20created\x20object(s)\x20registered\x20to\x20goal\x20'+m+'\x20(ACT\x20station)');}}}catch{}}try{if(typeof b==='object'&&b!==null&&'description'in b&&!('operation_type'in b)){const F=b['description'],G=typeof F==='string'&&(F['includes']('operation_type')||F['includes']('data'));if(G)throw new Error('Invalid\x20parameter\x20structure.\x20Parameters\x20should\x20NOT\x20be\x20wrapped\x20in\x20\x27description\x27\x20field.\x0a'+'Correct\x20format:\x20{\x20operation_type:\x20\x27...\x27,\x20data:\x20{...}\x20}\x0a'+'Incorrect\x20format:\x20{\x20description:\x20\x27{\x20operation_type:\x20...\x20}\x27\x20}');}c=strictParse(OnchainOperationsSchema,b,'onchain_operations\x20input');const m=getEnvConfig(c['env']);await expandBareReceiveIds(c,m?.['network']);const n=extractObjectOnlyRef(c);if(n!==undefined)return await queryObjectOnlyResult(c['operation_type'],n,m);try{const H=c['data']?.['object'];if(H&&typeof H==='object'&&H['replaceExistName']===!![]&&typeof H['name']==='string'&&H['name']['trim']()['length']>0x0){const I=await LocalMark['Instance']()['get'](H['name']['trim']());I?.['address']&&h['push']('NAME\x20REBIND:\x20local\x20name\x20\x27'+H['name']+'\x27\x20is\x20currently\x20bound\x20to\x20'+I['address']+'.\x20'+'replaceExistName=true\x20will\x20unbind\x20it\x20and\x20rebind\x20the\x20name\x20to\x20the\x20object\x20created/updated\x20by\x20this\x20'+('call\x20—\x20references\x20resolving\x20\x27'+H['name']+'\x27\x20will\x20point\x20to\x20the\x20NEW\x20object.\x20')+'If\x20this\x20is\x20unintentional,\x20drop\x20replaceExistName\x20or\x20choose\x20another\x20name.');}}catch{}if(!m['referrer']){const J=readStoredReferrer();if(J)m['referrer']=J;}if(m['network']==null)try{const K=await Config['Instance']()['network_get']();h['push']('env.network\x20not\x20set\x20—\x20routing\x20via\x20session\x20default\x20\x27'+String(K)+'\x27.\x20Pass\x20env.network\x20'+'explicitly\x20on\x20every\x20call\x20for\x20deterministic\x20routing\x20(the\x20response\x20network_source\x20echo\x20confirms\x20'+'which\x20network\x20served\x20the\x20call).');}catch{}if(m['dry_run']===!![]&&m['network']!=null)try{const L=await Config['Instance']()['network_get']();L&&L!==m['network']&&h['push']('NETWORK\x20DRIFT\x20(dry\x20run):\x20this\x20simulation\x20targets\x20\x27'+m['network']+'\x27\x20while\x20the\x20session\x20'+('default\x20is\x20\x27'+L+'\x27.\x20The\x20simulation\x20executed\x20(dry\x20runs\x20mutate\x20nothing),\x20but\x20the\x20')+('real\x20execution\x20WILL\x20land\x20on\x20\x27'+m['network']+'\x27\x20—\x20confirm\x20that\x20is\x20intended\x20before\x20dropping\x20dry_run.'));}catch{}const p=m['client_schema_version'],u=m['schema_strict_mode'],x=p?checkClientSchemaCompatibility(p,{'mode':u?'strict':'warn'}):undefined,y=(M,N,O)=>({'operation_type':c['operation_type'],'data':M,'expected':declareDispatchExpectation(c['operation_type'],M),'operation_id':stableOperationId(c['operation_type'],M),'pre_warnings':h['length']?h:undefined,'schema_check':x,'response_level':B,...N?{'evaluation':N}:{},...O?{'passport_test':O}:{}}),z=m['plan_approval'],A=m['network'],B=m['response_level'];if(m['confirmed']!==!![]&&m['dry_run']!==!![]){const M=await maybeGuardSubmissionConfirmation(c,m);if(M)return M;}delete m['confirmed'],delete m['user_intent_phrases'],delete m['client_schema_version'],delete m['response_level'],delete m['schema_strict_mode'],await resolveNamedObjectsInPlace(c['data']);const C=getSkillsHintForOnchain(c['operation_type'],c['data']);C&&h['push'](C);const D=getProjectSkillsHint();D&&h['push'](D);await assertReferencesResolve(c,m);{const N=c?.['idempotency_key'];if(typeof N==='string'&&N['length']>=0x8){k=N;const O=c?.['env']?.['dry_run']===!![],P=idempotencyKeyGate(N,c['operation_type'],O);if(P){const Q=P['status']==='unknown',R=(Q&&P['digests']['length']>0x0?'\x20Known\x20digests\x20from\x20that\x20attempt:\x20'+P['digests']['join'](',\x20')+'\x20—\x20verify\x20THEM\x20FIRST\x20via\x20onchain_transaction.':'')+(Q&&P['sender']?'\x20Sender\x20to\x20query\x20(onchain_events):\x20'+P['sender']+(P['verify_events_since']?',\x20events\x20since\x20'+P['verify_events_since']:'')+'.':''),S='IDEMPOTENT-REPLAY\x20HELD\x20(F-RQ-13A\x20⑨):\x20idempotency_key\x20\x22'+N+'\x22\x20already\x20names\x20an\x20attempt\x20of\x20'+('operation\x20\x22'+P['op']+'\x22\x20on\x20this\x20process\x20(')+(Q?'outcome\x20UNKNOWN\x20—\x20the\x20transaction\x20may\x20have\x20committed':'dispatched;\x20it\x20may\x20have\x20committed\x20or\x20succeeded')+(').\x20This\x20call\x20was\x20NOT\x20submitted.'+R+'\x20')+(Q?'Verify\x20the\x20outcome\x20first\x20(onchain_transaction\x20for\x20any\x20digest\x20/\x20onchain_events\x20for\x20the\x20sender\x20/\x20query\x20the\x20expected\x20object):\x20if\x20it\x20LANDED,\x20adopt\x20it\x20—\x20never\x20resubmit.\x20If\x20confirmed\x20ABSENT,\x20retry\x20with\x20a\x20NEW\x20idempotency_key\x20(the\x20verified\x20retry\x20is\x20a\x20new\x20attempt).\x20The\x20hold\x20expires\x20in\x2015\x20minutes.':'If\x20the\x20earlier\x20call\x20already\x20returned\x20a\x20successful\x20receipt,\x20adopt\x20it\x20—\x20never\x20resubmit\x20under\x20the\x20same\x20key.\x20If\x20it\x20never\x20returned,\x20verify\x20the\x20outcome\x20on-chain,\x20then\x20retry\x20with\x20a\x20NEW\x20idempotency_key.\x20The\x20hold\x20expires\x20in\x201\x20hour.');return{'content':[{'type':'text','text':S}],'structuredContent':{'result':{'type':'error','error':S,'error_code':'state_conflict','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':S,'onchain_state':'unknown',...Q?{'submission_state':'unknown'}:{},'idempotency_key':N,...Q&&P['sender']?{'submission_verification':{'sender':P['sender'],'failed_at':new Date()['toISOString'](),'verify_events_since':P['verify_events_since']??new Date(Date['now']()-0x5a*0x3e8)['toISOString'](),'digests':P['digests'],'idempotency_key':N}}:{}}}};}}}{const T=markerOpFor(c['operation_type'],c['data']),U=c['data']!==undefined?c['data']:c,V=pendingInFlightResend(T,U,c['submission'],c['env']);if(V)return{'content':[{'type':'text','text':V}],'structuredContent':{'result':{'type':'error','error':V,'error_code':'state_conflict','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':V}}};}switch(c['operation_type']){case'service':{const W=c['data'],X=await detectServiceGuardCircularDependency(W);if(X)return X;const Y=await prepareSaleWipSetOp(W,m?.['network']);if(Y)return Y;const Z=await checkSalesWipNetworkDeployment(W,m,h);if(Z)return Z;const a0=checkSalesZeroPrice(W);if(a0)return a0;const a1=await gateBuyWipPinDoctrine(W,m?.['network'],h);if(a1)return a1;const a2=describeBenchmarkIssueRisk(W?.['discount']?.['benchmark']);a2&&h['push'](a2);if(typeof W?.['discount']?.['time_ms_start']==='number'&&W['discount']['time_ms_start']>Date['now']()){const at=Math['round']((W['discount']['time_ms_start']-Date['now']())/0xea60);h['push']('COUPON\x20NOT\x20YET\x20LIVE:\x20this\x20discount\x27s\x20window\x20opens\x20at\x20'+new Date(W['discount']['time_ms_start'])['toISOString']()+'\x20'+('(in\x20~'+at+'\x20min).\x20Until\x20then\x20every\x20spend\x20attempt\x20aborts\x20with\x20E_DISCOUNT_TIME_INVALID\x20')+'(buy\x20dry_run\x20code\x2035)\x20even\x20though\x20the\x20coupon\x20is\x20already\x20minted\x20and\x20listed\x20as\x20usable\x20—\x20'+'do\x20NOT\x20distribute\x20it\x20to\x20recipients\x20before\x20the\x20window\x20opens.');}const a3=await checkDiscountFloorBeforeIssue(W,m?.['network'],{'resolveAddress':async au=>LocalMark['Instance']()['get_address'](au)['catch'](()=>undefined)??undefined,'fetchObjects':async(au,av)=>{const aw=await query_objects({'objects':au,'network':av});return aw?.['objects']??[];}});if(a3['block'])return{'content':[{'type':'text','text':a3['block']}],'structuredContent':{'result':{'type':'error','error':a3['block'],'error_code':'discount_zero_floor','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'Lower\x20discount_value\x20so\x20the\x20cheapest\x20SKU\x20still\x20pays\x20>=\x201\x20smallest\x20unit,\x20'+'switch\x20the\x20coupon\x20to\x20RATES\x20(type\x200)\x20with\x20a\x20value\x20below\x2010000,\x20or\x20price\x20a\x20'+'deliberate\x20free\x20tier\x20at\x201\x20smallest\x20unit\x20/\x20deliver\x20it\x20outside\x20the\x20sales\x20rails\x20'+'(allow_zero_total\x20waives\x20nothing\x20—\x20BSX-F07).'},'message':a3['block']}};a3['warning']&&h['push'](a3['warning']);const a4=await prepareFundOperation(W,'service',m?.['network']);if(a4['blockingErrors']['length']>0x0)return buildFundBlockResult(a4,'service');h['push'](...a4['warnings']);if(a4['confirmation']){h['push'](a4['confirmation']['message']);const au=a562b(a4['confirmation']);if(au)h['push'](au);}await warnMerchantCompensationFundLow(W,m?.['network'],h);if(typeof W?.['um']==='string'&&W['um']['trim']()!==''){const av=await checkUmContactHasIm(W['um'],m?.['network']);if(av)return av;}const a5=W?.['order_allocators'];if(a5&&typeof a5==='object'){const aw=Array['isArray'](a5['allocators'])?a5['allocators']:[];for(let ax=0x0;ax<aw['length'];ax++){const ay=aw[ax],az=Array['isArray'](ay?.['sharing'])?ay['sharing']:[];if(az['length']<=0x1)continue;const aA=new Map();for(let aB=0x0;aB<az['length'];aB++){const aC=az[aB]?.['who'];let aD=typeof aC==='string'?aC:'';if(!aD){const aF=classifyRecipient(aC);if(aF?.['kind']==='entity')aD='Entity:'+aF['address'];else{if(aF?.['kind']==='signer')aD='Signer';else{if(aF?.['kind']==='submission')aD='Guard:'+aF['identifier'];else{if(aC)aD=JSON['stringify'](aC);}}}}if(!aD)continue;const aE=aA['get'](aD)??0x0;aA['set'](aD,aE+0x1);}for(const [aG,aH]of aA){aH>0x1&&h['push']('DUPLICATE\x20SHARING\x20ENTITY:\x20Allocator['+ax+']\x20has\x20entity\x20\x22'+aG+'\x22\x20appearing\x20'+aH+'\x20times\x20'+'in\x20the\x20sharing\x20array.\x20This\x20is\x20likely\x20a\x20configuration\x20error\x20—\x20each\x20entity\x20should\x20appear\x20'+('at\x20most\x20once\x20per\x20allocator.\x20Total\x20sharing:\x20'+aH*0x64+'%\x20to\x20the\x20same\x20entity.\x20')+'If\x20intentional,\x20ignore\x20this\x20warning.');}}}if(a5){const aI=checkOrderAllocatorsPrePublish(a5,h);if(aI)return aI;const aJ=await checkEntityRecipientGate(a5,'service.order_allocators',h);if(aJ)return aJ;warnAmountEscrowDeadlock(a5,W?.['sales'],h);}const a6=c['data']?.['order_new']?.['buy']?.['items'];if(Array['isArray'](a6))for(const aK of a6){aK&&typeof aK==='object'&&'quantity'in aK&&!('stock'in aK)&&(aK['stock']=aK['quantity'],delete aK['quantity']);}const a7=c['data']?.['order_new']?.['order_required_info'],a8=typeof a7==='string'?priorProofConsumptions(a7):[];a8['length']>0x0&&h['push']('PROOF\x20REUSE\x20(informational):\x20the\x20WTS\x20Proof\x20\x27'+a7+'\x27\x20already\x20anchored\x20'+('order_required_info\x20'+a8['length']+'\x20time(s)\x20earlier\x20this\x20session')+(a8[0x0]?.['service']?'\x20(service:\x20'+a8[0x0]['service']+')':'')+'.\x20Reuse\x20is\x20acceptable\x20and\x20privacy-preserving\x20—\x20a\x20Proof\x20records\x20the\x20contact\x20channel,\x20'+'not\x20an\x20order;\x20do\x20NOT\x20mint\x20a\x20per-order\x20proof\x20(that\x20would\x20publicly\x20link\x20orders).\x20'+'Acceptance\x20of\x20the\x20delivered\x20info\x20is\x20the\x20merchant\x27s\x20confirming\x20forward\x20on\x20this\x20order.');const a9=await checkDiscountThresholdBeforeBuy(c['data']??W,m?.['network'],{'resolveAddress':async aL=>LocalMark['Instance']()['get_address'](aL)['catch'](()=>undefined)??undefined,'fetchObjects':async(aL,aM)=>{const aN=await query_objects({'objects':aL,'network':aM});return aN?.['objects']??[];}});if(a9)return{'content':[{'type':'text','text':a9}],'structuredContent':{'result':{'type':'error','error':a9,'error_code':'discount_benchmark_unmet','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'The\x20coupon\x20would\x20be\x20consumed\x20with\x20no\x20discount\x20because\x20this\x20order\x27s\x20total\x20is\x20'+'below\x20the\x20coupon\x27s\x20threshold.\x20Raise\x20the\x20order\x20total\x20above\x20the\x20threshold,\x20omit\x20'+'\x27discount\x27\x20to\x20pay\x20the\x20list\x20price\x20and\x20keep\x20the\x20coupon,\x20or\x20use\x20a\x20coupon\x20issued\x20'+'without\x20a\x20threshold.'},'message':a9}};let aa=[];if(W?.['publish']===!![]){aa=await collectArbitrationRefsForPublish(W,m);const aL=await checkArbitrationsBeforePublish(aa,m,h);if(aL)return aL;if(a5){const aM=await checkRefundRecipientSatisfiability(a5,m,h);if(aM)return aM;}}warnPermissionAutoCreation(c['data'],'Service',h);let ab;if(c['data']?.['order_new']){const aN=await resolveOrderNewSaleRefs(c['data'],m?.['network']);if(aN?.['block'])return aN['block'];aN?.['note']&&h['push'](aN['note']);const aO=await probeOrderNewWipReachability(c['data'],m?.['network']);if(aO)return aO;const aP=await deriveTotalPayIfOmitted(c['data'],m?.['network']);if(aP)h['push'](aP);const aQ=gateOrderNewZeroTotal(c['data']);if(aQ)return aQ;const aR=await warnOrderNewFundCoverage(c['data'],m?.['network']);aR&&h['push'](aR);h['push']('FUND\x20COVERAGE\x20NOTE\x20(warn-only):\x20the\x20on-chain\x20buy\x20does\x20NOT\x20read\x20the\x20compensation\x20fund\x20—\x20'+'coverage\x20is\x20not\x20enforced\x20at\x20buy\x20time.\x20The\x20advisory\x20FUND\x20COVERAGE\x20warning\x20in\x20this\x20response\x20'+'(when\x20present)\x20is\x20the\x20only\x20pre-transaction\x20signal;\x20a\x20won\x20award\x20above\x20the\x20fund\x20still\x20aborts\x20'+'the\x20buyer\x27s\x20payout\x20with\x20code\x2027\x20at\x20claim\x20time\x20(the\x20claim\x20is\x20NOT\x20consumed;\x20settlement\x20is\x20'+'all-or-nothing).\x20Buyers:\x20check\x20the\x20fund\x20balance\x20before\x20paying.\x20Merchants:\x20keep\x20the\x20fund\x20'+'>=\x203x\x20expected\x20per-order\x20amounts.');const aS=await gateOrderNewAmountLegCoverage(c['data'],m?.['network']);if(aS)return aS;const aT=await warnBuyGuardTimeCutoff(c['data'],m?.['network']);aT&&h['push'](aT);const aU=await warnBuyCustomerRequiredSelfAttested(c['data'],m?.['network']);aU&&h['push'](aU),ab=beginInFlight('order_new',c['data'],m);}const ac=await prepareSaleItemOp(W,m?.['network']);if(ac&&'block'in ac)return ac['block'];const ad=await prepareRestockOrderOp(W,m?.['network']);if(ad)return ad;W?.['restock']&&h['push']('RESTOCK\x20/\x20REFUND-WINDOW\x20DISCLOSURE:\x20restock\x20puts\x20a\x20refunded\x20order\x27s\x20purchased\x20units\x20back\x20on\x20'+'shelf\x20and\x20reopens\x20that\x20stock\x20for\x20sale\x20(the\x20order\x20path\x20is\x20two-pass\x20all-or-nothing\x20and\x20'+'once-per-order).\x20If\x20this\x20Service\x27s\x20machine\x20(or\x20its\x20template)\x20has\x20NO\x20refund-terminal\x20gate\x20—\x20'+'an\x20edge/guard\x20that\x20still\x20lets\x20orders\x20reach\x20a\x20refund\x20terminal\x20state\x20—\x20orders\x20inside\x20their\x20'+'refund\x20window\x20may\x20lose\x20refund\x20eligibility\x20or\x20create\x20fund-accounting\x20ambiguity\x20once\x20the\x20'+'restocked\x20units\x20are\x20resold.\x20Before\x20relisting,\x20confirm\x20the\x20machine\x27s\x20refund\x20rail\x20remains\x20'+'reachable\x20after\x20this\x20restock.');const ae=await prepareSalesAddDuplicateGate(W,m?.['network'],m);if(ae)return ae;const af=await gateServiceBuyGuardMount(c['data'],m?.['network']);if(af)return af;const {reentry_kind:ag,...ah}=c['data'],ai=ah['order_new']?.['buy']??ah['buy'];ai&&typeof ai==='object'&&'derive_wip_from_listing'in ai&&delete ai['derive_wip_from_listing'];const aj=new CallService(ah);let ak;try{ak=c['submission']?await aj['call_with_submission'](m,await transformSubmission(c['submission'])):await aj['call'](m);}catch(aV){const aW=aV['message']??String(aV);if(W?.['order_allocators_append']!=null&&(/allocation/i['test'](aW)&&(/MoveAbort\(.*,\s*20\s*\)/['test'](aW)||/abort code:\s*20\b/['test'](aW))||/EALLOCATORS_NOT_EXTENSION/i['test'](aW))){const aX=await describeAllocatorsNotExtensionDiff(W?.['object'],W['order_allocators_append'],m?.['network']);if(aX)throw new Error(aX+'\x0aOriginal\x20error:\x20'+aW);}if((W?.['order_new']?.['buy']?.['items']?.['length']??0x0)>0x0&&/coin not enough|E_COIN_NOT_ENOUGH|abort.*\b20\b/i['test'](aW))throw new Error('PURCHASE\x20ABORTED\x20(E_COIN_NOT_ENOUGH\x20/\x20abort\x2020):\x20the\x20payment\x20'+'total_pay\x20is\x20LESS\x20THAN\x20the\x20order\x20total.\x20On-chain\x20order\x20total\x20=\x20'+'sale.price\x20x\x20per-item\x20QUANTITY.\x20Common\x20cause:\x20the\x20inventory\x20number\x20'+'was\x20passed\x20as\x20the\x20purchase\x20quantity\x20(the\x20buy\x20item\x20field\x20is\x20the\x20'+'number\x20of\x20units\x20to\x20buy,\x20NOT\x20the\x20product\x27s\x20available\x20stock).\x20'+'Check\x20each\x20item\x27s\x20quantity\x20and\x20ensure\x20total_pay\x20>=\x20sum(price\x20x\x20quantity).\x20'+('Original\x20error:\x20'+aW));if(/not found|GetObjectExisted|resolve|LocalMark|failed to resolve/i['test'](aW)){const aY=typeof W?.['object']==='object'&&W?.['object']!==null?W['object']['permission']:undefined;throw new Error('DEPENDENCY\x20RESOLUTION\x20FAILED:\x20One\x20or\x20more\x20referenced\x20objects\x20could\x20not\x20be\x20resolved.\x0a'+('Original\x20error:\x20'+aW+'\x0a')+'Common\x20causes:\x0a'+'\x20\x201.\x20Object\x20name\x20typo\x20—\x20check\x20spelling\x20in\x20LocalMark\x0a'+'\x20\x202.\x20Object\x20not\x20yet\x20created\x20—\x20create\x20dependencies\x20first\x0a'+'\x20\x203.\x20Object\x20on\x20different\x20network\x20—\x20check\x20env.network\x0a'+('Referenced\x20objects\x20in\x20this\x20call:\x20machine='+(W?.['machine']??'<none>')+',\x20')+('buy_guard='+(W?.['buy_guard']??'<none>')+',\x20')+('permission='+(aY??'<inline/new>')+',\x20')+('arbitrations='+describeArbitrationPayload(W?.['arbitrations'])));}throw aV;}if(ab)recordInFlightOutcome(ab,ak);ac&&'prep'in ac&&ak?.['digest']&&await emitSaleItemOpReadback(ac['prep'],W,m?.['network'],h);if(W?.['discount']!=null&&ak?.['digest'])try{const aZ=ResponseData(ak)['filter'](b0=>b0?.['change']==='created'&&typeof b0?.['type_raw']==='string'&&b0['type_raw']['includes']('::service::Discount')&&typeof b0?.['object']==='string');if(aZ['length']>0x0){const b0=W['discount'],b1=b0?.['time_ms_end']!=null?new Date(Number(b0['time_ms_end']))['toISOString']():'n/a';if(aZ['length']===0x1&&typeof b0?.['name']==='string'&&b0['name']['length']>0x0){const b2=aZ[0x0]['object'],b3=await LocalMark['Instance']()['get_address'](b0['name'],m['network']);!b3||b3['toLowerCase']()===b2['toLowerCase']()?(await LocalMark['Instance']()['put']([{'name':{'value':b0['name']},'address':b2}],m['network']),h['push']('DISCOUNT\x20ISSUED:\x20coupon\x20\x22'+b0['name']+'\x22\x20is\x20live\x20at\x20'+b2+'\x20(bound\x20to\x20this\x20service,\x20expires\x20'+b1+',\x20single-use\x20—\x20burned\x20at\x20buy).\x20Reference\x20it\x20as\x20order_new.buy.discount:\x20\x22'+b0['name']+'\x22\x20or\x20by\x20the\x20object\x20ID.')):h['push']('DISCOUNT\x20ISSUED:\x20coupon\x20\x22'+b0['name']+'\x22\x20is\x20live\x20at\x20'+b2+'\x20(expires\x20'+b1+',\x20single-use).\x20LocalMark\x20name\x20\x22'+b0['name']+'\x22\x20already\x20points\x20elsewhere\x20('+b3+')\x20—\x20reference\x20the\x20coupon\x20by\x20its\x20object\x20ID\x20in\x20order_new.buy.discount.');}else h['push']('DISCOUNT\x20ISSUED:\x20'+aZ['length']+'\x20coupon(s)\x20live\x20(expires\x20'+b1+',\x20single-use\x20—\x20burned\x20at\x20buy):\x20'+(''+aZ['slice'](0x0,0x5)['map'](b4=>b4['object'])['join'](',\x20')+(aZ['length']>0x5?',\x20...':'')+'.\x20')+'Each\x20recipient\x20holds\x20their\x20own\x20copy;\x20reference\x20one\x20by\x20its\x20object\x20ID\x20in\x20order_new.buy.discount.');}}catch(b4){h['push']('DISCOUNT\x20ISSUED:\x20the\x20transaction\x20succeeded\x20but\x20coupon\x20disclosure\x20failed:\x20'+(b4?.['message']??String(b4)));}W?.['order_new']&&typeof a7==='string'&&recordProofConsumption(a7,typeof W?.['object']==='string'?W['object']:undefined);const al=W?.['object']!=null&&typeof W['object']==='object',am=W?.['compensation_fund_add']!=null;al&&!am&&h['push']('Service.compensation_fund\x20balance\x20is\x200\x20—\x20no\x20refund\x20protection\x20for\x20buyers.\x20'+'If\x20buyers\x20need\x20refund\x20protection,\x20call\x20service.compensation_fund_add\x20with\x20a\x20Coin<T>\x20'+'to\x20deposit.\x20Without\x20deposit,\x20arbitration\x20rulings\x20cannot\x20withdraw\x20compensation\x20'+'from\x20this\x20Service.\x20(Note:\x20some\x20industries\x20like\x20freelance\x20do\x20not\x20require\x20this;\x20'+'the\x20evaluation\x20engine\x20will\x20check\x20industry-specific\x20requirements.)');const an=W?.['publish']===!![];if(an){const b5=gateServicePublishPreflight(W);if(b5)return b5;}if(an){const b6=new Set(['audit_compensation_fund','audit_arbitrations']),b7=auditService(W,{'network':m?.['network']})['filter'](b8=>!b6['has'](b8['rule_id']));for(const b8 of b7){const b9=b8['severity']==='error'?'[AUDIT\x20ERROR]\x20':b8['severity']==='warning'?'[AUDIT]\x20':'[INFO]\x20';h['push'](b9+b8['message']+(b8['recommendation']?'\x20—\x20'+b8['recommendation']:''));}}let ao=an&&aa['length']>0x0;if(!an&&!ao&&am){const ba=await collectArbitrationRefsForPublish(W,m);ao=ba['length']>0x0;}if(an&&!ao&&am)throw new Error('HARD\x20PRE-CHECK\x20FAILED:\x20Cannot\x20publish\x20Service\x20with\x20compensation_fund\x20>\x200\x20but\x20no\x20Arbitration\x20bound.\x0a'+'On-chain\x20rule:\x20assert!(arbitration_count\x20>\x200,\x20E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND).\x0a'+'The\x20transaction\x20WILL\x20ABORT\x20on-chain\x20if\x20you\x20proceed.\x0a'+'Fix:\x20(1)\x20Create\x20an\x20Arbitration\x20object\x20first\x20(onchain_operations\x20with\x20operation_type=\x27arbitration\x27).\x0a'+'\x20\x20\x20\x20\x20(2)\x20Bind\x20it\x20in\x20this\x20same\x20call:\x20data.arbitrations={op:\x27add\x27,\x20objects:[<arbitration_name_or_id>]}\x0a'+'\x20\x20\x20\x20\x20\x20\x20\x20\x20(array\x20shorthand\x20data.arbitrations=[...]\x20is\x20also\x20accepted),\x20or\x20bind\x20it\x20in\x20a\x20prior\x0a'+'\x20\x20\x20\x20\x20\x20\x20\x20\x20call\x20—\x20arbitrations\x20already\x20bound\x20on\x20an\x20existing\x20Service\x20are\x20detected\x20automatically.\x0a'+'\x20\x20\x20\x20\x20(3)\x20Then\x20call\x20publish=true.\x0a'+'Note:\x20After\x20publish,\x20arbitrations\x20can\x20still\x20be\x20ADDED\x20(but\x20not\x20removed\x20without\x20pause+lock).');an&&!ao&&!am&&h['push']('WARNING:\x20Publishing\x20Service\x20without\x20arbitrations.\x20If\x20compensation_fund\x20was\x20'+'deposited\x20in\x20a\x20prior\x20call,\x20the\x20contract\x20WILL\x20ABORT\x20with\x20'+'E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND.\x20If\x20compensation_fund\x20is\x200,\x20'+'publish\x20will\x20succeed\x20but\x20buyers\x20have\x20no\x20dispute\x20resolution\x20path.\x20'+'Recommended:\x20bind\x20arbitrations\x20before\x20publish.');!an&&am&&!ao&&h['push']('WARNING:\x20Depositing\x20compensation_fund\x20on\x20a\x20Service\x20without\x20arbitrations\x20bound.\x20'+'If\x20this\x20Service\x20is\x20already\x20published,\x20arbitration\x20rulings\x20will\x20not\x20be\x20able\x20to\x20'+'withdraw\x20compensation\x20from\x20this\x20Service.\x20Recommended:\x20bind\x20arbitrations\x20first,\x20'+'then\x20deposit\x20compensation_fund.');const ap=await buildGuardSubmissionPrompt(ak,'service',{'network':m?.['network'],'signer':m?.['account'],'service_address':typeof W?.['object']==='string'?W['object']:undefined});if(ap)h['push'](ap);let aq;if(W?.['order_new']&&typeof W?.['object']==='string'&&a562c('customer_intelligence'))try{aq=await evaluateServiceFromGraph(W['object'],{'context_network':m?.['network']});}catch{}const ar=permissionEchoWarning(ak,'Service',W);if(ar)h['push'](ar);const as=handleCallResult(ak,y(W,aq));return l(z,A,c['operation_type'],ak,c['data'])['catch'](()=>{}),as;}case'machine':{if(c['data']['node']&&typeof c['data']['node']==='object'&&'json_or_markdown_file'in c['data']['node']){const bo=c['data']['node']['json_or_markdown_file'];let bp;try{const br=resolve(bo);bp=readFileSync(br,'utf-8');}catch(bs){throw new Error('Failed\x20to\x20read\x20file\x20\x27'+bo+'\x27:\x20'+bs['message']);}const bq=parseMachineNodesFromText(bp);if(!bq['success']){const bt=a562a(bq['errors']);throw new Error('Machine\x20node\x20validation\x20failed\x20for\x20file\x20\x27'+bo+'\x27:\x0a\x0a'+bt);}if(!bq['data'])throw new Error('No\x20nodes\x20found\x20in\x20file\x20\x27'+bo+'\x27');h['push']('json_or_markdown_file\x20mode:\x20file\x20\x27'+bo+'\x27\x20parsed\x20to\x20'+bq['data']['length']+'\x20node(s)\x20and\x20'+'mapped\x20to\x20op:\x27add\x27\x20+\x20bReplace:true\x20(complete\x20in-place\x20replacement).\x20op:\x27set\x27\x20is\x20not\x20used\x20because\x20'+'it\x20is\x20rejected\x20on\x20an\x20existing\x20Machine;\x20on\x20a\x20fresh\x20Machine\x20the\x20two\x20are\x20equivalent.'),c['data']['node']={'op':'add','nodes':bq['data'],'bReplace':!![]};if(c['data']?.['publish']===!![]){const bu=machinePublishGateViolation(bq['data']);if(bu)throw new Error('Machine\x20publish\x20pre-check\x20failed\x20for\x20file\x20\x27'+bo+'\x27:\x0a\x0a'+bu);}}const bb=c['data'],bc=await checkMachinePermissionBeforePublish(bb,m);bc&&h['push'](bc);const bd=bb?.['node']?.['nodes']??bb?.['node'];try{const bv=typeof bb?.['object']==='object'&&bb?.['object']!==null?bb['object']?.['name']:bb?.['object'];recordMachineNodeNames(bv,bd);}catch{}if(Array['isArray'](bd)){const bw=/^(dispute|disputed|arbitration|arb_|arb\.|resolve_dispute|start_arbitration|open_dispute)/i;for(const bx of bd){const by=typeof bx==='object'?bx?.['name']:'';typeof by==='string'&&bw['test'](by)&&h['push']('ARBITRATION\x20SEPARATION\x20WARNING:\x20Machine\x20node\x20\x22'+by+'\x22\x20appears\x20to\x20be\x20an\x20arbitration-related\x20node.\x0a'+'CORE\x20PRINCIPLE:\x20A\x20merchant\x20cannot\x20handle\x20disputes\x20fairly\x20—\x20they\x20would\x20be\x20\x27both\x20player\x20and\x20referee\x27.\x0a'+'The\x20WoWok\x20smart\x20contract\x20design\x20makes\x20Arbitration\x20a\x20completely\x20separate\x20object:\x0a'+'\x20\x20-\x20Arbitration\x20has\x20its\x20own\x20Permission,\x20voting_guard,\x20usage_guard,\x20and\x20balance\x0a'+'\x20\x20-\x20Arb\x20instances\x20have\x20a\x207-state\x20lifecycle\x20managed\x20by\x20Arbitration,\x20not\x20by\x20Machine\x0a'+'\x20\x20-\x20The\x20Order\x20object\x20is\x20the\x20bridge:\x20it\x20has\x20\x27progress\x27\x20(Machine)\x20and\x20\x27dispute\x27\x20(Arb\x20list)\x20fields\x0a'+'\x20\x20-\x20When\x20Arb\x20rules,\x20the\x20Order\x20executes\x20the\x20compensation\x20—\x20the\x20ONLY\x20connection\x20to\x20the\x20business\x20flow\x0a\x0a'+'CORRECT\x20PATTERN:\x0a'+'\x20\x20-\x20Machine:\x20business\x20states\x20only\x20(ordered\x20->\x20shipped\x20->\x20delivered\x20->\x20completed)\x0a'+'\x20\x20-\x20Arbitration:\x20separate\x20object\x20with\x20its\x20own\x20Permission\x20(NOT\x20shared\x20with\x20Service)\x0a'+'\x20\x20-\x20Arb:\x207-state\x20lifecycle\x20(Principal_confirming\x20->\x20Arbitrator_confirming\x20->\x20Voting\x20->\x20Arbitrated\x20->\x20Objectionable\x20->\x20Finished\x20->\x20Withdrawn)\x0a'+'\x20\x20-\x20R-M1-11:\x20NEVER\x20name\x20nodes\x20\x27refunded\x27/\x27disputed\x27/\x27arb\x27/\x27refund\x27\x20—\x20use\x20business\x20states\x20(\x27cancelled\x27/\x27returned\x27)\x20for\x20dispute\x20OUTCOMES;\x20refunds\x20route\x20via\x20Allocator\x20triggered\x20by\x20those\x20states,\x20disputes\x20via\x20the\x20separate\x20Arbitration\x20object\x0a\x0a'+'If\x20this\x20node\x20name\x20is\x20a\x20legitimate\x20business\x20state\x20(not\x20arbitration),\x20ignore\x20this\x20warning.');}}if(Array['isArray'](bd)){const bz=bd['map'](bA=>bA&&typeof bA==='object'&&bA['role']?bA['name']+'='+bA['role']:null)['filter'](Boolean);bz['length']>0x0&&h['push']('NODE\x20ROLES\x20(metadata):\x20'+bz['join'](',\x20')+'.\x20Roles\x20are\x20display-layer\x20semantics\x20'+'(draft/active/delivered/final/cancelled)\x20—\x20they\x20are\x20NOT\x20stored\x20on-chain\x20(nodes\x20carry\x20'+'name+pairs\x20only).\x20Consumers:\x20render\x20state\x20icons/colors\x20from\x20roles;\x20nodes\x20tagged\x20'+'\x27final\x27/\x27cancelled\x27\x20are\x20settlement\x20endpoints\x20—\x20advancing\x20to\x20them\x20should\x20trigger\x20the\x20'+'fund-release\x20reminder\x20(Allocation\x20trigger),\x20not\x20further\x20business\x20steps.');}try{let bA=Array['isArray'](bd)?bd:undefined,bB;if(!bA&&bb?.['publish']===!![]){const bC=await fetchChainAnchorContext(bb?.['object'],m);bC&&(bA=bC['nodes'],bB=bC['profiles']);}if(!bd&&bb?.['publish']===!![]&&bA){const bD=machinePublishGateViolation(bA);bD&&h['push']('PUBLISH\x20GATE\x20(on-chain\x20publish\x20check):\x20'+bD);}if(bA){const bE=checkGuardAnchorReachability(bA,bB),bF=formatGuardAnchorWarnings(bE);if(bF)h['push'](bF);}if(bb?.['publish']===!![]&&bA){const bG=lintMachineGuardBindings(bA);if(bG)h['push'](bG);}}catch{}warnPermissionAutoCreation(c['data'],'Machine',h);const be=c['data']?.['object'],bf=typeof be==='string'?be:typeof be?.['name']==='string'?be['name']:undefined,bg={};try{if(typeof be==='string'&&be['startsWith']('0x'))bg['resolvedAddress']=be;else bf&&(bg['resolvedAddress']=await LocalMark['Instance']()['get_address'](bf)['catch'](()=>undefined)??undefined);bg['resolvedAddress']&&(bg['beforeCount']=(await fetchMachineNodes(bg['resolvedAddress'],m?.['network'],!![]))['length']);}catch{}const {reentry_kind:bh,...bi}=c['data'],bj=new CallMachine(bi),bk=c['submission']?await bj['call_with_submission'](m,await transformSubmission(c['submission'])):await bj['call'](m),bl=await buildGuardSubmissionPrompt(bk,'machine',{'network':m?.['network'],'signer':m?.['account'],'machine_address':c['data']?.['object']});if(bl)h['push'](bl);try{await emitMachineNodeReadback(bf,bg,c['data']?.['node']?.['op'],bd,bk,m?.['network'],h);}catch{}const bm=permissionEchoWarning(bk,'Machine',c['data']);if(bm)h['push'](bm);const bn=handleCallResult(bk,y(c['data']));return l(z,A,c['operation_type'],bk,c['data'])['catch'](()=>{}),bn;}case'progress':{if(c['data']?.['operate']){h['push']('Progress\x20routing\x20fact:\x20on\x20an\x20order-bound\x20Progress\x20this\x20operate\x20call\x20'+'auto-routes\x20to\x20the\x20order-bound\x20path,\x20so\x20namedOperator=\x22\x22\x20(order\x20payer)\x20'+'forwards\x20execute\x20here\x20directly\x20—\x20switching\x20to\x20order.progress\x20is\x20NOT\x20required.\x20'+'If\x20this\x20Progress\x20is\x20standalone\x20(no\x20task\x20binding),\x20namedOperator=\x22\x22\x20forwards\x20'+'cannot\x20be\x20advanced\x20by\x20anyone\x20(no\x20order\x20payer\x20exists);\x20use\x20a\x20non-empty\x20'+'namedOperator\x20or\x20a\x20permissionIndex\x20forward\x20instead.');const bN=String(c['data']?.['operate']?.['operation']?.['forward']??'');/review/i['test'](bN)&&!c['data']?.['operate']?.['message']&&h['push']('Review-forward\x20hint:\x20the\x20real\x20exec\x20path\x20de-facto\x20requires\x20operate.message\x20for\x20Review-type\x20'+'forwards\x20(schema\x20marks\x20it\x20optional;\x20a\x20no-message\x20Review\x20failed\x20repeatedly\x20on\x20mainnet\x20until\x20the\x20'+'message\x20was\x20added).\x20Include\x20message:\x20\x27<review\x20text>\x27\x20in\x20this\x20call');const bO=bN+'\x20'+String(c['data']?.['operate']?.['operation']?.['next_node_name']??'');(/return.*(recv|receive|inspect)/i['test'](bO)||/^returned$/i['test'](String(c['data']?.['operate']?.['operation']?.['next_node_name']??'')))&&h['push']('NO-RESTOCK\x20reminder:\x20on-chain\x20stock\x20is\x20never\x20auto-restocked\x20—\x20a\x20return\x20only\x20moves\x20the\x20'+'Progress,\x20the\x20inventory\x20listing\x20is\x20not\x20refilled\x20automatically.\x20If\x20the\x20returned\x20goods\x20are\x20'+'resellable,\x20restock\x20the\x20sellable\x20item\x20via\x20the\x20sales\x20listing\x20before\x20relisting.');}const bH=typeof c['data']?.['review']?.['orderRef']==='string'?c['data']['review']['orderRef']:typeof c['data']?.['task']==='string'?c['data']['task']:undefined,bI=c['data']?.['review']&&c['submission']?await runReviewRepositoryWrite({'env':m,'submission':c['submission'],'review':c['data']['review'],'orderRef':bH}):[],bJ=await snapshotProgressNodePreAdvance(c['data'],m),bK=new CallProgress(c['data']);let bL=c['submission']?await bK['call_with_submission'](m,await transformSubmission(c['submission'])):await bK['call'](m);if(!c['submission']&&isSubmissionMissingEcho(bL)){const bP=await resolveOrderRefForBackfill(c['data']?.['task']),bQ=buildAutoFilledSubmission(bL,bP);bQ&&(bL=await bK['call_with_submission'](m,await transformSubmission(bQ)),h['push']('254\x20AUTO-BACKFILL:\x20the\x20pending\x20input\x20was\x20the\x20protocol\x20order\x20slot\x20(254)\x20—\x20filled\x20from\x20'+('this\x20operation\x27s\x20order\x20reference\x20('+bP+')\x20and\x20the\x20forward\x20was\x20re-driven\x20in-process,\x20')+'saving\x20the\x20manual\x20refill\x20round-trip.'));}if(!c['submission']&&bL&&typeof bL==='object'&&'submission'in bL){const bR=bL['submission'];if(Array['isArray'](bR)&&bR['length']>0x0){const bS=bR[0x0]?.['guard'];if(bS){const bT={'operation':'progress_next','network':m?.['network'],'signer':m?.['account'],'progress_address':c['data']?.['object'],'order_address':c['data']?.['task']},bU=await generateGuardSubmissionPrompt(bS,bT);bU&&h['push'](formatSubmissionPrompt(bU));}}}const bM=handleCallResult(bL,y(c['data']));bI['length']>0x0&&!(bL&&typeof bL==='object'&&'digest'in bL&&bL?.['effects']?.['status']?.['status']==='success')&&mergeReviewStepsIntoOutput(bM,bI,{'forwardOutcome':'failed\x20or\x20unconfirmed\x20—\x20the\x20pre-forward\x20review\x20write\x20MAY\x20have\x20landed\x20already\x20'+'(verify\x20via\x20the\x20repository\x20row\x20before\x20any\x20retry;\x20the\x20write\x20is\x20write-once)'});if(bL&&typeof bL==='object'&&'digest'in bL&&bL?.['effects']?.['status']?.['status']==='success'&&typeof c['data']?.['object']==='string'){const bV=c['data']?.['operate'],bW=bV?.['operation'],bX=await enrichWorkflowGuidance({'progressRef':c['data']['object'],'network':m?.['network'],'accountName':m?.['account'],'noCache':!![],'txResult':bL,'dryRun':m?.['dry_run']===!![],'compact':m?.['response_level']!=='full','operate':bW?.['forward']&&bW?.['next_node_name']?{'forward':bW['forward'],'next_node_name':bW['next_node_name'],'op':bV?.['op']}:undefined});mergeGuidanceIntoOutput(bM,bX,{'responseLevel':m?.['response_level']});}bL&&typeof bL==='object'&&'digest'in bL&&bL?.['effects']?.['status']?.['status']==='success'&&await annotateProgressAdvanceOutcome(bM,bJ,bL,m);if(bL&&typeof bL==='object'&&'digest'in bL&&bL?.['effects']?.['status']?.['status']==='success'&&c['data']?.['review']){const bY={'env':m,'submission':c['submission'],'review':c['data']['review'],'orderRef':bH},bZ=c['submission']?await runReviewRewardClaim(bY):await runReviewChain(bY),c0=[...bI,...bZ];if(c0['length']>0x0)mergeReviewStepsIntoOutput(bM,c0);else{if(c['data']?.['review'])try{if(bM?.['structuredContent']&&typeof bM['structuredContent']==='object'){const c1=bM['structuredContent'];if(!c1['semantic']||typeof c1['semantic']!=='object')c1['semantic']={};c1['semantic']['warnings']=[...Array['isArray'](c1['semantic']['warnings'])?c1['semantic']['warnings']:[],'data.review\x20was\x20declared\x20but\x20produced\x20no\x20chained\x20steps\x20(missing\x20repository\x20and\x20reward_claim)\x20—\x20no\x20review\x20was\x20written\x20and\x20no\x20reward\x20was\x20claimed.'];}}catch{}}}return l(z,A,c['operation_type'],bL,c['data'])['catch'](()=>{}),bM;}case'repository':{const c2=new CallRepository(c['data']),c3=c['submission']?await c2['call_with_submission'](m,await transformSubmission(c['submission'])):await c2['call'](m),c4=await buildGuardSubmissionPrompt(c3,'repository',{'network':m?.['network'],'signer':m?.['account'],'extra':{'repository':c['data']?.['object']}});if(c4)h['push'](c4);const c5=handleCallResult(c3,y(c['data']));return l(z,A,c['operation_type'],c3,c['data'])['catch'](()=>{}),c5;}case'arbitration':{const c6=await prepareFundOperation(c['data'],'arbitration',m?.['network']);if(c6['blockingErrors']['length']>0x0)return buildFundBlockResult(c6,'arbitration');h['push'](...c6['warnings']);if(c6['confirmation']){h['push'](c6['confirmation']['message']);const cf=a562b(c6['confirmation']);if(cf)h['push'](cf);}{const cg=c['data']['voting_deadline_change'],ch=cg?.['voting_deadline'];if(typeof ch==='number'&&ch<=Date['now']())return{'content':[{'type':'text','text':'voting_deadline_change\x20refused:\x20the\x20requested\x20deadline\x20is\x20not\x20in\x20the\x20future.\x20No\x20transaction\x20was\x20sent.'}],'structuredContent':{'result':{'type':'error','error':'voting_deadline\x20'+ch+'\x20is\x20<=\x20now\x20('+Date['now']()+').','error_code':'invalid_parameter','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'Set\x20voting_deadline_change.voting_deadline\x20to\x20an\x20ms-epoch\x20timestamp\x20STRICTLY\x20in\x20the\x20future\x20and\x20resubmit.\x20Moving\x20the\x20deadline\x20into\x20the\x20past\x20is\x20refused\x20client-side:\x20it\x20would\x20silently\x20revoke\x20every\x20other\x20arbitrator\x27s\x20remaining\x20vote\x20window\x20(instant-sovereignty\x20loophole).'},'message':'voting_deadline_change\x20refused\x20—\x20the\x20new\x20deadline\x20must\x20be\x20strictly\x20in\x20the\x20future.'}};}try{const ci=c['data']?.['dispute'];if(ci&&typeof c['data']?.['object']==='string'){const cj=c['data']['object'],ck=cj['startsWith']('0x')?cj:await LocalMark['Instance']()['get_address'](cj)??undefined;if(ck){const cl=await query_objects({'objects':[ck],'no_cache':!![],'network':m?.['network']}),cm=readRawOnchainAmount(((cl?.['objects']?.[0x0])?.['data']??cl?.['objects']?.[0x0])?.['fee']),cn=disputeFeeReceipt({'venueFee':cm});if(cn)h['push'](cn);}}}catch{}try{const co=c['data']?.['arbitration'],cp=typeof co?.['indemnity']==='number'?co['indemnity']:undefined;if(co&&typeof co['arb']==='string'&&cp!==undefined){const cq=co['arb']['startsWith']('0x')?co['arb']:await LocalMark['Instance']()['get_address'](co['arb'])??undefined;if(cq){const cr=await query_objects({'objects':[cq],'no_cache':!![],'network':m?.['network']}),cs=(cr?.['objects']?.[0x0])?.['data']??cr?.['objects']?.[0x0],ct=typeof cs?.['order']==='string'&&cs['order']['startsWith']('0x')?cs['order']:undefined;let cu,cv;if(ct){const cx=await query_objects({'objects':[ct],'no_cache':!![],'network':m?.['network']}),cy=(cx?.['objects']?.[0x0])?.['data']??cx?.['objects']?.[0x0];cu=readRawOnchainAmount(cy?.['amount']);if(typeof cy?.['service']==='string'&&cy['service']['startsWith']('0x')){const cz=await query_objects({'objects':[cy['service']],'no_cache':!![],'network':m?.['network']});cv=readRawOnchainAmount(((cz?.['objects']?.[0x0])?.['data']??cz?.['objects']?.[0x0])?.['compensation_fund']);}}const cw=awardPoolCapacityPosture({'indemnity':cp,'pool':cv,'orderAmount':cu});h['push'](awardPoolCapacityReceipt(cw,{'indemnity':cp,'pool':cv,'orderAmount':cu}));}}}catch{}const c7=new CallArbitration(c['data']),c8=c['submission']?await c7['call_with_submission'](m,await transformSubmission(c['submission'])):await c7['call'](m),c9=await buildGuardSubmissionPrompt(c8,'arbitration',{'network':m?.['network'],'signer':m?.['account'],'extra':{'arbitration':c['data']?.['object']}});if(c9)h['push'](c9);const ca=c['data']?.['object'],cb=ca!==null&&typeof ca==='object';cb&&c['data']?.['pause']!==![]&&(h['push']('ARBITRATION\x20ACTIVATION\x20REQUIRED:\x20a\x20newly\x20created\x20Arbitration\x20defaults\x20to\x20bPaused=true\x20—\x20'+'dispute\x20filing\x20aborts\x20with\x20E_PAUSED\x20until\x20unpaused.\x20Issue\x20'+'{operation_type:\x27arbitration\x27,\x20data:{object:\x27<arb>\x27,\x20pause:false}}\x20before\x20binding\x20it\x20'+'to\x20a\x20Service\x20or\x20accepting\x20disputes.\x20NOTE:\x20unpausing\x20requires\x20permission\x20356\x20—\x20'+'the\x20creator\x20passes\x20this\x20check\x20as\x20the\x20new\x20Permission\x27s\x20admin\x20(admins\x20are\x20exempt\x20'+'from\x20permission\x20checks);\x20any\x20OTHER\x20operator\x20needs\x20an\x20explicit\x20356\x20grant\x20first.'),h['push']('PERMISSION\x20INITIALIZATION\x20REQUIRED:\x20a\x20freshly\x20created\x20Arbitration\x20has\x20NO\x20permission\x20'+'grants\x20(350-368\x20all\x20unassigned)\x20—\x20every\x20NON-admin\x20caller\x20aborts\x20with\x20\x27Missing\x20permission\x27\x20'+'(code\x205);\x20the\x20new\x20Permission\x27s\x20admin\x20(its\x20creator)\x20always\x20passes\x20and\x20needs\x20no\x20grants.\x20'+'OPEN\x20VOTING\x20IS\x20NOT\x20PERMISSIONLESS:\x20an\x20empty\x20voting_guard\x20means\x20every\x20358\x20(vote)\x20grantee\x20'+'votes\x20with\x20EQUAL\x20weight\x20(1\x20person\x201\x20vote)\x20—\x20vote()\x20asserts\x20358\x20unconditionally:\x20only\x20the\x20'+'arb\x27s\x20Permission\x20admin\x20(its\x20creator,\x20by\x20default)\x20and\x20explicit\x20358\x20grantees\x20can\x20vote,\x20so\x20'+'grant\x20358\x20to\x20BOTH\x20disputing\x20parties\x20and\x20every\x20intended\x20non-admin\x20voter,\x20or\x20voting\x20collapses\x20'+'to\x20admin-only\x20(the\x20arb\x20admin\x20is\x20the\x20sole\x20voter\x20AND\x20judge).\x20'+'Recommended\x20grants\x20via\x20the\x20Arbitration\x27s\x20Permission\x20object\x20(permission_index_add)\x20for\x20'+'NON-admin\x20operators:\x20356\x20(pause/unpause),\x20357\x20(fee),\x20362\x20(voting\x20deadline),\x20363\x20(reset),\x20'+'364-366\x20(withdraw/fees\x20alloc/transfer),\x20367-368\x20(owner\x20receive/UM);\x20'+'arbitrator:\x20361\x20(confirm\x20materials,\x20starts\x20voting)\x20+\x20359\x20(issue\x20ruling).'));if(cb)try{const cA=c['data'],cB=Array['isArray'](cA?.['voting_guard']?.['guards'])?cA['voting_guard']['guards']:[],cC=[];for(const cF of cB){const cG=cF?.['vote_weight']?.['FixedValue'];if(typeof cG==='number'&&Number['isFinite'](cG)&&cG>=0x0)cC['push'](cG);}const cD=cC['reduce']((cH,cI)=>cH+cI,0x0),cE=checkArbitrationVenueOrder({'unpaused_at_creation':cA?.['pause']===![]?!![]:undefined,'voting_guard_count':cB['length'],'max_weight_share':cB['length']>0x0&&cC['length']===cB['length']&&cD>0x0?Math['max'](...cC)/cD:undefined,'fee':cA?.['fee'],'has_description':typeof cA?.['description']==='string'&&cA['description']['trim']()!==''?!![]:cA?.['description']===undefined?![]:undefined})['filter'](cH=>cH['order_id']!=='V1-activation');for(const cH of cE)h['push'](cH['message']);h['push'](venueOperatingDoctrine());}catch{}const cc=c['data'],cd=ca!==null&&typeof ca==='string'&&cc?.['pause']===![];if(cd){const cI=c7['content']?.['fee'],cJ=cc?.['fee']??cI,cK=cJ===0x0||cJ==='0'||cJ==='0.0'||cJ==='0WOW';cJ!=null&&cK&&h['push']('FREE\x20ARBITRATION:\x20this\x20Arbitration\x20activates\x20with\x20fee\x20=\x200\x20—\x20dispute\x20filers\x20pay\x20nothing\x20'+'(any\x20coin\x20they\x20send\x20is\x20refunded\x20on\x20filing;\x20only\x20self.fee\x20is\x20escrowed\x20for\x20the\x20arbitrator).\x20'+'The\x20arbitrator\x20earns\x20no\x20per-case\x20income\x20from\x20this\x20service.\x20If\x20this\x20is\x20intentional\x20'+'(e.g.\x20a\x20free-dispute\x20commercial\x20model),\x20ignore\x20this\x20warning;\x20to\x20charge\x20per\x20case,\x20set\x20'+'a\x20fee:\x20{operation_type:\x27arbitration\x27,\x20data:{object:\x27<arb>\x27,\x20fee:<amount>}}.');}if(cc?.['dispute']!=null){const cL=cc['dispute']?.['fee']?.['balance'],cM=c7['content']?.['fee'];h['push'](disputeFeeReconciliation(cM,cL));}if(typeof cc?.['vote']?.['arb']==='string'&&typeof m?.['account']==='string')try{const cN=cc['vote']['arb']['startsWith']('0x')?cc['vote']['arb']:await LocalMark['Instance']()['get_address'](cc['vote']['arb'])??undefined;if(cN){const cO=await query_objects({'objects':[cN],'no_cache':!![],'network':m?.['network']}),cP=cO?.['objects']?.[0x0],cQ=cP?.['data']??cP,cR=Array['isArray'](cQ?.['voting_guard'])?cQ['voting_guard']['filter'](Boolean):[];if(cR['length']===0x0){const cS=typeof cQ?.['permission']==='string'?cQ['permission']:undefined;if(cS){const cT=await query_objects({'objects':[cS],'no_cache':!![],'network':m?.['network']}),cU=cT?.['objects']?.[0x0],cV=cU?.['data']??cU,cW=Array['isArray'](cV?.['admin'])?cV['admin']:[];if(!cW['includes'](m['account'])){const cX=await fetchEntityPermissions(cS,m?.['network']),cY=cX['get'](m['account'])??[];!cY['includes'](0x166)&&h['push']('VOTE\x20PRE-FLIGHT:\x20account\x20'+m['account']+'\x20holds\x20NO\x20permission\x20358\x20on\x20this\x20Arbitration\x27s\x20'+'Permission\x20('+cS+'),\x20and\x20the\x20arb\x20has\x20no\x20voting_guard\x20(plain-vote\x20mode\x20asserts\x20358\x20'+'unconditionally)\x20—\x20this\x20vote\x20will\x20be\x20REFUSED\x20before\x20any\x20transaction\x20is\x20sent.\x20Remedy:\x20the\x20arb\x27s\x20'+'Permission\x20admin\x20grants\x20358\x20(permission_index_add\x20on\x20'+cS+';\x20equal-weight\x201-person-1-vote),\x20'+'or\x20the\x20voter\x20uses\x20the\x20weighted\x20path\x20vote.voting_guard=<registered\x20guard>\x20(passport-authorized,\x20no\x20358).\x20'+'NOTE:\x20if\x20a\x20transport\x20\x27fetch\x20failed\x27\x20surfaces\x20during\x20the\x20permission\x20read,\x20the\x20vote\x20was\x20NOT\x20submitted\x20—\x20'+'nothing\x20is\x20sent\x20until\x20the\x20permission\x20check\x20passes;\x20do\x20not\x20run\x20commit-state\x20verification.');}}}else{if(cc['vote']['voting_guard']==null){const cZ=cR['map'](d0=>String(d0?.['guard']??d0))['join'](',\x20');h['push']('VOTE\x20PRE-FLIGHT\x20(B-38):\x20this\x20Arbitration\x20carries\x20'+cR['length']+'\x20registered\x20voting_guard(s)\x20['+cZ+']\x20—\x20a\x20PLAIN\x20vote\x20(no\x20data.vote.voting_guard)\x20'+'aborts\x20on-chain\x20with\x20E_VOTING_GUARD_USED\x20(abort\x202)\x20and\x20the\x20transaction\x20is\x20LOST.\x20Resubmit\x20with\x20'+'the\x20two-step\x20shape:\x20{operation_type:\x27arbitration\x27,\x20data:{vote:{arb:\x27<arb>\x27,\x20voting_guard:\x27<one\x20of\x20the\x20guards\x20above>\x27,\x20...}}}\x20'+'(the\x20weighted\x20path\x20authorizes\x20via\x20the\x20guard\x27s\x20passport\x20and\x20does\x20NOT\x20require\x20permission\x20358).');}}}}catch{}if(c['data']?.['arbitration']){let d0='';try{const d1=c['data']['arbitration'],d2=typeof d1?.['arb']==='string'?d1['arb']['startsWith']('0x')?d1['arb']:await LocalMark['Instance']()['get_address'](d1['arb'])??undefined:undefined;if(d2){const d3=await query_objects({'objects':[d2],'no_cache':!![],'network':m?.['network']}),d4=d3?.['objects']?.[0x0]?.['data']??d3?.['objects']?.[0x0],d5=typeof d4?.['order']==='string'&&d4['order']['startsWith']('0x')?d4['order']:undefined;let d6;if(d5){const d7=await query_objects({'objects':[d5],'no_cache':!![],'network':m?.['network']}),d8=d7?.['objects']?.[0x0]?.['data']??d7?.['objects']?.[0x0];d6=typeof d8?.['allocation']==='string'&&d8['allocation']['startsWith']('0x')?d8['allocation']:undefined;}d0='\x20ESCROW\x20RELEASE\x20AFTER\x20THIS\x20CASE\x20—\x20'+await dualPayoutReleaseGuidance({'allocAddr':d6,'indemnityRaw':typeof d1?.['indemnity']==='number'?d1['indemnity']:undefined,'network':m?.['network']});}}catch{}h['push']('RULING\x20DOES\x20NOT\x20SETTLE\x20ESCROW:\x20this\x20ruling\x20records\x20the\x20feedback\x20+\x20indemnity\x20on\x20the\x20Arb\x20case\x20'+'object\x20ONLY\x20—\x20it\x20moves\x20no\x20funds\x20and\x20does\x20NOT\x20adjust\x20the\x20order\x27s\x20escrow\x20(the\x20Machine\x20workflow\x20'+'and\x20its\x20Allocation\x20are\x20independent\x20of\x20arbitration;\x20there\x20is\x20no\x20on-chain\x20linkage).\x20To\x20actually\x20'+'pay\x20the\x20buyer,\x20the\x20dispute\x20must\x20be\x20confirmed\x20and\x20then\x20claimed\x20via\x20'+'{operation_type:\x27order\x27,\x20data:{object:\x27<order>\x27,\x20arb_claim_compensation:{...}}}\x20—\x20the\x20indemnity\x20'+'is\x20paid\x20from\x20the\x20Service\x27s\x20merchant-prepaid\x20compensation_fund\x20(NOT\x20from\x20escrow),\x20capped\x20at\x203x\x20the\x20'+'order\x20amount,\x20and\x20it\x20does\x20NOT\x20re-split\x20the\x20allocator\x20ratios\x20(partial\x20/\x20proportional\x20refunds\x20via\x20a\x20'+'verdict\x20are\x20not\x20expressible\x20on-chain).\x20Because\x20the\x20two\x20tracks\x20are\x20independent,\x20the\x20buyer\x20can\x20still\x20'+'be\x20paid\x20the\x20FULL\x20escrow\x20AND\x20the\x20indemnity:\x20to\x20prevent\x20the\x20dual\x20payout,\x20freeze\x20the\x20settlement\x20by\x20'+'holding\x20the\x20order\x27s\x20edge\x20to\x20\x27completed\x27\x20before\x20it\x20settles\x20(hold\x20permission\x20=\x20the\x20forward\x27s\x20execute\x20'+'permission;\x20a\x20merchant-only\x20edge\x20needs\x20the\x20merchant\x20or\x20keeper\x20to\x20hold\x20it).'+d0),h['push']('ESCROW\x20FORENSICS\x20(refund-then-claim):\x20the\x20reverse\x20ordering\x20—\x20escrow\x20refund\x20first,\x20indemnity\x20'+'claim\x20second\x20—\x20is\x20NOT\x20on-chain\x20blocked,\x20but\x20it\x20IS\x20on-chain\x20distinguishable.\x20The\x20order-side\x20fund\x20'+'facts\x20(amount,\x20escrow\x20balance,\x20withdraw\x20history\x20with\x20per-payout\x20recipient\x20polarity,\x20claimed_by,\x20'+'workflow\x20node)\x20are\x20attached\x20to\x20this\x20result\x20as\x20order_fund_facts,\x20and\x20to\x20every\x20query\x20of\x20this\x20Arb\x20case\x20'+'as\x20_order_fund_facts\x20—\x20read\x20them\x20before\x20finalizing\x20the\x20indemnity.\x20POLARITY\x20DECIDES\x20THE\x20NETTING\x20'+'(rex5\x20B-66):\x20payouts\x20released\x20TO\x20THE\x20ORDER\x20(buyer-side\x20refund\x20rail)\x20→\x20net\x20the\x20award\x20against\x20the\x20'+'refunded\x20principal,\x20compensate\x20the\x20delta;\x20payouts\x20released\x20to\x20NON-order\x20recipients\x20(merchant/Entity\x20'+'side\x20—\x20settlement\x20or\x20recover)\x20→\x20the\x20buyer\x20received\x20nothing\x20from\x20those,\x20their\x20loss\x20is\x20the\x20FULL\x20price\x20'+'and\x20the\x20award\x20must\x20NOT\x20be\x20reduced.\x20A\x20positive\x20escrow_deficit\x20alone\x20proves\x20only\x20that\x20money\x20LEFT\x20the\x20'+'escrow,\x20never\x20who\x20received\x20it.\x20The\x20defendant\x20can\x20attach\x20the\x20same\x20forensics\x20to\x20the\x20case\x20statement.');}const ce=handleCallResult(c8,y(c['data']));try{const d9=!!c8&&typeof c8==='object'&&c8?.['effects']?.['status']?.['status']==='success';if(d9){const da=c['data'],db=da?.['vote']?.['arb']??da?.['confirm']?.['arb']??da?.['arbitration']?.['arb']??da?.['reset']?.['arb']??da?.['feedback']?.['arb']??da?.['arb_withdraw']?.['arb']??da?.['voting_deadline_change']?.['arb'],dc=da?.['dispute']?.['order'];if(db||dc){const dd=await buildOrderFundFacts({'arbRef':db,'orderRef':dc,'network':m?.['network']});dd&&(ce['structuredContent']['order_fund_facts']=dd['structured'],ce['content']['push']({'type':'text','text':dd['text']}));}}}catch{}try{const de=c['data'],df=!!c8&&typeof c8==='object'&&c8?.['effects']?.['status']?.['status']==='success',dg=!!(de?.['confirm']||de?.['vote']||de?.['arbitration']);df&&dg&&Array['isArray'](ce['content'])&&ce['content']['push']({'type':'text','text':'MONEY-MOVEMENT\x20CHECKLIST\x20—\x20this\x20adjudication\x20step\x20wrote\x20case\x20STATE\x20only\x20'+'(status\x20/\x20feedback\x20/\x20indemnity);\x20it\x20moved\x20NO\x20funds\x20and\x20paid\x20no\x20one:\x20no\x20wallet\x20balance\x20changed\x20'+'and\x20the\x20escrowed\x20case\x20fee\x20is\x20still\x20in\x20the\x20Arb\x20case.\x20To\x20actually\x20move\x20the\x20arbitration\x20fee,\x20'+'continue\x20in\x20order:\x20(1)\x20arb_withdraw\x20—\x20pulls\x20the\x20case\x20fee\x20into\x20the\x20Arbitration\x20(Registration)\x20'+'object\x27s\x20balance\x20pool\x20(immediately\x20from\x20state\x205\x20Finished;\x20from\x20state\x203\x20only\x20after\x20the\x2030-day\x20'+'no-objection\x20window;\x20refused\x20in\x20states\x200/1/2,\x20never\x20in\x20state\x204);\x20'+'(2)\x20fees_transfer\x20—\x20moves\x20the\x20Arbitration\x27s\x20ENTIRE\x20balance\x20pool\x20in\x20ONE\x20call\x20to\x20'+'to.allocation\x20(an\x20Allocation\x20object)\x20or\x20to.treasury\x20(a\x20Treasury\x20object),\x20single-key\x20\x27to\x27\x20'+'shape,\x20payment_index\x20required\x20(see\x20the\x20fees_transfer\x20field\x20description);\x20'+'(3)\x20treasury\x20target\x20only\x20—\x20treasury\x20receive:\x20\x22recently\x22\x20(permission\x20253)\x20intakes\x20the\x20'+'arrived\x20CoinWrapper,\x20then\x20treasury\x20withdraw\x20pays\x20out.\x20A\x20successful\x20arb_withdraw\x20with\x20no\x20'+'wallet\x20balance\x20change\x20is\x20EXPECTED\x20—\x20the\x20fee\x20sits\x20in\x20the\x20Arbitration\x20object\x27s\x20pool\x20until\x20'+'step\x20(2).\x20The\x20order-escrow\x20/\x20indemnity\x20track\x20is\x20independent\x20of\x20this\x20fee\x20track.'});}catch{}return l(z,A,c['operation_type'],c8,c['data'])['catch'](()=>{}),ce;}case'contact':{warnPermissionAutoCreation(c['data'],'Contact',h);const dh=new CallContact(c['data']),di=c['submission']?await dh['call_with_submission'](m,await transformSubmission(c['submission'])):await dh['call'](m),dj=await buildGuardSubmissionPrompt(di,'contact',{'network':m?.['network'],'signer':m?.['account']});if(dj)h['push'](dj);const dk=handleCallResult(di,y(c['data']));return l(z,A,c['operation_type'],di,c['data'])['catch'](()=>{}),dk;}case'treasury':{const dl=await prepareFundOperation(c['data'],'treasury',m?.['network']);if(dl['blockingErrors']['length']>0x0)return buildFundBlockResult(dl,'treasury');h['push'](...dl['warnings']);if(dl['confirmation']){h['push'](dl['confirmation']['message']);const dr=a562b(dl['confirmation']);if(dr)h['push'](dr);}const dm=new CallTreasury(c['data']),dn=c['submission']?await dm['call_with_submission'](m,await transformSubmission(c['submission'])):await dm['call'](m),dp=await buildGuardSubmissionPrompt(dn,'treasury',{'network':m?.['network'],'signer':m?.['account'],'extra':{'treasury':c['data']?.['object']}});if(dp)h['push'](dp);const dq=handleCallResult(dn,y(c['data']));return l(z,A,c['operation_type'],dn,c['data'])['catch'](()=>{}),dq;}case'reward':{const ds=await prepareFundOperation(c['data'],'reward',m?.['network']);if(ds['blockingErrors']['length']>0x0)return buildFundBlockResult(ds,'reward');h['push'](...ds['warnings']);if(ds['confirmation']){h['push'](ds['confirmation']['message']);const dy=a562b(ds['confirmation']);if(dy)h['push'](dy);}assertRewardRecipientSemantics(c['data']?.['guard_add']),await assertRewardReplayStamp(c['data']?.['guard_add'],m?.['network'],h),await checkRewardOnceArming(c['data'],m?.['network'],h);const dt=transformRewardInput(c['data']),du=new CallReward(dt),dv=c['submission']?await du['call_with_submission'](m,await transformSubmission(c['submission'])):await du['call'](m);try{h['push'](...await verifyRewardEvidenceBindings(dv,c['data']?.['object'],c['data']?.['guard_add'],m?.['network']));}catch{}const dw=await buildGuardSubmissionPrompt(dv,'reward',{'network':m?.['network'],'signer':m?.['account'],'extra':{'reward':c['data']?.['object']}});if(dw)h['push'](dw);try{const dz=dv?.['digest'];if(c['data']?.['claim']!=null&&typeof dz==='string'&&dz!==''){const dA=await query_events({'type':'RewardClaimEvent','order':'descending','limit':0x5,'network':m?.['network'],'no_cache':!![]}),dB=buildClaimLedgerEcho(dA,dz);if(dB)h['push'](dB);}}catch{}const dx=handleCallResult(dv,y(c['data']));return l(z,A,c['operation_type'],dv,c['data'])['catch'](()=>{}),dx;}case'allocation':{const dC=await prepareFundOperation(c['data'],'allocation',m?.['network']);if(dC['blockingErrors']['length']>0x0)return buildFundBlockResult(dC,'allocation');h['push'](...dC['warnings']);if(dC['confirmation']){h['push'](dC['confirmation']['message']);const dK=a562b(dC['confirmation']);if(dK)h['push'](dK);}const dD=[];if(c['data']?.['alloc_by_guard']&&c['submission']){const dL=new Set();for(const dM of c['submission']['submission']||[]){for(const dN of dM?.['submission']||[]){const dO=typeof dN?.['value']==='string'?dN['value']:'';if(/^0x[0-9a-fA-F]{64}$/['test'](dO))dL['add'](dO);}}if(dL['size']>0x0)try{const dP=(await batchQueryObjectsByIds([...dL],m?.['network'],!![]))['filter'](dT=>dT?.['type']==='Order'),dQ=c['data']?.['acknowledge_dual_payout']===!![],dR=await storeDualPayoutVerdict(m);let dS={'track':'unknown'};try{const dT=c['data'],dU=dT?.['alloc_batch'],dV=Array['isArray'](dU)&&dU['length']>0x0?dU:[dT?.['object']],dW=[];for(const dX of dV){if(typeof dX!=='string')continue;if(/^0x[0-9a-fA-F]{64}$/['test'](dX)){dW['push'](dX);continue;}const dY=await LocalMark['Instance']()['get_address'](dX)['catch'](()=>undefined)??undefined;if(typeof dY==='string'&&dY['startsWith']('0x'))dW['push'](dY);}if(dW['length']>0x0){let dZ;const e0=dT?.['alloc_by_guard'];if(typeof e0==='string'&&/^0x[0-9a-fA-F]{64}$/['test'](e0))dZ=e0;else typeof e0==='string'&&(dZ=await LocalMark['Instance']()['get_address'](e0)['catch'](()=>undefined)??undefined);const e1=await batchQueryObjectsByIds(dW,m?.['network'],!![]),e2=e5=>e5['track']==='entity-directed'?0x0:e5['track']==='unknown'?0x1:0x2;let e3;const e4=new Set();for(const e5 of e1??[]){if(!e5)continue;const e6=classifyDualPayoutTrack(e5?.['allocators'],dZ);if(!e3||e2(e6)>e2(e3))e3=e6;if(e6['track']==='entity-directed'){for(const e7 of e6['recipients']??[])e4['add'](e7);}}e3&&(dS=e3['track']==='entity-directed'?{'track':'entity-directed','recipients':Array['from'](e4)}:e3);}}catch{}for(const e8 of dP){if(typeof e8['claimed_by']==='string'&&e8['claimed_by']['startsWith']('0x')){let e9;try{e9=(await batchQueryObjectsByIds([e8['claimed_by']],m?.['network'],!![]))?.['find'](ec=>ec?.['type']==='Arb');}catch{}const ea=e9?e9['indemnity']:undefined,eb=e9!=null&&(ea==null||String(ea['amount']??'0')==='0');if(eb){h['push']('DUAL\x20PAYOUT\x20N/A\x20(zero\x20indemnity):\x20Order\x20'+e8['object']+'\x27s\x20arbitration\x20case\x20'+e8['claimed_by']+'\x20CONCLUDED\x20with\x20ZERO\x20compensation\x20'+'(indemnity\x20none/0\x20—\x20nothing\x20was\x20paid\x20from\x20the\x20compensation\x20fund),\x20so\x20this\x20escrow\x20release\x20can\x20never\x20be\x20a\x20double\x20payout\x20'+'and\x20no\x20acknowledge_dual_payout\x20is\x20needed.\x20'+'Note:\x20on\x20LEGACY\x20rails\x20still\x20carrying\x20a\x20claimed_by\x20pairing\x20(pre-decision-11\x20shape)\x20the\x20on-chain\x20guard\x20may\x20REJECT\x20the\x20claimed_by-gated\x20leg\x20(guard_rejected);\x20decision-11\x20node-gated\x20rails\x20are\x20unaffected.');continue;}if(!dQ){if(dS['track']==='entity-directed'){const ec=ea!=null?String(ea['amount']??'?'):'unreadable';h['push']('DUAL\x20PAYOUT\x20ADVISORY\x20(entity-directed\x20release):\x20Order\x20'+e8['object']+'\x20carries\x20a\x20recorded\x20arbitration\x20indemnity\x20award\x20'+('(claimed_by='+e8['claimed_by']+';\x20indemnity\x20amount\x20'+ec+')\x20and\x20this\x20alloc_by_guard\x20releases\x20its\x20escrow\x20to\x20FIXED\x20')+('ENTITY\x20recipients\x20('+dS['recipients']['join'](',\x20')+')\x20—\x20no\x20buyer-receivable\x20leg,\x20so\x20the\x20buyer\x20')+'double-dip\x20block\x20does\x20not\x20apply.\x20Note\x20the\x20compensation\x20recipient\x20may\x20still\x20net\x20compensation\x20+\x20escrow\x20'+'(merchant\x20stacking);\x20verify\x20that\x20is\x20the\x20intended\x20commercial\x20outcome.\x20'+'Direction-blind\x20protocol:\x20the\x20order-move\x20entrypoint\x20exposes\x20NO\x20winner/direction\x20field,\x20so\x20the\x20ruling\x27s\x20beneficiary\x20is\x20not\x20machine-verifiable\x20—\x20'+'a\x20buyer-won\x20case\x20would\x20have\x20its\x20refund\x20leg\x20hard-blocked\x20while\x20THIS\x20leg\x20passes;\x20the\x20same\x20facts\x20ride\x20this\x20'+'response\x20as\x20structured\x20semantic.red_flags\x20(F-RQD2-05).'),dD['push']({'code':'merchant_stacking_possible','order':e8['object'],'arb_case':e8['claimed_by'],'indemnity_amount':ec,'escrow_recipients':dS['recipients'],'note':'entity-directed\x20escrow\x20release\x20passed\x20while\x20an\x20arbitration\x20indemnity\x20is\x20recorded\x20on\x20the\x20same\x20order;\x20the\x20protocol\x20exposes\x20no\x20winner/direction\x20field\x20so\x20the\x20ruling\x27s\x20beneficiary\x20is\x20not\x20machine-verifiable'});continue;}if(dS['track']==='order-directed'&&e9!=null&&!eb){const ed=ea!=null?String(ea['amount']??'?'):'?';h['push']('DUAL\x20PAYOUT\x20N/A\x20(buyer-win\x20principal\x20return):\x20Order\x20'+e8['object']+'\x27s\x20arbitration\x20case\x20'+e8['claimed_by']+'\x20recorded\x20a\x20non-zero\x20indemnity\x20'+('('+ed+'\x20—\x20ALREADY\x20PAID\x20from\x20the\x20merchant-funded\x20compensation\x20pool),\x20and\x20this\x20alloc_by_guard\x20releases\x20the\x20escrow\x20along\x20')+'order-directed\x20recipients\x20(on\x20refund\x20rails:\x20the\x20buyer\x20reclaiming\x20their\x20PRINCIPAL).\x20Two\x20independent\x20pools\x20each\x20paying\x20once\x20—\x20'+'compensation\x20from\x20the\x20merchant\x20fund,\x20principal\x20back\x20to\x20the\x20buyer\x20—\x20is\x20the\x20legitimate\x20arbitration\x20completion,\x20not\x20a\x20double\x20payout;\x20'+'no\x20acknowledge_dual_payout\x20is\x20demanded.\x20Note:\x20on\x20LEGACY\x20claimed_by-pairing\x20rails\x20(pre-decision-11\x20shape)\x20the\x20on-chain\x20guard\x20may\x20still\x20reject\x20the\x20claimed_by-gated\x20leg\x20'+'(guard_rejected);\x20decision-11\x20node-gated\x20rails\x20are\x20unaffected.');continue;}return{'content':[{'type':'text','text':'DUAL\x20PAYOUT\x20REFUSED\x20—\x20no\x20transaction\x20was\x20sent.\x20Order\x20'+e8['object']+'\x20carries\x20a\x20recorded\x20arbitration\x20indemnity\x20award\x20(claimed_by='+e8['claimed_by']+');\x20this\x20alloc_by_guard\x20would\x20ALSO\x20release\x20its\x20escrow'+(dS['track']==='order-directed'?'\x20to\x20order-directed\x20(guard-submitted)\x20recipients\x20—\x20on\x20refund\x20rails\x20that\x20is\x20the\x20buyer':'')+'\x20(escrow\x20+\x20compensation\x20stacked\x20on\x20the\x20same\x20order).\x0a\x0a'+KEEPER_DUAL_PAYOUT_DIRECTIVE}],'structuredContent':{'result':{'type':'error','error':'Order\x20'+e8['object']+'\x20carries\x20a\x20recorded\x20arbitration\x20indemnity\x20award\x20(claimed_by='+e8['claimed_by']+');\x20releasing\x20its\x20escrow\x20stacks\x20both\x20independent\x20payout\x20tracks\x20on\x20one\x20order'+(dS['track']==='order-directed'?'\x20(allocation\x20pays\x20order-directed\x20recipients)':'')+'\x20—\x20a\x20netting\x20decision\x20reserved\x20for\x20the\x20operator\x20via\x20acknowledge_dual_payout.','error_code':'dual_payout_unconfirmed','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'The\x20two\x20payout\x20tracks\x20are\x20independent\x20by\x20design:\x20the\x20chain\x20never\x20nets\x20them\x20and\x20the\x20escrow\x20receive\x20path\x20has\x20no\x20claimed_by\x20gate\x20—\x20but\x20if\x20this\x20service\x27s\x20rails\x20use\x20the\x20LEGACY\x20claimed_by\x20pairing\x20(pre-decision-11\x20shape:\x20refund\x20rail\x20claimed_by\x20none\x20/\x20paired\x20recover\x20rail\x20claimed_by\x20some),\x20the\x20on-chain\x20guard\x20may\x20REJECT\x20this\x20alloc\x20(guard_rejected);\x20that\x20rejection\x20is\x20the\x20legacy\x20pairing\x20working,\x20and\x20the\x20escrow\x20exits\x20via\x20the\x20paired\x20rail\x20instead\x20(decision-11\x20node-gated\x20rails\x20are\x20unaffected).\x20Re-send\x20the\x20SAME\x20call\x20with\x20acknowledge_dual_payout:true\x20ONLY\x20if\x20this\x20distribution\x20is\x20an\x20intentional\x20commercial\x20decision\x20(buyer\x20NET\x20=\x20compensation\x20+\x20escrow\x20refund).\x20If\x20this\x20is\x20a\x20plain\x20refund\x20of\x20an\x20un-awarded\x20order,\x20the\x20order\x20you\x20submitted\x20is\x20the\x20wrong\x20one\x20—\x20verify\x20the\x20order\x20address\x20before\x20retrying.\x20'+KEEPER_DUAL_PAYOUT_DIRECTIVE},'message':'Refused:\x20this\x20release\x20would\x20stack\x20an\x20escrow\x20release\x20on\x20top\x20of\x20a\x20recorded\x20arbitration\x20indemnity\x20award.\x20Set\x20acknowledge_dual_payout:true\x20to\x20accept\x20explicitly\x20(HUMAN\x20operator\x20decision\x20—\x20keepers\x20must\x20escalate,\x20never\x20self-ack).'}};}if(dQ&&!dR['authorized'])return{'content':[{'type':'text','text':'DUAL\x20PAYOUT\x20REFUSED\x20(preauthorization\x20missing)\x20—\x20no\x20transaction\x20was\x20sent.\x20Order\x20'+e8['object']+'\x20carries\x20a\x20recorded\x20arbitration\x20indemnity\x20award\x20(claimed_by='+e8['claimed_by']+')\x20and\x20this\x20alloc_by_guard\x20would\x20ALSO\x20release\x20its\x20escrow,\x20but\x20acknowledge_dual_payout\x20is\x20honored\x20ONLY\x20for\x20a\x20store\x20whose\x20human\x20merchant\x20recorded\x20the\x20standing\x20netting\x20decision\x20(config_operation\x20store_dual_payout_set\x20{account,\x20confirm:true});\x20the\x20executing\x20account\x20'+(dR['account']??'(unresolved)')+'\x20has\x20none.\x0a\x0a'+KEEPER_DUAL_PAYOUT_DIRECTIVE}],'structuredContent':{'result':{'type':'error','error':'acknowledge_dual_payout\x20on\x20Order\x20'+e8['object']+'\x20requires\x20a\x20store-level\x20dual-payout\x20preauthorization\x20for\x20account\x20'+(dR['account']??'(unresolved)')+'\x20—\x20the\x20per-call\x20flag\x20alone\x20is\x20the\x20self-ack\x20form\x20D-1\x20retired\x20(a\x20synthetic-store\x20agent\x20set\x20it\x20for\x20itself\x20in\x20the\x20ksr\x20round).','error_code':'dual_payout_preauthorization_required','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'The\x20human\x20merchant\x20records\x20the\x20standing\x20netting\x20decision\x20ONCE\x20per\x20store\x20via\x20config_operation\x20store_dual_payout_set\x20{account:\x20<store\x20signing\x20account>,\x20confirm:\x20true,\x20note};\x20after\x20that\x20the\x20SAME\x20call\x20with\x20acknowledge_dual_payout:true\x20proceeds.\x20Automated\x20agents\x20must\x20NEVER\x20record\x20the\x20preauthorization\x20themselves\x20—\x20that\x20confirmation\x20is\x20the\x20human\x27s,\x20escalate\x20instead.\x20'+KEEPER_DUAL_PAYOUT_DIRECTIVE},'message':'Refused:\x20acknowledge_dual_payout\x20requires\x20the\x20store-level\x20preauthorization\x20(D-1).\x20The\x20merchant\x20records\x20it\x20via\x20config_operation\x20store_dual_payout_set\x20{account,\x20confirm:true};\x20automated\x20agents\x20escalate\x20instead\x20of\x20recording\x20it\x20themselves.'}};h['push']('DUAL\x20PAYOUT\x20ACKNOWLEDGED:\x20Order\x20'+e8['object']+'\x20carries\x20a\x20recorded\x20arbitration\x20indemnity\x20award\x20'+('(claimed_by='+e8['claimed_by']+';\x20compensation-fund\x20claim\x20state\x20per\x20the\x20Arb\x20case)\x20and\x20this\x20call\x20ALSO\x20releases\x20its\x20escrow'+(dS['track']==='entity-directed'?'\x20to\x20fixed\x20entity\x20recipients\x20('+dS['recipients']['join'](',\x20')+')':'')+'\x20—\x20verify\x20the\x20net\x20payout\x20per\x20party\x20is\x20the\x20intended\x20commercial\x20outcome.\x20Proceeding\x20on\x20the\x20explicit\x20acknowledge_dual_payout\x20flag\x20backed\x20by\x20the\x20store-level\x20preauthorization'+(dR['authorized_at']?'\x20recorded\x20'+dR['authorized_at']:'')+'\x20(D-1).'));}}}catch{}}if(c['data']?.['allocators']){const ee=await checkEntityRecipientGate(c['data']?.['allocators'],'allocation.allocators',h);if(ee)return ee;}let dE='';const dF=new CallAllocation(c['data']);c['data']?.['alloc_by_guard']&&(dE=beginInFlight('alloc_by_guard',c['data'],m,c['submission']));const dG=c['submission']?await dF['call_with_submission'](m,await transformSubmission(c['submission'])):await dF['call'](m);if(dE)recordInFlightOutcome(dE,dG);const dH=await buildGuardSubmissionPrompt(dG,'allocation',{'network':m?.['network'],'signer':m?.['account'],'allocation_address':c['data']?.['object']});if(dH)h['push'](dH);const dI=c['data'];if(dI?.['alloc_by_guard']){const ef=ResponseData(dG)['filter'](eg=>eg?.['type']==='Payment'&&eg?.['change']==='created');if(ef['length']>0x0){const eg=ef['map'](eh=>eh['object'])['join'](',\x20');try{const eh=await batchQueryObjectsByIds(ef['map'](em=>em['object']),m?.['network'],!![]),ei=[];let ej=BigInt(0x0);const ek=[];let el=![];for(const em of eh){if(em?.['type']==='Payment'&&em?.['record']){for(const en of em['record']){const eo=formatRecipientLabel(en['recipient']),ep=typeof en['amount']==='string'?en['amount']:String(en['amount']),eq=BigInt(ep);ej+=eq,ei['push']('\x20\x20•\x20'+eo+':\x20'+formatMistAmount(eq));const er=classifyRecipient(en['recipient']);if(er?.['kind']==='entity'&&m?.['account']&&er['address']['toLowerCase']()===String(m['account'])['toLowerCase']())el=!![],ek['push']('\x20\x20•\x20'+eo+':\x20ALREADY\x20SPENDABLE\x20by\x20you\x20(caller\x20==\x20recipient\x20—\x20the\x20SDK\x27s\x20follow-up\x20auto-claim\x20transaction\x20right\x20after\x20this\x20alloc\x20unwraps\x20it;\x20this\x20alloc\x20tx\x20itself\x20only\x20created\x20the\x20wrapper,\x20no\x20claim\x20step\x20remains;\x20a\x20follow-up\x20payment\x20receive\x20will\x20correctly\x20report\x20no\x20pending\x20claim)');else{if(er?.['kind']==='submission')ek['push']('\x20\x20•\x20'+eo+':\x20the\x20ORDER\x20OWNER\x20receives\x20—\x20call\x20the\x20order\x27s\x20receive/claim\x20entry');else{if(er?.['kind']==='signer')ek['push']('\x20\x20•\x20'+eo+':\x20the\x20CALLER\x20receives\x20—\x20payment\x20receive\x20as\x20the\x20caller');else er?.['kind']==='entity'?ek['push']('\x20\x20•\x20'+eo+':\x20that\x20account\x20receives\x20—\x20payment\x20receive\x20as\x20'+formatRecipientLabel(en['recipient'])):ek['push']('\x20\x20•\x20'+eo+':\x20query\x20the\x20Payment\x20object\x27s\x20record\x20for\x20the\x20claim\x20path');}}}em['object']&&ei['push']('\x20\x20•\x20Payment\x20object:\x20'+em['object']);}}if(ei['length']>0x0){ei['unshift']('DISTRIBUTION\x20DETAILS\x20(alloc_by_guard):'),ei['push']('\x20\x20─────────────────','\x20\x20•\x20Total\x20distributed:\x20'+formatMistAmount(ej));const es=eh['some'](et=>et?.['type']==='Payment'&&et?.['info']?.['for_object']);if(es){ej===BigInt(0x0)?ei['push']('','ESCROW\x20MODE\x20(nothing\x20owed):\x20total\x20distributed\x20is\x200\x20—\x20'+'nothing\x20is\x20being\x20held\x20for\x20claiming\x20and\x20no\x20distribution\x20is\x20pending.'):ei['push']('','ESCROW\x20MODE:\x20funds\x20are\x20held\x20in\x20the\x20Payment\x20wrapper(s)\x20above\x20'+'(Payment.for_object\x20points\x20to\x20an\x20Order)\x20—\x20claim\x20entry\x20PER\x20ROW:',...ek,'Note:\x20the\x20slot\x20number\x20shown\x20per\x20row\x20is\x20that\x20rail\x27s\x20DECLARED\x20'+'GuardIdentifier\x20(a\x20254\x20rail\x20legitimately\x20shows\x20254)\x20—\x20do\x20NOT\x20'+'infer\x20slot\x200\x20from\x20this\x20receipt.');if(el){const et=dG?.['auto_claim']?.['digest'];ei['push']('AUTO-CLAIMED\x20(SDK\x20follow-up\x20transaction):\x20at\x20least\x20one\x20row\x20had\x20caller\x20==\x20recipient\x20—\x20'+'a\x20SEPARATE\x20receive\x20transaction\x20fired\x20immediately\x20AFTER\x20this\x20alloc\x20unwrapped\x20that\x20share'+(et?'\x20(claim\x20digest:\x20'+et+')':'\x20(no\x20claim\x20digest\x20attached\x20—\x20the\x20alloc\x20caller\x27s\x20SDK\x20build\x20may\x20predate\x20auto_claim\x20attachment)')+';\x20THIS\x20alloc\x20transaction\x20itself\x20only\x20created\x20the\x20wrappers.\x20'+'The\x20share\x20is\x20already\x20spendable;\x20no\x20claim\x20step\x20remains.\x20A\x20follow-up\x20receive\x20reporting\x20'+'\x22already\x20unwrapped\x20or\x20auto-claimed\x22\x20is\x20the\x20EXPECTED\x20post-settlement\x20state,\x20not\x20a\x20failure.');}}h['push'](ei['join']('\x0a'));}}catch{h['push']('alloc_by_guard\x20created\x20Payment\x20object(s)\x20['+eg+'].\x20'+'Query\x20these\x20Payment\x20objects\x20to\x20see\x20the\x20distribution\x20details\x20and\x20check\x20for_object\x20for\x20escrow\x20mode.');}}else m?.['dry_run']===!![]?h['push']('DRY\x20RUN\x20(alloc_by_guard\x20'+dI['alloc_by_guard']+'):\x20simulation\x20succeeded.\x20'+'No\x20Payment\x20objects\x20exist\x20because\x20dry\x20runs\x20materialize\x20nothing\x20—\x20this\x20is\x20NOT\x20a\x20'+'\x22nothing\x20distributed\x22\x20signal.\x20Evaluate\x20the\x20sharing\x20plan\x20from\x20the\x20dry-run\x20balance\x20'+'output\x20above;\x20re-run\x20without\x20dry_run\x20to\x20execute.'):h['push']('NOTHING\x20DISTRIBUTED\x20(alloc_by_guard\x20'+dI['alloc_by_guard']+'):\x20the\x20transaction\x20'+'succeeded\x20but\x20created\x20NO\x20Payment\x20object,\x20so\x20no\x20funds\x20moved.\x20'+'The\x20guard\x20is\x20bound\x20to\x20this\x20allocation,\x20so\x20this\x20is\x20not\x20a\x20wrong-guard\x20mistake\x20—\x20the\x20'+'distribution\x20evaluated\x20to\x20zero.\x20Usual\x20causes:\x20the\x20sharing\x20plan\x20computes\x200\x20for\x20the\x20'+'remaining\x20balance,\x20the\x20pool\x20is\x20already\x20fully\x20distributed,\x20or\x20the\x20guard\x27s\x20once-slot\x20'+'was\x20already\x20consumed.\x20Do\x20NOT\x20report\x20this\x20allocation\x20as\x20executed.');}const dJ=handleCallResult(dG,y(c['data']));if(dD['length']>0x0&&dJ?.['structuredContent']&&typeof dJ['structuredContent']==='object')try{const eu=dJ['structuredContent'];if(!eu['semantic']||typeof eu['semantic']!=='object')eu['semantic']={};eu['semantic']['red_flags']=[...Array['isArray'](eu['semantic']['red_flags'])?eu['semantic']['red_flags']:[],...dD];}catch{}return l(z,A,c['operation_type'],dG,c['data'])['catch'](()=>{}),dJ;}case'permission':{const ev=c['operation_type'],ew=handlePermissionOperations(c['data'],m,y,h);return ew&&typeof ew==='object'&&'then'in ew&&ew['then'](ex=>{ex?.['structuredContent']?.['result']&&l(z,A,ev,ex['structuredContent']['result'],c['data'])['catch'](()=>{});})['catch'](()=>{}),ew;}case'guard':{const ex=c['data'],ey=ex['root'];if(ey?.['type']==='file'){const eD=ey,eE=resolve(eD['file_path']);let eF;try{eF=readFileSync(eE,'utf-8');}catch(eI){throw new Error('Failed\x20to\x20read\x20Guard\x20definition\x20file\x20\x27'+eD['file_path']+'\x27:\x20'+eI['message']);}const eG=parseGuardFile(eF,eD['format']);if(!eG['success']){const eJ=formatGuardParseErrors(eG['errors']);throw new Error('Guard\x20validation\x20failed\x20for\x20file\x20\x27'+eD['file_path']+'\x27:\x0a\x0a'+eJ);}const eH=eG['data'];ex['root']={'type':'node','node':eH['root']},eH['table']!==undefined&&ex['table']===undefined&&(ex['table']=eH['table']),eH['description']!==undefined&&ex['description']===undefined&&(ex['description']=eH['description']),eH['rely']!==undefined&&ex['rely']===undefined&&(ex['rely']=eH['rely']),eH['namedNew']!==undefined&&ex['namedNew']===undefined&&(ex['namedNew']=eH['namedNew']);}if(ex['root']&&typeof ex['root']==='object'){const eK=ex['root'];eK['type']==='node'&&eK['node']&&(ex['root']=eK['node']);}if(!ex['table']||ex['table']['length']===0x0)throw new Error('Guard\x20\x27table\x27\x20field\x20is\x20required\x20and\x20cannot\x20be\x20empty');if(!ex['root'])throw new Error('Guard\x20\x27root\x27\x20field\x20is\x20required');const ez=ex['table']['filter'](eL=>eL['b_submission']===![]&&Array['isArray'](eL['value'])&&eL['value']['length']===0x0);if(ez['length']>0x0)throw new Error('Guard\x20creation\x20blocked:\x20static\x20table\x20slot(s)\x20'+ez['map'](eL=>eL['identifier'])['join'](',\x20')+'\x20'+'carry\x20an\x20EMPTY\x20array\x20value.\x20Guard\x20table\x20construction\x20silently\x20DROPS\x20empty\x20vectors\x20—\x20these\x20rows\x20would\x20be\x20'+'MISSING\x20from\x20the\x20created\x20Guard\x20while\x20creation\x20still\x20succeeds.\x20Give\x20each\x20slot\x20a\x20non-empty\x20static\x20value,\x20'+'or\x20flip\x20it\x20to\x20b_submission=true\x20and\x20supply\x20the\x20value\x20at\x20Guard\x20trigger\x20time\x20'+'(protocol\x20once-slots:\x20255\x20keys\x20on\x20the\x20submitted\x20bytes,\x20254\x20on\x20the\x20chain-derived\x20object\x20key).');try{const eL=lintGuardNodeGates(parseGuardNodeGates(ex['root'],ex['table']));if(eL)h['push'](eL);}catch{}try{const eM=Array['isArray'](ex['table'])?ex['table']:[],eN=ex['binding_hint'],eO=parseGuardNodeGates(ex['root'],ex['table']),eP=eO['some'](eT=>REFUND_RAIL_NODE_REGEX['test'](eT)),eQ=eM['some'](eT=>{const eU=eT;return Number(eU?.['identifier'])===0x0&&eU?.['b_submission']===!![];}),eR=eN?.['action']==='allocate'||eN?.['binding_field']==='order_allocators',eS=lintTaskBindingAdvisories({'guardRef':ex['namedNew']?.['name'],'table':eM,'allocatorBound':!eP&&(eR||eQ),'refundReentry':eP});for(const eT of eS){h['push'](formatTaskBindingAdvisory(eT,'guard\x20create'));}}catch{}try{const eU=[],eV=eW=>{if(!eW||typeof eW!=='object')return;const eX=eW;if(eX['type']==='query'&&typeof eX['query']==='number'){const eY=getGuardQueryByIdOrName(eX['query']);eU['push']('query('+eX['query']+')\x20->\x20\x27'+(eY?.['name']??'NOT\x20IN\x20CATALOG')+'\x27');}for(const eZ of['parameters','nodes']){const f0=eX[eZ];if(Array['isArray'](f0))f0['forEach'](eV);}};eV(ex['root']),eU['length']>0x0&&h['push']('NUMERIC\x20QUERY\x20ID\x20RESOLUTION\x20(rndb58d8d\x20A2\x20—\x20verify\x20BEFORE\x20the\x20immutable\x20create):\x20'+(eU['join'](';\x20')+'.\x20A\x20numeric\x20ID\x20is\x20resolved\x20VERBATIM\x20at\x20runtime:\x20if\x20any\x20resolution\x20')+'above\x20is\x20NOT\x20the\x20field\x20you\x20intended,\x20STOP\x20and\x20rebuild\x20—\x20Guards\x20are\x20immutable,\x20and\x20a\x20'+'wrong-but-existing\x20ID\x20silently\x20checks\x20a\x20different\x20field\x20(it\x20only\x20fails\x20at\x20trigger\x20time,\x20'+'abort\x207,\x20without\x20naming\x20the\x20leg).\x20Prefer\x20the\x20NAMED\x20form\x20(e.g.\x20\x27order.amount\x27):\x20a\x20wrong\x20'+'name\x20fails\x20loudly\x20at\x20validation\x20instead\x20of\x20creating\x20a\x20mis-wired\x20Guard.');}catch{}const eA=new CallGuard(ex);let eB;try{eB=await eA['call'](m);}catch(eW){const eX=eW instanceof Error?eW['message']:String(eW),eY=translateGuardTypeError(eX);throw eY?new Error(eY):eW;}if(eB&&typeof eB==='object'&&'digest'in eB&&eB?.['effects']?.['status']?.['status']==='success'){try{const eZ=ResponseData(eB)['filter'](f1=>f1['change']==='created'&&typeof f1['type_raw']==='string'&&f1['type_raw']['includes']('::guard::'))['map'](f1=>String(f1['object']))[0x0],f0=ex['namedNew']?.['name'];console['warn']('[ConfirmGate]\x20guard\x20created\x20—\x20name='+(f0??'<unnamed>')+(eZ!==undefined?'\x20address='+eZ:'')+('\x20digest='+(eB['digest']??'?')));}catch{}try{const f1=ResponseData(eB)['filter'](f2=>f2['change']==='created'&&typeof f2['type_raw']==='string'&&f2['type_raw']['includes']('::guard::'))['map'](f2=>String(f2['object']))[0x0];recordCreatedGuard(ex['namedNew']?.['name'],f1);}catch{}try{const f2=ex['root']?.['type']??'<unknown>',f3=Array['isArray'](ex['table'])?ex['table']:[],f4=f3['length'],f5=f3['filter'](fb=>fb?.['b_submission']===!![])['length'],f6=ex['rely']?.['guards'],f7=Array['isArray'](f6)?f6['length']:0x0,f8=ex['rely']?.['logic_or']===!![]?'OR':ex['rely']?.['logic_or']===![]?'AND':'none',f9=['GUARD\x20LOGIC\x20SUMMARY:','\x20\x20•\x20root\x20type:\x20'+f2,'\x20\x20•\x20table\x20entries:\x20'+f4+'\x20('+f5+'\x20require\x20runtime\x20submission)'],fa=f3['filter'](fb=>fb?.['b_submission']===!![]);for(const fb of fa){const fc=typeof fb?.['value_type']==='string'?fb['value_type']:String(fb?.['value_type']??'?');f9['push']('\x20\x20•\x20submission\x20slot\x20'+fb?.['identifier']+':\x20value_type='+fc+'\x20—\x20forwards\x20bound\x20to\x20this\x20Guard\x20'+('must\x20advance\x20with\x20submissions:[{identifier:'+fb?.['identifier']+',\x20value_type:\x22'+fc+'\x22}]\x20')+'(Address\x20slots:\x20pass\x20the\x20Order\x20object\x20address)');}f7>0x0&&f9['push']('\x20\x20•\x20relies\x20on:\x20'+f7+'\x20guard(s)\x20(mode:\x20'+f8+')');if(ex['description']){const fd=String(ex['description'])['slice'](0x0,0x50);f9['push']('\x20\x20•\x20description:\x20\x22'+fd+'\x22');}h['push'](f9['join']('\x0a'));}catch{}try{const fe=parseGuardTimeBounds(ex['root'],ex['table']);if(fe){const ff=[],fg=ex['namedNew']?.['name'];typeof fg==='string'&&fg['trim']()&&ff['push'](fg['trim']());try{const fi=ResponseData(eB)['filter'](fj=>fj['change']==='created'&&fj['object']&&typeof fj['type_raw']==='string'&&fj['type_raw']['includes']('::guard::'))['map'](fj=>String(fj['object']));ff['push'](...fi);}catch{}if(ff['length']>0x0)recordGuardTimeProfile(ff,fe);const fh=fe['upperWindowMs']!==undefined?'Clock\x20<=\x20'+fe['anchor']+'\x20+\x20'+fe['upperWindowMs']+'ms':'Clock\x20>=\x20'+fe['anchor']+'\x20+\x20'+fe['lowerOffsetMs']+'ms';h['push']('TIME\x20ANCHOR:\x20this\x20Guard\x20uses\x20'+fh+'.\x20'+(fe['anchor']==='order.time'?'order.time\x20anchor\x20=\x20ORDER\x20CREATION\x20time\x20—\x20upper\x20windows\x20on\x20POST-checkout\x20branches\x20must\x20instead\x20anchor\x20progress.current_time\x20(query\x201272,\x20OrderProgress\x20witness),\x20otherwise\x20the\x20window\x20may\x20expire\x20before\x20the\x20branch\x20is\x20reachable\x20(§5.5\x20dead\x20branch).\x20':'witness-derived\x20anchor\x20—\x20the\x20window\x20counts\x20from\x20entering\x20the\x20source\x20node\x20(serves\x20all\x20orders).\x20')+'The\x20Machine-side\x20reachability\x20check\x20will\x20cross-verify\x20when\x20these\x20Guards\x20are\x20bound\x20to\x20forwards.');}}catch{}try{const fj=ResponseData(eB)['filter'](fk=>fk['change']==='created'&&typeof fk['type_raw']==='string'&&fk['type_raw']['includes']('::guard::'))['map'](fk=>String(fk['object']));for(const fk of fj){const fl=await loadGuardJsonFromChain(fk,m?.['network']);if(!fl)continue;const fm=diffGuardSpecVsChain({'table':ex['table'],'root':ex['root'],'rely':ex['rely']},fl['json']);h['push'](fm['summary']);}}catch{}}const eC=handleCallResult(eB,y(c['data']));return l(z,A,c['operation_type'],eB,c['data'])['catch'](()=>{}),eC;}case'personal':{const fn=transformPersonalInput(c['data']),fo=new CallPersonal(fn),fp=await fo['call'](m),fq=handleCallResult(fp,y(c['data']));return l(z,A,c['operation_type'],fp,c['data'])['catch'](()=>{}),fq;}case'payment':{const fr=await prepareFundOperation(c['data'],'payment',m?.['network']);if(fr['blockingErrors']['length']>0x0)return buildFundBlockResult(fr,'payment');h['push'](...fr['warnings']);if(fr['confirmation']){h['push'](fr['confirmation']['message']);const fw=a562b(fr['confirmation']);if(fw)h['push'](fw);}const fs=c['data'];if(fs?.['receive']===!![]){const fx=typeof fs?.['object']==='string'&&fs['object']['length']>0x0;h['push']('RECEIVE\x20MODE\x20(order_claim):\x20You\x20are\x20unwrapping\x20CoinWrapper(s)\x20to\x20your\x20wallet.\x20'+'This\x20is\x20the\x20final\x20step\x20of\x20the\x20escrow\x20flow:\x0a'+'\x20\x201.\x20Allocation\x27s\x20alloc_by_guard\x20created\x20a\x20Payment\x20object\x20with\x20your\x20address\x20as\x20a\x20recipient\x0a'+'\x20\x202.\x20The\x20Payment\x27s\x20revenue\x20split\x20transferred\x20CoinWrapper(s)\x20to\x20your\x20wallet\x20(owned\x20but\x20not\x20spendable)\x0a'+'\x20\x203.\x20'+(fx?'THIS\x20operation\x20unwraps\x20the\x20specified\x20CoinWrapper\x20to\x20your\x20wallet':'AUTO-RECEIVE:\x20this\x20operation\x20unwraps\x20EVERY\x20CoinWrapper\x20currently\x20owned\x20by\x20you\x20in\x20a\x20single\x20transaction')+',\x20deleting\x20the\x20CoinWrapper(s)\x20and\x20transferring\x20the\x20underlying\x20coin\x20to\x20tx_context::sender\x0a'+'Requirements:\x0a'+'\x20\x20-\x20You\x20MUST\x20be\x20the\x20CoinWrapper\x27s\x20owner\x20(the\x20recipient\x20specified\x20in\x20the\x20Allocation)\x0a'+'\x20\x20-\x20type_parameter\x20is\x20OPTIONAL:\x20when\x20omitted\x20it\x20is\x20auto-derived\x20from\x20the\x20CoinWrapper\x27s\x20'+'own\x20on-chain\x20type\x20(the\x20inner\x20T\x20of\x20CoinWrapper<T>)\x0a'+(fx?'\x20\x20-\x20object\x20can\x20be\x20a\x20CoinWrapper\x20ID\x20(0x...)\x20or\x20a\x20local\x20mark\x20name\x0a':'\x20\x20-\x20When\x20\x27object\x27\x20is\x20omitted,\x20no\x20wrapper\x20lookup\x20is\x20needed\x20—\x20all\x20your\x20CoinWrappers\x20are\x20unwrapped\x20at\x20once\x0a')+'To\x20find\x20received\x20CoinWrappers:\x20call\x20query_toolkit\x20with\x20query_type=\x27onchain_received\x27\x20'+'and\x20type=\x27CoinWrapper\x27\x20for\x20your\x20account.\x20'+'xk9\x20F-44:\x20when\x20onchain_received\x20is\x20empty,\x20AUTO-RECEIVE\x20no\x20longer\x20trusts\x20\x27already\x20claimed\x27\x20—\x20it\x20backtracks\x20your\x20recent\x20received\x20transactions\x20for\x20TxBuffer-stuck\x20wrappers\x20and\x20claims\x20them\x20in\x20the\x20same\x20call;\x20only\x20a\x20scan-confirmed\x20empty\x20state\x20reports\x20auto_claimed.\x0a'+'After\x20success:\x20verify\x20your\x20balance\x20increased\x20via\x20account_balance\x20query.');}else{if(fs?.['revenue']){h['push']('CREATE\x20MODE:\x20Creating\x20a\x20new\x20Payment\x20object.\x20Payments\x20are\x20IMMUTABLE\x20after\x20creation\x20—\x20'+'they\x20cannot\x20be\x20modified.\x20The\x20\x27revenue\x27\x20array\x20defines\x20the\x20recipients\x20and\x20amounts;\x20'+'ensure\x20correctness\x20before\x20submitting.\x20The\x20\x27info.for_guard\x27\x20field\x20(if\x20set)\x20binds\x20this\x20'+'Payment\x20to\x20a\x20Guard\x20for\x20conditional\x20release\x20(common\x20in\x20escrow\x20workflows).');for(let fz=0x0;fz<fs['revenue']['length'];fz++){const fA=fs['revenue'][fz],fB=classifyRecipient(fA?.['recipient']),fC=fB?.['kind']==='entity'?fB['address']:undefined;if(!fC||!isValidWowAddress(fC))continue;if(objectTypeFromAddress(fC)!==ObjectType['Allocation'])continue;const fD=fA?.['amount']?.['balance'];h['push']('P0\x20ALLOCATION-RECIPIENT\x20LEG\x20(irreversible\x20stranding):\x20revenue\x20leg\x20'+fz+'\x20sends\x20'+((fD!=null?String(fD):'(unspecified\x20amount)')+'\x20to\x20Allocation\x20'+fC+'.\x20')+'A\x20plain\x20payment\x20delivers\x20the\x20CoinWrapper\x20OWNED\x20BY\x20the\x20Allocation\x20object\x20itself,\x20and\x20'+'no\x20allocation\x20entry\x20can\x20ever\x20unwrap\x20it\x20—\x20these\x20funds\x20have\x20NO\x20user-triggerable\x20exit\x20'+'(verified\x20precedent:\x200.01\x20permanently\x20frozen\x20inside\x20Allocation\x200x1dcf3f3a…).\x20'+'To\x20fund\x20an\x20Allocation\x27s\x20pool,\x20use\x20the\x20renewal\x20intake\x20instead\x20'+'(create\x20the\x20escrowed\x20payment\x20record,\x20have\x20the\x20allocation\x20receive\x20it,\x20then\x20create\x20the\x20payment\x20in\x20ONE\x20PTB).\x20'+'To\x20pay\x20a\x20beneficiary,\x20target\x20a\x20user\x20account\x20or\x20an\x20object\x20with\x20its\x20own\x20receive\x20entry\x20'+'(Order/Treasury).\x20Confirm\x20this\x20is\x20intentional\x20before\x20submitting\x20—\x20this\x20cannot\x20be\x20undone.');}const fy=fs?.['object']?.['type_parameter']??'0x2::wow::WOW';for(const fE of fs['revenue']){const fF=fE?.['amount'];if(fF&&typeof fF==='object'&&typeof fF['balance']==='string'){const fG=await parseAmount(fF['balance'],fy,m?.['network']);fG?.['smallestUnit']!=null&&(fF['balance']=fG['smallestUnit']<=BigInt(Number['MAX_SAFE_INTEGER'])?Number(fG['smallestUnit']):fG['smallestUnit']['toString']());}}}}const ft=new CallPayment(c['data']);let fu;try{fu=await ft['call'](m);}catch(fH){const fI=fH instanceof Error?fH['message']:String(fH);if(/is not a CoinWrapper/i['test'](fI)&&/already unwrapped or auto-claimed/i['test'](fI)){const fJ=typeof c['data']?.['object']==='string'?c['data']['object']:'(unknown)';return{'content':[{'type':'text','text':'No\x20live\x20CoinWrapper\x20at\x20'+fJ+'\x20—\x20this\x20id\x20is\x20NOT\x20proof\x20of\x20arrival,\x20and\x20this\x20receive\x20is\x20a\x20no-op.\x20'+'Two\x20possible\x20states,\x20discriminate\x20BEFORE\x20reporting\x20anything\x20to\x20anyone:\x20'+'(a)\x20CLAIMED:\x20it\x20was\x20a\x20CoinWrapper\x20already\x20unwrapped/claimed\x20—\x20funds\x20are\x20spendable\x20in\x20the\x20wallet;\x20'+'(b)\x20WRONG\x20ID:\x20it\x20is\x20a\x20Payment\x20(or\x20other\x20non-wrapper\x20object)\x20—\x20a\x20settlement\x20Payment\x20holds\x20'+'per-recipient\x20CoinWrappers\x20that\x20must\x20be\x20claimed\x20INDIVIDUALLY,\x20and\x20unclaimed\x20wrappers\x20hold\x20the\x20funds.\x20'+'Discriminate\x20with\x20query_toolkit\x20onchain_received\x20(lists\x20unclaimed\x20wrappers\x20owned\x20by\x20the\x20signer\x20—\x20'+'any\x20wrapper\x20under\x20a\x20Payment\x20appears\x20here\x20until\x20claimed)\x20or\x20onchain_objects\x20on\x20the\x20id\x20to\x20read\x20its\x20type.\x20'+'Do\x20NOT\x20retry\x20the\x20same\x20receive\x20and\x20do\x20NOT\x20report\x20funds\x20as\x20arrived\x20on\x20this\x20response\x20alone.'}],'structuredContent':{'outcome':'executed','result':{'type':'null'},'message':'No\x20live\x20CoinWrapper\x20at\x20'+fJ+':\x20either\x20already\x20claimed\x20(funds\x20spendable)\x20or\x20a\x20non-wrapper\x20id\x20such\x20as\x20a\x20Payment\x20whose\x20per-recipient\x20CoinWrappers\x20still\x20need\x20individual\x20claims\x20—\x20discriminate\x20via\x20onchain_received\x20before\x20reporting\x20arrival.','semantic':{'intent':'payment_receive','status':'success','summary':'No-op\x20receive\x20at\x20'+fJ+':\x20not\x20a\x20live\x20wrapper.\x20Arrival\x20is\x20NOT\x20proven\x20—\x20check\x20for\x20unclaimed\x20per-recipient\x20wrappers\x20(onchain_received)\x20or\x20confirm\x20the\x20prior\x20claim\x20(account_balance).','next_actions':[{'action':'List\x20unclaimed\x20wrappers','reason':'If\x20a\x20Payment\x20id\x20was\x20passed,\x20its\x20per-recipient\x20CoinWrappers\x20are\x20the\x20real\x20claim\x20targets\x20and\x20may\x20still\x20hold\x20the\x20funds','tool':'query_toolkit','priority':'critical'},{'action':'Verify\x20the\x20arrival','reason':'Only\x20account_balance\x20/\x20onchain_received\x20prove\x20funds\x20arrived\x20—\x20this\x20no-op\x20response\x20does\x20not','tool':'account_operation','priority':'recommended'}],'warnings':['Receive\x20skipped\x20for\x20'+fJ+':\x20no\x20live\x20CoinWrapper\x20remains\x20under\x20this\x20id.\x20This\x20response\x20is\x20NOT\x20proof\x20that\x20funds\x20arrived\x20—\x20a\x20Payment\x20id\x20means\x20the\x20per-recipient\x20wrappers\x20were\x20never\x20touched.']}}};}throw fH;}const fv=handleCallResult(fu,y(c['data']));return l(z,A,c['operation_type'],fu,c['data'])['catch'](()=>{}),fv;}case'demand':{const fK=await preflightDemandFeedback(c['data'],m,h);if(fK)return fK;const fL=new CallDemand(c['data']),fM=c['submission']?await fL['call_with_submission'](m,await transformSubmission(c['submission'])):await fL['call'](m),fN=await buildGuardSubmissionPrompt(fM,'demand',{'network':m?.['network'],'signer':m?.['account'],'extra':{'demand':c['data']?.['object']}});if(fN)h['push'](fN);const fO=handleCallResult(fM,y(c['data']));return l(z,A,c['operation_type'],fM,c['data'])['catch'](()=>{}),fO;}case'order':{c['data']?.['progress']&&(h['push']('Order\x20routing\x20fact:\x20order.progress\x20runs\x20the\x20order-bound\x20path\x20—\x20it\x20passes\x20'+'namedOperator=\x22\x22\x20forwards\x20for\x20the\x20order\x20payer/agents,\x20and\x20non-empty\x20'+'namedOperator\x20or\x20permissionIndex\x20forwards\x20for\x20senders\x20entitled\x20by\x20them\x20'+'(same\x20checks\x20as\x20the\x20Progress-level\x20path).\x20On\x20an\x20order-bound\x20Progress,\x20'+'workflow_operation\x20operate\x20auto-routes\x20to\x20this\x20same\x20path.'),h['push']('Allocation\x20hint:\x20if\x20this\x20operation\x20advances\x20the\x20order\x20to\x20a\x20terminal\x20'+'state\x20(e.g.\x20Completed/Cancelled/Refunded),\x20funds\x20remain\x20in\x20the\x20'+'Allocation\x20object\x20and\x20are\x20NOT\x20auto-distributed.\x20To\x20release\x20funds,\x20'+'trigger\x20the\x20corresponding\x20Guard\x20verification\x20via\x20allocation\x20operation\x20'+'(the\x20Guard\x20bound\x20to\x20the\x20matching\x20Allocator\x20will\x20verify\x20and\x20distribute).\x20'+'Refunds\x20are\x20TWO-STEP\x20(E-4):\x20the\x20refund\x20alloc\x20pays\x20into\x20the\x20ORDER\x20object\x20'+'(only\x20the\x20order\x20owner\x20can\x20extract)\x20—\x20after\x20the\x20alloc,\x20the\x20order\x20owner\x20'+'must\x20run\x20order\x20receive\x20(e.g.\x20receive:\x27recently\x27)\x20to\x20unwrap\x20to\x20the\x20wallet;\x20'+'treat\x20\x27cancelled/refunded\x20+\x20unclaimed\x20balance\x27\x20as\x20a\x20standard\x20pending\x20task.'));const fP=c['data']?.['arb_claim_compensation'];if(fP&&typeof c['data']?.['object']==='string')try{const fU=c['data']['object'],fV=fU['startsWith']('0x')?fU:await LocalMark['Instance']()['get_address'](fU)??undefined;if(fV){const fW=await query_objects({'objects':[fV],'no_cache':!![],'network':m?.['network']}),fX=fW?.['objects']?.[0x0],fY=fX?.['data']??fX,fZ=fY?.['service'],g0=readRawOnchainAmount(fY?.['amount']);let g1;if(typeof fY?.['allocation']==='string'&&fY['allocation']['startsWith']('0x'))try{const g7=await query_objects({'objects':[fY['allocation']],'no_cache':!![],'network':m?.['network']}),g8=g7?.['objects']?.[0x0];g1=readRawOnchainAmount(g8?.['data']?.['balance']??g8?.['balance']);}catch{}const g2=c['data']?.['acknowledge_dual_payout']===!![];let g3;if(fZ){const g9=await query_objects({'objects':[fZ],'no_cache':!![],'network':m?.['network']}),ga=g9?.['objects']?.[0x0];g3=readRawOnchainAmount((ga?.['data']??ga)?.['compensation_fund']);}let g4;const g5=fP?.['arb'];if(typeof g5==='string'){const gb=g5['startsWith']('0x')?g5:await LocalMark['Instance']()['get_address'](g5)??undefined;if(gb){const gc=await query_objects({'objects':[gb],'no_cache':!![],'network':m?.['network']});g4=readRawOnchainAmount(gc?.['objects']?.[0x0]?.['data']?.['indemnity']);}}if(claimPoolInsufficient({'indemnity':g4,'pool':g3}))return{'content':[{'type':'text','text':'COMPENSATION\x20CLAIM\x20REFUSED\x20—\x20the\x20pool\x20cannot\x20cover\x20the\x20award\x20(no\x20transaction\x20was\x20'+('sent).\x20The\x20Service\x27s\x20merchant-prepaid\x20compensation_fund\x20reads\x20'+g3+'\x20raw\x20units\x20')+('and\x20the\x20ruled\x20indemnity\x20is\x20'+g4+':\x20the\x20pool\x20can\x20currently\x20pay\x20'+g3+';\x20')+('this\x20case\x20needs\x20'+g4+'.\x20Sent\x20as-is,\x20the\x20chain\x20aborts\x20with\x20code\x2027\x20')+'(E_COMPENSATION_NOT_MATCH)\x20BEFORE\x20any\x20transfer\x20—\x20the\x20claim\x20is\x20not\x20consumed\x20(the\x20Arb\x20'+'stays\x20Arbitrated).\x20AWARD\x20≠\x20RECEIPT:\x20a\x20claim\x20only\x20pays\x20when\x20the\x20pool\x20covers\x20it.'}],'structuredContent':{'result':{'type':'error','error':'compensation_fund\x20'+g3+'\x20<\x20ruled\x20indemnity\x20'+g4,'error_code':'compensation_pool_insufficient','refused':!![],'tx_submitted':![],'retryable':!![],'recovery_hint':'The\x20merchant\x20tops\x20up\x20the\x20Service\x20pool\x20first:\x20'+'{operation_type:\x27service\x27,\x20data:{object:\x27<service>\x27,\x20compensation_fund_add:{...}}}\x20'+('with\x20an\x20amount\x20>=\x20the\x20ruled\x20indemnity\x20('+g4+')\x20—\x20then\x20re-run\x20this\x20exact\x20')+'arb_claim_compensation.\x20The\x20abort/refusal\x20does\x20NOT\x20consume\x20the\x20claim;\x20verify\x20'+'the\x20fund\x20truth\x20via\x20order_fund_facts\x20before\x20retrying.'},'message':'Refused:\x20the\x20compensation\x20pool\x20cannot\x20cover\x20the\x20ruled\x20indemnity.\x20Top\x20up\x20via\x20service\x20compensation_fund_add,\x20then\x20re-claim.'}};const g6=arbClaimEscrowEmptyDualPayout({'orderAmount':g0,'escrowBalance':g1,'poolValue':g3,'acknowledged':g2});if(g6==='refuse')return{'content':[{'type':'text','text':'DUAL\x20PAYOUT\x20REFUSED\x20—\x20no\x20transaction\x20was\x20sent.\x20Order\x20'+fV+'\x27s\x20escrow\x20is\x20ALREADY\x20FULLY\x20RELEASED\x20(allocation\x20balance\x200\x20of\x20'+g0+')\x20and\x20this\x20arb_claim_compensation\x20would\x20stack\x20the\x20arbitration\x20compensation'+(g4!==undefined?'\x20('+g4+'\x20raw\x20units)':'')+'\x20from\x20the\x20merchant-funded\x20pool\x20on\x20top\x20of\x20that\x20completed\x20escrow\x20track.\x0a\x0a'+KEEPER_DUAL_PAYOUT_DIRECTIVE}],'structuredContent':{'result':{'type':'error','error':'Order\x20'+fV+':\x20the\x20escrow\x20track\x20already\x20completed\x20(allocation\x20balance\x200\x20of\x20'+g0+')\x20and\x20this\x20claim\x20pays\x20the\x20arbitration\x20compensation\x20on\x20top\x20—\x20the\x20recipient\x27s\x20net\x20becomes\x20compensation\x20+\x20a\x20completed\x20escrow\x20track.\x20Confirm\x20the\x20netting\x20intent\x20before\x20the\x20chain\x20pays\x20the\x20second\x20track.','error_code':'dual_payout_unconfirmed','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'The\x20escrow\x20track\x20and\x20the\x20compensation\x20track\x20are\x20independent\x20by\x20design:\x20the\x20chain\x20will\x20not\x20block\x20the\x20second\x20one,\x20though\x20a\x20rail\x20paired\x20on\x20order.claimed_by\x20may\x20guard-reject\x20the\x20post-claim\x20refund\x20leg\x20—\x20that\x20rejection\x20is\x20the\x20designed\x20mutual\x20exclusion,\x20not\x20a\x20malfunction.\x20State\x20the\x20decision\x20explicitly:\x20re-send\x20the\x20SAME\x20call\x20with\x20acknowledge_dual_payout:true\x20ONLY\x20if\x20paying\x20the\x20compensation\x20on\x20top\x20of\x20the\x20fully-released\x20escrow\x20is\x20the\x20intended\x20commercial\x20outcome\x20(e.g.\x20the\x20award\x20covers\x20a\x20loss\x20the\x20escrow\x20release\x20did\x20not).\x20If\x20the\x20escrow\x20release\x20already\x20settled\x20this\x20order,\x20do\x20not\x20claim\x20—\x20verify\x20the\x20order\x20address\x20before\x20retrying.\x20'+KEEPER_DUAL_PAYOUT_DIRECTIVE},'message':'Refused:\x20this\x20compensation\x20claim\x20would\x20stack\x20on\x20a\x20fully-released\x20escrow.\x20Set\x20acknowledge_dual_payout:true\x20to\x20accept\x20explicitly\x20(HUMAN\x20operator\x20decision\x20—\x20keepers\x20must\x20escalate,\x20never\x20self-ack).'}};if(g6==='acknowledged'){const gd=await storeDualPayoutVerdict(m);if(!gd['authorized'])return{'content':[{'type':'text','text':'DUAL\x20PAYOUT\x20REFUSED\x20(preauthorization\x20missing)\x20—\x20no\x20transaction\x20was\x20sent.\x20Order\x20'+fV+'\x27s\x20escrow\x20is\x20ALREADY\x20FULLY\x20RELEASED\x20(allocation\x20balance\x200\x20of\x20'+g0+')\x20and\x20this\x20arb_claim_compensation\x20would\x20stack\x20the\x20compensation\x20on\x20top,\x20but\x20acknowledge_dual_payout\x20is\x20honored\x20ONLY\x20for\x20a\x20store\x20whose\x20human\x20merchant\x20recorded\x20the\x20standing\x20netting\x20decision\x20(config_operation\x20store_dual_payout_set\x20{account,\x20confirm:true});\x20the\x20executing\x20account\x20'+(gd['account']??'(unresolved)')+'\x20has\x20none.\x0a\x0a'+KEEPER_DUAL_PAYOUT_DIRECTIVE}],'structuredContent':{'result':{'type':'error','error':'acknowledge_dual_payout\x20on\x20Order\x20'+fV+'\x20requires\x20a\x20store-level\x20dual-payout\x20preauthorization\x20for\x20account\x20'+(gd['account']??'(unresolved)')+'\x20—\x20the\x20per-call\x20flag\x20alone\x20is\x20the\x20self-ack\x20form\x20D-1\x20retired.','error_code':'dual_payout_preauthorization_required','refused':!![],'tx_submitted':![],'retryable':![],'recovery_hint':'The\x20human\x20merchant\x20records\x20the\x20standing\x20netting\x20decision\x20ONCE\x20per\x20store\x20via\x20config_operation\x20store_dual_payout_set\x20{account:\x20<store\x20signing\x20account>,\x20confirm:\x20true,\x20note};\x20after\x20that\x20the\x20SAME\x20call\x20with\x20acknowledge_dual_payout:true\x20proceeds.\x20Automated\x20agents\x20must\x20NEVER\x20record\x20the\x20preauthorization\x20themselves\x20—\x20escalate\x20instead.\x20'+KEEPER_DUAL_PAYOUT_DIRECTIVE},'message':'Refused:\x20acknowledge_dual_payout\x20requires\x20the\x20store-level\x20preauthorization\x20(D-1).\x20The\x20merchant\x20records\x20it\x20via\x20config_operation\x20store_dual_payout_set\x20{account,\x20confirm:true};\x20automated\x20agents\x20escalate\x20instead\x20of\x20recording\x20it\x20themselves.'}};h['push']('DUAL\x20PAYOUT\x20ACKNOWLEDGED:\x20order\x20'+fV+'\x27s\x20escrow\x20is\x20already\x20fully\x20released\x20(allocation\x20balance\x200\x20of\x20'+g0+')\x20and\x20this\x20claim\x20pays\x20the\x20arbitration\x20compensation\x20on\x20top\x20—\x20proceeding\x20on\x20the\x20explicit\x20acknowledge_dual_payout\x20flag\x20backed\x20by\x20the\x20store-level\x20preauthorization'+(gd['authorized_at']?'\x20recorded\x20'+gd['authorized_at']:'')+'\x20(D-1);\x20verify\x20the\x20net\x20payout\x20per\x20party\x20is\x20the\x20intended\x20commercial\x20outcome.');}if(g3!==undefined&&g0!==undefined&&g0>0x0&&g3<0x3*g0)h['push']('COMPENSATION\x20COVERAGE\x20BELOW\x20CEILING:\x20compensation_fund\x20('+g3+')\x20is\x20less\x20than\x20'+('3x\x20the\x20order\x20amount\x20('+g0+')\x20—\x20the\x20chain\x20caps\x20any\x20award\x20at\x203x\x20')+'(the\x20MAX_INDEMNITY_MULTIPLE\x20on-chain\x20cap),\x20so\x20a\x20ruling\x20at\x20the\x20ceiling\x20would\x20abort\x20this\x20'+'buyer\x27s\x20payout.\x20Recommend\x20the\x20merchant\x20top\x20up\x20the\x20pool\x20via\x20service\x20'+'compensation_fund_add.\x20(Above\x203x\x20only\x20buys\x20headroom\x20for\x20concurrent\x20claims\x20—\x20'+'the\x20pool\x20is\x20per-Service\x20and\x20has\x20no\x20on-chain\x20concurrency\x20limit.)');else g3!==undefined&&g3>0x0&&h['push']('Reminder:\x20this\x20claim\x20pays\x20from\x20the\x20Service\x27s\x20merchant-prepaid\x20compensation_fund\x20pool\x20'+'(not\x20the\x20order\x20escrow).\x20Pool\x20balance\x20is\x20sufficient\x20for\x20now.\x20A\x20settled\x20claim\x20does\x20NOT\x20'+'seal\x20the\x20order:\x20a\x20later\x20refund-track\x20alloc\x20can\x20still\x20split\x20AND\x20pay\x20out\x20the\x20escrow\x20'+'(the\x20owner\x20receive\x20entries\x20are\x20deliberately\x20ungated\x20on-chain).\x20TWO-RAIL\x20INDEPENDENCE\x20'+'(decision\x2011):\x20refund\x20and\x20award\x20are\x20independent\x20commercial\x20tracks\x20—\x20the\x20overlap\x20is\x20'+'LEGAL\x20and\x20disclosed\x20at\x20the\x20acknowledge_dual_payout\x20gate;\x20fund\x20rails\x20are\x20node-gated\x20'+'and\x20NEVER\x20add\x20an\x20order.claimed_by\x20leg\x20(RAIL_CLAIMED_BY_LEG\x20/\x20R-FUND-RAIL-CLAIMED-BY\x20'+'critical).\x20The\x20provider\x20release\x20track\x20(direct\x20transfer)\x20'+'stays\x20usable.');}}catch{}const fQ=new CallOrder(c['data']);let fR=c['submission']?await fQ['call_with_submission'](m,await transformSubmission(c['submission'])):await fQ['call'](m);if(!c['submission']&&isSubmissionMissingEcho(fR)){const ge=await resolveOrderRefForBackfill(c['data']?.['object']),gf=buildAutoFilledSubmission(fR,ge);gf&&(fR=await fQ['call_with_submission'](m,await transformSubmission(gf)),h['push']('254\x20AUTO-BACKFILL:\x20the\x20pending\x20input\x20was\x20the\x20protocol\x20order\x20slot\x20(254)\x20—\x20filled\x20from\x20'+('this\x20operation\x27s\x20order\x20reference\x20('+ge+')\x20and\x20the\x20call\x20was\x20re-driven\x20in-process,\x20')+'saving\x20the\x20manual\x20refill\x20round-trip.'));}if(c['data']?.['receive']!=null&&fR&&typeof fR==='object'&&fR?.['effects']?.['status']?.['status']==='success'){const gg=fR['effects'],gh=Array['isArray'](gg?.['objectChanges'])?gg['objectChanges']:Array['isArray'](fR?.['objectChanges'])?fR['objectChanges']:[],gi=gn=>String(gn??'')['includes']('::coin::Coin'),gj=gh['filter'](gn=>gn?.['type']==='created'&&gi(gn?.['objectType'])),gk=gh['filter'](gn=>gn?.['type']==='mutated'&&gi(gn?.['objectType'])),gl=Array['isArray'](gg?.['balanceChanges'])?gg['balanceChanges']:[],gm=gl['length']?'Balance\x20delta\x20this\x20tx:\x20'+gl['map'](gn=>{const go=typeof gn?.['owner']==='object'&&gn?.['owner']!==null?String(gn['owner']['AddressOwner']??gn['owner']['ObjectOwner']??''):String(gn?.['owner']??'');return(go||'(unknown)')+'\x20'+(gn?.['amount']??'?')+'\x20('+(String(gn?.['coinType']??'')['split']('::')['pop']()??'')+')';})['join'](';\x20'):'';h['push']('RECEIVE\x20RECEIPT:\x20claimed\x20'+gj['length']+'\x20object(s)\x20into\x20the\x20wallet'+(gj['length']?'\x20('+gj['map'](gn=>gn?.['objectId'])['join'](',\x20')+')':'')+(gm?'.\x20'+gm+'.':'')+(gk['length']?'\x20'+gk['length']+'\x20existing\x20coin(s)\x20consolidated/used\x20for\x20gas\x20(mutations,\x20NOT\x20new\x20funds).':'')+(gj['length']===0x0?'\x20NO_PENDING_CLAIM:\x20this\x20enumeration\x20found\x20nothing\x20claimable\x20—\x20a\x20coin\x20merge\x20may\x20still\x20have\x20run,\x20so\x20verify\x20arrival\x20on\x20the\x20AGGREGATE\x20balance\x20(account_balance),\x20never\x20on\x20created[].':'\x20A\x20claimed\x20refund\x20typically\x20arrives\x20as\x20its\x20OWN\x20Coin\x20object\x20—\x20the\x20balance\x20aggregate\x20may\x20show\x20it\x20as\x20a\x20second\x20coin,\x20so\x20consolidate\x20before\x20pricing\x20the\x20next\x20payment.'));}if(fP){const gn=!!fR&&typeof fR==='object'&&fR?.['effects']?.['status']?.['status']==='success';let go;if(gn)try{const gs=fR['effects'],gt=Array['isArray'](gs?.['objectChanges'])?gs['objectChanges']:Array['isArray'](fR?.['objectChanges'])?fR['objectChanges']:[],gu=gy=>String(gy??'')['includes']('::coin::Coin'),gv=Array['isArray'](gs?.['balanceChanges'])?gs['balanceChanges']:[],gw=gt['some'](gy=>(gy?.['type']==='created'||gy?.['type']==='transferred')&&gu(gy?.['objectType']))||gv['some'](gy=>Number(gy?.['amount']??0x0)>0x0),gx=fP?.['arb'];if(typeof gx==='string'){const gy=gx['startsWith']('0x')?gx:await LocalMark['Instance']()['get_address'](gx)??undefined;if(gy){const gz=await query_objects({'objects':[gy],'no_cache':!![],'network':m?.['network']});go=readRawOnchainAmount(((gz?.['objects']?.[0x0])?.['data']??gz?.['objects']?.[0x0])?.['indemnity']);}}if(go===0x0)h['push']('CLAIM\x20PAID\x20NOTHING\x20(award\x20≠\x20receipt):\x20this\x20arb_claim_compensation\x20succeeded\x20and\x20CLOSED\x20the\x20'+'case,\x20but\x20the\x20ruled\x20indemnity\x20reads\x200\x20—\x20a\x20dismissal\x20award.\x20No\x20coin\x20was\x20paid\x20and\x20none\x20will\x20'+'be:\x20the\x20claim\x27s\x20only\x20effect\x20was\x20closing\x20the\x20case\x20and\x20consuming\x20its\x20one-shot\x20latch.\x20If\x20a\x20'+'payout\x20was\x20intended,\x20the\x20award\x20must\x20be\x20RE-RULED\x20(arbitration\x20reset\x20→\x20order.arb_confirm\x20→\x20'+'new\x20ruling),\x20not\x20re-claimed\x20—\x20the\x20zero-indemnity\x20gate\x20aborts\x20a\x20re-claim.');else go!==undefined&&!gw&&h['push']('CLAIM\x20RECEIPT\x20—\x20ZERO\x20MOVEMENT:\x20the\x20claim\x20succeeded\x20with\x20ruled\x20indemnity\x20'+go+'\x20'+'(raw\x20units)\x20but\x20this\x20receipt\x20shows\x20no\x20created/transferred\x20coin\x20object\x20and\x20no\x20positive\x20'+'balance\x20change.\x20AWARD\x20≠\x20RECEIPT\x20until\x20the\x20money\x20is\x20on\x20the\x20recipient\x27s\x20balance\x20—\x20verify\x20'+'via\x20account_balance\x20/\x20order_fund_facts\x20before\x20treating\x20the\x20award\x20as\x20received.');}catch{}let gp,gq='';if(gn&&typeof c['data']?.['object']==='string')try{const gA=c['data']['object'],gB=gA['startsWith']('0x')?gA:await LocalMark['Instance']()['get_address'](gA)??undefined;let gC,gD;if(gB){const gE=await query_objects({'objects':[gB],'no_cache':!![],'network':m?.['network']}),gF=gE?.['objects']?.[0x0],gG=gF?.['data']??gF;gC=gG?.['progress'],typeof gG?.['allocation']==='string'&&gG['allocation']['startsWith']('0x')&&(gD=gG['allocation']);}gD&&(gq='\x20ESCROW\x20RELEASE\x20AFTER\x20THIS\x20CLAIM\x20—\x20'+await dualPayoutReleaseGuidance({'allocAddr':gD,'indemnityRaw':typeof go==='number'?go:undefined,'network':m?.['network']})),gp=await autoHoldAfterClaim(m,gA,gC);}catch{}const gr=['DUAL-TRACK\x20NOTICE\x20(NET\x20view):\x20claiming\x20compensation\x20does\x20NOT\x20adjust\x20the\x20allocation\x20—\x20'+'compensation\x20(Service\x20compensation_fund)\x20and\x20escrow\x20settlement\x20(Allocation)\x20are\x20independent\x20'+'tracks,\x20and\x20claim/objection\x20remain\x20mutually\x20exclusive\x20(claim\x20closes\x20the\x20case).\x20Buyer\x20NET\x20'+'across\x20BOTH\x20tracks\x20=\x20compensation\x20+\x20any\x20escrow\x20still\x20released\x20via\x20the\x20refund\x20track;\x20to\x20keep\x20'+'the\x20total\x20at\x20the\x20actual\x20loss,\x20keep\x20the\x20settlement\x20sealed\x20(auto-hold\x20below).\x20When\x20the\x20escrow\x20'+'is\x20released\x20later,\x20the\x20allocation\x20gate\x20answers\x20per\x20its\x20OWN\x20track\x20classification'+(gq||'\x20(unclassified\x20this\x20session\x20—\x20see\x20the\x20gate\x27s\x20answer\x20at\x20release\x20time)')+'.'+gq];if(gp&&(gp['held']['length']||gp['notHoldable']['length']||gp['failed']['length']))gp['held']['length']&&gr['push']('Auto-hold\x20applied\x20to:\x20'+gp['held']['join'](',\x20')+'\x20—\x20a\x20courtesy\x20Progress\x20hold,\x20NOT\x20a\x20chain-level\x20freeze.\x20Forwards\x20may\x20still\x20be\x20executable\x20by\x20other\x20permissioned\x20operators\x20and\x20the\x20machine\x20keeps\x20advancing;\x20the\x20post-claim\x20posture\x20is\x20two-rail\x20independence\x20(decision\x2011\x20—\x20payouts\x20follow\x20node\x20gates,\x20never\x20claim\x20state;\x20any\x20escrow\x20release\x20after\x20a\x20claim\x20goes\x20through\x20the\x20acknowledge_dual_payout\x20gate),\x20not\x20a\x20settlement\x20freeze.'),gp['notHoldable']['length']&&gr['push']('NOT\x20holdable\x20by\x20this\x20account\x20(needs\x20merchant\x20or\x20keeper\x20to\x20run\x20order\x20hold):\x20'+gp['notHoldable']['join'](',\x20')+'.'),gp['failed']['length']&&gr['push']('Hold\x20attempted\x20but\x20failed\x20(retry,\x20or\x20have\x20merchant\x20or\x20keeper\x20hold\x20manually):\x20'+gp['failed']['join'](',\x20')+'.'),gp['held']['length']===0x0&&gr['push']('No\x20outgoing\x20edge\x20could\x20be\x20auto-held\x20—\x20the\x20escrow\x20settlement\x20track\x20is\x20STILL\x20OPEN;\x20'+'have\x20the\x20merchant\x20or\x20keeper\x20hold\x20the\x20edge(s)\x20above\x20before\x20the\x20order\x20reaches\x20completed.');else gn?gr['push']('No\x20outgoing\x20edge\x20to\x20freeze\x20at\x20the\x20current\x20node\x20(order\x20likely\x20at\x20a\x20terminal\x20node),\x20or\x20'+'edge\x20resolution\x20was\x20unavailable\x20—\x20verify\x20the\x20settlement\x20state\x20manually.'):gr['push']('The\x20claim\x20did\x20not\x20succeed,\x20so\x20no\x20hold\x20was\x20attempted;\x20rerun\x20after\x20fixing\x20the\x20cause\x20above.');h['push'](gr['join']('\x20'));if(gn&&typeof c['data']?.['object']==='string')try{const gH=c['data']['object'],gI=gH['startsWith']('0x')?gH:await LocalMark['Instance']()['get_address'](gH)??undefined;if(gI){const gJ=await query_objects({'objects':[gI],'no_cache':!![],'network':m?.['network']}),gK=gJ?.['objects']?.[0x0]?.['data']??gJ?.['objects']?.[0x0],gL=typeof gK?.['service']==='string'?gK['service']:undefined;if(gL){const gM=await query_objects({'objects':[gL],'no_cache':!![],'network':m?.['network']}),gN=gM?.['objects']?.[0x0]?.['data']??gM?.['objects']?.[0x0],gO=gN?.['compensation_fund'],gP=typeof gO==='string'&&/^\d+$/['test'](gO['trim']())?BigInt(gO['trim']()):typeof gO==='number'&&Number['isFinite'](gO)?BigInt(Math['trunc'](gO)):undefined;if(gP===0x0n){const gQ=fundWaterReminder('depleted',{'balance':'0','threshold':'0'});if(gQ)h['push'](gQ);}else{if(gP!==undefined&&gP>0x0n&&Array['isArray'](gN?.['sales'])){const gR=gN['sales']['filter'](gT=>!gT?.['suspension']&&/^\d+$/['test'](String(gT?.['price']??'')['trim']()))['map'](gT=>({'name':String(gT?.['name']??''),'price':BigInt(String(gT['price'])['trim']())})),gS=computeFundListingWall(gP,gR);gS['walled']&&h['push']('FUND\x20LISTING\x20WALL\x20AFTER\x20AWARD:\x20this\x20claim\x20spent\x20the\x20Service\x27s\x20compensation\x20fund\x20—\x20the\x20live\x20fund\x20now\x20backs\x20single\x20orders\x20up\x20to\x20'+(gS['coverCap']['toString']()+'\x20base\x20units,\x20and\x20'+gS['blocked']['length']+'\x20listing(s)\x20are\x20priced\x20ABOVE\x20that\x20and\x20now\x20check\x20out\x20UNDER-COVERED\x20')+('(highest\x20first:\x20'+gS['blocked']['map'](gT=>gT['name']||'(unnamed)')['join'](',\x20')+').\x20The\x20order\x20still\x20proceeds\x20with\x20a\x20buy-time\x20warning\x20(拍板⑤\x20dm-mtw-261027\x20demoted\x20the\x20refusal),\x20')+'but\x20a\x20max-award\x20ruling\x20aborts\x20code\x2027\x20until\x20the\x20fund\x20is\x20topped\x20above\x203x\x20their\x20price\x20(service.compensation_fund_add)\x20or\x20the\x20price\x20is\x20cut.\x20'+'The\x20merchant\x20should\x20re-check\x20the\x20storefront\x20—\x20service_panorama\x20carries\x20the\x20live\x20wall\x20under\x20compensation_fund_listing_wall.');}}}}}catch{}}const fS=await buildGuardSubmissionPrompt(fR,'order',{'network':m?.['network'],'signer':m?.['account'],'order_address':c['data']?.['object']});if(fS)h['push'](fS);if(c['data']?.['order_new']&&fR&&typeof fR==='object'&&fR?.['effects']?.['status']?.['status']==='success'&&fR?.['digest']){const gT=await applyInitialForwardAfterOrderNew(c['data'],m);if(gT)h['push'](gT);}const fT=handleCallResult(fR,y(c['data']));if(fR&&typeof fR==='object'&&'digest'in fR&&fR?.['effects']?.['status']?.['status']==='success'&&c['data']?.['progress']&&typeof c['data']?.['object']==='string')try{const gU=c['data']['object'],gV=gU['startsWith']('0x')?gU:await LocalMark['Instance']()['get_address'](gU)??undefined;let gW;if(gV){const gX=await query_objects({'objects':[gV],'no_cache':!![],'network':m?.['network']}),gY=gX?.['objects']?.[0x0];gW=(gY?.['data']??gY)?.['progress'];}if(gW){const gZ=c['data']['progress']?.['operation'],h0=await enrichWorkflowGuidance({'progressRef':gW,'network':m?.['network'],'accountName':m?.['account'],'noCache':!![],'txResult':fR,'dryRun':m?.['dry_run']===!![],'compact':m?.['response_level']!=='full','operate':gZ?.['forward']&&gZ?.['next_node_name']?{'forward':gZ['forward'],'next_node_name':gZ['next_node_name'],'op':c['data']['progress']?.['op']}:undefined});mergeGuidanceIntoOutput(fT,h0,{'responseLevel':m?.['response_level']});}}catch{}return l(z,A,c['operation_type'],fR,c['data'])['catch'](()=>{}),fT;}case'gen_passport':{const h1=await gen_passport(m,c['guard'],c['info']);let h2;try{const h4=Array['isArray'](h1?.['objectChanges'])?h1['objectChanges']:[],h5=h4['find'](h7=>h7?.['type']==='created'&&typeof h7?.['objectType']==='string'&&/::passport::Passport$/['test'](h7['objectType'])),h6=h5?.['objectId'];if(h6){const h7=await query_objects({'objects':[h6],'no_cache':!![],'network':m?.['network']}),h8=h7?.['objects']?.[0x0],h9=h8?.['data']??h8;h9&&typeof h9==='object'&&typeof h9['result']==='boolean'&&(h2={'passport_id':h6,'result':h9['result']===!![],'has_verified':h9['has_verified']===!![],'info':Array['isArray'](h9['guard'])?h9['guard']['map'](ha=>({'guard':String(ha?.['guard']??ha??''),'result':ha?.['result']===!![],...typeof ha?.['impack']==='boolean'?{'impack':ha['impack']}:{}})):undefined});}}catch{}const h3=handleCallResult(h1,y(c['data'],undefined,h2));try{for(const ha of c['guard']??[]){const hb=typeof ha==='string'?ha:ha?.['object'];if(typeof hb!=='string'||hb==='')continue;const hc=await loadGuardJsonFromChain(hb,m?.['network']);if(!hc)continue;const hd=(hc['json']['table']??[])['some'](he=>he?.['identifier']===TASK_BINDING_SLOT&&he?.['b_submission']===!![]&&he?.['value_type']==='Address');!hd&&h['push']('PROTOCOL\x20SLOT\x20'+TASK_BINDING_SLOT+'\x20MISSING\x20on\x20Guard\x20\x27'+(hc['name']??hc['guard'])+'\x27:\x20the\x20table\x20declares\x20no\x20{identifier:\x20'+TASK_BINDING_SLOT+',\x20b_submission:\x20true,\x20value_type:\x20\x22Address\x22}\x20row\x20(task\x20binding).\x20A\x20passport\x20built\x20now\x20can\x20never\x20satisfy\x20the\x20on-chain\x20task-binding\x20check\x20on\x20an\x20order-driven\x20Progress\x20forward\x20(abort\x20code\x2011)\x20—\x20the\x20passport\x20only\x20emits\x20DECLARED\x20table\x20rows.\x20Fix\x20BEFORE\x20binding/publishing:\x20export\x20the\x20guard\x20(guard2file),\x20add\x20the\x20'+TASK_BINDING_SLOT+'\x20declaration,\x20create\x20a\x20NEW\x20Guard,\x20and\x20rebind\x20—\x20tables\x20freeze\x20at\x20creation.');}}catch{}return l(z,A,c['operation_type'],h1,c['data'])['catch'](()=>{}),h3;}case'proof':{const he=new CallProof(c['data']),hf=c['submission']?await he['call_with_submission'](m,await transformSubmission(c['submission'])):await he['call'](m),hg=await buildGuardSubmissionPrompt(hf,'proof',{'network':m?.['network'],'signer':m?.['account']});if(hg)h['push'](hg);const hh=handleCallResult(hf,y(c['data']));return l(z,A,c['operation_type'],hf,c['data'])['catch'](()=>{}),hh;}case'gen_proof':{const hi=await gen_proof(m,c['proof'],c['server_pubkey'],c['server_signature'],c['proof_type'],c['description'],c['item_count'],c['about_address']),hj=handleCallResult(hi,y(c['data']));return l(z,A,c['operation_type'],hi,c['data'])['catch'](()=>{}),hj;}}const E=c;throw new Error('Unknown\x20on-chain\x20operation\x20type:\x20'+String(E['operation_type']));}catch(hk){let hl=hk instanceof Error?hk['message']:String(hk);const hm=c?.['operation_type'],hn=c&&'data'in c?c['data']:undefined,ho=c&&c['env']?c['env']['network']:undefined;try{const ht=await diagnoseGuardFailure(c,hl);if(ht)hl=hl+'\x0a'+ht;}catch{}const hp=hk?.['digest'],hq=typeof hp==='string'&&hp?hp:undefined;let hr;const hs=c?.['env']?.['dry_run']===!![]||isDeterministicOutcomeMessage(hl);if(hm&&!hs){const hu=markerOpFor(hm,hn),hv=c?.['env'],hw=hn!==undefined?hn:c,hx=c?.['submission'];parkUnknownOutcomeMarker(hu,hw,hv,hx);const hy=lastInFlightMarker(hu,inFlightParamsHash(hw,hx,hv?.['account'])),hz=[...hq?[hq]:[],...hy?.['digests']??[]]['filter']((hA,hB,hC)=>hC['indexOf'](hA)===hB);hv?.['account']&&(hr={'sender':hv['account'],'failed_at':new Date()['toISOString'](),'verify_events_since':new Date(Date['now']()-0x5a*0x3e8)['toISOString'](),'digests':hz,...k?{'idempotency_key':k}:{}}),k&&idempotencyKeyObserveUnknown(k,hm,{'sender':hv?.['account'],'verify_events_since':hr?.['verify_events_since'],'digests':hz});}else{if(hm&&hs){consumeInFlightMarker(markerOpFor(hm,hn),inFlightParamsHash(hn!==undefined?hn:c,c?.['submission'],c?.['env']?.['account']));if(k)idempotencyKeyClear(k);}}if(hm==='service'&&hn?.['order_new']){if(!hs){const hA=inFlightParamsHash(hn,undefined,c?.['env']?.['account']),hB=markerOpFor(hm,hn);if(hq)attachInFlightDigest(hB,hA,hq);const hC=await verifyOrderNewLanded(ho,hA)['catch'](()=>undefined),hD=hC??describeLastInFlight(hB,hA);if(hD)hl=hl+'\x0a'+hD;}}if(hm==='allocation'&&hn?.['alloc_by_guard']){if(!hs){const hE=inFlightParamsHash(hn,c['submission'],c['env']?.['account']),hF=markerOpFor(hm,hn);if(hq)attachInFlightDigest(hF,hE,hq);const hG=describeLastInFlight(hF,hE);if(hG)hl=hl+'\x0a'+hG;}}try{const hH=await resolveNetwork(ho);hl+=ho?'\x0a[network:\x20attempted\x20=\x20'+hH+'\x20(explicitly\x20requested)]':'\x0a[network:\x20attempted\x20=\x20'+hH+'\x20(session\x20default\x20—\x20pass\x20env.network\x20to\x20pin\x20a\x20specific\x20network)]';}catch{}return handleCallResult({'error':hl},hm?{'operation_type':hm,'data':hn,'operation_id':stableOperationId(hm,hn),'submission_verification':hr}:undefined);}}export async function onchainTimeoutVerify(a){try{const b=strictParse(OnchainOperationsSchema,a,'onchain_operations\x20timeout\x20re-parse'),c=b['operation_type'];if(!c)return undefined;if(b['env']?.['dry_run']===!![])return undefined;const d='data'in b?b['data']:undefined,e=b['env']?.['network'];let f;if(c==='service'&&d?.['order_new']){const k=inFlightParamsHash(d,undefined,b['env']?.['account']),l=markerOpFor(c,d);f=await verifyOrderNewLanded(e,k)['catch'](()=>undefined)??describeLastInFlight(l,k);}else{if(c==='allocation'&&d?.['alloc_by_guard']){const m=inFlightParamsHash(d,b['submission'],b['env']?.['account']),n=markerOpFor(c,d);f=describeLastInFlight(n,m);}else{const o=markerOpFor(c,d),p=d!==undefined?d:b,q=b['submission'];parkUnknownOutcomeMarker(o,p,b['env'],q),f=describeLastInFlight(o,inFlightParamsHash(p,q,b['env']?.['account']));}}if(!f)return undefined;const g=b['env']?.['account'],h=typeof d?.['object']==='string'?d['object']:undefined,j='OUTCOME\x20UNKNOWN\x20(the\x20wrapper\x20stopped\x20waiting\x20after\x20submission\x20—\x20the\x20transaction\x20MAY\x20have\x20committed).\x20'+('sender='+(g??'unspecified'))+(''+(h?',\x20target='+h:''))+((e?',\x20network='+e:'')+'.\x20')+'Verify\x20before\x20ANY\x20retry:\x20query_toolkit\x20recover_created_objects\x20for\x20this\x20sender,\x20or\x20'+'onchain_address_activity\x20(direction=\x27sent\x27)\x20in\x20the\x20failure\x20window\x20—\x20adopt\x20what\x20landed,\x20'+'resubmit\x20only\x20when\x20confirmed\x20absent.';return j+'\x0a'+f;}catch{return undefined;}}