@poadio/app-vue 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/app-vue.css +13 -8
  3. package/dist/messages.d.ts +0 -1
  4. package/dist/messages.d.ts.map +1 -1
  5. package/dist/messages.js +0 -2
  6. package/dist/messages.js.map +1 -1
  7. package/dist/sections/grid.d.ts.map +1 -1
  8. package/dist/sections/grid.js +2 -1
  9. package/dist/sections/grid.js.map +1 -1
  10. package/package.json +1 -1
  11. package/runtime-dist/app.css +13 -8
  12. package/runtime-dist/app.js +2 -2
  13. package/runtime-dist/{c-3jm96b1p.js → c-031pq7qf.js} +1 -1
  14. package/runtime-dist/{c-cc3m3rs1.js → c-1hzd2pqr.js} +1 -1
  15. package/runtime-dist/{c-a63rkaa9.js → c-1q9r6ndn.js} +1 -1
  16. package/runtime-dist/c-1re10yb3.js +1 -0
  17. package/runtime-dist/{c-jymrpj5m.js → c-1v1v69qs.js} +1 -1
  18. package/runtime-dist/c-1yjbg3yb.js +1 -0
  19. package/runtime-dist/{c-16cdkp27.js → c-2c88ebgp.js} +1 -1
  20. package/runtime-dist/{c-d5y90g8f.js → c-30chvm5x.js} +1 -1
  21. package/runtime-dist/{c-y9120d6h.js → c-37zx0wkd.js} +1 -1
  22. package/runtime-dist/{c-13nx24wa.js → c-4agg4qbw.js} +1 -1
  23. package/runtime-dist/{c-9sm6aybf.js → c-4g3757ck.js} +1 -1
  24. package/runtime-dist/c-4vjd8na5.js +1 -0
  25. package/runtime-dist/{c-xeqwqt9z.js → c-56tgqzdn.js} +1 -1
  26. package/runtime-dist/{c-m49q9r7s.js → c-57mnqma1.js} +1 -1
  27. package/runtime-dist/{c-bvp9zbmr.js → c-5gfe19fa.js} +1 -1
  28. package/runtime-dist/{c-gen0a4bn.js → c-5ma45m2j.js} +1 -1
  29. package/runtime-dist/{c-8gpbevx2.js → c-74emmp4y.js} +1 -1
  30. package/runtime-dist/{c-fn3059s1.js → c-7dryrrsk.js} +1 -1
  31. package/runtime-dist/{c-4h51m4qq.js → c-82sqd7as.js} +1 -1
  32. package/runtime-dist/{c-cp1ehb23.js → c-8ahb2ywd.js} +1 -1
  33. package/runtime-dist/{c-16cm3n82.js → c-8cc3yqpn.js} +1 -1
  34. package/runtime-dist/c-8h2rwbd8.js +1 -0
  35. package/runtime-dist/{c-823yyjat.js → c-8nyvd0h0.js} +1 -1
  36. package/runtime-dist/c-8r1pgc8w.js +1 -0
  37. package/runtime-dist/{c-nn49946s.js → c-8x8fdn2b.js} +1 -1
  38. package/runtime-dist/{c-m70tbfc5.js → c-8xxzrkpg.js} +1 -1
  39. package/runtime-dist/{c-cvsx6n6e.js → c-9rx4pqjs.js} +1 -1
  40. package/runtime-dist/{c-fnzeden9.js → c-b5wfx90n.js} +1 -1
  41. package/runtime-dist/{c-hdstjg33.js → c-bhgqqt5x.js} +1 -1
  42. package/runtime-dist/{c-0zqjsnm5.js → c-c60s3ncm.js} +1 -1
  43. package/runtime-dist/{c-xk9fqzsc.js → c-cfrv87cv.js} +1 -1
  44. package/runtime-dist/{c-pbn2syef.js → c-d3hafdna.js} +1 -1
  45. package/runtime-dist/{c-nkrm4n9a.js → c-d9rzqgda.js} +1 -1
  46. package/runtime-dist/c-dx8zkcbf.js +1 -0
  47. package/runtime-dist/{c-ffkh15py.js → c-e3rddwjq.js} +1 -1
  48. package/runtime-dist/{c-gesjk5ph.js → c-e45fhawr.js} +1 -1
  49. package/runtime-dist/{c-gs1k0twe.js → c-eh9ryhw7.js} +1 -1
  50. package/runtime-dist/{c-7cjj18ea.js → c-er7e0yqs.js} +1 -1
  51. package/runtime-dist/{c-wnynh7zm.js → c-fbtxac36.js} +1 -1
  52. package/runtime-dist/{c-72hj12cs.js → c-g4dt7z6r.js} +1 -1
  53. package/runtime-dist/c-g6vc4fyb.js +1 -0
  54. package/runtime-dist/{c-64j9mv7a.js → c-g9jhyx8j.js} +1 -1
  55. package/runtime-dist/{c-1xpa1fqz.js → c-gf4wzfng.js} +1 -1
  56. package/runtime-dist/c-gfzghvh2.js +1 -0
  57. package/runtime-dist/{c-6f446pxt.js → c-grqtxpm9.js} +1 -1
  58. package/runtime-dist/{c-xqf3j4w7.js → c-h8ny4vpa.js} +1 -1
  59. package/runtime-dist/c-hgdk0vqh.js +1 -0
  60. package/runtime-dist/{c-tv3ksk7j.js → c-hrbpqm8q.js} +1 -1
  61. package/runtime-dist/{c-gznx0sj4.js → c-jxqht9an.js} +1 -1
  62. package/runtime-dist/{c-hsy77frc.js → c-jy6yg5r5.js} +1 -1
  63. package/runtime-dist/{c-0rxdxcn3.js → c-k3yb5e72.js} +1 -1
  64. package/runtime-dist/{c-gkyekesy.js → c-kaqzctfm.js} +1 -1
  65. package/runtime-dist/c-kqsnm92z.js +1 -0
  66. package/runtime-dist/{c-epemgj1a.js → c-mcy4rvac.js} +1 -1
  67. package/runtime-dist/c-mhzk96e8.js +1 -0
  68. package/runtime-dist/{c-sv15z0aa.js → c-mv93h1f5.js} +1 -1
  69. package/runtime-dist/{c-3pe5hprv.js → c-n27dcy6d.js} +1 -1
  70. package/runtime-dist/{c-qe1kevqk.js → c-n8sg12jt.js} +1 -1
  71. package/runtime-dist/{c-b6g9ey7e.js → c-n9cyhrcb.js} +1 -1
  72. package/runtime-dist/{c-wjadf68q.js → c-p3z8t4n5.js} +1 -1
  73. package/runtime-dist/{c-jvrr9zb8.js → c-pfc9b97d.js} +1 -1
  74. package/runtime-dist/{c-zyfkspym.js → c-pj08sk6j.js} +1 -1
  75. package/runtime-dist/{c-ahcj5yr5.js → c-pk2cv8zh.js} +1 -1
  76. package/runtime-dist/{c-29v2e09p.js → c-py0rvzyv.js} +1 -1
  77. package/runtime-dist/{c-sdf15np5.js → c-pyj696ce.js} +1 -1
  78. package/runtime-dist/{c-kyajr8zz.js → c-qzar8xvm.js} +1 -1
  79. package/runtime-dist/{c-rasvf2z2.js → c-rj7c7mwf.js} +1 -1
  80. package/runtime-dist/c-rm0av36n.js +1 -0
  81. package/runtime-dist/{c-m6yf7zaj.js → c-rv7cxh2k.js} +1 -1
  82. package/runtime-dist/{c-n8mqnvjg.js → c-s3vrabx6.js} +1 -1
  83. package/runtime-dist/{c-prt5qv2x.js → c-t83mbx7z.js} +1 -1
  84. package/runtime-dist/{c-j02ymtyd.js → c-tsyjqc1h.js} +1 -1
  85. package/runtime-dist/{c-ywzh0r63.js → c-vmp3ee81.js} +1 -1
  86. package/runtime-dist/{c-xx4986kx.js → c-vztkfwfq.js} +1 -1
  87. package/runtime-dist/{c-azvw5879.js → c-xw7vce7r.js} +1 -1
  88. package/runtime-dist/{c-6pd33f4a.js → c-y7abh583.js} +1 -1
  89. package/runtime-dist/{c-6qa26wds.js → c-ynwn0vws.js} +1 -1
  90. package/runtime-dist/{c-bssc8kwn.js → c-za724ed4.js} +1 -1
  91. package/runtime-dist/{c-h5m94fwp.js → c-zt8jhyxz.js} +1 -1
  92. package/runtime-dist/{c-eczfywaq.js → c-zv49taf7.js} +1 -1
  93. package/runtime-dist/version.json +1 -1
  94. package/src/messages.ts +0 -2
  95. package/src/sections/grid.ts +2 -1
  96. package/runtime-dist/c-2s6r37jb.js +0 -1
  97. package/runtime-dist/c-2v244yc0.js +0 -1
  98. package/runtime-dist/c-3be398px.js +0 -1
  99. package/runtime-dist/c-3zbf5g3p.js +0 -1
  100. package/runtime-dist/c-572jz6y4.js +0 -1
  101. package/runtime-dist/c-6w0f1kqm.js +0 -1
  102. package/runtime-dist/c-dqtdk937.js +0 -1
  103. package/runtime-dist/c-et83hbhc.js +0 -1
  104. package/runtime-dist/c-krt6rpg1.js +0 -1
  105. package/runtime-dist/c-m30q0jrb.js +0 -1
  106. package/runtime-dist/c-mw3zx9yk.js +0 -1
  107. package/runtime-dist/c-vrmw0gka.js +0 -1
@@ -1,2 +1,2 @@
1
- import{r,e}from"./c-kyajr8zz.js";var d=(a)=>!a.disabled&&!a.loading;function t(a){return["poad-button",`sev-${a.severity??"primary"}`,`var-${a.variant??"solid"}`,`size-${a.size??"md"}`,a.loading&&"is-loading",a.icon&&"is-icon",a.block&&"is-block",a.pressed&&"is-pressed"].filter(Boolean).join(" ")}function i(a){let s=!d(a),n=a.pressed??null;return{disabled:s,"aria-disabled":s?"true":null,"aria-busy":a.loading?"true":null,"aria-pressed":n===null?null:n?"true":"false"}}var k=r({name:"PoadButton",props:{severity:String,variant:String,size:String,loading:Boolean,disabled:Boolean,icon:Boolean,block:Boolean,pressed:{type:Boolean,default:null}},setup(a,{slots:s}){return()=>{let n=i(a);return e("button",{class:t(a),disabled:n.disabled,"aria-disabled":n["aria-disabled"]??void 0,"aria-busy":n["aria-busy"]??void 0,"aria-pressed":n["aria-pressed"]??void 0},[a.loading&&e("span",{class:"poad-button__spinner","aria-hidden":"true"}),e("span",{class:"poad-button__label"},s.default?.())])}}});
1
+ import{r,e}from"./c-qzar8xvm.js";var d=(a)=>!a.disabled&&!a.loading;function t(a){return["poad-button",`sev-${a.severity??"primary"}`,`var-${a.variant??"solid"}`,`size-${a.size??"md"}`,a.loading&&"is-loading",a.icon&&"is-icon",a.block&&"is-block",a.pressed&&"is-pressed"].filter(Boolean).join(" ")}function i(a){let s=!d(a),n=a.pressed??null;return{disabled:s,"aria-disabled":s?"true":null,"aria-busy":a.loading?"true":null,"aria-pressed":n===null?null:n?"true":"false"}}var k=r({name:"PoadButton",props:{severity:String,variant:String,size:String,loading:Boolean,disabled:Boolean,icon:Boolean,block:Boolean,pressed:{type:Boolean,default:null}},setup(a,{slots:s}){return()=>{let n=i(a);return e("button",{class:t(a),disabled:n.disabled,"aria-disabled":n["aria-disabled"]??void 0,"aria-busy":n["aria-busy"]??void 0,"aria-pressed":n["aria-pressed"]??void 0},[a.loading&&e("span",{class:"poad-button__spinner","aria-hidden":"true"}),e("span",{class:"poad-button__label"},s.default?.())])}}});
2
2
  export{k};
@@ -0,0 +1 @@
1
+ import{De}from"./c-4g3757ck.js";import"./c-k3yb5e72.js";import"./c-rv7cxh2k.js";export{De as PoadMenu};
@@ -1,2 +1,2 @@
1
- import{Rs,Is,Ls,Fs,zs}from"./c-azvw5879.js";import{r,e}from"./c-kyajr8zz.js";var n=r({name:"PoadIcon",props:{name:{type:String,required:!0},size:{type:Number,default:16},strokeWidth:{type:Number,default:2},label:String,title:String,spin:Boolean,filled:Boolean,flip:String,rotate:Number},setup(t){let a=zs();return()=>{let i=Rs(t),s=Is(t),o=Fs(t);return e("span",{class:["poad-icon",Ls(t)],role:i.role,"aria-label":i["aria-label"]??void 0,"aria-hidden":i["aria-hidden"]??void 0,title:i.title??void 0,style:{width:`${t.size}px`,height:`${t.size}px`,...o?{transform:o}:{}}},[e("svg",{...s,innerHTML:a().get(t.name)??""})])}}});
1
+ import{Rs,Is,Ls,Fs,zs}from"./c-xw7vce7r.js";import{r,e}from"./c-qzar8xvm.js";var n=r({name:"PoadIcon",props:{name:{type:String,required:!0},size:{type:Number,default:16},strokeWidth:{type:Number,default:2},label:String,title:String,spin:Boolean,filled:Boolean,flip:String,rotate:Number},setup(t){let a=zs();return()=>{let i=Rs(t),s=Is(t),o=Fs(t);return e("span",{class:["poad-icon",Ls(t)],role:i.role,"aria-label":i["aria-label"]??void 0,"aria-hidden":i["aria-hidden"]??void 0,title:i.title??void 0,style:{width:`${t.size}px`,height:`${t.size}px`,...o?{transform:o}:{}}},[e("svg",{...s,innerHTML:a().get(t.name)??""})])}}});
2
2
  export{n};
@@ -1 +1 @@
1
- import{C}from"./c-dzx0rg0g.js";import{r,f,a,e}from"./c-kyajr8zz.js";var m=[" ","Enter"];var p=(l)=>!l.disabled&&!l.readonly;function o(l,d){switch(d.type){case"toggle":return p(l)?{...l,checked:!l.checked}:l;case"keydown":return m.includes(d.key)?o(l,{type:"toggle"}):l;case"setChecked":return l.checked===d.checked?l:{...l,checked:d.checked};case"setDisabled":return l.disabled===d.disabled?l:{...l,disabled:d.disabled};case"setReadonly":return l.readonly===d.readonly?l:{...l,readonly:d.readonly}}}var u=(l)=>`${l}-l`;function h(l,d){let i=!!d.label;return{id:d.id,role:"switch","aria-checked":l.checked?"true":"false","aria-label":i?null:d.ariaLabel??"","aria-labelledby":i?u(d.id):null,disabled:l.disabled}}function y(l){return l.label?{id:u(l.id),for:l.id}:null}function k(l){return{"is-on":l.checked,"is-disabled":l.disabled}}var _=r({name:"PoadSwitch",props:{modelValue:{type:Boolean,default:void 0},disabled:Boolean,readonly:Boolean,label:String,ariaLabel:String,size:{type:String,default:"md"},labelPosition:{type:String,default:"right"},id:String},emits:{"update:modelValue":(l)=>!0},setup(l,{slots:d}){let i=a(l,"modelValue"),w=f();return()=>{let t={checked:!!i.value,disabled:l.disabled,readonly:l.readonly},s={id:l.id??w,label:l.label??"",ariaLabel:l.ariaLabel??""},c=h(t,s),n=y(s),g=()=>{let b=o(t,{type:"toggle"});if(b!==t)i.value=b.checked};return e("span",{class:C("poad-switch",{...k(t),"size-sm":l.size==="sm","label-left":l.labelPosition==="left"})},[e("button",{type:"button",role:c.role,id:c.id,"aria-checked":c["aria-checked"],"aria-label":c["aria-label"]??void 0,"aria-labelledby":c["aria-labelledby"]??void 0,disabled:c.disabled,onClick:g},[e("span",{class:"poad-switch__track"},[e("span",{class:"poad-switch__thumb"})])]),n&&e("label",{class:"poad-switch__label",id:n.id,for:n.for},l.label),d.default?.()])}}});export{_ as PoadSwitch};
1
+ import{C}from"./c-dzx0rg0g.js";import{r,f,a,e}from"./c-qzar8xvm.js";var m=[" ","Enter"];var p=(l)=>!l.disabled&&!l.readonly;function o(l,d){switch(d.type){case"toggle":return p(l)?{...l,checked:!l.checked}:l;case"keydown":return m.includes(d.key)?o(l,{type:"toggle"}):l;case"setChecked":return l.checked===d.checked?l:{...l,checked:d.checked};case"setDisabled":return l.disabled===d.disabled?l:{...l,disabled:d.disabled};case"setReadonly":return l.readonly===d.readonly?l:{...l,readonly:d.readonly}}}var u=(l)=>`${l}-l`;function h(l,d){let i=!!d.label;return{id:d.id,role:"switch","aria-checked":l.checked?"true":"false","aria-label":i?null:d.ariaLabel??"","aria-labelledby":i?u(d.id):null,disabled:l.disabled}}function y(l){return l.label?{id:u(l.id),for:l.id}:null}function k(l){return{"is-on":l.checked,"is-disabled":l.disabled}}var _=r({name:"PoadSwitch",props:{modelValue:{type:Boolean,default:void 0},disabled:Boolean,readonly:Boolean,label:String,ariaLabel:String,size:{type:String,default:"md"},labelPosition:{type:String,default:"right"},id:String},emits:{"update:modelValue":(l)=>!0},setup(l,{slots:d}){let i=a(l,"modelValue"),w=f();return()=>{let t={checked:!!i.value,disabled:l.disabled,readonly:l.readonly},s={id:l.id??w,label:l.label??"",ariaLabel:l.ariaLabel??""},c=h(t,s),n=y(s),g=()=>{let b=o(t,{type:"toggle"});if(b!==t)i.value=b.checked};return e("span",{class:C("poad-switch",{...k(t),"size-sm":l.size==="sm","label-left":l.labelPosition==="left"})},[e("button",{type:"button",role:c.role,id:c.id,"aria-checked":c["aria-checked"],"aria-label":c["aria-label"]??void 0,"aria-labelledby":c["aria-labelledby"]??void 0,disabled:c.disabled,onClick:g},[e("span",{class:"poad-switch__track"},[e("span",{class:"poad-switch__thumb"})])]),n&&e("label",{class:"poad-switch__label",id:n.id,for:n.for},l.label),d.default?.()])}}});export{_ as PoadSwitch};
@@ -1 +1 @@
1
- import{n}from"./c-m6yf7zaj.js";import{un,dn,fn}from"./c-sjajadt4.js";import{r,f,a,e}from"./c-kyajr8zz.js";function g(l){return["poad-fieldset",l.collapsed&&"is-collapsed",l.toggleable&&"is-toggleable"].filter(Boolean).join(" ")}var p=(l)=>`${l}-c`;var x=r({name:"PoadFieldset",props:{legend:String,toggleable:Boolean,collapsed:Boolean},emits:{"update:collapsed":(l)=>!0},setup(l,{slots:d}){let s=p(`poad-fieldset-${f()}`),t=a(l,"collapsed"),u=()=>{let o=un(t.value,l.toggleable);if(o!==null)t.value=o};return()=>{let o=dn(s,t.value),i=fn(s,t.value),c=d.legend?d.legend():l.legend;return e("div",{class:g({collapsed:t.value,toggleable:l.toggleable})},[e("fieldset",{class:"poad-fieldset__box"},[e("legend",{class:"poad-fieldset__legend"},[l.toggleable?e("button",{class:"poad-fieldset__toggle",type:o.type,"aria-expanded":o["aria-expanded"],"aria-controls":o["aria-controls"],onClick:u},[e(n,{class:"poad-fieldset__chev",name:"chevron-right",size:13}),c]):e("span",{class:"poad-fieldset__text"},c)]),e("div",{class:"poad-fieldset__wrap",id:i.id,inert:i.inert===null?void 0:""},[e("div",{class:"poad-fieldset__body"},d.default?.())])])])}}});export{x as PoadFieldset};
1
+ import{n}from"./c-rv7cxh2k.js";import{un,dn,fn}from"./c-sjajadt4.js";import{r,f,a,e}from"./c-qzar8xvm.js";function g(l){return["poad-fieldset",l.collapsed&&"is-collapsed",l.toggleable&&"is-toggleable"].filter(Boolean).join(" ")}var p=(l)=>`${l}-c`;var x=r({name:"PoadFieldset",props:{legend:String,toggleable:Boolean,collapsed:Boolean},emits:{"update:collapsed":(l)=>!0},setup(l,{slots:d}){let s=p(`poad-fieldset-${f()}`),t=a(l,"collapsed"),u=()=>{let o=un(t.value,l.toggleable);if(o!==null)t.value=o};return()=>{let o=dn(s,t.value),i=fn(s,t.value),c=d.legend?d.legend():l.legend;return e("div",{class:g({collapsed:t.value,toggleable:l.toggleable})},[e("fieldset",{class:"poad-fieldset__box"},[e("legend",{class:"poad-fieldset__legend"},[l.toggleable?e("button",{class:"poad-fieldset__toggle",type:o.type,"aria-expanded":o["aria-expanded"],"aria-controls":o["aria-controls"],onClick:u},[e(n,{class:"poad-fieldset__chev",name:"chevron-right",size:13}),c]):e("span",{class:"poad-fieldset__text"},c)]),e("div",{class:"poad-fieldset__wrap",id:i.id,inert:i.inert===null?void 0:""},[e("div",{class:"poad-fieldset__body"},d.default?.())])])])}}});export{x as PoadFieldset};
@@ -1,2 +1,2 @@
1
- import{s,S,P,F,ne,Os,D,Z,tt,ve,se,M,de,Fe,ze,xe,$e,Be,As,fe,ir,lt,cn,Mt,Ps,Et}from"./c-j63hz554.js";import{i}from"./c-azvw5879.js";import{l,A,c,y,u,pe,o}from"./c-kyajr8zz.js";var q=new Map;function Y(e,t){let r=q.get(e);if(!r)r=t(),q.set(e,r);return r}var W=/^(\d{4})-(\d{2})-(\d{2})$/;function je(e){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e==="number")return Number.isFinite(e)?new Date(e):null;if(typeof e!=="string"||!e)return null;let t=W.exec(e),r=t?new Date(Number(t[1]),Number(t[2])-1,Number(t[3])):/^\d{4}-\d{2}-\d{2}[T ]/.test(e)?new Date(e):null;return r&&!Number.isNaN(r.getTime())?r:null}function k(e,t,r){if(e===null||e===void 0||e==="")return"";let n=t.fieldType??t.type??"text",a=t.format??{},f=r.locale;switch(n){case"number":{let d=typeof e==="number"?e:typeof e==="string"&&e.trim()!==""?Number(e):NaN;if(!Number.isFinite(d))return String(e);let h=`n|${f}|${a.currency??""}|${a.percent?1:0}|${a.decimals??""}`;return Y(h,()=>new Intl.NumberFormat(f,{...a.currency?{style:"currency",currency:a.currency}:a.percent?{style:"percent"}:{},...a.decimals!==void 0?{minimumFractionDigits:a.decimals,maximumFractionDigits:a.decimals}:a.currency?{}:{maximumFractionDigits:2}})).format(d)}case"date":case"datetime":{let d=je(e);if(!d)return String(e);let h=a.date??"short",p=n==="datetime"&&!(typeof e==="string"&&W.test(e)),g=`d|${f}|${h}|${p?1:0}`;return Y(g,()=>new Intl.DateTimeFormat(f,{...h==="short"?{year:"numeric",month:"2-digit",day:"2-digit"}:{dateStyle:h},...p?h==="short"?{hour:"2-digit",minute:"2-digit"}:{timeStyle:"short"}:{}})).format(d)}case"boolean":return typeof e==="boolean"?r.booleanText?r.booleanText(e):String(e):String(e);case"enum":{let d=(t.filterOptions??t.options)?.find((h)=>h.value===e);return d?String(typeof d.label==="string"?d.label:e):String(e)}default:if(typeof e==="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)}}var U=(e)=>typeof e==="object"&&e!==null&&Array.isArray(e.path)&&typeof e.subscribe==="function"&&("store"in e);var G=(e)=>U(e)||xe(e)||e instanceof s?e:JSON.stringify(e),J=(e,t=2)=>String(e).padStart(t,"0"),Me=(e)=>`${J(e.getFullYear(),4)}-${J(e.getMonth()+1)}-${J(e.getDate())}`;function Re(e,t){if((t==="date"||t==="datetime")&&typeof e==="string"&&e){let r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(r)return new Date(Number(r[1]),Number(r[2])-1,Number(r[3]));let n=new Date(e);return Number.isNaN(n.getTime())?e:n}return e}function _e(e,t){if(t==="date")return e instanceof Date?Me(e):e===""?null:e;if(t==="datetime")return e instanceof Date?e.toISOString():e===""?null:e;if(t==="number"){if(e===""||e===null||e===void 0)return null;if(typeof e==="string"){let r=Number(e.replace(",","."));return Number.isFinite(r)?r:e}return e}return e}function Ie(e,t){try{let r=(typeof t==="function"?t():t)??Be();if(e instanceof s)throw e;if(U(e))return{target:e,binding:null,field:null,error:null,registry:r};let{binding:n,store:a}=$e(xe(e)?e:ze(e),r);if(!M(a)&&!de(a))throw new s("unknown_store",`no store named "${n.store}"`,{params:{name:n.store},path:"store"});let f=tt(a,n.field),d=n.fields?.find((h)=>h.field===n.field||h.key===n.field)??(n.fields?.length===1?n.fields[0]:void 0);return{target:f,binding:n,field:d??null,error:null,registry:r}}catch(r){return{target:null,binding:null,field:null,error:S(r),registry:null}}}var Je=(e)=>{let t=e.path;if(e.store.type==="record")return typeof t[0]==="string"?t[0]:null;return typeof t[1]==="string"?t[1]:null};class H{r;cell;stops=[];constructor(e,t){this.r=Ie(e,t),this.cell=new F(this.compute(),{start:()=>this.start(),stop:()=>this.stop()})}get target(){return this.r.target}get binding(){return this.r.binding}get(){if(!this.cell.observed)this.sync();return this.cell.get()}subscribe(e){return this.cell.subscribe(e)}toJSON(){throw new s("not_serializable","a field binding cannot be serialised: pass its JSON description instead")}descriptor(){if(this.r.field)return this.r.field;let e=this.r.target;if(!e)return null;let t=Je(e);return t?e.store.fields.rule(t)??null:null}feed=null;feedFor=null;stopFeed=null;localized=null;optionsFeed(){let e=this.descriptor()?.reference;if(!e)return null;let t=JSON.stringify(e);if(this.feed&&this.feedFor===t)return this.feed;if(this.stopFeed?.(),this.stopFeed=null,this.feed=lt(e,this.r.registry),this.feedFor=t,this.cell?.observed)this.listenFeed();return this.feed}listenFeed(){if(!this.feed||this.stopFeed)return;this.stopFeed=this.feed.subscribe(()=>this.sync()),this.wantValue()}wantValue(){let e=this.r.target?.get();this.feed?.want(Array.isArray(e)?e:e===null||e===void 0?[]:[e])}options(e){let t=this.descriptor();if(!t)return null;if(t.reference)return this.optionsFeed()?.get().options??null;if(!t.options)return null;let r=this.localized;if(r&&r.locale===e&&r.source===t.options)return r.out;let n=As(t.options,e);return this.localized={locale:e,source:t.options,out:n},n}searchOptions(e){this.optionsFeed()?.search(e)}suggest(e,t){let r=this.optionsFeed();if(r)return r.suggest(e);return Promise.resolve(ir(this.options(t)??[],e))}optionOf(e,t){let r=this.optionsFeed();if(r)return r.find(e);return(this.options(t)??[]).find((n)=>fe(n.value,e))}set(e){let t=this.r.target;if(!t||!t.writable)return;if(P(e,t.get()))return;t.set(e)}setFromControl(e){this.set(_e(e,this.descriptor()?.type))}controlValue(){return Re(this.get().value,this.descriptor()?.type)}resolve(e){this.r.target?.resolve(e)}revert(){this.r.target?.revert()}format(e,t){let r=this.descriptor();if(!r)return k(e,{},t);let n=r.options?.map((a)=>({value:a.value,label:ne(a.label,t.locale)}));return k(e,{fieldType:r.type,...r.format?{format:r.format}:{},...n?{options:n}:{}},t)}start(){let e=this.r.target;if(!e)return;if(this.r.field)this.stops.push(e.store.fields.use([this.r.field]));if(this.stops.push(e.subscribe(()=>{this.wantValue(),this.sync()})),this.stops.push(e.status.subscribe(()=>this.sync())),this.stops.push(e.store.subscribe(()=>this.sync())),this.optionsFeed())this.listenFeed();this.sync()}stop(){let e=this.stops;this.stops=[];for(let t of e)t();this.stopFeed?.(),this.stopFeed=null}sync(){let e=this.compute(),t=this.cell.get();if(t.value===e.value&&t.writable===e.writable&&t.dirty===e.dirty&&t.saving===e.saving&&t.error===e.error&&t.conflict===e.conflict&&t.loading===e.loading&&t.field===e.field&&Ve(t.choice,e.choice))return;this.cell.set(e)}compute(){let e=this.r.target,t=this.descriptor();if(!e){let f=this.r.error;return{value:void 0,writable:!1,dirty:!1,saving:!1,error:f,conflict:null,loading:!1,field:null,required:!1,errorKey:f?.messageKey??null,...f?.params?{errorParams:f.params}:{},choice:null}}let r=e.status.get(),n=e.store.get(),a=r.error??(n.status==="error"?n.error:null);return{value:e.get(),writable:r.writable,dirty:r.dirty,saving:r.saving,error:a,conflict:r.conflict,loading:n.status==="loading",field:t,required:!!t?.rules?.required,errorKey:a?.messageKey??null,...a?.params?{errorParams:a.params}:{},choice:this.choiceState(t)}}choiceState(e){if(e?.reference){let t=this.feed&&this.feedFor===JSON.stringify(e.reference)?this.feed:null,r=t?t.get():null;return{source:"reference",loading:r?.loading??!1,complete:r?.complete??!1,error:r?.error??null,options:r?.options??null}}if(e?.options)return Le;return null}}var Le=Object.freeze({source:"static",loading:!1,complete:!0,error:null,options:null}),Ve=(e,t)=>e===t||!!e&&!!t&&e.source===t.source&&e.loading===t.loading&&e.complete===t.complete&&e.error===t.error&&e.options===t.options;function X(e,t={}){return new H(e,t.registry)}function Q(e,t,r,n){let a=!!t.conflict,f=a?r("data.conflict_field",{theirs:e.format(t.conflict.theirs,n)||"—"}):t.errorKey?r(t.errorKey,t.errorParams):null,d=[t.dirty?"is-dirty":"",t.saving?"is-saving":"",a?"is-conflict":""].filter(Boolean).join(" ");return{invalid:!!t.error||a,classes:d,message:f,conflict:a,required:t.required}}var T=(e)=>Array.isArray(e)?e:e===null||e===void 0||e===""?[]:[e];function ee(e,t,r,n){let a=[];for(let f of e){let d=r.find((h)=>fe(h.value,f))??t.optionOf(f,n);if(d)a.push(d)}return a}function te(e,t,r,n,a={}){let f=e.options(n),d=f??[],h=r==="multiselect"||r==="picklist"||!!a.multiple,p=t.value,g;if(r==="picklist")g=ee(T(p),e,d,n);else if(r==="combo")g=h?ee(T(p),e,d,n):p===null||p===void 0?null:d.find((b)=>fe(b.value,p))??e.optionOf(p,n)??null;else if(h)g=[...T(p)];else g=p??null;if(!h&&r!=="combo"&&g!==null)g=d.find((b)=>fe(b.value,g))?.value??g;if(h&&Array.isArray(g)&&r!=="picklist"&&r!=="combo")g=g.map((b)=>d.find((w)=>fe(w.value,b))?.value??b);let m=t.choice;return{options:f,value:g,loading:!!m?.loading,remote:m?.source==="reference"&&!m.complete,set(b){if(r==="picklist"||r==="combo"&&h){e.setFromControl(T(b).map((w)=>w!==null&&typeof w==="object"?w.value:w));return}if(r==="combo"){if(b===null||b===void 0||b==="")e.setFromControl(null);else if(typeof b==="object")e.setFromControl(b.value);return}e.setFromControl(h?[...T(b)]:b??null)},filter(b){if(m?.source==="reference")e.searchOptions(b)},suggest:(b)=>e.suggest(b,n)}}var oe=/^[A-Za-z_][A-Za-z0-9_]{0,62}$/,qe=/^[A-Za-z_][A-Za-z0-9_]{0,62}(\.[A-Za-z0-9_]{1,63})+$/,z=(e)=>e===null||e===void 0||e==="",Ye=(e)=>z(e)||Array.isArray(e)&&e.length===0,re=(e)=>String(e).padStart(2,"0"),B=(e)=>`${e.getFullYear()}-${re(e.getMonth()+1)}-${re(e.getDate())}`;function _(e){let t=null;if(e instanceof Date)t=new Date(e.getTime());else if(typeof e==="number"&&Number.isFinite(e))t=new Date(e);else if(typeof e==="string"){let r=/^(\d{4})-(\d{2})-(\d{2})/.exec(e.trim());if(r)t=e.trim().length>10?new Date(e.trim()):new Date(Number(r[1]),Number(r[2])-1,Number(r[3]))}if(!t||Number.isNaN(t.getTime()))return null;return new Date(t.getFullYear(),t.getMonth(),t.getDate())}var We=(e)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+1),v=(e)=>e===null||typeof e==="string"||typeof e==="boolean"||typeof e==="number"&&Number.isFinite(e)?e:e instanceof Date?e.toISOString():void 0;function Ue(e,t){if(e)return e.type;if(typeof t==="number")return"number";if(typeof t==="boolean")return"boolean";if(t instanceof Date)return"date";return"text"}var x=(e,t,r=!1)=>{let n=r?We(t):t;return e==="datetime"?n.toISOString():B(n)},j=(e,t)=>({or:[t,{[e]:{is:null}}]});function Ge(e,t,r){if(!oe.test(e)&&!qe.test(e))return;let n=t.matchMode??"contains",a=t.value,f=Ue(r,Array.isArray(a)?a.find((m)=>!z(m)):a),d=f==="text"||f==="enum"||f==="json"||f==="geometry",h=f==="date"||f==="datetime",p=(m)=>({[e]:m});if(n==="isEmpty")return d&&f==="text"?{or:[p({is:null}),p({eq:""})]}:p({is:null});if(n==="isNotEmpty")return d&&f==="text"?{and:[p({not:null}),p({ne:""})]}:p({not:null});if(Ye(a))return;let g=(m)=>m instanceof Date?B(m):String(m);switch(n){case"contains":return p({ilike:`%${Fe(g(a))}%`});case"notContains":return j(e,p({notIlike:`%${Fe(g(a))}%`}));case"startsWith":return p({ilike:`${Fe(g(a))}%`});case"endsWith":return p({ilike:`%${Fe(g(a))}`});case"eq":case"neq":{let m;if(f==="boolean"){let b=a===!0||a==="true"?!0:a===!1||a==="false"?!1:void 0;if(b===void 0)return;m=p({is:b})}else if(h)return ie(e,f,a,n==="eq"?"dateIs":"dateIsNot");else if(f==="text")m=p({ilike:Fe(g(a))});else{let b=v(f==="number"?E(a):a);if(b===void 0||b===null)return;m=p({eq:b})}if(n==="eq")return m;return f==="text"?j(e,p({notIlike:Fe(g(a))})):j(e,{not:m})}case"lt":case"lte":case"gt":case"gte":{if(h){let b=_(a);if(!b)return;if(n==="lt")return p({lt:x(f,b)});if(n==="lte")return p({lt:x(f,b,!0)});if(n==="gt")return p({gte:x(f,b,!0)});return p({gte:x(f,b)})}let m=v(f==="number"?E(a):a);if(m===void 0||m===null)return;return p({[n]:m})}case"in":case"notIn":{let m=(Array.isArray(a)?a:[a]).map((N)=>v(f==="number"?E(N)??N:N)).filter((N)=>N!==void 0);if(m.length===0)return;let b=m.includes(null),w=m.filter((N)=>N!==null);if(n==="in"){if(!b)return p({in:w});return w.length?{or:[p({in:w}),p({is:null})]}:p({is:null})}if(b)return w.length?{and:[p({notIn:w}),p({not:null})]}:p({not:null});return j(e,p({notIn:w}))}case"between":{let[m,b]=Array.isArray(a)?a:[a,null],w=[];if(h){let N=z(m)?null:_(m),O=z(b)?null:_(b);if(N)w.push(p({gte:x(f,N)}));if(O)w.push(p({lt:x(f,O,!0)}))}else{let N=z(m)?void 0:v(f==="number"?E(m):m),O=z(b)?void 0:v(f==="number"?E(b):b);if(N!==void 0&&N!==null)w.push(p({gte:N}));if(O!==void 0&&O!==null)w.push(p({lte:O}))}if(w.length===0)return;return w.length===1?w[0]:{and:w}}case"dateIs":case"dateIsNot":case"dateBefore":case"dateAfter":return ie(e,h?f:"date",a,n);default:return}}function ie(e,t,r,n){let a=_(r);if(!a)return;let f=(h)=>({[e]:h});if(n==="dateBefore")return f({lt:x(t,a)});if(n==="dateAfter")return f({gte:x(t,a,!0)});let d=t==="datetime"?{and:[f({gte:x(t,a)}),f({lt:x(t,a,!0)})]}:f({eq:B(a)});if(n==="dateIs")return d;return t==="datetime"?{or:[f({lt:x(t,a)}),f({gte:x(t,a,!0)}),f({is:null})]}:j(e,f({ne:B(a)}))}function E(e){if(typeof e==="number")return Number.isFinite(e)?e:void 0;if(typeof e!=="string"||e.trim()==="")return;let t=Number(e.trim().replace(/\s/g,"").replace(",","."));return Number.isFinite(t)?t:void 0}function le(e,t=[]){let r=[];for(let[n,a]of Object.entries(e??{})){if(!a)continue;let f=t.find((h)=>h.field===n||h.key===n),d=Ge(f?.field??n,a,f);if(d)r.push(d)}if(r.length===0)return;return r.length===1?r[0]:{and:r}}function ae(e){return(e??[]).filter((t)=>(t.order===1||t.order===-1)&&oe.test(t.field)).map((t)=>({column:t.field,direction:t.order===-1?"desc":"asc"}))}var ce=(e)=>e.map((t)=>({field:t.column,order:t.direction==="desc"?-1:1}));var he=Object.freeze([]),me=new Set,ge=Object.freeze({});function ye(e){return!!e?.fields&&D(e.fields,"parent").length>0}var R=(e)=>JSON.stringify(e??null);class be{binding=null;store=null;error=null;dataKey="id";parentKey="parent_id";labelField="label";template=null;roots=null;levels=new Map;cell;stopNamed=null;constructor(e,t){try{let{binding:r,store:n}=$e(e,t);if(!M(n)||r.field!=="")throw new s("invalid_binding",'a tree is bound to a list store (no "field")',{path:"store"});let a=r.fields??[],f=D(a,"parent")[0];if(!f)throw new s("invalid_binding",'a tree needs a field with the role "parent"',{path:"fields"});this.binding=r,this.store=n,this.parentKey=f.field,this.dataKey=D(a,"key")[0]?.field??n.keyColumn,this.labelField=D(a,"label")[0]?.field??a.find((h)=>h.type==="text"&&h.field!==this.dataKey&&h.field!==f.field)?.field??"label";let d=n.description;this.template={table:d.table,...d.select?{select:d.select}:{},...d.where?{where:d.where}:{},...d.order?{order:d.order}:{},...d.include?{include:d.include}:{},...d.version?{version:d.version}:{},...d.fields?{fields:d.fields}:{},...d.realtime!==void 0?{realtime:d.realtime}:{},...d.save?{save:d.save}:{},keyColumn:this.dataKey,pageSize:ve}}catch(r){this.error=S(r)}this.cell=new F(this.compute(),{start:()=>this.start(),stop:()=>this.stop()})}get(){if(!this.cell.observed)this.sync();return this.cell.get()}subscribe(e){return this.cell.subscribe(e)}toJSON(){throw new s("not_serializable","a tree binding cannot be serialised: pass its JSON description instead")}keyOf(e){return e!==null&&typeof e==="object"?e[this.dataKey]:void 0}level(e){let t=this.template,r=t.where?{and:[t.where,{[this.parentKey]:e??null}]}:{[this.parentKey]:e??null},n=se(this.store.transport,{...t,where:r}),a={store:n,stop:null,stopWrite:null,waiters:[]};return a.stopWrite=n.onWrite((f)=>this.relay(n,f)),a}relay(e,t){for(let r of this.allLevels())if(r.store!==e)r.store.receive(t);if(this.store&&e!==this.store)this.store.receive(t)}allLevels(){return[...this.roots?[this.roots]:[],...this.levels.values()]}listen(e){if(e.stop)return;e.stop=e.store.subscribe(()=>{if(e.store.get().status!=="loading"&&e.waiters.length)for(let t of e.waiters.splice(0))t();this.sync()})}loadChildren(e){let t=this.keyOf(e);if(!this.template||t===void 0||t===null)return Promise.resolve([]);let r=R(t),n=this.levels.get(r);if(!n)n=this.level(t),this.levels.set(r,n);let a=n,f=new Promise((d)=>a.waiters.push(()=>d([])));if(this.cell.observed)this.listen(a);if(this.sync(),a.stop&&a.store.get().status==="ready")for(let d of a.waiters.splice(0))d();return f}hasChildren(e){let t=this.levels.get(R(this.keyOf(e)));if(!t)return!0;let r=t.store.get();return!(r.status==="ready"&&r.rows.length===0)}storeOf(e){for(let r of this.allLevels())if(r.store.get().rows.includes(e))return r.store;let t=R(this.keyOf(e));for(let r of this.allLevels())if(r.store.get().rows.some((n)=>R(this.keyOf(n))===t))return r.store;return null}async retry(){await Promise.all(this.allLevels().map((e)=>e.store.refresh()))}start(){if(!this.template)return;this.roots??=this.level(null),this.listen(this.roots);for(let e of this.levels.values())this.listen(e);this.stopNamed=this.store.onWrite((e)=>{for(let t of this.allLevels())t.store.receive(e)}),this.sync()}stop(){for(let e of this.allLevels())e.stop?.(),e.stop=null;this.stopNamed?.(),this.stopNamed=null}sync(){let e=this.compute(),t=this.cell?.get();if(t&&t.rows===e.rows&&t.status===e.status&&t.error===e.error&&t.edits===e.edits&&He(t.loadingKeys,e.loadingKeys))return;if(this.cell)this.cell.set(e)}lastParts=[];lastRows=he;lastEditsParts=[];lastEdits=ge;compute(){let e={dataKey:this.dataKey,parentKey:this.parentKey,labelField:this.labelField};if(!this.template)return{...e,rows:he,status:"error",loading:!1,error:this.error,loadingKeys:me,edits:ge};let t=this.roots?this.roots.store.get():null,r=[...this.levels.entries()].map(([p,g])=>[p,g.store.get()]),n=[t?.rows,...r.map(([,p])=>p.rows)];if(n.length!==this.lastParts.length||n.some((p,g)=>p!==this.lastParts[g])){this.lastParts=n;let p=new Set,g=[];for(let m of n)for(let b of m??[]){let w=R(this.keyOf(b));if(p.has(w))continue;p.add(w),g.push(b)}this.lastRows=g}let a=[t?.edits,...r.map(([,p])=>p.edits)];if(a.length!==this.lastEditsParts.length||a.some((p,g)=>p!==this.lastEditsParts[g]))this.lastEditsParts=a,this.lastEdits=Object.freeze(Object.assign({},...a.filter(Boolean)));let f=new Set;for(let[p,g]of r)if(g.status==="loading"||g.status==="idle")f.add(JSON.parse(p));let d=t?.error??r.find(([,p])=>p.error)?.[1].error??null,h=t?t.status==="error"||d?"error":t.status:"idle";return{...e,rows:this.lastRows,status:h,loading:t?.status==="loading",error:d,loadingKeys:f.size?f:me,edits:this.lastEdits}}}var He=(e,t)=>e===t||e.size===t.size&&[...e].every((r)=>t.has(r));function we(e,t={}){let r=(typeof t.registry==="function"?t.registry():t.registry)??Be();return new be(e,r)}var I=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null),ke=(e)=>typeof e==="object"&&e!==null&&Array.isArray(e.path)&&typeof e.subscribe==="function"&&("store"in e);var De=(e)=>M(e)||ke(e)||xe(e)||e instanceof s?e:JSON.stringify(e),Se=/^[A-Za-z_][A-Za-z0-9_]{0,62}$/,C=[],Oe=Object.freeze({}),L=(e,t=2)=>String(e).padStart(t,"0");function Ne(e,t){if(e instanceof Date){if(t==="date")return`${L(e.getFullYear(),4)}-${L(e.getMonth()+1)}-${L(e.getDate())}`;return e.toISOString()}return e}function Ce(e,t){let r=null;try{if(r=(typeof t==="function"?t():t)??Be(),e instanceof s)throw e;let n={tree:null,registry:r};if(M(e))return{store:e,binding:null,list:e,field:null,error:null,...n};if(ke(e))return{store:e.store,binding:null,list:null,field:e,error:null,...n};let{binding:a,store:f}=$e(xe(e)?e:ze(e),r);if(M(f)&&a.field===""&&ye(a))return{store:f,binding:a,list:null,field:null,error:null,tree:we(e,{registry:r}),registry:r};if(M(f)&&a.field==="")return{store:f,binding:a,list:f,field:null,error:null,...n};if(!M(f)&&!de(f))throw new s("unknown_store",`no store named "${a.store}"`,{params:{name:a.store},path:"store"});return{store:f,binding:a,list:null,field:tt(f,a.field),error:null,...n}}catch(n){return{store:null,binding:null,list:null,field:null,error:S(n),tree:null,registry:r}}}class Ke{source;registry;r;cell;stops=[];inferred=C;merged=C;columnCache=new Map;lastRows=null;constructor(e,t){this.source=e,this.registry=t,this.r=Ce(e,t),this.cell=new F(this.compute(),{start:()=>this.start(),stop:()=>this.stop()})}get store(){return this.r.store}get binding(){return this.r.binding}get(){if(!this.cell.observed)this.sync();return this.cell.get()}subscribe(e){return this.cell.subscribe(e)}toJSON(){throw new s("not_serializable","a data binding cannot be serialised: pass its JSON description instead")}load(e){let t=this.r.list;if(!t)return;let r=Math.max(1,Math.floor(e.rows||t.get().pageSize)),n=e.multiSortMeta&&e.multiSortMeta.length?e.multiSortMeta:e.sortField?[{field:e.sortField,order:e.sortOrder??1}]:[],a=(e.globalFilter??"").trim(),f=ae(n),d=le(e.filters,this.merged)??{},h=t.get(),p=r!==h.pageSize||JSON.stringify(f)!==JSON.stringify(h.order)||JSON.stringify(d)!==JSON.stringify(h.filters)||a!==h.search.trim(),g={pageSize:r,order:f,filters:d,search:a};if(!p)g.page=Math.floor(Math.max(0,e.first)/r)+1;if(a&&t.get().searchColumns.length===0){let m=this.textColumns();if(m.length)g.searchColumns=m}t.update(g)}setPage(e,t){let r=this.r.list;if(!r)return;let n=Math.max(1,Math.floor(t||r.get().pageSize));r.update({page:Math.floor(Math.max(0,e)/n)+1,pageSize:n})}setSearch(e){let t=this.r.list;if(!t)return;let r=e.trim(),n={search:r};if(r&&t.get().searchColumns.length===0){let a=this.textColumns();if(a.length)n.searchColumns=a}t.update(n)}listOf(e){return this.r.tree?this.r.tree.storeOf(e):this.r.list}loadChildren(e){return this.r.tree?this.r.tree.loadChildren(e):Promise.resolve([])}hasChildren(e){return this.r.tree?this.r.tree.hasChildren(e):!1}edit(e,t){let r=this.listOf(e),n=Object.entries(t);if(n.length===0)return;if(r){let m=r.keyOf(e);for(let[b,w]of n)r.set(m,b,Ne(w,this.merged.find((N)=>N.field===b)?.type));return}let a=this.r.field;if(!a||!a.writable)return;let f=a.get();if(!Array.isArray(f))return;let h=(this.converted?.rows??f).indexOf(e),p=h>=0?h:f.indexOf(e);if(p<0)return;let g=f.map((m,b)=>b===p&&I(m)?{...m,...Object.fromEntries(n.map(([w,N])=>[w,Ne(N,this.merged.find((O)=>O.field===w)?.type)]))}:m);a.set(g)}rowEdit(e){let t=this.listOf(e);if(!t)return Z;return t.get().edits[t.keyOf(e)]??Z}resolveRow(e,t){let r=this.listOf(e);if(r)r.resolve(r.keyOf(e),null,t)}dismissRow(e){let t=this.listOf(e);if(t)t.dismiss(t.keyOf(e))}makeCurrent(e){let t=this.r.tree?null:this.r.list;return t?t.makeCurrent(e):Promise.resolve(!1)}async retry(){if(!this.r.store){let e=this.cell.observed;if(e)this.stop();if(this.r=Ce(this.source,this.registry),e)this.start();this.sync();return}if(this.r.tree)return this.r.tree.retry();await this.r.store.refresh()}columns(e){this.get();let t=this.columnCache.get(e);if(!t){let r=this.merged.map((n)=>{let a=n.reference?this.feeds.get(JSON.stringify(n.reference)):void 0,f=a?.get().options;return a&&f&&f.length?{...n,options:f.map((d)=>({value:d.value,label:d.label}))}:n});t=Os(r,{locale:e}),this.columnCache.set(e,t)}return t}format(e,t,r){let n=this.merged.find((f)=>t.key!==void 0&&f.key===t.key||t.field!==void 0&&f.field===t.field);if(!n)return k(e,{},r);if(n.reference){let f=e===null||e===void 0?void 0:this.feeds.get(JSON.stringify(n.reference))?.find(e);return f?f.label:k(e,{},r)}let a=n.options?.map((f)=>({value:f.value,label:ne(f.label,r.locale)}));return k(e,{fieldType:n.type,...n.format?{format:n.format}:{},...a?{options:a}:{}},r)}textColumns(){return this.merged.filter((e)=>e.type==="text"&&!e.hidden&&Se.test(e.field)).map((e)=>e.field)}feeds=new Map;feedStops=[];syncFeeds(e){for(let t of this.merged){if(!t.reference)continue;let r=JSON.stringify(t.reference),n=this.feeds.get(r);if(!n){if(n=lt(t.reference,this.r.registry),this.feeds.set(r,n),this.cell?.observed)this.feedStops.push(n.subscribe(()=>{this.columnCache=new Map,this.refreshCells()}))}let a=new Set;for(let f of e){let d=I(f)?V(f,t.field):void 0;if(d!==null&&d!==void 0)for(let h of Array.isArray(d)?d:[d])a.add(h)}n.want([...a])}}refreshCells(){let e=this.cell.get();this.cell.set({...e,fields:[...e.fields]})}start(){if(this.r.tree){let a=this.r.tree;if(this.r.store&&this.r.binding?.fields)this.stops.push(this.r.store.fields.use(this.r.binding.fields));this.stops.push(a.subscribe(()=>this.sync())),this.sync(),this.listenFeeds();return}let{list:e,field:t,store:r}=this.r,n=this.r.binding?.fields?D(this.r.binding.fields,"search").map((a)=>a.field).filter((a)=>Se.test(a)):[];if(e&&n.length)e.setSearchColumns(n);if(r&&this.r.binding?.fields)this.stops.push(r.fields.use(this.r.binding.fields));if(e)this.stops.push(e.subscribe(()=>this.sync()));else if(t&&r)this.stops.push(t.subscribe(()=>this.sync())),this.stops.push(r.subscribe(()=>this.sync()));this.sync(),this.listenFeeds()}listenFeeds(){for(let e of this.feeds.values())this.feedStops.push(e.subscribe(()=>{this.columnCache=new Map,this.refreshCells()}));this.syncFeeds(this.get().rows)}stop(){let e=this.stops;this.stops=[];for(let r of e)r();let t=this.feedStops;this.feedStops=[];for(let r of t)r()}sync(){let e=this.compute();if(rt(this.cell.get(),e))return;if(this.cell.set(e),this.cell.observed&&this.merged.some((t)=>t.reference))this.syncFeeds(e.rows)}fieldsFor(e){let t=this.r.binding?.fields,r=this.r.binding?.fieldsOnly??!1;if(e!==this.lastRows){if(this.lastRows=e,!r&&e.length>0&&(this.inferred.length===0||Ps(e,this.inferred))){let a=cn(e),f=new Set(this.inferred.map((d)=>d.key));this.inferred=[...this.inferred,...a.filter((d)=>!f.has(d.key))]}}let n=Mt(this.inferred,t,{only:r});if(!Xe(n,this.merged))this.merged=n,this.columnCache=new Map;return this.merged}converted=null;localRows(e,t){let r=this.converted;if(r&&r.raw===e&&r.fields===t)return r.rows;let n=t.filter((f)=>f.type==="datetime"&&!f.field.includes(".")).map((f)=>f.field),a=e;if(n.length){let f=!1,d=e.map((h)=>{if(!I(h))return h;let p=null;for(let g of n){let m=h[g];if(typeof m==="string"&&/^\d{4}-\d{2}-\d{2}[T ]/.test(m)){let b=new Date(m);if(!Number.isNaN(b.getTime()))(p??={...h})[g]=b}}if(p)f=!0;return p??h});if(f)a=d}return this.converted={raw:e,fields:t,rows:a},a}compute(){let{list:e,field:t,store:r,error:n,tree:a}=this.r;if(a){let m=a.get(),b=this.fieldsFor(m.rows);return{mode:"tree",rows:m.error?C:m.rows,total:m.rows.length,first:0,pageSize:m.rows.length,sort:C,search:"",status:m.status,loading:m.loading,error:m.error,fields:b,searchable:!1,edits:m.edits,editable:b.some((w)=>w.editable),tree:{dataKey:m.dataKey,parentKey:m.parentKey,labelField:m.labelField,loadingKeys:m.loadingKeys}}}if(!r)return{mode:"local",rows:C,total:0,first:0,pageSize:0,sort:C,search:"",status:"error",loading:!1,error:n,fields:this.fieldsFor(C),searchable:!1,edits:Oe,editable:!1};if(e){let m=e.get(),b=this.r.binding?.fields?D(this.r.binding.fields,"search").length>0:!1,w=this.fieldsFor(m.rows);return{mode:"server",rows:m.rows,total:m.total??m.rows.length,first:(m.page-1)*m.pageSize,pageSize:m.pageSize,sort:ce(m.order),search:m.search,status:m.status,loading:m.status==="loading",error:m.error,fields:w,searchable:b||(e.description.search?.length??0)>0,edits:m.edits,editable:w.some((N)=>N.editable),...m.current.active?{current:m.current.row}:{},...m.totals?{totals:m.totals}:{}}}let f=t.get(),d=Array.isArray(f)?f:C,h=this.fieldsFor(d),p=this.localRows(d,h),g=r.get();return{mode:"local",rows:p,total:p.length,first:0,pageSize:p.length,sort:C,search:"",status:g.status,loading:g.status==="loading",error:g.error,fields:h,searchable:!1,edits:Oe,editable:h.some((m)=>m.editable)&&t.writable}}}function Xe(e,t){return e===t||e.length===t.length&&JSON.stringify(e)===JSON.stringify(t)}function rt(e,t){return e.mode===t.mode&&e.rows===t.rows&&e.total===t.total&&e.first===t.first&&e.pageSize===t.pageSize&&e.search===t.search&&e.status===t.status&&e.error===t.error&&e.fields===t.fields&&e.searchable===t.searchable&&e.edits===t.edits&&e.editable===t.editable&&JSON.stringify(e.sort)===JSON.stringify(t.sort)&&e.tree?.loadingKeys===t.tree?.loadingKeys&&e.current===t.current&&e.totals===t.totals}function Te(e,t={}){return new Ke(e,t.registry)}var Ae=(e,t=[10,25,50,100])=>[...new Set([...t,e])].filter((r)=>r>0).sort((r,n)=>r-n);function st(e){if(e===Z)return"";return[e.dirty?"is-dirty":"",e.saving?"is-saving":"",e.error&&Object.keys(e.conflicts).length===0?"is-error":"",Object.keys(e.conflicts).length?"is-conflict":""].filter(Boolean).join(" ")}function Cs(e,t,r){let n=t.mode==="server",a=t.tree?.dataKey??D(t.fields,"key")[0]?.field??(t.fields.some((d)=>d.field==="id")?"id":void 0),f=t.tree?{parentKey:t.tree.parentKey,lazyChildren:!0,loadChildren:(d)=>e.loadChildren(d),hasChildren:(d)=>e.hasChildren(d)}:{};return{value:t.error?C:t.rows,lazy:n,totalRecords:t.total,loading:t.loading,...n?{first:t.first,rows:t.pageSize,sort:t.sort,rowsPerPageOptions:Ae(t.pageSize,r.rowsPerPageOptions)}:{},columns:e.columns(r.locale),cellFormatter:(d,h)=>e.format(d,h,r),paginator:n,showSearch:n&&t.searchable,...a?{dataKey:a}:{},errorKey:t.error?t.error.messageKey:null,...t.error?.params?{errorParams:t.error.params}:{},...t.editable?{editMode:"cell"}:{},rowClass:(d)=>{let h=st(e.rowEdit(d));return t.current!==void 0&&t.current!==null&&it(e,d,t.current)?h?`${h} is-current`:"is-current":h},...n?{rowClick:(d)=>void e.makeCurrent(d)}:{},...t.totals?{totalsRow:nt(e,t,r)}:{},rowMessage:(d)=>{let h=r.t,p=e.rowEdit(d);if(!h||p===Z)return null;if(Object.keys(p.conflicts).length>0)return{severity:"conflict",text:h("data.conflict_row"),actions:[{label:h("data.keep_mine"),run:()=>e.resolveRow(d,"mine")},{label:h("data.take_theirs"),run:()=>e.resolveRow(d,"theirs")}]};let g=p.error??Object.values(p.errors)[0]??null;if(!g)return null;return{severity:"error",text:h(g.messageKey,g.params),actions:[{label:h("data.dismiss"),run:()=>e.dismissRow(d)}]}},...f}}function it(e,t,r){if(t===r)return!0;let n=e.store;return n!==null&&n.type==="list"&&n.keyOf(t)===n.keyOf(r)}function nt(e,t,r){let n=t.totals??{},a={};for(let f of t.fields)for(let d of["sum","avg","min","max"]){let h=n[d];if(h&&f.field in h){a[f.field]=e.format(h[f.field],{field:f.field,key:f.key},r);break}}if(typeof n.count==="number")a.count=String(n.count);return a}function ot(e,t,r){let n=I(e)?e:{},a=(g)=>g?k(V(n,g.field),{fieldType:g.type,...g.format?{format:g.format}:{}},r):"",f=D(t,"label")[0]??t.find((g)=>g.type==="text"&&!g.hidden&&g.field!=="id"),d=D(t,"description")[0],h=D(t,"image")[0],p=h?V(n,h.field):null;return{label:a(f),description:a(d),image:typeof p==="string"&&p?p:null}}var V=(e,t)=>{let r=e;for(let n of t.split(".")){if(r===null||typeof r!=="object")return;r=r[n]}return r};function Ts(e,t,r){let n=t.mode==="server",a=D(t.fields,"key")[0]?.field??(t.fields.some((f)=>f.field==="id")?"id":void 0);return{value:t.error?C:t.rows,lazy:n,totalRecords:t.total,loading:t.loading&&t.rows.length===0,...n?{first:t.first,rows:t.pageSize,rowsPerPageOptions:Ae(t.pageSize,[6,12,24,48])}:{},paginator:n,...a?{dataKey:a}:{},errorKey:t.error?t.error.messageKey:null,...t.error?.params?{errorParams:t.error.params}:{},parts:(f)=>ot(f,t.fields,r)}}function Ze(e){let t=A(Et,null),r=l(null),n=l(null),a=null,f=!1,d=void 0,h=()=>{a?.(),a=null;let g=r.value;if(!g||!f)return;a=g.subscribe((m)=>n.value=m),n.value=g.get()},p=(g)=>{let m=g==null?null:De(g);if(r.value&&m===d)return;d=m,a?.(),a=null,r.value=g==null?null:Te(g,{registry:t}),n.value=r.value?r.value.get():null,h()};if(p(e()),c(e,(g)=>p(g)),pe())y(()=>{f=!0,h()}),u(()=>{f=!1,a?.(),a=null});return{binding:r,state:n}}var sr=Symbol("poad-bound-field-source");function ue(e,t=!0){let r=A(Et,null),n=t?A(sr,null):null,a=i(),f=l(null),d=l(null),h=null,p=!1,g=void 0,m=()=>e()??n?.()??null,b=()=>{h?.(),h=null;let O=f.value;if(!O||!p)return;h=O.subscribe((K)=>d.value=K),d.value=O.get()},w=(O)=>{let K=O==null?null:G(O);if(f.value&&K===g)return;g=K,h?.(),h=null,f.value=O==null?null:X(O,{registry:r}),d.value=f.value?f.value.get():null,b()};if(w(m()),c(m,(O)=>w(O)),pe())y(()=>{p=!0,b()}),u(()=>{p=!1,h?.(),h=null});let N=o(()=>{let O=f.value,K=d.value;if(!O||!K)return null;return Q(O,K,(Ee,Pe)=>a.t(Ee,Pe),{locale:a.locale})});return{binding:f,state:d,view:N,value:()=>(d.value,f.value?.controlValue()),input:(O)=>f.value?.setFromControl(O)}}function Qe(e,t,r=(n)=>n){return{get value(){return t.binding.value?r(t.value()):e.value},set value(n){if(t.binding.value)t.input(n);e.value=n}}}function et(e,t,r=()=>!1){let n=ue(e),a=i(),f=o(()=>{let d=n.binding.value,h=n.state.value;if(!d||!h)return null;return te(d,h,t,a.locale,{multiple:r()})});return{bound:n,choice:f,options:(d)=>f.value?.options??d,paths:(d,h=!0)=>f.value?.options?{...d,optionLabel:"label",...h?{optionValue:"value"}:{}}:d,model(d){return{get value(){return f.value?f.value.value:d.value},set value(h){if(f.value)f.value.set(h);d.value=h}}},invalid:(d)=>!!d||!!n.view.value?.invalid,filter:(d)=>f.value?.filter(d)}}
1
+ import{s,S,P,F,ne,Os,D,Z,tt,ve,se,M,de,Fe,ze,xe,$e,Be,As,fe,ir,lt,cn,Mt,Ps,Et}from"./c-j63hz554.js";import{i}from"./c-xw7vce7r.js";import{l,A,c,y,u,pe,o}from"./c-qzar8xvm.js";var q=new Map;function Y(e,t){let r=q.get(e);if(!r)r=t(),q.set(e,r);return r}var W=/^(\d{4})-(\d{2})-(\d{2})$/;function je(e){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e==="number")return Number.isFinite(e)?new Date(e):null;if(typeof e!=="string"||!e)return null;let t=W.exec(e),r=t?new Date(Number(t[1]),Number(t[2])-1,Number(t[3])):/^\d{4}-\d{2}-\d{2}[T ]/.test(e)?new Date(e):null;return r&&!Number.isNaN(r.getTime())?r:null}function k(e,t,r){if(e===null||e===void 0||e==="")return"";let n=t.fieldType??t.type??"text",a=t.format??{},f=r.locale;switch(n){case"number":{let d=typeof e==="number"?e:typeof e==="string"&&e.trim()!==""?Number(e):NaN;if(!Number.isFinite(d))return String(e);let h=`n|${f}|${a.currency??""}|${a.percent?1:0}|${a.decimals??""}`;return Y(h,()=>new Intl.NumberFormat(f,{...a.currency?{style:"currency",currency:a.currency}:a.percent?{style:"percent"}:{},...a.decimals!==void 0?{minimumFractionDigits:a.decimals,maximumFractionDigits:a.decimals}:a.currency?{}:{maximumFractionDigits:2}})).format(d)}case"date":case"datetime":{let d=je(e);if(!d)return String(e);let h=a.date??"short",p=n==="datetime"&&!(typeof e==="string"&&W.test(e)),g=`d|${f}|${h}|${p?1:0}`;return Y(g,()=>new Intl.DateTimeFormat(f,{...h==="short"?{year:"numeric",month:"2-digit",day:"2-digit"}:{dateStyle:h},...p?h==="short"?{hour:"2-digit",minute:"2-digit"}:{timeStyle:"short"}:{}})).format(d)}case"boolean":return typeof e==="boolean"?r.booleanText?r.booleanText(e):String(e):String(e);case"enum":{let d=(t.filterOptions??t.options)?.find((h)=>h.value===e);return d?String(typeof d.label==="string"?d.label:e):String(e)}default:if(typeof e==="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)}}var U=(e)=>typeof e==="object"&&e!==null&&Array.isArray(e.path)&&typeof e.subscribe==="function"&&("store"in e);var G=(e)=>U(e)||xe(e)||e instanceof s?e:JSON.stringify(e),J=(e,t=2)=>String(e).padStart(t,"0"),Me=(e)=>`${J(e.getFullYear(),4)}-${J(e.getMonth()+1)}-${J(e.getDate())}`;function Re(e,t){if((t==="date"||t==="datetime")&&typeof e==="string"&&e){let r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(r)return new Date(Number(r[1]),Number(r[2])-1,Number(r[3]));let n=new Date(e);return Number.isNaN(n.getTime())?e:n}return e}function _e(e,t){if(t==="date")return e instanceof Date?Me(e):e===""?null:e;if(t==="datetime")return e instanceof Date?e.toISOString():e===""?null:e;if(t==="number"){if(e===""||e===null||e===void 0)return null;if(typeof e==="string"){let r=Number(e.replace(",","."));return Number.isFinite(r)?r:e}return e}return e}function Ie(e,t){try{let r=(typeof t==="function"?t():t)??Be();if(e instanceof s)throw e;if(U(e))return{target:e,binding:null,field:null,error:null,registry:r};let{binding:n,store:a}=$e(xe(e)?e:ze(e),r);if(!M(a)&&!de(a))throw new s("unknown_store",`no store named "${n.store}"`,{params:{name:n.store},path:"store"});let f=tt(a,n.field),d=n.fields?.find((h)=>h.field===n.field||h.key===n.field)??(n.fields?.length===1?n.fields[0]:void 0);return{target:f,binding:n,field:d??null,error:null,registry:r}}catch(r){return{target:null,binding:null,field:null,error:S(r),registry:null}}}var Je=(e)=>{let t=e.path;if(e.store.type==="record")return typeof t[0]==="string"?t[0]:null;return typeof t[1]==="string"?t[1]:null};class H{r;cell;stops=[];constructor(e,t){this.r=Ie(e,t),this.cell=new F(this.compute(),{start:()=>this.start(),stop:()=>this.stop()})}get target(){return this.r.target}get binding(){return this.r.binding}get(){if(!this.cell.observed)this.sync();return this.cell.get()}subscribe(e){return this.cell.subscribe(e)}toJSON(){throw new s("not_serializable","a field binding cannot be serialised: pass its JSON description instead")}descriptor(){if(this.r.field)return this.r.field;let e=this.r.target;if(!e)return null;let t=Je(e);return t?e.store.fields.rule(t)??null:null}feed=null;feedFor=null;stopFeed=null;localized=null;optionsFeed(){let e=this.descriptor()?.reference;if(!e)return null;let t=JSON.stringify(e);if(this.feed&&this.feedFor===t)return this.feed;if(this.stopFeed?.(),this.stopFeed=null,this.feed=lt(e,this.r.registry),this.feedFor=t,this.cell?.observed)this.listenFeed();return this.feed}listenFeed(){if(!this.feed||this.stopFeed)return;this.stopFeed=this.feed.subscribe(()=>this.sync()),this.wantValue()}wantValue(){let e=this.r.target?.get();this.feed?.want(Array.isArray(e)?e:e===null||e===void 0?[]:[e])}options(e){let t=this.descriptor();if(!t)return null;if(t.reference)return this.optionsFeed()?.get().options??null;if(!t.options)return null;let r=this.localized;if(r&&r.locale===e&&r.source===t.options)return r.out;let n=As(t.options,e);return this.localized={locale:e,source:t.options,out:n},n}searchOptions(e){this.optionsFeed()?.search(e)}suggest(e,t){let r=this.optionsFeed();if(r)return r.suggest(e);return Promise.resolve(ir(this.options(t)??[],e))}optionOf(e,t){let r=this.optionsFeed();if(r)return r.find(e);return(this.options(t)??[]).find((n)=>fe(n.value,e))}set(e){let t=this.r.target;if(!t||!t.writable)return;if(P(e,t.get()))return;t.set(e)}setFromControl(e){this.set(_e(e,this.descriptor()?.type))}controlValue(){return Re(this.get().value,this.descriptor()?.type)}resolve(e){this.r.target?.resolve(e)}revert(){this.r.target?.revert()}format(e,t){let r=this.descriptor();if(!r)return k(e,{},t);let n=r.options?.map((a)=>({value:a.value,label:ne(a.label,t.locale)}));return k(e,{fieldType:r.type,...r.format?{format:r.format}:{},...n?{options:n}:{}},t)}start(){let e=this.r.target;if(!e)return;if(this.r.field)this.stops.push(e.store.fields.use([this.r.field]));if(this.stops.push(e.subscribe(()=>{this.wantValue(),this.sync()})),this.stops.push(e.status.subscribe(()=>this.sync())),this.stops.push(e.store.subscribe(()=>this.sync())),this.optionsFeed())this.listenFeed();this.sync()}stop(){let e=this.stops;this.stops=[];for(let t of e)t();this.stopFeed?.(),this.stopFeed=null}sync(){let e=this.compute(),t=this.cell.get();if(t.value===e.value&&t.writable===e.writable&&t.dirty===e.dirty&&t.saving===e.saving&&t.error===e.error&&t.conflict===e.conflict&&t.loading===e.loading&&t.field===e.field&&Ve(t.choice,e.choice))return;this.cell.set(e)}compute(){let e=this.r.target,t=this.descriptor();if(!e){let f=this.r.error;return{value:void 0,writable:!1,dirty:!1,saving:!1,error:f,conflict:null,loading:!1,field:null,required:!1,errorKey:f?.messageKey??null,...f?.params?{errorParams:f.params}:{},choice:null}}let r=e.status.get(),n=e.store.get(),a=r.error??(n.status==="error"?n.error:null);return{value:e.get(),writable:r.writable,dirty:r.dirty,saving:r.saving,error:a,conflict:r.conflict,loading:n.status==="loading",field:t,required:!!t?.rules?.required,errorKey:a?.messageKey??null,...a?.params?{errorParams:a.params}:{},choice:this.choiceState(t)}}choiceState(e){if(e?.reference){let t=this.feed&&this.feedFor===JSON.stringify(e.reference)?this.feed:null,r=t?t.get():null;return{source:"reference",loading:r?.loading??!1,complete:r?.complete??!1,error:r?.error??null,options:r?.options??null}}if(e?.options)return Le;return null}}var Le=Object.freeze({source:"static",loading:!1,complete:!0,error:null,options:null}),Ve=(e,t)=>e===t||!!e&&!!t&&e.source===t.source&&e.loading===t.loading&&e.complete===t.complete&&e.error===t.error&&e.options===t.options;function X(e,t={}){return new H(e,t.registry)}function Q(e,t,r,n){let a=!!t.conflict,f=a?r("data.conflict_field",{theirs:e.format(t.conflict.theirs,n)||"—"}):t.errorKey?r(t.errorKey,t.errorParams):null,d=[t.dirty?"is-dirty":"",t.saving?"is-saving":"",a?"is-conflict":""].filter(Boolean).join(" ");return{invalid:!!t.error||a,classes:d,message:f,conflict:a,required:t.required}}var T=(e)=>Array.isArray(e)?e:e===null||e===void 0||e===""?[]:[e];function ee(e,t,r,n){let a=[];for(let f of e){let d=r.find((h)=>fe(h.value,f))??t.optionOf(f,n);if(d)a.push(d)}return a}function te(e,t,r,n,a={}){let f=e.options(n),d=f??[],h=r==="multiselect"||r==="picklist"||!!a.multiple,p=t.value,g;if(r==="picklist")g=ee(T(p),e,d,n);else if(r==="combo")g=h?ee(T(p),e,d,n):p===null||p===void 0?null:d.find((b)=>fe(b.value,p))??e.optionOf(p,n)??null;else if(h)g=[...T(p)];else g=p??null;if(!h&&r!=="combo"&&g!==null)g=d.find((b)=>fe(b.value,g))?.value??g;if(h&&Array.isArray(g)&&r!=="picklist"&&r!=="combo")g=g.map((b)=>d.find((w)=>fe(w.value,b))?.value??b);let m=t.choice;return{options:f,value:g,loading:!!m?.loading,remote:m?.source==="reference"&&!m.complete,set(b){if(r==="picklist"||r==="combo"&&h){e.setFromControl(T(b).map((w)=>w!==null&&typeof w==="object"?w.value:w));return}if(r==="combo"){if(b===null||b===void 0||b==="")e.setFromControl(null);else if(typeof b==="object")e.setFromControl(b.value);return}e.setFromControl(h?[...T(b)]:b??null)},filter(b){if(m?.source==="reference")e.searchOptions(b)},suggest:(b)=>e.suggest(b,n)}}var oe=/^[A-Za-z_][A-Za-z0-9_]{0,62}$/,qe=/^[A-Za-z_][A-Za-z0-9_]{0,62}(\.[A-Za-z0-9_]{1,63})+$/,z=(e)=>e===null||e===void 0||e==="",Ye=(e)=>z(e)||Array.isArray(e)&&e.length===0,re=(e)=>String(e).padStart(2,"0"),B=(e)=>`${e.getFullYear()}-${re(e.getMonth()+1)}-${re(e.getDate())}`;function _(e){let t=null;if(e instanceof Date)t=new Date(e.getTime());else if(typeof e==="number"&&Number.isFinite(e))t=new Date(e);else if(typeof e==="string"){let r=/^(\d{4})-(\d{2})-(\d{2})/.exec(e.trim());if(r)t=e.trim().length>10?new Date(e.trim()):new Date(Number(r[1]),Number(r[2])-1,Number(r[3]))}if(!t||Number.isNaN(t.getTime()))return null;return new Date(t.getFullYear(),t.getMonth(),t.getDate())}var We=(e)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+1),v=(e)=>e===null||typeof e==="string"||typeof e==="boolean"||typeof e==="number"&&Number.isFinite(e)?e:e instanceof Date?e.toISOString():void 0;function Ue(e,t){if(e)return e.type;if(typeof t==="number")return"number";if(typeof t==="boolean")return"boolean";if(t instanceof Date)return"date";return"text"}var x=(e,t,r=!1)=>{let n=r?We(t):t;return e==="datetime"?n.toISOString():B(n)},j=(e,t)=>({or:[t,{[e]:{is:null}}]});function Ge(e,t,r){if(!oe.test(e)&&!qe.test(e))return;let n=t.matchMode??"contains",a=t.value,f=Ue(r,Array.isArray(a)?a.find((m)=>!z(m)):a),d=f==="text"||f==="enum"||f==="json"||f==="geometry",h=f==="date"||f==="datetime",p=(m)=>({[e]:m});if(n==="isEmpty")return d&&f==="text"?{or:[p({is:null}),p({eq:""})]}:p({is:null});if(n==="isNotEmpty")return d&&f==="text"?{and:[p({not:null}),p({ne:""})]}:p({not:null});if(Ye(a))return;let g=(m)=>m instanceof Date?B(m):String(m);switch(n){case"contains":return p({ilike:`%${Fe(g(a))}%`});case"notContains":return j(e,p({notIlike:`%${Fe(g(a))}%`}));case"startsWith":return p({ilike:`${Fe(g(a))}%`});case"endsWith":return p({ilike:`%${Fe(g(a))}`});case"eq":case"neq":{let m;if(f==="boolean"){let b=a===!0||a==="true"?!0:a===!1||a==="false"?!1:void 0;if(b===void 0)return;m=p({is:b})}else if(h)return ie(e,f,a,n==="eq"?"dateIs":"dateIsNot");else if(f==="text")m=p({ilike:Fe(g(a))});else{let b=v(f==="number"?E(a):a);if(b===void 0||b===null)return;m=p({eq:b})}if(n==="eq")return m;return f==="text"?j(e,p({notIlike:Fe(g(a))})):j(e,{not:m})}case"lt":case"lte":case"gt":case"gte":{if(h){let b=_(a);if(!b)return;if(n==="lt")return p({lt:x(f,b)});if(n==="lte")return p({lt:x(f,b,!0)});if(n==="gt")return p({gte:x(f,b,!0)});return p({gte:x(f,b)})}let m=v(f==="number"?E(a):a);if(m===void 0||m===null)return;return p({[n]:m})}case"in":case"notIn":{let m=(Array.isArray(a)?a:[a]).map((N)=>v(f==="number"?E(N)??N:N)).filter((N)=>N!==void 0);if(m.length===0)return;let b=m.includes(null),w=m.filter((N)=>N!==null);if(n==="in"){if(!b)return p({in:w});return w.length?{or:[p({in:w}),p({is:null})]}:p({is:null})}if(b)return w.length?{and:[p({notIn:w}),p({not:null})]}:p({not:null});return j(e,p({notIn:w}))}case"between":{let[m,b]=Array.isArray(a)?a:[a,null],w=[];if(h){let N=z(m)?null:_(m),O=z(b)?null:_(b);if(N)w.push(p({gte:x(f,N)}));if(O)w.push(p({lt:x(f,O,!0)}))}else{let N=z(m)?void 0:v(f==="number"?E(m):m),O=z(b)?void 0:v(f==="number"?E(b):b);if(N!==void 0&&N!==null)w.push(p({gte:N}));if(O!==void 0&&O!==null)w.push(p({lte:O}))}if(w.length===0)return;return w.length===1?w[0]:{and:w}}case"dateIs":case"dateIsNot":case"dateBefore":case"dateAfter":return ie(e,h?f:"date",a,n);default:return}}function ie(e,t,r,n){let a=_(r);if(!a)return;let f=(h)=>({[e]:h});if(n==="dateBefore")return f({lt:x(t,a)});if(n==="dateAfter")return f({gte:x(t,a,!0)});let d=t==="datetime"?{and:[f({gte:x(t,a)}),f({lt:x(t,a,!0)})]}:f({eq:B(a)});if(n==="dateIs")return d;return t==="datetime"?{or:[f({lt:x(t,a)}),f({gte:x(t,a,!0)}),f({is:null})]}:j(e,f({ne:B(a)}))}function E(e){if(typeof e==="number")return Number.isFinite(e)?e:void 0;if(typeof e!=="string"||e.trim()==="")return;let t=Number(e.trim().replace(/\s/g,"").replace(",","."));return Number.isFinite(t)?t:void 0}function le(e,t=[]){let r=[];for(let[n,a]of Object.entries(e??{})){if(!a)continue;let f=t.find((h)=>h.field===n||h.key===n),d=Ge(f?.field??n,a,f);if(d)r.push(d)}if(r.length===0)return;return r.length===1?r[0]:{and:r}}function ae(e){return(e??[]).filter((t)=>(t.order===1||t.order===-1)&&oe.test(t.field)).map((t)=>({column:t.field,direction:t.order===-1?"desc":"asc"}))}var ce=(e)=>e.map((t)=>({field:t.column,order:t.direction==="desc"?-1:1}));var he=Object.freeze([]),me=new Set,ge=Object.freeze({});function ye(e){return!!e?.fields&&D(e.fields,"parent").length>0}var R=(e)=>JSON.stringify(e??null);class be{binding=null;store=null;error=null;dataKey="id";parentKey="parent_id";labelField="label";template=null;roots=null;levels=new Map;cell;stopNamed=null;constructor(e,t){try{let{binding:r,store:n}=$e(e,t);if(!M(n)||r.field!=="")throw new s("invalid_binding",'a tree is bound to a list store (no "field")',{path:"store"});let a=r.fields??[],f=D(a,"parent")[0];if(!f)throw new s("invalid_binding",'a tree needs a field with the role "parent"',{path:"fields"});this.binding=r,this.store=n,this.parentKey=f.field,this.dataKey=D(a,"key")[0]?.field??n.keyColumn,this.labelField=D(a,"label")[0]?.field??a.find((h)=>h.type==="text"&&h.field!==this.dataKey&&h.field!==f.field)?.field??"label";let d=n.description;this.template={table:d.table,...d.select?{select:d.select}:{},...d.where?{where:d.where}:{},...d.order?{order:d.order}:{},...d.include?{include:d.include}:{},...d.version?{version:d.version}:{},...d.fields?{fields:d.fields}:{},...d.realtime!==void 0?{realtime:d.realtime}:{},...d.save?{save:d.save}:{},keyColumn:this.dataKey,pageSize:ve}}catch(r){this.error=S(r)}this.cell=new F(this.compute(),{start:()=>this.start(),stop:()=>this.stop()})}get(){if(!this.cell.observed)this.sync();return this.cell.get()}subscribe(e){return this.cell.subscribe(e)}toJSON(){throw new s("not_serializable","a tree binding cannot be serialised: pass its JSON description instead")}keyOf(e){return e!==null&&typeof e==="object"?e[this.dataKey]:void 0}level(e){let t=this.template,r=t.where?{and:[t.where,{[this.parentKey]:e??null}]}:{[this.parentKey]:e??null},n=se(this.store.transport,{...t,where:r}),a={store:n,stop:null,stopWrite:null,waiters:[]};return a.stopWrite=n.onWrite((f)=>this.relay(n,f)),a}relay(e,t){for(let r of this.allLevels())if(r.store!==e)r.store.receive(t);if(this.store&&e!==this.store)this.store.receive(t)}allLevels(){return[...this.roots?[this.roots]:[],...this.levels.values()]}listen(e){if(e.stop)return;e.stop=e.store.subscribe(()=>{if(e.store.get().status!=="loading"&&e.waiters.length)for(let t of e.waiters.splice(0))t();this.sync()})}loadChildren(e){let t=this.keyOf(e);if(!this.template||t===void 0||t===null)return Promise.resolve([]);let r=R(t),n=this.levels.get(r);if(!n)n=this.level(t),this.levels.set(r,n);let a=n,f=new Promise((d)=>a.waiters.push(()=>d([])));if(this.cell.observed)this.listen(a);if(this.sync(),a.stop&&a.store.get().status==="ready")for(let d of a.waiters.splice(0))d();return f}hasChildren(e){let t=this.levels.get(R(this.keyOf(e)));if(!t)return!0;let r=t.store.get();return!(r.status==="ready"&&r.rows.length===0)}storeOf(e){for(let r of this.allLevels())if(r.store.get().rows.includes(e))return r.store;let t=R(this.keyOf(e));for(let r of this.allLevels())if(r.store.get().rows.some((n)=>R(this.keyOf(n))===t))return r.store;return null}async retry(){await Promise.all(this.allLevels().map((e)=>e.store.refresh()))}start(){if(!this.template)return;this.roots??=this.level(null),this.listen(this.roots);for(let e of this.levels.values())this.listen(e);this.stopNamed=this.store.onWrite((e)=>{for(let t of this.allLevels())t.store.receive(e)}),this.sync()}stop(){for(let e of this.allLevels())e.stop?.(),e.stop=null;this.stopNamed?.(),this.stopNamed=null}sync(){let e=this.compute(),t=this.cell?.get();if(t&&t.rows===e.rows&&t.status===e.status&&t.error===e.error&&t.edits===e.edits&&He(t.loadingKeys,e.loadingKeys))return;if(this.cell)this.cell.set(e)}lastParts=[];lastRows=he;lastEditsParts=[];lastEdits=ge;compute(){let e={dataKey:this.dataKey,parentKey:this.parentKey,labelField:this.labelField};if(!this.template)return{...e,rows:he,status:"error",loading:!1,error:this.error,loadingKeys:me,edits:ge};let t=this.roots?this.roots.store.get():null,r=[...this.levels.entries()].map(([p,g])=>[p,g.store.get()]),n=[t?.rows,...r.map(([,p])=>p.rows)];if(n.length!==this.lastParts.length||n.some((p,g)=>p!==this.lastParts[g])){this.lastParts=n;let p=new Set,g=[];for(let m of n)for(let b of m??[]){let w=R(this.keyOf(b));if(p.has(w))continue;p.add(w),g.push(b)}this.lastRows=g}let a=[t?.edits,...r.map(([,p])=>p.edits)];if(a.length!==this.lastEditsParts.length||a.some((p,g)=>p!==this.lastEditsParts[g]))this.lastEditsParts=a,this.lastEdits=Object.freeze(Object.assign({},...a.filter(Boolean)));let f=new Set;for(let[p,g]of r)if(g.status==="loading"||g.status==="idle")f.add(JSON.parse(p));let d=t?.error??r.find(([,p])=>p.error)?.[1].error??null,h=t?t.status==="error"||d?"error":t.status:"idle";return{...e,rows:this.lastRows,status:h,loading:t?.status==="loading",error:d,loadingKeys:f.size?f:me,edits:this.lastEdits}}}var He=(e,t)=>e===t||e.size===t.size&&[...e].every((r)=>t.has(r));function we(e,t={}){let r=(typeof t.registry==="function"?t.registry():t.registry)??Be();return new be(e,r)}var I=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null),ke=(e)=>typeof e==="object"&&e!==null&&Array.isArray(e.path)&&typeof e.subscribe==="function"&&("store"in e);var De=(e)=>M(e)||ke(e)||xe(e)||e instanceof s?e:JSON.stringify(e),Se=/^[A-Za-z_][A-Za-z0-9_]{0,62}$/,C=[],Oe=Object.freeze({}),L=(e,t=2)=>String(e).padStart(t,"0");function Ne(e,t){if(e instanceof Date){if(t==="date")return`${L(e.getFullYear(),4)}-${L(e.getMonth()+1)}-${L(e.getDate())}`;return e.toISOString()}return e}function Ce(e,t){let r=null;try{if(r=(typeof t==="function"?t():t)??Be(),e instanceof s)throw e;let n={tree:null,registry:r};if(M(e))return{store:e,binding:null,list:e,field:null,error:null,...n};if(ke(e))return{store:e.store,binding:null,list:null,field:e,error:null,...n};let{binding:a,store:f}=$e(xe(e)?e:ze(e),r);if(M(f)&&a.field===""&&ye(a))return{store:f,binding:a,list:null,field:null,error:null,tree:we(e,{registry:r}),registry:r};if(M(f)&&a.field==="")return{store:f,binding:a,list:f,field:null,error:null,...n};if(!M(f)&&!de(f))throw new s("unknown_store",`no store named "${a.store}"`,{params:{name:a.store},path:"store"});return{store:f,binding:a,list:null,field:tt(f,a.field),error:null,...n}}catch(n){return{store:null,binding:null,list:null,field:null,error:S(n),tree:null,registry:r}}}class Ke{source;registry;r;cell;stops=[];inferred=C;merged=C;columnCache=new Map;lastRows=null;constructor(e,t){this.source=e,this.registry=t,this.r=Ce(e,t),this.cell=new F(this.compute(),{start:()=>this.start(),stop:()=>this.stop()})}get store(){return this.r.store}get binding(){return this.r.binding}get(){if(!this.cell.observed)this.sync();return this.cell.get()}subscribe(e){return this.cell.subscribe(e)}toJSON(){throw new s("not_serializable","a data binding cannot be serialised: pass its JSON description instead")}load(e){let t=this.r.list;if(!t)return;let r=Math.max(1,Math.floor(e.rows||t.get().pageSize)),n=e.multiSortMeta&&e.multiSortMeta.length?e.multiSortMeta:e.sortField?[{field:e.sortField,order:e.sortOrder??1}]:[],a=(e.globalFilter??"").trim(),f=ae(n),d=le(e.filters,this.merged)??{},h=t.get(),p=r!==h.pageSize||JSON.stringify(f)!==JSON.stringify(h.order)||JSON.stringify(d)!==JSON.stringify(h.filters)||a!==h.search.trim(),g={pageSize:r,order:f,filters:d,search:a};if(!p)g.page=Math.floor(Math.max(0,e.first)/r)+1;if(a&&t.get().searchColumns.length===0){let m=this.textColumns();if(m.length)g.searchColumns=m}t.update(g)}setPage(e,t){let r=this.r.list;if(!r)return;let n=Math.max(1,Math.floor(t||r.get().pageSize));r.update({page:Math.floor(Math.max(0,e)/n)+1,pageSize:n})}setSearch(e){let t=this.r.list;if(!t)return;let r=e.trim(),n={search:r};if(r&&t.get().searchColumns.length===0){let a=this.textColumns();if(a.length)n.searchColumns=a}t.update(n)}listOf(e){return this.r.tree?this.r.tree.storeOf(e):this.r.list}loadChildren(e){return this.r.tree?this.r.tree.loadChildren(e):Promise.resolve([])}hasChildren(e){return this.r.tree?this.r.tree.hasChildren(e):!1}edit(e,t){let r=this.listOf(e),n=Object.entries(t);if(n.length===0)return;if(r){let m=r.keyOf(e);for(let[b,w]of n)r.set(m,b,Ne(w,this.merged.find((N)=>N.field===b)?.type));return}let a=this.r.field;if(!a||!a.writable)return;let f=a.get();if(!Array.isArray(f))return;let h=(this.converted?.rows??f).indexOf(e),p=h>=0?h:f.indexOf(e);if(p<0)return;let g=f.map((m,b)=>b===p&&I(m)?{...m,...Object.fromEntries(n.map(([w,N])=>[w,Ne(N,this.merged.find((O)=>O.field===w)?.type)]))}:m);a.set(g)}rowEdit(e){let t=this.listOf(e);if(!t)return Z;return t.get().edits[t.keyOf(e)]??Z}resolveRow(e,t){let r=this.listOf(e);if(r)r.resolve(r.keyOf(e),null,t)}dismissRow(e){let t=this.listOf(e);if(t)t.dismiss(t.keyOf(e))}makeCurrent(e){let t=this.r.tree?null:this.r.list;return t?t.makeCurrent(e):Promise.resolve(!1)}async retry(){if(!this.r.store){let e=this.cell.observed;if(e)this.stop();if(this.r=Ce(this.source,this.registry),e)this.start();this.sync();return}if(this.r.tree)return this.r.tree.retry();await this.r.store.refresh()}columns(e){this.get();let t=this.columnCache.get(e);if(!t){let r=this.merged.map((n)=>{let a=n.reference?this.feeds.get(JSON.stringify(n.reference)):void 0,f=a?.get().options;return a&&f&&f.length?{...n,options:f.map((d)=>({value:d.value,label:d.label}))}:n});t=Os(r,{locale:e}),this.columnCache.set(e,t)}return t}format(e,t,r){let n=this.merged.find((f)=>t.key!==void 0&&f.key===t.key||t.field!==void 0&&f.field===t.field);if(!n)return k(e,{},r);if(n.reference){let f=e===null||e===void 0?void 0:this.feeds.get(JSON.stringify(n.reference))?.find(e);return f?f.label:k(e,{},r)}let a=n.options?.map((f)=>({value:f.value,label:ne(f.label,r.locale)}));return k(e,{fieldType:n.type,...n.format?{format:n.format}:{},...a?{options:a}:{}},r)}textColumns(){return this.merged.filter((e)=>e.type==="text"&&!e.hidden&&Se.test(e.field)).map((e)=>e.field)}feeds=new Map;feedStops=[];syncFeeds(e){for(let t of this.merged){if(!t.reference)continue;let r=JSON.stringify(t.reference),n=this.feeds.get(r);if(!n){if(n=lt(t.reference,this.r.registry),this.feeds.set(r,n),this.cell?.observed)this.feedStops.push(n.subscribe(()=>{this.columnCache=new Map,this.refreshCells()}))}let a=new Set;for(let f of e){let d=I(f)?V(f,t.field):void 0;if(d!==null&&d!==void 0)for(let h of Array.isArray(d)?d:[d])a.add(h)}n.want([...a])}}refreshCells(){let e=this.cell.get();this.cell.set({...e,fields:[...e.fields]})}start(){if(this.r.tree){let a=this.r.tree;if(this.r.store&&this.r.binding?.fields)this.stops.push(this.r.store.fields.use(this.r.binding.fields));this.stops.push(a.subscribe(()=>this.sync())),this.sync(),this.listenFeeds();return}let{list:e,field:t,store:r}=this.r,n=this.r.binding?.fields?D(this.r.binding.fields,"search").map((a)=>a.field).filter((a)=>Se.test(a)):[];if(e&&n.length)e.setSearchColumns(n);if(r&&this.r.binding?.fields)this.stops.push(r.fields.use(this.r.binding.fields));if(e)this.stops.push(e.subscribe(()=>this.sync()));else if(t&&r)this.stops.push(t.subscribe(()=>this.sync())),this.stops.push(r.subscribe(()=>this.sync()));this.sync(),this.listenFeeds()}listenFeeds(){for(let e of this.feeds.values())this.feedStops.push(e.subscribe(()=>{this.columnCache=new Map,this.refreshCells()}));this.syncFeeds(this.get().rows)}stop(){let e=this.stops;this.stops=[];for(let r of e)r();let t=this.feedStops;this.feedStops=[];for(let r of t)r()}sync(){let e=this.compute();if(rt(this.cell.get(),e))return;if(this.cell.set(e),this.cell.observed&&this.merged.some((t)=>t.reference))this.syncFeeds(e.rows)}fieldsFor(e){let t=this.r.binding?.fields,r=this.r.binding?.fieldsOnly??!1;if(e!==this.lastRows){if(this.lastRows=e,!r&&e.length>0&&(this.inferred.length===0||Ps(e,this.inferred))){let a=cn(e),f=new Set(this.inferred.map((d)=>d.key));this.inferred=[...this.inferred,...a.filter((d)=>!f.has(d.key))]}}let n=Mt(this.inferred,t,{only:r});if(!Xe(n,this.merged))this.merged=n,this.columnCache=new Map;return this.merged}converted=null;localRows(e,t){let r=this.converted;if(r&&r.raw===e&&r.fields===t)return r.rows;let n=t.filter((f)=>f.type==="datetime"&&!f.field.includes(".")).map((f)=>f.field),a=e;if(n.length){let f=!1,d=e.map((h)=>{if(!I(h))return h;let p=null;for(let g of n){let m=h[g];if(typeof m==="string"&&/^\d{4}-\d{2}-\d{2}[T ]/.test(m)){let b=new Date(m);if(!Number.isNaN(b.getTime()))(p??={...h})[g]=b}}if(p)f=!0;return p??h});if(f)a=d}return this.converted={raw:e,fields:t,rows:a},a}compute(){let{list:e,field:t,store:r,error:n,tree:a}=this.r;if(a){let m=a.get(),b=this.fieldsFor(m.rows);return{mode:"tree",rows:m.error?C:m.rows,total:m.rows.length,first:0,pageSize:m.rows.length,sort:C,search:"",status:m.status,loading:m.loading,error:m.error,fields:b,searchable:!1,edits:m.edits,editable:b.some((w)=>w.editable),tree:{dataKey:m.dataKey,parentKey:m.parentKey,labelField:m.labelField,loadingKeys:m.loadingKeys}}}if(!r)return{mode:"local",rows:C,total:0,first:0,pageSize:0,sort:C,search:"",status:"error",loading:!1,error:n,fields:this.fieldsFor(C),searchable:!1,edits:Oe,editable:!1};if(e){let m=e.get(),b=this.r.binding?.fields?D(this.r.binding.fields,"search").length>0:!1,w=this.fieldsFor(m.rows);return{mode:"server",rows:m.rows,total:m.total??m.rows.length,first:(m.page-1)*m.pageSize,pageSize:m.pageSize,sort:ce(m.order),search:m.search,status:m.status,loading:m.status==="loading",error:m.error,fields:w,searchable:b||(e.description.search?.length??0)>0,edits:m.edits,editable:w.some((N)=>N.editable),...m.current.active?{current:m.current.row}:{},...m.totals?{totals:m.totals}:{}}}let f=t.get(),d=Array.isArray(f)?f:C,h=this.fieldsFor(d),p=this.localRows(d,h),g=r.get();return{mode:"local",rows:p,total:p.length,first:0,pageSize:p.length,sort:C,search:"",status:g.status,loading:g.status==="loading",error:g.error,fields:h,searchable:!1,edits:Oe,editable:h.some((m)=>m.editable)&&t.writable}}}function Xe(e,t){return e===t||e.length===t.length&&JSON.stringify(e)===JSON.stringify(t)}function rt(e,t){return e.mode===t.mode&&e.rows===t.rows&&e.total===t.total&&e.first===t.first&&e.pageSize===t.pageSize&&e.search===t.search&&e.status===t.status&&e.error===t.error&&e.fields===t.fields&&e.searchable===t.searchable&&e.edits===t.edits&&e.editable===t.editable&&JSON.stringify(e.sort)===JSON.stringify(t.sort)&&e.tree?.loadingKeys===t.tree?.loadingKeys&&e.current===t.current&&e.totals===t.totals}function Te(e,t={}){return new Ke(e,t.registry)}var Ae=(e,t=[10,25,50,100])=>[...new Set([...t,e])].filter((r)=>r>0).sort((r,n)=>r-n);function st(e){if(e===Z)return"";return[e.dirty?"is-dirty":"",e.saving?"is-saving":"",e.error&&Object.keys(e.conflicts).length===0?"is-error":"",Object.keys(e.conflicts).length?"is-conflict":""].filter(Boolean).join(" ")}function Cs(e,t,r){let n=t.mode==="server",a=t.tree?.dataKey??D(t.fields,"key")[0]?.field??(t.fields.some((d)=>d.field==="id")?"id":void 0),f=t.tree?{parentKey:t.tree.parentKey,lazyChildren:!0,loadChildren:(d)=>e.loadChildren(d),hasChildren:(d)=>e.hasChildren(d)}:{};return{value:t.error?C:t.rows,lazy:n,totalRecords:t.total,loading:t.loading,...n?{first:t.first,rows:t.pageSize,sort:t.sort,rowsPerPageOptions:Ae(t.pageSize,r.rowsPerPageOptions)}:{},columns:e.columns(r.locale),cellFormatter:(d,h)=>e.format(d,h,r),paginator:n,showSearch:n&&t.searchable,...a?{dataKey:a}:{},errorKey:t.error?t.error.messageKey:null,...t.error?.params?{errorParams:t.error.params}:{},...t.editable?{editMode:"cell"}:{},rowClass:(d)=>{let h=st(e.rowEdit(d));return t.current!==void 0&&t.current!==null&&it(e,d,t.current)?h?`${h} is-current`:"is-current":h},...n?{rowClick:(d)=>void e.makeCurrent(d)}:{},...t.totals?{totalsRow:nt(e,t,r)}:{},rowMessage:(d)=>{let h=r.t,p=e.rowEdit(d);if(!h||p===Z)return null;if(Object.keys(p.conflicts).length>0)return{severity:"conflict",text:h("data.conflict_row"),actions:[{label:h("data.keep_mine"),run:()=>e.resolveRow(d,"mine")},{label:h("data.take_theirs"),run:()=>e.resolveRow(d,"theirs")}]};let g=p.error??Object.values(p.errors)[0]??null;if(!g)return null;return{severity:"error",text:h(g.messageKey,g.params),actions:[{label:h("data.dismiss"),run:()=>e.dismissRow(d)}]}},...f}}function it(e,t,r){if(t===r)return!0;let n=e.store;return n!==null&&n.type==="list"&&n.keyOf(t)===n.keyOf(r)}function nt(e,t,r){let n=t.totals??{},a={};for(let f of t.fields)for(let d of["sum","avg","min","max"]){let h=n[d];if(h&&f.field in h){a[f.field]=e.format(h[f.field],{field:f.field,key:f.key},r);break}}if(typeof n.count==="number")a.count=String(n.count);return a}function ot(e,t,r){let n=I(e)?e:{},a=(g)=>g?k(V(n,g.field),{fieldType:g.type,...g.format?{format:g.format}:{}},r):"",f=D(t,"label")[0]??t.find((g)=>g.type==="text"&&!g.hidden&&g.field!=="id"),d=D(t,"description")[0],h=D(t,"image")[0],p=h?V(n,h.field):null;return{label:a(f),description:a(d),image:typeof p==="string"&&p?p:null}}var V=(e,t)=>{let r=e;for(let n of t.split(".")){if(r===null||typeof r!=="object")return;r=r[n]}return r};function Ts(e,t,r){let n=t.mode==="server",a=D(t.fields,"key")[0]?.field??(t.fields.some((f)=>f.field==="id")?"id":void 0);return{value:t.error?C:t.rows,lazy:n,totalRecords:t.total,loading:t.loading&&t.rows.length===0,...n?{first:t.first,rows:t.pageSize,rowsPerPageOptions:Ae(t.pageSize,[6,12,24,48])}:{},paginator:n,...a?{dataKey:a}:{},errorKey:t.error?t.error.messageKey:null,...t.error?.params?{errorParams:t.error.params}:{},parts:(f)=>ot(f,t.fields,r)}}function Ze(e){let t=A(Et,null),r=l(null),n=l(null),a=null,f=!1,d=void 0,h=()=>{a?.(),a=null;let g=r.value;if(!g||!f)return;a=g.subscribe((m)=>n.value=m),n.value=g.get()},p=(g)=>{let m=g==null?null:De(g);if(r.value&&m===d)return;d=m,a?.(),a=null,r.value=g==null?null:Te(g,{registry:t}),n.value=r.value?r.value.get():null,h()};if(p(e()),c(e,(g)=>p(g)),pe())y(()=>{f=!0,h()}),u(()=>{f=!1,a?.(),a=null});return{binding:r,state:n}}var sr=Symbol("poad-bound-field-source");function ue(e,t=!0){let r=A(Et,null),n=t?A(sr,null):null,a=i(),f=l(null),d=l(null),h=null,p=!1,g=void 0,m=()=>e()??n?.()??null,b=()=>{h?.(),h=null;let O=f.value;if(!O||!p)return;h=O.subscribe((K)=>d.value=K),d.value=O.get()},w=(O)=>{let K=O==null?null:G(O);if(f.value&&K===g)return;g=K,h?.(),h=null,f.value=O==null?null:X(O,{registry:r}),d.value=f.value?f.value.get():null,b()};if(w(m()),c(m,(O)=>w(O)),pe())y(()=>{p=!0,b()}),u(()=>{p=!1,h?.(),h=null});let N=o(()=>{let O=f.value,K=d.value;if(!O||!K)return null;return Q(O,K,(Ee,Pe)=>a.t(Ee,Pe),{locale:a.locale})});return{binding:f,state:d,view:N,value:()=>(d.value,f.value?.controlValue()),input:(O)=>f.value?.setFromControl(O)}}function Qe(e,t,r=(n)=>n){return{get value(){return t.binding.value?r(t.value()):e.value},set value(n){if(t.binding.value)t.input(n);e.value=n}}}function et(e,t,r=()=>!1){let n=ue(e),a=i(),f=o(()=>{let d=n.binding.value,h=n.state.value;if(!d||!h)return null;return te(d,h,t,a.locale,{multiple:r()})});return{bound:n,choice:f,options:(d)=>f.value?.options??d,paths:(d,h=!0)=>f.value?.options?{...d,optionLabel:"label",...h?{optionValue:"value"}:{}}:d,model(d){return{get value(){return f.value?f.value.value:d.value},set value(h){if(f.value)f.value.set(h);d.value=h}}},invalid:(d)=>!!d||!!n.view.value?.invalid,filter:(d)=>f.value?.filter(d)}}
2
2
  export{Cs,Ts,Ze,sr,ue,Qe,et};
@@ -1 +1 @@
1
- import{n}from"./c-m6yf7zaj.js";import{wt,R,te}from"./c-0rxdxcn3.js";import{i}from"./c-azvw5879.js";import{t,l,r,y,a,e}from"./c-kyajr8zz.js";var T=(o,u=0,s=1)=>Math.min(s,Math.max(u,o)),O=(o)=>Math.round(T(o,0,255)).toString(16).padStart(2,"0");function S(o){if(!o)return null;let u=o.trim().toLowerCase(),s=/^#([0-9a-f]{3,4})$/.exec(u);if(s){let c=s[1].split("").map((p)=>parseInt(p+p,16));return{r:c[0],g:c[1],b:c[2],a:c.length===4?c[3]/255:1}}if(s=/^#([0-9a-f]{6})([0-9a-f]{2})?$/.exec(u),s){let c=parseInt(s[1],16);return{r:c>>16,g:c>>8&255,b:c&255,a:s[2]?parseInt(s[2],16)/255:1}}if(s=/^rgba?\(\s*([\d.]+)\s*[, ]\s*([\d.]+)\s*[, ]\s*([\d.]+)\s*(?:[,/]\s*([\d.]+%?))?\s*\)$/.exec(u),s){let c=s[4]==null?1:s[4].endsWith("%")?parseFloat(s[4])/100:parseFloat(s[4]);return{r:+s[1],g:+s[2],b:+s[3],a:T(c)}}if(s=/^hsla?\(\s*([\d.]+)\s*[, ]\s*([\d.]+)%?\s*[, ]\s*([\d.]+)%?\s*(?:[,/]\s*([\d.]+%?))?\s*\)$/.exec(u),s){let c=s[4]==null?1:s[4].endsWith("%")?parseFloat(s[4])/100:parseFloat(s[4]);return{...be(+s[1],+s[2]/100,+s[3]/100),a:T(c)}}return null}function be(o,u,s){o=(o%360+360)%360;let c=(1-Math.abs(2*s-1))*u,p=c*(1-Math.abs(o/60%2-1)),d=s-c/2,[m,g,w]=o<60?[c,p,0]:o<120?[p,c,0]:o<180?[0,c,p]:o<240?[0,p,c]:o<300?[p,0,c]:[c,0,p];return{r:Math.round((m+d)*255),g:Math.round((g+d)*255),b:Math.round((w+d)*255)}}function P({r:o,g:u,b:s,a:c}){let p=o/255,d=u/255,m=s/255,g=Math.max(p,d,m),w=Math.min(p,d,m),x=g-w,M=0;if(x)M=g===p?(d-m)/x%6:g===d?(m-p)/x+2:(p-d)/x+4,M=(M*60+360)%360;return{h:M,s:g?x/g:0,v:g,a:c}}function H({h:o,s:u,v:s,a:c}){let p=s*u,d=p*(1-Math.abs(o/60%2-1)),m=s-p,[g,w,x]=o<60?[p,d,0]:o<120?[d,p,0]:o<180?[0,p,d]:o<240?[0,d,p]:o<300?[d,0,p]:[p,0,d];return{r:Math.round((g+m)*255),g:Math.round((w+m)*255),b:Math.round((x+m)*255),a:c}}function me({r:o,g:u,b:s}){let{h:c,s:p,v:d}=P({r:o,g:u,b:s,a:1}),m=d*(1-p/2),g=m===0||m===1?0:(d-m)/Math.min(m,1-m);return{h:c,s:g,l:m}}function D(o,u,s){let c=s?T(o.a):1;if(u==="hex")return`#${O(o.r)}${O(o.g)}${O(o.b)}${s&&c<1?O(c*255):""}`;if(u==="rgb")return s&&c<1?`rgba(${Math.round(o.r)}, ${Math.round(o.g)}, ${Math.round(o.b)}, ${+c.toFixed(3)})`:`rgb(${Math.round(o.r)}, ${Math.round(o.g)}, ${Math.round(o.b)})`;let{h:p,s:d,l:m}=me(o);return s&&c<1?`hsla(${Math.round(p)}, ${Math.round(d*100)}%, ${Math.round(m*100)}%, ${+c.toFixed(3)})`:`hsl(${Math.round(p)}, ${Math.round(d*100)}%, ${Math.round(m*100)}%)`}var V=["#2f6feb","#58a6ff","#3fb950","#d29922","#f85149","#a371f7","#79c0ff","#e36209","#0ea5e9","#14b8a6","#84cc16","#ec4899","#1e293b","#475569","#94a3b8","#ffffff"];var W=[{side:"bottom",align:"start"},{side:"top",align:"start"},{side:"top",align:"end"},{side:"bottom",align:"end"}],he={h:217,s:0.8,v:0.92,a:1},q=(o,u)=>Math.round(o.r)===Math.round(u.r)&&Math.round(o.g)===Math.round(u.g)&&Math.round(o.b)===Math.round(u.b)&&Math.abs(o.a-u.a)<0.005;function X(o,u){let s=S(o);if(u&&(!s||q(H(u),s)))return u;return s?P(s):he}function G(o,u){let s=H(o);return{rgb:s,css:D(s,"rgb",u),opaqueCss:D({...s,a:1},"rgb",!1),hueCss:D(H({h:o.h,s:1,v:1,a:1}),"rgb",!1),hex:D(s,"hex",u),sv:{left:o.s*100,top:(1-o.v)*100},hue:o.h/360*100,alpha:o.a*100,hueNow:Math.round(o.h),alphaNow:Math.round(o.a*100),saturation:o.s,brightness:o.v}}function Y(o,u,s,c){let p=D(H(o),u,s);return p!==c?p:null}function j(o,u,s,c){let p=s?0.1:0.01;if(o==="sv"){switch(u){case"ArrowLeft":return{...c,s:Math.max(0,c.s-p)};case"ArrowRight":return{...c,s:Math.min(1,c.s+p)};case"ArrowUp":return{...c,v:Math.min(1,c.v+p)};case"ArrowDown":return{...c,v:Math.max(0,c.v-p)}}return null}if(o==="hue"){let d=s?10:1;if(u==="ArrowLeft"||u==="ArrowDown")return{...c,h:(c.h-d+360)%360};if(u==="ArrowRight"||u==="ArrowUp")return{...c,h:(c.h+d)%360};if(u==="Home")return{...c,h:0};if(u==="End")return{...c,h:359};return null}if(u==="ArrowLeft"||u==="ArrowDown")return{...c,a:Math.max(0,c.a-p)};if(u==="ArrowRight"||u==="ArrowUp")return{...c,a:Math.min(1,c.a+p)};return null}function J(o,u,s){let c=(p,d)=>d>0?Math.max(0,Math.min(1,p/d)):0;return{x:c(o-s.left,s.width),y:c(u-s.top,s.height)}}function Q(o,u,s,c){if(o==="sv")return{...c,s:u,v:1-s};if(o==="hue")return{...c,h:u*360};return{...c,a:u}}function z(o){let u=S(o.startsWith("#")?o:"#"+o);return u?P(u):null}function Z(o,u,s){let c=Math.max(0,Math.min(255,Number(s)));return Number.isNaN(c)?null:P({...o,[u]:c})}function ee(o,u){let s=Math.max(0,Math.min(100,Number(u)));return Number.isNaN(s)?null:{...o,a:s/100}}var re=(o)=>{let u=S(o);return u?P(u):null},oe=(o,u)=>{let s=S(o);return!!s&&q(s,u)},ne=(o,u)=>{let s=S(o);return s?P({...s,a:u.a}):null},ae=(o)=>!o.open&&!o.disabled,le=(o)=>wt(o,{outsidePointer:!0,escape:!0,scroll:"reposition"}),ie=(o)=>({"aria-expanded":o.open?"true":"false","aria-haspopup":"dialog","aria-invalid":o.invalid?"true":null}),se=(o)=>({"is-open":o.open,"is-disabled":!!o.disabled,"is-invalid":!!o.invalid,"is-inline":!!o.inline,"size-sm":o.size==="sm","size-lg":o.size==="lg"});var Ee=r({name:"PoadColorpicker",props:{modelValue:{type:String,default:void 0},format:{type:String,default:"hex"},alpha:Boolean,inline:Boolean,presets:{type:Array,default:()=>V},placeholder:String,clearable:Boolean,invalid:Boolean,disabled:Boolean,size:{type:String,default:"md"},ariaLabel:String},emits:{"update:modelValue":(o)=>!0,openChange:(o)=>!0},setup(o,{emit:u}){let s=i(),c=a(o,"modelValue"),p=l(null),d=t(!1),m=t(!1),g=t(null),w=t(null),x={sv:t(null),hue:t(null),alpha:t(null)};y(()=>{m.value="EyeDropper"in window});let M=()=>X(c.value??null,p.value),I=(f)=>{if(f===d.value)return;if(f&&!ae({open:d.value,disabled:o.disabled}))return;if(d.value=f,u("openChange",f),!f)g.value?.focus()},C=(f)=>{if(!f)return;p.value=f;let v=Y(f,o.format,o.alpha,c.value??null);if(v!==null)c.value=v},ce=(f,v)=>{let k=x[v].value;if(o.disabled||!k)return;f.preventDefault();let h=k.getBoundingClientRect(),F=M(),E=(A)=>{let L=J(A.clientX,A.clientY,h);F=Q(v,L.x,L.y,F),C(F)};E(f);let _=()=>{window.removeEventListener("pointermove",E),window.removeEventListener("pointerup",_)};window.addEventListener("pointermove",E),window.addEventListener("pointerup",_),k.focus()},ue=(f,v)=>{let k=j(v,f.key,f.shiftKey,M());if(k)f.preventDefault(),C(k)},U=(f)=>{if(d.value&&le({type:"keydown",key:f.key}).action==="close")I(!1)},pe=async()=>{try{let f=window.EyeDropper;if(!f)return;let v=await new f().open();C(ne(v.sRGBHex,M()))}catch{}},K=()=>d.value&&!o.inline,{style:de}=R({open:K,anchor:g,floating:w,candidates:()=>W,offset:0,shift:!0});return te(K,[g,w],()=>I(!1)),()=>{let{t:f,text:v}=s,k=M(),h=G(k,o.alpha),F=(b)=>new Intl.NumberFormat(s.locale,{style:"percent",maximumFractionDigits:0}).format(b),E=(b,N,fe)=>e("div",{ref:x[b],tabindex:0,role:"slider",...N,onPointerdown:(B)=>ce(B,b),onKeydown:(B)=>ue(B,b)},fe),_=[E("sv",{class:"cp-sv",style:{backgroundColor:h.hueCss},"aria-label":f("field.saturationBrightness"),"aria-valuetext":f("field.saturationBrightnessValue",{saturation:F(h.saturation),brightness:F(h.brightness)})},[e("span",{class:"cp-sv__thumb",style:{left:`${h.sv.left}%`,top:`${h.sv.top}%`,background:h.opaqueCss}})]),e("div",{class:"cp-bars"},[e("button",{type:"button",class:"cp-eye",style:{visibility:m.value?"visible":"hidden"},title:f("field.eyedropper"),"aria-label":f("field.eyedropper"),onClick:pe},[e(n,{name:"crosshair",size:14})]),e("div",{class:"cp-sliders"},[E("hue",{class:"cp-bar cp-bar--hue","aria-label":f("field.hue"),"aria-valuemin":0,"aria-valuemax":360,"aria-valuenow":h.hueNow},[e("span",{class:"cp-bar__thumb",style:{left:`${h.hue}%`,background:h.hueCss}})]),o.alpha&&E("alpha",{class:"cp-bar cp-bar--alpha","aria-label":f("field.opacity"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":h.alphaNow},[e("i",{class:"cp-bar__grad",style:{background:`linear-gradient(to right, transparent, ${h.opaqueCss})`}}),e("span",{class:"cp-bar__thumb",style:{left:`${h.alpha}%`,background:h.css}})])])]),e("div",{class:"cp-fields"},[e("label",[e("span","HEX"),e("input",{key:h.hex,type:"text",value:h.hex,spellcheck:!1,onBlur:(b)=>C(z(b.target.value)),onKeydown:(b)=>{if(b.key==="Enter")C(z(b.target.value))}})]),...["r","g","b"].map((b)=>e("label",{key:b},[e("span",b.toUpperCase()),e("input",{type:"number",min:0,max:255,value:h.rgb[b],onInput:(N)=>C(Z(h.rgb,b,N.target.value))})])),o.alpha&&e("label",[e("span","A"),e("input",{type:"number",min:0,max:100,value:h.alphaNow,onInput:(b)=>C(ee(k,b.target.value))})])]),o.presets.length>0&&e("div",{class:"cp-presets",role:"listbox","aria-label":f("field.presets")},o.presets.map((b)=>{let N=oe(b,h.rgb);return e("button",{key:b,type:"button",role:"option","aria-selected":N,class:N?"is-on":void 0,style:{background:b},title:b,onClick:()=>C(re(b))})}))],A=ie({open:d.value,invalid:o.invalid}),L=c.value??null;return e("div",{class:["poad-colorpicker",se({open:d.value,disabled:o.disabled,invalid:o.invalid,inline:o.inline,size:o.size})]},o.inline?[e("div",{class:"poad-colorpicker-panel cp-panel is-inline"},_)]:[e("button",{ref:g,type:"button",class:"cp-trigger",disabled:o.disabled,"aria-expanded":A["aria-expanded"],"aria-haspopup":A["aria-haspopup"],"aria-label":o.ariaLabel||f("field.color"),"aria-invalid":A["aria-invalid"]??void 0,onClick:()=>I(!d.value),onKeydown:U},[e("span",{class:"cp-swatch",style:{background:h.css}},[e("i")]),e("span",{class:["cp-val",{"is-ph":!L}]},L||v(o.placeholder,"field.colorPlaceholder")),o.clearable&&L&&!o.disabled&&e("span",{class:"cp-clear",role:"button","aria-label":f("common.clear"),onClick:(b)=>{b.stopPropagation(),p.value=null,c.value=null}},[e(n,{name:"x",size:12})]),e(n,{name:"chevron-down",size:13,class:"cp-chev"})]),K()&&e("div",{ref:w,class:"poad-floating",style:de()},[e("div",{class:"poad-colorpicker-panel cp-panel",role:"dialog","aria-label":f("field.colorPicker"),onKeydown:U},_)])])}}});export{Ee as PoadColorpicker};
1
+ import{n}from"./c-rv7cxh2k.js";import{wt,R,te}from"./c-k3yb5e72.js";import{i}from"./c-xw7vce7r.js";import{t,l,r,y,a,e}from"./c-qzar8xvm.js";var T=(o,u=0,s=1)=>Math.min(s,Math.max(u,o)),O=(o)=>Math.round(T(o,0,255)).toString(16).padStart(2,"0");function S(o){if(!o)return null;let u=o.trim().toLowerCase(),s=/^#([0-9a-f]{3,4})$/.exec(u);if(s){let c=s[1].split("").map((p)=>parseInt(p+p,16));return{r:c[0],g:c[1],b:c[2],a:c.length===4?c[3]/255:1}}if(s=/^#([0-9a-f]{6})([0-9a-f]{2})?$/.exec(u),s){let c=parseInt(s[1],16);return{r:c>>16,g:c>>8&255,b:c&255,a:s[2]?parseInt(s[2],16)/255:1}}if(s=/^rgba?\(\s*([\d.]+)\s*[, ]\s*([\d.]+)\s*[, ]\s*([\d.]+)\s*(?:[,/]\s*([\d.]+%?))?\s*\)$/.exec(u),s){let c=s[4]==null?1:s[4].endsWith("%")?parseFloat(s[4])/100:parseFloat(s[4]);return{r:+s[1],g:+s[2],b:+s[3],a:T(c)}}if(s=/^hsla?\(\s*([\d.]+)\s*[, ]\s*([\d.]+)%?\s*[, ]\s*([\d.]+)%?\s*(?:[,/]\s*([\d.]+%?))?\s*\)$/.exec(u),s){let c=s[4]==null?1:s[4].endsWith("%")?parseFloat(s[4])/100:parseFloat(s[4]);return{...be(+s[1],+s[2]/100,+s[3]/100),a:T(c)}}return null}function be(o,u,s){o=(o%360+360)%360;let c=(1-Math.abs(2*s-1))*u,p=c*(1-Math.abs(o/60%2-1)),d=s-c/2,[m,g,w]=o<60?[c,p,0]:o<120?[p,c,0]:o<180?[0,c,p]:o<240?[0,p,c]:o<300?[p,0,c]:[c,0,p];return{r:Math.round((m+d)*255),g:Math.round((g+d)*255),b:Math.round((w+d)*255)}}function P({r:o,g:u,b:s,a:c}){let p=o/255,d=u/255,m=s/255,g=Math.max(p,d,m),w=Math.min(p,d,m),x=g-w,M=0;if(x)M=g===p?(d-m)/x%6:g===d?(m-p)/x+2:(p-d)/x+4,M=(M*60+360)%360;return{h:M,s:g?x/g:0,v:g,a:c}}function H({h:o,s:u,v:s,a:c}){let p=s*u,d=p*(1-Math.abs(o/60%2-1)),m=s-p,[g,w,x]=o<60?[p,d,0]:o<120?[d,p,0]:o<180?[0,p,d]:o<240?[0,d,p]:o<300?[d,0,p]:[p,0,d];return{r:Math.round((g+m)*255),g:Math.round((w+m)*255),b:Math.round((x+m)*255),a:c}}function me({r:o,g:u,b:s}){let{h:c,s:p,v:d}=P({r:o,g:u,b:s,a:1}),m=d*(1-p/2),g=m===0||m===1?0:(d-m)/Math.min(m,1-m);return{h:c,s:g,l:m}}function D(o,u,s){let c=s?T(o.a):1;if(u==="hex")return`#${O(o.r)}${O(o.g)}${O(o.b)}${s&&c<1?O(c*255):""}`;if(u==="rgb")return s&&c<1?`rgba(${Math.round(o.r)}, ${Math.round(o.g)}, ${Math.round(o.b)}, ${+c.toFixed(3)})`:`rgb(${Math.round(o.r)}, ${Math.round(o.g)}, ${Math.round(o.b)})`;let{h:p,s:d,l:m}=me(o);return s&&c<1?`hsla(${Math.round(p)}, ${Math.round(d*100)}%, ${Math.round(m*100)}%, ${+c.toFixed(3)})`:`hsl(${Math.round(p)}, ${Math.round(d*100)}%, ${Math.round(m*100)}%)`}var V=["#2f6feb","#58a6ff","#3fb950","#d29922","#f85149","#a371f7","#79c0ff","#e36209","#0ea5e9","#14b8a6","#84cc16","#ec4899","#1e293b","#475569","#94a3b8","#ffffff"];var W=[{side:"bottom",align:"start"},{side:"top",align:"start"},{side:"top",align:"end"},{side:"bottom",align:"end"}],he={h:217,s:0.8,v:0.92,a:1},q=(o,u)=>Math.round(o.r)===Math.round(u.r)&&Math.round(o.g)===Math.round(u.g)&&Math.round(o.b)===Math.round(u.b)&&Math.abs(o.a-u.a)<0.005;function X(o,u){let s=S(o);if(u&&(!s||q(H(u),s)))return u;return s?P(s):he}function G(o,u){let s=H(o);return{rgb:s,css:D(s,"rgb",u),opaqueCss:D({...s,a:1},"rgb",!1),hueCss:D(H({h:o.h,s:1,v:1,a:1}),"rgb",!1),hex:D(s,"hex",u),sv:{left:o.s*100,top:(1-o.v)*100},hue:o.h/360*100,alpha:o.a*100,hueNow:Math.round(o.h),alphaNow:Math.round(o.a*100),saturation:o.s,brightness:o.v}}function Y(o,u,s,c){let p=D(H(o),u,s);return p!==c?p:null}function j(o,u,s,c){let p=s?0.1:0.01;if(o==="sv"){switch(u){case"ArrowLeft":return{...c,s:Math.max(0,c.s-p)};case"ArrowRight":return{...c,s:Math.min(1,c.s+p)};case"ArrowUp":return{...c,v:Math.min(1,c.v+p)};case"ArrowDown":return{...c,v:Math.max(0,c.v-p)}}return null}if(o==="hue"){let d=s?10:1;if(u==="ArrowLeft"||u==="ArrowDown")return{...c,h:(c.h-d+360)%360};if(u==="ArrowRight"||u==="ArrowUp")return{...c,h:(c.h+d)%360};if(u==="Home")return{...c,h:0};if(u==="End")return{...c,h:359};return null}if(u==="ArrowLeft"||u==="ArrowDown")return{...c,a:Math.max(0,c.a-p)};if(u==="ArrowRight"||u==="ArrowUp")return{...c,a:Math.min(1,c.a+p)};return null}function J(o,u,s){let c=(p,d)=>d>0?Math.max(0,Math.min(1,p/d)):0;return{x:c(o-s.left,s.width),y:c(u-s.top,s.height)}}function Q(o,u,s,c){if(o==="sv")return{...c,s:u,v:1-s};if(o==="hue")return{...c,h:u*360};return{...c,a:u}}function z(o){let u=S(o.startsWith("#")?o:"#"+o);return u?P(u):null}function Z(o,u,s){let c=Math.max(0,Math.min(255,Number(s)));return Number.isNaN(c)?null:P({...o,[u]:c})}function ee(o,u){let s=Math.max(0,Math.min(100,Number(u)));return Number.isNaN(s)?null:{...o,a:s/100}}var re=(o)=>{let u=S(o);return u?P(u):null},oe=(o,u)=>{let s=S(o);return!!s&&q(s,u)},ne=(o,u)=>{let s=S(o);return s?P({...s,a:u.a}):null},ae=(o)=>!o.open&&!o.disabled,le=(o)=>wt(o,{outsidePointer:!0,escape:!0,scroll:"reposition"}),ie=(o)=>({"aria-expanded":o.open?"true":"false","aria-haspopup":"dialog","aria-invalid":o.invalid?"true":null}),se=(o)=>({"is-open":o.open,"is-disabled":!!o.disabled,"is-invalid":!!o.invalid,"is-inline":!!o.inline,"size-sm":o.size==="sm","size-lg":o.size==="lg"});var Ee=r({name:"PoadColorpicker",props:{modelValue:{type:String,default:void 0},format:{type:String,default:"hex"},alpha:Boolean,inline:Boolean,presets:{type:Array,default:()=>V},placeholder:String,clearable:Boolean,invalid:Boolean,disabled:Boolean,size:{type:String,default:"md"},ariaLabel:String},emits:{"update:modelValue":(o)=>!0,openChange:(o)=>!0},setup(o,{emit:u}){let s=i(),c=a(o,"modelValue"),p=l(null),d=t(!1),m=t(!1),g=t(null),w=t(null),x={sv:t(null),hue:t(null),alpha:t(null)};y(()=>{m.value="EyeDropper"in window});let M=()=>X(c.value??null,p.value),I=(f)=>{if(f===d.value)return;if(f&&!ae({open:d.value,disabled:o.disabled}))return;if(d.value=f,u("openChange",f),!f)g.value?.focus()},C=(f)=>{if(!f)return;p.value=f;let v=Y(f,o.format,o.alpha,c.value??null);if(v!==null)c.value=v},ce=(f,v)=>{let k=x[v].value;if(o.disabled||!k)return;f.preventDefault();let h=k.getBoundingClientRect(),F=M(),E=(A)=>{let L=J(A.clientX,A.clientY,h);F=Q(v,L.x,L.y,F),C(F)};E(f);let _=()=>{window.removeEventListener("pointermove",E),window.removeEventListener("pointerup",_)};window.addEventListener("pointermove",E),window.addEventListener("pointerup",_),k.focus()},ue=(f,v)=>{let k=j(v,f.key,f.shiftKey,M());if(k)f.preventDefault(),C(k)},U=(f)=>{if(d.value&&le({type:"keydown",key:f.key}).action==="close")I(!1)},pe=async()=>{try{let f=window.EyeDropper;if(!f)return;let v=await new f().open();C(ne(v.sRGBHex,M()))}catch{}},K=()=>d.value&&!o.inline,{style:de}=R({open:K,anchor:g,floating:w,candidates:()=>W,offset:0,shift:!0});return te(K,[g,w],()=>I(!1)),()=>{let{t:f,text:v}=s,k=M(),h=G(k,o.alpha),F=(b)=>new Intl.NumberFormat(s.locale,{style:"percent",maximumFractionDigits:0}).format(b),E=(b,N,fe)=>e("div",{ref:x[b],tabindex:0,role:"slider",...N,onPointerdown:(B)=>ce(B,b),onKeydown:(B)=>ue(B,b)},fe),_=[E("sv",{class:"cp-sv",style:{backgroundColor:h.hueCss},"aria-label":f("field.saturationBrightness"),"aria-valuetext":f("field.saturationBrightnessValue",{saturation:F(h.saturation),brightness:F(h.brightness)})},[e("span",{class:"cp-sv__thumb",style:{left:`${h.sv.left}%`,top:`${h.sv.top}%`,background:h.opaqueCss}})]),e("div",{class:"cp-bars"},[e("button",{type:"button",class:"cp-eye",style:{visibility:m.value?"visible":"hidden"},title:f("field.eyedropper"),"aria-label":f("field.eyedropper"),onClick:pe},[e(n,{name:"crosshair",size:14})]),e("div",{class:"cp-sliders"},[E("hue",{class:"cp-bar cp-bar--hue","aria-label":f("field.hue"),"aria-valuemin":0,"aria-valuemax":360,"aria-valuenow":h.hueNow},[e("span",{class:"cp-bar__thumb",style:{left:`${h.hue}%`,background:h.hueCss}})]),o.alpha&&E("alpha",{class:"cp-bar cp-bar--alpha","aria-label":f("field.opacity"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":h.alphaNow},[e("i",{class:"cp-bar__grad",style:{background:`linear-gradient(to right, transparent, ${h.opaqueCss})`}}),e("span",{class:"cp-bar__thumb",style:{left:`${h.alpha}%`,background:h.css}})])])]),e("div",{class:"cp-fields"},[e("label",[e("span","HEX"),e("input",{key:h.hex,type:"text",value:h.hex,spellcheck:!1,onBlur:(b)=>C(z(b.target.value)),onKeydown:(b)=>{if(b.key==="Enter")C(z(b.target.value))}})]),...["r","g","b"].map((b)=>e("label",{key:b},[e("span",b.toUpperCase()),e("input",{type:"number",min:0,max:255,value:h.rgb[b],onInput:(N)=>C(Z(h.rgb,b,N.target.value))})])),o.alpha&&e("label",[e("span","A"),e("input",{type:"number",min:0,max:100,value:h.alphaNow,onInput:(b)=>C(ee(k,b.target.value))})])]),o.presets.length>0&&e("div",{class:"cp-presets",role:"listbox","aria-label":f("field.presets")},o.presets.map((b)=>{let N=oe(b,h.rgb);return e("button",{key:b,type:"button",role:"option","aria-selected":N,class:N?"is-on":void 0,style:{background:b},title:b,onClick:()=>C(re(b))})}))],A=ie({open:d.value,invalid:o.invalid}),L=c.value??null;return e("div",{class:["poad-colorpicker",se({open:d.value,disabled:o.disabled,invalid:o.invalid,inline:o.inline,size:o.size})]},o.inline?[e("div",{class:"poad-colorpicker-panel cp-panel is-inline"},_)]:[e("button",{ref:g,type:"button",class:"cp-trigger",disabled:o.disabled,"aria-expanded":A["aria-expanded"],"aria-haspopup":A["aria-haspopup"],"aria-label":o.ariaLabel||f("field.color"),"aria-invalid":A["aria-invalid"]??void 0,onClick:()=>I(!d.value),onKeydown:U},[e("span",{class:"cp-swatch",style:{background:h.css}},[e("i")]),e("span",{class:["cp-val",{"is-ph":!L}]},L||v(o.placeholder,"field.colorPlaceholder")),o.clearable&&L&&!o.disabled&&e("span",{class:"cp-clear",role:"button","aria-label":f("common.clear"),onClick:(b)=>{b.stopPropagation(),p.value=null,c.value=null}},[e(n,{name:"x",size:12})]),e(n,{name:"chevron-down",size:13,class:"cp-chev"})]),K()&&e("div",{ref:w,class:"poad-floating",style:de()},[e("div",{class:"poad-colorpicker-panel cp-panel",role:"dialog","aria-label":f("field.colorPicker"),onKeydown:U},_)])])}}});export{Ee as PoadColorpicker};
@@ -1 +1 @@
1
- import"./c-m6yf7zaj.js";import"./c-9sm6aybf.js";import"./c-rasvf2z2.js";import"./c-epemgj1a.js";import"./c-hdstjg33.js";import"./c-3pe5hprv.js";import"./c-3jm96b1p.js";import{Fn}from"./c-hsy77frc.js";import{Nt,Ve}from"./c-cvsx6n6e.js";import{Se,He,gn}from"./c-cc3m3rs1.js";import{ae,le}from"./c-0zqjsnm5.js";import{H}from"./c-zyfkspym.js";import{Pe,ge,K,ee}from"./c-72hj12cs.js";import"./c-m70tbfc5.js";import{x,T}from"./c-523qwqen.js";import"./c-0rxdxcn3.js";import{v}from"./c-p8wyhrwm.js";import{i}from"./c-azvw5879.js";import{h,t,l,m,c,r,f,y,u,o,e}from"./c-kyajr8zz.js";function It(n,a,s){let p=new Map(n.map((w)=>[w.id,w])),g=[],_=(w,P)=>{for(let I of w){let A=p.get(I);if(!A)continue;if(!A.scheduled&&!A.milestone)continue;if(g.push({task:A,level:P}),A.children.length&&s.has(A.id))_(A.children,P+1)}};return _(a,0),g}function Rt(n,a,s,p=12,g=17){let _=n.charAt(0)==="F",w=n.charAt(1)==="S",P=_?a.x2:a.x1,I=_?1:-1,A=w?s.x1:s.x2,E=w?-1:1,B=P+I*p,j=A+E*p,R=w?B<=j:B>=j,b=`M${P} ${a.y} H${B}`;if(R)b+=` V${s.y} H${A}`;else{let L=a.y<s.y?s.y-g:s.y+g;b+=` V${L} H${j} V${s.y} H${A}`}return{d:b,fleche:{x:A,y:s.y,sens:w?"right":"left"}}}function Bt(n,a=4.5){let s=n.sens==="right"?n.x-a*1.6:n.x+a*1.6;return`${n.x},${n.y} ${s},${n.y-a} ${s},${n.y+a}`}var zt=(n,a)=>a||(n==="day"?36:n==="week"?90:120),Kt={src:void 0,map:new Map};function ot(n,a,s,p){let g=new Map(n.src===a?n.map:[]);return g.set(s,p),{src:a,map:g}}function jt(n,a){if(!n||a.src!==n||!a.map.size)return n??null;return{...n,tasks:(n.tasks??[]).map((s)=>{let p=a.map.get(s.id);return p?{...s,start:p.start,end:p.end,duration:null}:s})}}var we=(n)=>n.tasks.filter((a)=>a.children.length).map((a)=>a.id),Et=(n,a)=>n?[...n]:we(a),Ht=(n,a)=>It(n.tasks,n.roots,new Set(a)),bt=(n)=>n.tasks.filter((a)=>!a.scheduled&&!a.children.length);function Ot(n,a){let s=null,p=null,g=(_)=>{if(!_)return;s=s===null?_.getTime():Math.min(s,_.getTime()),p=p===null?_.getTime():Math.max(p,_.getTime())};for(let _ of n.tasks)if(_.scheduled)g(_.start),g(_.end);if(s===null||p===null)return null;for(let _ of a??[])g(T(_.date));return{min:new Date(s),max:new Date(p)}}function Gt(n,a,s){if(!n)return{upper:[],lower:[]};let p=a==="day"?3:a==="week"?10:40;return Nt(x(n.min,-p),x(n.max,p),a,{locale:s.locale,i18n:s.i18n,firstDay:s.firstDay,calendar:s.calendar??null,today:s.today??new Date})}function Lt(n,a){return{lower:n.lower.map((s)=>({label:s.label,off:s.off,today:s.today})),upper:n.upper.map((s)=>{let p=Math.max(0,a.xOf(s.start)),g=Math.min(a.width,a.xOf(s.end));return{label:s.label,w:Math.max(0,g-p)}}).filter((s)=>s.w>0)}}var Ft=(n,a)=>n.lower.map((s,p)=>({off:s.off,x:p*a,w:a})).filter((s)=>s.off).map(({x:s,w:p})=>({x:s,w:p})),Ut=(n,a)=>n.lower.map((s,p)=>({major:s.major,x:p*a})).filter((s)=>a>=20||s.major).map((s)=>s.x);function Wt(n,a){let{start:s,end:p}=a;if(!s||!p)return[];let g=[];for(let _ of n??[]){let w=T(_.date);if(!w||w<s||w>=p)continue;g.push({x:a.xOf(w),label:_.label??""})}return g}function qt(n,a){if(!a.start||!a.end||n<a.start||n>=a.end)return null;return a.xOf(n)}var lt=34;function Vt(n,a){if(a&&a.tops.length===n&&n>0)return{tops:a.tops,heights:a.heights,total:a.tops[n-1]+a.heights[n-1]};return{tops:Array.from({length:n},(s,p)=>p*lt),heights:Array(n).fill(lt),total:n*lt}}function Yt(n){let a=Array.from(n);if(!a.length)return null;let s=a[0].getBoundingClientRect().top,p=[],g=[];for(let _ of a){let w=_.getBoundingClientRect();if(w.height<=0)return null;p.push(Math.round(w.top-s)),g.push(Math.round(w.height))}return{tops:p,heights:g}}var rt=(n)=>{try{return Intl.getCanonicalLocales(n)[0]??"en"}catch{return"en"}},q=(n,a)=>a?new Intl.DateTimeFormat(rt(n),{day:"2-digit",month:"2-digit"}).format(a):"",Jt=(n,a,s)=>s("planning.days",{days:new Intl.NumberFormat(rt(a),{maximumFractionDigits:1}).format(n)});function _e(n,a){if(n.milestone)return a.t("planning.milestone");if(!n.start||!n.end)return"";let s=a.calendar.minutesBetween(n.start,n.end)/a.calendar.dailyMinutes;return Jt(Math.round(s*10)/10,a.locale,a.t)}function it(n,a){if(n.milestone)return`${n.label} — ${q(a.locale,n.start)} (${a.t("planning.milestone")})`;let s=` · ${new Intl.NumberFormat(rt(a.locale),{style:"percent",maximumFractionDigits:0}).format(n.progress)}`,p=n.rolled?" "+a.t("planning.summary"):"";return`${n.label} — ${q(a.locale,n.start)} → ${q(a.locale,n.end)}${s}${p}`}function Qt(n,a){let s=n.lagMinutes?` · ${a.t("planning.lag",{days:Jt(Math.round(n.lagMinutes/a.calendar.dailyMinutes*10)/10,a.locale,a.t)})}`:"";return`${n.from} → ${n.to} · ${n.type}${s}`}function Xt(n,a){return n.tasks.filter((s)=>s.scheduled||s.milestone||s.children.length).map((s)=>({id:s.id,parent:s.parent,label:s.label,start:q(a.locale,s.start),end:s.milestone?"—":q(a.locale,s.end),duration:_e(s,a),pct:String(Math.round(s.progress*100))}))}function Zt(n,a,s){let p=new Map,g=[];return n.forEach((_,w)=>{let P=_.task;if(!P.start||!P.end)return;let I=s.tops[w]+s.heights[w]/2,A=s.heights[w]/2;if(P.milestone){let R=a.xOf(P.start);g.push({task:P,kind:"milestone",x:R-8,w:16,y:I}),p.set(P.id,{x1:R-8,x2:R+8,y:I,half:A});return}let E=a.spanOf(P.start,P.end),B=E.x,j=Math.max(4,E.width-2);g.push({task:P,kind:P.rolled?"summary":"bar",x:B,w:j,y:I}),p.set(P.id,{x1:B,x2:B+j,y:I,half:A})}),{bars:g,anchors:p}}function te(n,a,s){let p=[];for(let g of n){let _=a.get(g.from),w=a.get(g.to);if(!_||!w)continue;let P=Rt(g.type,_,w,12,w.half);p.push({id:g.id,d:P.d,arrow:Bt(P.fleche),title:s(g),from:g.from,to:g.to})}return p}function ne(n,a){if(!a)return{links:new Set,tasks:new Set};let s=new Set,p=new Set([a]);for(let g of n){if(g.from===a)s.add(g.id),p.add(g.to);if(g.to===a)s.add(g.id),p.add(g.from)}return{links:s,tasks:p}}var dt=(n,a)=>a&&!n.locked&&!n.rolled&&!!n.start&&!!n.end;function se(n,a,s){return`${n.kind==="milestone"?"gt__jal":n.kind==="summary"?"gt__sum":"gt__b"}${s?" is-hot":""}${dt(n.task,a)?" is-editable":a&&n.kind!=="summary"?" is-verrouille":""}`}var oe=(n)=>`poad-gantt is-${n.scale}${n.editable?" is-editable":""}${n.dragging?" is-dragging":""}${n.compact?" is-compact":""}`,$e=86400000;function re(n,a,s,p,g=!1){let _=n==="resize-end"?a.end:a.start,w=p.dateAt(p.xOf(_)+s),P=w?Math.round((w.getTime()-_.getTime())/$e):0;return ie(g?"move":n,a,P)}function ie(n,a,s){if(n==="resize-end"){let p=x(a.end,s);while(p.getTime()<=a.start.getTime())p=x(p,1);return{start:a.start,end:p}}if(n==="resize-start"){let p=x(a.start,s);while(p.getTime()>=a.end.getTime())p=x(p,-1);return{start:p,end:a.end}}return{start:x(a.start,s),end:x(a.end,s)}}function de(n,a){if(n!=="ArrowLeft"&&n!=="ArrowRight"||!a.ctrl&&!a.shift||!a.task.start||!a.task.end)return null;let s=a.shift&&!a.ctrl?"resize-end":"move";if(s==="resize-end"&&a.task.milestone)return null;let p={start:a.task.start,end:a.task.end},g=ie(s,p,n===(a.rtl?"ArrowLeft":"ArrowRight")?1:-1);if(g.start.getTime()===p.start.getTime()&&g.end.getTime()===p.end.getTime())return null;return{kind:s==="move"?"move":"resize",start:g.start,end:g.end}}var ce=(n,a,s,p)=>n==="move"?{key:"planning.announceMoved",params:{label:a.label,date:Se(p,s.start,!0)}}:{key:"planning.announceResized",params:{label:a.label,date:Se(p,s.end,!0)}};function ue(n,a){if(!n)return null;return Array.from(n.querySelectorAll(".gt__corps [data-task]")).find((p)=>p.getAttribute("data-task")===a)??null}function pe(n){let a={start:n.task.start,end:n.task.end};return gn({event:n.event,doc:n.doc,base:a,project:(s)=>re(n.kind,a,n.rtl?-s:s,n.axis,n.task.milestone),onPreview:n.onPreview,onCommit:n.onCommit,onCancel:n.onCancel})}var Le=r({name:"PoadGantt",inheritAttrs:!1,props:{data:{type:Object,default:null},store:{type:[Object,String],default:null},fields:{type:Array,default:null},plan:{type:Object,default:null},scale:{type:String,default:"week"},expandedKeys:{type:Array,default:null},selectedKey:{type:String,default:null},tickWidth:{type:Number,default:null},workCalendar:{type:Object,default:null},today:{type:Date,default:null},locale:String,firstDay:{type:Number,default:1},emptyText:String,showNow:{type:Boolean,default:!0},showUnplanned:{type:Boolean,default:!0},taskColumnWidth:{type:String,default:"210px"},editable:Boolean},emits:{taskClick:(n)=>!0,taskMove:(n)=>!0,taskResize:(n)=>!0,"update:expandedKeys":(n)=>!0,"update:selectedKey":(n)=>!0},setup(n,{emit:a,attrs:s}){let p=i(),g=K(n),_=o(()=>g.state.value?ge(g.state.value,{locale:p.locale}):null),w=(k,M)=>{a(k,M);let S=g.binding.value;if(S&&(k==="taskMove"||k==="taskResize")){let D=M;Pe(S,D.task.id,D.start,D.end)}},P=()=>_.value&&!g.given("editable")?_.value.editable:n.editable,I=(k,M)=>p.t(k,M),A=`poad-gantt-${f()}-hint`,E=H(),B=l(null),j=t(null),R=l(Kt),b=t(!1),L=t(null),ct=t(""),F=l(null),ut=t(44),N=t(null),pt=He(),V=null,U=null,G=()=>_.value?_.value.plan:n.plan?h(n.plan):null,X=()=>n.locale??p.locale,Z=o(()=>ae(p.locale,p.messages)),fe=o(()=>le(G(),{i18n:Z.value})),O=o(()=>le(jt(G(),R.value),{i18n:Z.value})),gt=o(()=>n.workCalendar??O.value.calendar),ft=o(()=>zt(n.scale,n.tickWidth)),mt=o(()=>Et(n.expandedKeys??B.value,O.value)),ht=()=>n.selectedKey??j.value,yt=o(()=>Ht(O.value,mt.value)),Y=o(()=>Gt(Ot(fe.value,G()?.markers),n.scale,{locale:X(),i18n:Z.value,firstDay:n.firstDay,calendar:gt.value,today:n.today??new Date})),vt=o(()=>new Ve(Y.value.lower,ft.value)),xt=()=>{let k=N.value;if(!k)return;let M=k.querySelector(".gt__gauche thead")?.getBoundingClientRect().height??0;if(M>0)ut.value=Math.round(M);let S=Yt(k.querySelectorAll(".gt__gauche tbody tr"));if(S&&!(F.value&&F.value.tops.join()===S.tops.join()&&F.value.heights.join()===S.heights.join()))F.value=S},kt=()=>{U?.disconnect(),U=null,xt();let k=N.value?.querySelector(".gt__gauche");if(k&&typeof ResizeObserver<"u")U=new ResizeObserver(xt),U.observe(k)};y(kt),c(()=>[yt.value.length,E.isMobile.value],()=>void m(kt)),u(()=>{V?.(),U?.disconnect()});let J=(k)=>dt(k,P()),wt=(k)=>{j.value=k,w("update:selectedKey",k)},_t=()=>{V=null,b.value=!1,pt.mark()},$t=(k,M,S,D=R.value)=>{if(R.value=ot(D,G(),M.id,S),k==="move")w("taskMove",{task:M,start:S.start,end:S.end});else w("taskResize",{task:M,start:S.start,end:S.end});let z=ce(k,M,S,X());ct.value=p.t(z.key,z.params)},tt=(k,M,S)=>{if(!J(M.task)||S.button!==0||!N.value)return;S.preventDefault(),S.stopPropagation(),V?.();let D=R.value;V=pe({kind:k,event:S,doc:N.value.ownerDocument,task:M.task,axis:vt.value,rtl:v(N.value),onPreview:(z)=>{b.value=!0,R.value=ot(D,G(),M.task.id,z)},onCommit:(z)=>{_t(),$t(k==="move"?"move":"resize",M.task,z,D)},onCancel:()=>{_t(),R.value=D}})},me=(k,M)=>{if(!J(k.task))return;let S=de(M.key,{task:k.task,ctrl:M.ctrlKey||M.metaKey,shift:M.shiftKey,rtl:v(M.currentTarget)});if(!S)return;M.preventDefault(),$t(S.kind,k.task,S),m(()=>ue(N.value,k.task.id)?.focus())},he=(k,M)=>{if(M.stopPropagation(),pt.blocked())return;wt(k.id),w("taskClick",{task:k,originalEvent:M})},Tt=(k,M)=>{wt(ht()===k.id?null:k.id),w("taskClick",{task:k,originalEvent:M})};return()=>{let{t:k,text:M}=p,S=X(),D=vt.value,z=ft.value,et=E.isMobile.value,Q=yt.value,W=Vt(Q.length,F.value),{bars:ye,anchors:ve}=Zt(Q,D,W),Mt={locale:S,t:I,calendar:gt.value},Ct=te(O.value.links,ve,(d)=>Qt(d,Mt)),nt=ne(Ct,L.value),St=Lt(Y.value,D),Pt=Wt(G()?.markers,D),At=n.showNow?qt(n.today??new Date,D):null,at=bt(O.value),xe=[{field:"label",header:k("planning.columnTask"),width:et?"140px":n.taskColumnWidth},...et?[]:[{field:"start",header:k("planning.columnStart"),width:"60px"},{field:"end",header:k("planning.columnEnd"),width:"60px"},{field:"duration",header:k("planning.columnDuration"),width:"52px"},{field:"pct",header:"%",width:"38px"}]],st=(d)=>({key:d.task.id,type:"button",class:se(d,P(),nt.tasks.has(d.task.id)),"data-task":d.task.id,"aria-label":it(d.task,{locale:S,t:I}),title:it(d.task,{locale:S,t:I}),onPointerenter:()=>{L.value=d.task.id},onPointerleave:()=>{L.value=null},onClick:(C)=>he(d.task,C)}),Dt=(d)=>({"aria-describedby":J(d.task)?A:void 0,onPointerdown:(C)=>tt("move",d,C),onKeydown:(C)=>me(d,C)});return ee(g,e("div",{ref:N,role:"region",class:oe({scale:n.scale,editable:P(),dragging:b.value,compact:et})},[e("p",{class:"gt__live",role:"status","aria-live":"polite"},ct.value),e("span",{class:"gt__hint",id:A},k("planning.ganttHint")),Q.length?e("div",{class:"gt__scroll"},[e("div",{class:"gt"},[e("div",{class:"gt__gauche"},[e(Fn,{value:Xt(O.value,Mt),columns:xe,dataKey:"id",parentKey:"parent",treeColumn:"label",dense:!0,showToolbar:!1,expandedNodeKeys:mt.value,"onUpdate:expandedNodeKeys":(d)=>{let C=d.map(String);B.value=C,w("update:expandedKeys",C)},onRowClick:(d)=>{let C=O.value.byId.get(String(d.row.id));if(C)Tt(C,d.event)}})]),e("div",{class:"gt__droite",style:{width:`${D.width}px`}},[e("div",{class:"gt__hd",style:{height:`${ut.value}px`}},[e("div",{class:"gt__hdr is-haut"},St.upper.map((d,C)=>e("div",{key:C,class:"gt__hc",style:{width:`${d.w}px`}},d.label))),e("div",{class:"gt__hdr"},St.lower.map((d,C)=>e("div",{key:C,class:["gt__hc",{"is-off":d.off,"is-auj":d.today}],style:{width:`${z}px`}},d.label))),...Pt.map((d,C)=>e("span",{key:`m${C}`,class:"gt__drapeau",style:{insetInlineStart:`${d.x+4}px`}},d.label))]),e("div",{class:"gt__corps",style:{height:`${W.total}px`}},[...Ft(Y.value,z).map((d,C)=>e("div",{key:`o${C}`,class:"gt__off",style:{insetInlineStart:`${d.x}px`,width:`${d.w}px`}})),...Ut(Y.value,z).map((d,C)=>e("div",{key:`t${C}`,class:"gt__trait",style:{insetInlineStart:`${d}px`}})),...Pt.map((d,C)=>e("div",{key:`m${C}`,class:"gt__marqueur",style:{insetInlineStart:`${d.x}px`}})),At!==null?e("div",{key:"now",class:"gt__now",style:{insetInlineStart:`${At}px`}}):null,...Q.map((d,C)=>e("div",{key:`r${d.task.id}`,class:["gt__row",{"is-sel":ht()===d.task.id}],style:{top:`${W.tops[C]}px`,height:`${W.heights[C]}px`},onClick:(ke)=>Tt(d.task,ke)})),e("svg",{key:"svg",class:"gt__liens",width:D.width,height:W.total,"aria-hidden":"true"},Ct.flatMap((d)=>[e("path",{key:`p${d.id}`,d:d.d,class:{"is-hot":nt.links.has(d.id)}},[e("title",d.title)]),e("polygon",{key:`f${d.id}`,class:["fl",{"is-hot":nt.links.has(d.id)}],points:d.arrow})])),...ye.flatMap((d)=>d.kind==="milestone"?[e("button",{...st(d),...Dt(d),style:{insetInlineStart:`${d.x+d.w/2-6}px`,top:`${d.y-6}px`}}),e("span",{key:`l${d.task.id}`,class:"gt__lbl",style:{insetInlineStart:`${d.x+d.w/2+12}px`,top:`${d.y-8}px`}},d.task.label)]:d.kind==="summary"?[e("button",{...st(d),style:{insetInlineStart:`${d.x}px`,width:`${d.w}px`,top:`${d.y-5}px`}})]:[e("button",{...st(d),...Dt(d),style:{"--_c":d.task.color||void 0,"--_p":`${d.task.progress*100}%`,insetInlineStart:`${d.x}px`,width:`${d.w}px`,top:`${d.y-8}px`}},[e("span",{class:"avancement"}),...J(d.task)?[e("span",{class:"poignee is-debut",onPointerdown:(C)=>tt("resize-start",d,C)}),e("span",{class:"poignee is-fin",onPointerdown:(C)=>tt("resize-end",d,C)})]:[]]),e("span",{key:`l${d.task.id}`,class:"gt__lbl",style:{insetInlineStart:`${d.x+d.w+6}px`,top:`${d.y-8}px`}},d.task.label)])])])])]):e("div",{class:"gt__vide"},M(n.emptyText,"planning.ganttEmpty")),n.showUnplanned&&at.length?e("div",{class:"gt__tray"},[e("span",{class:"gt__trayt"},k("planning.unplanned")),e("span",{class:"gt__trayn"},String(at.length)),...at.map((d)=>e("span",{key:d.id,class:"gt__chip"},[d.label,e("i",k("planning.noDates"))]))]):null]),s)}}});export{Le as PoadGantt};
1
+ import"./c-rv7cxh2k.js";import"./c-4g3757ck.js";import"./c-rj7c7mwf.js";import"./c-mcy4rvac.js";import"./c-bhgqqt5x.js";import"./c-n27dcy6d.js";import"./c-031pq7qf.js";import{Fn}from"./c-jy6yg5r5.js";import{Nt,Ve}from"./c-9rx4pqjs.js";import{Se,He,gn}from"./c-1hzd2pqr.js";import{ae,le}from"./c-c60s3ncm.js";import{H}from"./c-pj08sk6j.js";import{Pe,ge,K,ee}from"./c-g4dt7z6r.js";import"./c-8xxzrkpg.js";import{x,T}from"./c-523qwqen.js";import"./c-k3yb5e72.js";import{v}from"./c-p8wyhrwm.js";import{i}from"./c-xw7vce7r.js";import{h,t,l,m,c,r,f,y,u,o,e}from"./c-qzar8xvm.js";function It(n,a,s){let p=new Map(n.map((w)=>[w.id,w])),g=[],_=(w,P)=>{for(let I of w){let A=p.get(I);if(!A)continue;if(!A.scheduled&&!A.milestone)continue;if(g.push({task:A,level:P}),A.children.length&&s.has(A.id))_(A.children,P+1)}};return _(a,0),g}function Rt(n,a,s,p=12,g=17){let _=n.charAt(0)==="F",w=n.charAt(1)==="S",P=_?a.x2:a.x1,I=_?1:-1,A=w?s.x1:s.x2,E=w?-1:1,B=P+I*p,j=A+E*p,R=w?B<=j:B>=j,b=`M${P} ${a.y} H${B}`;if(R)b+=` V${s.y} H${A}`;else{let L=a.y<s.y?s.y-g:s.y+g;b+=` V${L} H${j} V${s.y} H${A}`}return{d:b,fleche:{x:A,y:s.y,sens:w?"right":"left"}}}function Bt(n,a=4.5){let s=n.sens==="right"?n.x-a*1.6:n.x+a*1.6;return`${n.x},${n.y} ${s},${n.y-a} ${s},${n.y+a}`}var zt=(n,a)=>a||(n==="day"?36:n==="week"?90:120),Kt={src:void 0,map:new Map};function ot(n,a,s,p){let g=new Map(n.src===a?n.map:[]);return g.set(s,p),{src:a,map:g}}function jt(n,a){if(!n||a.src!==n||!a.map.size)return n??null;return{...n,tasks:(n.tasks??[]).map((s)=>{let p=a.map.get(s.id);return p?{...s,start:p.start,end:p.end,duration:null}:s})}}var we=(n)=>n.tasks.filter((a)=>a.children.length).map((a)=>a.id),Et=(n,a)=>n?[...n]:we(a),Ht=(n,a)=>It(n.tasks,n.roots,new Set(a)),bt=(n)=>n.tasks.filter((a)=>!a.scheduled&&!a.children.length);function Ot(n,a){let s=null,p=null,g=(_)=>{if(!_)return;s=s===null?_.getTime():Math.min(s,_.getTime()),p=p===null?_.getTime():Math.max(p,_.getTime())};for(let _ of n.tasks)if(_.scheduled)g(_.start),g(_.end);if(s===null||p===null)return null;for(let _ of a??[])g(T(_.date));return{min:new Date(s),max:new Date(p)}}function Gt(n,a,s){if(!n)return{upper:[],lower:[]};let p=a==="day"?3:a==="week"?10:40;return Nt(x(n.min,-p),x(n.max,p),a,{locale:s.locale,i18n:s.i18n,firstDay:s.firstDay,calendar:s.calendar??null,today:s.today??new Date})}function Lt(n,a){return{lower:n.lower.map((s)=>({label:s.label,off:s.off,today:s.today})),upper:n.upper.map((s)=>{let p=Math.max(0,a.xOf(s.start)),g=Math.min(a.width,a.xOf(s.end));return{label:s.label,w:Math.max(0,g-p)}}).filter((s)=>s.w>0)}}var Ft=(n,a)=>n.lower.map((s,p)=>({off:s.off,x:p*a,w:a})).filter((s)=>s.off).map(({x:s,w:p})=>({x:s,w:p})),Ut=(n,a)=>n.lower.map((s,p)=>({major:s.major,x:p*a})).filter((s)=>a>=20||s.major).map((s)=>s.x);function Wt(n,a){let{start:s,end:p}=a;if(!s||!p)return[];let g=[];for(let _ of n??[]){let w=T(_.date);if(!w||w<s||w>=p)continue;g.push({x:a.xOf(w),label:_.label??""})}return g}function qt(n,a){if(!a.start||!a.end||n<a.start||n>=a.end)return null;return a.xOf(n)}var lt=34;function Vt(n,a){if(a&&a.tops.length===n&&n>0)return{tops:a.tops,heights:a.heights,total:a.tops[n-1]+a.heights[n-1]};return{tops:Array.from({length:n},(s,p)=>p*lt),heights:Array(n).fill(lt),total:n*lt}}function Yt(n){let a=Array.from(n);if(!a.length)return null;let s=a[0].getBoundingClientRect().top,p=[],g=[];for(let _ of a){let w=_.getBoundingClientRect();if(w.height<=0)return null;p.push(Math.round(w.top-s)),g.push(Math.round(w.height))}return{tops:p,heights:g}}var rt=(n)=>{try{return Intl.getCanonicalLocales(n)[0]??"en"}catch{return"en"}},q=(n,a)=>a?new Intl.DateTimeFormat(rt(n),{day:"2-digit",month:"2-digit"}).format(a):"",Jt=(n,a,s)=>s("planning.days",{days:new Intl.NumberFormat(rt(a),{maximumFractionDigits:1}).format(n)});function _e(n,a){if(n.milestone)return a.t("planning.milestone");if(!n.start||!n.end)return"";let s=a.calendar.minutesBetween(n.start,n.end)/a.calendar.dailyMinutes;return Jt(Math.round(s*10)/10,a.locale,a.t)}function it(n,a){if(n.milestone)return`${n.label} — ${q(a.locale,n.start)} (${a.t("planning.milestone")})`;let s=` · ${new Intl.NumberFormat(rt(a.locale),{style:"percent",maximumFractionDigits:0}).format(n.progress)}`,p=n.rolled?" "+a.t("planning.summary"):"";return`${n.label} — ${q(a.locale,n.start)} → ${q(a.locale,n.end)}${s}${p}`}function Qt(n,a){let s=n.lagMinutes?` · ${a.t("planning.lag",{days:Jt(Math.round(n.lagMinutes/a.calendar.dailyMinutes*10)/10,a.locale,a.t)})}`:"";return`${n.from} → ${n.to} · ${n.type}${s}`}function Xt(n,a){return n.tasks.filter((s)=>s.scheduled||s.milestone||s.children.length).map((s)=>({id:s.id,parent:s.parent,label:s.label,start:q(a.locale,s.start),end:s.milestone?"—":q(a.locale,s.end),duration:_e(s,a),pct:String(Math.round(s.progress*100))}))}function Zt(n,a,s){let p=new Map,g=[];return n.forEach((_,w)=>{let P=_.task;if(!P.start||!P.end)return;let I=s.tops[w]+s.heights[w]/2,A=s.heights[w]/2;if(P.milestone){let R=a.xOf(P.start);g.push({task:P,kind:"milestone",x:R-8,w:16,y:I}),p.set(P.id,{x1:R-8,x2:R+8,y:I,half:A});return}let E=a.spanOf(P.start,P.end),B=E.x,j=Math.max(4,E.width-2);g.push({task:P,kind:P.rolled?"summary":"bar",x:B,w:j,y:I}),p.set(P.id,{x1:B,x2:B+j,y:I,half:A})}),{bars:g,anchors:p}}function te(n,a,s){let p=[];for(let g of n){let _=a.get(g.from),w=a.get(g.to);if(!_||!w)continue;let P=Rt(g.type,_,w,12,w.half);p.push({id:g.id,d:P.d,arrow:Bt(P.fleche),title:s(g),from:g.from,to:g.to})}return p}function ne(n,a){if(!a)return{links:new Set,tasks:new Set};let s=new Set,p=new Set([a]);for(let g of n){if(g.from===a)s.add(g.id),p.add(g.to);if(g.to===a)s.add(g.id),p.add(g.from)}return{links:s,tasks:p}}var dt=(n,a)=>a&&!n.locked&&!n.rolled&&!!n.start&&!!n.end;function se(n,a,s){return`${n.kind==="milestone"?"gt__jal":n.kind==="summary"?"gt__sum":"gt__b"}${s?" is-hot":""}${dt(n.task,a)?" is-editable":a&&n.kind!=="summary"?" is-verrouille":""}`}var oe=(n)=>`poad-gantt is-${n.scale}${n.editable?" is-editable":""}${n.dragging?" is-dragging":""}${n.compact?" is-compact":""}`,$e=86400000;function re(n,a,s,p,g=!1){let _=n==="resize-end"?a.end:a.start,w=p.dateAt(p.xOf(_)+s),P=w?Math.round((w.getTime()-_.getTime())/$e):0;return ie(g?"move":n,a,P)}function ie(n,a,s){if(n==="resize-end"){let p=x(a.end,s);while(p.getTime()<=a.start.getTime())p=x(p,1);return{start:a.start,end:p}}if(n==="resize-start"){let p=x(a.start,s);while(p.getTime()>=a.end.getTime())p=x(p,-1);return{start:p,end:a.end}}return{start:x(a.start,s),end:x(a.end,s)}}function de(n,a){if(n!=="ArrowLeft"&&n!=="ArrowRight"||!a.ctrl&&!a.shift||!a.task.start||!a.task.end)return null;let s=a.shift&&!a.ctrl?"resize-end":"move";if(s==="resize-end"&&a.task.milestone)return null;let p={start:a.task.start,end:a.task.end},g=ie(s,p,n===(a.rtl?"ArrowLeft":"ArrowRight")?1:-1);if(g.start.getTime()===p.start.getTime()&&g.end.getTime()===p.end.getTime())return null;return{kind:s==="move"?"move":"resize",start:g.start,end:g.end}}var ce=(n,a,s,p)=>n==="move"?{key:"planning.announceMoved",params:{label:a.label,date:Se(p,s.start,!0)}}:{key:"planning.announceResized",params:{label:a.label,date:Se(p,s.end,!0)}};function ue(n,a){if(!n)return null;return Array.from(n.querySelectorAll(".gt__corps [data-task]")).find((p)=>p.getAttribute("data-task")===a)??null}function pe(n){let a={start:n.task.start,end:n.task.end};return gn({event:n.event,doc:n.doc,base:a,project:(s)=>re(n.kind,a,n.rtl?-s:s,n.axis,n.task.milestone),onPreview:n.onPreview,onCommit:n.onCommit,onCancel:n.onCancel})}var Le=r({name:"PoadGantt",inheritAttrs:!1,props:{data:{type:Object,default:null},store:{type:[Object,String],default:null},fields:{type:Array,default:null},plan:{type:Object,default:null},scale:{type:String,default:"week"},expandedKeys:{type:Array,default:null},selectedKey:{type:String,default:null},tickWidth:{type:Number,default:null},workCalendar:{type:Object,default:null},today:{type:Date,default:null},locale:String,firstDay:{type:Number,default:1},emptyText:String,showNow:{type:Boolean,default:!0},showUnplanned:{type:Boolean,default:!0},taskColumnWidth:{type:String,default:"210px"},editable:Boolean},emits:{taskClick:(n)=>!0,taskMove:(n)=>!0,taskResize:(n)=>!0,"update:expandedKeys":(n)=>!0,"update:selectedKey":(n)=>!0},setup(n,{emit:a,attrs:s}){let p=i(),g=K(n),_=o(()=>g.state.value?ge(g.state.value,{locale:p.locale}):null),w=(k,M)=>{a(k,M);let S=g.binding.value;if(S&&(k==="taskMove"||k==="taskResize")){let D=M;Pe(S,D.task.id,D.start,D.end)}},P=()=>_.value&&!g.given("editable")?_.value.editable:n.editable,I=(k,M)=>p.t(k,M),A=`poad-gantt-${f()}-hint`,E=H(),B=l(null),j=t(null),R=l(Kt),b=t(!1),L=t(null),ct=t(""),F=l(null),ut=t(44),N=t(null),pt=He(),V=null,U=null,G=()=>_.value?_.value.plan:n.plan?h(n.plan):null,X=()=>n.locale??p.locale,Z=o(()=>ae(p.locale,p.messages)),fe=o(()=>le(G(),{i18n:Z.value})),O=o(()=>le(jt(G(),R.value),{i18n:Z.value})),gt=o(()=>n.workCalendar??O.value.calendar),ft=o(()=>zt(n.scale,n.tickWidth)),mt=o(()=>Et(n.expandedKeys??B.value,O.value)),ht=()=>n.selectedKey??j.value,yt=o(()=>Ht(O.value,mt.value)),Y=o(()=>Gt(Ot(fe.value,G()?.markers),n.scale,{locale:X(),i18n:Z.value,firstDay:n.firstDay,calendar:gt.value,today:n.today??new Date})),vt=o(()=>new Ve(Y.value.lower,ft.value)),xt=()=>{let k=N.value;if(!k)return;let M=k.querySelector(".gt__gauche thead")?.getBoundingClientRect().height??0;if(M>0)ut.value=Math.round(M);let S=Yt(k.querySelectorAll(".gt__gauche tbody tr"));if(S&&!(F.value&&F.value.tops.join()===S.tops.join()&&F.value.heights.join()===S.heights.join()))F.value=S},kt=()=>{U?.disconnect(),U=null,xt();let k=N.value?.querySelector(".gt__gauche");if(k&&typeof ResizeObserver<"u")U=new ResizeObserver(xt),U.observe(k)};y(kt),c(()=>[yt.value.length,E.isMobile.value],()=>void m(kt)),u(()=>{V?.(),U?.disconnect()});let J=(k)=>dt(k,P()),wt=(k)=>{j.value=k,w("update:selectedKey",k)},_t=()=>{V=null,b.value=!1,pt.mark()},$t=(k,M,S,D=R.value)=>{if(R.value=ot(D,G(),M.id,S),k==="move")w("taskMove",{task:M,start:S.start,end:S.end});else w("taskResize",{task:M,start:S.start,end:S.end});let z=ce(k,M,S,X());ct.value=p.t(z.key,z.params)},tt=(k,M,S)=>{if(!J(M.task)||S.button!==0||!N.value)return;S.preventDefault(),S.stopPropagation(),V?.();let D=R.value;V=pe({kind:k,event:S,doc:N.value.ownerDocument,task:M.task,axis:vt.value,rtl:v(N.value),onPreview:(z)=>{b.value=!0,R.value=ot(D,G(),M.task.id,z)},onCommit:(z)=>{_t(),$t(k==="move"?"move":"resize",M.task,z,D)},onCancel:()=>{_t(),R.value=D}})},me=(k,M)=>{if(!J(k.task))return;let S=de(M.key,{task:k.task,ctrl:M.ctrlKey||M.metaKey,shift:M.shiftKey,rtl:v(M.currentTarget)});if(!S)return;M.preventDefault(),$t(S.kind,k.task,S),m(()=>ue(N.value,k.task.id)?.focus())},he=(k,M)=>{if(M.stopPropagation(),pt.blocked())return;wt(k.id),w("taskClick",{task:k,originalEvent:M})},Tt=(k,M)=>{wt(ht()===k.id?null:k.id),w("taskClick",{task:k,originalEvent:M})};return()=>{let{t:k,text:M}=p,S=X(),D=vt.value,z=ft.value,et=E.isMobile.value,Q=yt.value,W=Vt(Q.length,F.value),{bars:ye,anchors:ve}=Zt(Q,D,W),Mt={locale:S,t:I,calendar:gt.value},Ct=te(O.value.links,ve,(d)=>Qt(d,Mt)),nt=ne(Ct,L.value),St=Lt(Y.value,D),Pt=Wt(G()?.markers,D),At=n.showNow?qt(n.today??new Date,D):null,at=bt(O.value),xe=[{field:"label",header:k("planning.columnTask"),width:et?"140px":n.taskColumnWidth},...et?[]:[{field:"start",header:k("planning.columnStart"),width:"60px"},{field:"end",header:k("planning.columnEnd"),width:"60px"},{field:"duration",header:k("planning.columnDuration"),width:"52px"},{field:"pct",header:"%",width:"38px"}]],st=(d)=>({key:d.task.id,type:"button",class:se(d,P(),nt.tasks.has(d.task.id)),"data-task":d.task.id,"aria-label":it(d.task,{locale:S,t:I}),title:it(d.task,{locale:S,t:I}),onPointerenter:()=>{L.value=d.task.id},onPointerleave:()=>{L.value=null},onClick:(C)=>he(d.task,C)}),Dt=(d)=>({"aria-describedby":J(d.task)?A:void 0,onPointerdown:(C)=>tt("move",d,C),onKeydown:(C)=>me(d,C)});return ee(g,e("div",{ref:N,role:"region",class:oe({scale:n.scale,editable:P(),dragging:b.value,compact:et})},[e("p",{class:"gt__live",role:"status","aria-live":"polite"},ct.value),e("span",{class:"gt__hint",id:A},k("planning.ganttHint")),Q.length?e("div",{class:"gt__scroll"},[e("div",{class:"gt"},[e("div",{class:"gt__gauche"},[e(Fn,{value:Xt(O.value,Mt),columns:xe,dataKey:"id",parentKey:"parent",treeColumn:"label",dense:!0,showToolbar:!1,expandedNodeKeys:mt.value,"onUpdate:expandedNodeKeys":(d)=>{let C=d.map(String);B.value=C,w("update:expandedKeys",C)},onRowClick:(d)=>{let C=O.value.byId.get(String(d.row.id));if(C)Tt(C,d.event)}})]),e("div",{class:"gt__droite",style:{width:`${D.width}px`}},[e("div",{class:"gt__hd",style:{height:`${ut.value}px`}},[e("div",{class:"gt__hdr is-haut"},St.upper.map((d,C)=>e("div",{key:C,class:"gt__hc",style:{width:`${d.w}px`}},d.label))),e("div",{class:"gt__hdr"},St.lower.map((d,C)=>e("div",{key:C,class:["gt__hc",{"is-off":d.off,"is-auj":d.today}],style:{width:`${z}px`}},d.label))),...Pt.map((d,C)=>e("span",{key:`m${C}`,class:"gt__drapeau",style:{insetInlineStart:`${d.x+4}px`}},d.label))]),e("div",{class:"gt__corps",style:{height:`${W.total}px`}},[...Ft(Y.value,z).map((d,C)=>e("div",{key:`o${C}`,class:"gt__off",style:{insetInlineStart:`${d.x}px`,width:`${d.w}px`}})),...Ut(Y.value,z).map((d,C)=>e("div",{key:`t${C}`,class:"gt__trait",style:{insetInlineStart:`${d}px`}})),...Pt.map((d,C)=>e("div",{key:`m${C}`,class:"gt__marqueur",style:{insetInlineStart:`${d.x}px`}})),At!==null?e("div",{key:"now",class:"gt__now",style:{insetInlineStart:`${At}px`}}):null,...Q.map((d,C)=>e("div",{key:`r${d.task.id}`,class:["gt__row",{"is-sel":ht()===d.task.id}],style:{top:`${W.tops[C]}px`,height:`${W.heights[C]}px`},onClick:(ke)=>Tt(d.task,ke)})),e("svg",{key:"svg",class:"gt__liens",width:D.width,height:W.total,"aria-hidden":"true"},Ct.flatMap((d)=>[e("path",{key:`p${d.id}`,d:d.d,class:{"is-hot":nt.links.has(d.id)}},[e("title",d.title)]),e("polygon",{key:`f${d.id}`,class:["fl",{"is-hot":nt.links.has(d.id)}],points:d.arrow})])),...ye.flatMap((d)=>d.kind==="milestone"?[e("button",{...st(d),...Dt(d),style:{insetInlineStart:`${d.x+d.w/2-6}px`,top:`${d.y-6}px`}}),e("span",{key:`l${d.task.id}`,class:"gt__lbl",style:{insetInlineStart:`${d.x+d.w/2+12}px`,top:`${d.y-8}px`}},d.task.label)]:d.kind==="summary"?[e("button",{...st(d),style:{insetInlineStart:`${d.x}px`,width:`${d.w}px`,top:`${d.y-5}px`}})]:[e("button",{...st(d),...Dt(d),style:{"--_c":d.task.color||void 0,"--_p":`${d.task.progress*100}%`,insetInlineStart:`${d.x}px`,width:`${d.w}px`,top:`${d.y-8}px`}},[e("span",{class:"avancement"}),...J(d.task)?[e("span",{class:"poignee is-debut",onPointerdown:(C)=>tt("resize-start",d,C)}),e("span",{class:"poignee is-fin",onPointerdown:(C)=>tt("resize-end",d,C)})]:[]]),e("span",{key:`l${d.task.id}`,class:"gt__lbl",style:{insetInlineStart:`${d.x+d.w+6}px`,top:`${d.y-8}px`}},d.task.label)])])])])]):e("div",{class:"gt__vide"},M(n.emptyText,"planning.ganttEmpty")),n.showUnplanned&&at.length?e("div",{class:"gt__tray"},[e("span",{class:"gt__trayt"},k("planning.unplanned")),e("span",{class:"gt__trayn"},String(at.length)),...at.map((d)=>e("span",{key:d.id,class:"gt__chip"},[d.label,e("i",k("planning.noDates"))]))]):null]),s)}}});export{Le as PoadGantt};