import{n as e,p as t,y as n}from"./globalCategorySettings-BuKUniuw.js";var r=99999,i=888;function a(e){i=e.goofishDefaultStock}function o(){return i}function s(e){let t=C(e);if(!t)return null;let n=Number(t);return Number.isFinite(n)?n:null}function c(e,t){let n=e*(1+(Number.isFinite(t)?t:0)/100);return Math.round(n*100)/100}function l(e,t){let n=s(e);return n==null?C(e):String(c(n,t))}function u(e,t){let n=l(e,t),r=Number(n);return{...e,price:Number.isFinite(r)?r:e.price,priceText:n?`¥${n}`:e.priceText}}function d(e,t,n){if(e==null||!Number.isFinite(e))return t;let r=Math.floor(e);return r<=0?t:Math.min(r,n)}function f(e){return d(e,100,100)}function p(e){return d(e,i,r)}function m(e,t){return{...u(e,t),quantity:p(e.quantity)}}function h(e){let t=e.replace(/%/g,``).trim();if(!t)return 0;let n=Number(t);return!Number.isFinite(n)||n<0||n>500?null:Math.round(n*100)/100}function g(e){return String(Number.isFinite(e)?e:0)}function _(e){return e.replace(/[¥,\s]/g,``).trim()}function v(e){return t(e.description.trim())}function y(e,t=30){let n=Array.from(e.trim());return n.length<=t?n.join(``):n.slice(0,t).join(``)}function b(e){return y(e.title?.trim()||``)}function x(e){let t=e.skus??[];if(!t.length)return;let n=t.find(e=>e.quantity!=null&&Number.isFinite(e.quantity)&&e.quantity>0)??t[0];if(n?.quantity!=null&&Number.isFinite(n.quantity)){let e=Math.floor(Number(n.quantity));if(e>0)return Math.min(e,r)}return o()}function S(t,r,i){let a=x(t),o=e(t,r),s=n(t,i);return{title:b(t),description:v(t),priceYuan:_(t.price.currentText)||`0`,...a==null?{}:{stock:a},...o.length?{categoryPath:o}:{},...s?{shippingLocation:s}:{}}}function C(e){return e.price!=null&&Number.isFinite(e.price)?String(e.price):_(e.priceText??``)}export{g as a,h as c,l as i,m as l,C as n,p as o,y as r,f as s,S as t,a as u};