import{B as E,i as M,a as U,s as v,f as L,b as D,g as H}from"./VennDiagram.svelte_svelte_type_style_lang.D7p4KQI7.js";import{Q as z,s as S,R as h,G as d,H as c,d as p,g as o,h as y,S as w,i as A,j as g,z as C,T as b,U as x,w as k,x as B,y as G}from"./scheduler.C39PMv9a.js";import{S as X,i as Y}from"./index.Te5Nl1-a.js";const Z="customFormattingSettings",$="_inputs";function O(e,...t){if(typeof e=="function")throw new Error("You must supply the data as the first argument to tidy()");let r=e;for(const i of t)i&&(r=i(r));return r}function N(e){return r=>{const i=r.map(f=>({...f}));let n=0;for(const f of i){for(const a in e){const s=e[a],l=typeof s=="function"?s(f,n,i):s;f[a]=l}++n}return i}}function _(e){if(e&&typeof e=="string"){let t=e.split(" ");e.includes(":")||(e=e+"T00:00:00"),t.length>2&&(e=t[0]+" "+t[1]);const r=/\.([^\s]+)/;e=e.replace(r,""),e=e.replace("Z",""),e=e.replace(" ","T")}return e}function ee(e,t){return e=O(e,N({[t]:r=>r[t]?new Date(_(r[t])):null})),e}function te(e,t){return e=O(e,N({[t]:r=>_(r[t])})),e}const R="axis",u="value",V=()=>{var e;try{return((e=z(Z))==null?void 0:e.getCustomFormats())||[]}catch{return[]}},re=(e,t,r)=>{let i=P(e);if(t.evidenceType==="string")return;if(i){let f=V(),a=[...E,...f].find(s=>{var l,T;return((l=s.formatTag)==null?void 0:l.toLowerCase())===((T=i==null?void 0:i.toLowerCase)==null?void 0:T.call(i))});if(a)return a}let n=D(e,t,r);if(n)return n};function ne(e,t=void 0){let r=e,i=V(),n=[...E,...i].find(a=>{var s,l;return((s=a.formatTag)==null?void 0:s.toLowerCase())===((l=r==null?void 0:r.toLowerCase)==null?void 0:l.call(r))}),f={};return n||(f={formatTag:"custom",formatCode:r},t&&(f.valueType=t),f)}const ie=(e,t=void 0,r=void 0)=>{try{return m(e,t,r,u)}catch(i){return console.warn(`Unexpected error calling applyFormatting(${e}, ${t}, ${u}, ${r}). Error=${i}`),e}},se=(e,t=void 0,r=void 0)=>{try{return m(e,t,r,R)}catch{}return e},ae=(e,t)=>{let r=e;if(e&&(t!=null&&t.formatTag)){let i=e.toLowerCase().lastIndexOf(`_${t.formatTag.toLowerCase()}`),n="";i>0&&(typeof(t==null?void 0:t.titleTagReplacement)=="string"&&(n=t.titleTagReplacement),r=e.substring(0,i)+n)}return r},j=e=>{switch(e){case"number":return 1234;case"date":return"2022-01-03";default:return}},fe=e=>{var i,n;let r=((i=e.userInput)==null?void 0:i.trim())||e.exampleInput||j(e.valueType);if(r)try{let f;if(e.valueType==="number"){let a=Number(r);f={min:a,max:a,median:a,maxDecimals:((n=a.toString().split(".")[1])==null?void 0:n.length)||0,unitType:"number"}}return m(r,e,f,u)}catch{}return""};function m(e,t=void 0,r=void 0,i=u){if(e==null)return"-";let n;if(t)try{let f=K(t,i),a;try{t.valueType==="date"&&typeof e=="string"?a=new Date(_(e)):e instanceof Date?a=new Date(e.toISOString().slice(0,-1)):t.valueType==="number"&&typeof e!="number"&&!Number.isNaN(e)?a=Number(e):a=e}catch{a=e}if(M(t,f))try{n=U(a,t,r)}catch(s){console.warn(`Unexpected error applying auto formatting. Error=${s}`)}else n=v.format(f,a)}catch(f){console.warn(`Unexpected error applying formatting ${f}`)}return n===void 0&&(n=L(e)),n}function K(e,t=u){return typeof e=="string"?e:t===R&&(e!=null&&e.axisFormatCode)?e.axisFormatCode:e==null?void 0:e.formatCode}function P(e){let t=e.toLowerCase(),r=t.lastIndexOf("_");if(r>0)return t.substr(r).replace("_","")}function I(e){let t,r;return{c(){t=d("title"),r=k(e[0])},l(i){t=c(i,"title",{});var n=p(t);r=B(n,e[0]),n.forEach(o)},m(i,n){A(i,t,n),g(t,r)},p(i,n){n&1&&G(r,i[0])},d(i){i&&o(t)}}}function q(e){let t,r,i,n=e[0]&&I(e),f=[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 32 32"},{fill:"currentColor"},{width:"100%"},{height:"100%"},{preserveAspectRatio:"xMidYMid meet"},e[1],e[2]],a={};for(let s=0;s{r(4,t=h(h({},t),x(l))),r(2,a=b(t,f)),"title"in l&&r(0,s=l.title)},e.$$.update=()=>{r(3,i=t["aria-label"]||t["aria-labelledby"]||s),r(1,n={"aria-hidden":i?void 0:!0,role:i?"img":void 0,focusable:Number(t.tabindex)===0?!0:void 0})},t=x(t),[s,n,a,i]}class le extends X{constructor(t){super(),Y(this,t,Q,q,S,{title:0})}}export{le as C,$ as I,ae as a,fe as b,ee as c,j as d,se as e,ie as f,ne as g,Z as h,re as l,N as m,te as s,O as t};