@kashi-ui/elements 0.25.0 → 1.0.0

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 (70) hide show
  1. package/README.md +11 -1
  2. package/dist/appointment.d.ts +40 -0
  3. package/dist/appointment.js +175 -0
  4. package/dist/base.d.ts +408 -0
  5. package/dist/base.js +31 -0
  6. package/dist/basic.d.ts +43 -0
  7. package/dist/basic.js +222 -0
  8. package/dist/calendar.js +21 -20
  9. package/dist/cdn/appointment-CrIZi8Bp.js +1 -0
  10. package/dist/cdn/base-DTQ50VdG.js +1 -0
  11. package/dist/cdn/basic-CrEW2RKF.js +1 -0
  12. package/dist/cdn/calendar-CYRrdGIf.js +16 -0
  13. package/dist/cdn/charts-D6KM26Vp.js +1 -0
  14. package/dist/cdn/combobox-6EFI2qqN.js +1 -0
  15. package/dist/cdn/controls-BwebEIlf.js +1 -0
  16. package/dist/cdn/display-DFuMkcj5.js +1 -0
  17. package/dist/cdn/fields-DhLIhHQ8.js +1 -0
  18. package/dist/cdn/forms-BHivKDdC.js +1 -0
  19. package/dist/cdn/holidays-DgbIAdlt.js +1 -0
  20. package/dist/cdn/inputs-R7nEHfbV.js +1 -0
  21. package/dist/cdn/kashi-elements.js +1 -1
  22. package/dist/cdn/map-H3xiZd8Y.js +12 -0
  23. package/dist/cdn/{menu-DhrqyLgy.js → menu-BAUSubXk.js} +1 -1
  24. package/dist/cdn/nav-NK-v48B5.js +1 -0
  25. package/dist/cdn/overlay-CBv8grz3.js +1 -0
  26. package/dist/cdn/pickers-BHzNt_X8.js +1 -0
  27. package/dist/cdn/table-Bt9WVLoo.js +1 -0
  28. package/dist/cdn/text-D4a_hlwL.js +1 -0
  29. package/dist/cdn/time-DJ3p1wvd.js +1 -0
  30. package/dist/cdn/words-BdADG_9U.js +1 -0
  31. package/dist/cdn.d.ts +1 -0
  32. package/dist/cdn.js +4 -0
  33. package/dist/charts.js +27 -24
  34. package/dist/combobox.d.ts +6 -5
  35. package/dist/combobox.js +29 -20
  36. package/dist/controls.js +15 -15
  37. package/dist/display.js +17 -14
  38. package/dist/fields.js +3 -3
  39. package/dist/forms.d.ts +3 -3
  40. package/dist/forms.js +54 -47
  41. package/dist/index.d.ts +12 -2
  42. package/dist/index.js +7 -1
  43. package/dist/inputs.d.ts +3 -3
  44. package/dist/inputs.js +31 -30
  45. package/dist/map.js +16 -13
  46. package/dist/nav.js +18 -16
  47. package/dist/overlay.js +5 -5
  48. package/dist/pickers.d.ts +1 -1
  49. package/dist/pickers.js +39 -38
  50. package/dist/table.js +7 -7
  51. package/dist/toast.js +3 -3
  52. package/package.json +4 -4
  53. package/dist/cdn/base-Cmq7zeIG.js +0 -1
  54. package/dist/cdn/calendar-Dm3fq2bs.js +0 -16
  55. package/dist/cdn/charts-DNOWi4sJ.js +0 -1
  56. package/dist/cdn/combobox-ZGrZ5okg.js +0 -1
  57. package/dist/cdn/controls-K-OZcjg4.js +0 -1
  58. package/dist/cdn/digits-DE1YGT94.js +0 -1
  59. package/dist/cdn/display-C975tS7j.js +0 -1
  60. package/dist/cdn/fields-BUTaSN8m.js +0 -1
  61. package/dist/cdn/forms-C-effPKn.js +0 -1
  62. package/dist/cdn/inputs-BjOddAM7.js +0 -1
  63. package/dist/cdn/jalali-BiM5Kfep.js +0 -1
  64. package/dist/cdn/map-BHuusa4t.js +0 -12
  65. package/dist/cdn/nav-D_w5BV_K.js +0 -1
  66. package/dist/cdn/overlay-DX9un2xm.js +0 -1
  67. package/dist/cdn/pickers-BFLpUruK.js +0 -1
  68. package/dist/cdn/table-DPQfDMs-.js +0 -1
  69. package/dist/cdn/text-D1U32D6K.js +0 -1
  70. package/dist/cdn/words-9OdzG7y6.js +0 -1
@@ -0,0 +1 @@
1
+ import{D as e,E as t,T as n,a as r,d as i,f as a,l as o,o as s,p as c,t as l,v as u,w as d,x as f,y as p}from"./base-DTQ50VdG.js";const m=t=>e(t,{digits:a()}),h=e=>m(Math.round(e*10)/10).replace(`.`,c().common.decimal),g=e=>{let t=Math.abs(e),n=c().chart;return t>=1e9?h(e/1e9)+n.billion:t>=1e6?h(e/1e6)+n.million:t>=1e3?h(e/1e3)+n.thousand:m(e)};function _(e,t=4){if(e<=0)return[0];let n=e/t,r=10**Math.floor(Math.log10(n)),i=[1,2,2.5,5,10].map(e=>e*r).find(e=>e>=n);return Array.from({length:Math.ceil(e/i)+1},(e,t)=>t*i)}const v=(e,t)=>c().common.percent(h(e/(t||1)*100)),y=e=>`var(--k-chart-${e+1})`,b=(e,t)=>{if(!e)return t;try{return JSON.parse(e)}catch{return t}};var x=class extends l{constructor(){super(...arguments),this.key=u(`kashi-chart`),this.props={}}connectedCallback(){this.draw()}attributeChangedCallback(){this.isConnected&&this.draw()}get format(){let e=this.getAttribute(`unit`);return this.fmt??(t=>`${m(Math.round(t))}${e?` ${e}`:``}`)}set format(e){this.fmt=e,this.isConnected&&this.draw()}read(e,t){return this.props[e]??b(this.getAttribute(e),t)}write(e,t){this.props[e]=t,this.isConnected&&this.draw()}get heading(){return this.getAttribute(`label`)??``}tip(e,t,n=0,r,i=[]){let a=e.querySelector(`:scope > .k-chart__tip`);if(t===null){a?.remove();return}a||(a=document.createElement(`div`),a.className=`k-chart__tip`,a.setAttribute(`aria-hidden`,`true`),e.append(a));let s=e.clientWidth;a.style.left=`${s?Math.min(Math.max(t,80),s-80):t}px`,a.style.top=`${n}px`,a.innerHTML=`${r?`<span class="k-chart__tip-title">${o(r)}</span>`:``}${i.map(e=>`<span class="k-chart__tip-row"${e.color?` style="--_c: ${e.color}"`:``}>${e.name===void 0?``:`<span>${e.color?`<i></i>`:``}${o(e.name)}</span>`}<strong>${o(e.value)}</strong></span>`).join(``)}`}at(e,t){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return{x:r.left+r.width/2-n.left,y:r.top-n.top}}},S=class extends x{get data(){return this.read(`data`,[])}set data(e){this.write(`data`,e)}get series(){return this.read(`series`,[])}set series(e){this.write(`series`,e)}get labels(){return this.read(`labels`,[])}set labels(e){this.write(`labels`,e)}draw(){let e=this.format,t=this.series.length?this.series.slice(0,4):null,n=this.data,r=t?this.labels:n.map(e=>e.label),i=r.map((e,r)=>t?t.reduce((e,t)=>e+(t.values[r]??0),0):n[r].value),a=Math.max(0,...i),s=_(a),l=s.at(-1)||1,u=i.indexOf(a),d=this.getAttribute(`label-max`)!==`false`,f=n=>t?`${r[n]}: ${t.map(t=>`${t.name} ${e(t.values[n]??0)}`).join(c().common.list)}${c().common.list}${c().common.total} ${e(i[n])}`:`${r[n]}: ${e(i[n])}`,p=this.getAttribute(`height`);this.innerHTML=`<figure class="k-chart k-chart--bar" aria-labelledby="${this.key}-t" style="margin: 0${p?`; --k-chart-height: ${o(p)}`:``}"><figcaption class="k-chart__head"><p class="k-chart__title" id="${this.key}-t">${o(this.heading)}</p>${t&&t.length>1?`<ul class="k-chart__legend" aria-hidden="true">${t.map((e,t)=>`<li style="--_c: ${y(t)}"><span class="k-chart__key k-chart__key--box"></span>${o(e.name)}</li>`).join(``)}</ul>`:``}</figcaption><div class="k-chart__plot"><div class="k-bars__grid" aria-hidden="true">${s.map(e=>`<span data-v="${o(g(e))}"></span>`).join(``)}</div><div class="k-bars" role="list" aria-label="${o(this.heading)}">${r.map((n,r)=>`<div class="k-bars__col" role="listitem" tabindex="0" data-i="${r}" aria-label="${o(f(r))}" style="--_d: ${r*40}ms">${d&&r===u?`<span class="k-bars__value" aria-hidden="true">${o(e(i[r]))}</span>`:``}${t?`<span class="k-bars__stack" style="block-size: ${i[r]/l*100}%" aria-hidden="true">${t.map((e,t)=>`<span class="k-bars__seg" style="--_c: ${y(t)}; flex-grow: ${e.values[r]??0}"></span>`).join(``)}</span>`:`<span class="k-bars__bar" style="block-size: ${i[r]/l*100}%" aria-hidden="true"></span>`}<span class="k-bars__label" aria-hidden="true">${o(n)}</span></div>`).join(``)}</div></div></figure>`;let m=this.querySelector(`.k-chart__plot`),h=n=>{let a=Number(n.dataset.i);m.querySelector(`[data-active]`)?.removeAttribute(`data-active`),n.setAttribute(`data-active`,``);let o=this.at(n.querySelector(`.k-bars__bar, .k-bars__stack`)??n,m);this.tip(m,o.x,o.y,r[a],t?[...t.map((t,n)=>({name:t.name,value:e(t.values[a]??0),color:y(n)})),{name:c().common.total,value:e(i[a])}]:[{value:e(i[a])}])},v=()=>{m.querySelector(`[data-active]`)?.removeAttribute(`data-active`),this.tip(m,null)};m.querySelectorAll(`.k-bars__col`).forEach(e=>{e.addEventListener(`pointerenter`,()=>h(e)),e.addEventListener(`focus`,()=>h(e)),e.addEventListener(`pointerleave`,v),e.addEventListener(`blur`,v)})}};S.observedAttributes=[`label`,`data`,`labels`,`series`,`unit`,`label-max`,`height`];var C=class extends x{get data(){return this.read(`data`,[])}set data(e){this.write(`data`,e)}draw(){let e=this.format,t=this.data,n=Math.max(1,...t.map(e=>e.value)),r=t.reduce((e,t)=>e+t.value,0);this.innerHTML=`<figure class="k-chart" aria-labelledby="${this.key}-t" style="margin: 0"><figcaption class="k-chart__head"><p class="k-chart__title" id="${this.key}-t">${o(this.heading)}</p></figcaption><ol class="k-barlist" style="position: relative">${t.map((t,i)=>`<li class="k-barlist__row" data-i="${i}" style="--_d: ${i*60}ms"><span class="k-barlist__track"><span class="k-barlist__fill" style="inline-size: ${t.value/n*100}%" aria-hidden="true"></span>${t.href?`<a class="k-barlist__label" href="${o(t.href)}">${o(t.label)}</a>`:`<span class="k-barlist__label">${o(t.label)}</span>`}</span><span class="k-barlist__value">${o(e(t.value))} <span class="k-barlist__share">${v(t.value,r)}</span></span></li>`).join(``)}</ol></figure>`;let i=this.querySelector(`.k-barlist`);i.querySelectorAll(`.k-barlist__row`).forEach(n=>{n.addEventListener(`pointerenter`,()=>{let a=t[Number(n.dataset.i)];n.setAttribute(`data-active`,``);let o=this.at(n.querySelector(`.k-barlist__fill`),i);this.tip(i,o.x,o.y,a.label,[{name:c().chart.value,value:e(a.value)},{name:c().chart.share,value:v(a.value,r)}])}),n.addEventListener(`pointerleave`,()=>{n.removeAttribute(`data-active`),this.tip(i,null)})})}};C.observedAttributes=[`label`,`data`,`unit`];var w=class extends x{get data(){return this.read(`data`,[])}set data(e){this.write(`data`,e)}draw(){let e=this.format,t=this.data.slice(0,4),n=t.reduce((e,t)=>e+t.value,0),r=this.getAttribute(`percent`)!==`false`;this.innerHTML=`<figure class="k-chart" aria-labelledby="${this.key}-t" style="margin: 0"><figcaption class="k-chart__head"><p class="k-chart__title" id="${this.key}-t">${o(this.heading)}</p></figcaption><div class="k-proportion__wrap"><div class="k-proportion" aria-hidden="true">${t.map((e,t)=>`<span class="k-proportion__seg" data-i="${t}" style="--_c: ${y(t)}; flex-grow: ${e.value}"></span>`).join(``)}</div></div><ul class="k-proportion__legend">${t.map((t,i)=>`<li data-i="${i}" style="--_c: ${y(i)}"><span class="k-chart__key k-chart__key--box" aria-hidden="true"></span><span>${o(t.label)}</span><strong>${o(r?v(t.value,n):e(t.value))}</strong>${r?`<span class="k-proportion__abs">${o(e(t.value))}</span>`:``}</li>`).join(``)}</ul></figure>`;let i=this.querySelector(`.k-proportion__wrap`),a=e=>this.querySelectorAll(`[data-i]`).forEach(t=>t.toggleAttribute(`data-active`,Number(t.dataset.i)===e));i.querySelectorAll(`.k-proportion__seg`).forEach(r=>{r.addEventListener(`pointerenter`,()=>{let o=Number(r.dataset.i);a(o);let s=this.at(r,i);this.tip(i,s.x,s.y,void 0,[{name:t[o].label,value:v(t[o].value,n),color:y(o)},{name:c().chart.count,value:e(t[o].value)}])}),r.addEventListener(`pointerleave`,()=>{a(null),this.tip(i,null)})})}};w.observedAttributes=[`label`,`data`,`unit`,`percent`];var T=class extends x{get data(){return this.read(`data`,[])}set data(e){this.write(`data`,e)}draw(){let e=this.format,t=[...this.data].sort((e,t)=>t.value-e.value),n=t.length>5?[...t.slice(0,4),{label:c().common.other,value:t.slice(4).reduce((e,t)=>e+t.value,0)}]:t,r=n.reduce((e,t)=>e+t.value,0)||1,i=e=>e<4?y(e):`var(--k-text-quaternary)`,a=this.getAttribute(`variant`)!==`pie`,s=Number(this.getAttribute(`size`))||176,l=this.getAttribute(`total-label`)??c().common.total,u=a?40:25,d=a?16:50,f=2*Math.PI*u,p=n.length>1?a?1.6:.8:0,m=0,h=n.map(e=>{let t=e.value/r*f,n={start:m,len:t};return m+=t,n});this.innerHTML=`<figure class="k-chart k-pie" aria-labelledby="${this.key}-t" style="margin: 0"><figcaption class="k-chart__head"><p class="k-chart__title" id="${this.key}-t">${o(this.heading)}</p></figcaption><div class="k-pie__body"><div class="k-pie__plot" style="inline-size: ${s}px; block-size: ${s}px"><svg viewBox="0 0 100 100" class="k-pie__svg" aria-hidden="true">${a?`<circle cx="50" cy="50" r="${u}" fill="none" stroke="var(--k-bg-tertiary)" stroke-width="${d}"></circle>`:``}${n.map((e,t)=>`<circle class="k-pie__slice" data-i="${t}" cx="50" cy="50" r="${u}" fill="none" stroke="${i(t)}" stroke-width="${d}" stroke-dasharray="${Math.max(0,h[t].len-p)} ${f}" stroke-dashoffset="${-h[t].start}" transform="rotate(-90 50 50)" style="--_d: ${t*80}ms"></circle>`).join(``)}</svg>${a?`<div class="k-pie__center" aria-hidden="true"><strong>${o(e(r))}</strong><span>${o(l)}</span></div>`:``}</div><ul class="k-pie__legend">${n.map((t,n)=>`<li data-i="${n}" style="--_c: ${i(n)}"><span class="k-chart__key k-chart__key--box" aria-hidden="true"></span><span class="k-pie__name">${o(t.label)}</span><strong>${v(t.value,r)}</strong><span class="k-pie__abs">${o(e(t.value))}</span></li>`).join(``)}</ul></div></figure>`;let g=this.querySelector(`.k-pie__plot`),_=this.querySelector(`.k-pie__center`),b=e=>{let t=(h[e].start+h[e].len/2)/f*2*Math.PI-Math.PI/2,n=a?u:u*1.3;return{x:(50+n*Math.cos(t))/100*s,y:(50+n*Math.sin(t))/100*s-8}},x=t=>{this.querySelectorAll(`[data-i]`).forEach(e=>e.toggleAttribute(`data-active`,Number(e.dataset.i)===t)),_&&(_.innerHTML=t===null?`<strong>${o(e(r))}</strong><span>${o(l)}</span>`:`<strong>${v(n[t].value,r)}</strong><span>${o(n[t].label)}</span>`),a||(t===null?this.tip(g,null):this.tip(g,b(t).x,b(t).y,void 0,[{name:n[t].label,value:v(n[t].value,r),color:i(t)},{name:c().chart.count,value:e(n[t].value)}]))};this.querySelectorAll(`.k-pie__slice, .k-pie__legend li`).forEach(e=>e.addEventListener(`pointerenter`,()=>x(Number(e.dataset.i)))),g.addEventListener(`pointerleave`,()=>x(null)),this.querySelector(`.k-pie__legend`).addEventListener(`pointerleave`,()=>x(null))}};T.observedAttributes=[`label`,`data`,`unit`,`variant`,`total-label`,`size`];var E=class extends x{get values(){return this.props.values??(this.getAttribute(`values`)??``).split(/[,،\s]+/).filter(Boolean).map(Number).filter(e=>!Number.isNaN(e))}set values(e){this.write(`values`,e)}draw(){let e=this.values;if(!e.length){this.innerHTML=``;return}let t=Math.max(...e),n=Math.min(...e),r=Math.max(t-n,Math.abs(t)*.25)||1,i=(t+n)/2-r/2,a=e.map((t,n)=>`${n?`L`:`M`}${n/Math.max(1,e.length-1)*100},${28-(t-i)/r*24}`).join(` `),s=this.getAttribute(`tone`)??`brand`,c=s===`neutral`?`var(--k-text-tertiary)`:s===`brand`?`var(--k-text-brand)`:`var(--k-text-${s})`,l=this.getAttribute(`label`);this.innerHTML=`<svg class="k-sparkline" viewBox="0 0 100 30" preserveAspectRatio="none"${l?` role="img" aria-label="${o(l)}"`:` aria-hidden="true"`} style="color: ${c}">${this.getAttribute(`area`)===`false`?``:`<path d="${a} L100,30 L0,30 Z" fill="currentColor" opacity="0.1"></path>`}<path d="${a}" fill="none" stroke="currentColor" stroke-width="2" vector-effect="non-scaling-stroke" stroke-linejoin="round" stroke-linecap="round"></path></svg>`}};E.observedAttributes=[`values`,`tone`,`area`,`label`];var D=class extends x{constructor(){super(...arguments),this.ro=null,this.active=null}get labels(){return this.read(`labels`,[])}set labels(e){this.write(`labels`,e)}get series(){return this.read(`series`,[])}set series(e){this.write(`series`,e)}connectedCallback(){if(super.connectedCallback(),typeof ResizeObserver<`u`&&!this.ro){let e=0;this.ro=new ResizeObserver(()=>{let t=this.clientWidth;t&&t!==e&&(e=t,this.paintSvg())}),this.ro.observe(this)}}disconnectedCallback(){this.ro?.disconnect(),this.ro=null}draw(){let e=this.series.slice(0,4),t=this.format,n=this.labels,r=this.getAttribute(`height`);this.innerHTML=`<figure class="k-chart" aria-labelledby="${this.key}-t" style="margin: 0${r?`; --k-chart-height: ${o(r)}`:``}"><figcaption class="k-chart__head"><p class="k-chart__title" id="${this.key}-t">${o(this.heading)}</p>${e.length>1?`<ul class="k-chart__legend" aria-hidden="true">${e.map((e,t)=>`<li style="--_c: ${y(t)}"><span class="k-chart__key"></span>${o(e.name)}</li>`).join(``)}</ul>`:``}</figcaption><div class="k-chart__plot" tabindex="0" role="img" aria-label="${o(c().chart.keyboard(this.heading))}" aria-describedby="${this.key}-live"><svg class="k-chart__svg" aria-hidden="true" direction="ltr"></svg></div><span class="k-sr-only" aria-live="polite" id="${this.key}-live"></span><table class="k-sr-only"><caption>${o(this.heading)}</caption><thead><tr><th scope="col">${o(c().chart.period)}</th>${e.map(e=>`<th scope="col">${o(e.name)}</th>`).join(``)}</tr></thead><tbody>${n.map((n,r)=>`<tr><th scope="row">${o(n)}</th>${e.map(e=>`<td>${o(t(e.values[r]))}</td>`).join(``)}</tr>`).join(``)}</tbody></table></figure>`;let i=this.querySelector(`.k-chart__plot`);i.addEventListener(`pointermove`,e=>this.pick(e.clientX)),i.addEventListener(`pointerleave`,()=>this.setActive(null)),i.addEventListener(`blur`,()=>this.setActive(null)),i.addEventListener(`keydown`,e=>{let t=getComputedStyle(i).direction===`rtl`,r=n.length,a={ArrowLeft:t?1:-1,ArrowRight:t?-1:1}[e.key];a?(e.preventDefault(),this.setActive(Math.min(r-1,Math.max(0,(this.active??(a>0?-1:r))+a)))):e.key===`Home`?this.setActive(0):e.key===`End`?this.setActive(r-1):e.key===`Escape`&&this.setActive(null)}),this.active=null,this.paintSvg()}geometry(){let e=this.querySelector(`.k-chart__plot`),t=this.series.slice(0,4),n=this.labels,r=e.clientWidth||600,i=e.clientHeight||220,a=getComputedStyle(e).direction===`rtl`,o={top:12,bottom:24,start:52,end:t.length>1?64:16},s=_(Math.max(0,...t.flatMap(e=>e.values))),c=s.at(-1)||1,l=Math.max(1,r-o.start-o.end),u=Math.max(1,i-o.top-o.bottom);return{plot:e,shown:t,labels:n,w:r,h:i,rtl:a,pad:o,ticks:s,innerW:l,innerH:u,x:e=>{let t=n.length>1?e/(n.length-1):.5;return a?r-o.start-t*l:o.start+t*l},y:e=>o.top+u-e/c*u}}paintSvg(){if(!this.querySelector(`.k-chart__plot`))return;let{plot:e,shown:t,labels:n,w:r,h:i,rtl:a,pad:s,ticks:l,innerW:u,innerH:d,x:f,y:p}=this.geometry(),m=e.querySelector(`svg`),h=a?r-s.start+8:s.start-8,_=a?`start`:`end`,v=n.length-1,b=t.map((e,t)=>({i:t,y:p(e.values[v])})).sort((e,t)=>e.y-t.y);for(let e=1;e<b.length;e++)b[e].y-b[e-1].y<14&&(b[e].y=b[e-1].y+14);let x=Object.fromEntries(b.map(e=>[e.i,e.y])),S=Math.max(1,Math.ceil(n.length/Math.max(2,Math.floor(u/64)))),C=`${this.key}-fade`,w=this.active;m.innerHTML=`<g class="k-chart__grid">${l.map(e=>`<line x1="${s.start}" x2="${r-s.end}" y1="${p(e)}" y2="${p(e)}"${a?` transform="translate(${s.end-s.start} 0)"`:``}></line>`).join(``)}</g>${l.map(e=>`<text class="k-chart__tick" x="${h}" y="${p(e)+4}" text-anchor="${_}">${o(g(e))}</text>`).join(``)}${n.map((e,t)=>t%S===0||t===v?`<text class="k-chart__tick" x="${f(t)}" y="${i-6}" text-anchor="middle">${o(e)}</text>`:``).join(``)}<defs><linearGradient id="${C}" x1="0" y1="0" x2="0" y2="1"><stop offset="0" style="stop-color: var(--k-chart-1); stop-opacity: 0.28"></stop><stop offset="1" style="stop-color: var(--k-chart-1); stop-opacity: 0"></stop></linearGradient></defs>${t.length===1&&this.getAttribute(`area`)!==`false`?`<path class="k-chart__area" fill="url(#${C})" d="M${f(0)},${p(0)} ${t[0].values.map((e,t)=>`L${f(t)},${p(e)}`).join(` `)} L${f(v)},${p(0)} Z"></path>`:``}${w===null?``:`<line class="k-chart__cross" x1="${f(w)}" x2="${f(w)}" y1="${s.top}" y2="${s.top+d}"></line>`}${t.map((e,n)=>`<g style="--_c: ${y(n)}"><path class="k-chart__line" pathLength="1" d="${e.values.map((e,t)=>`${t?`L`:`M`}${f(t)},${p(e)}`).join(` `)}"></path><circle class="k-chart__dot" cx="${f(e.values.length-1)}" cy="${p(e.values.at(-1)??0)}" r="4"></circle>${t.length>1?`<text class="k-chart__end" x="${f(v)+(a?-8:8)}" y="${x[n]+4}" text-anchor="${a?`end`:`start`}">${o(e.name)}</text>`:``}${w===null?``:`<circle class="k-chart__dot" cx="${f(w)}" cy="${p(e.values[w])}" r="4.5"></circle>`}</g>`).join(``)}`;let T=this.format;w===null?this.tip(e,null):this.tip(e,f(w),Math.min(...t.map(e=>p(e.values[w])))-6,n[w],t.map((e,t)=>({name:e.name,value:T(e.values[w]),color:y(t)}))),this.querySelector(`#${this.key}-live`).textContent=w===null?``:`${n[w]}: ${t.map(e=>`${e.name} ${T(e.values[w])}`).join(c().common.list)}`}pick(e){let{plot:t,labels:n,x:r}=this.geometry(),i=e-t.getBoundingClientRect().left,a=0;n.forEach((e,t)=>{Math.abs(r(t)-i)<Math.abs(r(a)-i)&&(a=t)}),a!==this.active&&this.setActive(a)}setActive(e){this.active=e,this.paintSvg()}};D.observedAttributes=[`label`,`labels`,`series`,`unit`,`area`,`height`];var O=class extends x{get data(){return this.read(`data`,{})}set data(e){this.write(`data`,e)}draw(){let e=this.data,s=Number(this.getAttribute(`year`))||t(/* @__PURE__ */ new Date).jy,l=c().heatmap,u=this.getAttribute(`unit`)??l.unit,h=[];for(let t=1;t<=12;t++)for(let r=1;r<=f(s,t);r++){let i=d(s,t,r);h.push({date:i,value:e[n(i)]??0})}let g=Math.max(0,...h.map(e=>e.value)),_=e=>e<=0||g===0?0:Math.max(1,Math.ceil(e/g*4)),v=(h[0].date.getDay()+1)%7,y=e=>Math.floor((e+v)/7),b=r().months.map((e,n)=>({name:e,col:y(h.findIndex(e=>t(e.date).jm===n+1))})),x=h.reduce((e,t)=>e+t.value,0),S=r().months.map((e,n)=>({name:e,sum:h.filter(e=>t(e.date).jm===n+1).reduce((e,t)=>e+t.value,0)})),C=m(s).replace(/[٬,]/g,``),w=this.getAttribute(`label`)??l.inYear(u,C);this.innerHTML=`<figure class="k-heatmap" style="margin: 0"><div class="k-heatmap__scroll"><div role="img" aria-label="${o(`${w}: ${m(x)} ${u}`)}"><div class="k-heatmap__months" aria-hidden="true">${b.map(e=>`<span style="grid-column: ${e.col+1}">${e.name}</span>`).join(``)}</div><div class="k-heatmap__body" aria-hidden="true"><div class="k-heatmap__days">${l.weekdays.map(e=>`<span>${e}</span>`).join(``)}</div><div class="k-heatmap__grid">${`<span class="k-heatmap__cell" data-empty=""></span>`.repeat(v)}${h.map((e,t)=>`<span class="k-heatmap__cell" data-l="${_(e.value)}" data-i="${t}"></span>`).join(``)}</div></div></div></div><figcaption class="k-heatmap__foot"><span>${o(l.total(m(x),u,C))}</span><span class="k-heatmap__scale" aria-hidden="true">${o(l.less)} ${[0,1,2,3,4].map(e=>`<span class="k-heatmap__cell" data-l="${e}"></span>`).join(``)} ${o(l.more)}</span></figcaption><table class="k-sr-only"><caption>${o(l.byMonth(w))}</caption><tbody>${S.map(e=>`<tr><th scope="row">${e.name}</th><td>${m(e.sum)}</td></tr>`).join(``)}</tbody></table></figure>`;let T=this.querySelector(`figure`);this.querySelector(`.k-heatmap__grid`).addEventListener(`pointerover`,e=>{let t=e.target.closest(`[data-i]`);if(T.querySelector(`.k-heatmap__cell[data-active]`)?.removeAttribute(`data-active`),!t)return this.tip(T,null);t.setAttribute(`data-active`,``);let n=this.at(t,T),r=h[Number(t.dataset.i)];this.tip(T,n.x,n.y-2,p(r.date,{style:`full`,digits:a(),locale:i()}),[{value:`${m(r.value)} ${u}`}])}),T.addEventListener(`pointerleave`,()=>this.tip(T,null))}};O.observedAttributes=[`data`,`year`,`unit`,`label`],s(`kashi-bar-chart`,S,`block`),s(`kashi-line-chart`,D,`block`),s(`kashi-pie-chart`,T,`block`),s(`kashi-bar-list`,C,`block`),s(`kashi-proportion-bar`,w,`block`),s(`kashi-sparkline`,E),s(`kashi-activity-heatmap`,O,`block`);export{O as KashiActivityHeatmap,S as KashiBarChart,C as KashiBarList,D as KashiLineChart,T as KashiPieChart,w as KashiProportionBar,E as KashiSparkline};
@@ -0,0 +1 @@
1
+ import{_ as e,c as t,g as n,l as r,m as i,o as a,p as o,r as s,t as c,u as l,v as u}from"./base-DTQ50VdG.js";import{n as d}from"./text-D4a_hlwL.js";const f=[{name:`آذربایجان شرقی`,capital:`تبریز`,areaCode:`41`},{name:`آذربایجان غربی`,capital:`ارومیه`,areaCode:`44`},{name:`اردبیل`,capital:`اردبیل`,areaCode:`45`},{name:`اصفهان`,capital:`اصفهان`,areaCode:`31`},{name:`البرز`,capital:`کرج`,areaCode:`26`},{name:`ایلام`,capital:`ایلام`,areaCode:`84`},{name:`بوشهر`,capital:`بوشهر`,areaCode:`77`},{name:`تهران`,capital:`تهران`,areaCode:`21`},{name:`چهارمحال و بختیاری`,capital:`شهرکرد`,areaCode:`38`},{name:`خراسان جنوبی`,capital:`بیرجند`,areaCode:`56`},{name:`خراسان رضوی`,capital:`مشهد`,areaCode:`51`},{name:`خراسان شمالی`,capital:`بجنورد`,areaCode:`58`},{name:`خوزستان`,capital:`اهواز`,areaCode:`61`},{name:`زنجان`,capital:`زنجان`,areaCode:`24`},{name:`سمنان`,capital:`سمنان`,areaCode:`23`},{name:`سیستان و بلوچستان`,capital:`زاهدان`,areaCode:`54`},{name:`فارس`,capital:`شیراز`,areaCode:`71`},{name:`قزوین`,capital:`قزوین`,areaCode:`28`},{name:`قم`,capital:`قم`,areaCode:`25`},{name:`کردستان`,capital:`سنندج`,areaCode:`87`},{name:`کرمان`,capital:`کرمان`,areaCode:`34`},{name:`کرمانشاه`,capital:`کرمانشاه`,areaCode:`83`},{name:`کهگیلویه و بویراحمد`,capital:`یاسوج`,areaCode:`74`},{name:`گلستان`,capital:`گرگان`,areaCode:`17`},{name:`گیلان`,capital:`رشت`,areaCode:`13`},{name:`لرستان`,capital:`خرم‌آباد`,areaCode:`66`},{name:`مازندران`,capital:`ساری`,areaCode:`11`},{name:`مرکزی`,capital:`اراک`,areaCode:`86`},{name:`هرمزگان`,capital:`بندرعباس`,areaCode:`76`},{name:`همدان`,capital:`همدان`,areaCode:`81`},{name:`یزد`,capital:`یزد`,areaCode:`35`}],p={"آذربایجان شرقی":/* @__PURE__ */ `آبشاحمد.آچاچی.آذرشهر.آقکند.اسکو.اهر.ایلخچی.باسمنج.بخشایش.بستان‌آباد.بناب.بناب مرند.تبریز.ترک.ترکمانچای.تسوج.تیکمهداش.تیمورلو.جلفا.جوانقلعه.خاروانا.خامنه.خداجو.خسروشاه.خمارلو.خواجه.دریان.دوزدوزان.زرنق.زنوز.سراب.سردرود.سهند.سیس.سیهرود.شبستر.شربیان.شرفخانه.شندآباد.شهریار.صوفیان.عجبشیر.قرهآغاج.کشکسرای.کلوانق.کلیبر.کوزهکنان.گوگان.لیلان.مبارک آباد.مراغه.مرند.ملکان.ملککیان.ممقان.مهربان.میانه.نظرکهریزی.وایقان.ورزقان.هادی‌شهر.هریس.هشترود.هوراند.یامچی`.split(`.`),"آذربایجان غربی":/* @__PURE__ */ `آواجیق.ارومیه.اشنویه.ایواوغلی.باروق.بازرگان.بوکان.پلدشت.پیرانشهر.تازه‌شهر.تکاب.چهاربرج.خلیفان.خوی.دیزج دیز.ربط.زرآباد.سردشت.سرو.سلماس.سیلوانه.سیمینه.سیهچشمه.شاهیندژ.شوط.فیرورق.قرهضیاءالدین.قطور.قوشچی.کشاورز.گردکشانه.ماکو.محمدیار.محمودآباد.مرگنلر.مهاباد.میاندوآب.میرآباد.نازک علیا.نالوس.نقده.نوشینشهر`.split(`.`),اردبیل:[`آبیبیگلو`,`اردبیل`,`اسلام‌آباد قدیم`,`اصلاندوز`,`انگوت`,`بیلهسوار`,`پارس‌آباد`,`جعفرآباد`,`خلخال`,`رضی`,`سرعین`,`عنبران`,`قصابه`,`کلور`,`کوراییم`,`گرمی`,`گیوی`,`لاهرود`,`مرادلو`,`مشگینشهر`,`نمین`,`نیر`,`هشجین`,`هیر`],اصفهان:/* @__PURE__ */ `آران و بیدگل.ابریشم.ابوزیدآباد.اردستان.اژیه.اشترجان.اصغرآباد.اصفهان.افوس.انارک.بادرود.باغ بهادران.باغشاد.بافران.برزک.برفانبار.بوئین و میاندشت.بهارانشهر.بهارستان.پیربکران.تودشک.تیران.جندق.جوزدان.جوشقان قالی.جوشقان و کامو.چادگان.چرمهین.چمگردان.حبیب آباد برخوار.حسن‌آباد.حنا.خالدآباد.خمینی‌شهر.خوانسار.خور.خوراسگان.خورزوق.داران.دامنه.درچهپیاز.دستگرد.دولت‌آباد.دهاقان.دهق.دیزیچه.رزوه.رضوانشهر.زازران.زایندهرود.زرینشهر.زواره.زیار.زیباشهر.سده لنجان.سفیدشهر.سگزی.سمیرم.سین.شاپورآباد.شاهینشهر.شهر جدید مجلسی.شهرضا.طالخونچه.طرق.عسگران.علویجه.فرخی.فریدونشهر.فلاورجان.فولادشهر.قمصر.قهجاورستان.قهدریجان.کاشان.کرکوند.کلیشاد و سودرجان.کمشجه.کمه.کوشک.کوهپایه.کهریزسنگ.گرگاب.گز.گلپایگان.گلدشت.گلشن.گلشهر.گوگد.لای بید.مبارکه.محمدآباد.مشکات.منظریه.مهاباد.میمه.نائین.نجف‌آباد.نصرآباد.نطنز.نوش‌آباد.نیاسر.نیک‌آباد.ورزنه.ورنامخواست.وزوان.ونک.هرند.یزدانشهر نجف آباد`.split(`.`),البرز:[`آسارا`,`اشتهارد`,`تنکمان`,`چهارباغ`,`طالقان`,`فردیس`,`کرج`,`کمالشهر`,`کوهسار`,`گرمدره`,`گلسار`,`ماهدشت`,`محمدشهر`,`مشکیندشت`,`مهستان`,`نظرآباد`],ایلام:/* @__PURE__ */ `آبدانان.آسمان‌آباد.ارکواز.ایلام.ایوان.بدره.بلاوه تره سفلی.پهله.توحید.جعفرآباد.چشمه شیرین.چوار.دره‌شهر.دلگشا.دهلران.زرنه.سرابباغ.سرابله.شباب.صالح‌آباد.لومار.ماژین.مورموری.موسیان.مهر.مهران.میمه`.split(`.`),بوشهر:/* @__PURE__ */ `آباد.آبپخش.آبدان.امام حسن.انارستان.اهرم.بادوله.برازجان.بردخون.بردستان.بندر دیر.بندر دیلم.بندر ریگ.بندر سیراف.بندر کنگان.بندر گناوه.بندو.بنک.بوشکان.بوشهر.تنگ ارم.جم.چغادک.خارگ.خورموج.دالکی.دلوار.دوراهک.ریز.سعدآباد.شبانکاره.شنبه.عالی‌شهر.عسلویه.کاکی.کلمه.نخل تقی.وحدتیه`.split(`.`),تهران:/* @__PURE__ */ `آبسرد.آبعلی.احمدآباد مستوفی.ارجمند.اسلامشهر.اندیشه.باغستان.باقرشهر.بومهن.پاکدشت.پردیس.پرند.پیشوا.تهران.جلیل‌آباد.جوادآباد.چهاردانگه.حسن‌آباد.خاورشهر.دماوند.رباطکریم.رودهن.شاهدشهر.شریف‌آباد.شمشک.شهر ری.شهریار.صالحیه.صباشهر.صفادشت.فردوسیه.فرون‌آباد.فشم.فیروزکوه.قدس.قرچک.کرشته.کهریزک.کیلان.گلستان.لواسان.ملارد.نسیم‌شهر.نصیرشهر.وحیدیه.ورامین`.split(`.`),"چهارمحال و بختیاری":/* @__PURE__ */ `آلونی.اردل.باباحیدر.بروجن.بلداجی.بن.پردنجان.تلورد.جونقان.چالشتر.چلگرد.چلیچه.دستنا.دشتک.سامان.سرخون.سردشت.سفیددشت.سودجان.سورشجان.شلمزار.شهرکرد.صمصامی.طاقانک.فارسان.فرادنبه.فرخشهر.کاج.کیان.گندمان.گوجان.گهرو.لردگان.مالخلیفه.منج نسا.ناغان.نافچ.وردنجان.هارونی.هرچگان.هفشجان.یانچشمه`.split(`.`),"خراسان جنوبی":/* @__PURE__ */ `آرینشهر.آیسک.ارسک.اسدیه.اسفدن.اسلامیه.باغستان علیا.بشرویه.بیرجند.حاجی‌آباد.خضری دشتبیاض.خوسف.درح.دیهوک.زهان.سرایان.سربیشه.سهقلعه.شوسف.طبس.طبس مسینا.عشق‌آباد.فردوس.قائن.قهستان.گزیک.محمدشهر.مود.نهبندان.نیمبلوک`.split(`.`),"خراسان رضوی":/* @__PURE__ */ `احمدآباد.انابد.باجگیران.باخرز.بار.بایگ.بجستان.بردسکن.بیدخت.بینالود.تایباد.تربت جام.تربت حیدریه.جغتای.جنگل.چاپشلو.چکنه.چناران.خرو.خلیل‌آباد.خواف.داورزن.دررود.درگز.دولت‌آباد.رادکان.رباط سنگ.رشتخوار.رضویه.رودآب.ریوش.سبزوار.سرخس.سفیدسنگ.سلامی.سلطان‌آباد.سنگان.سیدآباد.شادمهر.شاندیز.ششتمد.شهرآباد.شهرزو.شهرکهنه.صالح‌آباد.طرقبه.عشق‌آباد.فرگ قلعه.فرهادگرد.فریمان.فیروزه.فیض‌آباد.قاسم‌آباد.قدمگاه.قلندرآباد.قوچان.کاخک.کاریز.کاشمر.کدکن.کلات.کندر.گلبهار.گلمکان.گناباد.لطف‌آباد.مزداوند.مشهد.مشهد ریزه.ملک‌آباد.نسر.نشتیفان.نصرآباد.نقاب.نوخندان.نیشابور.نیلشهر.همت‌آباد.یونسی`.split(`.`),"خراسان شمالی":[`آشخانه`,`آوا`,`اسفراین`,`ایور`,`بجنورد`,`پیشقلعه`,`تیتکانلو`,`جاجرم`,`چنارانشهر`,`حصار گرمخان`,`درق`,`راز`,`زیارت`,`سنخواست`,`شوقان`,`شیروان`,`صفی‌آباد`,`فاروج`,`فیروزه`,`قاضی`,`گرمه`,`لوجلی`],خوزستان:/* @__PURE__ */ `آبادان.آبژدان.آغاجاری.ابوحمیظه.اروندکنار.الوان.الهایی.امیدیه.اندیمشک.اهواز.ایذه.باغملک.بستان.بندر امام خمینی.بندر ماهشهر.بهبهان.بیدروبهمرکزی.ترکالکی.تشان.جایزان.جنتمکان.چغامیش.چم گلک.چمران.چویبده.حر ریاحی.حسینیه.حمیدیه.خرمشهر.دارخوین.دزآب.دزفول.دهدز.رامشیر.رامهرمز.رفیع.زهره.سالند.سردشت.سماله.سوسنگرد.سیاهمنصور.شادگان.شمس‌آباد.شوش.شوشتر.شهرک حمزه.شیبان.صالح شهر.صفی‌آباد.صیدون.فتح‌المبین.قلعه خواجه.قلعهتل.کوت سیدنعیم طالقانی.کوت عبدالله.گتوند.گوریه.لالی.مسجدسلیمان.مشراگه.مقاومت.ملاثانی.منصوریه.میانرود.میانکوه.میداود.مینوشهر.ویس.هفتکل.هندیجان.هویزه`.split(`.`),زنجان:[`آببر`,`ابهر`,`ارمغانخانه`,`چورزق`,`حلب`,`خرمدره`,`دندی`,`زرین‌آباد`,`زرینرود`,`زنجان`,`سجاس`,`سلطانیه`,`سهرورد`,`صایینقلعه`,`قیدار`,`کرسف`,`گرماب`,`ماهنشان`,`نیکپی`,`هیدج`],سمنان:[`آرادان`,`امیریه`,`ایوانکی`,`بسطام`,`بیارجمند`,`دامغان`,`درجزین`,`دیباج`,`رودیان`,`سرخه`,`سمنان`,`شاهرود`,`شهمیرزاد`,`کلاته خیج`,`کلاته رودبار`,`کهن‌آباد`,`گرمسار`,`مجن`,`مهدی‌شهر`,`میامی`],"سیستان و بلوچستان":/* @__PURE__ */ `آسپیچ محمدی.ادیمی.اسپکه.ایرانشهر.بریس.بزمان.بمپور.بنت.بنجار.پیشین.جالق.چابهار.خاش.دوستمحمد.راسک.رامشار.زابل.زاهدان.زرآباد.زهک.سراوان.سرباز.سوران.سیب.سیرکان.شهرک علیاکبر.فنوج.قصرقند.کنارک.گشت.گلمورتی.محمدآباد.مهرستان.میرجاوه.نصرت‌آباد.نگور.نوک‌آباد.نیکشهر.هیدوچ`.split(`.`),فارس:/* @__PURE__ */ `آباده.آباده طشک.ارد.اردکان.ارسنجان.استهبان.اسیر.اشکنان.افزر.اقلید.اوز.اهل.ایج.ایزدخواست.باب انار.بابامنیر.بایگان.بنارویه.بوانات.بهمن.بیرم.بیضا.جنتشهر.جویم.جهرم.حاجی‌آباد.حسامی.حسن‌آباد.خانه زنیان.خانیمن.خاوران.خرامه.خشت.خنج.خور.خوزی.خومهزار.داراب.داریان.دبیران.دژکرد.دوبرجی.دوزه.دهرم.رامجرد.رونیز.زاهدشهر.زرقان.سده.سروستان.سعادتشهر.سلطانشهر.سورمق.سیدان.ششده.شهر جدید صدرا.شهرپیر.شهرک امام.شیراز.صغاد.صفاشهر.علامرودشت.عمادشهر.فاروق.فتح آباد.فدامی.فراشبند.فسا.فیروزآباد.فیشور.قائمیه.قادرآباد.قرهبلاغ.قطب‌آباد.قطرویه.قیر.کازرون.کامفیروز.کرهای.کنارتخته.کوار.کوپن.کوهنجان.گراش.گلهدار.گویم.لار.لامرد.لپوئی.لطیفی.مادرسلیمان.مرودشت.مزایجان.مشکان.مصیری.مهر.میانشهر.میمند.نوبندگان.نوجین.نودان.نورآباد.نیریز.والاشهر.وراوی.هماشهر`.split(`.`),قزوین:[`آبگرم`,`آبیک`,`آوج`,`ارداق`,`اسفرورین`,`اقبالیه`,`الوند`,`بوئینزهرا`,`بیدستان`,`تاکستان`,`خاکعلی`,`خرمدشت`,`دانسفهان`,`رازمیان`,`سگزآباد`,`سیردان`,`شال`,`ضیاءآباد`,`قزوین`,`کوهین`,`محمدیه`,`محمودآباد نمونه`,`معلمکلایه`,`نرجه`],قم:[`جعفریه`,`دستجرد`,`سلفچگان`,`قاهان`,`قم`,`قنوات`,`کهک`],کردستان:/* @__PURE__ */ `آرمرده.اورامان.بابارشانی.بانه.برده رشه.بلبان‌آباد.بویین سفلی.بیجار.پیرتاج.توپآغاج.چناره.حسن‌آباد یاسوکند.دزج.دلبران.دهگلان.دیواندره.زرینه.سروآباد.سریش‌آباد.سقز.سنندج.شویشه.صاحب.قروه.کامیاران.کانیدینار.کانیسور.مریوان.موچش`.split(`.`),کرمان:/* @__PURE__ */ `اختیارآباد.ارزوئیه.امینشهر.انار.اندوهجرد.باغین.بافت.بردسیر.بروات.بزنجان.بلورد.بلوک.بم.بهرمان.پاریز.جبالبارز.جوپار.جوزم.جیرفت.چترود.خاتون‌آباد.خانوک.خرسند.خواجو شهر.درب بهشت.دشتکار.دوساری.دهج.دهستان بزنجان.رابر.راور.راین.رفسنجان.ریحانشهر.زرند.زنگی‌آباد.زهکلوت.زیدآباد.سیرجان.سیریز.شهداد.شهربابک.صفائیه.عنبرآباد.فاریاب.فهرج.قلعهگنج.کاظم‌آباد.کرمان.کشکوئیه.کوهبنان.کهنوج.کیانشهر.گلباف.گلزار.لاله زار.ماهان.محمدآباد.محمدآباد گنبکی.محی‌آباد.مردهک.مس سرچشمه.منوجان.نجفشهر.نرماشیر.نظامشهر.نگار.نودژ.هجدک.هماشهر.هنزا.یزدانشهر`.split(`.`),کرمانشاه:/* @__PURE__ */ `ازگله.اسلام‌آباد غرب.بانهوره.باینگان.بیستون.پاوه.تازه‌آباد.جوانرود.حمیل.روانسر.ریژاو.سرپل ذهاب.سرمست.سطر.سنقر.سومار.شروینه.صحنه.قصر شیرین.قلعه.کرمانشاه.کرند غرب.کنگاور.کوزران.گودین.گهواره.گیلانغرب.ماهیدشت.میانراهان.نودشه.نوسود.هرسین.هلشی`.split(`.`),"کهگیلویه و بویراحمد":[`باشت`,`پاتاوه`,`چرام`,`چیتاب`,`دوگنبدان`,`دهدشت`,`دیشموک`,`سوق`,`سیسخت`,`قلعه رئیسی`,`گراب سفلی`,`لنده`,`لیکک`,`مادوان علیا`,`مارگون`,`محله چینیها`,`یاسوج`],گلستان:/* @__PURE__ */ `آزادشهر.آققلا.انبارآلوم.اینچهبرون.بندر ترکمن.بندر گز.تاتار علیا.خانببین.دلند.رامیان.سرخنکلاته.سنگدوین.سیمینشهر.علی‌آباد کتول.فاضل‌آباد.فراغی.قرق.کردکوی.کلاله.گالیکش.گرگان.گمیشان.گنبد کاووس.مراوهتپه.مزرعه.مینودشت.نگینشهر.نوده خاندوز.نوکنده`.split(`.`),گیلان:/* @__PURE__ */ `آستارا.آستانه اشرفیه.احمدسرگوراب.اسالم.اطاقور.املش.بازارجمعه.برهسر.بندر انزلی.بندر کیاشهر.پرهسر.توتکابن.جیرنده.چابکسر.چاف و چمخاله.چوبر.حویق.خشکبیجار.خمام.دیلمان.رانکوه.رحیم‌آباد.رستم‌آباد.رشت.رضوانشهر.رودبار.رودبنه.رودسر.سنگر.سیاهکل.شفت.شلمان.صومعهسرا.فومن.کلاچای.کوچصفهان.کومله.گوراب زرمیخ.لاهیجان.لشت نشا.لنگرود.لوشان.لولمان.لوندویل.لیسار.ماسال.ماسوله.ماکلوان.مرجغل.منجیل.واجارگاه.هشتپر`.split(`.`),لرستان:[`ازنا`,`اشترینان`,`الشتر`,`الیگودرز`,`بروجرد`,`بیرانشهر`,`پل دختر`,`چالانچولان`,`چقابل`,`خرم‌آباد`,`درب گنبد`,`دورود`,`زاغه`,`سپیددشت`,`سرابدوره`,`شول‌آباد`,`فیروزآباد`,`کونانی`,`کوهدشت`,`گراب لکستان`,`معمولان`,`مومن‌آباد`,`نورآباد`,`ویسیان`,`هفتچشمه`],مازندران:/* @__PURE__ */ `آلاشت.آمل.ارطه.اکند.امامزاده عبدالله.امیرکلا.ایزدشهر.بابل.بابلسر.بلده.بهشهر.بهنمیر.پایین هولار.پل سفید.پول.تنکابن.جویبار.چالوس.چمستان.خرم‌آباد.خلیلشهر.خوشرودپی.دابودشت.رامسر.رستمکلا.رویان.رینه.زرگرمحله.زیرآب.ساری.سرخرود.سلمانشهر.سورک.شیرگاه.شیرود.طبقده.عباس‌آباد.فرح‌آباد.فریدونکنار.فریم.قائمشهر.کتالم و ساداتشهر.کجور.کلارآباد.کلاردشت.کلهبست.کوهیخیل.کیاسر.کیاکلا.گتاب.گزنک.گلوگاه.محمودآباد.مرزن‌آباد.مرزیکلا.نشتارود.نکا.نمکآبرود.نور.نوشهر.هچیرود`.split(`.`),مرکزی:/* @__PURE__ */ `آستانه.آشتیان.آوه.اراک.پرندک.تفرش.توره.جاورسیان.خشکرود.خمین.خنجین.خنداب.داوودآباد.دلیجان.رازقان.زاویه.ساروق.ساوه.سنجان.شازند.شهباز.شهر جدید امیرکبیر.غرق‌آباد.فرمهین.قورچیباشی.کارچان.کرهرود.کمیجان.مأمونیه.محلات.مهاجران.میلاجرد.نراق.نوبران.نیمور.هندودر`.split(`.`),هرمزگان:/* @__PURE__ */ `ابوموسی.بستک.بندر چارک.بندر خمیر.بندر کنگ.بندر لافت.بندر لنگه.بندرعباس.بیکا.پارسیان.تازیان پایین.تخت.تنب بزرگ.تیرور.جاسک.جناح.حاجی‌آباد.درگهان.دشتی.دهبارز.رویدر.زیارتعلی.سردشت.سرگز احمدی.سندرک.سوزا.سیریک.طبل.فارغان.فین.قشم.قلعه قاضی.کوخردهرنگ.کوهستک.کوهیج.کیش.گروک.گوهران.لمزان.میناب.هرمز.هشتبندی`.split(`.`),همدان:/* @__PURE__ */ `آجین.ازندریان.اسدآباد.برزول.بهار.تویسرکان.جورقان.جوکار.داقداق‌آباد.دمق.دهستان سلگی.رزن.زنگنه.سامن.سرکان.شیرینسو.صالح‌آباد.فامنین.فرسفج.فیروزان.قروه درجزین.قهاوند.کبودرآهنگ.گلتپه.گیان.لالجین.مریانج.ملایر.مهاجران.نهاوند.همدان`.split(`.`),یزد:[`ابرکوه`,`احمدآباد`,`اردکان`,`اشکذر`,`بافق`,`بخ`,`بفروییه`,`بهاباد`,`تفت`,`حمیدیا`,`خضرآباد`,`رضوانشهر`,`زارچ`,`شاهدیه`,`عقدا`,`مروست`,`مهردشت`,`مهریز`,`میبد`,`ندوشن`,`نیر`,`هرات`,`یزد`]};function m(e){return e&&p[e]||[]}const h={province:null,city:null,street:``,plaque:``,unit:``,postalCode:``},g=e=>d(e,{digits:`latin`}).toLowerCase();var _=class extends c{constructor(){super(...arguments),this.selected=null,this.query=``,this.list=null,this.filtered=[],this.typing=!1,this.isOpen=!1,this.active=-1,this.rendered=!1,this.valueSet=!1,this.key=u(`kashi-combo`),this.onOutside=e=>{this.contains(e.target)||this.close()}}get defaultLabel(){return null}get defaultPlaceholder(){return``}connectedCallback(){s(()=>{if(this.isConnected){if(!this.rendered){if(this.list===null&&(this.list=this.readOptions()),Object.prototype.hasOwnProperty.call(this,`value`)){let e=this.value;delete this.value,this.value=e??``}else if(!this.valueSet){let e=this.getAttribute(`value`);this.selected=e?this.find(e):null,this.query=this.selected?.label??``}}this.render()}})}disconnectedCallback(){document.removeEventListener(`pointerdown`,this.onOutside)}attributeChangedCallback(e,t,n){this.rendered&&t!==n&&(e===`value`?this.value=n??``:this.render())}get options(){return this.list??[]}set options(e){this.list=[...e],this.selected&&=this.find(this.selected.value),this.rendered&&this.sync()}get value(){return this.selected?.value??``}set value(e){this.valueSet=!0,this.selected=e?this.find(e):null,this.query=this.selected?.label??``,this.typing=!1,this.rendered&&this.sync()}get selectedOption(){return this.selected}focus(e){this.input?.focus(e)}readOptions(){let e=[];for(let t of[...this.querySelectorAll(`:scope > option, :scope > optgroup > option`)]){let n=t.parentElement?.tagName===`OPTGROUP`?t.parentElement.getAttribute(`label`)??void 0:void 0;e.push({value:t.value,label:t.textContent?.trim()??t.value,description:t.dataset.description,keywords:t.dataset.keywords?.split(/[,،]\s*/),disabled:t.disabled,group:n})}for(let e of[...this.querySelectorAll(`:scope > option, :scope > optgroup`)])e.remove();return e}source(e){return this.options}accepts(e,t){let n=g(t.trim());return!n||[e.label,e.description??``,...e.keywords??[]].some(e=>g(e).includes(n))}find(e){return this.source(``).find(t=>t.value===e)??null}detail(){return{value:this.value,option:this.selected}}render(){let e=this.key,n=this.getAttribute(`aria-label`),i=this.hasAttribute(`label`)?this.getAttribute(`label`):n?null:this.defaultLabel,a=this.hasAttribute(`required`),s=this.hasAttribute(`disabled`),c=`${e}-list`,u=`<div class="k-combobox"><div class="k-input"${s?` data-state="disabled"`:``}><input id="${e}" class="k-input__control" type="text" role="combobox" aria-autocomplete="list" aria-expanded="false" aria-controls="${c}" autocomplete="off" placeholder="${r(this.getAttribute(`placeholder`)??this.defaultPlaceholder)}"${a?` required`:``}${s?` disabled`:``}${!i&&n?` aria-label="${r(n)}"`:``}><button type="button" tabindex="-1" class="k-input__action k-combobox__toggle" aria-label="${r(o().combobox.toggle)}"${s?` disabled`:``}><svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 8 4 4 4-4"/></svg></button></div><ul id="${c}" role="listbox" class="k-listbox" hidden style="inset-block-start: calc(100% + 6px)"${i?` aria-label="${r(i)}"`:` aria-labelledby="${e}"`}></ul><span class="k-sr-only" aria-live="polite"></span></div>`;this.querySelector(`:scope > .k-field`)?.remove(),this.insertAdjacentHTML(`afterbegin`,l({id:e,label:i,required:a,control:u})),this.input=this.querySelector(`input.k-input__control`),this.listbox=this.querySelector(`.k-listbox`),this.live=this.querySelector(`.k-combobox > .k-sr-only`),this.isOpen=!1,this.input.addEventListener(`input`,()=>{this.query=this.input.value,this.typing=!0,this.active=-1,this.open(!1),t(this,`kashi-input`,{query:this.query})}),this.input.addEventListener(`keydown`,e=>this.onKey(e)),this.input.addEventListener(`click`,()=>!this.isOpen&&this.open()),this.input.addEventListener(`blur`,e=>{this.contains(e.relatedTarget)||this.close()}),this.querySelector(`.k-combobox__toggle`).addEventListener(`click`,()=>{this.isOpen?this.close():(this.typing=!1,this.open(),this.input.focus())}),this.listbox.addEventListener(`pointerdown`,e=>e.preventDefault()),this.listbox.addEventListener(`click`,e=>{let t=e.target.closest(`[role="option"]`);t&&t.getAttribute(`aria-disabled`)!==`true`&&this.commit(this.filtered[Number(t.dataset.i)])}),this.listbox.addEventListener(`pointermove`,e=>{let t=e.target.closest(`[role="option"]`);t&&t.getAttribute(`aria-disabled`)!==`true`&&Number(t.dataset.i)!==this.active&&this.setActive(Number(t.dataset.i))}),this.rendered=!0,this.sync()}sync(){!this.typing&&this.input.value!==this.query&&(this.input.value=this.query),n(this.querySelector(`:scope > .k-field`),this.input,this.key,this.getAttribute(`error`),this.getAttribute(`hint`)),this.syncHidden(),this.isOpen&&this.renderList()}syncHidden(){e(this,this.getAttribute(`name`),this.value)}enabled(){return this.filtered.map((e,t)=>e.disabled?-1:t).filter(e=>e>=0)}open(e=!0,t=`selected`){if(!this.hasAttribute(`disabled`)){if(this.isOpen=!0,this.input.setAttribute(`aria-expanded`,`true`),this.listbox.hidden=!1,this.toggleAttribute(`data-open`,!0),this.querySelector(`.k-combobox`).setAttribute(`data-open`,``),this.filter(),e){let e=this.enabled(),n=this.filtered.findIndex(e=>e.value===this.selected?.value);this.active=t===`last`?e.at(-1)??-1:t===`first`||n<0?e[0]??-1:n}this.renderList(),document.addEventListener(`pointerdown`,this.onOutside)}}close(){this.rendered&&(this.isOpen=!1,this.input.setAttribute(`aria-expanded`,`false`),this.input.removeAttribute(`aria-activedescendant`),this.listbox.hidden=!0,this.querySelector(`.k-combobox`).removeAttribute(`data-open`),this.live.textContent=``,document.removeEventListener(`pointerdown`,this.onOutside),this.typing&&(this.typing=!1,this.query=this.selected?.label??``,this.input.value=this.query))}filter(){let e=this.source(this.typing?this.query:``);this.filtered=this.typing?e.filter(e=>this.accepts(e,this.query)):e}renderList(){let e=this.typing?g(this.query.trim()):``,t=t=>{let n=e?g(t).indexOf(e):-1;return n<0?r(t):`${r(t.slice(0,n))}<mark>${r(t.slice(n,n+e.length))}</mark>${r(t.slice(n+e.length))}`},n=`${this.key}-list`,a,s=this.filtered.slice(0,300).map((e,i)=>{let o=e.group&&e.group!==a?`<li role="presentation" class="k-listbox__group">${r(e.group)}</li>`:``;a=e.group;let s=e.value===this.selected?.value;return`${o}<li id="${n}-${i}" data-i="${i}" role="option" aria-selected="${s}"${e.disabled?` aria-disabled="true"`:``}${i===this.active?` data-active`:``} class="k-option"><span class="k-option__body"><span>${t(e.label)}</span>${e.description?`<span class="k-option__desc">${r(e.description)}</span>`:``}</span>${s?`<span class="k-option__check"><svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m5 10.5 3.2 3L15 7"/></svg></span>`:``}</li>`});this.filtered.length||s.push(`<li class="k-listbox__empty" role="presentation">${r(this.getAttribute(`empty-message`)??o().common.noResults)}</li>`),this.filtered.length>300&&s.push(`<li class="k-listbox__empty" role="presentation">${r(o().combobox.more(i(this,this.filtered.length-300)))}</li>`),this.listbox.innerHTML=s.join(``),this.live.textContent=this.typing?o().common.results(i(this,this.filtered.length)):``,this.setActive(this.active)}setActive(e){this.active=e,this.listbox.querySelector(`[data-active]`)?.removeAttribute(`data-active`);let t=e>=0?this.listbox.querySelector(`[data-i="${e}"]`):null;t?(t.setAttribute(`data-active`,``),t.scrollIntoView?.({block:`nearest`}),this.input.setAttribute(`aria-activedescendant`,t.id)):this.input.removeAttribute(`aria-activedescendant`)}move(e){let t=this.enabled().filter(e=>e<300);if(!t.length)return;let n=t.indexOf(this.active);this.setActive(t[(n+e+t.length)%t.length])}onKey(e){if(e.key===`ArrowDown`)e.preventDefault(),this.isOpen?this.move(1):this.open(!0,e.altKey?`selected`:`first`);else if(e.key===`ArrowUp`)e.preventDefault(),this.isOpen?this.move(-1):this.open(!0,`last`);else if(e.key===`Enter`&&this.isOpen&&this.active>=0)e.preventDefault(),this.commit(this.filtered[this.active]);else if(e.key===`Escape`)this.isOpen?(e.preventDefault(),this.close()):this.input.value&&(e.preventDefault(),this.commit(null));else if((e.key===`Home`||e.key===`End`)&&this.isOpen){e.preventDefault();let t=this.enabled();this.setActive((e.key===`Home`?t[0]:t.at(-1))??-1)}}commit(e){let n=(e?.value??null)!==(this.selected?.value??null);this.selected=e,this.query=e?.label??``,this.typing=!1,this.input.value=this.query,this.close(),this.sync(),n&&t(this,`kashi-change`,this.detail())}};_.observedAttributes=[`label`,`hint`,`error`,`placeholder`,`required`,`disabled`,`name`,`value`,`empty-message`,`aria-label`];var v=class extends _{get defaultLabel(){return o().province.label}get defaultPlaceholder(){return o().province.search}source(){let e=this.getAttribute(`show-capital`)!==`false`;return f.map(t=>({value:t.name,label:t.name,description:e?o().province.capital(t.capital):void 0,keywords:[t.capital]}))}detail(){return{value:this.value,province:f.find(e=>e.name===this.value)??null}}};v.observedAttributes=[..._.observedAttributes,`show-capital`];const y=e=>g(e).replace(/[\s‌]/g,``);var b=class extends _{constructor(){super(...arguments),this.custom=null}get defaultLabel(){return o().city.label}get defaultPlaceholder(){return this.placeholderText()}get province(){return this.getAttribute(`province`)||null}set province(e){e?this.setAttribute(`province`,e):this.removeAttribute(`province`)}get value(){return this.selected?this.selected.value.split(`|`)[1]:``}set value(e){this.valueSet=!0,this.custom=null;let t=this.source(``),n=this.province,r=e?t.find(t=>t.label===e&&(!n||t.value.startsWith(`${n}|`)))??null:null;e&&!r&&(this.custom=e,r={value:`custom|${e}`,label:e,description:o().city.outside}),this.selected=r,this.query=r?.label??``,this.isConnected&&this.querySelector(`.k-combobox`)&&this.sync()}find(e){return this.value=e,this.selected}attributeChangedCallback(e,t,n){if(e!==`province`)return super.attributeChangedCallback(e,t,n);if(t!==n){if(this.selected){let e=this.value;!n||!m(n).includes(e)?(this.selected=null,this.query=``,this.custom=null):this.selected={value:`${n}|${e}`,label:e}}this.querySelector(`.k-combobox`)&&(this.input.placeholder=this.getAttribute(`placeholder`)??this.placeholderText(),this.input.value=this.query,this.sync())}}connectedCallback(){super.connectedCallback()}placeholderText(){return this.province?o().city.search:o().city.hint}source(e){let t=this.province,n=t?m(t).map(e=>({value:`${t}|${e}`,label:e})):Object.entries(p).flatMap(([e,t])=>t.map(t=>({value:`${e}|${t}`,label:t,description:e})));this.custom&&n.unshift({value:`custom|${this.custom}`,label:this.custom,description:o().city.outside});let r=e.trim();return this.getAttribute(`allow-custom`)!==`false`&&r&&r!==this.custom&&!n.some(e=>y(e.label)===y(r))&&n.push({value:`custom|${r}`,label:r,description:o().city.custom}),n}accepts(e,t){return e.value.startsWith(`custom|`)||[e.label,e.description??``].some(e=>y(e).includes(y(t)))}commit(e){this.custom=e?.value.startsWith(`custom|`)?e.label:null,super.commit(e)}detail(){let[e]=this.selected?this.selected.value.split(`|`):[null];return{value:this.value,province:e===`custom`?null:e}}};b.observedAttributes=[..._.observedAttributes,`province`,`allow-custom`],a(`kashi-combobox`,_,`block`),a(`kashi-province-select`,v,`block`),a(`kashi-city-select`,b,`block`);export{b as KashiCitySelect,_ as KashiCombobox,v as KashiProvinceSelect,m as n,f as r,g as searchText,h as t};
@@ -0,0 +1 @@
1
+ import{A as e,D as t,O as n,c as r,g as i,i as a,k as o,l as s,m as c,o as l,p as u,s as d,t as f,u as p,v as m}from"./base-DTQ50VdG.js";import{n as h}from"./text-D4a_hlwL.js";function g(e,t,n){if(e.querySelectorAll(`:scope > input[type=hidden][data-kashi-value]`).forEach(e=>e.remove()),t)for(let r of n){let n=document.createElement(`input`);n.type=`hidden`,n.name=t,n.value=r,n.dataset.kashiValue=``,e.append(n)}}var _=class extends f{constructor(){super(...arguments),this.tags=[],this.localError=null,this.rendered=!1,this.valueSet=!1,this.key=m(`kashi-tags`)}connectedCallback(){!this.rendered&&!this.valueSet&&(this.tags=this.parse(this.getAttribute(`value`))),this.render()}attributeChangedCallback(e,t,n){this.rendered&&t!==n&&(e===`value`?this.value=this.parse(n):this.render())}parse(e){return(e??``).split(/[,،]/).map(e=>e.trim()).filter(Boolean)}get value(){return[...this.tags]}set value(e){this.valueSet=!0,this.tags=Array.isArray(e)?[...e]:this.parse(e),this.rendered&&this.paint()}focus(e){this.input?.focus(e)}render(){let e=this.key,t=this.getAttribute(`aria-label`),n=this.hasAttribute(`label`)?this.getAttribute(`label`):t?null:u().tagInput.label,r=`<div class="k-tag-input"><input id="${e}" class="k-tag-input__control"${this.hasAttribute(`disabled`)?` disabled`:``}${!n&&t?` aria-label="${s(t)}"`:``}></div><span class="k-sr-only" aria-live="polite"></span>`;this.querySelector(`:scope > .k-field`)?.remove(),this.insertAdjacentHTML(`afterbegin`,p({id:e,label:n,control:r})),this.input=this.querySelector(`.k-tag-input__control`),this.querySelector(`.k-tag-input`).addEventListener(`click`,e=>{let t=e.target.closest(`.k-badge__remove`);t?this.removeAt(Number(t.dataset.i)):this.input.focus()}),this.input.addEventListener(`keydown`,e=>{(e.key===`Enter`||e.key===`,`||e.key===`،`)&&this.input.value.trim()?(e.preventDefault(),this.add([this.input.value])):e.key===`Backspace`&&!this.input.value&&this.tags.length&&this.removeAt(this.tags.length-1)}),this.input.addEventListener(`input`,()=>{this.localError=null;let e=this.input.value.split(/[,،\n\t]/);if(e.length>1){let t=e.pop()??``;this.add(e),t&&!this.localError&&(this.input.value=t)}else this.paintMessages()}),this.input.addEventListener(`blur`,()=>this.input.value.trim()&&this.add([this.input.value])),this.rendered=!0,this.paint()}add(e){let t=Number(this.getAttribute(`max`))||1/0,n=a(this,`allow-duplicates`),r=[...this.tags],i=``;for(let a of e){let e=h(a).trim();if(!e)continue;let o=r.length>=t?u().common.max(c(this,t)):!n&&r.includes(e)?u().tagInput.duplicate:this.validate?.(e);if(o){this.localError=o,this.commit(r,i),this.input.value=e;return}r=[...r,e],i=u().common.added(e)}this.localError=null,this.input.value=``,this.commit(r,i)}removeAt(e){let t=this.tags[e];this.commit(this.tags.filter((t,n)=>n!==e),u().common.removed(t)),this.input.focus()}commit(e,t){let n=e.join(`\0`)!==this.tags.join(`\0`);this.tags=e,this.paint(),t&&(this.querySelector(`.k-field > .k-sr-only`).textContent=t),n&&r(this,`kashi-change`,{value:[...e]})}paint(){this.querySelector(`.k-tag-input`).querySelectorAll(`.k-badge`).forEach(e=>e.remove());let e=this.getAttribute(`tone`)??`brand`,t=this.hasAttribute(`disabled`),n=this.tags.map((n,r)=>`<span class="k-badge${e===`neutral`?``:` k-badge--${s(e)}`}${t?``:` k-badge--removable`}">${s(n)}${t?``:`<button type="button" class="k-badge__remove" data-i="${r}" aria-label="${s(u().common.remove(n))}"><svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="m6 6 8 8M14 6l-8 8"/></svg></button>`}</span>`).join(``);this.input.insertAdjacentHTML(`beforebegin`,n),this.input.placeholder=this.tags.length?``:this.getAttribute(`placeholder`)??``,this.paintMessages(),g(this,this.getAttribute(`name`),this.tags)}paintMessages(){let e=this.getAttribute(`error`)||this.localError;this.querySelector(`.k-tag-input`).toggleAttribute(`data-invalid`,!!e),i(this.querySelector(`:scope > .k-field`),this.input,this.key,e,this.getAttribute(`hint`))}};_.observedAttributes=[`label`,`hint`,`error`,`placeholder`,`disabled`,`name`,`value`,`max`,`tone`,`allow-duplicates`,`aria-label`];var v=class extends f{constructor(){super(...arguments),this.current=null,this.rendered=!1,this.valueSet=!1,this.key=m(`kashi-num`)}connectedCallback(){!this.rendered&&!this.valueSet&&(this.current=this.num(this.getAttribute(`value`))??null),this.render()}attributeChangedCallback(e,t,n){this.rendered&&t!==n&&(e===`value`?this.value=n===null||n===``?null:Number(n):this.render())}get value(){return this.current}set value(e){this.valueSet=!0,this.current=e==null||Number.isNaN(Number(e))?null:Number(e),this.rendered&&this.paint()}focus(e){this.input?.focus(e)}num(e){return e===null||e===``||Number.isNaN(Number(e))?void 0:Number(e)}get min(){return this.num(this.getAttribute(`min`))}get max(){return this.num(this.getAttribute(`max`))}clamp(e){return Math.min(this.max??1/0,Math.max(this.min??-1/0,e))}show(n){if(n===null)return``;let r=this.hasAttribute(`thousands`)?t(n,{digits:`latin`}):String(n);return d(this)===`latin`?r:e(r).replace(/,/g,`٬`)}render(){let e=this.key,t=this.getAttribute(`aria-label`),r=this.hasAttribute(`label`)?this.getAttribute(`label`):t?null:u().numberInput.label,i=this.hasAttribute(`disabled`),a=this.getAttribute(`unit`),o=`<div class="k-number"><div class="k-input"${i?` data-state="disabled"`:``}><button type="button" class="k-number__step" data-step="-1" tabindex="-1" aria-label="${s(u().numberInput.decrement)}"${i?` disabled`:``}><svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true"><path d="M5 10h10"/></svg></button><input id="${e}" class="k-input__control" type="text" inputmode="decimal" role="spinbutton" dir="ltr"${i?` disabled`:``}${!r&&t?` aria-label="${s(t)}"`:``}>${a?`<span class="k-input__addon">${s(a)}</span>`:``}<button type="button" class="k-number__step" data-step="1" tabindex="-1" aria-label="${s(u().numberInput.increment)}"${i?` disabled`:``}><svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true"><path d="M10 5v10M5 10h10"/></svg></button></div></div>`;this.querySelector(`:scope > .k-field`)?.remove(),this.insertAdjacentHTML(`afterbegin`,p({id:e,label:r,control:o})),this.input=this.querySelector(`input.k-input__control`),this.querySelectorAll(`.k-number__step`).forEach(e=>e.addEventListener(`click`,()=>this.bump(Number(e.dataset.step)))),this.input.addEventListener(`input`,()=>{let e=this.input.value,t=n(e);this.set(t?(/^\s*[-−]/.test(e)?-1:1)*Number(t):null,!1)}),this.input.addEventListener(`blur`,()=>{this.current!==null&&this.current!==this.clamp(this.current)?this.set(this.clamp(this.current)):this.paint()}),this.input.addEventListener(`keydown`,e=>{let t={ArrowUp:()=>this.bump(1),ArrowDown:()=>this.bump(-1),PageUp:()=>this.bump(10),PageDown:()=>this.bump(-10),Home:()=>this.min!==void 0&&this.set(this.min),End:()=>this.max!==void 0&&this.set(this.max)};t[e.key]&&(e.preventDefault(),t[e.key]())}),this.rendered=!0,this.paint()}bump(e){let t=this.num(this.getAttribute(`step`))??1;this.set(this.clamp((this.current??this.min??0)+e*t))}set(e,t=!0){let n=e!==this.current;this.current=e,t?this.paint():this.paintState(),n&&r(this,`kashi-change`,{value:e})}paint(){let e=this.show(this.current);this.input.value!==e&&(this.input.value=e),this.paintState()}paintState(){let e=this.input,t=this.current;for(let[n,r]of[[`aria-valuenow`,t],[`aria-valuemin`,this.min],[`aria-valuemax`,this.max]])r==null?e.removeAttribute(n):e.setAttribute(n,String(r));t===null?e.removeAttribute(`aria-valuetext`):e.setAttribute(`aria-valuetext`,this.show(t));let n=this.hasAttribute(`disabled`),[r,a]=this.querySelectorAll(`.k-number__step`);r.disabled=n||this.min!==void 0&&(t??0)<=this.min,a.disabled=n||this.max!==void 0&&(t??0)>=this.max,i(this.querySelector(`:scope > .k-field`),e,this.key,this.getAttribute(`error`),this.getAttribute(`hint`)),g(this,this.getAttribute(`name`),[t===null?``:String(t)])}};v.observedAttributes=[`label`,`hint`,`error`,`value`,`min`,`max`,`step`,`thousands`,`digits`,`unit`,`disabled`,`name`,`aria-label`];const y=`<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M12 2.8l2.8 5.9 6.4.8-4.7 4.4 1.2 6.3L12 17.1l-5.7 3.1 1.2-6.3L2.8 9.5l6.4-.8z"/><path class="k-rating__half" fill="none" d="M12 2.8v14.3l-5.7 3.1 1.2-6.3L2.8 9.5l6.4-.8z"/></svg>`;var b=class extends f{constructor(){super(...arguments),this.current=0,this.valueSet=!1,this.key=m(`kashi-rate`)}connectedCallback(){this.valueSet||(this.current=Number(this.getAttribute(`value`))||0),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&(e===`value`&&(this.current=Number(n)||0),this.render())}get value(){return this.current}set value(e){this.valueSet=!0,this.current=Number(e)||0,this.isConnected&&this.render()}render(){let e=Number(this.getAttribute(`max`))||5,t=this.getAttribute(`label`)??u().rating.label,n=e=>c(this,e).replace(`.`,u().common.decimal),i=this.getAttribute(`size`),a=`k-rating${i===`sm`||i===`lg`?` k-rating--${i}`:``}`,o=this.current,l=Array.from({length:e},(e,t)=>t+1),d=this.hasAttribute(`show-value`)?`<span class="k-rating__value" aria-hidden="true">${n(o)}</span>`:``;if(this.hasAttribute(`readonly`)){this.innerHTML=`<span class="${a}" data-readonly="" role="img" aria-label="${s(`${t}: ${u().common.of(n(o),n(e))}`)}">${l.map(e=>`<span class="k-rating__star"${e<=Math.floor(o)?` data-filled=""`:``}${e===Math.ceil(o)&&o%1>=.25?` data-half=""`:``}>${y}</span>`).join(``)}${d}</span>`;return}let f=this.getAttribute(`name`)??this.key,p=this.hasAttribute(`disabled`);this.innerHTML=`<fieldset class="${a}"><legend class="k-sr-only">${s(t)}</legend>${l.map(t=>`<label class="k-rating__star"${t<=o?` data-filled=""`:``}><input type="radio" class="k-sr-only" name="${s(f)}" value="${t}"${o===t?` checked`:``}${p?` disabled`:``} aria-label="${s(u().common.of(n(t),n(e)))}">${y}</label>`).join(``)}${d}</fieldset>`;let m=this.querySelector(`fieldset`),h=e=>m.querySelectorAll(`.k-rating__star`).forEach((t,n)=>t.toggleAttribute(`data-filled`,n+1<=e));m.addEventListener(`change`,e=>{this.current=Number(e.target.value),h(this.current),r(this,`kashi-change`,{value:this.current})}),m.addEventListener(`pointerover`,e=>{let t=e.target.closest(`.k-rating__star`);t&&!p&&h([...m.querySelectorAll(`.k-rating__star`)].indexOf(t)+1)}),m.addEventListener(`pointerleave`,()=>h(this.current))}};b.observedAttributes=[`value`,`max`,`readonly`,`show-value`,`size`,`label`,`name`,`disabled`];function x(e,t,n=1){let r=[1],i=Math.max(2,e-n),a=Math.min(t-1,e+n);i>2&&r.push(i===3?2:null);for(let e=i;e<=a;e++)r.push(e);return a<t-1&&r.push(a===t-2?t-1:null),t>1&&r.push(t),r}const S=e=>`<svg data-k-mirror="" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${e}"/></svg>`;var C=class extends f{connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}get page(){return Math.max(1,Number(this.getAttribute(`page`))||1)}set page(e){this.setAttribute(`page`,String(e))}get total(){return Math.max(1,Number(this.getAttribute(`total`))||1)}render(){let t=Math.min(this.page,this.total),n=this.total,i=t=>d(this)===`latin`?String(t):e(t),a=this.getAttribute(`href`),o=this.contains(document.activeElement)?document.activeElement.dataset.to:null,c=(e,t,n,{current:r=!1,disabled:i=!1,aria:o=``}={})=>a&&!i?`<a class="${n}" href="${s(a.replace(`{page}`,String(e)))}" data-to="${e}"${r?` aria-current="page"`:``}${o?` aria-label="${s(o)}"`:``}>${t}</a>`:`<button type="button" class="${n}" data-to="${e}"${i?` disabled`:``}${r?` aria-current="page"`:``}${o?` aria-label="${s(o)}"`:``}>${t}</button>`,l=this.getAttribute(`summary`);this.innerHTML=`<nav class="k-pagination" aria-label="${s(this.getAttribute(`label`)??u().pagination.nav)}">${c(t-1,`${S(`m12 5-5 5 5 5`)}${s(u().common.prev)}`,`k-btn k-btn--secondary k-btn--sm`,{disabled:t<=1})}${l?`<span class="k-pagination__summary">${s(l)}</span>`:``}<ul class="k-pagination__pages" role="list">${x(t,n,Number(this.getAttribute(`siblings`)??1)).map(e=>`<li>${e===null?`<span class="k-pagination__ellipsis" aria-hidden="true">…</span>`:c(e,i(e),`k-pagination__page`,{current:e===t,aria:u().pagination.page(i(e))})}</li>`).join(``)}</ul>${c(t+1,`${s(u().common.next)}${S(`m8 5 5 5-5 5`)}`,`k-btn k-btn--secondary k-btn--sm`,{disabled:t>=n})}</nav>`,this.querySelector(`nav`).addEventListener(`click`,e=>{let t=e.target.closest(`button[data-to]`);if(!t||t.disabled)return;let n=Number(t.dataset.to);this.setAttribute(`page`,String(n)),r(this,`kashi-change`,{page:n}),this.querySelector(`.k-pagination__page[data-to="${n}"]`)?.focus()}),o&&this.querySelector(`[data-to="${o}"]`)?.focus()}};C.observedAttributes=[`page`,`total`,`siblings`,`href`,`digits`,`label`,`summary`];const w=e=>{let t=o(e).replace(/[٬,\s]/g,``).replace(`٫`,`.`).replace(`−`,`-`).match(/-?\d+(\.\d+)?/);return t?Number(t[0]):NaN};l(`kashi-tag-input`,_,`block`),l(`kashi-number-input`,v,`block`),l(`kashi-rating`,b),l(`kashi-pagination`,C,`block`);export{v as KashiNumberInput,C as KashiPagination,b as KashiRating,_ as KashiTagInput,w as cellNumber,x as pageRange};
@@ -0,0 +1 @@
1
+ import{A as e,D as t,b as n,c as r,d as i,l as a,o,p as s,s as c,t as l,y as u}from"./base-DTQ50VdG.js";import{t as d}from"./words-BdADG_9U.js";const f={دقیقه:`minute`,ساعت:`hour`,روز:`day`,هفته:`week`,ماه:`month`,سال:`year`},p=6e4,m=60*p,h=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();function g(t,{now:n=/* @__PURE__ */ new Date,locale:r=`fa`,digits:i=r===`en`?`latin`:`fa`}={}){let a=r===`en`,o=t.getTime()-n.getTime(),s=o<0,c=Math.abs(o),l=t=>i===`fa`?e(t):String(t),u=(e,t)=>{if(!a)return`${l(e)} ${t} ${s?`پیش`:`دیگر`}`;let n=`${f[t]}${e===1?``:`s`}`;return s?`${l(e)} ${n} ago`:`in ${l(e)} ${n}`};if(c<45e3)return a?`just now`:`همین الان`;if(c<m)return u(Math.max(1,Math.round(c/p)),`دقیقه`);let d=Math.round((h(t)-h(n))/864e5);if(c<6*m||d===0)return u(Math.round(c/m),`ساعت`);if(d===-1)return a?`yesterday`:`دیروز`;if(d===1)return a?`tomorrow`:`فردا`;let g=Math.abs(d);return g<7?u(g,`روز`):g<30?u(Math.round(g/7),`هفته`):g<365?u(Math.max(1,Math.round(g/30.44)),`ماه`):u(Math.round(g/365.25),`سال`)}const _={همت:`trillion`,میلیارد:`billion`,میلیون:`million`,هزار:`thousand`},v=[[0xe8d4a51000,`همت`],[1e9,`میلیارد`],[1e6,`میلیون`],[1e3,`هزار`]],y=e=>Math.round(e/10),b=e=>e*10;function x(n,{unit:r=`toman`,from:i=`toman`,compact:a=!1,showUnit:o=!0,locale:s=`fa`,digits:c=s===`en`?`latin`:`fa`}={}){let l=s===`en`,u=i===r?n:i===`rial`?y(n):b(n),d=u<0?`−`:``;u=Math.abs(u);let f=t(Math.round(u),{digits:c}),p=l?r===`toman`?`Toman`:`Rial`:r===`toman`?`تومان`:`ریال`;if(a){let t=v.find(([e,t])=>u>=e&&(t!==`همت`||r===`toman`&&!l));if(t){let n=Math.round(u/t[0]*100)/100,r=String(n).replace(`.`,c===`fa`?`٫`:`.`);f=`${c===`fa`?e(r):r} ${l?_[t[1]]:t[1]}`,t[1]===`همت`&&(p=``)}}return`${d}${f}${o&&p?` ${p}`:``}`}const S=e=>{if(!e)return null;let t=n(e.trim())??new Date(e);return Number.isNaN(t.getTime())?null:t};var C=class extends l{connectedCallback(){this.render()}attributeChangedCallback(){this.isConnected&&this.render()}},w=class extends C{render(){let e=Number(this.getAttribute(`value`)??0),t=this.getAttribute(`unit`)===`rial`?`rial`:`toman`,n=this.getAttribute(`from`)===`rial`?`rial`:this.getAttribute(`from`)===`toman`?`toman`:t,r=this.hasAttribute(`compact`),o=c(this),l=this.hasAttribute(`signed`),u=this.getAttribute(`size`)??`md`,f=n===t?e:n===`rial`?y(e):b(e),p=i(),m=s(),h=x(f,{unit:t,compact:r,digits:o,locale:p,showUnit:!1}),g=x(f,{unit:t,compact:r,locale:p}),_=t===`toman`?m.money.toman:m.money.rial,v=g.endsWith(`همت`)?null:_,S=this.getAttribute(`words`)!==`false`&&Number.isSafeInteger(Math.round(f))?`${d(Math.round(f),{locale:p})} ${_}`:null,C=l?f>0?`positive`:f<0?`negative`:null:null,w=S?` aria-hidden="true"`:``;this.innerHTML=`<data value="${f}" class="k-money k-money--${a(u)}"${C?` data-tone="${C}"`:``}${S?` title="${a(S)}"`:``}><span class="k-money__amount"${w}>${l&&f>0?`+`:``}${a(h)}</span>${v?`<span class="k-money__unit"${w}>${v}</span>`:``}${S?`<span class="k-sr-only">${f<0?``:l&&f>0?m.money.positive:``}${a(S)}</span>`:``}</data>`}};w.observedAttributes=[`value`,`unit`,`from`,`compact`,`digits`,`signed`,`words`,`size`];var T=class extends C{render(){let e=S(this.getAttribute(`datetime`));if(!e){this.textContent=``;return}let t=this.getAttribute(`format`),n=t===`numeric`||t===`full`?t:`long`,r=c(this);this.innerHTML=`<time datetime="${a(this.getAttribute(`datetime`))}">${a(u(e,{style:n,digits:r,locale:i()}))}</time>`}};T.observedAttributes=[`datetime`,`format`,`digits`];var E=class extends C{connectedCallback(){super.connectedCallback(),clearInterval(this.timer),this.timer=setInterval(()=>this.render(),Number(this.getAttribute(`refresh`))||6e4)}disconnectedCallback(){clearInterval(this.timer)}render(){let e=S(this.getAttribute(`datetime`));if(!e){this.textContent=``;return}let t=c(this);this.innerHTML=`<time datetime="${e.toISOString()}" title="${a(u(e,{style:`full`,digits:t,locale:i()}))}">${a(g(e,{digits:t,locale:i()}))}</time>`}};E.observedAttributes=[`datetime`,`digits`,`refresh`];const D=e=>String(e).padStart(2,`0`);var O=class extends l{constructor(){super(...arguments),this.end=0,this.done=!1}connectedCallback(){this.restart()}disconnectedCallback(){clearInterval(this.timer)}attributeChangedCallback(e,t,n){this.isConnected&&t!==n&&(e===`to`||e===`seconds`?this.restart():this.render())}restart(){let e=S(this.getAttribute(`to`));this.end=e?e.getTime():Date.now()+(Number(this.getAttribute(`seconds`))||0)*1e3,this.done=!1,clearInterval(this.timer),this.render(),this.timer=setInterval(()=>this.render(),1e3)}get remaining(){return Math.max(0,Math.ceil((this.end-Date.now())/1e3))}render(){let t=this.remaining,n=Math.floor(t/86400),i=Math.floor(t%86400/3600),o=Math.floor(t%3600/60),l=t%60,u=c(this)===`fa`,d=t=>u?e(String(t)):String(t),f=s().countdown,p=[n&&`${d(n)} ${f.days}`,i&&`${d(i)} ${f.hours}`,o&&`${d(o)} ${f.minutes}`,`${d(l)} ${f.seconds}`].filter(Boolean).join(s().common.and),m=this.getAttribute(`label`),h=a(m?`${m}: ${p}`:p),g=t===0?` data-done=""`:``;if(this.getAttribute(`variant`)===`blocks`){let e=[...n?[[n,f.days]]:[],[i,f.hours],[o,f.minutes],[l,f.seconds]];this.innerHTML=`<div role="timer" aria-label="${h}" class="k-countdown k-countdown--blocks"${g}>${e.map(([e,t])=>`<span class="k-countdown__unit" aria-hidden="true"><span class="k-countdown__num">${d(D(e))}</span><span class="k-countdown__name">${t}</span></span>`).join(``)}</div>`}else{let e=(n?`${n}:`:``)+(i||n?`${D(i)}:`:``)+`${D(o)}:${D(l)}`;this.innerHTML=`<span role="timer" aria-label="${h}" class="k-countdown"${g} dir="ltr"><span aria-hidden="true">${d(e)}</span></span>`}t===0&&(clearInterval(this.timer),this.done||(this.done=!0,r(this,`kashi-complete`,{})))}};O.observedAttributes=[`to`,`seconds`,`variant`,`digits`,`label`],o(`kashi-money`,w),o(`kashi-date`,T),o(`kashi-relative-time`,E),o(`kashi-countdown`,O);export{O as KashiCountdown,T as KashiDate,w as KashiMoney,E as KashiRelativeTime};
@@ -0,0 +1 @@
1
+ import{A as e,O as t,_ as n,c as r,g as i,l as a,o,p as s,s as c,t as l,u,v as d}from"./base-DTQ50VdG.js";var f=class extends l{constructor(){super(...arguments),this.code=``,this.caret=0,this.valueSet=!1,this.rendered=!1,this.key=d(`kashi-otp`)}connectedCallback(){!this.rendered&&!this.valueSet&&(this.code=t(this.getAttribute(`value`)??``).slice(0,this.length)),this.render()}attributeChangedCallback(e,n,r){this.rendered&&n!==r&&(e===`value`?(this.code=t(r??``).slice(0,this.length),this.paint()):this.render())}get value(){return this.code}set value(e){this.valueSet=!0,this.code=t(String(e??``)).slice(0,this.length),this.rendered&&this.paint()}focus(e){this.input?.focus(e)}get length(){let e=Number(this.getAttribute(`length`));return Number.isInteger(e)&&e>0?e:6}render(){let e=this.key,n=this.length,i=Number(this.getAttribute(`group-after`))||0,o=this.getAttribute(`aria-label`),c=this.hasAttribute(`label`)?this.getAttribute(`label`):o?null:s().otp.label,l=Array.from({length:n},(e,t)=>`${i&&t===i?`<span class="k-otp__sep" aria-hidden="true"></span>`:``}<span class="k-otp__slot" aria-hidden="true"></span>`).join(``),d=`<div class="k-otp${this.getAttribute(`size`)===`sm`?` k-otp--sm`:``}"><input id="${e}" class="k-otp__input" type="text" inputmode="numeric" autocomplete="one-time-code" pattern="\\d*" maxlength="${n*2}"${this.hasAttribute(`disabled`)?` disabled`:``}${!c&&o?` aria-label="${a(o)}"`:``}>${l}</div>`;this.querySelector(`:scope > .k-field`)?.remove(),this.insertAdjacentHTML(`afterbegin`,u({id:e,label:c,control:d})),this.input=this.querySelector(`.k-otp__input`),this.querySelector(`.k-otp`).addEventListener(`click`,()=>this.input.focus()),this.input.addEventListener(`input`,()=>{let e=t(this.input.value).slice(0,this.length),n=this.code;this.code=e,this.caret=e.length,this.paint(),e!==n&&r(this,`kashi-change`,{value:e}),e.length===this.length&&e!==n&&r(this,`kashi-complete`,{value:e})});let f=()=>{this.caret=Math.min(this.input.selectionStart??this.code.length,this.length),this.paintSlots()};for(let e of[`select`,`keyup`,`focus`])this.input.addEventListener(e,f);this.input.addEventListener(`blur`,()=>this.paintSlots()),this.rendered=!0,this.paint()}paint(){this.input.value!==this.code&&(this.input.value=this.code),this.paintSlots();let e=this.getAttribute(`error`);this.querySelector(`.k-otp`).classList.toggle(`k-otp--invalid`,!!e),i(this.querySelector(`:scope > .k-field`),this.input,this.key,e,this.getAttribute(`hint`)),n(this,this.getAttribute(`name`),this.code)}paintSlots(){let t=c(this)===`fa`,n=this.ownerDocument.activeElement===this.input,r=Math.min(this.caret,this.length-1);this.querySelectorAll(`.k-otp__slot`).forEach((i,a)=>{let o=this.code[a]??``;i.textContent=t?e(o):o,i.toggleAttribute(`data-filled`,!!o),i.toggleAttribute(`data-active`,n&&a===r)})}};f.observedAttributes=[`label`,`hint`,`error`,`length`,`digits`,`group-after`,`size`,`disabled`,`name`,`value`,`aria-label`],o(`kashi-otp`,f,`block`);export{f as KashiOtp};
@@ -0,0 +1 @@
1
+ import{A as e,D as t,O as n,_ as r,c as i,d as a,f as o,g as s,i as c,l,m as u,o as d,p as f,r as p,s as m,t as h,u as g,v as _}from"./base-DTQ50VdG.js";import{t as v}from"./text-D4a_hlwL.js";import{n as y,t as b}from"./time-DJ3p1wvd.js";import{searchText as x}from"./combobox-6EFI2qqN.js";const S=[`الف`,`ب`,`پ`,`ت`,`ث`,`ج`,`د`,`ز`,`س`,`ش`,`ص`,`ط`,`ع`,`ف`,`ق`,`ک`,`گ`,`ل`,`م`,`ن`,`و`,`ه`,`ی`,`ژ`],C={الف:`government`,پ:`police`,ث:`police`,ت:`taxi`,ع:`public`,ک:`agricultural`,ش:`army`,ز:`defense`,ف:`defense`,ژ:`disabled`};function w(e){return C[e]??`private`}function T(e){let t=n(e.first??``),r=n(e.middle??``),i=n(e.region??``);return/^[1-9]\d$/.test(t)&&/^[1-9]\d{2}$/.test(r)&&/^[1-9]\d$/.test(i)&&S.includes(e.letter??``)}function E(t,{digits:r=`fa`}={}){let i=t=>r===`fa`?e(n(t)):n(t);return`${i(t.first)} ${t.letter} ${i(t.middle)} ایران ${i(t.region)}`}const D=`ضصثقفغعهخحجچپشسیبلاتنمکگظطزرذدپوژ؟آ`,O=/* @__PURE__ */ new Map,k=/* @__PURE__ */ new Map;[...`qwertyuiop[]\\asdfghjkl;'zxcvbnm,C?H`].forEach((e,t)=>{O.set(e,D[t]),k.has(D[t])||k.set(D[t],e)});function A(e,t=`fa`){let n=t===`fa`?O:k;return[...e].map(e=>n.get(t===`fa`&&e!==`C`&&e!==`H`?e.toLowerCase():e)??e).join(``)}function j(e){let t=e.trim();if(!t||/[\u0600-\u06FF]/.test(t)||!/[a-z]/i.test(t))return!1;let n=t.split(/\s+/).filter(e=>/[a-z]/i.test(e)),r=n.filter(e=>/[a-z][;'[\],\\]|[;'[\],\\][a-z]/i.test(e)||e.length>=3&&!/[aeiouy]/i.test(e));return r.length>0&&r.length*2>=n.length}const M=`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m5 10.5 3.2 3L15 7"/></svg>`,N=`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="m6 6 8 8M14 6l-8 8"/></svg>`;function P(e,t,n){if(e.querySelectorAll(`:scope > input[type=hidden][data-kashi-value]`).forEach(e=>e.remove()),t)for(let r of n)e.insertAdjacentHTML(`beforeend`,`<input type="hidden" data-kashi-value name="${l(t)}" value="${l(r)}">`)}function F(e){let t=[...e.querySelectorAll(`:scope > option`)].map(e=>({value:e.value,label:e.textContent?.trim()??e.value,description:e.dataset.description,disabled:e.disabled,selected:e.hasAttribute(`selected`)}));return e.querySelectorAll(`:scope > option`).forEach(e=>e.remove()),t}var I=class extends h{constructor(){super(...arguments),this.list=null,this.chosen=[],this.query=``,this.active=-1,this.isOpen=!1,this.valueSet=!1,this.key=_(`kashi-multi`),this.onOutside=e=>{this.contains(e.target)||this.close()}}connectedCallback(){p(()=>{if(this.isConnected){if(this.list===null){let e=F(this);this.list=e,this.valueSet||(this.chosen=e.filter(e=>e.selected).map(e=>e.value))}this.render()}})}disconnectedCallback(){document.removeEventListener(`pointerdown`,this.onOutside)}attributeChangedCallback(e,t,n){this.box&&t!==n&&this.render()}get options(){return this.list??[]}set options(e){this.list=[...e],this.box&&this.paint()}get value(){return[...this.chosen]}set value(e){this.valueSet=!0,this.chosen=[...e],this.box&&this.paint()}render(){let e=this.key,t=this.getAttribute(`aria-label`),n=this.hasAttribute(`label`)?this.getAttribute(`label`):t?null:f().multiSelect.label,r=`<div class="k-combobox k-multiselect"><div class="k-tag-input"><input id="${e}" class="k-tag-input__control" role="combobox" aria-autocomplete="list" aria-expanded="false" aria-controls="${e}-list" autocomplete="off"${this.hasAttribute(`disabled`)?` disabled`:``}${!n&&t?` aria-label="${l(t)}"`:``}></div><ul id="${e}-list" role="listbox" aria-multiselectable="true" class="k-listbox" hidden style="inset-block-start: calc(100% + 6px)"${n?` aria-label="${l(n)}"`:``}></ul><span id="${e}-count" class="k-sr-only"></span><span class="k-sr-only" aria-live="polite"></span></div>`;this.querySelector(`:scope > .k-field`)?.remove(),this.insertAdjacentHTML(`afterbegin`,g({id:e,label:n,control:r})),this.input=this.querySelector(`.k-tag-input__control`),this.box=this.querySelector(`.k-tag-input`),this.listbox=this.querySelector(`.k-listbox`),this.box.addEventListener(`click`,e=>{let t=e.target.closest(`[data-remove]`);t?this.set(this.chosen.filter(e=>e!==t.dataset.remove),f().common.removed(this.labelOf(t.dataset.remove))):e.target.closest(`[data-clear]`)&&this.set([],f().multiSelect.clearedAll),this.input.focus()}),this.input.addEventListener(`input`,()=>{this.query=this.input.value,this.active=0,this.open()}),this.input.addEventListener(`focus`,()=>this.open()),this.input.addEventListener(`keydown`,e=>this.onKey(e)),this.listbox.addEventListener(`pointerdown`,e=>e.preventDefault()),this.listbox.addEventListener(`click`,e=>{let t=e.target.closest(`[role="option"]`);t&&this.toggle(this.filtered()[Number(t.dataset.i)])}),this.paint()}labelOf(e){return this.options.find(t=>t.value===e)?.label??e}filtered(){let e=x(this.query.trim());return this.options.filter(t=>!e||[t.label,t.description??``].some(t=>x(t).includes(e)))}get full(){let e=Number(this.getAttribute(`max`));return!!e&&this.chosen.length>=e}toggle(e){if(!e||e.disabled)return;let t=this.chosen.includes(e.value);if(!t&&this.full)return this.announce(f().common.max(u(this,Number(this.getAttribute(`max`)))));this.query=``,this.input.value=``,this.set(t?this.chosen.filter(t=>t!==e.value):[...this.chosen,e.value],t?f().common.removed(e.label):f().common.selected(e.label))}set(e,t){this.chosen=e,this.paint(),this.announce(t),i(this,`kashi-change`,{value:[...e]})}announce(e){this.querySelector(`.k-multiselect > .k-sr-only[aria-live]`).textContent=e}open(){this.hasAttribute(`disabled`)||(this.isOpen=!0,this.listbox.hidden=!1,this.input.setAttribute(`aria-expanded`,`true`),this.querySelector(`.k-combobox`).setAttribute(`data-open`,``),document.addEventListener(`pointerdown`,this.onOutside),this.paintList())}close(){this.isOpen=!1,this.listbox.hidden=!0,this.input.setAttribute(`aria-expanded`,`false`),this.input.removeAttribute(`aria-activedescendant`),this.querySelector(`.k-combobox`).removeAttribute(`data-open`),document.removeEventListener(`pointerdown`,this.onOutside)}onKey(e){let t=this.filtered(),n=t.map((e,t)=>e.disabled?-1:t).filter(e=>e>=0),r=e=>{n.length&&(this.active=n[(n.indexOf(this.active)+e+n.length)%n.length],this.paintList())};if(e.key===`ArrowDown`)e.preventDefault(),this.isOpen?r(1):this.open();else if(e.key===`ArrowUp`)e.preventDefault(),this.isOpen?r(-1):this.open();else if(e.key===`Enter`&&this.isOpen&&t[this.active])e.preventDefault(),this.toggle(t[this.active]);else if(e.key===`Escape`&&this.isOpen)e.preventDefault(),this.close();else if(e.key===`Backspace`&&!this.input.value&&this.chosen.length){let e=this.chosen.at(-1);this.set(this.chosen.slice(0,-1),f().common.removed(this.labelOf(e)))}}paint(){let e=this.hasAttribute(`disabled`);this.box.querySelectorAll(`.k-badge, [data-clear]`).forEach(e=>e.remove());let t=this.chosen.map(t=>`<span class="k-badge k-badge--brand${e?``:` k-badge--removable`}">${l(this.labelOf(t))}${e?``:`<button type="button" class="k-badge__remove" data-remove="${l(t)}" aria-label="${l(f().common.remove(this.labelOf(t)))}">${N}</button>`}</span>`).join(``);this.input.insertAdjacentHTML(`beforebegin`,t),this.chosen.length>1&&!e&&this.box.insertAdjacentHTML(`beforeend`,`<button type="button" class="k-input__action" data-clear aria-label="${l(f().common.clearAll)}">${N}</button>`),this.input.placeholder=this.chosen.length?``:this.getAttribute(`placeholder`)??``,this.querySelector(`#${this.key}-count`).textContent=f().multiSelect.selected(u(this,this.chosen.length));let n=this.getAttribute(`error`);this.box.toggleAttribute(`data-invalid`,!!n),s(this.querySelector(`:scope > .k-field`),this.input,this.key,n,this.getAttribute(`hint`),`${this.key}-count`),P(this,this.getAttribute(`name`),this.chosen),this.isOpen&&this.paintList()}paintList(){let e=this.filtered(),t=x(this.query.trim()),n=this.full,r=e=>{let n=t?x(e).indexOf(t):-1;return n<0?l(e):`${l(e.slice(0,n))}<mark>${l(e.slice(n,n+t.length))}</mark>${l(e.slice(n+t.length))}`};this.listbox.innerHTML=e.length?e.map((e,t)=>{let i=this.chosen.includes(e.value);return`<li id="${this.key}-list-${t}" data-i="${t}" role="option" aria-selected="${i}"${e.disabled||!i&&n?` aria-disabled="true"`:``}${t===this.active?` data-active`:``} class="k-option k-option--check"><span class="k-multiselect__box" aria-hidden="true">${i?M:``}</span><span class="k-option__body"><span>${r(e.label)}</span>${e.description?`<span class="k-option__desc">${l(e.description)}</span>`:``}</span></li>`}).join(``):`<li class="k-listbox__empty" role="presentation">${l(f().common.noResults)}</li>`;let i=this.active>=0?this.listbox.querySelector(`[data-i="${this.active}"]`):null;i?(this.input.setAttribute(`aria-activedescendant`,i.id),i.scrollIntoView?.({block:`nearest`})):this.input.removeAttribute(`aria-activedescendant`)}};I.observedAttributes=[`label`,`hint`,`error`,`placeholder`,`max`,`disabled`,`name`,`aria-label`];var L=class extends h{constructor(){super(...arguments),this.lo=0,this.hi=0,this.valueSet=!1,this.rendered=!1,this.key=_(`kashi-slider`)}connectedCallback(){!this.rendered&&!this.valueSet&&this.readValue(this.getAttribute(`value`)),this.render()}attributeChangedCallback(e,t,n){this.rendered&&t!==n&&(e===`value`&&this.readValue(n),this.render())}num(e,t){let n=this.getAttribute(e);return n===null||n===``||Number.isNaN(Number(n))?t:Number(n)}get min(){return this.num(`min`,0)}get max(){return this.num(`max`,100)}get isRange(){return this.hasAttribute(`range`)}readValue(e){let t=(e??``).split(/[,،]/).map(e=>Number(e.trim())).filter(e=>!Number.isNaN(e)&&String(e)!==``);this.isRange?[this.lo,this.hi]=[t[0]??this.min,t[1]??this.max]:[this.lo,this.hi]=[this.min,t[0]??this.min]}get value(){return this.isRange?[this.lo,this.hi]:this.hi}set value(e){this.valueSet=!0,this.readValue(Array.isArray(e)?e.join(`,`):String(e)),this.rendered&&this.render()}fmt(e){let n=this.getAttribute(`unit`);return`${t(e,{digits:m(this)})}${n?` ${n}`:``}`}render(){let e=this.getAttribute(`label`),t=this.isRange,n=this.getAttribute(`name`),r=this.hasAttribute(`disabled`),a=e=>`${(e-this.min)/(this.max-this.min)*100}%`,o=i=>{let a=i===`lo`?this.lo:this.hi,o=n?t?`${n}_${i===`lo`?`min`:`max`}`:n:``;return`<input type="range" class="k-slider__input" data-which="${i}" min="${this.min}" max="${this.max}" step="${this.num(`step`,1)}" value="${a}"${r?` disabled`:``}${o?` name="${l(o)}"`:``}${t?` aria-label="${l(i===`lo`?f().slider.from:f().slider.to)}${e?` ${l(e)}`:``}"`:e?` aria-labelledby="${this.key}-label"`:``} aria-valuetext="${l(this.fmt(a))}">`},s=(this.getAttribute(`marks`)??``).split(/[,،]/).map(e=>e.trim()).filter(Boolean).map(Number),c=this.getAttribute(`show-value`)!==`false`;this.innerHTML=`<div class="k-slider"${t?` data-range=""`:``}>${e||c?`<div class="k-slider__head">${e?`<span class="k-label" id="${this.key}-label">${l(e)}</span>`:``}${c?`<span class="k-slider__value" aria-hidden="true">${l(t?`${this.fmt(this.lo)}${f().common.range}${this.fmt(this.hi)}`:this.fmt(this.hi))}</span>`:``}</div>`:``}<div class="k-slider__track" style="--_from: ${t?a(this.lo):`0%`}; --_to: ${a(this.hi)}"><span class="k-slider__fill" aria-hidden="true"></span>${t?o(`lo`):``}${o(`hi`)}</div>${s.length?`<div class="k-slider__marks" aria-hidden="true">${s.map(e=>`<span>${l(this.fmt(e))}</span>`).join(``)}</div>`:``}</div>`,this.rendered=!0,this.querySelectorAll(`.k-slider__input`).forEach(e=>e.addEventListener(`input`,()=>{let n=Number(e.value);t?e.dataset.which===`lo`?this.lo=Math.min(n,this.hi):this.hi=Math.max(n,this.lo):this.hi=n,e.value=String(e.dataset.which===`lo`?this.lo:this.hi),e.setAttribute(`aria-valuetext`,this.fmt(Number(e.value)));let r=this.querySelector(`.k-slider__track`);r.style.setProperty(`--_from`,t?a(this.lo):`0%`),r.style.setProperty(`--_to`,a(this.hi));let o=this.querySelector(`.k-slider__value`);o&&(o.textContent=t?`${this.fmt(this.lo)}${f().common.range}${this.fmt(this.hi)}`:this.fmt(this.hi)),i(this,`kashi-change`,{value:this.value})}))}};L.observedAttributes=[`label`,`min`,`max`,`step`,`value`,`range`,`show-value`,`marks`,`unit`,`disabled`,`name`];var R=class extends h{constructor(){super(...arguments),this.built=!1}connectedCallback(){p(()=>this.isConnected&&!this.built&&this.build())}attributeChangedCallback(){if(!this.built)return;let e=this.getAttribute(`label`);e&&this.setAttribute(`aria-label`,e),this.sync(!1)}get value(){return[...this.querySelectorAll(`.k-chip[aria-pressed="true"]`)].map(e=>e.dataset.value??``)}set value(e){this.querySelectorAll(`.k-chip`).forEach(t=>t.setAttribute(`aria-pressed`,String(e.includes(t.dataset.value??``)))),this.sync(!1)}build(){this.built=!0,this.classList.add(`k-chips`),this.setAttribute(`role`,`group`);let e=this.getAttribute(`label`);e&&this.setAttribute(`aria-label`,e),this.querySelectorAll(`:scope > button`).forEach(e=>{var t;e.type=`button`,e.classList.add(`k-chip`),(t=e.dataset).value||(t.value=e.textContent?.trim()??``),e.setAttribute(`aria-pressed`,String(e.hasAttribute(`data-pressed`)||e.getAttribute(`aria-pressed`)===`true`)),e.insertAdjacentHTML(`afterbegin`,`<svg class="k-chip__check" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m5 10.5 3.2 3L15 7"/></svg>`),e.dataset.count&&e.insertAdjacentHTML(`beforeend`,`<span class="k-chip__count">${u(this,e.dataset.count??``)}</span>`)}),this.addEventListener(`click`,e=>{let t=e.target.closest(`.k-chip`);if(!t||t.disabled)return;let n=t.getAttribute(`aria-pressed`)!==`true`;c(this,`single`)&&this.querySelectorAll(`.k-chip`).forEach(e=>e.setAttribute(`aria-pressed`,`false`)),t.setAttribute(`aria-pressed`,String(n)),this.sync(!0)}),this.sync(!1)}sync(e){P(this,this.getAttribute(`name`),this.value),e&&i(this,`kashi-change`,{value:this.value})}};R.observedAttributes=[`label`,`single`,`name`];const z=[[t=>t.length(o()===`fa`?e(8):`8`),e=>e.length>=8],[e=>e.cases,e=>/[a-z]/.test(e)&&/[A-Z]/.test(e)],[e=>e.digit,e=>/\d/.test(e)],[e=>e.symbol,e=>/[^A-Za-z0-9\s؀-ۿ]/.test(e)]];var B=class extends h{constructor(){super(...arguments),this.target=null,this.onInput=()=>this.render(this.target?.value??``)}connectedCallback(){p(()=>{this.isConnected&&(this.attach(),this.render(``))})}disconnectedCallback(){this.target?.removeEventListener(`input`,this.onInput)}attributeChangedCallback(){this.isConnected&&(this.attach(),this.render(this.target?.value??``))}attach(){this.target?.removeEventListener(`input`,this.onInput);let e=this.getAttribute(`for`),t=e?document.getElementById(e):null;if(this.target=t instanceof HTMLInputElement?t:t?.querySelector(`input`)??null,this.target?.addEventListener(`input`,this.onInput),this.target){this.id||=_(`kashi-strength`);let e=(this.target.getAttribute(`aria-describedby`)??``).split(` `).filter(Boolean);e.includes(this.id)||this.target.setAttribute(`aria-describedby`,[...e,this.id].join(` `))}}score(e){let t=z.filter(([,t])=>t(e)).length;return e?Math.max(1,Math.round(t/z.length*4)):0}render(e){let t=this.score(e),n=f().password,r=n.levels,i=/[؀-ۿ]/.test(e);this.innerHTML=`<div class="k-strength" data-score="${t}"><div class="k-strength__bars" aria-hidden="true">${`<span class="k-strength__bar"></span>`.repeat(4)}</div><p class="k-strength__label" aria-live="polite" style="margin: 0">${t?l(n.strength(`\0`)).replace(`\0`,`<strong>${l(r[t-1])}</strong>`):``}</p>${i?`<p class="k-hint k-hint--error" role="alert">${l(n.persian)}</p>`:``}${this.getAttribute(`show-rules`)===`false`?``:`<ul class="k-strength__rules">${z.map(([t,r])=>{let i=r(e);return`<li class="k-strength__rule"${i?` data-met=""`:``}>${i?M:`<svg viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="2.5" fill="currentColor"/></svg>`}<span>${l(t(n))}<span class="k-sr-only">${i?n.met:n.unmet}</span></span></li>`}).join(``)}</ul>`}</div>`}};B.observedAttributes=[`for`,`show-rules`];var V=class extends h{constructor(){super(...arguments),this.key=_(`kashi-text`),this.rendered=!1,this.valueSet=!1,this.text=``}connectedCallback(){!this.rendered&&!this.valueSet&&(this.text=this.getAttribute(`value`)??``),this.render()}attributeChangedCallback(e,t,n){this.rendered&&t!==n&&(e===`value`?this.value=n??``:this.render())}get value(){return this.text}set value(e){this.valueSet=!0,this.text=String(e??``),this.rendered&&(this.control.value=this.text,this.paint())}focus(e){this.control?.focus(e)}render(){let e=this.key,t=this.getAttribute(`aria-label`),n=this.hasAttribute(`label`)?this.getAttribute(`label`):t?null:this.defaultLabel,r=this.getAttribute(`name`),a=`id="${e}" class="k-input__control" dir="auto"${r?` name="${l(r)}"`:``}${this.hasAttribute(`required`)?` required`:``}${this.hasAttribute(`disabled`)?` disabled`:``} placeholder="${l(this.getAttribute(`placeholder`)??``)}"${!n&&t?` aria-label="${l(t)}"`:``}`,o=this.multiline?`<div class="k-input k-input--textarea"><textarea ${a} rows="${Number(this.getAttribute(`rows`))||4}"></textarea></div>`:`<div class="k-input"><input ${a}></div>`;this.querySelector(`:scope > .k-field`)?.remove(),this.insertAdjacentHTML(`afterbegin`,g({id:e,label:n,required:this.hasAttribute(`required`),control:o})),this.control=this.querySelector(`.k-input__control`),this.control.value=this.text,this.control.addEventListener(`input`,()=>{this.text=this.control.value,this.paint(),i(this,`kashi-change`,{value:this.text})}),this.rendered=!0,this.paint()}paint(){let e=this.querySelector(`:scope > .k-field`);s(e,this.control,this.key,this.getAttribute(`error`),null);let t=this.hint();if(e.querySelector(`.k-field__hint-row[data-extra]`)?.remove(),t){e.insertAdjacentHTML(`beforeend`,`<div class="k-field__hint-row" data-extra><div class="k-field__hints"><p class="k-hint" id="${this.key}-hint">${t}</p></div></div>`);let n=(this.control.getAttribute(`aria-describedby`)??``).split(` `).filter(Boolean);this.control.setAttribute(`aria-describedby`,[...n,`${this.key}-hint`].join(` `))}}replace(e){this.text=e,this.control.value=e,this.paint(),this.control.focus(),i(this,`kashi-change`,{value:e})}};const H=[`arabic`,`zwnj`,`punctuation`,`digits`,`spacing`];var U=class extends V{constructor(){super(...arguments),this.multiline=!0}get defaultLabel(){return f().persianInput.text}render(){super.render(),this.control.addEventListener(`blur`,()=>{let e=this.result();c(this,`fix-on-blur`)&&e.count&&this.replace(e.text)}),this.addEventListener(`click`,e=>{e.target.closest(`[data-fix]`)&&this.replace(this.result().text)})}result(){return v(this.text,{digits:this.getAttribute(`fix-digits`)!==`false`})}hint(){if(!this.text.trim())return this.getAttribute(`hint`)?l(this.getAttribute(`hint`)):null;let e=this.result();if(!e.count)return`<span class="k-textfix" data-state="clean"><span class="k-textfix__text">${l(f().textFix.clean)}</span></span>`;let t=f().textFix,n=H.filter(t=>e.fixes[t]).map(n=>`${u(this,e.fixes[n])} ${t[n]}`).join(f().common.list);return`<span class="k-textfix" data-state="fix"><span class="k-textfix__text">${l(t.count(u(this,e.count),n))}</span><button type="button" class="k-btn k-btn--tertiary k-btn--xs" data-fix>${l(t.fix)}</button></span>`}};U.observedAttributes=[`label`,`hint`,`error`,`placeholder`,`required`,`disabled`,`name`,`value`,`rows`,`fix-on-blur`,`fix-digits`,`aria-label`];var W=class extends V{constructor(){super(...arguments),this.multiline=!1}get defaultLabel(){return f().persianInput.text}render(){super.render(),this.addEventListener(`click`,e=>{e.target.closest(`[data-fix]`)&&this.replace(A(this.text))})}hint(){let e=this.text,t=/[a-z]/i.test(e)&&!/[؀-ۿ]/.test(e);return(this.getAttribute(`suggest`)===`always`?t:j(e))?`<span class="k-kbfix" role="status">${l(f().keyboardFix.before)} <button type="button" class="k-kbfix__btn" data-fix>«${l(A(e))}»</button>${a()===`en`?``:` `}${l(f().keyboardFix.after)}</span>`:this.getAttribute(`hint`)?l(this.getAttribute(`hint`)):null}};W.observedAttributes=[`label`,`hint`,`error`,`placeholder`,`required`,`disabled`,`name`,`value`,`suggest`,`aria-label`];const G=e=>e.hours*60+e.minutes,K=e=>({hours:Math.floor(e/60),minutes:e%60});var q=class extends h{constructor(){super(...arguments),this.current=null,this.invalid=!1,this.valueSet=!1,this.rendered=!1,this.key=_(`kashi-time`)}connectedCallback(){!this.rendered&&!this.valueSet&&(this.current=this.normal(this.getAttribute(`value`))),this.render()}attributeChangedCallback(e,t,n){this.rendered&&t!==n&&(e===`value`?this.value=n??``:this.render())}get value(){return this.current??``}set value(e){this.valueSet=!0,this.current=this.normal(e),this.invalid=!1,this.rendered&&this.paint()}normal(e){let t=e?y(e):null;return t?b(t):null}show(t){return t?m(this)===`latin`?t:e(t):``}get lo(){let e=y(this.getAttribute(`min`)??``);return e?G(e):0}get hi(){let e=y(this.getAttribute(`max`)??``);return e?G(e):1439}render(){let e=this.key,t=this.getAttribute(`aria-label`),n=this.hasAttribute(`label`)?this.getAttribute(`label`):t?null:f().persianInput.time,r=m(this)===`fa`,i=`<div class="k-input"><input id="${e}" class="k-input__control" type="text" inputmode="numeric" dir="ltr" autocomplete="off" placeholder="${l(this.getAttribute(`placeholder`)??(r?`۰۹:۳۰`:`09:30`))}"${this.hasAttribute(`required`)?` required`:``}${this.hasAttribute(`disabled`)?` disabled`:``}${!n&&t?` aria-label="${l(t)}"`:``}><span class="k-input__addon"><svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="10" cy="10" r="7"/><path d="M10 6v4l2.5 2"/></svg></span></div>`;this.querySelector(`:scope > .k-field`)?.remove(),this.insertAdjacentHTML(`afterbegin`,g({id:e,label:n,required:this.hasAttribute(`required`),control:i})),this.input=this.querySelector(`input.k-input__control`),this.input.addEventListener(`blur`,()=>this.commitText()),this.input.addEventListener(`keydown`,e=>{if(e.key===`Enter`&&this.commitText(),e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;e.preventDefault();let t=Number(this.getAttribute(`step`))||15,n=y(this.input.value)??y(this.current??``)??K(this.lo),r=G(n),i=e.key===`ArrowUp`?Math.floor(r/t)*t+t:Math.ceil(r/t)*t-t;this.commit(K(Math.min(this.hi,Math.max(this.lo,i))))}),this.rendered=!0,this.paint()}commitText(){let e=this.input.value.trim();if(!e)return this.commit(null);let t=y(e);if(!t)this.invalid=`format`;else if(G(t)<this.lo||G(t)>this.hi)this.invalid=`range`;else return this.commit(t);this.paint(!1)}commit(e){let t=e?b(e):null,n=t!==this.current;this.current=t,this.invalid=!1,this.paint(),n&&i(this,`kashi-change`,{value:t??``})}paint(e=!0){e&&(this.input.value=this.show(this.current));let t=this.invalid===`range`?f().invalid.timeRange(this.show(b(K(this.lo))),this.show(b(K(this.hi)))):this.invalid?f().invalid.time:null;this.input.setCustomValidity(t??``),s(this.querySelector(`:scope > .k-field`),this.input,this.key,this.getAttribute(`error`)||t,this.getAttribute(`hint`)),r(this,this.getAttribute(`name`),this.current??``)}};q.observedAttributes=[`label`,`hint`,`error`,`value`,`min`,`max`,`step`,`digits`,`required`,`disabled`,`name`,`placeholder`,`aria-label`];const J={first:``,letter:``,middle:``,region:``};var Y=class extends h{constructor(){super(...arguments),this.plate={...J},this.touched=!1,this.valueSet=!1,this.rendered=!1,this.key=_(`kashi-plate`)}connectedCallback(){!this.rendered&&!this.valueSet&&(this.plate=this.parse(this.getAttribute(`value`))),this.render()}attributeChangedCallback(e,t,n){this.rendered&&t!==n&&(e===`value`?this.value=this.parse(n):this.render())}parse(e){let[t=``,r=``,i=``,a=``]=(e??``).split(`-`);return{first:n(t),letter:r,middle:n(i),region:n(a)}}get value(){return{...this.plate}}set value(e){this.valueSet=!0,this.plate={...J,...e},this.rendered&&this.render()}get valid(){return T(this.plate)}render(){let t=this.key,r=this.plate,a=this.hasAttribute(`disabled`)?` disabled`:``,o=(n,i,o,s=``,c=!1)=>`<input${c?` id="${t}-first"`:``} class="k-plate__seg ${s}" data-key="${n}" data-len="${i}" inputmode="numeric" autocomplete="off" aria-label="${o}" placeholder="${e(`0`.repeat(i))}" value="${e(r[n])}"${a}>`,s=f().plate,c=this.getAttribute(`label`)??s.label,u=`<div class="k-plate" role="group" aria-label="${l(c)}" data-type="${w(r.letter)}"><span class="k-plate__flag" aria-hidden="true"><span class="k-plate__flag-colors"></span>I.R.<br>IRAN</span>${o(`first`,2,s.first,``,!0)}<select class="k-plate__letter" data-key="letter" aria-label="${l(s.letter)}"${a}><option value="">–</option>${S.map(e=>`<option value="${e}"${e===r.letter?` selected`:``}>${e===`ه`?`هـ`:e}</option>`).join(``)}</select>${o(`middle`,3,s.middle,`k-plate__seg--3`)}<span class="k-plate__region"><span class="k-plate__region-label" aria-hidden="true">ایران</span>${o(`region`,2,s.region)}</span></div><span class="k-sr-only" aria-live="polite"></span>`;this.querySelector(`:scope > .k-field`)?.remove(),this.insertAdjacentHTML(`afterbegin`,g({id:`${t}-first`,label:c,control:u}));let d=[...this.querySelectorAll(`[data-key]`)];d.forEach((t,r)=>{t.addEventListener(t instanceof HTMLSelectElement?`change`:`input`,()=>{let a=t.dataset.key;if(t instanceof HTMLSelectElement)this.plate.letter=t.value,t.value&&d[r+1]?.focus();else{let i=Number(t.dataset.len),o=n(t.value);a===`middle`&&o.length>i&&(this.plate.region=(this.plate.region+o.slice(i)).slice(0,2)),this.plate[a]=o.slice(0,i),t.value=e(this.plate[a]),this.plate[a].length===i&&d[r+1]?.focus()}this.paint(),i(this,`kashi-change`,{value:this.value,valid:this.valid})}),t.addEventListener(`keydown`,e=>{e.key===`Backspace`&&!t.value&&d[r-1]?.focus()})});let p=this.querySelector(`.k-plate`);p.addEventListener(`focusout`,e=>{p.contains(e.relatedTarget)||(this.touched=!0,this.paint())}),this.rendered=!0,this.paint()}paint(){let t=this.plate,n=this.querySelector(`.k-plate`),r=this.querySelector(`[data-key="region"]`);r.value!==e(t.region)&&(r.value=e(t.region)),n.dataset.type=w(t.letter);let i=t.first.length===2&&!!t.letter&&t.middle.length===3&&t.region.length===2,a=(this.touched||i)&&Object.values(t).some(Boolean)&&!this.valid,o=this.getAttribute(`error`)||(a?f().invalid.plate:null);n.toggleAttribute(`data-invalid`,!!o),s(this.querySelector(`:scope > .k-field`),n,this.key,o,this.getAttribute(`hint`)),this.querySelector(`.k-field > .k-sr-only`).textContent=this.valid?E(t):``;let c=this.getAttribute(`name`);if(this.querySelectorAll(`:scope > input[type=hidden]`).forEach(e=>e.remove()),c)for(let e of[`first`,`letter`,`middle`,`region`])this.insertAdjacentHTML(`beforeend`,`<input type="hidden" name="${l(`${c}_${e}`)}" value="${l(t[e])}">`)}};Y.observedAttributes=[`label`,`hint`,`error`,`name`,`disabled`,`value`];var X=class extends h{constructor(){super(...arguments),this.text=``,this.editing=!1,this.valueSet=!1,this.rendered=!1}connectedCallback(){!this.rendered&&!this.valueSet&&(this.text=this.getAttribute(`value`)??this.textContent?.trim()??``),this.render()}attributeChangedCallback(e,t,n){this.rendered&&t!==n&&(e===`value`&&(this.text=n??``),this.editing||this.render())}get value(){return this.text}set value(e){this.valueSet=!0,this.text=String(e??``),this.rendered&&!this.editing&&this.render()}render(e=!1){let t=this.getAttribute(`label`)??f().persianInput.text;this.rendered=!0,this.editing=!1,this.innerHTML=`<span class="k-inline-edit"><button type="button" class="k-inline-edit__view" aria-label="${l(`${t}: ${this.text||f().inlineEdit.empty}${f().common.list}${f().common.edit}`)}">${this.text?l(this.text):`<span class="k-inline-edit__placeholder">${l(this.getAttribute(`placeholder`)??f().inlineEdit.empty)}</span>`}<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m13.5 3.5 3 3L7 16H4v-3Z"/></svg></button></span>`;let n=this.querySelector(`button`);n.addEventListener(`click`,()=>this.edit()),e&&n.focus()}edit(e,t=this.text){this.editing=!0;let n=this.getAttribute(`label`)??f().persianInput.text,r=_(`kashi-ie-err`);this.innerHTML=`<span class="k-inline-edit"><span class="k-field" style="gap: 4px"><span class="k-input"${e?` data-state="invalid"`:``}><input class="k-input__control" aria-label="${l(n)}" placeholder="${l(this.getAttribute(`placeholder`)??``)}"${e?` aria-invalid="true" aria-describedby="${r}"`:``}></span>${e?`<span class="k-hint k-hint--error" id="${r}">${l(e)}</span>`:``}</span><span class="k-inline-edit__actions"><button type="button" class="k-btn k-btn--primary k-btn--icon k-btn--sm" data-save aria-label="${l(f().common.save)}">${M}</button><button type="button" class="k-btn k-btn--secondary k-btn--icon k-btn--sm" data-cancel aria-label="${l(f().common.cancel)}">${N}</button></span></span>`;let i=this.querySelector(`input`);i.value=t,i.focus(),i.select(),i.addEventListener(`keydown`,e=>{e.key===`Enter`?(e.preventDefault(),this.commit(i.value)):e.key===`Escape`&&(e.preventDefault(),this.render(!0))}),this.querySelector(`[data-save]`).addEventListener(`click`,()=>this.commit(i.value)),this.querySelector(`[data-cancel]`).addEventListener(`click`,()=>this.render(!0))}async commit(e){let t=e.trim(),n=this.validate?.(t);if(n)return this.edit(n,e);if(t===this.text)return this.render(!0);let r=this.text,a=null;if(i(this,`kashi-save`,{value:t,wait:e=>a=e}),this.text=t,a){this.querySelector(`[data-save]`)?.setAttribute(`aria-busy`,`true`);try{await a}catch{return this.text=r,this.edit(f().inlineEdit.failed,e)}}this.render(!0),i(this,`kashi-change`,{value:t})}};X.observedAttributes=[`value`,`label`,`placeholder`],d(`kashi-multi-select`,I,`block`),d(`kashi-slider`,L,`block`),d(`kashi-chip-group`,R),d(`kashi-password-strength`,B,`block`),d(`kashi-persian-textarea`,U,`block`),d(`kashi-keyboard-fix`,W,`block`),d(`kashi-time-input`,q,`block`),d(`kashi-plate-input`,Y,`block`),d(`kashi-inline-edit`,X);export{R as KashiChipGroup,X as KashiInlineEdit,W as KashiKeyboardFix,I as KashiMultiSelect,B as KashiPasswordStrength,U as KashiPersianTextarea,Y as KashiPlateInput,L as KashiSlider,q as KashiTimeInput};
@@ -0,0 +1 @@
1
+ import{E as e}from"./base-DTQ50VdG.js";const t={"1-1":`عید نوروز`,"1-2":`عید نوروز`,"1-3":`عید نوروز`,"1-4":`عید نوروز`,"1-12":`روز جمهوری اسلامی`,"1-13":`روز طبیعت`,"3-14":`رحلت امام خمینی`,"3-15":`قیام ۱۵ خرداد`,"11-22":`پیروزی انقلاب اسلامی`,"12-29":`ملی شدن صنعت نفت`},n={"1-1":`Nowruz`,"1-2":`Nowruz`,"1-3":`Nowruz`,"1-4":`Nowruz`,"1-12":`Islamic Republic Day`,"1-13":`Nature Day`,"3-14":`Death of Imam Khomeini`,"3-15":`15 Khordad Uprising`,"11-22":`Islamic Revolution Victory Day`,"12-29":`Oil Nationalization Day`};function r(r,{extra:i={},friday:a=!0,locale:o=`fa`}={}){let{jm:s,jd:c}=e(r),l=`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,`0`)}-${String(r.getDate()).padStart(2,`0`)}`,u=(o===`en`?n:t)[`${s}-${c}`];return i[l]??i[`${s}-${c}`]??u??(a&&r.getDay()===5?o===`en`?`Friday`:`جمعه`:null)}export{r as t};
@@ -0,0 +1 @@
1
+ import{A as e,D as t,O as n,_ as r,c as i,d as a,g as o,i as s,k as c,l,o as u,p as d,t as f,u as p,v as m}from"./base-DTQ50VdG.js";import{t as h}from"./words-BdADG_9U.js";function g(e){let t=n(e);if(!/^\d{10}$/.test(t)||/^(\d)\1{9}$/.test(t))return!1;let r=Number(t[9]),i=0;for(let e=0;e<9;e++)i+=Number(t[e])*(10-e);let a=i%11;return a<2?r===a:r===11-a}const ee={melli:`Bank Melli`,sepah:`Bank Sepah`,edbi:`Export Development Bank`,bim:`Bank of Industry and Mine`,keshavarzi:`Bank Keshavarzi`,maskan:`Bank Maskan`,postbank:`Post Bank`,"tosee-taavon":`Tose'e Ta'avon Bank`,"eghtesad-novin":`EN Bank`,parsian:`Parsian Bank`,pasargad:`Bank Pasargad`,karafarin:`Karafarin Bank`,saman:`Saman Bank`,sina:`Sina Bank`,sarmayeh:`Sarmayeh Bank`,ayandeh:`Ayandeh Bank`,shahr:`Shahr Bank`,dey:`Dey Bank`,saderat:`Bank Saderat`,mellat:`Bank Mellat`,tejarat:`Tejarat Bank`,refah:`Refah Bank`,"iran-zamin":`Iran Zamin Bank`,"mehr-iran":`Mehr Iran Bank`,gardeshgari:`Tourism Bank`,markazi:`Central Bank of Iran`,khavarmianeh:`Middle East Bank`,noor:`Noor Credit Institution`,melal:`Melal Credit Institution`,tosee:`Tose'e Credit Institution`,resalat:`Resalat Bank`,ansar:`Ansar Bank`,ghavamin:`Ghavamin Bank`,hekmat:`Hekmat Iranian Bank`,kosar:`Kosar Credit Institution`,"mehr-eghtesad":`Mehr Eghtesad Bank`};function _(e,t=`fa`){return t===`en`?ee[e.slug]??e.name:e.name}const v={603799:{name:`بانک ملی`,slug:`melli`},589210:{name:`بانک سپه`,slug:`sepah`},627648:{name:`بانک توسعه صادرات`,slug:`edbi`},627961:{name:`بانک صنعت و معدن`,slug:`bim`},603770:{name:`بانک کشاورزی`,slug:`keshavarzi`},639217:{name:`بانک کشاورزی`,slug:`keshavarzi`},628023:{name:`بانک مسکن`,slug:`maskan`},627760:{name:`پست بانک`,slug:`postbank`},502908:{name:`بانک توسعه تعاون`,slug:`tosee-taavon`},627412:{name:`بانک اقتصاد نوین`,slug:`eghtesad-novin`},622106:{name:`بانک پارسیان`,slug:`parsian`},639194:{name:`بانک پارسیان`,slug:`parsian`},627884:{name:`بانک پارسیان`,slug:`parsian`},502229:{name:`بانک پاسارگاد`,slug:`pasargad`},639347:{name:`بانک پاسارگاد`,slug:`pasargad`},627488:{name:`بانک کارآفرین`,slug:`karafarin`},502910:{name:`بانک کارآفرین`,slug:`karafarin`},621986:{name:`بانک سامان`,slug:`saman`},639346:{name:`بانک سینا`,slug:`sina`},639607:{name:`بانک سرمایه`,slug:`sarmayeh`},636214:{name:`بانک آینده`,slug:`ayandeh`},502806:{name:`بانک شهر`,slug:`shahr`},504706:{name:`بانک شهر`,slug:`shahr`},502938:{name:`بانک دی`,slug:`dey`},603769:{name:`بانک صادرات`,slug:`saderat`},610433:{name:`بانک ملت`,slug:`mellat`},991975:{name:`بانک ملت`,slug:`mellat`},627353:{name:`بانک تجارت`,slug:`tejarat`},585983:{name:`بانک تجارت`,slug:`tejarat`},589463:{name:`بانک رفاه`,slug:`refah`},505785:{name:`بانک ایران زمین`,slug:`iran-zamin`},606373:{name:`بانک قرض‌الحسنه مهر ایران`,slug:`mehr-iran`},505416:{name:`بانک گردشگری`,slug:`gardeshgari`},636795:{name:`بانک مرکزی`,slug:`markazi`},585947:{name:`بانک خاورمیانه`,slug:`khavarmianeh`},505809:{name:`بانک خاورمیانه`,slug:`khavarmianeh`},507677:{name:`موسسه اعتباری نور`,slug:`noor`},606256:{name:`موسسه اعتباری ملل`,slug:`melal`},628157:{name:`موسسه اعتباری توسعه`,slug:`tosee`},504172:{name:`بانک قرض‌الحسنه رسالت`,slug:`resalat`},627381:{name:`بانک انصار`,slug:`ansar`},639599:{name:`بانک قوامین`,slug:`ghavamin`},636949:{name:`بانک حکمت ایرانیان`,slug:`hekmat`},505801:{name:`موسسه اعتباری کوثر`,slug:`kosar`},639370:{name:`بانک مهر اقتصاد`,slug:`mehr-eghtesad`}};function te(e){let t=0;for(let n=0;n<e.length;n++){let r=Number(e[e.length-1-n]);n%2==1&&(r*=2,r>9&&(r-=9)),t+=r}return t%10==0}function y(e){let t=n(e);return/^\d{16}$/.test(t)&&te(t)}function b(e){let t=n(e);return t.length>=6?v[t.slice(0,6)]??null:null}function x(e){return n(e).slice(0,16).replace(/(\d{4})(?=\d)/g,`$1 `)}const S={"010":{name:`بانک مرکزی`,slug:`markazi`},"011":{name:`بانک صنعت و معدن`,slug:`bim`},"012":{name:`بانک ملت`,slug:`mellat`},"013":{name:`بانک رفاه`,slug:`refah`},"014":{name:`بانک مسکن`,slug:`maskan`},"015":{name:`بانک سپه`,slug:`sepah`},"016":{name:`بانک کشاورزی`,slug:`keshavarzi`},"017":{name:`بانک ملی`,slug:`melli`},"018":{name:`بانک تجارت`,slug:`tejarat`},"019":{name:`بانک صادرات`,slug:`saderat`},"020":{name:`بانک توسعه صادرات`,slug:`edbi`},"021":{name:`پست بانک`,slug:`postbank`},"022":{name:`بانک توسعه تعاون`,slug:`tosee-taavon`},"053":{name:`بانک کارآفرین`,slug:`karafarin`},"054":{name:`بانک پارسیان`,slug:`parsian`},"055":{name:`بانک اقتصاد نوین`,slug:`eghtesad-novin`},"056":{name:`بانک سامان`,slug:`saman`},"057":{name:`بانک پاسارگاد`,slug:`pasargad`},"058":{name:`بانک سرمایه`,slug:`sarmayeh`},"059":{name:`بانک سینا`,slug:`sina`},"060":{name:`بانک قرض‌الحسنه مهر ایران`,slug:`mehr-iran`},"061":{name:`بانک شهر`,slug:`shahr`},"062":{name:`بانک آینده`,slug:`ayandeh`},"064":{name:`بانک گردشگری`,slug:`gardeshgari`},"066":{name:`بانک دی`,slug:`dey`},"069":{name:`بانک ایران زمین`,slug:`iran-zamin`},"070":{name:`بانک قرض‌الحسنه رسالت`,slug:`resalat`},"078":{name:`بانک خاورمیانه`,slug:`khavarmianeh`}};function C(e){return c(e).toUpperCase().replace(/^\s*IR/,``).replace(/\D/g,``).slice(0,24)}function ne(e){let t=0;for(let n=0;n<e.length;n+=7)t=Number(String(t)+e.slice(n,n+7))%97;return t}function re(e){let t=c(e).toUpperCase().replace(/[\s-]/g,``),n=t.startsWith(`IR`)?t.slice(2):t;return/^\d{24}$/.test(n)?ne(n.slice(2)+`1827`+n.slice(0,2))===1:!1}function w(e){let t=C(e);return t.length>=5?S[t.slice(2,5)]??null:null}function ie(e){let t=C(e);return t?`IR${t}`.replace(/(.{4})(?=.)/g,`$1 `):``}const ae={name:`همراه اول`,slug:`mci`},T={name:`ایرانسل`,slug:`irancell`},E={name:`رایتل`,slug:`rightel`},D={mci:`Hamrah-e Aval`,irancell:`Irancell`,rightel:`RighTel`},O=(e,t=`fa`)=>t===`en`?D[e.slug]:e.name,k={...Object.fromEntries([`10`,`11`,`12`,`13`,`14`,`15`,`16`,`17`,`18`,`19`,`90`,`91`,`92`,`93`,`94`].map(e=>[e,ae])),...Object.fromEntries([`01`,`02`,`03`,`04`,`05`,`30`,`33`,`35`,`36`,`37`,`38`,`39`,`41`].map(e=>[e,T])),...Object.fromEntries([`20`,`21`,`22`].map(e=>[e,E]))};function A(e){let t=n(e);return t.startsWith(`0098`)?t=`0`+t.slice(4):t.startsWith(`98`)&&t.length===12?t=`0`+t.slice(2):t.startsWith(`9`)&&t.length===10&&(t=`0`+t),t}function j(e){return/^09\d{9}$/.test(A(e))}function M(e){let t=A(e);return t.length>=4&&t.startsWith(`09`)?k[t.slice(2,4)]??null:null}function N(e){let t=A(e).slice(0,11);return[t.slice(0,4),t.slice(4,7),t.slice(7,11)].filter(Boolean).join(` `)}function P(e){let t=n(e);return/^(?!(\d)\1{3})[13-9]{4}[1346-9][013-9]{5}$/.test(t)}function F(e){let t=n(e).slice(0,10);return t.length>5?`${t.slice(0,5)}-${t.slice(5)}`:t}const I={11:`مازندران`,13:`گیلان`,17:`گلستان`,21:`تهران`,23:`سمنان`,24:`زنجان`,25:`قم`,26:`البرز`,28:`قزوین`,31:`اصفهان`,34:`کرمان`,35:`یزد`,38:`چهارمحال و بختیاری`,41:`آذربایجان شرقی`,44:`آذربایجان غربی`,45:`اردبیل`,51:`خراسان رضوی`,54:`سیستان و بلوچستان`,56:`خراسان جنوبی`,58:`خراسان شمالی`,61:`خوزستان`,66:`لرستان`,71:`فارس`,74:`کهگیلویه و بویراحمد`,76:`هرمزگان`,77:`بوشهر`,81:`همدان`,83:`کرمانشاه`,84:`ایلام`,86:`مرکزی`,87:`کردستان`};function L(e){let t=n(e);return t.startsWith(`0098`)?t=`0`+t.slice(4):t.startsWith(`98`)&&t.length===12?t=`0`+t.slice(2):/^[1-8]/.test(t)&&t.length===10&&(t=`0`+t),t}function R(e){let t=L(e);return t.length>=3&&t[0]===`0`?I[t.slice(1,3)]??null:null}function z(e){let t=L(e);return/^0\d{2}[2-9]\d{7}$/.test(t)&&R(t)!==null}function B(e){let t=L(e).slice(0,11);return[t.slice(0,3),t.slice(3,7),t.slice(7,11)].filter(Boolean).join(` `)}const V=[29,27,23,19,17,29,27,23,19,17];function H(e){let t=n(e);if(!/^\d{11}$/.test(t)||/^0+$/.test(t.slice(3,9)))return!1;let r=[...t].map(Number),i=r[9]+2,a=0;for(let e=0;e<10;e++)a+=(r[e]+i)*V[e];let o=a%11;return(o===10?0:o)===r[10]}const U=t=>e(t);function W(e,t){if(t===0)return e.search(/[0-9۰-۹]/)===-1?e.length:e.search(/[0-9۰-۹]/);let n=0;for(let r=0;r<e.length;r++)if(/[0-9۰-۹]/.test(e[r])&&++n===t)return r+1;return e.length}var G=class extends f{constructor(){super(...arguments),this.raw=``,this.touched=!1,this.valueSet=!1,this.rendered=!1,this.key=m(`kashi-in`),this.logoSlug=null}connectedCallback(){if(!this.rendered&&!this.valueSet&&(this.raw=this.clean(this.getAttribute(`value`)??``)),Object.prototype.hasOwnProperty.call(this,`value`)){let e=this.value;delete this.value,this.raw=this.clean(String(e??``))}this.render()}attributeChangedCallback(e,t,n){this.rendered&&t!==n&&(e===`value`?this.setRaw(this.clean(n??``),!1):this.render())}get value(){return this.kind.submit?this.kind.submit(this.raw):this.raw}set value(e){this.valueSet=!0,this.setRaw(this.clean(String(e??``)),!1)}get valid(){return this.isValid()}isValid(){return this.kind.valid(this.raw)}focus(e){this.input?.focus(e)}clean(e){let t=this.kind;return(t.normalize??(e=>e))(n(e)).slice(0,t.maxDigits)}get digits(){let e=this.getAttribute(`digits`);return e===`fa`||e===`latin`?e:a()===`en`?`latin`:this.kind.digits}shown(){let e=this.kind.format(this.raw);return this.digits===`fa`?U(e):e}render(){let e=this.kind,t=this.key,n=this.getAttribute(`aria-label`),r=this.hasAttribute(`label`)?this.getAttribute(`label`):n?null:e.label(),i=this.getAttribute(`size`),a=this.hasAttribute(`required`),o=this.hasAttribute(`disabled`),s=this.getAttribute(`placeholder`)??e.placeholder[this.digits],c=`<div class="k-input${i===`sm`||i===`lg`?` k-input--${i}`:``}" data-size="${i??`md`}"${o?` data-state="disabled"`:``}><input id="${t}" class="k-input__control" type="${e.type??`text`}" inputmode="${e.inputMode??`numeric`}" autocomplete="${e.autocomplete??`off`}" dir="ltr" spellcheck="false" placeholder="${l(s)}"${a?` required`:``}${o?` disabled`:``}${this.hasAttribute(`readonly`)?` readonly`:``}${!r&&n?` aria-label="${l(n)}"`:``}></div>`;this.querySelector(`:scope > .k-field`)?.remove(),this.insertAdjacentHTML(`afterbegin`,p({id:t,label:r,required:a,control:c})),this.input=this.querySelector(`input.k-input__control`),this.input.addEventListener(`input`,()=>this.onInput()),this.input.addEventListener(`blur`,()=>{this.touched=!0,this.paint()}),this.rendered=!0,this.paint()}onInput(){let e=this.input,t=e.value.slice(0,e.selectionStart??e.value.length),r=this.clean(e.value),i=Math.min(n(t).length,r.length);if(this.setRaw(r,!0),e.ownerDocument.activeElement===e){let t=W(e.value,i);e.setSelectionRange(t,t)}}setRaw(e,t){let n=e!==this.raw;this.raw=e,this.rendered&&(this.paint(),t&&n&&i(this,`kashi-change`,{value:this.value,valid:this.isValid(),...this.kind.detail?.(this.raw)}))}invalidText(e){return this.raw.length>0&&(e||this.raw.length===this.kind.maxDigits)&&!this.isValid()?this.getAttribute(`invalid-message`)??this.kind.invalidMessage():null}hintText(){return this.getAttribute(`hint`)}paint(){let e=this.input,t=this.shown();e.value!==t&&(e.value=t);let n=e.parentElement;n.querySelector(`:scope > .k-input__addon`)?.remove();let i=s(this,`show-meta`,!0)?this.kind.meta?.(this.raw,this):null,a=`${this.key}-meta`;if(i){let e=document.createElement(`span`);e.className=`k-input__addon`,e.innerHTML=i.bank?`<span class="k-bank" id="${a}">${l(i.text)}</span>`:`<span class="k-input__meta" id="${a}">${l(i.text)}</span>`,n.append(e),i.bank&&s(this,`bank-logo`,!0)&&this.loadLogo(i.bank,e.firstElementChild)}let c=this.getAttribute(`error`)||this.invalidText(this.touched);e.setCustomValidity(this.raw&&!this.isValid()?this.invalidText(!0)??``:``),o(this.querySelector(`:scope > .k-field`),e,this.key,c,this.hintText(),i?a:null),r(this,this.getAttribute(`name`),this.raw?this.value:``)}loadLogo(e,t){this.logoSlug=e.slug,import(`./dist-D670Gw0K.js`).then(n=>{let r=n.bankLogoDataUri(e.slug);if(!r||this.logoSlug!==e.slug||!t.isConnected)return;let i=document.createElement(`img`);i.className=`k-bank__logo`,i.src=r,i.alt=``,i.width=i.height=24,t.prepend(i)}).catch(()=>{})}};G.observedAttributes=[`label`,`hint`,`error`,`placeholder`,`required`,`disabled`,`readonly`,`digits`,`invalid-message`,`name`,`value`,`size`,`aria-label`,`show-meta`,`bank-logo`];var K=class extends G{constructor(){super(...arguments),this.kind={label:()=>d().persianInput[`national-id`],maxDigits:10,format:e=>e,valid:e=>g(e),invalidMessage:()=>d().invalid.nationalId,placeholder:{fa:`۰۰۰۰۰۰۰۰۰۰`,latin:`0000000000`},digits:`fa`}}},q=class extends G{constructor(){super(...arguments),this.kind={label:()=>d().persianInput[`legal-id`],maxDigits:11,format:e=>e,valid:e=>H(e),invalidMessage:()=>d().invalid.legalId,placeholder:{fa:`۰۰۰۰۰۰۰۰۰۰۰`,latin:`00000000000`},digits:`fa`}}},J=class extends G{constructor(){super(...arguments),this.kind={label:()=>d().persianInput.mobile,maxDigits:11,normalize:A,format:N,valid:e=>j(e),invalidMessage:()=>d().invalid.mobile,placeholder:{fa:`۰۹۱۲ ۳۴۵ ۶۷۸۹`,latin:`0912 345 6789`},digits:`fa`,type:`tel`,inputMode:`tel`,autocomplete:`tel-national`,meta:e=>{let t=M(e);return t?{text:O(t,a())}:null},detail:e=>({operator:M(e)?.name??null})}}},Y=class extends G{constructor(){super(...arguments),this.kind={label:()=>d().persianInput.landline,maxDigits:11,normalize:L,format:B,valid:e=>z(e),invalidMessage:()=>d().invalid.landline,placeholder:{fa:`۰۲۱ ۸۸۷۷ ۶۶۵۵`,latin:`021 8877 6655`},digits:`fa`,type:`tel`,inputMode:`tel`,autocomplete:`tel-national`,meta:e=>{let t=R(e);return t?{text:t}:null},detail:e=>({province:R(e)})}}},X=class extends G{constructor(){super(...arguments),this.kind={label:()=>d().persianInput.card,maxDigits:16,format:x,valid:e=>y(e),invalidMessage:()=>d().invalid.card,placeholder:{fa:`۰۰۰۰ ۰۰۰۰ ۰۰۰۰ ۰۰۰۰`,latin:`0000 0000 0000 0000`},digits:`fa`,autocomplete:`cc-number`,meta:e=>{let t=b(e);return t?{text:_(t,a()),bank:t}:null},detail:e=>({bank:b(e)?.name??null})}}},Z=class extends G{constructor(){super(...arguments),this.kind={label:()=>d().persianInput.iban,maxDigits:24,format:e=>ie(e),valid:e=>re(e),invalidMessage:()=>d().invalid.iban,placeholder:{fa:`IR00 0000 0000 0000 0000 0000 00`,latin:`IR00 0000 0000 0000 0000 0000 00`},digits:`latin`,meta:e=>{let t=w(e);return t?{text:_(t,a()),bank:t}:null},submit:e=>e?`IR${e}`:``,detail:e=>({bank:w(e)?.name??null})}}clean(e){return super.clean(e.replace(/^\s*IR/i,``))}},Q=class extends G{constructor(){super(...arguments),this.kind={label:()=>d().persianInput.postal,maxDigits:10,format:F,valid:e=>P(e),invalidMessage:()=>d().invalid.postal,placeholder:{fa:`۱۲۳۴۵-۶۷۸۹۰`,latin:`12345-67890`},digits:`fa`,autocomplete:`postal-code`}}},$=class extends G{constructor(){super(...arguments),this.kind={label:()=>d().persianInput.price,maxDigits:15,normalize:e=>e.replace(/^0+(?=\d)/,``),format:e=>e?t(e,{digits:`latin`}).replace(/,/g,this.digits===`fa`?`٬`:`,`):``,valid:()=>this.inRange(),invalidMessage:()=>``,placeholder:{fa:`۰`,latin:`0`},digits:`fa`,meta:(e,t)=>{let n=t.getAttribute(`unit`)??d().money.toman;return n?{text:n}:null},detail:e=>({value:e?Number(e):null})}}get valueAsNumber(){return this.raw?Number(this.raw):null}num(e){let t=this.getAttribute(e);return t===null||t===``||Number.isNaN(Number(t))?void 0:Number(t)}inRange(){if(!this.raw)return!0;let e=Number(this.raw),t=this.num(`min`),n=this.num(`max`);return!(t!==void 0&&e<t||n!==void 0&&e>n)}invalidText(e){if(!e||this.inRange())return null;let n=this.getAttribute(`invalid-message`);if(n)return n;let r=this.num(`min`),i=this.num(`max`),a=e=>this.digits===`fa`?U(t(e)):t(e,{digits:`latin`}),o=d().invalid;return r!==void 0&&i!==void 0?o.priceRange(a(r),a(i)):r===void 0?o.priceMax(a(i)):o.priceMin(a(r))}hintText(){if(this.raw&&s(this,`show-words`,!0)){let e=this.getAttribute(`unit`)??d().money.toman;return`${h(Number(this.raw),{locale:a()})}${e?` ${e}`:``}`}return this.getAttribute(`hint`)}};$.observedAttributes=[...G.observedAttributes,`unit`,`min`,`max`,`show-words`],u(`kashi-national-id`,K,`block`),u(`kashi-legal-id`,q,`block`),u(`kashi-mobile`,J,`block`),u(`kashi-landline`,Y,`block`),u(`kashi-card-number`,X,`block`),u(`kashi-iban`,Z,`block`),u(`kashi-postal-code`,Q,`block`),u(`kashi-price`,$,`block`);export{X as KashiCardNumber,G as KashiDigitsInput,Z as KashiIban,Y as KashiLandline,q as KashiLegalId,J as KashiMobile,K as KashiNationalId,Q as KashiPostalCode,$ as KashiPrice};
@@ -1 +1 @@
1
- import{a as e,n as t,s as n,t as r}from"./base-Cmq7zeIG.js";let i=1;function a(){let e=document.querySelectorAll(`kashi-toaster`);if(e.length)return e[e.length-1];let t=document.createElement(`kashi-toaster`);return document.body.append(t),t}function o(e){let t=e.id??i++;return a().upsert({...e,id:t}),t}function s(e){return o(typeof e==`string`?{title:e}:e)}s.success=(e,t={})=>s({...t,title:e,tone:`success`}),s.error=(e,t={})=>s({...t,title:e,tone:`error`}),s.warning=(e,t={})=>s({...t,title:e,tone:`warning`}),s.info=(e,t={})=>s({...t,title:e,tone:`info`}),s.dismiss=e=>document.querySelectorAll(`kashi-toaster`).forEach(t=>t.dismiss(e)),s.promise=(e,t)=>{let n=o({title:t.loading,tone:`info`,duration:1/0,loading:!0});return e.then(e=>o({id:n,title:typeof t.success==`function`?t.success(e):t.success,tone:`success`}),e=>o({id:n,title:typeof t.error==`function`?t.error(e):t.error,tone:`error`})),e};var c=class extends r{constructor(){super(...arguments),this.list=null}connectedCallback(){this.list||=(this.innerHTML=`<section><ol class="k-toaster" aria-live="polite"></ol></section>`,this.querySelector(`ol`)),this.decorate()}attributeChangedCallback(){this.list&&this.decorate()}decorate(){let e=this.getAttribute(`placement`)??`bottom-end`;this.list.className=`k-toaster k-toaster--${e}`,this.list.dataset.placement=e,this.querySelector(`section`).setAttribute(`aria-label`,this.getAttribute(`label`)??`اعلان‌ها`)}upsert(e){this.list||this.connectedCallback();let t=[...this.list.children].find(t=>t.toastId===e.id),n=l(e,this.getAttribute(`close-label`)??`بستن اعلان`,()=>this.dismiss(e.id));t?(t.stop?.(),t.replaceWith(n)):this.list.append(n);let r=Number(this.getAttribute(`max`))||5;for(;this.list.children.length>r;)this.list.firstElementChild.stop?.(),this.list.firstElementChild.remove()}dismiss(e){let t=[...this.list?.children??[]].find(t=>t.toastId===e);t&&t.dataset.state!==`closing`&&(t.stop?.(),t.dataset.state=`closing`,setTimeout(()=>t.remove(),200))}};c.observedAttributes=[`placement`,`label`];function l(e,r,i){let a=e.duration??(e.action?1/0:5e3),o=e.tone??`neutral`,s=document.createElement(`li`);s.toastId=e.id,s.className=`k-toast${o===`neutral`?``:` k-toast--${o}`}`,s.dataset.state=`open`,s.setAttribute(`role`,o===`error`?`alert`:`status`),s.innerHTML=`<span class="k-toast__icon" aria-hidden="true">${e.loading?`<span class="k-spinner k-spinner--sm" style="color: inherit"></span>`:t[o===`neutral`?`info`:o]}</span><div class="k-toast__content"><p class="k-toast__title">${n(e.title)}</p>${e.description?`<p class="k-toast__description">${n(e.description)}</p>`:``}${e.action?`<button type="button" class="k-btn k-btn--link k-toast__action">${n(e.action.label)}</button>`:``}</div><button type="button" class="k-btn k-btn--tertiary k-btn--icon k-btn--sm k-toast__close" aria-label="${n(r)}">${t.close}</button>${Number.isFinite(a)?`<span class="k-toast__progress" aria-hidden="true" style="animation-duration: ${a}ms"></span>`:``}`,s.querySelector(`.k-toast__close`).addEventListener(`click`,i),s.querySelector(`.k-toast__action`)?.addEventListener(`click`,()=>{e.action.onClick(),i()}),s.addEventListener(`keydown`,e=>e.key===`Escape`&&i());let c=a,l=0,u,d=()=>{u===void 0&&Number.isFinite(c)&&(l=Date.now(),u=setTimeout(i,c))},f=()=>{u!==void 0&&(clearTimeout(u),u=void 0,c-=Date.now()-l)};return s.addEventListener(`mouseenter`,f),s.addEventListener(`focusin`,f),s.addEventListener(`mouseleave`,d),s.addEventListener(`focusout`,d),s.stop=()=>{clearTimeout(u),c=1/0},d(),s}e(`kashi-toaster`,c),typeof document<`u`&&document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`[data-kashi-toast]`);t&&s({title:t.dataset.kashiToast,description:t.dataset.description,tone:t.dataset.tone??`neutral`})});const u=/* @__PURE__ */ new Set([[[`kashi-national-id`,`kashi-legal-id`,`kashi-mobile`,`kashi-landline`,`kashi-card-number`,`kashi-iban`,`kashi-postal-code`,`kashi-price`],()=>import(`./inputs-BjOddAM7.js`)],[[`kashi-otp`],()=>import(`./fields-BUTaSN8m.js`)],[[`kashi-combobox`,`kashi-province-select`,`kashi-city-select`],()=>import(`./combobox-ZGrZ5okg.js`)],[[`kashi-iran-map`,`kashi-address-form`],()=>import(`./map-BHuusa4t.js`)],[[`kashi-calendar`,`kashi-date-picker`],()=>import(`./calendar-Dm3fq2bs.js`)],[[`kashi-money`,`kashi-date`,`kashi-relative-time`,`kashi-countdown`],()=>import(`./display-C975tS7j.js`)],[[`kashi-dialog`,`kashi-tabs`,`kashi-tooltip`,`kashi-copy-button`],()=>import(`./overlay-DX9un2xm.js`)],[[`kashi-dropdown-menu`,`kashi-popover`],()=>import(`./menu-DhrqyLgy.js`)],[[`kashi-tag-input`,`kashi-number-input`,`kashi-rating`,`kashi-pagination`],()=>import(`./controls-K-OZcjg4.js`)],[[`kashi-data-table`],()=>import(`./table-DPQfDMs-.js`)],[[`kashi-multi-select`,`kashi-slider`,`kashi-chip-group`,`kashi-password-strength`,`kashi-persian-textarea`,`kashi-keyboard-fix`,`kashi-time-input`,`kashi-plate-input`,`kashi-inline-edit`],()=>import(`./forms-C-effPKn.js`)],[[`kashi-date-range-picker`,`kashi-month-picker`,`kashi-file-upload`,`kashi-color-picker`],()=>import(`./pickers-BFLpUruK.js`)],[[`kashi-bar-chart`,`kashi-line-chart`,`kashi-pie-chart`,`kashi-bar-list`,`kashi-proportion-bar`,`kashi-sparkline`,`kashi-activity-heatmap`],()=>import(`./charts-DNOWi4sJ.js`)],[[`kashi-command-palette`,`kashi-context-menu`,`kashi-carousel`,`kashi-tree-view`,`kashi-tour`,`kashi-splitter`,`kashi-side-nav`],()=>import(`./nav-D_w5BV_K.js`)]]);function d(){for(let e of u)document.querySelector(e[0].join(`,`))&&(u.delete(e),e[1]().catch(e=>console.error(`[kashi] بارگذاری نشد:`,e)));u.size||p?.disconnect()}function f(){let e=[...u].map(([,e])=>e());return u.clear(),p?.disconnect(),Promise.all(e)}let p=null;typeof document<`u`&&(d(),p=new MutationObserver(d),p.observe(document.documentElement,{childList:!0,subtree:!0}));export{f as loadAll,s as toast};
1
+ import{h as e,l as t,n,o as r,p as i,t as a}from"./base-DTQ50VdG.js";let o=1;function s(){let e=document.querySelectorAll(`kashi-toaster`);if(e.length)return e[e.length-1];let t=document.createElement(`kashi-toaster`);return document.body.append(t),t}function c(e){let t=e.id??o++;return s().upsert({...e,id:t}),t}function l(e){return c(typeof e==`string`?{title:e}:e)}l.success=(e,t={})=>l({...t,title:e,tone:`success`}),l.error=(e,t={})=>l({...t,title:e,tone:`error`}),l.warning=(e,t={})=>l({...t,title:e,tone:`warning`}),l.info=(e,t={})=>l({...t,title:e,tone:`info`}),l.dismiss=e=>document.querySelectorAll(`kashi-toaster`).forEach(t=>t.dismiss(e)),l.promise=(e,t)=>{let n=c({title:t.loading,tone:`info`,duration:1/0,loading:!0});return e.then(e=>c({id:n,title:typeof t.success==`function`?t.success(e):t.success,tone:`success`}),e=>c({id:n,title:typeof t.error==`function`?t.error(e):t.error,tone:`error`})),e};var u=class extends a{constructor(){super(...arguments),this.list=null}connectedCallback(){this.list||=(this.innerHTML=`<section><ol class="k-toaster" aria-live="polite"></ol></section>`,this.querySelector(`ol`)),this.decorate()}attributeChangedCallback(){this.list&&this.decorate()}decorate(){let e=this.getAttribute(`placement`)??`bottom-end`;this.list.className=`k-toaster k-toaster--${e}`,this.list.dataset.placement=e,this.querySelector(`section`).setAttribute(`aria-label`,this.getAttribute(`label`)??i().toast.region)}upsert(e){this.list||this.connectedCallback();let t=[...this.list.children].find(t=>t.toastId===e.id),n=d(e,this.getAttribute(`close-label`)??i().toast.close,()=>this.dismiss(e.id));t?(t.stop?.(),t.replaceWith(n)):this.list.append(n);let r=Number(this.getAttribute(`max`))||5;for(;this.list.children.length>r;)this.list.firstElementChild.stop?.(),this.list.firstElementChild.remove()}dismiss(e){let t=[...this.list?.children??[]].find(t=>t.toastId===e);t&&t.dataset.state!==`closing`&&(t.stop?.(),t.dataset.state=`closing`,setTimeout(()=>t.remove(),200))}};u.observedAttributes=[`placement`,`label`];function d(e,r,i){let a=e.duration??(e.action?1/0:5e3),o=e.tone??`neutral`,s=document.createElement(`li`);s.toastId=e.id,s.className=`k-toast${o===`neutral`?``:` k-toast--${o}`}`,s.dataset.state=`open`,s.setAttribute(`role`,o===`error`?`alert`:`status`),s.innerHTML=`<span class="k-toast__icon" aria-hidden="true">${e.loading?`<span class="k-spinner k-spinner--sm" style="color: inherit"></span>`:n[o===`neutral`?`info`:o]}</span><div class="k-toast__content"><p class="k-toast__title">${t(e.title)}</p>${e.description?`<p class="k-toast__description">${t(e.description)}</p>`:``}${e.action?`<button type="button" class="k-btn k-btn--link k-toast__action">${t(e.action.label)}</button>`:``}</div><button type="button" class="k-btn k-btn--tertiary k-btn--icon k-btn--sm k-toast__close" aria-label="${t(r)}">${n.close}</button>${Number.isFinite(a)?`<span class="k-toast__progress" aria-hidden="true" style="animation-duration: ${a}ms"></span>`:``}`,s.querySelector(`.k-toast__close`).addEventListener(`click`,i),s.querySelector(`.k-toast__action`)?.addEventListener(`click`,()=>{e.action.onClick(),i()}),s.addEventListener(`keydown`,e=>e.key===`Escape`&&i());let c=a,l=0,u,d=()=>{u===void 0&&Number.isFinite(c)&&(l=Date.now(),u=setTimeout(i,c))},f=()=>{u!==void 0&&(clearTimeout(u),u=void 0,c-=Date.now()-l)};return s.addEventListener(`mouseenter`,f),s.addEventListener(`focusin`,f),s.addEventListener(`mouseleave`,d),s.addEventListener(`focusout`,d),s.stop=()=>{clearTimeout(u),c=1/0},d(),s}r(`kashi-toaster`,u),typeof document<`u`&&document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`[data-kashi-toast]`);t&&l({title:t.dataset.kashiToast,description:t.dataset.description,tone:t.dataset.tone??`neutral`})});const f=/* @__PURE__ */ new Set([[[`kashi-national-id`,`kashi-legal-id`,`kashi-mobile`,`kashi-landline`,`kashi-card-number`,`kashi-iban`,`kashi-postal-code`,`kashi-price`],()=>import(`./inputs-R7nEHfbV.js`)],[[`kashi-otp`],()=>import(`./fields-DhLIhHQ8.js`)],[[`kashi-combobox`,`kashi-province-select`,`kashi-city-select`],()=>import(`./combobox-6EFI2qqN.js`)],[[`kashi-iran-map`,`kashi-address-form`],()=>import(`./map-H3xiZd8Y.js`)],[[`kashi-calendar`,`kashi-date-picker`],()=>import(`./calendar-CYRrdGIf.js`)],[[`kashi-money`,`kashi-date`,`kashi-relative-time`,`kashi-countdown`],()=>import(`./display-DFuMkcj5.js`)],[[`kashi-dialog`,`kashi-tabs`,`kashi-tooltip`,`kashi-copy-button`],()=>import(`./overlay-CBv8grz3.js`)],[[`kashi-dropdown-menu`,`kashi-popover`],()=>import(`./menu-BAUSubXk.js`)],[[`kashi-tag-input`,`kashi-number-input`,`kashi-rating`,`kashi-pagination`],()=>import(`./controls-BwebEIlf.js`)],[[`kashi-data-table`],()=>import(`./table-Bt9WVLoo.js`)],[[`kashi-multi-select`,`kashi-slider`,`kashi-chip-group`,`kashi-password-strength`,`kashi-persian-textarea`,`kashi-keyboard-fix`,`kashi-time-input`,`kashi-plate-input`,`kashi-inline-edit`],()=>import(`./forms-BHivKDdC.js`)],[[`kashi-date-range-picker`,`kashi-month-picker`,`kashi-file-upload`,`kashi-color-picker`],()=>import(`./pickers-BHzNt_X8.js`)],[[`kashi-bar-chart`,`kashi-line-chart`,`kashi-pie-chart`,`kashi-bar-list`,`kashi-proportion-bar`,`kashi-sparkline`,`kashi-activity-heatmap`],()=>import(`./charts-D6KM26Vp.js`)],[[`kashi-input`,`kashi-textarea`,`kashi-banner`],()=>import(`./basic-CrEW2RKF.js`)],[[`kashi-appointment-picker`],()=>import(`./appointment-CrIZi8Bp.js`)],[[`kashi-command-palette`,`kashi-context-menu`,`kashi-carousel`,`kashi-tree-view`,`kashi-tour`,`kashi-splitter`,`kashi-side-nav`],()=>import(`./nav-NK-v48B5.js`)]]);function p(){for(let e of f)document.querySelector(e[0].join(`,`))&&(f.delete(e),e[1]().catch(e=>console.error(`[kashi] بارگذاری نشد:`,e)));f.size||h?.disconnect()}function m(){let e=[...f].map(([,e])=>e());return f.clear(),h?.disconnect(),Promise.all(e)}let h=null;typeof document<`u`&&(p(),h=new MutationObserver(p),h.observe(document.documentElement,{childList:!0,subtree:!0}));export{m as loadAll,e as setLocale,l as toast};
@@ -0,0 +1,12 @@
1
+ import{D as e,c as t,i as n,l as r,o as i,p as a,r as o,s,t as c,v as l}from"./base-DTQ50VdG.js";import{n as u,r as d,t as f}from"./combobox-6EFI2qqN.js";import"./inputs-R7nEHfbV.js";const p=`0 0 1000 907`,m={"آذربایجان شرقی":{x:123,y:128,d:`M163 199l1-7l10-12l11-8l17-2l20 2l7-4l-13-8l-2-7l-12-7l-1-7l2-10l-8-10l-5-17l-15 0l-10-6l10-13l7 0l2-16l-6-22l-13 8l-12 19l-8-2l-10 4l-5-5l5-9l5 1l12-6l6-7l-4-9l-8 1l-15 18l-10-1l-13 4l-33-8l-6 6l-3 10l0 14l-9 9l-3 10l5 7l4 34l4 7l2 15l16 10l12 1l8 8l11 7l5-7l13-5l8 5l2 13l7 3z`},"آذربایجان غربی":{x:39,y:59,d:`M75 53l-8-13l-9-3l-6-11l-5-4l-4-11l-17-11l-5 5l-3 17l-7 4l-11-1l1 13l6 4l-3 10l7 10l-1 8l2 7l0 15l7 1l-5 18l-6 9l0 6l8 1l4 6l8 3l-2 18l13 10l-3 12l7 5l-3 16l9 3l2 6l-3 7l7 9l6 0l6 20l1 7l7-2l12-15l8-3l4-8l4-2l13 2l27-3l6 6l11 2l10-11l-7-16l-12 1l-7-3l-2-13l-8-5l-13 5l-5 7l-11-7l-8-8l-12-1l-16-10l-2-15l-4-7l-4-34l-5-7l3-10l9-9l0-14l3-10z`},اردبیل:{x:202,y:87,d:`M229 168l7 5l3-4l12 1l-1-10l-8-8l-8-13l-5-13l3-13l12-14l-7-7l-9-12l-7-2l-5-9l-10-6l2-8l10-2l3-5l-8-9l-1-8l11-5l-15-18l-11-3l-29 21l-10 5l-4 8l4 9l-6 7l-12 6l-5-1l-5 9l5 5l10-4l8 2l12-19l13-8l6 22l-2 16l-7 0l-10 13l10 6l15 0l5 17l8 10l-2 10l1 7l12 7l2 7z`},اصفهان:{x:414,y:418,d:`M296 467l10-6l9-1l6 4l10 0l6-4l15-2l6 10l1 10l15 12l4 11l-4 7l-1 18l5 16l0 7l3 11l14 12l5-1l0-11l7-21l-9-7l6-6l17-11l4 10l16 2l18-5l-3-9l5-25l-2-19l15-11l9-2l16 4l55-19l9-6l6-19l3-4l12-5l6-12l-1-42l-4-3l-125 4l-25-8l-23 0l-10-6l-17 5l-15 1l-8 6l-2 12l3 3l-7 19l-12 5l-22 6l-13 8l-1 9l-7 14l-8 2l-4 11l-8 7l2 6l13 3z`},البرز:{x:353,y:249,d:`M351 227l-12-1l-8 2l11 9l-5 13l-12 7l-3 7l2 5l16 1l11 3l13-13l4-11l12-3l0-6l-3-4l-14-6z`},ایلام:{x:143,y:429,d:`M87 397l8 0l8 16l6 7l1 6l-4 13l9 0l11 4l12 8l21 18l12 1l3 7l9 14l9-7l-1-7l9-16l-10-20l-13-15l-11-5l-22-20l7-9l18-5l6-6l-2-9l-11 1l1 12l-24 1l-13-4l-7-5l-16-5l-11 1z`},بوشهر:{x:387,y:698,d:`M312 606l4 5l1 11l5 5l8 12l13 12l0 19l10 0l4 4l-5 9l3 5l9 6l1 10l4 10l6 7l0 7l6 10l11 8l7 1l15 0l12 9l9 2l8 6l2 11l4 2l2-3l13-1l-10-7l-14-15l-7-16l-9-8l-9-27l-24-44l-8-6l-14-19l-21-5l-6-9l-1-7l-9-4l-11-2z`},تهران:{x:384,y:274,d:`M380 240l0 6l-12 3l-4 11l-13 13l4 10l-5 14l15 1l13 3l29 18l5-16l-8-12l2-15l6 1l13 8l24 5l11-5l8-7l2-6l-3-14l-11-2l-22-7l-11 12l-12-1l-10-13l-15-4z`},"چهارمحال و بختیاری":{x:346,y:499,d:`M323 529l12 6l5 0l19 17l8 1l11-4l0-7l-5-16l1-18l4-7l-4-11l-15-12l-1-10l-6-10l-15 2l-6 4l-10 0l-6-4l-9 1l-10 6l1 5l9 17l6 4l6 14l8 9l1 6z`},"خراسان جنوبی":{x:802,y:473,d:`M734 452l-3 11l7 13l-3 13l-7 9l-11 22l59 27l8 5l21 30l40-12l18 10l12 15l10-4l-3-12l1-20l6-17l0-11l-16-2l-3-33l3-14l-13-45l0-10l13-16l3-9l-12 0l-7-5l0-13l-2-15l-36 1l-7-3l-8-10l-10 4l-16 3l-2 2l-14-2l-3 22l-2 6l4 8l8 6l-7 11l-16 11l-7 11z`},"خراسان رضوی":{x:784,y:272,d:`M657 206l6 6l-4 10l0 19l4 12l15 14l0 4l-13 22l-11 4l-13 10l-8 10l21-5l21-10l13-4l6 2l15 12l1 8l-5 5l-21 14l-3 6l-7 20l0 11l3 18l2 4l11 1l13-3l4 7l4 26l3 7l14 8l6 8l5-13l7-11l16-11l7-11l-8-6l-4-8l2-6l3-22l14 2l2-2l16-3l10-4l8 10l7 3l36-1l2-7l7-7l12-1l-9-14l12-6l6-11l3-16l0-13l9-18l-3-7l1-14l-4-8l3-7l-4-19l2-11l-6-4l-38 1l-17-26l-27-10l-7-9l-1-11l-7-2l-9-6l-9-4l-8 2l-10-3l-8 4l-8-3l-2-7l-23-8l-8 6l0 9l24 1l7 11l-1 9l-7 21l11 9l-4 5l1 9l-5 3l-15-2l-34-20l-9 0l-12 10z`},"خراسان شمالی":{x:674,y:152,d:`M712 124l-20-4l0-8l-7-12l-9 5l-16-5l-8 2l-8-1l-14 11l0 21l7 5l-2 8l-15 6l-5 8l12 16l-2 15l13 14l11 3l8-2l3-11l12-10l9 0l34 20l15 2l5-3l-1-9l4-5l-11-9l7-21l1-9l-7-11l-24-1l0-9z`},خوزستان:{x:253,y:524,d:`M183 491l13 21l-8 22l0 25l18 1l0 31l7 2l13 12l3 14l8 2l1-5l13 1l3-3l-1-10l-3-6l6-10l10 0l-9 12l13 9l12 0l6 8l17-11l7 0l9-2l11 2l-4-19l2-10l-8-5l-6-7l-9 2l0-9l-2-9l2-7l6-3l10-10l4-7l-1-6l-8-9l-6-14l-6-4l-9-17l-1-5l0-10l-13-3l-2-6l-11 0l-12-8l-12-1l-11-5l-22 2l-3 2l-10 23l-9 16l1 7z`},زنجان:{x:228,y:211,d:`M170 215l2 1l26 6l4 7l1 15l-3 11l14 8l3 4l4 5l11 0l9 4l6-5l-11-12l10-5l13-3l9-6l9-3l0-8l-4-11l-8-3l-6-11l1-9l10-5l-3-11l-8-9l-8-5l-12-1l-3 4l-7-5l-7 4l-20-2l-17 2l-11 8l-10 12l-1 7z`},سمنان:{x:554,y:286,d:`M615 160l-12 17l-10 22l-18-3l-14 6l-12 11l-7 3l-18 0l-10 4l-6 8l-2 9l-10 12l-6 4l-8 1l-15 4l3 14l-2 6l-8 7l-11 5l-24-5l-13-8l-6-1l-2 15l8 12l-5 16l1 8l-6 13l10 6l23 0l25 8l125-4l4 3l19-1l6-3l19-32l8-10l13-10l11-4l13-22l0-4l-15-14l-4-12l0-19l4-10l-6-6l-8 2l-11-3l-13-14l2-15z`},"سیستان و بلوچستان":{x:863,y:770,d:`M805 582l-11 50l0 5l5 8l2 12l-2 11l-4 7l0 13l2 7l-16 11l-9 3l8 10l-7 13l-1 27l-6 23l3 21l6 10l-3 7l0 9l3 8l-4 16l-2 4l13 11l9 14l0 4l11-2l4 4l12 0l7 4l9-2l7 2l8 0l3-5l7-2l4 10l21 4l8 5l12 3l4-8l6-5l2-27l6-4l2-19l3-5l20-6l2-9l7-3l9-1l8-4l21 1l2-12l4-3l-2-10l1-9l-4-3l-13 3l-6-1l-2-7l3-8l-2-20l-3-10l2-12l-10-1l-11-12l-16-3l-8-4l-13-12l-4-7l-5-13l-7-10l-3-9l-23-27l49-58l2-13l-4-16l-5-5l-27-4l0 11l-6 17l-1 20l3 12l-10 4l-12-15l-18-10z`},فارس:{x:473,y:666,d:`M464 773l5 7l12 1l8 5l5-1l16 2l5-2l3-13l8-5l27-2l14 2l9-5l4-8l17-6l2-5l-7-8l2-14l0-10l-16-15l1-6l-3-9l-10-26l-17-4l-9-20l-19-11l-3-17l-11-14l-8-16l-12-30l-15-16l-13-5l-18 5l-16-2l-4-10l-17 11l-6 6l9 7l-7 21l0 11l-5 1l0 13l-6 2l-16-7l-5-1l4 16l-1 6l-14 8l-16 1l1 7l6 9l21 5l14 19l8 6l24 44l9 27l9 8l7 16l14 15z`},قزوین:{x:304,y:239,d:`M270 195l-10 5l-1 9l6 11l8 3l4 11l0 8l-9 3l-9 6l-13 3l-10 5l11 12l8-1l8 10l17 3l9 0l4-5l31-9l-2-5l3-7l12-7l5-13l-11-9l8-2l12 1l-1-3l-25-20l-11 1l-15 6l-17-4z`},قم:{x:368,y:323,d:`M407 319l-29-18l-13-3l-15-1l-3 7l-2 13l-28 8l1 7l-6 6l13 9l1 7l6 6l14 1l17 6l-3-3l2-12l8-6l15-1l17-5l6-13z`},کردستان:{x:152,y:265,d:`M75 247l16 13l13-3l9 9l-10 1l-4 13l8 13l12 8l12 17l5 9l14-1l4-8l12-5l1-5l7-1l1-5l11 3l8 9l3 0l13-1l3-8l-1-6l-8-7l-9-18l8 1l14-8l-3-4l-14-8l3-11l-1-15l-4-7l-26-6l-2-1l-10 11l-11-2l-6-6l-27 3l-13-2l-4 2l-4 8l-8 3z`},کرمان:{x:697,y:622,d:`M717 520l-56-24l-6-1l-4 4l-14 10l-28 15l-2 4l-2 24l-9 4l-9 1l-11-1l-30 5l-7 10l-1 7l11 23l-1 19l2 8l-10 3l9 20l17 4l10 26l14 3l7 7l7 2l11-8l9-1l1 33l4 6l10 7l6 1l10-4l10-9l8 3l2 16l6 4l8 11l-2 6l5 10l3 25l21 11l9-5l11 9l-3 3l-4 30l16-1l7 2l5 8l7-2l7 5l4-16l-3-8l0-9l3-7l-6-10l-3-21l6-23l1-27l7-13l-8-10l9-3l16-11l-2-7l0-13l4-7l2-11l-2-12l-5-8l0-5l11-50l-21-30l-8-5z`},کرمانشاه:{x:139,y:357,d:`M107 293l3 6l-9 8l-7 3l-2 8l-8 5l-2 6l3 11l-10-3l-3 14l6 4l-1 11l-6 8l12 20l4 3l5-24l11-1l16 5l7 5l13 4l24-1l-1-12l11-1l1-8l9-3l0-8l6-1l3-4l13-1l0-7l-19-6l11-20l-3 0l-8-9l-11-3l-1 5l-7 1l-1 5l-12 5l-4 8l-14 1l-5-9l-12-17z`},"کهگیلویه و بویراحمد":{x:348,y:570,d:`M332 606l9 4l16-1l14-8l1-6l-4-16l5 1l16 7l6-2l0-13l-14-12l-3-11l-11 4l-8-1l-19-17l-5 0l-12-6l-10 10l-6 3l-2 7l2 9l0 9l9-2l6 7l8 5l-2 10z`},گلستان:{x:577,y:168,d:`M630 112l-9 1l-14-3l-15 3l-16 8l-14 12l-3 8l-1 8l-8 6l-23 7l-14-1l6 25l-1 9l-16 0l3 6l11 6l8 9l18 0l7-3l12-11l14-6l18 3l10-22l12-17l5-8l15-6l2-8l-7-5z`},گیلان:{x:295,y:181,d:`M251 170l8 5l8 9l3 11l12 12l17 4l15-6l11-1l7-12l7-8l-13-11l-9-16l-11-4l-26-2l-16-9l-6-7l-6-23l-1-23l-14 3l7 7l-12 14l-3 13l5 13l8 13l8 8z`},لرستان:{x:221,y:403,d:`M173 372l2 9l-6 6l-18 5l-7 9l22 20l11 5l13 15l10 20l10-23l3-2l22-2l11 5l12 1l12 8l11 0l8-7l4-11l8-2l7-14l1-9l-9-10l-4 6l-9-8l1-6l-7-6l-7 4l-7 9l-14-4l3-15l-15-6l-10 3l-15-2l-27-18l-6 1l0 8l-9 3z`},مازندران:{x:467,y:227,d:`M325 204l25 20l1 3l12 3l14 6l3 4l6 3l15 4l10 13l12 1l11-12l22 7l11 2l15-4l8-1l6-4l10-12l2-9l6-8l10-4l-8-9l-11-6l-3-6l-2-4l-9-1l-20 5l-17 5l-45 10l-43-10l-27-16l-7 8z`},مرکزی:{x:294,y:357,d:`M280 283l2 8l-8 0l4 11l-7 7l11 4l5 13l-8-2l-1-7l-14 0l-2 10l0 9l-7 2l1 11l4 7l2 11l-6 8l-3 15l14 4l7-9l7-4l7 6l-1 6l9 8l4-6l9 10l13-8l22-6l12-5l7-19l-17-6l-14-1l-6-6l-1-7l-13-9l6-6l-1-7l28-8l2-13l3-7l5-14l-4-10l-11-3l-16-1l-31 9l-4 5z`},هرمزگان:{x:651,y:758,d:`M771 853l-7-5l-7 2l-5-8l-7-2l-16 1l4-30l3-3l-11-9l-9 5l-21-11l-3-25l-5-10l2-6l-8-11l-6-4l-2-16l-8-3l-10 9l-10 4l-6-1l-10-7l-4-6l-1-33l-9 1l-11 8l-7-2l-7-7l-14-3l3 9l-1 6l16 15l0 10l-2 14l7 8l-2 5l-17 6l-4 8l-9 5l-14-2l-27 2l-8 5l-3 13l-5 2l-16-2l-5 1l-8-5l-12-1l-5-7l-13 1l-2 3l20 13l18 6l4 8l12 8l14-2l17 2l4 6l9 2l3 4l9 1l25-17l6 1l8-2l3-9l4-3l14-1l9-8l12-2l12 3l12 0l8 10l6 21l0 10l3 10l4 6l-3 4l9 18l23 3l1 5l9-3l6 7l24-1l14 1l10 9l6 1l7-2l0-4l-9-14l-13-11zM633 795l-9 2l-13 8l-3 3l-20 8l8 3l10-6l9-3l4 3l7-5z`},همدان:{x:235,y:319,d:`M197 314l-11 20l19 6l0 7l-13 1l-3 4l27 18l15 2l10-3l15 6l6-8l-2-11l-4-7l-1-11l7-2l0-9l2-10l14 0l1 7l8 2l-5-13l-11-4l7-7l-4-11l8 0l-2-8l-17-3l-8-10l-8 1l-6 5l-9-4l-11 0l-4-5l-14 8l-8-1l9 18l8 7l1 6l-3 8z`},یزد:{x:615,y:452,d:`M633 317l-19 32l-6 3l-19 1l1 42l-6 12l-12 5l-3 4l-6 19l-9 6l-55 19l-16-4l-9 2l-15 11l2 19l-5 25l3 9l13 5l15 16l12 30l8 16l11 14l3 17l19 11l10-3l-2-8l1-19l-11-23l1-7l7-10l30-5l11 1l9-1l9-4l2-24l2-4l28-15l14-10l4-4l6 1l56 24l11-22l7-9l3-13l-7-13l3-11l-6-8l-14-8l-3-7l-4-26l-4-7l-13 3l-11-1l-2-4l-3-18l0-11l7-20l3-6l21-14l5-5l-1-8l-15-12l-6-2l-13 4l-21 10z`}},h=d.map(e=>e.name),g=Object.fromEntries(d.map(e=>[e.name,e.capital])),[,,_,v]=p.split(` `).map(Number);var y=class extends c{constructor(){super(...arguments),this.values=null,this.selected=[],this.active=0,this.rendered=!1,this.valueSet=!1,this.key=l(`kashi-map`)}connectedCallback(){this.rendered||(this.valueSet||(this.selected=(this.getAttribute(`value`)??``).split(/[,،]/).map(e=>e.trim()).filter(e=>h.includes(e))),this.values===null&&(this.values=this.parseData(this.getAttribute(`data`)))),this.render()}attributeChangedCallback(e,t,n){this.rendered&&t!==n&&(e===`data`&&(this.values=this.parseData(n)),e===`value`?this.value=n??``:this.render())}parseData(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}get data(){return this.values}set data(e){this.values=e,this.rendered&&this.render()}get value(){return this.selected.join(`,`)}set value(e){this.valueSet=!0,this.selected=String(e??``).split(/[,،]/).map(e=>e.trim()).filter(e=>h.includes(e)),this.multiple||(this.selected=this.selected.slice(0,1)),this.rendered&&this.paint()}get selectedProvinces(){return[...this.selected]}get multiple(){return n(this,`multiple`)}get selectable(){return this.multiple||n(this,`selectable`)||this.hasAttribute(`value`)||this.hasAttribute(`name`)}fmt(t){return e(t,{digits:s(this)})}level(e){let t=this.values,n=t?.[e];if(typeof n!=`number`||!t)return;let r=this.steps,i=h.map(e=>t[e]).filter(e=>typeof e==`number`),a=Math.min(...i),o=Math.max(...i);if(o===a)return r;if(this.getAttribute(`scale`)!==`linear`){let e=[...i].sort((e,t)=>e-t);return 1+Math.round(e.indexOf(n)*(r-1)/(e.length-1))}return Math.min(r,1+Math.floor((n-a)/(o-a)*r))}get steps(){return Number(this.getAttribute(`steps`))||5}shade(e){return`${Math.round(12+88*e/this.steps)}%`}describe(e){let t=this.values?.[e],n=this.getAttribute(`unit`);return typeof t==`number`?`${e}: ${this.fmt(t)}${n?` ${n}`:``}`:e}render(){let e=this.getAttribute(`label`)??a().iranMap.label,t=this.selectable,i=this.multiple,o=this.values,s=this.getAttribute(`unit`),c=h.map((e,n)=>{let a=this.level(e);return`<path d="${m[e].d}" class="k-iran-map__province" data-i="${n}"${a?` data-l="${a}" style="--_p: ${this.shade(a)}"`:``}${t?` role="${i?`checkbox`:`radio`}" aria-label="${r(this.describe(e))}"`:``}></path>`}).join(``),l=o?h.map(e=>o[e]).filter(e=>typeof e==`number`):[],u=(this.hasAttribute(`legend`)?n(this,`legend`):o)&&l.length?`<figcaption class="k-iran-map__legend"><span>${this.fmt(Math.min(...l))}</span><span class="k-iran-map__scale" aria-hidden="true">${Array.from({length:this.steps},(e,t)=>`<i style="--_p: ${this.shade(t+1)}"></i>`).join(``)}</span><span>${this.fmt(Math.max(...l))}${s?` ${r(s)}`:``}</span></figcaption>`:``,d=o?`<table class="k-sr-only"><caption>${r(e)}</caption><tbody>${h.filter(e=>typeof o[e]==`number`).sort((e,t)=>o[t]-o[e]).map(e=>`<tr><th scope="row">${r(e)}</th><td>${this.fmt(o[e])}${s?` ${r(s)}`:``}</td></tr>`).join(``)}</tbody></table>`:``;this.innerHTML=`<figure class="k-iran-map${t?` k-iran-map--selectable`:``}"><div class="k-iran-map__canvas" style="block-size: auto; aspect-ratio: ${_} / ${v}"><svg viewBox="${p}" class="k-iran-map__svg" role="${t?i?`group`:`radiogroup`:`img`}" aria-label="${r(t?e:`${e}${o?a().iranMap.tableNote:``}`)}">${c}</svg><div class="k-chart__tip" aria-hidden="true" style="display: none"></div></div>${u}${d}</figure>`;let f=this.querySelector(`svg`),g=this.querySelector(`figure`);f.addEventListener(`pointerover`,e=>{let t=e.target.getAttribute?.(`data-i`);t!=null&&this.tip(Number(t))}),g.addEventListener(`pointerleave`,()=>this.tip(null)),t&&(f.addEventListener(`click`,e=>{let t=e.target.getAttribute?.(`data-i`);t!=null&&(this.active=Number(t),this.toggle(h[this.active]))}),f.addEventListener(`keydown`,e=>this.onKey(e)),f.addEventListener(`focusin`,e=>{let t=e.target.getAttribute?.(`data-i`);t!=null&&(this.active=Number(t),this.tip(this.active))}),f.addEventListener(`focusout`,()=>this.tip(null))),this.rendered=!0,this.paint()}paint(){let e=this.selectable,t=h.findIndex(e=>this.selected.includes(e)),n=this.contains(document.activeElement)||t<0?this.active:t;this.querySelectorAll(`.k-iran-map__province`).forEach((t,r)=>{let i=this.selected.includes(h[r]);t.toggleAttribute(`data-selected`,i),e&&(t.setAttribute(`aria-checked`,String(i)),t.setAttribute(`tabindex`,r===n?`0`:`-1`))});let r=this.getAttribute(`name`);if(this.querySelectorAll(`:scope > input[type=hidden]`).forEach(e=>e.remove()),r)for(let e of this.multiple?this.selected:[this.selected[0]??``]){let t=document.createElement(`input`);t.type=`hidden`,t.name=r,t.value=e,this.append(t)}}toggle(e){this.selected=this.multiple?this.selected.includes(e)?this.selected.filter(t=>t!==e):[...this.selected,e]:this.selected[0]===e?[]:[e],this.paint(),t(this,`kashi-change`,{value:this.multiple?[...this.selected]:this.selected[0]??null})}onKey(e){let t=this.active,n={ArrowLeft:1,ArrowDown:1,ArrowRight:-1,ArrowUp:-1}[e.key],r=t;if(n)r=(t+n+h.length)%h.length;else if(e.key===`Home`)r=0;else if(e.key===`End`)r=h.length-1;else if(e.key===`Enter`||e.key===` `){e.preventDefault(),this.toggle(h[t]);return}else return;e.preventDefault(),this.active=r,this.paint(),this.querySelector(`[data-i="${r}"]`)?.focus()}tip(e){let t=this.querySelector(`.k-chart__tip`);if(!t)return;if(this.querySelector(`.k-iran-map__province[data-active]`)?.removeAttribute(`data-active`),e===null){t.style.display=`none`;return}let n=h[e];this.querySelector(`[data-i="${e}"]`)?.setAttribute(`data-active`,``);let i=m[n],o=this.querySelector(`figure`).clientWidth||_,s=this.values?.[n],c=this.getAttribute(`unit`),l=typeof s==`number`?`${this.fmt(s)}${c?` ${c}`:``}`:a().province.capital(g[n]);t.innerHTML=`<span class="k-chart__tip-title">${r(n)}</span><span class="k-chart__tip-row"><strong>${r(l)}</strong></span>`,t.style.left=`${Math.min(Math.max(i.x/_*o,80),o-80)}px`,t.style.top=`${Math.max(64,i.y/v*(v/_*o)-6)}px`,t.style.display=``}};y.observedAttributes=[`data`,`value`,`label`,`unit`,`steps`,`scale`,`legend`,`selectable`,`multiple`,`name`];const b=()=>{let e=a().address;return{province:e.province,city:e.city,street:e.street,plaque:e.plaque,unit:e.unit,postalCode:e.postalCode}};var x=class extends c{constructor(){super(...arguments),this.address={...f},this.built=!1,this.key=l(`kashi-address`)}connectedCallback(){o(()=>{if(this.isConnected){if(!this.built){let e=Object.prototype.hasOwnProperty.call(this,`value`)?this.value:null;delete this.value;let t=this.getAttribute(`value`),n=e??{};if(!e&&t)try{n=JSON.parse(t)}catch{}this.address={...f,...n}}this.render()}})}attributeChangedCallback(e,t,n){this.built&&t!==n&&this.render()}get value(){return{...this.address}}set value(e){this.address={...f,...e},this.built&&this.render()}set errors(e){for(let t of Object.keys(b())){let n=this.querySelector(`[data-field="${t}"]`);n&&(n.matches(`kashi-province-select, kashi-city-select, kashi-postal-code`)?e[t]?n.setAttribute(`error`,e[t]):n.removeAttribute(`error`):this.fieldError(n,e[t]??null))}}label(e){return this.getAttribute(`label-${e===`postalCode`?`postal-code`:e}`)??b()[e]}render(){let e=this.address,t=this.getAttribute(`name`),i=e=>t?` name="${r(`${t}[${e}]`)}"`:``,o=n(this,`required`,!0),s=o?` required`:``,c=n(this,`map`),l=this.key,d=o?`<span class="k-label__required" aria-hidden="true">*</span>`:``,f=this.getAttribute(`legend`)??a().address.legend;this.innerHTML=`<fieldset class="k-address${c?` k-address--map`:``}"${this.hasAttribute(`disabled`)?` disabled`:``}>
2
+ ${f?`<legend class="k-address__legend">${r(f)}</legend>`:``}
3
+ <div class="k-address__fields">
4
+ <kashi-province-select class="k-address__province" data-field="province" label="${r(this.label(`province`))}" show-capital="false" placeholder="${r(a().address.provinceSearch)}"${i(`province`)}${s}></kashi-province-select>
5
+ <kashi-city-select class="k-address__city" data-field="city" label="${r(this.label(`city`))}"${i(`city`)}${s}></kashi-city-select>
6
+ <div class="k-field k-address__street" data-field="street"><div class="k-field__label-row"><label class="k-label" for="${l}-street">${r(this.label(`street`))}${d}</label></div><div class="k-input k-input--textarea k-input--autoresize"><textarea id="${l}-street" class="k-input__control" rows="2" autocomplete="street-address" placeholder="${r(a().address.streetHint)}"${i(`street`)}${s}></textarea></div></div>
7
+ <div class="k-field k-address__plaque" data-field="plaque"><div class="k-field__label-row"><label class="k-label" for="${l}-plaque">${r(this.label(`plaque`))}${d}</label></div><div class="k-input"><input id="${l}-plaque" class="k-input__control" inputmode="numeric" autocomplete="address-line2"${i(`plaque`)}${s}></div></div>
8
+ <div class="k-field k-address__unit" data-field="unit"><div class="k-field__label-row"><label class="k-label" for="${l}-unit">${r(this.label(`unit`))}${o?`<span class="k-label__optional">${r(a().common.optional)}</span>`:``}</label></div><div class="k-input"><input id="${l}-unit" class="k-input__control" inputmode="numeric" autocomplete="address-line3"${i(`unit`)}></div></div>
9
+ <kashi-postal-code class="k-address__postal" data-field="postalCode" label="${r(this.label(`postalCode`))}"${i(`postalCode`)}${s}></kashi-postal-code>
10
+ </div>
11
+ ${c?`<kashi-iran-map class="k-address__map" selectable label="${r(a().iranMap.onMap(this.label(`province`)))}"></kashi-iran-map>`:``}
12
+ </fieldset>`,this.built=!0;let p=this.querySelector(`kashi-province-select`),m=this.querySelector(`kashi-city-select`),h=this.querySelector(`kashi-postal-code`),g=this.querySelector(`kashi-iran-map`),_=this.querySelector(`textarea`),v=this.querySelector(`#${l}-plaque`),y=this.querySelector(`#${l}-unit`);e.province&&(p.value=e.province),e.province&&m.setAttribute(`province`,e.province),e.city&&(m.value=e.city),h.value=e.postalCode,_.value=e.street,v.value=e.plaque,y.value=e.unit,g&&e.province&&(g.value=e.province);let b=e=>{let t=e&&this.address.city&&u(e).includes(this.address.city);this.address={...this.address,province:e,city:t?this.address.city:null},p.value!==(e??``)&&(p.value=e??``),m.province=e,t||(m.value=``),g&&(g.value=e??``),this.changed()},x=e=>e.stopPropagation();p.addEventListener(`kashi-change`,e=>{x(e),b(e.detail.value||null)}),g?.addEventListener(`kashi-change`,e=>{x(e),b(e.detail.value)}),m.addEventListener(`kashi-change`,e=>{x(e);let{value:t,province:n}=e.detail;this.address={...this.address,city:t||null},n&&!this.address.province?b(n):this.changed()}),h.addEventListener(`kashi-change`,e=>{x(e),this.address={...this.address,postalCode:e.detail.value},this.changed()});for(let[e,t]of[[_,`street`],[v,`plaque`],[y,`unit`]])e.addEventListener(`input`,()=>{this.address={...this.address,[t]:e.value},this.changed()})}changed(){t(this,`kashi-change`,{value:this.value})}fieldError(e,t){e.querySelector(`.k-field__hint-row`)?.remove();let n=e.querySelector(`.k-input__control`);e.toggleAttribute(`data-invalid`,!!t),t?(e.insertAdjacentHTML(`beforeend`,`<div class="k-field__hint-row"><div class="k-field__hints"><p class="k-hint k-hint--error" id="${n.id}-error">${r(t)}</p></div></div>`),n.setAttribute(`aria-invalid`,`true`),n.setAttribute(`aria-describedby`,`${n.id}-error`)):(n.removeAttribute(`aria-invalid`),n.removeAttribute(`aria-describedby`))}};x.observedAttributes=[`legend`,`name`,`map`,`required`,`disabled`],i(`kashi-iran-map`,y,`block`),i(`kashi-address-form`,x,`block`);export{x as KashiAddressForm,y as KashiIranMap};
@@ -1 +1 @@
1
- import{a as e,d as t,o as n,r,s as i,t as a}from"./base-Cmq7zeIG.js";const o=e=>[...e.querySelectorAll(`[role^="menuitem"]:not([aria-disabled="true"])`)];var s=class extends a{constructor(){super(...arguments),this.menu=null,this.trigger=null,this.key=t(`kashi-menu`),this.onOutside=e=>{this.contains(e.target)||this.close(!1)}}connectedCallback(){r(()=>this.isConnected&&!this.menu&&this.build())}disconnectedCallback(){document.removeEventListener(`pointerdown`,this.onOutside)}attributeChangedCallback(){this.menu&&this.decorate()}get open(){return!!this.menu&&!this.menu.hidden}build(){let[e,...t]=[...this.children];if(!e)return;this.classList.add(`k-menu-anchor`),this.trigger=e,e.id||=`${this.key}-trigger`,e.setAttribute(`aria-haspopup`,`menu`),e.setAttribute(`aria-expanded`,`false`);let r=document.createElement(`ul`);r.id=`${this.key}-menu`,r.setAttribute(`role`,`menu`),r.hidden=!0;for(let e of t){let t=document.createElement(`li`);if(e.tagName===`HR`)t.setAttribute(`role`,`separator`),t.className=`k-menu__separator`,e.remove();else if(e.hasAttribute(`data-label`))t.setAttribute(`role`,`presentation`),t.className=`k-menu__label`,t.textContent=e.textContent,e.remove();else{t.setAttribute(`role`,`none`);let n=e.hasAttribute(`data-checked`);e.setAttribute(`role`,n?`menuitemcheckbox`:`menuitem`),e.tabIndex=-1,e.classList.add(`k-menu__item`),e.dataset.tone===`danger`&&e.classList.add(`k-menu__item--danger`),e instanceof HTMLButtonElement&&(e.type=`button`,e.disabled&&(e.disabled=!1,e.setAttribute(`aria-disabled`,`true`)));let r=e.innerHTML;e.innerHTML=`${n?`<span class="k-menu__check" aria-hidden="true"></span>`:``}<span>${r}</span>${e.dataset.shortcut?`<span class="k-menu__shortcut" aria-hidden="true">${i(e.dataset.shortcut)}</span>`:``}`,n&&this.paintCheck(e),t.append(e)}r.append(t)}this.append(r),this.menu=r,this.decorate(),e.addEventListener(`click`,()=>this.open?this.close(!1):this.show(`first`)),e.addEventListener(`keydown`,e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),this.show(e.key===`ArrowUp`?`last`:`first`))}),r.addEventListener(`keydown`,e=>this.onKey(e)),r.addEventListener(`click`,e=>{let t=e.target.closest(`[role^="menuitem"]`);t&&t.getAttribute(`aria-disabled`)!==`true`&&(t.getAttribute(`role`)===`menuitemcheckbox`&&(t.dataset.checked=String(t.dataset.checked!==`true`),this.paintCheck(t)),n(this,`kashi-select`,{value:t.dataset.value??t.textContent?.trim()??``,checked:t.dataset.checked===void 0?void 0:t.dataset.checked===`true`}),t.getAttribute(`role`)===`menuitem`&&this.close(t.tagName!==`A`))})}paintCheck(e){let t=e.dataset.checked===`true`;e.setAttribute(`aria-checked`,String(t)),e.querySelector(`.k-menu__check`).innerHTML=t?`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m5 10.5 3.2 3L15 7"/></svg>`:``}decorate(){let e=this.getAttribute(`label`);this.menu.className=`k-menu${this.getAttribute(`align`)===`end`?` k-menu--end`:``}`,e?(this.menu.setAttribute(`aria-label`,e),this.menu.removeAttribute(`aria-labelledby`)):(this.menu.setAttribute(`aria-labelledby`,this.trigger.id),this.menu.removeAttribute(`aria-label`))}show(e=`first`){if(!this.menu)return;this.menu.hidden=!1,this.trigger.setAttribute(`aria-expanded`,`true`),this.trigger.setAttribute(`aria-controls`,this.menu.id);let t=o(this.menu);(e===`last`?t.at(-1):t[0])?.focus(),document.addEventListener(`pointerdown`,this.onOutside)}close(e=!0){this.menu&&!this.menu.hidden&&(this.menu.hidden=!0,this.trigger.setAttribute(`aria-expanded`,`false`),this.trigger.removeAttribute(`aria-controls`),document.removeEventListener(`pointerdown`,this.onOutside),e&&this.trigger.focus())}onKey(e){let t=o(this.menu),n=t.indexOf(document.activeElement),r=e=>t[(e+t.length)%t.length]?.focus();if(e.key===`ArrowDown`)r(n+1);else if(e.key===`ArrowUp`)r(n-1);else if(e.key===`Home`)r(0);else if(e.key===`End`)r(t.length-1);else if(e.key===`Escape`)this.close();else if(e.key===`Tab`)return this.close(!1);else if(e.key.length===1&&/\S/.test(e.key)){let r=e.key.toLowerCase();[...t.slice(n+1),...t.slice(0,n+1)].find(e=>e.textContent?.trim().toLowerCase().startsWith(r))?.focus()}else return;e.preventDefault()}};s.observedAttributes=[`label`,`align`];var c=class extends a{constructor(){super(...arguments),this.panel=null,this.trigger=null,this.key=t(`kashi-pop`),this.onOutside=e=>{this.contains(e.target)||this.close(!1)}}connectedCallback(){r(()=>this.isConnected&&!this.panel&&this.build())}disconnectedCallback(){document.removeEventListener(`pointerdown`,this.onOutside)}attributeChangedCallback(){this.panel&&this.decorate()}get open(){return!!this.panel&&!this.panel.hidden}set open(e){e?this.show():this.close(!1)}build(){let[e,...t]=[...this.childNodes].filter(e=>e.nodeType===1||e.textContent?.trim());if(!e)return;this.classList.add(`k-popover-anchor`),this.trigger=e,e.setAttribute(`aria-haspopup`,`dialog`),e.setAttribute(`aria-expanded`,`false`);let n=document.createElement(`div`);n.id=`${this.key}-panel`,n.setAttribute(`role`,`dialog`),n.tabIndex=-1,n.hidden=!0,n.innerHTML=`<p class="k-popover__title" id="${this.key}-title"></p><div class="k-popover__body"></div>`,n.querySelector(`.k-popover__body`).append(...t),this.append(n),this.panel=n,this.decorate(),e.addEventListener(`click`,()=>this.open?this.close(!1):this.show()),n.addEventListener(`keydown`,e=>{e.key===`Escape`&&(e.stopPropagation(),this.close(!0))}),n.addEventListener(`focusout`,e=>{let t=e.relatedTarget;t&&!this.contains(t)&&this.close(!1)})}decorate(){let e=this.panel,[t,n]=(this.getAttribute(`placement`)??`bottom-start`).split(`-`);e.className=[`k-popover`,t===`top`&&`k-popover--top`,n===`end`&&`k-popover--end`].filter(Boolean).join(` `);let r=this.getAttribute(`heading`),i=e.querySelector(`.k-popover__title`);i.textContent=r??``,i.hidden=!r,r?(e.setAttribute(`aria-labelledby`,i.id),e.removeAttribute(`aria-label`)):(e.removeAttribute(`aria-labelledby`),e.setAttribute(`aria-label`,this.getAttribute(`label`)??``))}show(){this.panel&&!this.open&&(this.panel.hidden=!1,this.trigger.setAttribute(`aria-expanded`,`true`),this.trigger.setAttribute(`aria-controls`,this.panel.id),(this.panel.querySelector(`.k-popover__body :is(a[href], button:not([disabled]), input:not([disabled]), select, textarea, [tabindex]:not([tabindex="-1"]))`)??this.panel).focus(),document.addEventListener(`pointerdown`,this.onOutside),n(this,`kashi-open`,{}))}close(e=!0){this.panel&&!this.panel.hidden&&(this.panel.hidden=!0,this.trigger.setAttribute(`aria-expanded`,`false`),this.trigger.removeAttribute(`aria-controls`),document.removeEventListener(`pointerdown`,this.onOutside),e&&this.trigger.focus(),n(this,`kashi-close`,{}))}};c.observedAttributes=[`heading`,`placement`,`label`],e(`kashi-dropdown-menu`,s),e(`kashi-popover`,c);export{s as KashiDropdownMenu,c as KashiPopover};
1
+ import{c as e,l as t,o as n,r,t as i,v as a}from"./base-DTQ50VdG.js";const o=e=>[...e.querySelectorAll(`[role^="menuitem"]:not([aria-disabled="true"])`)];var s=class extends i{constructor(){super(...arguments),this.menu=null,this.trigger=null,this.key=a(`kashi-menu`),this.onOutside=e=>{this.contains(e.target)||this.close(!1)}}connectedCallback(){r(()=>this.isConnected&&!this.menu&&this.build())}disconnectedCallback(){document.removeEventListener(`pointerdown`,this.onOutside)}attributeChangedCallback(){this.menu&&this.decorate()}get open(){return!!this.menu&&!this.menu.hidden}build(){let[n,...r]=[...this.children];if(!n)return;this.classList.add(`k-menu-anchor`),this.trigger=n,n.id||=`${this.key}-trigger`,n.setAttribute(`aria-haspopup`,`menu`),n.setAttribute(`aria-expanded`,`false`);let i=document.createElement(`ul`);i.id=`${this.key}-menu`,i.setAttribute(`role`,`menu`),i.hidden=!0;for(let e of r){let n=document.createElement(`li`);if(e.tagName===`HR`)n.setAttribute(`role`,`separator`),n.className=`k-menu__separator`,e.remove();else if(e.hasAttribute(`data-label`))n.setAttribute(`role`,`presentation`),n.className=`k-menu__label`,n.textContent=e.textContent,e.remove();else{n.setAttribute(`role`,`none`);let r=e.hasAttribute(`data-checked`);e.setAttribute(`role`,r?`menuitemcheckbox`:`menuitem`),e.tabIndex=-1,e.classList.add(`k-menu__item`),e.dataset.tone===`danger`&&e.classList.add(`k-menu__item--danger`),e instanceof HTMLButtonElement&&(e.type=`button`,e.disabled&&(e.disabled=!1,e.setAttribute(`aria-disabled`,`true`)));let i=e.innerHTML;e.innerHTML=`${r?`<span class="k-menu__check" aria-hidden="true"></span>`:``}<span>${i}</span>${e.dataset.shortcut?`<span class="k-menu__shortcut" aria-hidden="true">${t(e.dataset.shortcut)}</span>`:``}`,r&&this.paintCheck(e),n.append(e)}i.append(n)}this.append(i),this.menu=i,this.decorate(),n.addEventListener(`click`,()=>this.open?this.close(!1):this.show(`first`)),n.addEventListener(`keydown`,e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),this.show(e.key===`ArrowUp`?`last`:`first`))}),i.addEventListener(`keydown`,e=>this.onKey(e)),i.addEventListener(`click`,t=>{let n=t.target.closest(`[role^="menuitem"]`);n&&n.getAttribute(`aria-disabled`)!==`true`&&(n.getAttribute(`role`)===`menuitemcheckbox`&&(n.dataset.checked=String(n.dataset.checked!==`true`),this.paintCheck(n)),e(this,`kashi-select`,{value:n.dataset.value??n.textContent?.trim()??``,checked:n.dataset.checked===void 0?void 0:n.dataset.checked===`true`}),n.getAttribute(`role`)===`menuitem`&&this.close(n.tagName!==`A`))})}paintCheck(e){let t=e.dataset.checked===`true`;e.setAttribute(`aria-checked`,String(t)),e.querySelector(`.k-menu__check`).innerHTML=t?`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m5 10.5 3.2 3L15 7"/></svg>`:``}decorate(){let e=this.getAttribute(`label`);this.menu.className=`k-menu${this.getAttribute(`align`)===`end`?` k-menu--end`:``}`,e?(this.menu.setAttribute(`aria-label`,e),this.menu.removeAttribute(`aria-labelledby`)):(this.menu.setAttribute(`aria-labelledby`,this.trigger.id),this.menu.removeAttribute(`aria-label`))}show(e=`first`){if(!this.menu)return;this.menu.hidden=!1,this.trigger.setAttribute(`aria-expanded`,`true`),this.trigger.setAttribute(`aria-controls`,this.menu.id);let t=o(this.menu);(e===`last`?t.at(-1):t[0])?.focus(),document.addEventListener(`pointerdown`,this.onOutside)}close(e=!0){this.menu&&!this.menu.hidden&&(this.menu.hidden=!0,this.trigger.setAttribute(`aria-expanded`,`false`),this.trigger.removeAttribute(`aria-controls`),document.removeEventListener(`pointerdown`,this.onOutside),e&&this.trigger.focus())}onKey(e){let t=o(this.menu),n=t.indexOf(document.activeElement),r=e=>t[(e+t.length)%t.length]?.focus();if(e.key===`ArrowDown`)r(n+1);else if(e.key===`ArrowUp`)r(n-1);else if(e.key===`Home`)r(0);else if(e.key===`End`)r(t.length-1);else if(e.key===`Escape`)this.close();else if(e.key===`Tab`)return this.close(!1);else if(e.key.length===1&&/\S/.test(e.key)){let r=e.key.toLowerCase();[...t.slice(n+1),...t.slice(0,n+1)].find(e=>e.textContent?.trim().toLowerCase().startsWith(r))?.focus()}else return;e.preventDefault()}};s.observedAttributes=[`label`,`align`];var c=class extends i{constructor(){super(...arguments),this.panel=null,this.trigger=null,this.key=a(`kashi-pop`),this.onOutside=e=>{this.contains(e.target)||this.close(!1)}}connectedCallback(){r(()=>this.isConnected&&!this.panel&&this.build())}disconnectedCallback(){document.removeEventListener(`pointerdown`,this.onOutside)}attributeChangedCallback(){this.panel&&this.decorate()}get open(){return!!this.panel&&!this.panel.hidden}set open(e){e?this.show():this.close(!1)}build(){let[e,...t]=[...this.childNodes].filter(e=>e.nodeType===1||e.textContent?.trim());if(!e)return;this.classList.add(`k-popover-anchor`),this.trigger=e,e.setAttribute(`aria-haspopup`,`dialog`),e.setAttribute(`aria-expanded`,`false`);let n=document.createElement(`div`);n.id=`${this.key}-panel`,n.setAttribute(`role`,`dialog`),n.tabIndex=-1,n.hidden=!0,n.innerHTML=`<p class="k-popover__title" id="${this.key}-title"></p><div class="k-popover__body"></div>`,n.querySelector(`.k-popover__body`).append(...t),this.append(n),this.panel=n,this.decorate(),e.addEventListener(`click`,()=>this.open?this.close(!1):this.show()),n.addEventListener(`keydown`,e=>{e.key===`Escape`&&(e.stopPropagation(),this.close(!0))}),n.addEventListener(`focusout`,e=>{let t=e.relatedTarget;t&&!this.contains(t)&&this.close(!1)})}decorate(){let e=this.panel,[t,n]=(this.getAttribute(`placement`)??`bottom-start`).split(`-`);e.className=[`k-popover`,t===`top`&&`k-popover--top`,n===`end`&&`k-popover--end`].filter(Boolean).join(` `);let r=this.getAttribute(`heading`),i=e.querySelector(`.k-popover__title`);i.textContent=r??``,i.hidden=!r,r?(e.setAttribute(`aria-labelledby`,i.id),e.removeAttribute(`aria-label`)):(e.removeAttribute(`aria-labelledby`),e.setAttribute(`aria-label`,this.getAttribute(`label`)??``))}show(){this.panel&&!this.open&&(this.panel.hidden=!1,this.trigger.setAttribute(`aria-expanded`,`true`),this.trigger.setAttribute(`aria-controls`,this.panel.id),(this.panel.querySelector(`.k-popover__body :is(a[href], button:not([disabled]), input:not([disabled]), select, textarea, [tabindex]:not([tabindex="-1"]))`)??this.panel).focus(),document.addEventListener(`pointerdown`,this.onOutside),e(this,`kashi-open`,{}))}close(t=!0){this.panel&&!this.panel.hidden&&(this.panel.hidden=!0,this.trigger.setAttribute(`aria-expanded`,`false`),this.trigger.removeAttribute(`aria-controls`),document.removeEventListener(`pointerdown`,this.onOutside),t&&this.trigger.focus(),e(this,`kashi-close`,{}))}};c.observedAttributes=[`heading`,`placement`,`label`],n(`kashi-dropdown-menu`,s),n(`kashi-popover`,c);export{s as KashiDropdownMenu,c as KashiPopover};
@@ -0,0 +1 @@
1
+ import{c as e,i as t,l as n,m as r,o as i,p as a,r as o,t as s,v as c}from"./base-DTQ50VdG.js";import{n as l}from"./text-D4a_hlwL.js";const u=e=>l(e,{digits:`latin`}).toLowerCase(),d=e=>[...e.querySelectorAll(`[role^="menuitem"]:not([aria-disabled="true"])`)];var f=class extends s{constructor(){super(...arguments),this.list=null,this.dialog=null,this.query=``,this.active=0,this.opener=null,this.key=c(`kashi-cmd`),this.onShortcut=e=>{this.getAttribute(`shortcut`)!==`false`&&(e.ctrlKey||e.metaKey)&&(e.key===`k`||e.key===`K`||e.code===`KeyK`)&&(e.preventDefault(),this.dialog?.open?this.close():this.show())}}connectedCallback(){o(()=>{this.isConnected&&(this.list===null&&(this.list=this.readItems()),this.dialog||this.build(),document.addEventListener(`keydown`,this.onShortcut))})}disconnectedCallback(){document.removeEventListener(`keydown`,this.onShortcut)}get items(){return this.list??[]}set items(e){this.list=[...e],this.dialog?.open&&this.paint()}readItems(){let e=[...this.querySelectorAll(`:scope > a, :scope > button`)].map((e,t)=>({id:e.dataset.value??`${t}`,label:e.textContent?.trim()??``,group:e.dataset.group,description:e.dataset.description,shortcut:e.dataset.shortcut,keywords:e.dataset.keywords?.split(/[,،]\s*/),href:e instanceof HTMLAnchorElement?e.getAttribute(`href`)??void 0:void 0}));return this.querySelectorAll(`:scope > a, :scope > button`).forEach(e=>e.remove()),e}build(){let e=document.createElement(`dialog`);e.className=`k-dialog k-command`;let t=a(),r=this.getAttribute(`label`)??t.command.title;e.setAttribute(`aria-label`,r),e.innerHTML=`<div class="k-input"><span class="k-input__addon"><svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" aria-hidden="true"><circle cx="9" cy="9" r="5.5"/><path d="m13.5 13.5 3 3"/></svg></span><input class="k-input__control" type="text" role="combobox" aria-expanded="true" aria-controls="${this.key}-list" aria-autocomplete="list" aria-label="${n(r)}" placeholder="${n(this.getAttribute(`placeholder`)??t.command.placeholder)}" autocomplete="off"></div><ul id="${this.key}-list" role="listbox" aria-label="${n(r)}" class="k-listbox k-listbox--inline k-command__list"></ul><div class="k-command__footer" aria-hidden="true"><span><kbd class="k-kbd">↑</kbd><kbd class="k-kbd">↓</kbd>${n(t.command.navigate)}</span><span><kbd class="k-kbd">Enter</kbd>${n(t.command.select)}</span><span><kbd class="k-kbd">Esc</kbd>${n(t.common.close)}</span></div><span class="k-sr-only" aria-live="polite"></span>`,this.append(e),this.dialog=e;let i=e.querySelector(`input`);i.addEventListener(`input`,()=>{this.query=i.value,this.active=0,this.paint()}),i.addEventListener(`keydown`,e=>{let t=this.filtered().length;if(t){if(e.key===`ArrowDown`)this.active=(this.active+1)%t;else if(e.key===`ArrowUp`)this.active=(this.active-1+t)%t;else if(e.key===`Home`)this.active=0;else if(e.key===`End`)this.active=t-1;else if(e.key===`Enter`)return this.run(this.filtered()[this.active]);else return;e.preventDefault(),this.paint()}});let o=e.querySelector(`ul`);o.addEventListener(`pointerdown`,e=>e.preventDefault()),o.addEventListener(`click`,e=>{let t=e.target.closest(`[role="option"]`);t&&this.run(this.filtered()[Number(t.dataset.i)])}),e.addEventListener(`click`,t=>t.target===e&&this.close()),e.addEventListener(`close`,()=>this.opener?.focus?.())}filtered(){let e=u(this.query.trim());return this.items.filter(t=>!e||[t.label,t.description??``,...t.keywords??[]].some(t=>u(t).includes(e)))}show(){this.dialog&&(this.opener=document.activeElement,this.query=``,this.active=0,this.dialog.querySelector(`input`).value=``,this.dialog.showModal?.(),this.paint(),this.dialog.querySelector(`input`).focus())}close(){this.dialog?.open&&this.dialog.close()}run(t){t&&(this.close(),t.href?location.href=t.href:e(this,`kashi-select`,{value:t.id,item:t}))}paint(){let e=this.dialog,t=this.filtered(),i=u(this.query.trim()),o=e=>{let t=i?u(e).indexOf(i):-1;return t<0?n(e):`${n(e.slice(0,t))}<mark>${n(e.slice(t,t+i.length))}</mark>${n(e.slice(t+i.length))}`},s;e.querySelector(`ul`).innerHTML=t.length?t.map((e,t)=>{let r=e.group&&e.group!==s?`<li role="presentation" class="k-listbox__group">${n(e.group)}</li>`:``;return s=e.group,`${r}<li id="${this.key}-list-${t}" data-i="${t}" role="option" aria-selected="${t===this.active}"${t===this.active?` data-active`:``} class="k-option"><span class="k-option__body"><span>${o(e.label)}</span>${e.description?`<span class="k-option__desc">${n(e.description)}</span>`:``}</span>${e.shortcut?`<span class="k-menu__shortcut" aria-hidden="true">${n(e.shortcut)}</span>`:``}</li>`}).join(``):`<li role="presentation" class="k-listbox__empty">${n(a().command.empty)}</li>`;let c=e.querySelector(`input`);t.length?c.setAttribute(`aria-activedescendant`,`${this.key}-list-${this.active}`):c.removeAttribute(`aria-activedescendant`),e.querySelector(`#${this.key}-list-${this.active}`)?.scrollIntoView?.({block:`nearest`}),e.querySelector(`:scope > .k-sr-only`).textContent=this.query?a().common.results(r(this,t.length)):``}};f.observedAttributes=[`placeholder`,`label`,`shortcut`];var p=class extends s{constructor(){super(...arguments),this.menu=null,this.returnTo=null,this.key=c(`kashi-ctx`),this.onOutside=e=>{this.menu?.contains(e.target)||this.close(!1)},this.onScroll=()=>this.close(!1)}connectedCallback(){o(()=>this.isConnected&&!this.menu&&this.build())}disconnectedCallback(){document.removeEventListener(`pointerdown`,this.onOutside)}build(){let t=this.querySelector(`:scope > [data-menu]`);this.classList.add(`k-context-area`),this.setAttribute(`aria-haspopup`,`menu`),this.setAttribute(`aria-describedby`,`${this.key}-hint`);let r=document.createElement(`ul`);r.setAttribute(`role`,`menu`),r.setAttribute(`aria-label`,this.getAttribute(`label`)??a().contextMenu.label),r.className=`k-menu k-menu--context`,r.hidden=!0;for(let e of[...t?.children??[]]){let t=document.createElement(`li`);e.tagName===`HR`?(t.setAttribute(`role`,`separator`),t.className=`k-menu__separator`):e.hasAttribute(`data-label`)?(t.setAttribute(`role`,`presentation`),t.className=`k-menu__label`,t.textContent=e.textContent):(t.setAttribute(`role`,`none`),e.setAttribute(`role`,`menuitem`),e.tabIndex=-1,e.classList.add(`k-menu__item`),e.dataset.tone===`danger`&&e.classList.add(`k-menu__item--danger`),e instanceof HTMLButtonElement&&(e.type=`button`),e.innerHTML=`<span>${e.innerHTML}</span>${e.dataset.shortcut?`<span class="k-menu__shortcut" aria-hidden="true">${n(e.dataset.shortcut)}</span>`:``}`,t.append(e)),r.append(t)}t?.remove(),this.insertAdjacentHTML(`beforeend`,`<span id="${this.key}-hint" class="k-sr-only">${n(a().contextMenu.hint)}</span>`),this.append(r),this.menu=r,this.addEventListener(`contextmenu`,e=>{r.contains(e.target)||(e.preventDefault(),this.openAt(e.clientX,e.clientY))}),this.addEventListener(`keydown`,e=>{if(r.contains(e.target))return this.onMenuKey(e);if(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`){e.preventDefault();let t=document.activeElement.getBoundingClientRect();this.openAt(t.left+t.width/2,t.top+t.height/2)}}),r.addEventListener(`click`,t=>{let n=t.target.closest(`[role="menuitem"]`);n&&(e(this,`kashi-select`,{value:n.dataset.value??n.textContent?.trim()??``}),this.close(n.tagName!==`A`))})}openAt(e,t){let n=this.menu;this.returnTo=document.activeElement??this,n.hidden=!1;let r=n;r.showPopover&&(n.hasAttribute(`popover`)||n.setAttribute(`popover`,`manual`),n.matches(`:popover-open`)||r.showPopover());let i=n.getBoundingClientRect(),a=getComputedStyle(this).direction===`rtl`,o=a?e-i.width:e;o<8&&(o=a?e:8),o=Math.max(8,Math.min(o,innerWidth-i.width-8));let s=Math.max(8,Math.min(t+i.height>innerHeight-8?t-i.height:t,innerHeight-i.height-8));n.style.setProperty(`--_x`,`${o}px`),n.style.setProperty(`--_y`,`${s}px`),d(n)[0]?.focus({preventScroll:!0}),document.addEventListener(`pointerdown`,this.onOutside),setTimeout(()=>addEventListener(`scroll`,this.onScroll,{passive:!0,once:!0}),150)}close(e=!0){let t=this.menu;if(!t||t.hidden)return;let n=t;t.matches?.(`:popover-open`)&&n.hidePopover?.(),t.hidden=!0,document.removeEventListener(`pointerdown`,this.onOutside),removeEventListener(`scroll`,this.onScroll),e&&this.returnTo?.focus()}onMenuKey(e){let t=d(this.menu),n=t.indexOf(document.activeElement),r=e=>t[(e+t.length)%t.length]?.focus();if(e.key===`ArrowDown`)r(n+1);else if(e.key===`ArrowUp`)r(n-1);else if(e.key===`Home`)r(0);else if(e.key===`End`)r(t.length-1);else if(e.key===`Escape`)this.close();else if(e.key===`Tab`)return this.close(!1);else return;e.preventDefault()}};p.observedAttributes=[`label`];const m=e=>`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-k-mirror=""><path d="${e?`m8 5 5 5-5 5`:`m12 5-5 5 5 5`}"/></svg>`;var h=class extends s{constructor(){super(...arguments),this.track=null,this.index=0,this.io=null,this.key=c(`kashi-carousel`)}connectedCallback(){o(()=>this.isConnected&&!this.track&&this.build())}disconnectedCallback(){this.io?.disconnect()}get perView(){return Math.max(1,Number(this.getAttribute(`per-view`))||1)}get slides(){return[...this.track?.children??[]]}get pages(){return Math.max(1,this.slides.length-this.perView+1)}build(){let e=a(),t=this.getAttribute(`label`)??e.carousel.slider,i=[...this.children],o=document.createElement(`section`);o.className=`k-carousel`,o.setAttribute(`aria-roledescription`,e.carousel.slider),o.setAttribute(`aria-label`,t),o.style.setProperty(`--k-carousel-per-view`,String(this.perView));let s=document.createElement(`div`);if(s.className=`k-carousel__track`,s.tabIndex=0,s.setAttribute(`aria-live`,`polite`),i.forEach((t,n)=>{let a=document.createElement(`div`);a.className=`k-carousel__slide`,a.setAttribute(`role`,`group`),a.setAttribute(`aria-roledescription`,e.carousel.slide),a.setAttribute(`aria-label`,e.carousel.slideOf(r(this,n+1),r(this,i.length))),a.id=`${this.key}-s${n}`,a.append(t),s.append(a)}),o.append(s),this.replaceChildren(o),this.track=s,this.pages>1){let i=this.getAttribute(`dots`)!==`false`;o.insertAdjacentHTML(`beforeend`,`<div class="k-carousel__bar">${i?`<ul class="k-carousel__dots" aria-label="${n(e.carousel.slides(t))}">${Array.from({length:this.pages},(t,i)=>`<li><button type="button" class="k-carousel__dot" data-go="${i}" aria-label="${n(e.carousel.slideOf(r(this,i+1),r(this,this.pages)))}" aria-controls="${this.key}-s${i}"></button></li>`).join(``)}</ul>`:`<span></span>`}<div class="k-carousel__nav"><button type="button" class="k-btn k-btn--secondary k-btn--icon k-btn--sm" data-step="-1" aria-label="${n(e.common.prev)}">${m(!1)}</button><button type="button" class="k-btn k-btn--secondary k-btn--icon k-btn--sm" data-step="1" aria-label="${n(e.common.next)}">${m(!0)}</button></div></div>`),o.querySelector(`.k-carousel__bar`).addEventListener(`click`,e=>{let t=e.target.closest(`button`);t&&this.go(t.dataset.go===void 0?this.index+Number(t.dataset.step):Number(t.dataset.go))})}s.addEventListener(`keydown`,e=>{let t=getComputedStyle(s).direction===`rtl`,n={ArrowLeft:t?1:-1,ArrowRight:t?-1:1}[e.key];n?(e.preventDefault(),this.go(this.index+n)):e.key===`Home`?this.go(0):e.key===`End`&&this.go(this.pages-1)}),typeof IntersectionObserver<`u`&&(this.io=new IntersectionObserver(e=>{let t=e.filter(e=>e.isIntersecting&&e.intersectionRatio>.6).map(e=>this.slides.indexOf(e.target));t.length&&this.setIndex(Math.min(...t))},{root:s,threshold:[.6,1]}),this.slides.forEach(e=>this.io.observe(e))),this.setIndex(0)}go(e){let t=Math.max(0,Math.min(this.pages-1,e)),n=this.slides[t],r=this.track;if(!n||!r)return;let i=getComputedStyle(r).direction===`rtl`?-(r.getBoundingClientRect().right-n.getBoundingClientRect().right)+r.scrollLeft:n.getBoundingClientRect().left-r.getBoundingClientRect().left+r.scrollLeft;r.scrollTo?.({left:i}),this.setIndex(t)}setIndex(t){let n=t!==this.index;this.index=t,this.querySelectorAll(`.k-carousel__dot`).forEach((e,n)=>e.setAttribute(`aria-current`,String(n===t)));let[r,i]=this.querySelectorAll(`[data-step]`);r&&(r.disabled=t===0),i&&(i.disabled=t>=this.pages-1),n&&e(this,`kashi-change`,{index:t})}};h.observedAttributes=[`label`,`per-view`,`dots`];var g=class extends s{constructor(){super(...arguments),this.nodes=null,this.open=/* @__PURE__ */ new Set,this.sel=null,this.focusId=null,this.built=!1}connectedCallback(){o(()=>{if(this.isConnected){if(this.nodes===null){let e=this.querySelector(`:scope > ul`);this.nodes=e?this.parse(e):[]}if(!this.built){this.sel=this.getAttribute(`selected`);for(let e of(this.getAttribute(`expanded`)??``).split(/[,،]/).map(e=>e.trim()).filter(Boolean))this.open.add(e);this.built=!0}this.render()}})}attributeChangedCallback(e,t,n){this.built&&t!==n&&(e===`selected`&&(this.sel=n),this.render())}get items(){return this.nodes??[]}set items(e){this.nodes=e,this.built&&this.render()}get value(){return this.sel??``}parse(e){return[...e.children].filter(e=>e.tagName===`LI`).map((e,t)=>{let n=e.querySelector(`:scope > ul`),r=[...e.childNodes].filter(e=>e!==n).map(e=>e.textContent).join(``).trim(),i=e;return{id:i.dataset.id??`${r}-${t}`,label:r,meta:i.dataset.meta,disabled:i.hasAttribute(`data-disabled`),children:n?this.parse(n):void 0}})}visible(){let e=[],t=(n,r)=>{for(let i of n)e.push({node:i,parent:r}),i.children?.length&&this.open.has(i.id)&&t(i.children,i.id)};return t(this.items,null),e}render(e=!1){let t=this.visible(),r=this.focusId&&t.some(e=>e.node.id===this.focusId)?this.focusId:this.sel&&t.some(e=>e.node.id===this.sel)?this.sel:t[0]?.node.id,i=(e,t)=>e.map(e=>{let a=!!e.children?.length,o=this.open.has(e.id);return`<li role="treeitem" data-id="${n(e.id)}" class="k-tree__item" aria-level="${t}"${a?` aria-expanded="${o}"`:``} aria-selected="${this.sel===e.id}"${e.disabled?` aria-disabled="true"`:``} tabindex="${r===e.id?0:-1}"><div class="k-tree__row">${a?`<span class="k-tree__toggle" aria-hidden="true"><svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m8 5 5 5-5 5"/></svg></span>`:`<span class="k-tree__spacer"></span>`}<span class="k-tree__label">${n(e.label)}</span>${e.meta?`<span class="k-tree__meta">${n(e.meta)}</span>`:``}</div>${a&&o?`<ul role="group">${i(e.children,t+1)}</ul>`:``}</li>`}).join(``);this.innerHTML=`<ul role="tree" class="k-tree"${this.getAttribute(`label`)?` aria-label="${n(this.getAttribute(`label`))}"`:``}>${i(this.items,1)}</ul>`;let a=this.querySelector(`ul`);a.addEventListener(`click`,e=>{let t=e.target.closest(`[role="treeitem"]`);if(!t||!e.target.closest(`.k-tree__row`))return;let n=this.find(t.dataset.id);n&&(n.children?.length&&this.toggle(n.id),this.focusId=n.id,this.choose(n))}),a.addEventListener(`keydown`,e=>this.onKey(e)),e&&r&&[...this.querySelectorAll(`[data-id]`)].find(e=>e.dataset.id===r)?.focus()}find(e,t=this.items){for(let n of t){if(n.id===e)return n;let t=n.children&&this.find(e,n.children);if(t)return t}return null}toggle(t,n=!this.open.has(t)){n?this.open.add(t):this.open.delete(t),e(this,`kashi-expand`,{expanded:[...this.open]})}choose(t){t.disabled||(this.sel=t.id,e(this,`kashi-change`,{value:t.id,node:t})),this.render(!0)}onKey(e){let t=this.visible(),n=document.activeElement?.dataset?.id,r=t.findIndex(e=>e.node.id===n),i=t[r];if(!i)return;let a=getComputedStyle(this).direction===`rtl`,o=!!i.node.children?.length,s=this.open.has(i.node.id),c=e=>{this.focusId=e,this.render(!0)};if(e.key===`ArrowDown`)t[r+1]&&c(t[r+1].node.id);else if(e.key===`ArrowUp`)t[r-1]&&c(t[r-1].node.id);else if(e.key===`Home`)c(t[0].node.id);else if(e.key===`End`)c(t[t.length-1].node.id);else if(e.key===(a?`ArrowLeft`:`ArrowRight`))o&&!s?(this.toggle(i.node.id,!0),c(i.node.id)):o&&c(i.node.children[0].id);else if(e.key===(a?`ArrowRight`:`ArrowLeft`))o&&s?(this.toggle(i.node.id,!1),c(i.node.id)):i.parent&&c(i.parent);else if(e.key===`Enter`||e.key===` `)this.focusId=i.node.id,this.choose(i.node);else return;e.preventDefault()}};g.observedAttributes=[`label`,`selected`,`expanded`];var _=class extends s{constructor(){super(...arguments),this.list=null,this.i=0,this.spot=null,this.card=null,this.returnTo=null,this.key=c(`kashi-tour`),this.place=()=>{let e=this.card;if(!e)return;let t=document.querySelector(this.steps[this.i].target)?.getBoundingClientRect()??null;t?(this.spot||(this.spot=document.createElement(`div`),this.spot.className=`k-tour__spot`,this.spot.setAttribute(`aria-hidden`,`true`),document.body.append(this.spot)),Object.assign(this.spot.style,{top:`${t.top-6}px`,left:`${t.left-6}px`,inlineSize:`${t.width+12}px`,blockSize:`${t.height+12}px`})):(this.spot?.remove(),this.spot=null);let n=e.getBoundingClientRect();if(!t){Object.assign(e.style,{top:`${innerHeight/2-n.height/2}px`,left:`${innerWidth/2-n.width/2}px`});return}let r=t.bottom+12+n.height<innerHeight?t.bottom+12:Math.max(12,t.top-12-n.height),i=Math.min(innerWidth-n.width-12,Math.max(12,t.left+t.width/2-n.width/2));Object.assign(e.style,{top:`${r}px`,left:`${i}px`})}}connectedCallback(){o(()=>{this.isConnected&&this.list===null&&(this.list=[...this.querySelectorAll(`:scope > [data-target]`)].map(e=>({target:e.dataset.target,title:e.dataset.title??``,content:e.textContent?.trim()??``})),this.replaceChildren())})}disconnectedCallback(){this.stop(!1)}get steps(){return this.list??[]}set steps(e){this.list=[...e]}start(){this.steps.length&&(this.returnTo=document.activeElement,this.i=0,addEventListener(`scroll`,this.place,{passive:!0}),addEventListener(`resize`,this.place),this.show())}stop(e=!0){this.spot?.remove(),this.card?.remove(),this.spot=this.card=null,removeEventListener(`scroll`,this.place),removeEventListener(`resize`,this.place),e&&this.returnTo?.focus?.()}show(){let t=this.steps[this.i],i=this.steps.length,o=this.i===i-1;this.card||(this.card=document.createElement(`div`),this.card.className=`k-tour__card`,this.card.setAttribute(`role`,`dialog`),this.card.setAttribute(`aria-modal`,`false`),this.card.setAttribute(`aria-labelledby`,`${this.key}-t`),this.card.setAttribute(`aria-describedby`,`${this.key}-b`),this.card.tabIndex=-1,this.card.addEventListener(`click`,t=>{let n=t.target.closest(`[data-act]`);if(!n)return;let r=n.dataset.act;r===`skip`?this.stop():r===`prev`?this.step(-1):r===`next`?this.step(1):r===`done`&&(this.stop(),e(this,`kashi-finish`,{}))}),this.card.addEventListener(`keydown`,e=>{let t=getComputedStyle(this.card).direction===`rtl`;e.key===`Escape`?this.stop():e.key===(t?`ArrowLeft`:`ArrowRight`)&&this.i<this.steps.length-1?this.step(1):e.key===(t?`ArrowRight`:`ArrowLeft`)&&this.i>0&&this.step(-1)}),document.body.append(this.card)),this.card.innerHTML=`<span class="k-tour__step">${n(a().tour.step(r(this,this.i+1),r(this,i)))}</span><p class="k-tour__title" id="${this.key}-t">${n(t.title)}</p><p class="k-tour__body" id="${this.key}-b">${n(t.content)}</p><div class="k-tour__actions"><button type="button" class="k-btn k-btn--link k-tour__skip" data-act="skip">${n(a().tour.skip)}</button><span class="k-tour__progress" aria-hidden="true">${this.steps.map((e,t)=>`<span${t<=this.i?` data-on=""`:``}></span>`).join(``)}</span>${this.i>0?'<button type="button" class="k-btn k-btn--secondary k-btn--sm" data-act="prev">${esc(msg().common.prev)}</button>':``}<button type="button" class="k-btn k-btn--primary k-btn--sm" data-act="${o?`done`:`next`}">${n(o?a().tour.done:a().common.next)}</button></div>`;let s=document.querySelector(t.target),c=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches;s?.scrollIntoView?.({block:`center`,behavior:c?`auto`:`smooth`}),this.place(),setTimeout(this.place,400),this.card.focus({preventScroll:!0})}step(e){this.i=Math.max(0,Math.min(this.steps.length-1,this.i+e)),this.show()}},v=class extends s{constructor(){super(...arguments),this.current=40,this.built=!1,this.dragging=!1}connectedCallback(){o(()=>{this.isConnected&&!this.built&&(this.current=this.num(`size`,40),this.build())})}attributeChangedCallback(e,t,n){this.built&&t!==n&&(e===`size`?this.set(Number(n)||40,!1):this.decorate())}get value(){return this.current}set value(e){this.set(e,!1)}num(e,t){let n=Number(this.getAttribute(e));return Number.isFinite(n)&&this.getAttribute(e)!==null?n:t}get vertical(){return this.getAttribute(`orientation`)===`vertical`}build(){let[e,t]=[...this.children],n=document.createElement(`div`),r=document.createElement(`div`);r.className=`k-splitter__pane`,e&&r.append(e);let i=document.createElement(`div`);i.className=`k-splitter__handle`,i.setAttribute(`role`,`separator`),i.tabIndex=0;let a=document.createElement(`div`);a.className=`k-splitter__pane`,t&&a.append(t),n.append(r,i,a),this.replaceChildren(n),this.built=!0,i.addEventListener(`pointerdown`,e=>{i.setPointerCapture?.(e.pointerId),this.dragging=!0,n.toggleAttribute(`data-dragging`,!0),i.toggleAttribute(`data-dragging`,!0)}),i.addEventListener(`pointermove`,e=>{if(!this.dragging)return;let t=n.getBoundingClientRect();if(this.vertical)return this.set((e.clientY-t.top)/t.height*100);let r=getComputedStyle(n).direction===`rtl`;this.set((r?t.right-e.clientX:e.clientX-t.left)/t.width*100)});let o=()=>{this.dragging=!1,n.removeAttribute(`data-dragging`),i.removeAttribute(`data-dragging`)};i.addEventListener(`pointerup`,o),i.addEventListener(`pointercancel`,o),i.addEventListener(`dblclick`,()=>this.set(this.num(`size`,40))),i.addEventListener(`keydown`,e=>{let t=getComputedStyle(i).direction===`rtl`,n=this.vertical?{ArrowUp:-5,ArrowDown:5}:{ArrowLeft:t?5:-5,ArrowRight:t?-5:5};if(e.key in n)this.set(this.current+n[e.key]);else if(e.key===`Home`)this.set(this.num(`min`,15));else if(e.key===`End`)this.set(this.num(`max`,85));else return;e.preventDefault()}),this.decorate()}decorate(){let e=this.firstElementChild;e.className=`k-splitter${this.vertical?` k-splitter--vertical`:``}`;let t=this.getAttribute(`height`);e.style.blockSize=t??``;let n=e.querySelector(`.k-splitter__handle`);n.setAttribute(`aria-orientation`,this.vertical?`horizontal`:`vertical`),n.setAttribute(`aria-valuemin`,String(this.num(`min`,15))),n.setAttribute(`aria-valuemax`,String(this.num(`max`,85))),n.setAttribute(`aria-label`,this.getAttribute(`label`)??a().splitter.label),this.paint()}set(t,n=!0){let r=Math.round(Math.min(this.num(`max`,85),Math.max(this.num(`min`,15),t))*10)/10,i=r!==this.current;this.current=r,this.built&&this.paint(),n&&i&&e(this,`kashi-change`,{value:r})}paint(){let e=this.firstElementChild,t=e.querySelector(`.k-splitter__pane`);t.style.inlineSize=this.vertical?``:`${this.current}%`,t.style.blockSize=this.vertical?`${this.current}%`:``;let n=e.querySelector(`.k-splitter__handle`);n.setAttribute(`aria-valuenow`,String(this.current)),n.setAttribute(`aria-valuetext`,a().common.percent(r(this,Math.round(this.current))))}};v.observedAttributes=[`size`,`min`,`max`,`orientation`,`label`,`height`];var y=class extends s{constructor(){super(...arguments),this.built=!1}connectedCallback(){o(()=>{this.isConnected&&!this.built&&(this.built=!0,this.addEventListener(`click`,t=>{let n=t.target.closest(`button[aria-controls][aria-expanded]`);if(!n||!this.contains(n))return;let r=document.getElementById(n.getAttribute(`aria-controls`)),i=n.getAttribute(`aria-expanded`)!==`true`;n.setAttribute(`aria-expanded`,String(i)),r&&(r.hidden=!i),e(this,`kashi-toggle`,{id:r?.id??``,open:i})}),this.decorate())})}attributeChangedCallback(){this.built&&this.decorate()}decorate(){let e=this.querySelector(`.k-sidenav`),n=t(this,`collapsed`);e?.classList.toggle(`k-sidenav--collapsed`,n),this.querySelectorAll(`.k-sidenav__item`).forEach(e=>{let t=e.querySelector(`.k-sidenav__text`)?.textContent?.trim();t&&(n?(e.setAttribute(`aria-label`,t),e.setAttribute(`title`,t)):(e.removeAttribute(`aria-label`),e.removeAttribute(`title`)))})}};y.observedAttributes=[`collapsed`],typeof document<`u`&&document.addEventListener(`click`,e=>{let t=e.target,n=t?.closest?.(`[data-kashi-tour]`),r=n?document.getElementById(n.getAttribute(`data-kashi-tour`)):null;r?.start&&r.start();let i=t?.closest?.(`[data-kashi-command]`),a=i?document.getElementById(i.getAttribute(`data-kashi-command`)):null;a?.show&&a.show()}),i(`kashi-command-palette`,f,`contents`),i(`kashi-context-menu`,p,`block`),i(`kashi-carousel`,h,`block`),i(`kashi-tree-view`,g,`block`),i(`kashi-tour`,_,`contents`),i(`kashi-splitter`,v,`block`),i(`kashi-side-nav`,y,`block`);export{h as KashiCarousel,f as KashiCommandPalette,p as KashiContextMenu,y as KashiSideNav,v as KashiSplitter,_ as KashiTour,g as KashiTreeView};
@@ -0,0 +1 @@
1
+ import{c as e,i as t,l as n,n as r,o as i,p as a,r as o,t as s,v as c}from"./base-DTQ50VdG.js";var l=class extends s{constructor(){super(...arguments),this.dialog=null,this.opener=null,this.key=c(`kashi-dialog`)}connectedCallback(){o(()=>{this.isConnected&&(this.dialog||this.build(),this.sync())})}attributeChangedCallback(e,t,n){this.dialog&&t!==n&&(e===`open`?this.sync():this.decorate())}get open(){return this.hasAttribute(`open`)}set open(e){this.toggleAttribute(`open`,!!e)}show(){this.open=!0}close(e){this.dialog?.open?this.dialog.close(e):this.open=!1}build(){let n=[...this.children].filter(e=>e.getAttribute(`slot`)===`footer`),i=[...this.childNodes].filter(e=>!n.includes(e)),a=document.createElement(`dialog`);if(a.setAttribute(`aria-labelledby`,`${this.key}-title`),a.innerHTML=`<div class="k-dialog__header"><div class="k-dialog__heading"><h2 class="k-dialog__title" id="${this.key}-title"></h2><p class="k-dialog__description" id="${this.key}-desc"></p></div><button type="button" class="k-btn k-btn--tertiary k-btn--icon k-btn--sm k-dialog__close">${r.close}</button></div>`,i.some(e=>e.nodeType===1||e.textContent?.trim())){let e=document.createElement(`div`);e.className=`k-dialog__body`,e.append(...i),a.append(e)}if(n.length){let e=document.createElement(`div`);e.className=`k-dialog__footer`;for(let t of n)t.removeAttribute(`slot`),e.append(t);a.append(e)}this.replaceChildren(a),this.dialog=a,a.querySelector(`.k-dialog__close`).addEventListener(`click`,()=>this.close()),a.addEventListener(`click`,e=>{e.target===a&&t(this,`dismissible`,!0)&&this.close();let n=e.target.closest(`[data-kashi-close]`);n&&a.contains(n)&&this.close(n.getAttribute(`data-kashi-close`)||void 0)}),a.addEventListener(`close`,()=>{this.removeAttribute(`open`),this.opener?.focus?.(),e(this,`kashi-close`,{returnValue:a.returnValue})}),this.decorate()}decorate(){let e=this.dialog,t=this.getAttribute(`size`)??`md`,n=this.getAttribute(`placement`)??`center`;e.className=[`k-dialog`,t!==`md`&&`k-dialog--${t}`,n!==`center`&&`k-dialog--${n}`,this.getAttribute(`tone`)===`danger`&&`k-dialog--danger`].filter(Boolean).join(` `),e.dataset.placement=n,e.querySelector(`.k-dialog__title`).textContent=this.getAttribute(`heading`)??``;let r=e.querySelector(`.k-dialog__description`),i=this.getAttribute(`description`);r.textContent=i??``,r.hidden=!i,i?e.setAttribute(`aria-describedby`,r.id):e.removeAttribute(`aria-describedby`),e.querySelector(`.k-dialog__close`).setAttribute(`aria-label`,this.getAttribute(`close-label`)??a().common.close)}sync(){let t=this.dialog;t&&this.isConnected&&(this.open&&!t.open?(this.opener=document.activeElement,t.showModal?.(),e(this,`kashi-open`,{})):!this.open&&t.open&&t.close())}};l.observedAttributes=[`open`,`heading`,`description`,`tone`,`size`,`placement`,`close-label`];var u=class extends s{constructor(){super(...arguments),this.list=null,this.key=c(`kashi-tabs`),this.ro=null}connectedCallback(){o(()=>this.isConnected&&this.setup())}setup(){this.list||this.build(),this.decorate(),this.select(this.getAttribute(`value`)??this.panels[0]?.dataset.value??``,!1),typeof ResizeObserver<`u`&&!this.ro&&(this.ro=new ResizeObserver(()=>this.measure()),this.ro.observe(this.list))}disconnectedCallback(){this.ro?.disconnect(),this.ro=null}attributeChangedCallback(e,t,n){this.list&&t!==n&&(e===`value`?this.select(n??``,!1):this.decorate())}get value(){return this.getAttribute(`value`)??``}set value(e){this.setAttribute(`value`,e)}get panels(){return[...this.children].filter(e=>e instanceof HTMLElement&&e.hasAttribute(`data-tab`))}build(){let e=document.createElement(`div`);e.setAttribute(`role`,`tablist`),e.className=`k-tabs__list`,this.panels.forEach((t,n)=>{let r=t.dataset.value||String(n+1);t.dataset.value=r;let i=document.createElement(`button`);i.type=`button`,i.setAttribute(`role`,`tab`),i.className=`k-tabs__tab`,i.id=`${this.key}-tab-${n}`,i.dataset.value=r,i.textContent=t.dataset.tab??``,t.hasAttribute(`data-disabled`)&&(i.disabled=!0),t.id||=`${this.key}-panel-${n}`,i.setAttribute(`aria-controls`,t.id),t.setAttribute(`role`,`tabpanel`),t.setAttribute(`aria-labelledby`,i.id),t.tabIndex=0,t.classList.add(`k-tabs__panel`),e.append(i)});let t=document.createElement(`span`);t.className=`k-tabs__indicator`,t.setAttribute(`aria-hidden`,`true`),e.append(t),e.addEventListener(`click`,e=>{let t=e.target.closest(`[role="tab"]`);t&&!t.disabled&&this.select(t.dataset.value,!0)}),e.addEventListener(`keydown`,e=>this.onKey(e)),this.prepend(e),this.list=e}decorate(){let e=this.getAttribute(`variant`)??`line`,n=this.getAttribute(`orientation`)===`vertical`;for(let e of[...this.classList])e.startsWith(`k-tabs`)&&this.classList.remove(e);this.classList.add(`k-tabs`,`k-tabs--${e}`),t(this,`block`)&&this.classList.add(`k-tabs--block`),n&&this.classList.add(`k-tabs--vertical`),this.getAttribute(`size`)===`sm`&&this.classList.add(`k-tabs--sm`),this.dataset.orientation=n?`vertical`:`horizontal`,this.list.setAttribute(`aria-orientation`,n?`vertical`:`horizontal`);let r=this.getAttribute(`label`);r&&this.list.setAttribute(`aria-label`,r),this.measure()}select(t,n){let r=[...this.list.querySelectorAll(`[role="tab"]`)];r.some(e=>e.dataset.value===t)||(t=r[0]?.dataset.value??``);for(let e of r){let n=e.dataset.value===t;e.setAttribute(`aria-selected`,String(n)),e.tabIndex=n?0:-1}for(let e of this.panels)e.hidden=e.dataset.value!==t;this.getAttribute(`value`)!==t&&this.setAttribute(`value`,t),this.measure(),n&&e(this,`kashi-change`,{value:t})}measure(){let e=this.list,t=e?.querySelector(`[role="tab"][aria-selected="true"]`);!e||!t||!t.offsetWidth?e?.removeAttribute(`data-indicator`):(e.setAttribute(`data-indicator`,``),e.style.setProperty(`--_ix`,`${t.offsetLeft}px`),e.style.setProperty(`--_iy`,`${t.offsetTop}px`),e.style.setProperty(`--_iw`,`${t.offsetWidth}px`),e.style.setProperty(`--_ih`,`${t.offsetHeight}px`))}onKey(e){let t=[...this.list.querySelectorAll(`[role="tab"]:not(:disabled)`)],n=t.indexOf(document.activeElement);if(n<0)return;let r=getComputedStyle(this.list).direction===`rtl`,i=this.getAttribute(`orientation`)===`vertical`?{ArrowDown:n+1,ArrowUp:n-1,Home:0,End:t.length-1}:{ArrowLeft:r?n+1:n-1,ArrowRight:r?n-1:n+1,Home:0,End:t.length-1};if(!(e.key in i))return;e.preventDefault();let a=t[(i[e.key]+t.length)%t.length];a.focus(),this.select(a.dataset.value,!0)}};u.observedAttributes=[`value`,`variant`,`block`,`orientation`,`size`,`label`];var d=class extends s{constructor(){super(...arguments),this.tip=null,this.key=c(`kashi-tip`),this.onKey=e=>{e.key===`Escape`&&(clearTimeout(this.timer),this.tip.hidden=!0)}}connectedCallback(){o(()=>this.isConnected&&this.setup())}setup(){if(!this.tip){this.classList.add(`k-tooltip-anchor`);let e=document.createElement(`span`);e.setAttribute(`role`,`tooltip`),e.id=this.key,e.hidden=!0,this.append(e),this.tip=e;let t=this.firstElementChild===e?null:this.firstElementChild;t&&t.setAttribute(`aria-describedby`,[t.getAttribute(`aria-describedby`),this.key].filter(Boolean).join(` `)),this.addEventListener(`mouseenter`,()=>this.show(Number(this.getAttribute(`delay`)??300))),this.addEventListener(`mouseleave`,()=>this.hide()),this.addEventListener(`focusin`,()=>this.show(0)),this.addEventListener(`focusout`,()=>this.hide())}this.decorate()}disconnectedCallback(){clearTimeout(this.timer),document.removeEventListener(`keydown`,this.onKey)}attributeChangedCallback(){this.tip&&this.decorate()}decorate(){let e=this.getAttribute(`placement`);this.tip.className=`k-tooltip${e&&e!==`top`?` k-tooltip--${e}`:``}`,this.tip.textContent=this.getAttribute(`content`)??``}show(e){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tip.hidden=!1,document.addEventListener(`keydown`,this.onKey)},e)}hide(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tip.hidden=!0,document.removeEventListener(`keydown`,this.onKey)},100)}};d.observedAttributes=[`content`,`placement`];var f=class extends s{constructor(){super(...arguments),this.state=`idle`,this.built=!1}connectedCallback(){this.built||(this.built=!0,this.addEventListener(`click`,e=>{e.target.closest(`button`)&&this.copy()})),this.render()}disconnectedCallback(){clearTimeout(this.timer)}attributeChangedCallback(){this.built&&this.render()}get text(){let e=this.getAttribute(`value`);if(e!==null)return e;let t=this.getAttribute(`target`),n=t?document.querySelector(t):null;return n?typeof n.value==`string`?n.value:(n.textContent??``).trim():``}async copy(){try{await navigator.clipboard.writeText(this.text),this.state=`copied`,e(this,`kashi-copy`,{value:this.text})}catch{this.state=`failed`}this.render(),clearTimeout(this.timer),this.timer=setTimeout(()=>{this.state=`idle`,this.render()},Number(this.getAttribute(`timeout`))||2e3)}render(){let e=this.getAttribute(`label`)??a().copy.copy,i=this.getAttribute(`copied-label`)??a().copy.copied,o=this.state===`copied`?i:this.state===`failed`?a().copy.failed:e,s=t(this,`icon-only`),c=this.state===`copied`?r.check:r.copy,l=this.getAttribute(`variant`)??`secondary`,u=this.getAttribute(`size`)??`sm`,d=this.contains(document.activeElement);this.innerHTML=`<button type="button" class="k-btn k-btn--${n(l)}${u===`md`?``:` k-btn--${n(u)}`}${s?` k-btn--icon`:``}" data-variant="${n(l)}" data-size="${n(u)}"${s?` aria-label="${n(o)}"`:``}${this.state===`copied`?` data-copied=""`:``}>${c}${s?``:n(o)}</button><span class="k-sr-only" aria-live="polite">${this.state===`idle`?``:n(o)}</span>`,d&&this.querySelector(`button`).focus()}};f.observedAttributes=[`value`,`target`,`label`,`copied-label`,`icon-only`,`variant`,`size`],i(`kashi-dialog`,l,`contents`),i(`kashi-tabs`,u,`block`),i(`kashi-tooltip`,d),i(`kashi-copy-button`,f),typeof document<`u`&&document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`[data-kashi-open]`);if(t){let n=document.getElementById(t.getAttribute(`data-kashi-open`));n?.show&&(e.preventDefault(),n.show())}});export{f as KashiCopyButton,l as KashiDialog,u as KashiTabs,d as KashiTooltip};