import{n as t}from"../i18n-B98kiI7M.js";import{D as n,E as r}from"../intlFormat-DNT_1eg4.js";import{n as e}from"../NumberFormat-CVAfQTsE.js";import"../observable-tloG64m6.js";import{a as i}from"../normalize-C0Pp7GJL.js";import"./features.js";import{i as s}from"../utils-CB_20U-G.js";import"./i18nCldrOptions.js";import"../ssr-C2pjZzfv.js";import"./iso8601Utils.js";import"./i18nService.js";import"./configProvider.js";import"../empty_html-CjXB8rB4.js";import"@kdcloudjs/kwc";import"../classSet-DY6Qvt6E.js";import"../labelUtils-DAuN2uUV.js";import"../label-CY8Q8HAO.js";import"./utilsPrivate.js";import"../client-Ddi3i8XR.js";import"../colorValid-qIPgkqGp.js";const{groupingSeparator:o,decimalSeparator:a}=t,c=new RegExp("^[-+0-9kKmMbBtTeE.,٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯෦-෯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꧰-꧹꩐-꩙꯰-꯹]$"),l={k:3,m:6,b:9,t:12},u=["k","m","b","t"],f=["+","-"];function p(t){const n=j(t);return isNaN(n)?"":n}function m(t){return!isNaN(j(t))}function g(t){return n(t.replace(".",a))}function h({value:t,increment:n,step:r,fractionDigits:e}){const i=""===t||null==t?"0":t,s=parseFloat(r);let o;if(isNaN(s))o=parseFloat(i)+n;else{const t=n*s;o=parseFloat(i)+t}return o.toFixed(e)}function d(t){let n;if(t){const r=String(t).toLowerCase();if("any"!==r){let t=0;if(r.indexOf(".")>=0&&r.indexOf("e")<0){const n=r.split(".")[1];parseInt(n,10)>0&&(t=n.length)}else if(r.indexOf("e-")>0){const n=r.split("e-"),e=n[0].split(".")[1],i=n[1],s=e?e.length:0;t=parseInt(i,10)+s}n=t}}return n}function b(t,n){if(s(t))return"";let r=t,i=t;const o=n.style,a={style:o};if(a.minimumFractionDigits=n.minimumFractionDigits,a.maximumFractionDigits=n.maximumFractionDigits,"percent-fixed"===o){a.style="percent";const t=i.toString(),n=parseFloat(i)/100;i=t.indexOf(".")>0&&t.indexOf("e")<0?n.toFixed(t.split(".")[1].length+2):n}try{r=e(a).format(i)||""}catch(t){}return r}function j(t,n){if(null==t||0===t.length)return"";const e=n?n.decimalSeparator:a,i=n?n.groupSeparator:o;let s=t.split(i).join("");return"."!==e&&(s=s.replace(e,".")),N(function(t){const n=t.indexOf(".");if(0===n||1===n){const r=t.charAt(0);"+"!==r&&"-"!==r&&"."!==r||(t=`${t.substring(0,n)}0${t.substring(n)}`)}return t}(r(s)))}function x(t){return c.test(t)}function $(t){const n="string"==typeof t?Number(t):t;return void 0===i(n)?"":String(t)}function F(t){const n=f.join(""),r=new RegExp(`[${n}]`);return!!t.match(r)}function w(t){const n=t.toLowerCase().trim(),r=u.join(""),e=new RegExp(`([${r}])`,"g"),i=n.match(e);if(i&&i.length>1)return!1;const s=new RegExp(`[${r}]$`);return null!==n.match(s)&&n.length>1}function N(t){if(!w(t))return t;let n=t.toLowerCase().trim();const r=n.charAt(n.length-1);if(n=n.substring(0,n.length-1),isNaN(n))return t;const e=n.split(".");let i=0;e.length>1&&(i=e[1].length);const s=l[r],o=Math.max(0,i-s);return parseFloat(n*Math.pow(10,s)).toFixed(o)}function E(t){const n=`${t}`.match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return n?Math.max(0,(n[1]?n[1].length:0)-(n[2]?Number(n[2]):0)):0}function O(t){return["Backspace","Delete","ArrowLeft","ArrowRight","Tab","Escape","Enter","Home","End"].includes(t)}function S(t){return/^\d$/.test(t)||"."===t||"-"===t}function v(t){return/^0\d+/.test(t)&&!t.startsWith("0.")||/^-0\d+/.test(t)&&!t.startsWith("-0.")}function y(t,n,r,e,i){const s=t.substring(0,r)+n+t.substring(e);if("-"===n&&((s.match(/-/g)||[]).length>1||0!==r))return!1;if("."===n){if(0===i)return!1;if((s.match(/\./g)||[]).length>1)return!1;if("."===s||"-."===s)return!1}if(s.includes(".")&&i>0){if((s.split(".")[1]||"").length>i)return!1}return!v(s)}function D(t,n){const r=t.replace(/。/,".");let e=t.split("").filter(t=>S(t)).join("");if(e.includes("-")){const t=e.indexOf("-");e=0===t?`-${e.substring(1).replace(/-/g,"")}`:e.replace(/-/g,"")}if(0===n)e=e.replace(/\./g,"");else if(e.includes(".")){const t=e.indexOf(".");e=e.substring(0,t+1)+e.substring(t+1).replace(/\./g,"")}for(e.startsWith(".")&&(e=e.substring(1)),e.startsWith("-.")&&e.length>2&&(e=`-${e.substring(2)}`);v(e);)e.startsWith("0")?e=e.substring(1):e.startsWith("-0")&&(e=`-${e.substring(2)}`);if(""===e&&r.includes("-")&&1===r.length&&(e="-"),""===e&&"0"===r&&(e="0"),e.includes(".")&&n>0){const t=e.split(".");e=`${t[0]}.${(t[1]||"").substring(0,n)}`}return e}export{d as calculateFractionDigitsFromStep,D as cleanValue,N as expandShortcuts,b as formatNumber,g as fromIsoDecimal,E as getDecimalPlaces,w as hasValidNumberShortcut,F as hasValidNumberSymbol,h as increaseNumberByStep,S as isAllowedChar,O as isControlKey,y as isValidInput,m as isValidNumber,x as isValidNumberCharacter,$ as stringifyNumber,p as toIsoDecimal,j as transformLocalizedNumberToIsoDecimal};
