{"version":3,"file":"finished_catalog.ce-SukDl.mjs","names":[],"sources":["https:/framerusercontent.com/modules/7j09P03AESfmtbn76h01/jiCTBrdqGwbZ1VgomC3P/finished_catalog.js"],"sourcesContent":["export const apiBase=\"https://orders-api.xtillman.workers.dev\";export function centsToUsd(cents){return(cents/100).toLocaleString(\"en-US\",{style:\"currency\",currency:\"USD\"});}export function variantOptionsOf(options){return options.filter(o=>o.kind===\"variant\").sort((a,b)=>a.sort-b.sort);}export function selectionOptionsOf(options){return options.filter(o=>o.kind===\"selection\").sort((a,b)=>a.sort-b.sort);}// Resolve the selected variant-option values to one variant by matching the sorted\n// value-id set against each variant's option_value_ids (the combo_key contract from\n// orders-api/src/catalog-grid.ts). Returns null until every variant option is chosen.\n// For a flat product (no variant options) callers should NOT use this; the calling component\n// selects a variant directly by label (the variantOptions.length check in FinishedShop).\nexport function resolveVariant(variantOptions,variants,selectedByOption){const wanted=[];for(const opt of variantOptions){const v=selectedByOption[opt.id];if(v==null)return null;wanted.push(v);}const wantedKey=wanted.slice().sort((a,b)=>a-b).join(\"|\");for(const variant of variants){const key=(variant.option_value_ids??[]).slice().sort((a,b)=>a-b).join(\"|\");if(key===wantedKey)return variant;}return null;}// Category line-art glyphs (viewBox 0 0 64 64, stroke=currentColor, fill=none), keyed by a\n// normalized category. Used as the no-image placeholder alongside a \"photo coming soon\" tag.\nexport const CATEGORY_ART={bollards:'<rect x=\"26\" y=\"15\" width=\"12\" height=\"37\" rx=\"6\"/><path d=\"M18 52 H46\"/><path d=\"M27 26 H37 M27 31 H37\"/>',\"guard rails\":'<path d=\"M20 18 V52 M44 18 V52 M14 27 H50 M14 39 H50 M15 52 H25 M39 52 H49\"/>',grating:'<rect x=\"15\" y=\"16\" width=\"34\" height=\"32\" rx=\"2\"/><path d=\"M24 16 V48 M32 16 V48 M40 16 V48 M15 27 H49 M15 37 H49\"/>',\"stair treads\":'<path d=\"M13 51 H23 V42 H33 V33 H43 V24 H53\"/>',ladders:'<path d=\"M16 18 H40 M22 18 L18 46 M34 18 L38 46 M21 26 H35 M20 32 H36 M19 39 H37\"/><circle cx=\"18\" cy=\"48\" r=\"2.2\"/><circle cx=\"38\" cy=\"48\" r=\"2.2\"/>',mezzanines:'<path d=\"M14 28 H50 M14 32 H50 M19 32 V50 M32 32 V50 M45 32 V50 M20 28 V18 M44 28 V18 M20 18 H44\"/>',handrail:'<path d=\"M20 18 V52 M44 18 V52 M14 27 H50 M14 39 H50 M15 52 H25 M39 52 H49\"/>',stairs:'<path d=\"M13 51 H23 V42 H33 V33 H43 V24 H53\"/>',default:'<path d=\"M16 16 H48 M16 48 H48 M32 16 V48\"/>'};export function categoryArt(category){return CATEGORY_ART[category.trim().toLowerCase()]??CATEGORY_ART.default;}export function pricedLines(basket){return basket.filter(l=>l.kind===\"priced\");}export function quoteLines(basket){return basket.filter(l=>l.kind===\"quote\");}// Only priced lines contribute. A quote line has no price to add, and treating a missing price\n// as 0 is exactly the bug that would make a subtotal look complete when it is not.\nexport function basketSubtotalCents(basket){return pricedLines(basket).reduce((sum,l)=>sum+l.unit_cents*l.qty,0);}// One number for the header badge, counting BOTH buckets: the button owns the whole basket, so\n// a badge that ignored quote lines would under-report what the customer has collected.\nexport function basketCount(basket){return basket.reduce((sum,l)=>sum+(l.kind===\"priced\"?l.qty:1),0);}\nexport const __FramerMetadata__ = {\"exports\":{\"CartLine\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"basketCount\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShopListProduct\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShopAddon\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"centsToUsd\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShopVariant\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShopDownload\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"variantOptionsOf\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShopOptionValue\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"BasketLine\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"selectionOptionsOf\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"apiBase\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShopOption\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShopDetail\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"pricedLines\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"PricedLine\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"quoteLines\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"resolveVariant\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"QuoteLine\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"CATEGORY_ART\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"categoryArt\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"basketSubtotalCents\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./finished_catalog.map"],"mappings":"oDAA+D,SAAgB,EAAW,EAAM,CAAC,OAAO,EAAM,IAAA,CAAK,eAAe,QAAQ,CAAC,MAAM,WAAW,SAAS,KAAK,CAAC,CAAE,CAAC,SAAgB,EAAiB,EAAQ,CAAC,OAAO,EAAQ,OAAO,GAAG,EAAE,OAAO,SAAS,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAE,CAAC,SAAgB,EAAmB,EAAQ,CAA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