var T=Object.defineProperty,Z=Object.defineProperties;var _=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var v=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var $=(i,e,t)=>e in i?T(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,h=(i,e)=>{for(var t in e||(e={}))v.call(e,t)&&$(i,t,e[t]);if(b)for(var t of b(e))z.call(e,t)&&$(i,t,e[t]);return i},d=(i,e)=>Z(i,_(e));import{bC as P,b as W,m as o,c as f,aq as B,d as F,r as O,w as V,e as p,a6 as j,f as q,o as I,g as x,k as S,J as w,h as L,L as g,M as y,P as U,n as A,a4 as E,an as G,q as J}from"./index-C2C--_0G.js";class c{constructor(e){this.utc=!1;const t=this.parseConfig(e);this.date=new Date(t),this.timeZone=this.date.getTimezoneOffset()/60,this.timeZoneString=this.padNumber(String(-1*this.timeZone).replace(/^(.)?(\d)/,"$10$200"),5,"+"),this.mYear=this.date.getFullYear(),this.mMonth=this.date.getMonth(),this.mDay=this.date.getDate(),this.mWeek=this.date.getDay(),this.mHour=this.date.getHours(),this.mMinute=this.date.getMinutes(),this.mSecond=this.date.getSeconds()}parseConfig(e){return e?P(e)?e:/^(\d){8}$/.test(e)?(this.utc=!0,`${e.substr(0,4)}-${e.substr(4,2)}-${e.substr(6,2)}`):e:new Date}padNumber(e,t,n){return!e||e.length>=t?e:`${Array(t+1-e.length).join(n)}${e}`}year(){return this.mYear}month(){return this.mMonth}unix(){const e=this.utc?60*this.timeZone*60*1e3:0;return Math.floor((this.date.getTime()+e)/1e3)}toString(){return this.date.toUTCString()}startOf(e){switch(e){case"year":return new c(new Date(this.year(),0,1));case"month":return new c(new Date(this.year(),this.month(),1));default:return this}}add(e,t){let n;switch(t){case"m":case"minutes":n=60;break;case"h":case"hours":n=60*60;break;case"d":case"days":n=24*60*60;break;case"w":case"weeks":n=7*24*60*60;break;default:n=1}const l=this.unix()+e*n;return new c(1e3*l)}subtract(e,t){return this.add(-1*e,t)}format(e="YYYY-MM-DDTHH:mm:ssZ"){const t=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];return e.replace(/Y{2,4}|M{1,2}|D{1,2}|d{1,4}|H{1,2}|m{1,2}|s{1,2}|Z{1,2}/g,n=>{switch(n){case"YY":return String(this.mYear).slice(-2);case"YYYY":return String(this.mYear);case"M":return String(this.mMonth+1);case"MM":return this.padNumber(String(this.mMonth+1),2,"0");case"D":return String(this.mDay);case"DD":return this.padNumber(String(this.mDay),2,"0");case"d":return String(this.mWeek);case"dddd":return t[this.mWeek];case"H":return String(this.mHour);case"HH":return this.padNumber(String(this.mHour),2,"0");case"m":return String(this.mMinute);case"mm":return this.padNumber(String(this.mMinute),2,"0");case"s":return String(this.mSecond);case"ss":return this.padNumber(String(this.mSecond),2,"0");case"Z":return`${this.timeZoneString.slice(0,-2)}:00`;case"ZZ":return this.timeZoneString;default:return n}})}}function K(i){return new c(i)}const Q=d(h({},W),{type:o("default"),text:B(""),size:o(""),mode:o("text"),decoration:o("none"),call:f(!1),bold:f(!1),format:f(!1),color:o(""),prefix:String,suffix:String,lines:Number,lineHeight:o(""),customStyle:o(""),customClass:o("")}),R={name:"wd-text",options:{virtualHost:!0,addGlobalClass:!0,styleIsolation:"shared"}},X=F(d(h({},R),{props:Q,emits:["click"],setup(i,{emit:e}){const t=i,n=e,l=O("");V(()=>({type:t.type,text:t.text,mode:t.mode,color:t.color,bold:t.bold,lines:t.lines,format:t.format}),({type:s})=>{Y()},{deep:!0,immediate:!0});const k=p(()=>`wd-text ${t.customClass} ${l.value}`),M=p(()=>{const s={};return t.color&&(s.color=t.color),t.size&&(s["font-size"]=`${t.size}`),t.lineHeight&&(s["line-height"]=`${t.lineHeight}`),t.decoration&&(s["text-decoration"]=`${t.decoration}`),`${j(s)}${t.customStyle}`});function Y(){const{type:s,color:a,bold:r,lines:m}=t,u=[];a||u.push(`is-${s}`),G(m)&&u.push(`is-lines-${m}`),r&&u.push("is-bold"),l.value=u.join(" ")}function D(s,a,r){if(a){if(r==="phone")return s.replace(/^(\d{3})\d{4}(\d{4})$/,"$1****$2");if(r==="name")return s.replace(/^(.).*(.)$/,"$1**$2");throw new Error("mode must be one of phone or name for encryption")}return s}function C(s){s=Number(s).toFixed(2);const a=s.split(".");let r=a[0];const m=a.length>1?"."+a[1]:"",u=/(\d+)(\d{3})/;for(;u.test(r);)r=r.replace(u,"$1,$2");return r+m}const N=p(()=>{const{text:s,mode:a,format:r}=t;return a==="date"?K(Number(s)).format("YYYY-MM-DD"):a==="price"?C(s):D(`${s}`,r,a)});function H(s){n("click",s)}return(s,a)=>{const r=U;return I(),q(r,{onClick:H,class:E(k.value),style:A(M.value)},{default:x(()=>[s.$slots.prefix||s.prefix?S(s.$slots,"prefix",{key:0},()=>[g(y(s.prefix),1)],!0):w("",!0),L(r,null,{default:x(()=>[g(y(N.value),1)]),_:1}),s.$slots.suffix||s.suffix?S(s.$slots,"suffix",{key:1},()=>[g(y(s.suffix),1)],!0):w("",!0)]),_:3},8,["class","style"])}}})),se=J(X,[["__scopeId","data-v-3ee43bbe"]]);export{se as _};