|
1
|
|
-import{A as p,a as g,t as y}from"./Translator.js?ver=1.6.2";import{d as f}from"./dayjs.min.js?ver=1.6.2";import{u as x,t as S}from"./timezone.js?ver=1.6.2";import{C as w}from"./CurrencyFormatter.js?ver=1.6.2";f.extend(x);f.extend(S);class _{static debounce(a,e=300,n=null){let r;return(...s)=>{clearTimeout(r),r=setTimeout(()=>{a.bind(n)(...s)},e)}}}function N(t,a="MMM DD"){const e=p.get("datei18"),n=f.utc(t).local().locale({name:"fluent_date_time",weekdays:Object.values(e.weekdays),weekdaysShort:Object.values(e.weekdaysShort),months:Object.values(e.months),monthsShort:Object.values(e.monthsShort),meridiem:(r,s,o)=>{const l=e.am||"AM",u=e.pm||"PM",d=r<12?l:u;return o?d.toLowerCase():d}}).format(a);return A(n)}const A=function(t,a){return t&&(p.get("datei18"),t=t.toString(),g(t))};function C(t){if(t==null)return!0;if(typeof t=="string"||Array.isArray(t))return t.length===0;if(typeof t=="object")return Object.values(t).length===0}function E(t,a){typeof t>"u"||t===null||(Array.isArray(t)?t.forEach((e,n)=>{a(e,n)}):typeof t=="object"&&Object.keys(t).forEach((e,n)=>{let r=t[e];a(r,e)}))}function P(t,a="billing",e=!1){return t?(t.formatted_address&&(t=t.formatted_address),[e?" ":t.name,t.address_1,t.address_2,t.city,t.state,t.postcode,t.country].filter(s=>s!==null&&typeof s<"u"&&s.toString().trim().length>0).join(", ")||y("No %s address provided",a)):""}function z(t,a=null){return w.formatNumber(Math.round(Number(t)||0),!0,!1,a)}function D(t,a,e,n,r){const o=r.viewSize[0],l=r.viewSize[1],u=r.contentSize[0],d=r.contentSize[1],c=t[0]-16-u,m=t[0]+16;let i=t[0]>o/2?c:m;i<16?i=m:i+u>o-16&&(i=c),i=Math.min(Math.max(16,i),Math.max(16,o-u-16));const h=Math.min(Math.max(16,t[1]-d/2),Math.max(16,l-d-16));return[i,h]}function H(t,a,e=null,n="line"){return n==="bar"?{type:"shadow",shadowStyle:{color:t?a:"rgba(103, 129, 168, 0.10)"}}:{type:"line",lineStyle:{type:"solid",width:2,color:t?a:e}}}export{_ as U,D as a,z as b,H as c,N as d,E as e,C as i,P as p}; |
|
1
|
+import{A as g,a as h,t as y}from"./Translator.js?ver=1.6.5";import{d as o}from"./dayjs.min.js?ver=1.6.5";import{u as x,t as A}from"./timezone.js?ver=1.6.5";import{a as S,w}from"./weekOfYear.js?ver=1.6.5";import{t as v,f as M,r as T,C as _}from"./CurrencyFormatter.js?ver=1.6.5";o.extend(x);o.extend(A);o.extend(S);o.extend(w);class D{static debounce(e,r=300,n=null){let a;return(...i)=>{clearTimeout(a),a=setTimeout(()=>{e.bind(n)(...i)},r)}}}function H(t,e="date_short"){const r=v(t).locale(M()).format(T(e));return N(r)}const N=function(t,e){return t&&(g.get("datei18"),t=t.toString(),h(t))};function I(t){if(t==null)return!0;if(typeof t=="string"||Array.isArray(t))return t.length===0;if(typeof t=="object")return Object.values(t).length===0}function L(t,e){typeof t>"u"||t===null||(Array.isArray(t)?t.forEach((r,n)=>{e(r,n)}):typeof t=="object"&&Object.keys(t).forEach((r,n)=>{let a=t[r];e(a,r)}))}function P(t,e="billing",r=!1){return t?(t.formatted_address&&(t=t.formatted_address),[r?" ":t.name,t.address_1,t.address_2,t.city,t.state,t.postcode,t.country].filter(i=>i!==null&&typeof i<"u"&&i.toString().trim().length>0).join(", ")||y("No %s address provided",e)):""}function U(t,e=null){return _.formatNumber(Math.round(Number(t)||0),!0,!1,e)}function W(t,e,r,n,a){const d=a.viewSize[0],m=a.viewSize[1],u=a.contentSize[0],f=a.contentSize[1],l=t[0]-16-u,c=t[0]+16;let s=t[0]>d/2?l:c;s<16?s=c:s+u>d-16&&(s=l),s=Math.min(Math.max(16,s),Math.max(16,d-u-16));const p=Math.min(Math.max(16,t[1]-f/2),Math.max(16,m-f-16));return[s,p]}function R(t,e,r=null,n="line"){return n==="bar"?{type:"shadow",shadowStyle:{color:t?e:"rgba(103, 129, 168, 0.10)"}}:{type:"line",lineStyle:{type:"solid",width:2,color:t?e:r}}}export{D as U,W as a,U as b,R as c,H as d,L as e,I as i,P as p}; |