{"version":3,"file":"internal.cjs","names":["LayeredLensesModel.LayeredLenses","ConduitError","parseRes","materializeSource","InitializationError","Transport"],"sources":["../../contracts/src/v1/layered-lenses/edge-map.ts","../../contracts/src/v1/layered-lenses/bin-score.ts","../../contracts/src/v1/layered-lenses/model.ts","../src/internal-resources/behavior-maps.ts","../src/InternalConduit.ts"],"sourcesContent":["export const EDGE_MAP = {\n\tachievement: [0.0, 0.3, 0.5, 0.6, 0.8, 1.0],\n\tagreeablenessFacet: [\n\t\t0.020833333333333315, 0.4375, 0.5520833333333334, 0.625, 0.7291666666666667,\n\t\t1.0,\n\t],\n\tagreeablenessFlexibility: [\n\t\t0.08333333333333331, 0.41666666666666663, 0.5, 0.5833333333333334, 0.75,\n\t\t1.0,\n\t],\n\tagreeablenessForgiveness: [0.0, 0.25, 0.5, 0.625, 0.75, 1.0],\n\tagreeablenessGentleness: [\n\t\t0.0, 0.41666666666666663, 0.5833333333333334, 0.6666666666666666, 0.75, 1.0,\n\t],\n\tagreeablenessPatience: [0.0, 0.5, 0.625, 0.75, 0.875, 1.0],\n\taloofIntroverted: [0.0, 0.375, 0.5, 0.625, 0.8125, 1.0],\n\tarrogantCalculating: [0.0, 0.125, 0.1875, 0.3125, 0.4375, 0.9375],\n\tbasDrive: [0.0, 0.4166666666666667, 0.5, 0.6666666666666666, 0.75, 1.0],\n\tbasFunSeeking: [\n\t\t0.0, 0.4166666666666667, 0.5833333333333334, 0.6666666666666666, 0.75, 1.0,\n\t],\n\tbasRewardResponsiveness: [\n\t\t0.06666666666666665, 0.6666666666666666, 0.7999999999999999,\n\t\t0.8666666666666667, 0.9333333333333332, 1.0,\n\t],\n\tbenevolence: [0.0, 0.1, 0.2, 0.3, 0.9],\n\tbis: [\n\t\t0.0, 0.4761904761904761, 0.6190476190476191, 0.7619047619047619,\n\t\t0.8571428571428572, 1.0,\n\t],\n\tcaregiver: [\n\t\t0.0, 0.6151682633259641, 0.7040162122328667, 0.75, 0.8409604519774012, 1.0,\n\t],\n\tcognitiveReappraisal: [\n\t\t0.0, 0.6111111111111112, 0.6944444444444445, 0.8055555555555555,\n\t\t0.8611111111111112, 1.0,\n\t],\n\tcoldHearted: [0.0, 0.25, 0.3125, 0.4375, 0.5, 0.9375],\n\tconformity: [0.0, 0.2, 0.4, 0.5, 0.7, 1.0],\n\tconscientiousnessDiligence: [0.125, 0.625, 0.75, 0.875, 1.0],\n\tconscientiousnessFacet: [\n\t\t0.17708333333333337, 0.5750000000000001, 0.6770833333333333,\n\t\t0.7291666666666667, 0.8229166666666665, 1.0,\n\t],\n\tconscientiousnessOrganization: [0.0, 0.5, 0.625, 0.75, 0.875, 1.0],\n\tconscientiousnessPerfectionism: [\n\t\t0.08333333333333331, 0.5833333333333334, 0.6666666666666666, 0.75,\n\t\t0.8333333333333333, 1.0,\n\t],\n\tconscientiousnessPrudence: [\n\t\t0.0, 0.5, 0.6666666666666666, 0.75, 0.8333333333333333, 1.0,\n\t],\n\tconservation: [\n\t\t0.0, 0.2333333333333333, 0.3333333333333333, 0.4333333333333333,\n\t\t0.5333333333333333, 0.8333333333333334,\n\t],\n\tcreator: [\n\t\t0.0, 0.5619415600096596, 0.6668075344119778, 0.75, 0.8669886500845206, 1.0,\n\t],\n\tcrtScore: [0.0, 0.5, 1.0],\n\temotionalityAnxiety: [0.0, 0.5, 0.625, 0.75, 0.875, 1.0],\n\temotionalityDependence: [0.0, 0.25, 0.375, 0.5, 0.625, 1.0],\n\temotionalityFacet: [\n\t\t0.0, 0.42708333333333326, 0.5208333333333334, 0.6104166666666663,\n\t\t0.7083333333333334, 1.0,\n\t],\n\temotionalityFearfulness: [\n\t\t0.0, 0.33333333333333337, 0.5, 0.6333333333333305, 0.75, 1.0,\n\t],\n\temotionalitySentimentality: [\n\t\t0.0, 0.41666666666666663, 0.5833333333333334, 0.6666666666666666, 0.75, 1.0,\n\t],\n\texpressiveSuppression: [\n\t\t0.0, 0.2916666666666667, 0.4166666666666667, 0.5833333333333334,\n\t\t0.7083333333333334, 1.0,\n\t],\n\textraversionFacet: [\n\t\t0.0, 0.33333333333333326, 0.44791666666666663, 0.5625, 0.6666666666666666,\n\t\t1.0,\n\t],\n\textraversionLiveliness: [0.0, 0.375, 0.5, 0.625, 0.75, 1.0],\n\textraversionSociability: [0.0, 0.125, 0.25, 0.5, 0.625, 1.0],\n\textraversionSocialBoldness: [\n\t\t0.0, 0.25, 0.41666666666666663, 0.5, 0.6666666666666666, 1.0,\n\t],\n\textraversionSocialSelfEsteem: [\n\t\t0.0, 0.33333333333333337, 0.5833333333333334, 0.75, 0.8333333333333333, 1.0,\n\t],\n\tgregariousExtraverted: [0.0, 0.25, 0.375, 0.5625, 0.75, 1.0],\n\thedonism: [0.0, 0.2, 0.4, 0.5, 0.7, 1.0],\n\thonestyHumilityFacet: [\n\t\t0.020833333333333315, 0.5, 0.6041666666666666, 0.6770833333333333,\n\t\t0.7708333333333333, 1.0,\n\t],\n\thonestyHumilityFairness: [\n\t\t0.0, 0.33333333333333337, 0.5833333333333334, 0.75, 0.9166666666666667, 1.0,\n\t],\n\thonestyHumilityGreedAvoidance: [0.0, 0.25, 0.5, 0.625, 0.75, 1.0],\n\thonestyHumilityModesty: [0.0, 0.75, 0.875, 1.0],\n\thonestyHumilitySincerity: [\n\t\t0.0, 0.41666666666666663, 0.5833333333333334, 0.6666666666666666, 0.75, 1.0,\n\t],\n\tidealist: [\n\t\t0.0, 0.416425702811245, 0.5423828647925033, 0.6306559571619812,\n\t\t0.7481927710843375, 1.0,\n\t],\n\tjester: [\n\t\t0.11320418350368427, 0.6507368671262183, 0.7450558592821489,\n\t\t0.7951033990967435, 0.9189446161159971, 1.0,\n\t],\n\tlover: [\n\t\t0.0395767066307805, 0.45814778566185455, 0.6234401761683385,\n\t\t0.7354171764130165, 0.8271959872767309, 0.9999999999999998,\n\t],\n\tmachiavellianism: [\n\t\t0.0, 0.33333333333333337, 0.4444444444444444, 0.5277777777777778,\n\t\t0.6388888888888888, 1.0,\n\t],\n\tmagician: [\n\t\t0.0, 0.498103448275862, 0.6046551724137931, 0.6826508620689654,\n\t\t0.7538793103448276, 1.0,\n\t],\n\tnarcissism: [\n\t\t0.0, 0.25, 0.33333333333333337, 0.4444444444444444, 0.5555555555555556,\n\t\t0.9166666666666667,\n\t],\n\topennessAestheticAppreciation: [0.0, 0.5, 0.625, 0.75, 0.875, 1.0],\n\topennessCreativity: [\n\t\t0.0, 0.5, 0.6666666666666666, 0.8333333333333333, 0.9166666666666667, 1.0,\n\t],\n\topennessFacet: [\n\t\t0.08333333333333331, 0.5520833333333333, 0.65625, 0.75, 0.84375, 1.0,\n\t],\n\topennessInquisitiveness: [0.0, 0.5, 0.625, 0.75, 0.875, 1.0],\n\topennessToChange: [\n\t\t0.0, 0.23333333333333334, 0.33333333333333337, 0.4333333333333333,\n\t\t0.5333333333333333, 0.9333333333333333,\n\t],\n\topennessUnconventionality: [\n\t\t0.0, 0.5, 0.6666666666666666, 0.75, 0.8333333333333333, 1.0,\n\t],\n\tpower: [0.0, 0.4, 0.5, 0.7, 0.8, 1.0],\n\tpsychopathy: [\n\t\t0.0, 0.1388888888888889, 0.2222222222222222, 0.3055555555555556,\n\t\t0.41666666666666663, 0.8611111111111112,\n\t],\n\trealist: [\n\t\t0.22719060523938572, 0.6131436314363145, 0.6911472448057815, 0.75,\n\t\t0.8195121951219512, 1.0,\n\t],\n\trevolutionary: [\n\t\t0.2256905032160424, 0.5361710177828225, 0.5933219825955354,\n\t\t0.6597994702989027, 0.7186341278849793, 1.0,\n\t],\n\truler: [\n\t\t0.0, 0.33992048643592143, 0.45854770813844714, 0.553122076707203,\n\t\t0.6802619270346117, 1.0,\n\t],\n\tsage: [\n\t\t0.0, 0.6692338072669826, 0.75, 0.7972617166929963, 0.914797261716693,\n\t\t0.9999999999999998,\n\t],\n\tsecurity: [0.0, 0.1, 0.2, 0.4, 0.5, 1.0],\n\tseeker: [\n\t\t0.05172117039586921, 0.6065232358003442, 0.6982788296041308, 0.75,\n\t\t0.8345955249569705, 1.0,\n\t],\n\tselfDirection: [0.0, 0.1, 0.2, 0.3, 0.4, 0.9],\n\tselfEnhancement: [0.0, 0.35, 0.55, 0.65, 0.8, 1.0],\n\tselfMonitoring: [0.0, 0.28, 0.4, 0.48, 0.6, 0.96],\n\tselfTranscendence: [\n\t\t0.0, 0.08333333333333333, 0.16666666666666669, 0.25, 0.35,\n\t\t0.8666666666666668,\n\t],\n\tstimulation: [0.0, 0.2, 0.4, 0.6, 0.7, 1.0],\n\ttradition: [0.0, 0.2, 0.3, 0.4, 0.5, 1.0],\n\tunassumingIngenuous: [0.1875, 0.5750000000000002, 0.6875, 0.75, 0.8125, 1.0],\n\tunassuredSubmissive: [0.0625, 0.5, 0.625, 0.75, 0.875, 1.0],\n\tuniversalism: [\n\t\t0.0, 0.06666666666666665, 0.13333333333333336, 0.2666666666666667,\n\t\t0.3333333333333333, 0.9333333333333333,\n\t],\n\twarmAgreeable: [0.125, 0.6875, 0.75, 0.8125, 0.9375, 1.0],\n\twarrior: [\n\t\t0.12321999418773605, 0.5305870386515547, 0.6384626562045916,\n\t\t0.7083551293228711, 0.7947544318512061, 0.9999999999999998,\n\t],\n} as const;\n","import { z } from \"zod\";\nimport { EDGE_MAP } from \"./edge-map\";\n\nconst binnedSchema = z\n\t.enum([\"very_low\", \"low\", \"medium\", \"high\", \"very_high\"])\n\t.describe(\n\t\t\"Binned score category, can be used for interpretation, this is derived from the normalized score and the population distribution\",\n\t);\ntype Binned = z.infer<typeof binnedSchema>;\n// Number of bins (intervals) = edges.length - 1, constrained to 2..5\ntype IntervalCount = 2 | 3 | 4 | 5;\n\n/**\n * Type guard to check if a number is a valid IntervalCount (2-5).\n */\nfunction isValidIntervalCount(n: number): n is IntervalCount {\n\treturn n >= 2 && n <= 5;\n}\n\nexport function binScore(\n\tname: keyof typeof EDGE_MAP | string,\n\tnormalized: number,\n) {\n\tconst edges = EDGE_MAP[name as keyof typeof EDGE_MAP] ?? [\n\t\t0, 0.2, 0.4, 0.6, 0.8, 1,\n\t];\n\n\tconst rawIntervals = edges.length - 1;\n\tif (!isValidIntervalCount(rawIntervals)) {\n\t\tthrow new Error(\n\t\t\t`Invalid number of edges for ${name}, must define between 3 and 6 edges to create 2 to 5 intervals.`,\n\t\t);\n\t}\n\t// rawIntervals is now narrowed to IntervalCount\n\tconst intervals = rawIntervals;\n\n\t// Allowed label vocabulary (must match InterpretableScoreSchema enum)\n\tconst LabelSets: Record<IntervalCount, readonly Binned[]> = {\n\t\t2: [\"low\", \"high\"],\n\t\t3: [\"low\", \"medium\", \"high\"],\n\t\t4: [\"very_low\", \"low\", \"high\", \"very_high\"],\n\t\t5: [\"very_low\", \"low\", \"medium\", \"high\", \"very_high\"],\n\t} as const;\n\n\tconst labels = LabelSets[intervals];\n\n\t// Defensive copy + sort\n\tconst sorted = [...edges].sort((a, b) => a - b);\n\n\t// Array bounds are guaranteed by the validation above (at least 3 edges = 2 intervals)\n\tconst minEdge = sorted[0] ?? 0;\n\tconst maxEdge = sorted.at(-1) ?? 1;\n\tconst value = Math.min(Math.max(normalized, minEdge), maxEdge);\n\n\t// Bin selection - default to the last label (highest bin)\n\t// labels always has at least 2 elements based on LABEL_SETS definition\n\tconst lastLabel = labels.at(-1) ?? \"high\";\n\tlet binned: Binned = lastLabel;\n\tfor (let i = 0; i < intervals; i++) {\n\t\tconst upper = sorted[i + 1] ?? maxEdge;\n\t\tif (value <= upper) {\n\t\t\tbinned = labels[i] ?? binned;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn { binned, normalized };\n}\n","import { z } from \"zod\";\nimport { binScore } from \"./bin-score\";\n\nexport const InterpretableScoreSchema = z.object({\n\tbinned: z\n\t\t.enum([\"very_low\", \"low\", \"medium\", \"high\", \"very_high\"])\n\t\t.describe(\n\t\t\t\"Binned score category, can be used for interpretation, this is derived from the normalized score and the population distribution\",\n\t\t),\n\tnormalized: z\n\t\t.number()\n\t\t.gte(0)\n\t\t.lte(1)\n\t\t.describe(\"Normalized score from 0 to 1\")\n\t\t.transform((n) => Math.round(n * 100) / 100),\n});\nexport type InterpretableScoreSchema = z.infer<typeof InterpretableScoreSchema>;\n\nexport const LayeredLenses = z\n\t.object({\n\t\tarchetypal_story: z.object({\n\t\t\tpmai: z.object({\n\t\t\t\tcaregiver: InterpretableScoreSchema,\n\t\t\t\tcreator: InterpretableScoreSchema,\n\t\t\t\tidealist: InterpretableScoreSchema,\n\t\t\t\tjester: InterpretableScoreSchema,\n\t\t\t\tlover: InterpretableScoreSchema,\n\t\t\t\tmagician: InterpretableScoreSchema,\n\t\t\t\trealist: InterpretableScoreSchema,\n\t\t\t\trevolutionary: InterpretableScoreSchema,\n\t\t\t\truler: InterpretableScoreSchema,\n\t\t\t\tsage: InterpretableScoreSchema,\n\t\t\t\tseeker: InterpretableScoreSchema,\n\t\t\t\twarrior: InterpretableScoreSchema,\n\t\t\t}),\n\t\t}),\n\t\tcognitive_override: z.object({\n\t\t\tcrt: z.object({\n\t\t\t\tcrt_score: InterpretableScoreSchema,\n\t\t\t}),\n\t\t}),\n\t\tflexibility_mask: z.object({\n\t\t\tsms: z.object({\n\t\t\t\tself_monitoring: InterpretableScoreSchema,\n\t\t\t}),\n\t\t}),\n\t\tinterpersonal_stance: z.object({\n\t\t\tipip_ipc: z.object({\n\t\t\t\taloof_introverted: InterpretableScoreSchema,\n\t\t\t\tarrogant_calculating: InterpretableScoreSchema,\n\t\t\t\tassured_dominant: InterpretableScoreSchema,\n\t\t\t\tcold_hearted: InterpretableScoreSchema,\n\t\t\t\tgregarious_extraverted: InterpretableScoreSchema,\n\t\t\t\tunassuming_ingenuous: InterpretableScoreSchema,\n\t\t\t\tunassured_submissive: InterpretableScoreSchema,\n\t\t\t\twarm_agreeable: InterpretableScoreSchema,\n\t\t\t}),\n\t\t}),\n\t\tmotivational_weights: z.object({\n\t\t\tpvq: z.object({\n\t\t\t\tachievement: InterpretableScoreSchema,\n\t\t\t\tbenevolence: InterpretableScoreSchema,\n\t\t\t\tconformity: InterpretableScoreSchema,\n\t\t\t\tconservation: InterpretableScoreSchema,\n\t\t\t\thedonism: InterpretableScoreSchema,\n\t\t\t\tmrat: InterpretableScoreSchema,\n\t\t\t\topenness_to_change: InterpretableScoreSchema,\n\t\t\t\tpower: InterpretableScoreSchema,\n\t\t\t\tsecurity: InterpretableScoreSchema,\n\t\t\t\tself_direction: InterpretableScoreSchema,\n\t\t\t\tself_enhancement: InterpretableScoreSchema,\n\t\t\t\tself_transcendence: InterpretableScoreSchema,\n\t\t\t\tstimulation: InterpretableScoreSchema,\n\t\t\t\ttradition: InterpretableScoreSchema,\n\t\t\t\tuniversalism: InterpretableScoreSchema,\n\t\t\t}),\n\t\t}),\n\t\ttemperamental_reactivity: z.object({\n\t\t\tbis_bas: z.object({\n\t\t\t\tbas_drive: InterpretableScoreSchema,\n\t\t\t\tbas_fun_seeking: InterpretableScoreSchema,\n\t\t\t\tbas_reward_responsiveness: InterpretableScoreSchema,\n\t\t\t\tbis: InterpretableScoreSchema,\n\t\t\t}),\n\t\t\terq: z.object({\n\t\t\t\tcognitive_reappraisal: InterpretableScoreSchema,\n\t\t\t\texpressive_suppression: InterpretableScoreSchema,\n\t\t\t}),\n\t\t}),\n\t\ttrait_baseline: z.object({\n\t\t\thexaco: z.object({\n\t\t\t\tagreeableness: z.object({\n\t\t\t\t\tfacet: InterpretableScoreSchema,\n\t\t\t\t\tfactors: z.object({\n\t\t\t\t\t\tflexibility: InterpretableScoreSchema,\n\t\t\t\t\t\tforgiveness: InterpretableScoreSchema,\n\t\t\t\t\t\tgentleness: InterpretableScoreSchema,\n\t\t\t\t\t\tpatience: InterpretableScoreSchema,\n\t\t\t\t\t}),\n\t\t\t\t}),\n\t\t\t\tconscientiousness: z.object({\n\t\t\t\t\tfacet: InterpretableScoreSchema,\n\t\t\t\t\tfactors: z.object({\n\t\t\t\t\t\tdiligence: InterpretableScoreSchema,\n\t\t\t\t\t\torganization: InterpretableScoreSchema,\n\t\t\t\t\t\tperfectionism: InterpretableScoreSchema,\n\t\t\t\t\t\tprudence: InterpretableScoreSchema,\n\t\t\t\t\t}),\n\t\t\t\t}),\n\t\t\t\temotionality: z.object({\n\t\t\t\t\tfacet: InterpretableScoreSchema,\n\t\t\t\t\tfactors: z.object({\n\t\t\t\t\t\tanxiety: InterpretableScoreSchema,\n\t\t\t\t\t\tdependence: InterpretableScoreSchema,\n\t\t\t\t\t\tfearfulness: InterpretableScoreSchema,\n\t\t\t\t\t\tsentimentality: InterpretableScoreSchema,\n\t\t\t\t\t}),\n\t\t\t\t}),\n\t\t\t\textraversion: z.object({\n\t\t\t\t\tfacet: InterpretableScoreSchema,\n\t\t\t\t\tfactors: z.object({\n\t\t\t\t\t\tliveliness: InterpretableScoreSchema,\n\t\t\t\t\t\tsociability: InterpretableScoreSchema,\n\t\t\t\t\t\tsocial_boldness: InterpretableScoreSchema,\n\t\t\t\t\t\tsocial_self_esteem: InterpretableScoreSchema,\n\t\t\t\t\t}),\n\t\t\t\t}),\n\t\t\t\thonesty_humility: z.object({\n\t\t\t\t\tfacet: InterpretableScoreSchema,\n\t\t\t\t\tfactors: z.object({\n\t\t\t\t\t\tfairness: InterpretableScoreSchema,\n\t\t\t\t\t\tgreed_avoidance: InterpretableScoreSchema,\n\t\t\t\t\t\tmodesty: InterpretableScoreSchema,\n\t\t\t\t\t\tsincerity: InterpretableScoreSchema,\n\t\t\t\t\t}),\n\t\t\t\t}),\n\t\t\t\topenness_to_experience: z.object({\n\t\t\t\t\tfacet: InterpretableScoreSchema,\n\t\t\t\t\tfactors: z.object({\n\t\t\t\t\t\taesthetic_appreciation: InterpretableScoreSchema,\n\t\t\t\t\t\tcreativity: InterpretableScoreSchema,\n\t\t\t\t\t\tinquisitiveness: InterpretableScoreSchema,\n\t\t\t\t\t\tunconventionality: InterpretableScoreSchema,\n\t\t\t\t\t}),\n\t\t\t\t}),\n\t\t\t}),\n\t\t\tsd3: z.object({\n\t\t\t\tmachiavellianism: InterpretableScoreSchema,\n\t\t\t\tnarcissism: InterpretableScoreSchema,\n\t\t\t\tpsychopathy: InterpretableScoreSchema,\n\t\t\t}),\n\t\t}),\n\t})\n\t.describe(\n\t\t\"The layered lenses schema describe the final hashmap containing all layers values per individual.\",\n\t);\nexport type LayeredLenses = z.infer<typeof LayeredLenses>;\n\nexport const normalizedScore = z.number().min(0).max(1);\nexport type NormalizedScore = z.infer<typeof normalizedScore>;\n\nexport const mappaToInterpretable = z\n\t.object({\n\t\tachievement: normalizedScore,\n\t\tagreeablenessFacet: normalizedScore,\n\t\tagreeablenessFlexibility: normalizedScore,\n\t\tagreeablenessForgiveness: normalizedScore,\n\t\tagreeablenessGentleness: normalizedScore,\n\t\tagreeablenessPatience: normalizedScore,\n\t\taloofIntroverted: normalizedScore,\n\t\tarrogantCalculating: normalizedScore,\n\t\tassuredDominant: normalizedScore,\n\t\tbasDrive: normalizedScore,\n\t\tbasFunSeeking: normalizedScore,\n\t\tbasRewardResponsiveness: normalizedScore,\n\t\tbenevolence: normalizedScore,\n\t\tbis: normalizedScore,\n\t\tcaregiver: normalizedScore,\n\t\tcognitiveReappraisal: normalizedScore,\n\t\tcoldHearted: normalizedScore,\n\t\tconformity: normalizedScore,\n\t\tconscientiousnessDiligence: normalizedScore,\n\t\tconscientiousnessFacet: normalizedScore,\n\t\tconscientiousnessOrganization: normalizedScore,\n\t\tconscientiousnessPerfectionism: normalizedScore,\n\t\tconscientiousnessPrudence: normalizedScore,\n\t\tconservation: normalizedScore,\n\t\tcreator: normalizedScore,\n\t\tcrtScore: normalizedScore,\n\t\temotionalityAnxiety: normalizedScore,\n\t\temotionalityDependence: normalizedScore,\n\t\temotionalityFacet: normalizedScore,\n\t\temotionalityFearfulness: normalizedScore,\n\t\temotionalitySentimentality: normalizedScore,\n\t\texpressiveSuppression: normalizedScore,\n\t\textraversionFacet: normalizedScore,\n\t\textraversionLiveliness: normalizedScore,\n\t\textraversionSociability: normalizedScore,\n\t\textraversionSocialBoldness: normalizedScore,\n\t\textraversionSocialSelfEsteem: normalizedScore,\n\t\tgregariousExtraverted: normalizedScore,\n\t\thedonism: normalizedScore,\n\t\thonestyHumilityFacet: normalizedScore,\n\t\thonestyHumilityFairness: normalizedScore,\n\t\thonestyHumilityGreedAvoidance: normalizedScore,\n\t\thonestyHumilityModesty: normalizedScore,\n\t\thonestyHumilitySincerity: normalizedScore,\n\t\tidealist: normalizedScore,\n\t\tjester: normalizedScore,\n\t\tlover: normalizedScore,\n\t\tmachiavellianism: normalizedScore,\n\t\tmagician: normalizedScore,\n\t\tnarcissism: normalizedScore,\n\t\topennessAestheticAppreciation: normalizedScore,\n\t\topennessCreativity: normalizedScore,\n\t\topennessFacet: normalizedScore,\n\t\topennessInquisitiveness: normalizedScore,\n\t\topennessToChange: normalizedScore,\n\t\topennessUnconventionality: normalizedScore,\n\t\tpower: normalizedScore,\n\t\tpsychopathy: normalizedScore,\n\t\trealist: normalizedScore,\n\t\trevolutionary: normalizedScore,\n\t\truler: normalizedScore,\n\t\tsage: normalizedScore,\n\t\tsecurity: normalizedScore,\n\t\tseeker: normalizedScore,\n\t\tselfDirection: normalizedScore,\n\t\tselfEnhancement: normalizedScore,\n\t\tselfMonitoring: normalizedScore,\n\t\tselfTranscendence: normalizedScore,\n\t\tstimulation: normalizedScore,\n\t\ttradition: normalizedScore,\n\t\tunassumingIngenuous: normalizedScore,\n\t\tunassuredSubmissive: normalizedScore,\n\t\tuniversalism: normalizedScore,\n\t\twarmAgreeable: normalizedScore,\n\t\twarrior: normalizedScore,\n\t})\n\t.transform((d) => ({\n\t\tarchetypal_story: {\n\t\t\tpmai: {\n\t\t\t\tcaregiver: binScore(\"caregiver\", d.caregiver),\n\t\t\t\tcreator: binScore(\"creator\", d.creator),\n\t\t\t\tidealist: binScore(\"idealist\", d.idealist),\n\t\t\t\tjester: binScore(\"jester\", d.jester),\n\t\t\t\tlover: binScore(\"lover\", d.lover),\n\t\t\t\tmagician: binScore(\"magician\", d.magician),\n\t\t\t\trealist: binScore(\"realist\", d.realist),\n\t\t\t\trevolutionary: binScore(\"revolutionary\", d.revolutionary),\n\t\t\t\truler: binScore(\"ruler\", d.ruler),\n\t\t\t\tsage: binScore(\"sage\", d.sage),\n\t\t\t\tseeker: binScore(\"seeker\", d.seeker),\n\t\t\t\twarrior: binScore(\"warrior\", d.warrior),\n\t\t\t},\n\t\t},\n\t\tcognitive_override: {\n\t\t\tcrt: {\n\t\t\t\tcrt_score: binScore(\"crtScore\", d.crtScore),\n\t\t\t},\n\t\t},\n\t\tflexibility_mask: {\n\t\t\tsms: {\n\t\t\t\tself_monitoring: binScore(\"selfMonitoring\", d.selfMonitoring),\n\t\t\t},\n\t\t},\n\t\tinterpersonal_stance: {\n\t\t\tipip_ipc: {\n\t\t\t\taloof_introverted: binScore(\"aloofIntroverted\", d.aloofIntroverted),\n\t\t\t\tarrogant_calculating: binScore(\n\t\t\t\t\t\"arrogantCalculating\",\n\t\t\t\t\td.arrogantCalculating,\n\t\t\t\t),\n\t\t\t\tassured_dominant: binScore(\"assuredDominant\", d.assuredDominant),\n\t\t\t\tcold_hearted: binScore(\"coldHearted\", d.coldHearted),\n\t\t\t\tgregarious_extraverted: binScore(\n\t\t\t\t\t\"gregariousExtraverted\",\n\t\t\t\t\td.gregariousExtraverted,\n\t\t\t\t),\n\t\t\t\tunassuming_ingenuous: binScore(\n\t\t\t\t\t\"unassumingIngenuous\",\n\t\t\t\t\td.unassumingIngenuous,\n\t\t\t\t),\n\t\t\t\tunassured_submissive: binScore(\n\t\t\t\t\t\"unassuredSubmissive\",\n\t\t\t\t\td.unassuredSubmissive,\n\t\t\t\t),\n\t\t\t\twarm_agreeable: binScore(\"warmAgreeable\", d.warmAgreeable),\n\t\t\t},\n\t\t},\n\t\tmotivational_weights: {\n\t\t\tpvq: (() => {\n\t\t\t\tconst pvqScores = {\n\t\t\t\t\tachievement: binScore(\"achievement\", d.achievement),\n\t\t\t\t\tbenevolence: binScore(\"benevolence\", d.benevolence),\n\t\t\t\t\tconformity: binScore(\"conformity\", d.conformity),\n\t\t\t\t\tconservation: binScore(\"conservation\", d.conservation),\n\t\t\t\t\thedonism: binScore(\"hedonism\", d.hedonism),\n\t\t\t\t\topenness_to_change: binScore(\"opennessToChange\", d.opennessToChange),\n\t\t\t\t\tpower: binScore(\"power\", d.power),\n\t\t\t\t\tsecurity: binScore(\"security\", d.security),\n\t\t\t\t\tself_direction: binScore(\"selfDirection\", d.selfDirection),\n\t\t\t\t\tself_enhancement: binScore(\"selfEnhancement\", d.selfEnhancement),\n\t\t\t\t\tself_transcendence: binScore(\n\t\t\t\t\t\t\"selfTranscendence\",\n\t\t\t\t\t\td.selfTranscendence,\n\t\t\t\t\t),\n\t\t\t\t\tstimulation: binScore(\"stimulation\", d.stimulation),\n\t\t\t\t\ttradition: binScore(\"tradition\", d.tradition),\n\t\t\t\t\tuniversalism: binScore(\"universalism\", d.universalism),\n\t\t\t\t};\n\t\t\t\tconst pvqValues = Object.values(pvqScores);\n\n\t\t\t\tconst mrat =\n\t\t\t\t\tpvqValues.reduce((sum, value) => sum + value.normalized, 0) /\n\t\t\t\t\tpvqValues.length;\n\n\t\t\t\treturn {\n\t\t\t\t\t...pvqScores,\n\t\t\t\t\tmrat: binScore(\"mrat\", mrat),\n\t\t\t\t};\n\t\t\t})(),\n\t\t},\n\t\ttemperamental_reactivity: {\n\t\t\tbis_bas: {\n\t\t\t\tbas_drive: binScore(\"basDrive\", d.basDrive),\n\t\t\t\tbas_fun_seeking: binScore(\"basFunSeeking\", d.basFunSeeking),\n\t\t\t\tbas_reward_responsiveness: binScore(\n\t\t\t\t\t\"basRewardResponsiveness\",\n\t\t\t\t\td.basRewardResponsiveness,\n\t\t\t\t),\n\t\t\t\tbis: binScore(\"bis\", d.bis),\n\t\t\t},\n\t\t\terq: {\n\t\t\t\tcognitive_reappraisal: binScore(\n\t\t\t\t\t\"cognitiveReappraisal\",\n\t\t\t\t\td.cognitiveReappraisal,\n\t\t\t\t),\n\t\t\t\texpressive_suppression: binScore(\n\t\t\t\t\t\"expressiveSuppression\",\n\t\t\t\t\td.expressiveSuppression,\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t\ttrait_baseline: {\n\t\t\thexaco: {\n\t\t\t\tagreeableness: {\n\t\t\t\t\tfacet: binScore(\"agreeablenessFacet\", d.agreeablenessFacet),\n\t\t\t\t\tfactors: {\n\t\t\t\t\t\tflexibility: binScore(\n\t\t\t\t\t\t\t\"agreeablenessFlexibility\",\n\t\t\t\t\t\t\td.agreeablenessFlexibility,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tforgiveness: binScore(\n\t\t\t\t\t\t\t\"agreeablenessForgiveness\",\n\t\t\t\t\t\t\td.agreeablenessForgiveness,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tgentleness: binScore(\n\t\t\t\t\t\t\t\"agreeablenessGentleness\",\n\t\t\t\t\t\t\td.agreeablenessGentleness,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tpatience: binScore(\n\t\t\t\t\t\t\t\"agreeablenessPatience\",\n\t\t\t\t\t\t\td.agreeablenessPatience,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tconscientiousness: {\n\t\t\t\t\tfacet: binScore(\"conscientiousnessFacet\", d.conscientiousnessFacet),\n\t\t\t\t\tfactors: {\n\t\t\t\t\t\tdiligence: binScore(\n\t\t\t\t\t\t\t\"conscientiousnessDiligence\",\n\t\t\t\t\t\t\td.conscientiousnessDiligence,\n\t\t\t\t\t\t),\n\t\t\t\t\t\torganization: binScore(\n\t\t\t\t\t\t\t\"conscientiousnessOrganization\",\n\t\t\t\t\t\t\td.conscientiousnessOrganization,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tperfectionism: binScore(\n\t\t\t\t\t\t\t\"conscientiousnessPerfectionism\",\n\t\t\t\t\t\t\td.conscientiousnessPerfectionism,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tprudence: binScore(\n\t\t\t\t\t\t\t\"conscientiousnessPrudence\",\n\t\t\t\t\t\t\td.conscientiousnessPrudence,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\temotionality: {\n\t\t\t\t\tfacet: binScore(\"emotionalityFacet\", d.emotionalityFacet),\n\t\t\t\t\tfactors: {\n\t\t\t\t\t\tanxiety: binScore(\"emotionalityAnxiety\", d.emotionalityAnxiety),\n\t\t\t\t\t\tdependence: binScore(\n\t\t\t\t\t\t\t\"emotionalityDependence\",\n\t\t\t\t\t\t\td.emotionalityDependence,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tfearfulness: binScore(\n\t\t\t\t\t\t\t\"emotionalityFearfulness\",\n\t\t\t\t\t\t\td.emotionalityFearfulness,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tsentimentality: binScore(\n\t\t\t\t\t\t\t\"emotionalitySentimentality\",\n\t\t\t\t\t\t\td.emotionalitySentimentality,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\textraversion: {\n\t\t\t\t\tfacet: binScore(\"extraversionFacet\", d.extraversionFacet),\n\t\t\t\t\tfactors: {\n\t\t\t\t\t\tliveliness: binScore(\n\t\t\t\t\t\t\t\"extraversionLiveliness\",\n\t\t\t\t\t\t\td.extraversionLiveliness,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tsociability: binScore(\n\t\t\t\t\t\t\t\"extraversionSociability\",\n\t\t\t\t\t\t\td.extraversionSociability,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tsocial_boldness: binScore(\n\t\t\t\t\t\t\t\"extraversionSocialBoldness\",\n\t\t\t\t\t\t\td.extraversionSocialBoldness,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tsocial_self_esteem: binScore(\n\t\t\t\t\t\t\t\"extraversionSocialSelfEsteem\",\n\t\t\t\t\t\t\td.extraversionSocialSelfEsteem,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\thonesty_humility: {\n\t\t\t\t\tfacet: binScore(\"honestyHumilityFacet\", d.honestyHumilityFacet),\n\t\t\t\t\tfactors: {\n\t\t\t\t\t\tfairness: binScore(\n\t\t\t\t\t\t\t\"honestyHumilityFairness\",\n\t\t\t\t\t\t\td.honestyHumilityFairness,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tgreed_avoidance: binScore(\n\t\t\t\t\t\t\t\"honestyHumilityGreedAvoidance\",\n\t\t\t\t\t\t\td.honestyHumilityGreedAvoidance,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmodesty: binScore(\n\t\t\t\t\t\t\t\"honestyHumilityModesty\",\n\t\t\t\t\t\t\td.honestyHumilityModesty,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tsincerity: binScore(\n\t\t\t\t\t\t\t\"honestyHumilitySincerity\",\n\t\t\t\t\t\t\td.honestyHumilitySincerity,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\topenness_to_experience: {\n\t\t\t\t\tfacet: binScore(\"opennessFacet\", d.opennessFacet),\n\t\t\t\t\tfactors: {\n\t\t\t\t\t\taesthetic_appreciation: binScore(\n\t\t\t\t\t\t\t\"opennessAestheticAppreciation\",\n\t\t\t\t\t\t\td.opennessAestheticAppreciation,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcreativity: binScore(\"opennessCreativity\", d.opennessCreativity),\n\t\t\t\t\t\tinquisitiveness: binScore(\n\t\t\t\t\t\t\t\"opennessInquisitiveness\",\n\t\t\t\t\t\t\td.opennessInquisitiveness,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tunconventionality: binScore(\n\t\t\t\t\t\t\t\"opennessUnconventionality\",\n\t\t\t\t\t\t\td.opennessUnconventionality,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tsd3: {\n\t\t\t\tmachiavellianism: binScore(\"machiavellianism\", d.machiavellianism),\n\t\t\t\tnarcissism: binScore(\"narcissism\", d.narcissism),\n\t\t\t\tpsychopathy: binScore(\"psychopathy\", d.psychopathy),\n\t\t\t},\n\t\t},\n\t}))\n\t.pipe(LayeredLenses);\nexport type MappaToInterpretable = z.infer<typeof mappaToInterpretable>;\n\nexport const rawTraitMap = z\n\t.object({\n\t\tachievement: normalizedScore,\n\t\tagreeableness_facet: normalizedScore,\n\t\tagreeableness_flexibility: normalizedScore,\n\t\tagreeableness_forgiveness: normalizedScore,\n\t\tagreeableness_gentleness: normalizedScore,\n\t\tagreeableness_patience: normalizedScore,\n\t\taloof_introverted: normalizedScore,\n\t\tarrogant_calculating: normalizedScore,\n\t\tassured_dominant: normalizedScore,\n\t\tbas_drive: normalizedScore,\n\t\tbas_fun_seeking: normalizedScore,\n\t\tbas_reward_responsiveness: normalizedScore,\n\t\tbenevolence: normalizedScore,\n\t\tbis: normalizedScore,\n\t\tcaregiver: normalizedScore,\n\t\tcognitive_reappraisal: normalizedScore,\n\t\tcold_hearted: normalizedScore,\n\t\tconformity: normalizedScore,\n\t\tconscientiousness_diligence: normalizedScore,\n\t\tconscientiousness_facet: normalizedScore,\n\t\tconscientiousness_organization: normalizedScore,\n\t\tconscientiousness_perfectionism: normalizedScore,\n\t\tconscientiousness_prudence: normalizedScore,\n\t\tconservation: normalizedScore,\n\t\tcreator: normalizedScore,\n\t\tcrt_score: normalizedScore,\n\t\temotionality_anxiety: normalizedScore,\n\t\temotionality_dependence: normalizedScore,\n\t\temotionality_facet: normalizedScore,\n\t\temotionality_fearfulness: normalizedScore,\n\t\temotionality_sentimentality: normalizedScore,\n\t\texpressive_suppression: normalizedScore,\n\t\textraversion_facet: normalizedScore,\n\t\textraversion_liveliness: normalizedScore,\n\t\textraversion_sociability: normalizedScore,\n\t\textraversion_social_boldness: normalizedScore,\n\t\textraversion_social_self_esteem: normalizedScore,\n\t\tgregarious_extraverted: normalizedScore,\n\t\thedonism: normalizedScore,\n\t\thonesty_humility_facet: normalizedScore,\n\t\thonesty_humility_fairness: normalizedScore,\n\t\thonesty_humility_greed_avoidance: normalizedScore,\n\t\thonesty_humility_modesty: normalizedScore,\n\t\thonesty_humility_sincerity: normalizedScore,\n\t\tidealist: normalizedScore,\n\t\tjester: normalizedScore,\n\t\tlover: normalizedScore,\n\t\tmachiavellianism: normalizedScore,\n\t\tmagician: normalizedScore,\n\t\tnarcissism: normalizedScore,\n\t\topenness_aesthetic_appreciation: normalizedScore,\n\t\topenness_creativity: normalizedScore,\n\t\topenness_facet: normalizedScore,\n\t\topenness_inquisitiveness: normalizedScore,\n\t\topenness_to_change: normalizedScore,\n\t\topenness_unconventionality: normalizedScore,\n\t\tpower: normalizedScore,\n\t\tpsychopathy: normalizedScore,\n\t\trealist: normalizedScore,\n\t\trevolutionary: normalizedScore,\n\t\truler: normalizedScore,\n\t\tsage: normalizedScore,\n\t\tsecurity: normalizedScore,\n\t\tseeker: normalizedScore,\n\t\tself_direction: normalizedScore,\n\t\tself_enhancement: normalizedScore,\n\t\tself_monitoring: normalizedScore,\n\t\tself_transcendence: normalizedScore,\n\t\tstimulation: normalizedScore,\n\t\ttradition: normalizedScore,\n\t\tunassuming_ingenuous: normalizedScore,\n\t\tunassured_submissive: normalizedScore,\n\t\tuniversalism: normalizedScore,\n\t\twarm_agreeable: normalizedScore,\n\t\twarrior: normalizedScore,\n\t})\n\t.transform((v) => ({\n\t\tachievement: v.achievement,\n\t\tagreeablenessFacet: v.agreeableness_facet,\n\t\tagreeablenessFlexibility: v.agreeableness_flexibility,\n\t\tagreeablenessForgiveness: v.agreeableness_forgiveness,\n\t\tagreeablenessGentleness: v.agreeableness_gentleness,\n\t\tagreeablenessPatience: v.agreeableness_patience,\n\t\taloofIntroverted: v.aloof_introverted,\n\t\tarrogantCalculating: v.arrogant_calculating,\n\t\tassuredDominant: v.assured_dominant,\n\t\tbasDrive: v.bas_drive,\n\t\tbasFunSeeking: v.bas_fun_seeking,\n\t\tbasRewardResponsiveness: v.bas_reward_responsiveness,\n\t\tbenevolence: v.benevolence,\n\t\tbis: v.bis,\n\t\tcaregiver: v.caregiver,\n\t\tcognitiveReappraisal: v.cognitive_reappraisal,\n\t\tcoldHearted: v.cold_hearted,\n\t\tconformity: v.conformity,\n\t\tconscientiousnessDiligence: v.conscientiousness_diligence,\n\t\tconscientiousnessFacet: v.conscientiousness_facet,\n\t\tconscientiousnessOrganization: v.conscientiousness_organization,\n\t\tconscientiousnessPerfectionism: v.conscientiousness_perfectionism,\n\t\tconscientiousnessPrudence: v.conscientiousness_prudence,\n\t\tconservation: v.conservation,\n\t\tcreator: v.creator,\n\t\tcrtScore: v.crt_score,\n\t\temotionalityAnxiety: v.emotionality_anxiety,\n\t\temotionalityDependence: v.emotionality_dependence,\n\t\temotionalityFacet: v.emotionality_facet,\n\t\temotionalityFearfulness: v.emotionality_fearfulness,\n\t\temotionalitySentimentality: v.emotionality_sentimentality,\n\t\texpressiveSuppression: v.expressive_suppression,\n\t\textraversionFacet: v.extraversion_facet,\n\t\textraversionLiveliness: v.extraversion_liveliness,\n\t\textraversionSociability: v.extraversion_sociability,\n\t\textraversionSocialBoldness: v.extraversion_social_boldness,\n\t\textraversionSocialSelfEsteem: v.extraversion_social_self_esteem,\n\t\tgregariousExtraverted: v.gregarious_extraverted,\n\t\thedonism: v.hedonism,\n\t\thonestyHumilityFacet: v.honesty_humility_facet,\n\t\thonestyHumilityFairness: v.honesty_humility_fairness,\n\t\thonestyHumilityGreedAvoidance: v.honesty_humility_greed_avoidance,\n\t\thonestyHumilityModesty: v.honesty_humility_modesty,\n\t\thonestyHumilitySincerity: v.honesty_humility_sincerity,\n\t\tidealist: v.idealist,\n\t\tjester: v.jester,\n\t\tlover: v.lover,\n\t\tmachiavellianism: v.machiavellianism,\n\t\tmagician: v.magician,\n\t\tnarcissism: v.narcissism,\n\t\topennessAestheticAppreciation: v.openness_aesthetic_appreciation,\n\t\topennessCreativity: v.openness_creativity,\n\t\topennessFacet: v.openness_facet,\n\t\topennessInquisitiveness: v.openness_inquisitiveness,\n\t\topennessToChange: v.openness_to_change,\n\t\topennessUnconventionality: v.openness_unconventionality,\n\t\tpower: v.power,\n\t\tpsychopathy: v.psychopathy,\n\t\trealist: v.realist,\n\t\trevolutionary: v.revolutionary,\n\t\truler: v.ruler,\n\t\tsage: v.sage,\n\t\tsecurity: v.security,\n\t\tseeker: v.seeker,\n\t\tselfDirection: v.self_direction,\n\t\tselfEnhancement: v.self_enhancement,\n\t\tselfMonitoring: v.self_monitoring,\n\t\tselfTranscendence: v.self_transcendence,\n\t\tstimulation: v.stimulation,\n\t\ttradition: v.tradition,\n\t\tunassumingIngenuous: v.unassuming_ingenuous,\n\t\tunassuredSubmissive: v.unassured_submissive,\n\t\tuniversalism: v.universalism,\n\t\twarmAgreeable: v.warm_agreeable,\n\t\twarrior: v.warrior,\n\t}));\nexport type RawTraitMap = z.infer<typeof rawTraitMap>;\n\nexport const layeredLensesResponse = z.object({\n\tmodel_info: z.object({\n\t\tcheckpoint: z.string(),\n\t}),\n\ttraits: rawTraitMap,\n});\n\nexport type LayeredLensesResponse = z.infer<typeof layeredLensesResponse>;\n","import * as LayeredLensesModel from \"@mappa-ai/contracts/v1/layered-lenses\";\nimport { z } from \"zod\";\nimport { ConduitError } from \"../errors\";\nimport type {\n\tBehaviorMapDirectUploadRequest,\n\tBehaviorMapDirectUploadResult,\n\tBehaviorMapExport,\n} from \"../internal-types\";\nimport {\n\tDEFAULT_MAX_SOURCE_BYTES,\n\tmaterializeSource,\n} from \"../resources/source\";\nimport type { Transport } from \"../resources/transport\";\nimport { parseRes } from \"../resources/validate\";\n\nconst behaviorMapExportResponse = z.object({\n\tbehaviorMap: LayeredLensesModel.LayeredLenses,\n\tcreatedAt: z.iso.datetime(),\n\tentityId: z.string().min(1),\n\tmapId: z.string().min(1),\n\tmodelCheckpoint: z.string().min(1),\n});\n\nconst behaviorMapDirectUploadResponse = z.object({\n\tbehaviorMap: LayeredLensesModel.LayeredLenses,\n\tmodelCheckpoint: z.string().min(1),\n\tselectedSpeakerIndex: z.number().int().min(0),\n});\n\nfunction internalBehaviorMapsValidateSource(\n\treq: BehaviorMapDirectUploadRequest,\n) {\n\tconst keys = [\"file\", \"url\", \"path\"].filter((key) => key in req);\n\tif (keys.length === 1) {\n\t\treturn req;\n\t}\n\n\tthrow new ConduitError(\n\t\t\"directUpload() must include exactly one of file, url, or path\",\n\t\t{ code: \"invalid_request\" },\n\t);\n}\n\nfunction internalBehaviorMapsValidateTarget(\n\ttarget: BehaviorMapDirectUploadRequest[\"target\"],\n) {\n\tif (target.strategy === \"dominant\") {\n\t\treturn target;\n\t}\n\n\tif (!target.hint.trim()) {\n\t\tthrow new ConduitError(\"target.hint is required for magic_hint\", {\n\t\t\tcode: \"invalid_request\",\n\t\t});\n\t}\n\n\treturn target;\n}\n\nexport class InternalBehaviorMapsResource {\n\tprivate readonly transport: Transport;\n\tprivate readonly fetchImpl: typeof fetch;\n\tprivate readonly timeoutMs: number;\n\tprivate readonly maxSourceBytes: number;\n\n\tconstructor(\n\t\ttransport: Transport,\n\t\topts?: {\n\t\t\tfetchImpl?: typeof fetch;\n\t\t\ttimeoutMs?: number;\n\t\t\tmaxSourceBytes?: number;\n\t\t},\n\t) {\n\t\tthis.transport = transport;\n\t\tthis.fetchImpl = opts?.fetchImpl ?? fetch;\n\t\tthis.timeoutMs = opts?.timeoutMs ?? 300000;\n\t\tthis.maxSourceBytes = opts?.maxSourceBytes ?? DEFAULT_MAX_SOURCE_BYTES;\n\t}\n\n\tasync get(\n\t\tentityId: string,\n\t\topts?: { requestId?: string; signal?: AbortSignal },\n\t): Promise<BehaviorMapExport> {\n\t\tif (!entityId) {\n\t\t\tthrow new ConduitError(\"entityId must be a non-empty string\", {\n\t\t\t\tcode: \"invalid_request\",\n\t\t\t});\n\t\t}\n\n\t\tconst res = await this.transport.request<BehaviorMapExport>({\n\t\t\tmethod: \"GET\",\n\t\t\tpath: `/internal/behavior-maps/${encodeURIComponent(entityId)}`,\n\t\t\trequestId: opts?.requestId,\n\t\t\tretryable: true,\n\t\t\tsignal: opts?.signal,\n\t\t});\n\n\t\treturn parseRes(\n\t\t\tbehaviorMapExportResponse,\n\t\t\tres.data,\n\t\t\t\"internal.behaviorMaps.get\",\n\t\t);\n\t}\n\n\tasync directUpload(\n\t\treq: BehaviorMapDirectUploadRequest,\n\t): Promise<BehaviorMapDirectUploadResult> {\n\t\tif (typeof FormData === \"undefined\") {\n\t\t\tthrow new ConduitError(\n\t\t\t\t\"FormData is not available in this runtime; cannot perform multipart upload\",\n\t\t\t\t{ code: \"unsupported_runtime\" },\n\t\t\t);\n\t\t}\n\n\t\tconst source = internalBehaviorMapsValidateSource(req);\n\t\tconst target = internalBehaviorMapsValidateTarget(req.target);\n\t\tconst { file, label } = await materializeSource(source, {\n\t\t\tfetchImpl: this.fetchImpl,\n\t\t\tmaxSourceBytes: this.maxSourceBytes,\n\t\t\tsignal: req.signal,\n\t\t\ttimeoutMs: this.timeoutMs,\n\t\t});\n\n\t\tconst form = new FormData();\n\t\tform.append(\"file\", file, label);\n\t\tform.append(\"strategy\", target.strategy);\n\t\tif (target.strategy === \"magic_hint\") {\n\t\t\tform.append(\"hint\", target.hint);\n\t\t}\n\n\t\tconst res = await this.transport.request<BehaviorMapDirectUploadResult>({\n\t\t\tbody: form,\n\t\t\tmethod: \"POST\",\n\t\t\tpath: \"/internal/behavior-maps/direct-upload\",\n\t\t\trequestId: req.requestId,\n\t\t\tretryable: false,\n\t\t\tsignal: req.signal,\n\t\t});\n\n\t\treturn parseRes(\n\t\t\tbehaviorMapDirectUploadResponse,\n\t\t\tres.data,\n\t\t\t\"internal.behaviorMaps.directUpload\",\n\t\t);\n\t}\n}\n","import { InitializationError } from \"./errors\";\nimport { InternalBehaviorMapsResource } from \"./internal-resources/behavior-maps\";\nimport type {\n\tBehaviorMapDirectUploadRequest,\n\tBehaviorMapDirectUploadResult,\n\tBehaviorMapExport,\n\tInternalConduitClientOptions,\n} from \"./internal-types\";\nimport { Transport } from \"./resources/transport\";\n\ntype InternalConduitBehaviorMaps = {\n\tget: (\n\t\tentityId: string,\n\t\topts?: { requestId?: string; signal?: AbortSignal },\n\t) => Promise<BehaviorMapExport>;\n\tdirectUpload: (\n\t\treq: BehaviorMapDirectUploadRequest,\n\t) => Promise<BehaviorMapDirectUploadResult>;\n};\n\nclass InternalConduit {\n\tpublic readonly behaviorMaps: InternalConduitBehaviorMaps;\n\n\tconstructor(options: InternalConduitClientOptions) {\n\t\tif (!options.internalApiKey) {\n\t\t\tthrow new InitializationError(\"internalApiKey is required\", {\n\t\t\t\tcode: \"config_error\",\n\t\t\t});\n\t\t}\n\t\tif (isBrowserRuntime() && !options.dangerouslyAllowBrowser) {\n\t\t\tthrow new InitializationError(\n\t\t\t\t\"Conduit internal SDK cannot run in browser environments by default because internal API keys are secret. Use a server/edge proxy or pass dangerouslyAllowBrowser: true only if you understand the risk.\",\n\t\t\t\t{ code: \"unsupported_runtime\" },\n\t\t\t);\n\t\t}\n\n\t\tconst baseUrl = options.baseUrl ?? \"https://api.mappa.ai\";\n\t\tif (!isValidUrl(baseUrl)) {\n\t\t\tthrow new InitializationError(\"baseUrl must be a valid URL\", {\n\t\t\t\tcode: \"config_error\",\n\t\t\t});\n\t\t}\n\n\t\tconst transport = new Transport({\n\t\t\tapiKey: options.internalApiKey,\n\t\t\tauthHeaderName: \"x-internal-key\",\n\t\t\tbaseUrl,\n\t\t\tdefaultHeaders: options.defaultHeaders,\n\t\t\tfetch: options.fetch,\n\t\t\tmaxRetries: options.maxRetries ?? 2,\n\t\t\ttelemetry: options.telemetry,\n\t\t\ttimeoutMs: options.timeoutMs ?? 300000,\n\t\t\tuserAgent: options.userAgent,\n\t\t});\n\n\t\tconst behaviorMaps = new InternalBehaviorMapsResource(transport, {\n\t\t\tfetchImpl: options.fetch,\n\t\t\ttimeoutMs: options.timeoutMs ?? 300000,\n\t\t});\n\t\tthis.behaviorMaps = {\n\t\t\tdirectUpload: behaviorMaps.directUpload.bind(behaviorMaps),\n\t\t\tget: behaviorMaps.get.bind(behaviorMaps),\n\t\t};\n\t}\n}\n\nfunction isBrowserRuntime(): boolean {\n\tif (typeof globalThis.window === \"undefined\") return false;\n\tif (typeof document === \"undefined\") return false;\n\treturn true;\n}\n\nfunction isValidUrl(value: string): boolean {\n\ttry {\n\t\tnew URL(value);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport type { InternalConduitClientOptions } from \"./internal-types\";\nexport { InternalConduit };\n"],"mappings":";;;;AAAA,MAAa,WAAW;CACvB,aAAa;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAI;CAC3C,oBAAoB;EACnB;EAAsB;EAAQ;EAAoB;EAAO;EACzD;EACA;CACD,0BAA0B;EACzB;EAAqB;EAAqB;EAAK;EAAoB;EACnE;EACA;CACD,0BAA0B;EAAC;EAAK;EAAM;EAAK;EAAO;EAAM;EAAI;CAC5D,yBAAyB;EACxB;EAAK;EAAqB;EAAoB;EAAoB;EAAM;EACxE;CACD,uBAAuB;EAAC;EAAK;EAAK;EAAO;EAAM;EAAO;EAAI;CAC1D,kBAAkB;EAAC;EAAK;EAAO;EAAK;EAAO;EAAQ;EAAI;CACvD,qBAAqB;EAAC;EAAK;EAAO;EAAQ;EAAQ;EAAQ;EAAO;CACjE,UAAU;EAAC;EAAK;EAAoB;EAAK;EAAoB;EAAM;EAAI;CACvE,eAAe;EACd;EAAK;EAAoB;EAAoB;EAAoB;EAAM;EACvE;CACD,yBAAyB;EACxB;EAAqB;EAAoB;EACzC;EAAoB;EAAoB;EACxC;CACD,aAAa;EAAC;EAAK;EAAK;EAAK;EAAK;EAAI;CACtC,KAAK;EACJ;EAAK;EAAoB;EAAoB;EAC7C;EAAoB;EACpB;CACD,WAAW;EACV;EAAK;EAAoB;EAAoB;EAAM;EAAoB;EACvE;CACD,sBAAsB;EACrB;EAAK;EAAoB;EAAoB;EAC7C;EAAoB;EACpB;CACD,aAAa;EAAC;EAAK;EAAM;EAAQ;EAAQ;EAAK;EAAO;CACrD,YAAY;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAI;CAC1C,4BAA4B;EAAC;EAAO;EAAO;EAAM;EAA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