@simai-studio/ui 5.20261019.1710 → 5.20261019.1921

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 (46) hide show
  1. package/README.md +4 -4
  2. package/distr/component/button-group/css/button-group.min.css +1 -1
  3. package/distr/component/country-code/js/country-code.min.js +1 -1
  4. package/distr/component/dropdown/js/dropdown.min.js +1 -1
  5. package/distr/component/file-upload/js/file-upload.min.js +1 -1
  6. package/distr/component/inputs/js/inputs.min.js +1 -1
  7. package/distr/component/pagination/css/pagination.min.css +1 -1
  8. package/distr/component/quantity/js/quantity.min.js +1 -1
  9. package/distr/component/textarea/js/textarea.min.js +1 -1
  10. package/distr/core/contracts/adaptive-sizing.schema.json +1 -1
  11. package/distr/core/contracts/composite-host-port.v1.schema.json +1 -1
  12. package/distr/core/contracts/composition-document.v1.schema.json +1 -1
  13. package/distr/core/contracts/composition-editor-field-kind.v1.schema.json +1 -1
  14. package/distr/core/contracts/composition-editor-manifest.v1.schema.json +1 -1
  15. package/distr/core/contracts/composition-port-manifest.v1.schema.json +1 -1
  16. package/distr/core/contracts/composition-type-manifest.v1.schema.json +1 -1
  17. package/distr/core/contracts/public-js-api.json +1 -0
  18. package/distr/core/contracts/public-variables.v1.json +11 -0
  19. package/distr/core/css/core.css +11 -0
  20. package/distr/core/css/core.min.css +1 -1
  21. package/distr/core/js/core-loader.js +13 -11
  22. package/distr/core/js/core-loader.min.js +1 -1
  23. package/distr/core/js/core.js +75 -24
  24. package/distr/core/js/core.min.js +2 -2
  25. package/distr/core/js/smart-base.js +2 -2
  26. package/distr/core/js/smart-base.min.js +1 -1
  27. package/distr/core/js/template-utilities.generated.json +1 -0
  28. package/distr/smart/avatar/js/avatar.min.js +1 -1
  29. package/distr/smart/badges/js/badges.min.js +1 -1
  30. package/distr/smart/button-group/js/button-group.min.js +22 -21
  31. package/distr/smart/button-group/smart.manifest.json +22 -1
  32. package/distr/smart/button-group/template/default.js +4 -0
  33. package/distr/smart/buttons/js/buttons.min.js +1 -1
  34. package/distr/smart/country-code/js/country-code.min.js +1 -1
  35. package/distr/smart/datepicker/js/datepicker.min.js +1 -1
  36. package/distr/smart/dropdown/js/dropdown.min.js +1 -1
  37. package/distr/smart/file-upload/js/file-upload.min.js +1 -1
  38. package/distr/smart/inputs/js/inputs.min.js +1 -1
  39. package/distr/smart/list-item/js/list-item.min.js +16 -16
  40. package/distr/smart/modal/contract.json +1 -1
  41. package/distr/smart/progress-scale/js/progress-scale.min.js +1 -1
  42. package/distr/smart/reference-link/js/reference-link.min.js +1 -1
  43. package/distr/smart/tags/js/tags.min.js +1 -1
  44. package/distr/smart/textarea/js/textarea.min.js +5 -5
  45. package/package-manifest.json +46 -46
  46. package/package.json +4 -4
@@ -1,37 +1,38 @@
1
- (()=>{"use strict";var t={"18333410c461"(t,e,n){n.a(t,async(t,e)=>{try{var a=n("fbe0570fcc69"),i=n("2c8db2795ace"),s=n("2feae72af89f"),r=t([a,i,s]);[a,i,s]=r.then?(await r)():r;var o=n.n(a);function l(t=[]){if(Array.isArray(t))return t;const e=String(t||"").trim();if(!e)return[];if(e.startsWith("["))try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}return e.split("|").map(t=>{const[e,n,a=""]=t.split("::"),i=a.split(",").map(t=>t.trim()).filter(Boolean),s=i.find(t=>t.startsWith("icon="));return{value:e.trim(),label:(n||e).trim(),disabled:i.includes("disabled"),icon:s?s.slice(5):""}})}function u(t=[]){const e=new Set;return l(t).map((t,n)=>{const a="string"==typeof t?{value:t,label:t}:t;if(!a||"object"!=typeof a)return null;const i=String(a.value??a.id??n).trim();return!i||e.has(i)?null:(e.add(i),{id:String(a.id||i),value:i,label:String(a.label??a.text??i),icon:String(a.icon||""),ariaLabel:String(a.ariaLabel||a["aria-label"]||""),count:null===a.count||void 0===a.count?"":String(a.count).trim(),iconOnly:Boolean((a.iconOnly??a["icon-only"])&&a.icon),disabled:Boolean(a.disabled)})}).filter(Boolean)}class c extends(o()){static get props(){return{templateName:{attribute:"template",default:"default"},items:{type:Array,default:[],parser:l},value:{default:""},size:{default:"1",values:["1/3","1/2","1","2","3"]},spacing:{type:String,default:null},tightness:{default:"",values:["","low","high","highest"]},scheme:{default:"primary",values:["primary","secondary","on-surface"]},appearance:{default:"default",values:["default","segmented"]},plate:{default:"scheme",values:["scheme","raised"]},fullWidth:{attribute:"full-width",type:Boolean,default:!1},orientation:{default:"horizontal",values:["horizontal","vertical"]},disabled:{type:Boolean,default:!1},ariaLabel:{attribute:"aria-label",default:""},rootClass:{attribute:"root-class",default:""}}}constructor(){super(),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("sf-after-render",t=>{t.target!==this&&t.target.parentElement===this.querySelector(".sf-button-group")&&this.syncButtonSemantics()})}get normalizedItems(){const t=u(this.getProp("items")),e=t.findIndex(t=>!t.disabled);return t.map((t,n)=>({...t,firstEnabled:n===e}))}get value(){return this.getAttribute("value")||""}set value(t){null!=t&&""!==t?this.setAttribute("value",String(t)):this.removeAttribute("value")}get disabled(){return this.getBooleanAttr("disabled",!1)}templateContext(){return this.createTemplateContext({...this.getPropsContext(),...(0,s.resolveControlSpacing)({spacing:this.getAttribute("spacing"),tightness:this.getAttribute("tightness")}),component:this,items:this.normalizedItems,value:this.value,disabled:this.disabled})}template(){return(0,i.a)(this.templateContext())}emitValueChange(t){this.emitComponentEvent("button-group-change",t),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{component:this,...t}}))}select(t){const e=String(t??""),n=this.normalizedItems.find(t=>t.value===e);if(!n||n.disabled||this.disabled||e===this.value)return this;const a=this.value;return this.value=e,this.emitValueChange({previous:a,value:e,item:n}),this}afterRender(){this.syncButtonSemantics()}syncButtonSemantics(){const t=this.querySelector(".sf-button-group");if(!t)return;const e=this.normalizedItems,n=this.disabled?[]:e.filter(t=>!t.disabled),a=n.find(t=>t.value===this.value)||n[0];t.querySelectorAll(":scope > sf-button, :scope > button").forEach((t,n)=>{const i=t.matches("button")?t:t.querySelector("button"),s=e[n];if(!i||!s)return;const r=s.value===this.value;i.setAttribute("role","radio"),i.setAttribute("aria-checked",r?"true":"false"),i.tabIndex=s===a?0:-1})}clear(){if(!this.value||this.disabled)return this;const t=this.value;return this.value="",this.emitValueChange({previous:t,value:"",item:null}),this}focus(t){const e=this.querySelector('button[role="radio"][tabindex="0"]:not(:disabled)');return e?.focus?.(t),this}handleClick=t=>{const e=t.target?.closest?.("[data-sf-button-group-value]");e&&this.contains(e)&&this.select(e.getAttribute("data-sf-button-group-value"))};handleKeyDown=t=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(t.key))return;const e=this.normalizedItems.filter(t=>!t.disabled);if(!e.length||this.disabled)return;const n=Math.max(0,e.findIndex(t=>t.value===this.value)),a="Home"===t.key?0:"End"===t.key?e.length-1:["ArrowLeft","ArrowUp"].includes(t.key)?(n-1+e.length)%e.length:(n+1)%e.length;t.preventDefault();const i=this.value;this.select(e[a].value),this.value!==i&&this.addEventListener("sf-after-render",()=>this.focus(),{once:!0})}}c.define("sf-button-group"),e()}catch(d){e(d)}})},"2c8db2795ace"(t,e,n){n.a(t,async(t,a)=>{try{n.d(e,{a:()=>c});var i=n("ddf1cdb42ecc"),s=t([i]),r=s.then?(await s)():s;i=r[0];function o(t,e){return e<=1?"":0===t?"start":t===e-1?"end":"middle"}function l(t,e,n){const a=t.value===n.value,s=n.disabled||t.disabled;return i.html`
1
+ (()=>{"use strict";var e={"67eed2647f47"(e,t,n){n.d(t,{z:()=>i});const a=new WeakMap,s=new WeakSet;function i(e,t){const n=e.ownerDocument;s.has(n)||(n.addEventListener("reset",e=>{const t=e.target;if("FORM"!==t?.tagName)return;const n=Array.from(t.elements);setTimeout(()=>{if(!e.defaultPrevented)for(const e of n)if(e.isConnected&&e.form===t)for(const t of a.get(e)||[])t()},0)},!0),s.add(n));let i=a.get(e);return i||a.set(e,i=new Set),i.add(t),()=>i.delete(t)}},"18333410c461"(e,t,n){n.a(e,async(e,t)=>{try{var a=n("fbe0570fcc69"),s=n("2c8db2795ace"),i=n("2feae72af89f"),r=n("67eed2647f47"),o=n("0d662e4d7d63"),l=e([a,s,i,o]);[a,s,i,o]=l.then?(await l)():l;var u=n.n(a);const c={en:{group:"Theme",system:"System",light:"Light",dark:"Dark"},ru:{group:"Тема",system:"Как в системе",light:"Светлая",dark:"Тёмная"}},d=["system","light","dark"],h={system:"brightness_auto",light:"light_mode",dark:"dark_mode"};function b(){const e=globalThis.SF?.Loader?.themePreference;return d.includes(e)?e:"system"}function f(e=[]){if(Array.isArray(e))return e;const t=String(e||"").trim();if(!t)return[];if(t.startsWith("["))try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}return t.split("|").map(e=>{const[t,n,a=""]=e.split("::"),s=a.split(",").map(e=>e.trim()).filter(Boolean),i=s.find(e=>e.startsWith("icon="));return{value:t.trim(),label:(n||t).trim(),disabled:s.includes("disabled"),icon:i?i.slice(5):""}})}function m(e=[]){const t=new Set;return f(e).map((e,n)=>{const a="string"==typeof e?{value:e,label:e}:e;if(!a||"object"!=typeof a)return null;const s=String(a.value??a.id??n).trim();return!s||t.has(s)?null:(t.add(s),{id:String(a.id||s),value:s,label:String(a.label??a.text??s),icon:String(a.icon||""),ariaLabel:String(a.ariaLabel||a["aria-label"]||""),count:null===a.count||void 0===a.count?"":String(a.count).trim(),iconOnly:Boolean((a.iconOnly??a["icon-only"])&&a.icon),disabled:Boolean(a.disabled)})}).filter(Boolean)}class g extends(u()){static get props(){return{templateName:{attribute:"template",default:"default"},items:{type:Array,default:[],parser:f},value:{default:""},name:{default:""},themeSwitch:{attribute:"theme-switch",type:Boolean,default:!1},size:{default:"1",values:["1/3","1/2","1","2","3"]},spacing:{type:String,default:null},tightness:{default:"",values:["","low","high","highest"]},scheme:{default:"primary",values:["primary","secondary","on-surface"]},appearance:{default:"default",values:["default","segmented"]},plate:{default:"scheme",values:["scheme","raised"]},fullWidth:{attribute:"full-width",type:Boolean,default:!1},radius:{default:"",values:["","default","square","rounded"]},orientation:{default:"horizontal",values:["horizontal","vertical"]},disabled:{type:Boolean,default:!1},ariaLabel:{attribute:"aria-label",default:""},rootClass:{attribute:"root-class",default:""}}}constructor(){super(),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("sf-after-render",e=>{e.target!==this&&e.target.parentElement===this.querySelector(".sf-button-group")&&this.syncButtonSemantics()})}get themeSwitch(){return this.getBooleanAttr("theme-switch",!1)}get themeItems(){return d.map(e=>({value:e,label:(0,o.pageText)(c,e,this),icon:h[e],iconOnly:!0}))}get normalizedItems(){const e=m(this.themeSwitch?this.themeItems:this.getProp("items")),t=e.findIndex(e=>!e.disabled);return e.map((e,n)=>({...e,firstEnabled:n===t}))}get value(){return this.getAttribute("value")||""}set value(e){null!=e&&""!==e?this.setAttribute("value",String(e)):this.removeAttribute("value")}get disabled(){return this.getBooleanAttr("disabled",!1)}get name(){return this.getAttribute("name")||""}connectedCallback(){Object.prototype.hasOwnProperty.call(this,"_resetValue")||(this._resetValue=this.value),super.connectedCallback()}onConnected(){window.addEventListener("sf-theme-change",this.handleThemeChange),this.syncThemePreference()}onDisconnected(){window.removeEventListener("sf-theme-change",this.handleThemeChange),this._releaseReset?.(),this._releaseReset=null,this._resetInput=null,super.onDisconnected()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),"theme-switch"===e&&t!==n&&this._isMounted&&this.syncThemePreference()}syncThemePreference(){if(!this.themeSwitch)return;const e=b();this.value!==e&&(this.value=e)}handleThemeChange=()=>this.syncThemePreference();templateContext(){return this.createTemplateContext({...this.getPropsContext(),ariaLabel:this.getAttribute("aria-label")||(this.themeSwitch?(0,o.pageText)(c,"group",this):""),...(0,i.resolveControlSpacing)({spacing:this.getAttribute("spacing"),tightness:this.getAttribute("tightness")}),component:this,items:this.normalizedItems,value:this.value,disabled:this.disabled})}template(){return(0,s.a)(this.templateContext())}emitValueChange(e){this.emitComponentEvent("button-group-change",e),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{component:this,...e}}))}select(e){const t=String(e??""),n=this.normalizedItems.find(e=>e.value===t);if(!n||n.disabled||this.disabled||t===this.value)return this;const a=this.value;return this.themeSwitch&&!0!==globalThis.SF?.Loader?.setTheme?.(t)||(this.value=t,this.emitValueChange({previous:a,value:t,item:n})),this}afterRender(){this.syncButtonSemantics(),this.bindReset()}bindReset(){const e=this.querySelector(":scope > .sf-button-group-input");this._resetInput!==e&&(this._releaseReset?.(),this._resetInput=e,this._releaseReset=e?(0,r.z)(e,()=>{this.themeSwitch||(this.value=this._resetValue)}):null)}syncButtonSemantics(){const e=this.querySelector(".sf-button-group");if(!e)return;const t=this.normalizedItems,n=this.disabled?[]:t.filter(e=>!e.disabled),a=n.find(e=>e.value===this.value)||n[0];e.querySelectorAll(":scope > sf-button, :scope > button").forEach((e,n)=>{const s=e.matches("button")?e:e.querySelector("button"),i=t[n];if(!s||!i)return;const r=i.value===this.value;s.setAttribute("role","radio"),s.setAttribute("aria-checked",r?"true":"false"),s.tabIndex=i===a?0:-1})}clear(){if(!this.value||this.disabled||this.themeSwitch)return this;const e=this.value;return this.value="",this.emitValueChange({previous:e,value:"",item:null}),this}focus(e){const t=this.querySelector('button[role="radio"][tabindex="0"]:not(:disabled)');return t?.focus?.(e),this}handleClick=e=>{const t=e.target?.closest?.("[data-sf-button-group-value]");t&&this.contains(t)&&this.select(t.getAttribute("data-sf-button-group-value"))};handleKeyDown=e=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key))return;const t=this.normalizedItems.filter(e=>!e.disabled);if(!t.length||this.disabled)return;const n=Math.max(0,t.findIndex(e=>e.value===this.value)),a="Home"===e.key?0:"End"===e.key?t.length-1:["ArrowLeft","ArrowUp"].includes(e.key)?(n-1+t.length)%t.length:(n+1)%t.length;e.preventDefault();const s=this.value;this.select(t[a].value),this.value!==s&&this.addEventListener("sf-after-render",()=>this.focus(),{once:!0})}}g.define("sf-button-group"),t()}catch(p){t(p)}})},"2c8db2795ace"(e,t,n){n.a(e,async(e,a)=>{try{n.d(t,{a:()=>c});var s=n("ddf1cdb42ecc"),i=e([s]),r=i.then?(await i)():i;s=r[0];function o(e,t){return t<=1?"":0===e?"start":e===t-1?"end":"middle"}function l(e,t,n){const a=e.value===n.value,i=n.disabled||e.disabled;return s.html`
2
2
  <sf-button
3
- text=${t.label}
4
- icon=${t.icon||i.nothing}
3
+ text=${e.label}
4
+ icon=${e.icon||s.nothing}
5
5
  size=${n.size}
6
- spacing=${n.spacing&&"normal"!==n.spacing?n.spacing:i.nothing}
6
+ spacing=${n.spacing&&"normal"!==n.spacing?n.spacing:s.nothing}
7
7
  appearance=${a?"default":"outline"}
8
8
  scheme=${a?n.scheme:"on-surface"}
9
- segment=${o(e,n.items.length)}
10
- data-sf-button-group-value=${t.value}
11
- aria-label=${t.ariaLabel||i.nothing}
12
- class=${a?"active":i.nothing}
13
- ?disabled=${s}
9
+ segment=${o(t,n.items.length)}
10
+ data-sf-button-group-value=${e.value}
11
+ aria-label=${e.ariaLabel||s.nothing}
12
+ class=${a?"active":s.nothing}
13
+ ?disabled=${i}
14
14
  ></sf-button>
15
- `}function u(t,e){const n=t.value===e.value,a=e.disabled||t.disabled,s=["sf-button",`sf-button--size-${e.size}`,"sf-button--link","sf-button--on-surface","flex","items-cross-center","sf-button-group-segment",t.iconOnly?"sf-button-group-icon-only":"",e.spacing&&"normal"!==e.spacing?`spacing-${e.spacing}`:"",n?"active":""].filter(Boolean).join(" "),r=""!==t.count||t.ariaLabel?[t.ariaLabel||t.label,t.count].filter(t=>""!==t).join(" "):"",o=t.icon?i.html`<sf-icon icon=${t.icon} root-class="pointer-event-none" weight="400" aria-hidden="true"></sf-icon>`:i.nothing,l=""!==t.count?i.html`<span class="sf-button-group-count">${t.count}</span>`:i.nothing;return i.html`
15
+ `}function u(e,t){const n=e.value===t.value,a=t.disabled||e.disabled,i=["sf-button",`sf-button--size-${t.size}`,"sf-button--link","sf-button--on-surface","flex","items-cross-center","sf-button-group-segment",e.iconOnly?"sf-button-group-icon-only":"",t.spacing&&"normal"!==t.spacing?`spacing-${t.spacing}`:"",n?"active":""].filter(Boolean).join(" "),r=""!==e.count||e.ariaLabel?[e.ariaLabel||e.label,e.count].filter(e=>""!==e).join(" "):"",o=e.icon?s.html`<sf-icon icon=${e.icon} root-class="pointer-event-none" weight="400" aria-hidden="true"></sf-icon>`:s.nothing,l=""!==e.count?s.html`<span class="sf-button-group-count">${e.count}</span>`:s.nothing;return s.html`
16
16
  <button
17
17
  type="button"
18
- class=${s}
19
- data-sf-button-group-value=${t.value}
20
- aria-label=${r||i.nothing}
18
+ class=${i}
19
+ data-sf-button-group-value=${e.value}
20
+ aria-label=${r||s.nothing}
21
21
  ?disabled=${a}
22
22
  >
23
23
  ${o}
24
- ${t.iconOnly?i.html`<span class="sf-button-group-label--hidden">${t.label}</span>${l}`:i.html`<span class="sf-button-text-container text-center pointer-event-none">${t.label}${l}</span>`}
24
+ ${e.iconOnly?s.html`<span class="sf-button-group-label--hidden">${e.label}</span>${l}`:s.html`<span class="sf-button-text-container text-center pointer-event-none">${e.label}${l}</span>`}
25
25
  </button>
26
- `}function c(t){const e="segmented"===t.appearance,n=["sf-button-group",e?"sf-button-group--segmented":"",e?`sf-button-group--size-${t.size}`:"",e&&"raised"===t.plate?"sf-button-group--plate-raised":"",e?`sf-button-group--${t.scheme}`:"",e&&t.fullWidth?"sf-button-group--full-width":"",t.rootClass].filter(Boolean).join(" ");return i.html`
26
+ `}function c(e){const t="segmented"===e.appearance,n=["sf-button-group",t?"sf-button-group--segmented":"",t?`sf-button-group--size-${e.size}`:"",t&&"raised"===e.plate?"sf-button-group--plate-raised":"",t?`sf-button-group--${e.scheme}`:"",t&&e.fullWidth?"sf-button-group--full-width":"",e.radius?`sf-button-group--radius-${e.radius}`:"",e.rootClass].filter(Boolean).join(" ");return s.html`
27
27
  <div
28
28
  class=${n}
29
- style=${t.rootStyle||i.nothing}
29
+ style=${e.rootStyle||s.nothing}
30
30
  role="radiogroup"
31
- aria-label=${t.ariaLabel||i.nothing}
32
- aria-orientation=${t.orientation}
33
- data-value=${t.value||""}
31
+ aria-label=${e.ariaLabel||s.nothing}
32
+ aria-orientation=${e.orientation}
33
+ data-value=${e.value||""}
34
34
  >
35
- ${t.items.map((n,a)=>e?u(n,t):l(n,a,t))}
35
+ ${e.items.map((n,a)=>t?u(n,e):l(n,a,e))}
36
36
  </div>
37
- `}a()}catch(d){a(d)}})},"2feae72af89f"(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("control-spacing"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("control-spacing")),{once:!0}))},ddf1cdb42ecc(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("lit")),{once:!0}))},fbe0570fcc69(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("smart-base"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("smart-base")),{once:!0}))}};const e={};function n(a){const i=e[a];if(void 0!==i)return i.exports;const s=e[a]={exports:{}};return t[a](s,s.exports,n),s.exports}(()=>{const t="function"==typeof Symbol,e=t?Symbol("webpack queues"):"__webpack_queues__",a=t?Symbol("webpack exports"):"__webpack_exports__",i=t?Symbol("webpack error"):"__webpack_error__",s=t=>{t?.d<1&&(t.d=1,t.forEach(t=>t.r--),t.forEach(t=>t.r--?t.r++:t()))};n.a=(t,n,r)=>{let o;r&&((o=[]).d=-1);const l=new Set,u=t.exports;let c,d,h;const b=new Promise((t,e)=>{h=e,d=t});b[a]=u,b[e]=t=>(o&&t(o),l.forEach(t),b.catch(t=>{})),t.exports=b;n(t=>{let n;c=(t=>t.map(t=>{if(null!==t&&"object"==typeof t){if(t[e])return t;if(t.then){const n=[];n.d=0,t.then(t=>{r[a]=t,s(n)},t=>{r[i]=t,s(n)});const r={};return r[e]=t=>t(n),r}}const n={};return n[e]=t=>{},n[a]=t,n}))(t);const r=()=>c.map(t=>{if(t[i])throw t[i];return t[a]}),u=new Promise(t=>{n=()=>t(r),n.r=0;const a=t=>t!==o&&!l.has(t)&&(l.add(t),t&&!t.d&&(n.r++,t.push(n)));c.map(t=>t[e](a))});return n.r?u:r()},t=>(t?h(b[i]=t):d(u),s(o))),o?.d<0&&(o.d=0)}})(),n.n=t=>{const e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{if(Array.isArray(e))for(var a=0;a<e.length;){var i=e[a++],s=e[a++];n.o(t,i)?0===s&&a++:0===s?Object.defineProperty(t,i,{enumerable:!0,value:e[a++]}):Object.defineProperty(t,i,{enumerable:!0,get:s})}else for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);n("18333410c461")})();
37
+ ${e.name?s.html`<input class="sf-button-group-input" type="hidden" name=${e.name} value=${e.value||""} ?disabled=${e.disabled}>`:s.nothing}
38
+ `}a()}catch(d){a(d)}})},"2feae72af89f"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("control-spacing"):new Promise(e=>globalThis.addEventListener("sf-runtime-ready",()=>e(globalThis.SF.runtimeModule("control-spacing")),{once:!0}))},ddf1cdb42ecc(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit"):new Promise(e=>globalThis.addEventListener("sf-runtime-ready",()=>e(globalThis.SF.runtimeModule("lit")),{once:!0}))},"0d662e4d7d63"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("page-language"):new Promise(e=>globalThis.addEventListener("sf-runtime-ready",()=>e(globalThis.SF.runtimeModule("page-language")),{once:!0}))},fbe0570fcc69(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("smart-base"):new Promise(e=>globalThis.addEventListener("sf-runtime-ready",()=>e(globalThis.SF.runtimeModule("smart-base")),{once:!0}))}};const t={};function n(a){const s=t[a];if(void 0!==s)return s.exports;const i=t[a]={exports:{}};return e[a](i,i.exports,n),i.exports}(()=>{const e="function"==typeof Symbol,t=e?Symbol("webpack queues"):"__webpack_queues__",a=e?Symbol("webpack exports"):"__webpack_exports__",s=e?Symbol("webpack error"):"__webpack_error__",i=e=>{e?.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))};n.a=(e,n,r)=>{let o;r&&((o=[]).d=-1);const l=new Set,u=e.exports;let c,d,h;const b=new Promise((e,t)=>{h=t,d=e});b[a]=u,b[t]=e=>(o&&e(o),l.forEach(e),b.catch(e=>{})),e.exports=b;n(e=>{let n;c=(e=>e.map(e=>{if(null!==e&&"object"==typeof e){if(e[t])return e;if(e.then){const n=[];n.d=0,e.then(e=>{r[a]=e,i(n)},e=>{r[s]=e,i(n)});const r={};return r[t]=e=>e(n),r}}const n={};return n[t]=e=>{},n[a]=e,n}))(e);const r=()=>c.map(e=>{if(e[s])throw e[s];return e[a]}),u=new Promise(e=>{n=()=>e(r),n.r=0;const a=e=>e!==o&&!l.has(e)&&(l.add(e),e&&!e.d&&(n.r++,e.push(n)));c.map(e=>e[t](a))});return n.r?u:r()},e=>(e?h(b[s]=e):d(u),i(o))),o?.d<0&&(o.d=0)}})(),n.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{if(Array.isArray(t))for(var a=0;a<t.length;){var s=t[a++],i=t[a++];n.o(e,s)?0===i&&a++:0===i?Object.defineProperty(e,s,{enumerable:!0,value:t[a++]}):Object.defineProperty(e,s,{enumerable:!0,get:i})}else for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);n("18333410c461")})();
@@ -119,6 +119,16 @@
119
119
  "default": "",
120
120
  "description": "Currently selected item value."
121
121
  },
122
+ "name": {
123
+ "type": "string",
124
+ "default": "",
125
+ "description": "Native form field name: the group submits its value with its form, a form reset restores the initial value, and a disabled group is left out."
126
+ },
127
+ "theme-switch": {
128
+ "type": "boolean",
129
+ "default": false,
130
+ "description": "A ready theme switch: the group draws its own three icon-only items (system, light, dark) named in the page language, selects SF.Loader's theme preference and follows sf-theme-change, and a choice calls SF.Loader.setTheme. items is ignored."
131
+ },
122
132
  "size": {
123
133
  "type": "string",
124
134
  "default": "1",
@@ -186,6 +196,17 @@
186
196
  "default": false,
187
197
  "description": "In the segmented appearance, the track fills its container and the segments share the width equally."
188
198
  },
199
+ "radius": {
200
+ "type": "string",
201
+ "default": "",
202
+ "enum": [
203
+ "",
204
+ "default",
205
+ "square",
206
+ "rounded"
207
+ ],
208
+ "description": "Corner radius, as on sf-button: empty is the UI radius. In the segmented appearance the plate, a button-sized segment, takes the radius a button of that value has, and the track is it plus the padding (rounded: both pills)."
209
+ },
189
210
  "orientation": {
190
211
  "type": "string",
191
212
  "default": "horizontal",
@@ -424,7 +445,7 @@
424
445
  "source_artifacts": [
425
446
  {
426
447
  "path": "src/smart/button-group/index.js",
427
- "sha256": "a93050b14e18a71f6b6061c32e5fab9fa7272e1e56cccd4497c824282838d4ca"
448
+ "sha256": "2719a65441300ff8c0c5f515cf951906856b19b4e73844e2fbc61b61b8d9719d"
428
449
  }
429
450
  ],
430
451
  "generated_runtime": []
@@ -86,6 +86,7 @@ export function renderButtonGroupTemplate(context) {
86
86
  segmented && context.plate === 'raised' ? 'sf-button-group--plate-raised' : '',
87
87
  segmented ? `sf-button-group--${context.scheme}` : '',
88
88
  segmented && context.fullWidth ? 'sf-button-group--full-width' : '',
89
+ context.radius ? `sf-button-group--radius-${context.radius}` : '',
89
90
  context.rootClass,
90
91
  ].filter(Boolean).join(' ');
91
92
 
@@ -100,5 +101,8 @@ export function renderButtonGroupTemplate(context) {
100
101
  >
101
102
  ${context.items.map((item, index) => (segmented ? renderSegment(item, context) : renderItem(item, index, context)))}
102
103
  </div>
104
+ ${context.name
105
+ ? html`<input class="sf-button-group-input" type="hidden" name=${context.name} value=${context.value || ''} ?disabled=${context.disabled}>`
106
+ : nothing}
103
107
  `;
104
108
  }
@@ -1,4 +1,4 @@
1
- (()=>{"use strict";var t={"06e8cd089f28"(t,e,n){function i(){const t=globalThis.SF=globalThis.SF||{};return t.__deprecationNotes instanceof Map||Object.defineProperty(t,"__deprecationNotes",{value:new Map,configurable:!0}),t.__deprecationNotes}function s({component:t="",kind:e="attribute",attribute:n="",from:s,to:o=null}={}){if(!s)return;const r=[t,e,n,s].join("|"),a=i(),c=a.get(r);if(c)c.count+=1;else if(a.set(r,{component:t,kind:e,attribute:n,from:s,to:o,count:1}),function(){const t=globalThis.document?.documentElement;return"warn"===t?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const i=t?`${t}: `:"",r="value"===e?`${n}="${s}"`:`${e} ${s}`;globalThis.console?.warn?.(`[Simai Framework] ${i}${r} is a legacy name${o?`; write ${o}`:""}. See contracts/changes/journal.json.`)}}if(n.d(e,{YB:()=>s}),"undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const t=globalThis.SF.deprecations||{};t.list=function(){return[...i().values()].map(t=>({...t}))},t.clear=function(){i().clear()},t.note=s,globalThis.SF.deprecations=t}},c76f8895b630(t,e,n){n.a(t,async(t,e)=>{try{var i=n("fbe0570fcc69"),s=n("5168bdf4a1f9"),o=n("ddf1cdb42ecc"),r=n("2feae72af89f"),a=n("06e8cd089f28"),c=t([i,s,o,r]);[i,s,o,r]=c.then?(await c)():c;var l=n.n(i);const u=new Set(["template","size","appearance","type","scheme","status","text","icon","icon-start","icon-end","icon-left","icon-right","icon-position","text-position","spacing","tightness","radius","root-class","loading","segment","disabled","native-type","aria-label","class","style","id","slot"]);function d(t,e){t?.forwardHostAttributes(e,{exclude:u,transferDataAttributes:!0,storageKey:"__sfButtonForwardedDataAttributes",targetStorageKey:"__sfButtonAttributeKeys"})}const h=["default","tonal","outline","link","surface"],g={ghost:"link"},f={danger:"error",critical:"error"};class p extends(l()){constructor(){super(),this._attributeObserver=null}static get props(){return{templateName:{attribute:"template",default:"default"},size:{default:"1"},appearance:{default:"default",aliases:["type"]},scheme:{default:"primary"},status:{default:"",values:["","error"]},textPosition:{type:String,default:"center"},text:{default:""},segment:{default:""},icon:{default:""},iconStart:{type:String,default:null},iconEnd:{type:String,default:null},iconLeft:{default:""},iconRight:{default:""},iconPosition:{default:"start"},spacing:{type:String,default:null},tightness:{default:"",values:["","low","high","highest"]},radius:{default:"",values:["","default","square","rounded"]},rootClass:{default:""},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},nativeType:{default:"button"},ariaLabel:{default:""}}}get templateName(){return this.getAttribute("template")||"default"}get size(){return this.getAttribute("size")||"1"}get appearance(){const t=this.getAttribute("appearance")||this.getAttribute("type")||"default";return Object.hasOwn(g,t)?((0,a.YB)({component:this.localName,kind:"value",attribute:"appearance",from:t,to:g[t]}),g[t]):h.includes(t)?t:"default"}get type(){return this.appearance}get scheme(){return this.getAttribute("scheme")||"primary"}get status(){const t=this.getAttribute("status")||"";return f[t]?((0,a.YB)({component:this.localName,kind:"value",attribute:"status",from:t,to:f[t]}),f[t]):t}get text(){return this.getAttribute("text")||""}get icon(){return this.getAttribute("icon")||""}get iconLeft(){return this.hasAttribute("icon-left")&&(0,a.YB)({component:this.localName,kind:"attribute",from:"icon-left",to:"icon-start"}),this.getAttribute("icon-start")??this.getAttribute("icon-left")}get iconRight(){return this.hasAttribute("icon-right")&&(0,a.YB)({component:this.localName,kind:"attribute",from:"icon-right",to:"icon-end"}),this.getAttribute("icon-end")??this.getAttribute("icon-right")}get iconStart(){return this.iconLeft}get iconEnd(){return this.iconRight}get iconPosition(){return this.getAttribute("icon-position")||"start"}noteLegacyNames(){return this.hasAttribute("tightness")&&(0,a.YB)({component:this.localName,kind:"attribute",from:"tightness",to:"spacing"}),{}}get tightness(){return(0,r.resolveControlSpacing)({spacing:this.getAttribute("spacing"),tightness:this.getAttribute("tightness")}).tightness}get spacing(){return(0,r.resolveControlSpacing)({spacing:this.getAttribute("spacing"),tightness:this.getAttribute("tightness")}).spacing}get radius(){return this.getEnumAttr("radius",["default","square","rounded"],"")}get rootClass(){return this.getAttribute("root-class")||""}get loading(){return this.getBooleanAttr("loading",!1)}get disabled(){return this.getBooleanAttr("disabled",!1)}get nativeType(){return this.getAttribute("native-type")||"button"}get ariaLabel(){return this.getAttribute("aria-label")||""}templateContext(){const t=this.getPropsContext();return this.createTemplateContext({...t,iconLeft:t.iconStart??t.iconLeft,iconRight:t.iconEnd??t.iconRight,iconStart:this.iconStart,iconEnd:this.iconEnd,type:this.type,appearance:"ghost"===t.appearance?"link":t.appearance,status:this.status,...(0,r.resolveControlSpacing)({spacing:this.getAttribute("spacing"),tightness:this.getAttribute("tightness")}),...this.noteLegacyNames?.(),component:this})}template(){return(0,s.B)(this.templateContext())}resolveUpdateMode(){return"lit"}afterRender(){d(this,this.querySelector(".sf-button")),this._attributeObserver||(this._attributeObserver=this.observeForwardedHostAttributes(()=>this.querySelector(".sf-button"),{exclude:u,transferDataAttributes:!0,storageKey:"__sfButtonForwardedDataAttributes",targetStorageKey:"__sfButtonAttributeKeys"})._forwardHostAttributeObserver)}get value(){return{template:this.templateName,size:this.size,appearance:this.appearance,type:this.type,scheme:this.scheme,status:this.status,text:this.text,icon:this.icon,iconLeft:this.iconLeft,iconRight:this.iconRight,iconStart:this.iconStart,iconEnd:this.iconEnd,iconPosition:this.iconPosition,tightness:this.tightness,spacing:this.spacing,radius:this.radius,rootClass:this.rootClass,loading:this.loading,disabled:this.disabled,nativeType:this.nativeType,ariaLabel:this.ariaLabel}}onClick(t,e){return"function"==typeof t&&this.addEventListener("click",t,e),this}onFocus(t,e){return"function"==typeof t&&this.addEventListener("focusin",t,e),this}onBlur(t,e){return"function"==typeof t&&this.addEventListener("focusout",t,e),this}onMouseEnter(t,e){return"function"==typeof t&&this.addEventListener("mouseenter",t,e),this}onMouseLeave(t,e){return"function"==typeof t&&this.addEventListener("mouseleave",t,e),this}setDisabled(t=!0){return t?this.setAttribute("disabled",""):this.removeAttribute("disabled"),this}createIcon(t){return t?o.html`<sf-icon icon="${t}" root-class="pointer-event-none" weight="400" aria-hidden="true"></sf-icon>`:""}set value(t){this.setValueAttributes(t)}onDisconnected(){this.disconnectForwardedHostAttributes(),this._attributeObserver=null,super.onDisconnected?.()}}p.define("sf-button"),e()}catch(b){e(b)}})},"5168bdf4a1f9"(t,e,n){n.a(t,async(t,i)=>{try{n.d(e,{B:()=>a});var s=n("ddf1cdb42ecc"),o=t([s]),r=o.then?(await o)():o;s=r[0];function a(t){const{size:e,appearance:n,type:i,scheme:o,status:r,text:a,icon:c,iconLeft:l,iconRight:u,iconPosition:d,spacing:h,radius:g,rootClass:f,textPosition:p,loading:b,disabled:m,nativeType:y,ariaLabel:S,segment:v}=t,A=String(d||"start").toLowerCase(),_=["right","end"].includes(A),x=t.iconStart??(l||(c&&!_?c:"")),w=t.iconEnd??(u||(c&&_?c:"")),T=t.component,$=T?.hasSlotContent?.("icon-start")?T.getSlotContent("icon-start"):T?.hasSlotContent?.("icon-left")?T.getSlotContent("icon-left"):T.createIcon(x),F=T?.hasSlotContent?.("icon-end")?T.getSlotContent("icon-end"):T?.hasSlotContent?.("icon-right")?T.getSlotContent("icon-right"):T.createIcon(w),L=T?.hasSlotContent?.("text")?T.getSlotContent("text"):a,C=!$&&!F,E=["sf-button",`sf-button--size-${e}`,`sf-button--${n||i}`,`sf-button--${r||o}`,"flex","items-cross-center",v?`segment-${v}`:"",h&&"normal"!==h?`spacing-${h}`:"",g?`radius-${g}`:"",f,b?"loading sf-button-state-loading":""].filter(Boolean);return s.html`
1
+ (()=>{"use strict";var t={"06e8cd089f28"(t,e,n){function i(){const t=globalThis.SF=globalThis.SF||{};return t.__deprecationNotes instanceof Map||Object.defineProperty(t,"__deprecationNotes",{value:new Map,configurable:!0}),t.__deprecationNotes}function s({component:t="",kind:e="attribute",attribute:n="",from:s,to:o=null}={}){if(!s)return;const r=[t,e,n,s].join("|"),a=i(),c=a.get(r);if(c)c.count+=1;else if(a.set(r,{component:t,kind:e,attribute:n,from:s,to:o,count:1}),function(){const t=globalThis.document?.documentElement;return"warn"===t?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const i=t?`${t}: `:"",r="value"===e?`${n}="${s}"`:`${e} ${s}`;globalThis.console?.warn?.(`[SIMAI Framework] ${i}${r} is a legacy name${o?`; write ${o}`:""}. See contracts/changes/journal.json.`)}}if(n.d(e,{YB:()=>s}),"undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const t=globalThis.SF.deprecations||{};t.list=function(){return[...i().values()].map(t=>({...t}))},t.clear=function(){i().clear()},t.note=s,globalThis.SF.deprecations=t}},c76f8895b630(t,e,n){n.a(t,async(t,e)=>{try{var i=n("fbe0570fcc69"),s=n("5168bdf4a1f9"),o=n("ddf1cdb42ecc"),r=n("2feae72af89f"),a=n("06e8cd089f28"),c=t([i,s,o,r]);[i,s,o,r]=c.then?(await c)():c;var l=n.n(i);const u=new Set(["template","size","appearance","type","scheme","status","text","icon","icon-start","icon-end","icon-left","icon-right","icon-position","text-position","spacing","tightness","radius","root-class","loading","segment","disabled","native-type","aria-label","class","style","id","slot"]);function d(t,e){t?.forwardHostAttributes(e,{exclude:u,transferDataAttributes:!0,storageKey:"__sfButtonForwardedDataAttributes",targetStorageKey:"__sfButtonAttributeKeys"})}const h=["default","tonal","outline","link","surface"],g={ghost:"link"},f={danger:"error",critical:"error"};class p extends(l()){constructor(){super(),this._attributeObserver=null}static get props(){return{templateName:{attribute:"template",default:"default"},size:{default:"1"},appearance:{default:"default",aliases:["type"]},scheme:{default:"primary"},status:{default:"",values:["","error"]},textPosition:{type:String,default:"center"},text:{default:""},segment:{default:""},icon:{default:""},iconStart:{type:String,default:null},iconEnd:{type:String,default:null},iconLeft:{default:""},iconRight:{default:""},iconPosition:{default:"start"},spacing:{type:String,default:null},tightness:{default:"",values:["","low","high","highest"]},radius:{default:"",values:["","default","square","rounded"]},rootClass:{default:""},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},nativeType:{default:"button"},ariaLabel:{default:""}}}get templateName(){return this.getAttribute("template")||"default"}get size(){return this.getAttribute("size")||"1"}get appearance(){const t=this.getAttribute("appearance")||this.getAttribute("type")||"default";return Object.hasOwn(g,t)?((0,a.YB)({component:this.localName,kind:"value",attribute:"appearance",from:t,to:g[t]}),g[t]):h.includes(t)?t:"default"}get type(){return this.appearance}get scheme(){return this.getAttribute("scheme")||"primary"}get status(){const t=this.getAttribute("status")||"";return f[t]?((0,a.YB)({component:this.localName,kind:"value",attribute:"status",from:t,to:f[t]}),f[t]):t}get text(){return this.getAttribute("text")||""}get icon(){return this.getAttribute("icon")||""}get iconLeft(){return this.hasAttribute("icon-left")&&(0,a.YB)({component:this.localName,kind:"attribute",from:"icon-left",to:"icon-start"}),this.getAttribute("icon-start")??this.getAttribute("icon-left")}get iconRight(){return this.hasAttribute("icon-right")&&(0,a.YB)({component:this.localName,kind:"attribute",from:"icon-right",to:"icon-end"}),this.getAttribute("icon-end")??this.getAttribute("icon-right")}get iconStart(){return this.iconLeft}get iconEnd(){return this.iconRight}get iconPosition(){return this.getAttribute("icon-position")||"start"}noteLegacyNames(){return this.hasAttribute("tightness")&&(0,a.YB)({component:this.localName,kind:"attribute",from:"tightness",to:"spacing"}),{}}get tightness(){return(0,r.resolveControlSpacing)({spacing:this.getAttribute("spacing"),tightness:this.getAttribute("tightness")}).tightness}get spacing(){return(0,r.resolveControlSpacing)({spacing:this.getAttribute("spacing"),tightness:this.getAttribute("tightness")}).spacing}get radius(){return this.getEnumAttr("radius",["default","square","rounded"],"")}get rootClass(){return this.getAttribute("root-class")||""}get loading(){return this.getBooleanAttr("loading",!1)}get disabled(){return this.getBooleanAttr("disabled",!1)}get nativeType(){return this.getAttribute("native-type")||"button"}get ariaLabel(){return this.getAttribute("aria-label")||""}templateContext(){const t=this.getPropsContext();return this.createTemplateContext({...t,iconLeft:t.iconStart??t.iconLeft,iconRight:t.iconEnd??t.iconRight,iconStart:this.iconStart,iconEnd:this.iconEnd,type:this.type,appearance:"ghost"===t.appearance?"link":t.appearance,status:this.status,...(0,r.resolveControlSpacing)({spacing:this.getAttribute("spacing"),tightness:this.getAttribute("tightness")}),...this.noteLegacyNames?.(),component:this})}template(){return(0,s.B)(this.templateContext())}resolveUpdateMode(){return"lit"}afterRender(){d(this,this.querySelector(".sf-button")),this._attributeObserver||(this._attributeObserver=this.observeForwardedHostAttributes(()=>this.querySelector(".sf-button"),{exclude:u,transferDataAttributes:!0,storageKey:"__sfButtonForwardedDataAttributes",targetStorageKey:"__sfButtonAttributeKeys"})._forwardHostAttributeObserver)}get value(){return{template:this.templateName,size:this.size,appearance:this.appearance,type:this.type,scheme:this.scheme,status:this.status,text:this.text,icon:this.icon,iconLeft:this.iconLeft,iconRight:this.iconRight,iconStart:this.iconStart,iconEnd:this.iconEnd,iconPosition:this.iconPosition,tightness:this.tightness,spacing:this.spacing,radius:this.radius,rootClass:this.rootClass,loading:this.loading,disabled:this.disabled,nativeType:this.nativeType,ariaLabel:this.ariaLabel}}onClick(t,e){return"function"==typeof t&&this.addEventListener("click",t,e),this}onFocus(t,e){return"function"==typeof t&&this.addEventListener("focusin",t,e),this}onBlur(t,e){return"function"==typeof t&&this.addEventListener("focusout",t,e),this}onMouseEnter(t,e){return"function"==typeof t&&this.addEventListener("mouseenter",t,e),this}onMouseLeave(t,e){return"function"==typeof t&&this.addEventListener("mouseleave",t,e),this}setDisabled(t=!0){return t?this.setAttribute("disabled",""):this.removeAttribute("disabled"),this}createIcon(t){return t?o.html`<sf-icon icon="${t}" root-class="pointer-event-none" weight="400" aria-hidden="true"></sf-icon>`:""}set value(t){this.setValueAttributes(t)}onDisconnected(){this.disconnectForwardedHostAttributes(),this._attributeObserver=null,super.onDisconnected?.()}}p.define("sf-button"),e()}catch(b){e(b)}})},"5168bdf4a1f9"(t,e,n){n.a(t,async(t,i)=>{try{n.d(e,{B:()=>a});var s=n("ddf1cdb42ecc"),o=t([s]),r=o.then?(await o)():o;s=r[0];function a(t){const{size:e,appearance:n,type:i,scheme:o,status:r,text:a,icon:c,iconLeft:l,iconRight:u,iconPosition:d,spacing:h,radius:g,rootClass:f,textPosition:p,loading:b,disabled:m,nativeType:y,ariaLabel:S,segment:v}=t,A=String(d||"start").toLowerCase(),_=["right","end"].includes(A),x=t.iconStart??(l||(c&&!_?c:"")),w=t.iconEnd??(u||(c&&_?c:"")),T=t.component,$=T?.hasSlotContent?.("icon-start")?T.getSlotContent("icon-start"):T?.hasSlotContent?.("icon-left")?T.getSlotContent("icon-left"):T.createIcon(x),F=T?.hasSlotContent?.("icon-end")?T.getSlotContent("icon-end"):T?.hasSlotContent?.("icon-right")?T.getSlotContent("icon-right"):T.createIcon(w),L=T?.hasSlotContent?.("text")?T.getSlotContent("text"):a,C=!$&&!F,E=["sf-button",`sf-button--size-${e}`,`sf-button--${n||i}`,`sf-button--${r||o}`,"flex","items-cross-center",v?`segment-${v}`:"",h&&"normal"!==h?`spacing-${h}`:"",g?`radius-${g}`:"",f,b?"loading sf-button-state-loading":""].filter(Boolean);return s.html`
2
2
  <button
3
3
  type=${y}
4
4
  class=${E.join(" ")}
@@ -1,4 +1,4 @@
1
- (()=>{"use strict";var e={c0450586011d(e,a,s){s.a(e,async(e,t)=>{try{s.d(a,{Dk:()=>T,Ue:()=>J,Xx:()=>L,_i:()=>ce,nD:()=>ue,nK:()=>ke});var n=s("d7f974466839"),o=s("58661bec99a6"),i=s("8c672a55a76a"),l=s("c614c5e30b0d"),r=s("67eed2647f47"),m=s("0ab12d47912a"),d=s("5c1dc214bb5e"),f=s("98e26702f55a"),u=s("0d662e4d7d63"),c=e([d,u]);[d,u]=c.then?(await c)():c;var h=s.n(d);const k={en:{phoneLabel:"Phone number",phoneRequired:"Enter a phone number.",countryLabel:"Country code"},ru:{phoneLabel:"Телефон",phoneRequired:"Введите номер телефона.",countryLabel:"Код страны"}},y=()=>globalThis.SF?.Position||h(),p=".sf-country-code",H="sfCountryCodeBound",g=Array.isArray(l?.items)?l.items:[];let E=null,P=0;const C=new WeakMap,b=new WeakMap,R=new WeakMap,j=new WeakMap,w=new WeakMap;function x(e,a){if(!a)return;const s=j.get(a)||{},t=e.querySelector(".sf-country-code-text"),n=e.querySelector(".sf-country-code-hint"),o=C.get(a),i=a.hasAttribute("aria-label")&&a.getAttribute("aria-label")!==o;for(const[e,o]of[["aria-labelledby",t],["aria-describedby",n]]){const t=o?.textContent.trim()?o:null;let n=(a.getAttribute(e)||"").split(/\s+/).filter(Boolean);const l=o&&/^sf-country-\d+$/.test(o.id)&&n.includes(o.id)?o.id:"",r=s[e]||l;n=n.filter(e=>e!==r);const m=t&&("aria-describedby"===e||!i&&0===n.length)?_(t):"";m&&n.push(m);const d=[...new Set(n)].join(" ");d!==(a.getAttribute(e)||"")&&(d?a.setAttribute(e,d):a.removeAttribute(e)),s[e]=m}if(j.set(a,s),t?.textContent.trim()||a.hasAttribute("aria-labelledby"))o&&a.getAttribute("aria-label")===o&&a.removeAttribute("aria-label");else if(!i){const s=(0,u.pageText)(k,"phoneLabel",e,"sf-country-code");a.getAttribute("aria-label")!==s&&a.setAttribute("aria-label",s),C.set(a,s)}}function S(e,a){const s=R.get(a);if(a.validity.customError&&a.validationMessage!==s)return;const t=e.__sfCountryConfig||{},n=String(a.value||"").trim(),o=t.showCode?K(n,e.dataset.dialCode):n,i=a.required&&""!==n&&!/\d/.test(o)?(0,u.pageText)(k,"phoneRequired",e,"sf-country-code"):"";a.setCustomValidity(i),R.set(a,i)}function _(e){if(!e)return"";if(!e.id||document.getElementById(e.id)&&document.getElementById(e.id)!==e)do{e.id="sf-country-"+ ++P}while(document.getElementById(e.id)&&document.getElementById(e.id)!==e);return e.id}function v(e,a){if(!e||e.hasAttribute("aria-labelledby"))return;const s=C.get(e);e.hasAttribute("aria-label")&&e.getAttribute("aria-label")!==s||(e.setAttribute("aria-label",a),C.set(e,a))}function M(e){const{input:a,toggle:s,list:t,items:n}=N(e),o=e.__sfCountryConfig||{},i=e.classList.contains("open"),l=e.__sfCountrySelected,r=(0,u.pageText)(k,"countryLabel",e,"sf-country-code");x(e,a),e.querySelectorAll(".sf-country-code-required, .sf-country-code-left .sf-icon").forEach(e=>e.setAttribute("aria-hidden","true")),s&&(o.multiCountry&&o.showCode&&t?(v(s,`${r}${l?`: ${Z(l,o.locale)}`:""}`),s.setAttribute("role","button"),s.setAttribute("aria-haspopup","listbox"),s.setAttribute("aria-controls",_(t)),s.setAttribute("aria-expanded",String(i))):(s.removeAttribute("aria-haspopup"),s.removeAttribute("aria-controls"),s.removeAttribute("aria-expanded"),s.removeAttribute("aria-disabled"),s.removeAttribute("role"),s.getAttribute("aria-label")===C.get(s)&&(s.removeAttribute("aria-label"),C.delete(s)),s.tabIndex=-1)),t&&(t.setAttribute("role","listbox"),v(t,r),t.setAttribute("aria-hidden",String(!i)),t.inert=!i);let m=!1;for(const e of n){const a=!m&&!!l&&(l.iso2?L(e.dataset.iso2)===l.iso2:e.dataset.code===l.dialCode);m||=a,e.setAttribute("role","option"),e.setAttribute("aria-selected",String(a)),e.tabIndex=i&&e===document.activeElement?0:-1}}function A(e,a=!1){return null==e||""===e?a:"boolean"==typeof e?e:["1","true","yes","on","active","open","disabled"].includes(String(e).toLowerCase())}function L(e){return String(e||"").trim().toUpperCase()}function T(){const e="undefined"!=typeof window?window.sfPath:"";if(!e)return"";try{return new URL("component/flag/flags/rect",e).href.replace(/\/$/,"")}catch{return String(e).replace(/\/$/,"")+"/component/flag/flags/rect"}}function B(e,a){const s=L(e).toLowerCase();return s&&a?`${a}/${s}.svg`:""}function I(e){if(!e||"1"===e.dataset.loaded)return;const a=e.dataset.flagSrc||"";a&&(e.src=a,e.dataset.loaded="1")}function $(e,a=!0){if(!e)return;if(!a)return void I(e);const s=(E||!("IntersectionObserver"in window)||(E=new IntersectionObserver(e=>{e.forEach(e=>{if(!e.isIntersecting)return;const a=e.target;I(a),E?.unobserve?.(a)})},{rootMargin:"120px"})),E);s?s.observe(e):I(e)}function F(e,a,s=!0){const t=document.createElement("div");t.classList.add("sf-country-code-flag"),t.setAttribute("aria-hidden","true");const n=e?.flagEmoji||"",o=B(e?.iso2,a.flagBase);if(!o)return t.textContent=n,t;const i=document.createElement("img");return i.alt=e?.iso2?`${e.iso2} flag`:"flag",i.decoding="async",i.loading="lazy",i.dataset.flagSrc=o,i.dataset.flagFallback=n,i.addEventListener("error",()=>{t.textContent=n},{once:!0}),$(i,s&&a.lazyFlags),t.append(i),t}function N(e){return{input:e?.querySelector?.(".sf-country-code-field input")||null,toggle:e?.querySelector?.(".sf-country-code-left")||null,list:e?.querySelector?.(".sf-country-code-list")||null,itemsWrap:e?.querySelector?.(".sf-country-code-items")||null,items:Array.from(e?.querySelectorAll?.(".sf-country-code-item")||[]),leftFlag:e?.querySelector?.(".sf-country-code-left .sf-country-code-flag-icon")||e?.querySelector?.(".sf-country-code-left .sf-country-code-flag")||null}}function O(e){const a=L(e);return a&&g.find(e=>e.iso2===a)||null}function D(e){const a=String(e||"").trim();return a&&g.find(e=>e.dialCode===a)||null}function q(e,a="native"){const s=String(e||"").trim();if(!s)return s;if("brackets"!==a)return s;const t=s.replace(/[()]/g,""),n=t.match(/^(\+\S+)\s+(.+)$/);if(!n)return t;const o=n[1],i=n[2].trim();if(!i)return t;const l=i.indexOf(" ");let r=l>=0?i.slice(0,l):i,m=l>=0?i.slice(l+1).trim():"",d=r;if(r.includes("-")){const[e,...a]=r.split("-");d=e;m=[a.join("-"),m].filter(Boolean).join(" ")}return d?`${o} (${d})${m?` ${m}`:""}`.trim():t}function z(e,a,s=""){const t=String(e||"");if(!t)return"";const n=a||"_",o=String(s||"").replace(/\D/g,"");let i=0;return t.replace(/0/g,()=>{if(i<o.length){const e=o[i];return i+=1,e}return n})}function G(e){return String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function K(e,a){const s=String(e||"").trim();if(!s)return"";if(a){const e=G(a.trim()),t=new RegExp(`^${e}[\\s\\-()]*`,"i"),n=s.replace(t,"").trim();if(n!==s)return n}return s.replace(/^\+\d+[\s\-()]*/,"").trim()}function U(e=null){document.querySelectorAll(p).forEach(a=>{e&&a===e||V(a,!1)})}function V(e,a){if(!e)return;const{input:s}=N(e);(s?.disabled||e.classList.contains("disabled")||!1===e.__sfCountryConfig?.multiCountry)&&(a=!1),a?e.classList.add("open"):e.classList.remove("open"),M(e),e.__sfCountryViewport?.(a)}function W(e,a){const s=String(e.dataset.locale||a?.dataset.locale||(0,u.pageLanguage)(e)).toLowerCase(),t="brackets"===String(e.dataset.maskStyle??a?.dataset.maskStyle??"native").toLowerCase()?"brackets":"native";return{locale:"ru"===s?"ru":"en",useMask:A(e.dataset.useMask??a?.dataset.useMask,!1),useCountryMasks:A(e.dataset.useCountryMasks??a?.dataset.useCountryMasks,!0),showCode:A(e.dataset.showCode??a?.dataset.showCode,!0),maskStyle:t,multiCountry:A(e.dataset.multiCountry??a?.dataset.multiCountry,!0),defaultIso2:L(e.dataset.iso2??a?.dataset.iso2),fixedDialCode:String(e.dataset.dialCode??a?.dataset.dialCode??"").trim(),fixedMaskPattern:String(e.dataset.maskPattern??a?.dataset.maskPattern??"").trim(),flagBase:String(e.dataset.flagBase||a?.dataset.flagBase||"").trim()||T(),lazyFlags:A(e.dataset.lazyFlags??a?.dataset.lazyFlags,!0),showMaskPlaceholder:A(e.dataset.showMaskPlaceholder??a?.dataset.showMaskPlaceholder,!1),maskPlaceholderChar:String(e.dataset.maskPlaceholderChar??a?.dataset.maskPlaceholderChar??"_"),maxItems:Number.parseInt(e.dataset.maxItems||a?.dataset.maxItems||"0",10)||0}}function Z(e,a){if(!e)return"";if(e.label)return String(e.label);const s=("en"===a?e.nameEn||e.nameRu:e.nameRu||e.nameEn)||e.iso2;return s?`${s} (${e.dialCode})`:String(e.dialCode||"")}function J(e,a="ru",s=0){let t=Array.isArray(e)&&e.length?e:g;return Number(s)>0&&(t=t.slice(0,Number(s))),t.filter(e=>e&&"object"==typeof e).map(e=>{const s=L(e.iso2),t=String(e.dialCode||e.code||"").trim(),n=O(s)||!s&&D(t)||{},o={...n,...e,iso2:s||n.iso2||"",dialCode:t||n.dialCode||""};return o.label=Z(o,a),o})}function Y(e,a){const s=e.cloneNode(!0);return s.querySelectorAll('.sf-country-code-flag, [aria-hidden="true"]').forEach(e=>e.remove()),J([{iso2:e.dataset.iso2,code:e.dataset.code,label:s.textContent.trim(),...e.hasAttribute("data-mask-pattern")?{maskPattern:e.dataset.maskPattern}:{}}],a)[0]}function X(e,a="",s=""){const t=e.__sfCountryOptions||[],n=L(a),o=String(s||"").trim();return n&&t.find(e=>e.iso2===n)||o&&t.find(e=>e.dialCode===o)||O(n)||D(o)}function Q(e,a){const{list:s,itemsWrap:t}=N(e);if(s&&t)return{list:s,itemsWrap:t};const n=document.createElement("span");n.classList.add("sf-country-code-list");const o=document.createElement("span");o.classList.add("sf-country-code-items","flex","flex-col"),n.append(o);const i=e.querySelector(".sf-country-code-field");return i?i.insertAdjacentElement("afterend",n):e.append(n),a.multiCountry||n.classList.add("hidden"),{list:n,itemsWrap:o}}function ee(e,a){if(!a.multiCountry)return;const{itemsWrap:s}=Q(e,a);if(!s)return;if(s.children.length>0)return;const t=a.maxItems>0?g.slice(0,a.maxItems):g,n=document.createDocumentFragment();t.forEach(e=>{const s=document.createElement("span");s.classList.add("sf-country-code-item","flex","items-center","transition"),s.dataset.iso2=e.iso2,s.dataset.code=e.dialCode,e.maskPattern&&(s.dataset.maskPattern=e.maskPattern);const t=F(e,a,!0),o=document.createElement("span");o.textContent=Z(e,a.locale),s.append(t,o),n.append(s)}),s.append(n)}function ae(e){const{list:a}=N(e);a&&a.querySelectorAll("img[data-flag-src]").forEach(e=>$(e,!0))}function se(e,a=8){const{list:s,itemsWrap:t}=N(e);if(!s||!t||a<=0||!e.classList.contains("open"))return 0;const n=Array.from(t.querySelectorAll(".sf-country-code-item")).slice(0,a),o=n.map(e=>e.offsetHeight);if(!o.some(Boolean))return 0;const i=window.getComputedStyle(t),l=Number.parseFloat(i.rowGap||"")||Number.parseFloat(i.gap||"")||0,r=o.reduce((e,a)=>e+a,0)+(n.length-1)*l+(Number.parseFloat(i.paddingTop||"")||0)+(Number.parseFloat(i.paddingBottom||"")||0);return Object.assign(t.style,{maxHeight:`${r}px`,minHeight:"0",overflowY:"auto",overflowX:"hidden"}),r}function te(e){const{list:a,itemsWrap:s}=N(e);if(!a||!s)return;let t=null,n=null;e.__sfCountryViewport=s=>{if(s&&!t&&e.isConnected)n=["display","flex-direction","overflow"].map(e=>[e,a.style.getPropertyValue(e),a.style.getPropertyPriority(e)]),Object.assign(a.style,{display:"flex",flexDirection:"column",overflow:"hidden"}),se(e),t=y().anchor(e,a,{side:"block-end",align:"start",matchWidth:!0,fitHeight:!0,onPosition:()=>{const a=e.getBoundingClientRect();(a.bottom<=0||a.top>=window.innerHeight)&&V(e,!1)}});else if(!s&&t){t.stop(),t=null;for(const[e,s,t]of n)s?a.style.setProperty(e,s,t):a.style.removeProperty(e)}else s&&t&&(se(e),t.update())}}function ne(e,a){for(let s=e;s;s=Object.getPrototypeOf(s)){const e=Object.getOwnPropertyDescriptor(s,a);if(e)return"function"==typeof e.set||!0===e.writable}return!1}async function oe(e,a,s,t=null){if(!a)return;const n=Symbol("country-code-mask");if(e.__sfCountryMaskToken=n,e.__sfCountryMask&&(window.SF?.Mask?.destroy?.(e.__sfCountryMask),delete e.__sfCountryMask),!s)return;const o=await(0,m.y)();if(n!==e.__sfCountryMaskToken)return;const i=a.value;try{const l=t||e.__sfCountryConfig||W(e,a),r=""!==String(i||"").trim(),m=l.showMaskPlaceholder&&r;if(!r&&s){const t=e?.dataset?.dialCode||l.fixedDialCode||"";a.placeholder=z(s,l.maskPlaceholderChar||"_",t)}const d=await o.create(a,{mask:s,lazy:!m,placeholderChar:l.maskPlaceholderChar||"_"});if(!d||n!==e.__sfCountryMaskToken)return void window.SF?.Mask?.destroy?.(d);if(e.__sfCountryMask=d,i){const e=String(i).replace(/\D+/g,"");e&&ne(d,"unmaskedValue")?d.unmaskedValue=e:ne(d,"value")&&(d.value=String(i)),"function"==typeof d.updateValue&&d.updateValue(),a.value=d.value||a.value}S(e,a)}catch(e){console.warn("SF.CountryCode mask init failed",e)}}function ie(e,a){return X(a,e.defaultIso2)||X(a,"",e.fixedDialCode)||a.__sfCountryOptions?.[0]||g[0]||null}function le(e){const{input:a,toggle:s}=N(e);if(!a)return;const t=e.classList.contains("disabled"),n=A(a.disabled,!1),o=t||n;e.classList.toggle("disabled",o),s&&(s.setAttribute("aria-disabled",o?"true":"false"),s.tabIndex=o?-1:0),o&&V(e,!1),M(e)}function re(e,a){if(!a?.showCode)return"";const s=String(e?.dataset?.dialCode||"").trim();return s?`${s} `:""}function me(e,a,s){if(!a)return;const t=re(e,s);if(!t)return;const n=String(a.value||"");if(n.startsWith(t))return;const o=K(n,e?.dataset?.dialCode||"");a.value=`${t}${o}`.trimEnd()}function de(e,a){if(!e||!a)return;const s=e.selectionStart??0,t=e.selectionEnd??0;if(s>=a.length&&t>=a.length)return;const n=a.length;e.setSelectionRange(n,n)}function fe(e,a,s="runtime"){if(!e||!a)return;const{input:t,leftFlag:n}=N(e);if(!t)return;const o=e.__sfCountryConfig||W(e,t),i=e.dataset.dialCode||"";e.dataset.iso2=a.iso2,e.dataset.dialCode=a.dialCode,e.dataset.maskPattern=a.maskPattern||"";const l=w.get(e);if(l&&(l.selected=e.dataset.maskPattern),e.__sfCountrySelected=a,o.showCode&&n){const e=F(a,o,!1),s=e.querySelector("img");n.textContent="",s?n.append(s):n.textContent=e.textContent||""}if("item"===s||"state"===s){const s=K(t.value,i);oe(e,t,"",o);const n=a.dialCode?`${a.dialCode} `:"";t.value=`${n}${s}`.trim(),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))}if(o.useMask){oe(e,t,q(o.useCountryMasks?a.maskPattern:o.fixedMaskPattern||a.maskPattern,o.maskStyle),o)}else oe(e,t,"",o);M(e),S(e,t)}function ue(e,{resetCountry:a=!1,countries:s,maskPattern:t}={}){if((0,f.vl)(e,"sf-country-code"),e?.__sfCountryCodeBind&&e.__sfCountryCodeBind!==ue)return e.__sfCountryCodeBind(e,{resetCountry:a,countries:s,maskPattern:t});if(!e||"function"==typeof e.__sfCountryCodeInput)return;const{input:n,toggle:o,leftFlag:i}=N(e);if(!n)return;e.__sfCountryCodeBind=ue,e.__sfCountryCodeSetState=ke;const l=W(e,n),m=w.get(e),d=void 0!==t?String(t).trim():m&&l.fixedMaskPattern===m.selected?m.fixed:l.fixedMaskPattern;l.fixedMaskPattern=d,w.set(e,{fixed:d,selected:e.dataset.maskPattern}),e.__sfCountryConfig=l,ee(e,l),se(e,8);const u=N(e),c=u.items;if(te(e),e.__sfCountryOptions=void 0===s?c.map(e=>Y(e,l.locale)):J(s,l.locale,l.maxItems),!l.showCode&&o?o.classList.add("hidden"):o&&o.classList.remove("hidden"),l.multiCountry)e.classList.remove("sf-country-code--fixed-dial-code"),u.list?.classList?.remove("hidden");else{e.classList.add("sf-country-code--fixed-dial-code"),e.classList.remove("open"),u.list?.classList?.add("hidden");const a=o?.querySelector?.(".sf-icon");a&&a.remove()}const h=ie(l,e);!a&&b.has(n)||b.set(n,h),h?fe(e,h,"init"):i&&(i.textContent="");const k=a=>{if(a.preventDefault(),!l.multiCountry||n.disabled||e.classList.contains("disabled"))return;const s=!e.classList.contains("open");U(e),V(e,s),s&&ae(e)},y=a=>{a.altKey||a.ctrlKey||a.metaKey||n.disabled||e.classList.contains("disabled")||!l.multiCountry||("Enter"!==a.key&&" "!==a.key||(a.preventDefault(),k(a),e.classList.contains("open")&&P()),"ArrowDown"!==a.key&&"ArrowUp"!==a.key||(a.preventDefault(),e.classList.contains("open")||k(a),P("ArrowUp"===a.key?-1:void 0)),"Escape"===a.key&&V(e,!1))},p=a=>{e.contains(a.target)||V(e,!1)},g=a=>{if(a.preventDefault(),n.disabled||e.classList.contains("disabled")||!l.multiCountry)return;const s=a.currentTarget;if("true"===s.getAttribute("aria-disabled")||s.classList.contains("disabled"))return;const t=Y(s,l.locale);t&&(fe(e,t,"item"),V(e,!1),("keydown"===a.type?o:n)?.focus({preventScroll:!0}))},E=()=>c.filter(e=>"true"!==e.getAttribute("aria-disabled")&&!e.classList.contains("disabled")&&!e.hidden),P=e=>{const a=E(),s=a.findIndex(e=>"true"===e.getAttribute("aria-selected")),t=void 0===e?Math.max(0,s):e<0?a.length-1:Math.min(e,a.length-1);c.forEach(e=>{e.tabIndex=-1});const n=a[t];if(!n)return;n.tabIndex=0,n.focus({preventScroll:!0});const o=u.itemsWrap;if(o){const e=o.getBoundingClientRect(),a=n.getBoundingClientRect();a.top<e.top?o.scrollTo({top:o.scrollTop-(e.top-a.top),behavior:"instant"}):a.bottom>e.bottom&&o.scrollTo({top:o.scrollTop+(a.bottom-e.bottom),behavior:"instant"})}};let C="",R=0;const j=a=>{if(a.altKey||a.ctrlKey||a.metaKey||n.disabled||e.classList.contains("disabled"))return;const s=E(),t=s.indexOf(a.currentTarget);if("Escape"===a.key)return a.preventDefault(),V(e,!1),void o?.focus({preventScroll:!0});if("Enter"!==a.key&&" "!==a.key){if(["ArrowDown","ArrowUp","Home","End"].includes(a.key)){a.preventDefault();const e="Home"===a.key?0:"End"===a.key?s.length-1:Math.max(0,t+("ArrowDown"===a.key?1:-1));return void P(e)}if(1===a.key.length){const e=performance.now();C=e-R>700?a.key:C+a.key,R=e;const n=[...C].every(e=>e===C[0])?C[0]:C,o=[...s.slice(t+1),...s.slice(0,t+1)].find(e=>(e.querySelector("span")?.textContent||e.textContent).trim().toLocaleLowerCase().startsWith(n.toLocaleLowerCase()));o&&(a.preventDefault(),P(s.indexOf(o)))}}else g(a)},_=a=>{e.contains(a.relatedTarget)||V(e,!1)},v=()=>{me(e,n,l),de(n,re(e,l)),S(e,n)},M=()=>{requestAnimationFrame(()=>{me(e,n,l),de(n,re(e,l))})},A=a=>{const s=re(e,l);if(!s)return;if(!["Backspace","Delete"].includes(a.key))return;const t=n.selectionStart??0,o=n.selectionEnd??t;return"Backspace"===a.key&&t<=s.length||"Delete"===a.key&&t<s.length?(a.preventDefault(),void de(n,s)):void((t<s.length||o<s.length)&&(a.preventDefault(),de(n,s)))};o&&(o.addEventListener("click",k),o.addEventListener("keydown",y),o.setAttribute("role","button")),n.addEventListener("input",v),n.addEventListener("paste",M),n.addEventListener("keydown",A),c.forEach(e=>{e.addEventListener("click",g),e.addEventListener("keydown",j)}),e.addEventListener("focusout",_),document.addEventListener("click",p),e.__sfCountryCodeToggleClick=k,e.__sfCountryCodeToggleKeydown=y,e.__sfCountryCodeDocClick=p,e.__sfCountryCodeItemClick=g,e.__sfCountryCodeItemKeydown=j,e.__sfCountryCodeFocusOut=_,e.__sfCountryCodeInput=v,e.__sfCountryCodePaste=M,e.__sfCountryCodeInputKeydown=A,e.__sfCountryReleaseReset=(0,r.z)(n,()=>{const a=b.get(n);a&&fe(e,a,"reset"),V(e,!1),S(e,n)}),e.__sfCountryRequiredObserver=new MutationObserver(()=>{S(e,n),x(e,n)}),e.__sfCountryRequiredObserver.observe(e,{attributes:!0,attributeFilter:["required","aria-label","aria-labelledby","aria-describedby","id"],childList:!0,characterData:!0,subtree:!0}),e.dataset[H]="1",le(e),e.__sfCountryViewport?.(e.classList.contains("open"))}function ce(e){if(!e||"function"!=typeof e.__sfCountryCodeInput)return;const{input:a,toggle:s,items:t}=N(e);e.__sfCountryReleaseReset?.(),delete e.__sfCountryReleaseReset,e.__sfCountryRequiredObserver?.disconnect(),delete e.__sfCountryRequiredObserver,e.__sfCountryViewport?.(!1),delete e.__sfCountryViewport,e.querySelectorAll("img[data-flag-src]").forEach(e=>E?.unobserve(e)),s&&e.__sfCountryCodeToggleClick&&s.removeEventListener("click",e.__sfCountryCodeToggleClick),s&&e.__sfCountryCodeToggleKeydown&&s.removeEventListener("keydown",e.__sfCountryCodeToggleKeydown),e.__sfCountryCodeDocClick&&document.removeEventListener("click",e.__sfCountryCodeDocClick),t.forEach(a=>{e.__sfCountryCodeItemKeydown&&a.removeEventListener("keydown",e.__sfCountryCodeItemKeydown),e.__sfCountryCodeItemClick&&a.removeEventListener("click",e.__sfCountryCodeItemClick)}),e.__sfCountryCodeFocusOut&&e.removeEventListener("focusout",e.__sfCountryCodeFocusOut),a&&e.__sfCountryCodeInput&&a.removeEventListener("input",e.__sfCountryCodeInput),a&&e.__sfCountryCodePaste&&a.removeEventListener("paste",e.__sfCountryCodePaste),a&&e.__sfCountryCodeInputKeydown&&a.removeEventListener("keydown",e.__sfCountryCodeInputKeydown),e.__sfCountryMask&&window.SF?.Mask?.destroy?.(e.__sfCountryMask),delete e.__sfCountryCodeToggleClick,delete e.__sfCountryCodeToggleKeydown,delete e.__sfCountryCodeDocClick,delete e.__sfCountryCodeItemClick,delete e.__sfCountryCodeItemKeydown,delete e.__sfCountryCodeFocusOut,delete e.__sfCountryCodeInput,delete e.__sfCountryCodePaste,delete e.__sfCountryCodeInputKeydown,delete e.__sfCountryMask,delete e.__sfCountryMaskToken,delete e.__sfCountrySelected,delete e.__sfCountryConfig,delete e.__sfCountryOptions,delete e.dataset[H]}function he(e=document){e.querySelectorAll(p).forEach(e=>{e.closest("sf-country-code")||ue(e)})}function ke(e,a={}){const s=e instanceof HTMLElement?e.closest(p)||e:null;if(!s)return!1;if(s.__sfCountryCodeSetState&&s.__sfCountryCodeSetState!==ke)return s.__sfCountryCodeSetState(s,a);const{input:t}=N(s);if(!t)return!1;if(Object.prototype.hasOwnProperty.call(a,"disabled")){const e=A(a.disabled,!1);t.disabled=e,s.classList.toggle("disabled",e),le(s)}if(Object.prototype.hasOwnProperty.call(a,"active")&&V(s,A(a.active,!1)),Object.prototype.hasOwnProperty.call(a,"open")&&V(s,A(a.open,!1)),Object.prototype.hasOwnProperty.call(a,"value")&&(t.value=String(a.value??""),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))),Object.prototype.hasOwnProperty.call(a,"iso2")){const e=X(s,a.iso2);e&&fe(s,e,"state")}if(Object.prototype.hasOwnProperty.call(a,"dialCode")){const e=X(s,"",a.dialCode);e&&fe(s,e,"state")}return!0}class ye extends n.y{static componentName="CountryCode";html=null;constructor(e){super(e);const{size:a="1",label:s="",required:t=!1,name:n="",form:o="",hint:i="",value:l="",placeholder:r="+7(___)___-__-__",disabled:m=!1,active:d=!1,open:u=d,countries:c=[],locale:h="ru",useMask:k=!1,useCountryMasks:y=!0,showCode:p=!0,maskStyle:H="native",multiCountry:g=!0,iso2:E="",dialCode:P="",maskPattern:C="",flagBase:b="",lazyFlags:R=!0,showMaskPlaceholder:j=!1,maskPlaceholderChar:w="_",maxItems:x=0}=this.params||{},S=this.attrs.class||this.attrs.className;this.template=document.createElement("label"),this.id&&(this.template.id=this.id),this.template.classList.add("sf-country-code",`sf-country-code--size-${(0,f.id)(a,"sf-country-code")}`),A(m)&&this.template.classList.add("disabled"),A(u)&&this.template.classList.add("open"),S&&this.template.classList.add(...`${S}`.split(" ").filter(Boolean)),this.template.dataset.locale=String(h),this.template.dataset.useMask=String(A(k,!1)),this.template.dataset.useCountryMasks=String(A(y,!0)),this.template.dataset.showCode=String(A(p,!0)),this.template.dataset.maskStyle="brackets"===String(H).toLowerCase()?"brackets":"native",this.template.dataset.multiCountry=String(A(g,!0)),this.template.dataset.lazyFlags=String(A(R,!0)),this.template.dataset.showMaskPlaceholder=String(A(j,!1)),this.template.dataset.maskPlaceholderChar=String(w||"_"),E&&(this.template.dataset.iso2=L(E)),P&&(this.template.dataset.dialCode=String(P)),C&&(this.template.dataset.maskPattern=String(C)),b&&(this.template.dataset.flagBase=String(b).replace(/\/$/,"")),Number(x)>0&&(this.template.dataset.maxItems=String(Number(x)));const _=document.createElement("span");_.classList.add("sf-country-code-label");const v=document.createElement("span");if(v.classList.add("sf-country-code-text"),v.textContent=String(s),_.append(v),A(t,!1)){const e=document.createElement("span");e.classList.add("sf-country-code-required"),e.textContent="*",_.append(e)}const M=document.createElement("span");M.classList.add("sf-country-code-field");const B=document.createElement("span");B.classList.add("sf-country-code-left");const I=document.createElement("div");I.classList.add("sf-country-code-flag-icon"),I.setAttribute("aria-hidden","true");const $=document.createElement("i");$.classList.add("sf-icon"),$.textContent=A(u)?"expand_less":"expand_more",B.append(I,$);const N=document.createElement("input");N.type="tel",N.name=String(n),o&&N.setAttribute("form",String(o)),N.required=A(t,!1),N.defaultValue=String(l??""),N.placeholder=String(r??""),N.disabled=A(m,!1),M.append(B,N),this.template.append(_,M);const O=J(c,h,x);if(O.length){const e=document.createElement("span");e.classList.add("sf-country-code-list");const a=document.createElement("span");a.classList.add("sf-country-code-items","flex","flex-col"),O.forEach(e=>{const s=document.createElement("span");s.classList.add("sf-country-code-item"),e?.iso2&&(s.dataset.iso2=L(e.iso2)),(e?.dialCode||e?.code)&&(s.dataset.code=String(e.dialCode||e.code)),void 0!==e?.maskPattern&&(s.dataset.maskPattern=String(e.maskPattern||""));const t=F({iso2:e?.iso2,flagEmoji:e?.flagEmoji||""},{flagBase:this.template.dataset.flagBase||T(),lazyFlags:A(this.template.dataset.lazyFlags,!0)},!0),n=document.createElement("span");if(e?.label)n.textContent=String(e.label);else{const a=e?.nameRu||e?.nameEn||e?.dialCode||"",s=e?.dialCode||e?.code||"";n.textContent=s?`${a} (${s})`:a}s.append(t,n),this.applyLayoutUtilities(s,".sf-country-code .sf-country-code-item"),this.applyLayoutUtilities(t,".sf-country-code .sf-country-code-flag"),a.append(s)}),e.append(a),this.template.append(e)}if(i){const e=document.createElement("span");e.classList.add("sf-country-code-hint"),e.textContent=String(i),this.template.append(e)}this.applyLayoutUtilities(this.template,".sf-country-code"),this.applyLayoutUtilities(_,".sf-country-code .sf-country-code-label"),this.applyLayoutUtilities(M,".sf-country-code .sf-country-code-field"),this.applyLayoutUtilities(B,".sf-country-code .sf-country-code-left"),this.applyLayoutUtilities(N,".sf-country-code .sf-country-code-field input"),this.applyLayoutUtilities(I,".sf-country-code .sf-country-code-flag-icon")}init(){ue(this.template,{maskPattern:this.params?.maskPattern||""})}destroyInternal(){ce(this.template)}}ye.utilityMap=i,(0,o.A)("CountryCode",ye),"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.CountryCode=window.SF.CountryCode||{},window.SF.CountryCode.setState=ke),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>he()):he();new MutationObserver(e=>{e.forEach(e=>{e.removedNodes.forEach(e=>{if(!(e instanceof Element))return;const a=[...e.querySelectorAll(p)];e.matches(p)&&a.unshift(e);for(const e of a)e.isConnected||e.closest("sf-country-code")||ce(e)}),e.addedNodes.forEach(e=>{e instanceof Element&&(e.matches?.(p)&&!e.closest("sf-country-code")&&ue(e),he(e))})})}).observe(document.documentElement,{childList:!0,subtree:!0}),t()}catch(pe){t(pe)}})},"98e26702f55a"(e,a,s){function t(){const e=globalThis.SF=globalThis.SF||{};return e.__deprecationNotes instanceof Map||Object.defineProperty(e,"__deprecationNotes",{value:new Map,configurable:!0}),e.__deprecationNotes}function n({component:e="",kind:a="attribute",attribute:s="",from:n,to:o=null}={}){if(!n)return;const i=[e,a,s,n].join("|"),l=t(),r=l.get(i);if(r)r.count+=1;else if(l.set(i,{component:e,kind:a,attribute:s,from:n,to:o,count:1}),function(){const e=globalThis.document?.documentElement;return"warn"===e?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const t=e?`${e}: `:"",i="value"===a?`${s}="${n}"`:`${a} ${n}`;globalThis.console?.warn?.(`[Simai Framework] ${t}${i} is a legacy name${o?`; write ${o}`:""}. See contracts/changes/journal.json.`)}}if(s.d(a,{id:()=>r,vl:()=>m}),"undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const e=globalThis.SF.deprecations||{};e.list=function(){return[...t().values()].map(e=>({...e}))},e.clear=function(){t().clear()},e.note=n,globalThis.SF.deprecations=e}const o=Object.freeze(["1/2","1","2"]),i=Object.freeze({"1/3":"1/2",3:"2"}),l=new Set;function r(e,a="field",s="1"){const t=String(e??"").trim().toLowerCase();if(o.includes(t))return t;if(Object.hasOwn(i,t)){const e=i[t];n({component:a,kind:"value",attribute:"size",from:t,to:e});const s=`${a}:${t}`;return l.has(s)||"undefined"==typeof console||(l.add(s),console.warn(`[Simai Framework] ${a}: size ${t} is retired for form fields; rendering size ${e}.`)),e}return s}function m(e,a){if(e?.classList)for(const[s,t]of Object.entries(i)){const t=`${a}--size-${s}`;e.classList.contains(t)&&e.classList.replace(t,`${a}--size-${r(s,a)}`)}}},"67eed2647f47"(e,a,s){s.d(a,{z:()=>o});const t=new WeakMap,n=new WeakSet;function o(e,a){const s=e.ownerDocument;n.has(s)||(s.addEventListener("reset",e=>{const a=e.target;if("FORM"!==a?.tagName)return;const s=Array.from(a.elements);setTimeout(()=>{if(!e.defaultPrevented)for(const e of s)if(e.isConnected&&e.form===a)for(const a of t.get(e)||[])a()},0)},!0),n.add(s));let o=t.get(e);return o||t.set(e,o=new Set),o.add(a),()=>o.delete(a)}},"0ab12d47912a"(e,a,s){s.d(a,{y:()=>n});let t=null;function n(){const e=()=>window.SF?.Mask?.create?window.SF.Mask:null,a=e();return a?Promise.resolve(a):t||(t=new Promise(a=>{const s=[[window,"sf-mask-ready"],[window,"sf-loader-ready"],[window,"load"],[document,"DOMContentLoaded"]],n=()=>{const o=e();o&&(s.forEach(([e,a])=>e.removeEventListener(a,n)),t=null,a(o))};s.forEach(([e,a])=>e.addEventListener(a,n))}),t)}},"58661bec99a6"(e,a,s){const t=function(e,a){if(e&&a)if("undefined"==typeof window||"function"!=typeof window.registerSfComponent){if("undefined"!=typeof window&&window.SF?.Loader?.registerComponent)window.SF.Loader.registerComponent(e,a);else if("undefined"!=typeof window){(window.SF_PENDING_COMPONENTS=window.SF_PENDING_COMPONENTS||[]).push([e,a])}}else window.registerSfComponent(e,a)};s.d(a,["A",0,t])},d7f974466839(e,a,s){s.d(a,{y:()=>t});class t{lifecycleName(){return this.componentName??this.constructor.componentName}constructor(e){this.props=e,this.id=e?.id,this.params=e?.param,this.attrs=e?.attrs||{},this.template=null,window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:beforeRender`,{detail:this}))}getUtilityMap(){return this.constructor.utilityMap||null}extractUtilityClasses(e){if(!Array.isArray(e))return[];const a=new Set;return e.forEach(e=>{if("string"!=typeof e)return;const s=e.match(/\(([^)]+)\)/g);s&&s.forEach(e=>{e.slice(1,-1).split(/\s+/).filter(Boolean).forEach(e=>{e.startsWith(".")&&e.length>1&&a.add(e.slice(1))})})}),Array.from(a)}applyLayoutUtilities(e,a){if(!e||!a)return;const s=this.getUtilityMap();if(!s||!s[a])return;this.extractUtilityClasses(s[a]).forEach(a=>e.classList.add(a))}render(){return this.html=this.template,"function"==typeof this.init&&this.init(),this.html&&window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:render`,{detail:this})),this.html}destroy(){this.destroyInternal?.(),this.props=null,this.id=null,this.params=null,this.template=null,this.html&&(this.html.remove(),this.html=null),window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:destroy`,{detail:this}))}destroyInternal(){}}},"2a25b3f4fc15"(e,a,s){s.a(e,async(e,a)=>{try{var t=s("c614c5e30b0d"),n=s("0d662e4d7d63"),o=s("c0450586011d"),i=s("fbe0570fcc69"),l=s("98e26702f55a"),r=s("788779012d8a"),m=e([n,o,i,r]);[n,o,i,r]=m.then?(await m)():m;var d=s.n(i);const f=".sf-country-code",u=Array.isArray(t?.items)?t.items:[];class c extends(d()){static get props(){return{size:{default:"1"},label:{default:""},required:{type:Boolean,default:!1},name:{default:""},form:{default:""},hint:{default:""},value:{default:""},placeholder:{default:"+7(___)___-__-__"},disabled:{type:Boolean,default:!1},open:{type:Boolean,default:!1},locale:{default:""},useMask:{type:Boolean,default:!1},useCountryMasks:{type:Boolean,default:!0},showCode:{type:Boolean,default:!0},maskStyle:{default:"native"},multiCountry:{type:Boolean,default:!0},iso2:{default:""},dialCode:{default:""},maskPattern:{default:""},flagBase:{default:""},lazyFlags:{type:Boolean,default:!0},showMaskPlaceholder:{type:Boolean,default:!1},maskPlaceholderChar:{default:"_"},maxItems:{type:Number,default:0}}}constructor(){super(),this._countries=null,this._boundRoot=null,this._renderAttributes=new Set}get size(){return(0,l.id)(this.getAttribute("size")||"1","sf-country-code")}get label(){return this.getAttribute("label")||""}get required(){return this.getBooleanAttr("required",!1)}get hint(){return this.getAttribute("hint")||""}get value(){return this.getAttribute("value")||""}get placeholder(){return this.getAttribute("placeholder")||"+7(___)___-__-__"}get disabled(){return this.getBooleanAttr("disabled",!1)}get open(){return this.getBooleanAttr("open",!1)||this.getBooleanAttr("active",!1)}get locale(){return"ru"===String(this.getAttribute("locale")||(0,n.pageLanguage)(this)).toLowerCase()?"ru":"en"}get useMask(){return this.getBooleanAttr("use-mask",!1)}get useCountryMasks(){return this.getBooleanAttr("use-country-masks",!0)}get showCode(){return this.getBooleanAttr("show-code",!0)}get maskStyle(){return"brackets"===String(this.getAttribute("mask-style")||"native").toLowerCase()?"brackets":"native"}get multiCountry(){return this.getBooleanAttr("multi-country",!0)}get iso2(){return(0,o.Xx)(this.getAttribute("iso2"))}get dialCode(){return String(this.getAttribute("dial-code")||"").trim()}get maskPattern(){return String(this.getAttribute("mask-pattern")||"").trim()}get flagBase(){return String(this.getAttribute("flag-base")||"").trim()||(0,o.Dk)()}get lazyFlags(){return this.getBooleanAttr("lazy-flags",!0)}get showMaskPlaceholder(){return this.getBooleanAttr("show-mask-placeholder",!1)}get maskPlaceholderChar(){return String(this.getAttribute("mask-placeholder-char")||"_")}get maxItems(){return Math.trunc(this.getNumberAttr("max-items",0))}get countries(){return(0,o.Ue)(this._countries,this.locale,this.maxItems)}set countries(e){this._countries=Array.isArray(e)?e:null,this.requestComponentUpdate("countries")}templateContext(){const e=this.getPropsContext(),a=this._boundRoot,s=a&&!this._renderAttributes.has("open")&&!this._renderAttributes.has("active"),t=a&&!this._renderAttributes.has("disabled");return this.createTemplateContext({...e,open:s?a.classList.contains("open"):this.open,disabled:t?!!a.querySelector("input")?.disabled||a.classList.contains("disabled"):this.disabled,countries:this.countries.length?this.countries:(0,o.Ue)(u,this.locale,this.maxItems),locale:this.locale,maskStyle:this.maskStyle,iso2:this.iso2,flagBase:this.flagBase,maxItems:this.maxItems})}onDisconnected(){this._boundRoot&&((0,o._i)(this._boundRoot),this._boundRoot=null)}beforeRender(e=[]){this._renderAttributes=new Set(e)}afterRender(e){if("function"==typeof e)return super.afterRender(e);this._boundRoot&&((0,o._i)(this._boundRoot),this._boundRoot=null),this._boundRoot=this.querySelector(f),this._boundRoot&&(0,o.nD)(this._boundRoot,{resetCountry:this._renderAttributes.has("iso2")||this._renderAttributes.has("dial-code"),countries:this.countries,maskPattern:this.maskPattern})}template(){return(0,r.o)(this.templateContext())}get state(){const e=this.querySelector(f),a=e?.querySelector?.(".sf-country-code-field input")||null;return{value:a?.value||"",iso2:e?.dataset?.iso2||"",dialCode:e?.dataset?.dialCode||"",open:e?.classList?.contains("open")||!1,disabled:e?.classList?.contains("disabled")||!1}}setState(e={}){const a=this.querySelector(f);return(0,o.nK)(a,e)}}c.define("sf-country-code"),a()}catch(e){a(e)}})},"788779012d8a"(e,a,s){s.a(e,async(e,t)=>{try{s.d(a,{o:()=>r});var n=s("ddf1cdb42ecc"),o=e([n]),i=o.then?(await o)():o;n=i[0];function l(e,a=""){const s=String(e?.iso2||"").trim().toLowerCase(),t=e?.flagEmoji||"",o=s&&a?`${a}/${s}.svg`:"";return o?n.html`
1
+ (()=>{"use strict";var e={c0450586011d(e,a,s){s.a(e,async(e,t)=>{try{s.d(a,{Dk:()=>T,Ue:()=>J,Xx:()=>L,_i:()=>ce,nD:()=>ue,nK:()=>ke});var n=s("d7f974466839"),o=s("58661bec99a6"),i=s("8c672a55a76a"),l=s("c614c5e30b0d"),r=s("67eed2647f47"),m=s("0ab12d47912a"),d=s("5c1dc214bb5e"),f=s("98e26702f55a"),u=s("0d662e4d7d63"),c=e([d,u]);[d,u]=c.then?(await c)():c;var h=s.n(d);const k={en:{phoneLabel:"Phone number",phoneRequired:"Enter a phone number.",countryLabel:"Country code"},ru:{phoneLabel:"Телефон",phoneRequired:"Введите номер телефона.",countryLabel:"Код страны"}},y=()=>globalThis.SF?.Position||h(),p=".sf-country-code",H="sfCountryCodeBound",g=Array.isArray(l?.items)?l.items:[];let E=null,P=0;const C=new WeakMap,b=new WeakMap,R=new WeakMap,j=new WeakMap,w=new WeakMap;function x(e,a){if(!a)return;const s=j.get(a)||{},t=e.querySelector(".sf-country-code-text"),n=e.querySelector(".sf-country-code-hint"),o=C.get(a),i=a.hasAttribute("aria-label")&&a.getAttribute("aria-label")!==o;for(const[e,o]of[["aria-labelledby",t],["aria-describedby",n]]){const t=o?.textContent.trim()?o:null;let n=(a.getAttribute(e)||"").split(/\s+/).filter(Boolean);const l=o&&/^sf-country-\d+$/.test(o.id)&&n.includes(o.id)?o.id:"",r=s[e]||l;n=n.filter(e=>e!==r);const m=t&&("aria-describedby"===e||!i&&0===n.length)?_(t):"";m&&n.push(m);const d=[...new Set(n)].join(" ");d!==(a.getAttribute(e)||"")&&(d?a.setAttribute(e,d):a.removeAttribute(e)),s[e]=m}if(j.set(a,s),t?.textContent.trim()||a.hasAttribute("aria-labelledby"))o&&a.getAttribute("aria-label")===o&&a.removeAttribute("aria-label");else if(!i){const s=(0,u.pageText)(k,"phoneLabel",e,"sf-country-code");a.getAttribute("aria-label")!==s&&a.setAttribute("aria-label",s),C.set(a,s)}}function S(e,a){const s=R.get(a);if(a.validity.customError&&a.validationMessage!==s)return;const t=e.__sfCountryConfig||{},n=String(a.value||"").trim(),o=t.showCode?K(n,e.dataset.dialCode):n,i=a.required&&""!==n&&!/\d/.test(o)?(0,u.pageText)(k,"phoneRequired",e,"sf-country-code"):"";a.setCustomValidity(i),R.set(a,i)}function _(e){if(!e)return"";if(!e.id||document.getElementById(e.id)&&document.getElementById(e.id)!==e)do{e.id="sf-country-"+ ++P}while(document.getElementById(e.id)&&document.getElementById(e.id)!==e);return e.id}function v(e,a){if(!e||e.hasAttribute("aria-labelledby"))return;const s=C.get(e);e.hasAttribute("aria-label")&&e.getAttribute("aria-label")!==s||(e.setAttribute("aria-label",a),C.set(e,a))}function M(e){const{input:a,toggle:s,list:t,items:n}=N(e),o=e.__sfCountryConfig||{},i=e.classList.contains("open"),l=e.__sfCountrySelected,r=(0,u.pageText)(k,"countryLabel",e,"sf-country-code");x(e,a),e.querySelectorAll(".sf-country-code-required, .sf-country-code-left .sf-icon").forEach(e=>e.setAttribute("aria-hidden","true")),s&&(o.multiCountry&&o.showCode&&t?(v(s,`${r}${l?`: ${Z(l,o.locale)}`:""}`),s.setAttribute("role","button"),s.setAttribute("aria-haspopup","listbox"),s.setAttribute("aria-controls",_(t)),s.setAttribute("aria-expanded",String(i))):(s.removeAttribute("aria-haspopup"),s.removeAttribute("aria-controls"),s.removeAttribute("aria-expanded"),s.removeAttribute("aria-disabled"),s.removeAttribute("role"),s.getAttribute("aria-label")===C.get(s)&&(s.removeAttribute("aria-label"),C.delete(s)),s.tabIndex=-1)),t&&(t.setAttribute("role","listbox"),v(t,r),t.setAttribute("aria-hidden",String(!i)),t.inert=!i);let m=!1;for(const e of n){const a=!m&&!!l&&(l.iso2?L(e.dataset.iso2)===l.iso2:e.dataset.code===l.dialCode);m||=a,e.setAttribute("role","option"),e.setAttribute("aria-selected",String(a)),e.tabIndex=i&&e===document.activeElement?0:-1}}function A(e,a=!1){return null==e||""===e?a:"boolean"==typeof e?e:["1","true","yes","on","active","open","disabled"].includes(String(e).toLowerCase())}function L(e){return String(e||"").trim().toUpperCase()}function T(){const e="undefined"!=typeof window?window.sfPath:"";if(!e)return"";try{return new URL("component/flag/flags/rect",e).href.replace(/\/$/,"")}catch{return String(e).replace(/\/$/,"")+"/component/flag/flags/rect"}}function I(e,a){const s=L(e).toLowerCase();return s&&a?`${a}/${s}.svg`:""}function B(e){if(!e||"1"===e.dataset.loaded)return;const a=e.dataset.flagSrc||"";a&&(e.src=a,e.dataset.loaded="1")}function $(e,a=!0){if(!e)return;if(!a)return void B(e);const s=(E||!("IntersectionObserver"in window)||(E=new IntersectionObserver(e=>{e.forEach(e=>{if(!e.isIntersecting)return;const a=e.target;B(a),E?.unobserve?.(a)})},{rootMargin:"120px"})),E);s?s.observe(e):B(e)}function F(e,a,s=!0){const t=document.createElement("div");t.classList.add("sf-country-code-flag"),t.setAttribute("aria-hidden","true");const n=e?.flagEmoji||"",o=I(e?.iso2,a.flagBase);if(!o)return t.textContent=n,t;const i=document.createElement("img");return i.alt=e?.iso2?`${e.iso2} flag`:"flag",i.decoding="async",i.loading="lazy",i.dataset.flagSrc=o,i.dataset.flagFallback=n,i.addEventListener("error",()=>{t.textContent=n},{once:!0}),$(i,s&&a.lazyFlags),t.append(i),t}function N(e){return{input:e?.querySelector?.(".sf-country-code-field input")||null,toggle:e?.querySelector?.(".sf-country-code-left")||null,list:e?.querySelector?.(".sf-country-code-list")||null,itemsWrap:e?.querySelector?.(".sf-country-code-items")||null,items:Array.from(e?.querySelectorAll?.(".sf-country-code-item")||[]),leftFlag:e?.querySelector?.(".sf-country-code-left .sf-country-code-flag-icon")||e?.querySelector?.(".sf-country-code-left .sf-country-code-flag")||null}}function O(e){const a=L(e);return a&&g.find(e=>e.iso2===a)||null}function D(e){const a=String(e||"").trim();return a&&g.find(e=>e.dialCode===a)||null}function q(e,a="native"){const s=String(e||"").trim();if(!s)return s;if("brackets"!==a)return s;const t=s.replace(/[()]/g,""),n=t.match(/^(\+\S+)\s+(.+)$/);if(!n)return t;const o=n[1],i=n[2].trim();if(!i)return t;const l=i.indexOf(" ");let r=l>=0?i.slice(0,l):i,m=l>=0?i.slice(l+1).trim():"",d=r;if(r.includes("-")){const[e,...a]=r.split("-");d=e;m=[a.join("-"),m].filter(Boolean).join(" ")}return d?`${o} (${d})${m?` ${m}`:""}`.trim():t}function z(e,a,s=""){const t=String(e||"");if(!t)return"";const n=a||"_",o=String(s||"").replace(/\D/g,"");let i=0;return t.replace(/0/g,()=>{if(i<o.length){const e=o[i];return i+=1,e}return n})}function G(e){return String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function K(e,a){const s=String(e||"").trim();if(!s)return"";if(a){const e=G(a.trim()),t=new RegExp(`^${e}[\\s\\-()]*`,"i"),n=s.replace(t,"").trim();if(n!==s)return n}return s.replace(/^\+\d+[\s\-()]*/,"").trim()}function U(e=null){document.querySelectorAll(p).forEach(a=>{e&&a===e||V(a,!1)})}function V(e,a){if(!e)return;const{input:s}=N(e);(s?.disabled||e.classList.contains("disabled")||!1===e.__sfCountryConfig?.multiCountry)&&(a=!1),a?e.classList.add("open"):e.classList.remove("open"),M(e),e.__sfCountryViewport?.(a)}function W(e,a){const s=String(e.dataset.locale||a?.dataset.locale||(0,u.pageLanguage)(e)).toLowerCase(),t="brackets"===String(e.dataset.maskStyle??a?.dataset.maskStyle??"native").toLowerCase()?"brackets":"native";return{locale:"ru"===s?"ru":"en",useMask:A(e.dataset.useMask??a?.dataset.useMask,!1),useCountryMasks:A(e.dataset.useCountryMasks??a?.dataset.useCountryMasks,!0),showCode:A(e.dataset.showCode??a?.dataset.showCode,!0),maskStyle:t,multiCountry:A(e.dataset.multiCountry??a?.dataset.multiCountry,!0),defaultIso2:L(e.dataset.iso2??a?.dataset.iso2),fixedDialCode:String(e.dataset.dialCode??a?.dataset.dialCode??"").trim(),fixedMaskPattern:String(e.dataset.maskPattern??a?.dataset.maskPattern??"").trim(),flagBase:String(e.dataset.flagBase||a?.dataset.flagBase||"").trim()||T(),lazyFlags:A(e.dataset.lazyFlags??a?.dataset.lazyFlags,!0),showMaskPlaceholder:A(e.dataset.showMaskPlaceholder??a?.dataset.showMaskPlaceholder,!1),maskPlaceholderChar:String(e.dataset.maskPlaceholderChar??a?.dataset.maskPlaceholderChar??"_"),maxItems:Number.parseInt(e.dataset.maxItems||a?.dataset.maxItems||"0",10)||0}}function Z(e,a){if(!e)return"";if(e.label)return String(e.label);const s=("en"===a?e.nameEn||e.nameRu:e.nameRu||e.nameEn)||e.iso2;return s?`${s} (${e.dialCode})`:String(e.dialCode||"")}function J(e,a="ru",s=0){let t=Array.isArray(e)&&e.length?e:g;return Number(s)>0&&(t=t.slice(0,Number(s))),t.filter(e=>e&&"object"==typeof e).map(e=>{const s=L(e.iso2),t=String(e.dialCode||e.code||"").trim(),n=O(s)||!s&&D(t)||{},o={...n,...e,iso2:s||n.iso2||"",dialCode:t||n.dialCode||""};return o.label=Z(o,a),o})}function Y(e,a){const s=e.cloneNode(!0);return s.querySelectorAll('.sf-country-code-flag, [aria-hidden="true"]').forEach(e=>e.remove()),J([{iso2:e.dataset.iso2,code:e.dataset.code,label:s.textContent.trim(),...e.hasAttribute("data-mask-pattern")?{maskPattern:e.dataset.maskPattern}:{}}],a)[0]}function X(e,a="",s=""){const t=e.__sfCountryOptions||[],n=L(a),o=String(s||"").trim();return n&&t.find(e=>e.iso2===n)||o&&t.find(e=>e.dialCode===o)||O(n)||D(o)}function Q(e,a){const{list:s,itemsWrap:t}=N(e);if(s&&t)return{list:s,itemsWrap:t};const n=document.createElement("span");n.classList.add("sf-country-code-list");const o=document.createElement("span");o.classList.add("sf-country-code-items","flex","flex-col"),n.append(o);const i=e.querySelector(".sf-country-code-field");return i?i.insertAdjacentElement("afterend",n):e.append(n),a.multiCountry||n.classList.add("hidden"),{list:n,itemsWrap:o}}function ee(e,a){if(!a.multiCountry)return;const{itemsWrap:s}=Q(e,a);if(!s)return;if(s.children.length>0)return;const t=a.maxItems>0?g.slice(0,a.maxItems):g,n=document.createDocumentFragment();t.forEach(e=>{const s=document.createElement("span");s.classList.add("sf-country-code-item","flex","items-center","transition"),s.dataset.iso2=e.iso2,s.dataset.code=e.dialCode,e.maskPattern&&(s.dataset.maskPattern=e.maskPattern);const t=F(e,a,!0),o=document.createElement("span");o.textContent=Z(e,a.locale),s.append(t,o),n.append(s)}),s.append(n)}function ae(e){const{list:a}=N(e);a&&a.querySelectorAll("img[data-flag-src]").forEach(e=>$(e,!0))}function se(e,a=8){const{list:s,itemsWrap:t}=N(e);if(!s||!t||a<=0||!e.classList.contains("open"))return 0;const n=Array.from(t.querySelectorAll(".sf-country-code-item")).slice(0,a),o=n.map(e=>e.offsetHeight);if(!o.some(Boolean))return 0;const i=window.getComputedStyle(t),l=Number.parseFloat(i.rowGap||"")||Number.parseFloat(i.gap||"")||0,r=o.reduce((e,a)=>e+a,0)+(n.length-1)*l+(Number.parseFloat(i.paddingTop||"")||0)+(Number.parseFloat(i.paddingBottom||"")||0);return Object.assign(t.style,{maxHeight:`${r}px`,minHeight:"0",overflowY:"auto",overflowX:"hidden"}),r}function te(e){const{list:a,itemsWrap:s}=N(e);if(!a||!s)return;let t=null,n=null;e.__sfCountryViewport=s=>{if(s&&!t&&e.isConnected)n=["display","flex-direction","overflow"].map(e=>[e,a.style.getPropertyValue(e),a.style.getPropertyPriority(e)]),Object.assign(a.style,{display:"flex",flexDirection:"column",overflow:"hidden"}),se(e),t=y().anchor(e,a,{side:"block-end",align:"start",matchWidth:!0,fitHeight:!0,onPosition:()=>{const a=e.getBoundingClientRect();(a.bottom<=0||a.top>=window.innerHeight)&&V(e,!1)}});else if(!s&&t){t.stop(),t=null;for(const[e,s,t]of n)s?a.style.setProperty(e,s,t):a.style.removeProperty(e)}else s&&t&&(se(e),t.update())}}function ne(e,a){for(let s=e;s;s=Object.getPrototypeOf(s)){const e=Object.getOwnPropertyDescriptor(s,a);if(e)return"function"==typeof e.set||!0===e.writable}return!1}async function oe(e,a,s,t=null){if(!a)return;const n=Symbol("country-code-mask");if(e.__sfCountryMaskToken=n,e.__sfCountryMask&&(window.SF?.Mask?.destroy?.(e.__sfCountryMask),delete e.__sfCountryMask),!s)return;const o=await(0,m.y)();if(n!==e.__sfCountryMaskToken)return;const i=a.value;try{const l=t||e.__sfCountryConfig||W(e,a),r=""!==String(i||"").trim(),m=l.showMaskPlaceholder&&r;if(!r&&s){const t=e?.dataset?.dialCode||l.fixedDialCode||"";a.placeholder=z(s,l.maskPlaceholderChar||"_",t)}const d=await o.create(a,{mask:s,lazy:!m,placeholderChar:l.maskPlaceholderChar||"_"});if(!d||n!==e.__sfCountryMaskToken)return void window.SF?.Mask?.destroy?.(d);if(e.__sfCountryMask=d,i){const e=String(i).replace(/\D+/g,"");e&&ne(d,"unmaskedValue")?d.unmaskedValue=e:ne(d,"value")&&(d.value=String(i)),"function"==typeof d.updateValue&&d.updateValue(),a.value=d.value||a.value}S(e,a)}catch(e){console.warn("SF.CountryCode mask init failed",e)}}function ie(e,a){return X(a,e.defaultIso2)||X(a,"",e.fixedDialCode)||a.__sfCountryOptions?.[0]||g[0]||null}function le(e){const{input:a,toggle:s}=N(e);if(!a)return;const t=e.classList.contains("disabled"),n=A(a.disabled,!1),o=t||n;e.classList.toggle("disabled",o),s&&(s.setAttribute("aria-disabled",o?"true":"false"),s.tabIndex=o?-1:0),o&&V(e,!1),M(e)}function re(e,a){if(!a?.showCode)return"";const s=String(e?.dataset?.dialCode||"").trim();return s?`${s} `:""}function me(e,a,s){if(!a)return;const t=re(e,s);if(!t)return;const n=String(a.value||"");if(n.startsWith(t))return;const o=K(n,e?.dataset?.dialCode||"");a.value=`${t}${o}`.trimEnd()}function de(e,a){if(!e||!a)return;const s=e.selectionStart??0,t=e.selectionEnd??0;if(s>=a.length&&t>=a.length)return;const n=a.length;e.setSelectionRange(n,n)}function fe(e,a,s="runtime"){if(!e||!a)return;const{input:t,leftFlag:n}=N(e);if(!t)return;const o=e.__sfCountryConfig||W(e,t),i=e.dataset.dialCode||"";e.dataset.iso2=a.iso2,e.dataset.dialCode=a.dialCode,e.dataset.maskPattern=a.maskPattern||"";const l=w.get(e);if(l&&(l.selected=e.dataset.maskPattern),e.__sfCountrySelected=a,o.showCode&&n){const e=F(a,o,!1),s=e.querySelector("img");n.textContent="",s?n.append(s):n.textContent=e.textContent||""}if("item"===s||"state"===s){const s=K(t.value,i);oe(e,t,"",o);const n=a.dialCode?`${a.dialCode} `:"";t.value=`${n}${s}`.trim(),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))}if(o.useMask){oe(e,t,q(o.useCountryMasks?a.maskPattern:o.fixedMaskPattern||a.maskPattern,o.maskStyle),o)}else oe(e,t,"",o);M(e),S(e,t)}function ue(e,{resetCountry:a=!1,countries:s,maskPattern:t}={}){if((0,f.vl)(e,"sf-country-code"),e?.__sfCountryCodeBind&&e.__sfCountryCodeBind!==ue)return e.__sfCountryCodeBind(e,{resetCountry:a,countries:s,maskPattern:t});if(!e||"function"==typeof e.__sfCountryCodeInput)return;const{input:n,toggle:o,leftFlag:i}=N(e);if(!n)return;e.__sfCountryCodeBind=ue,e.__sfCountryCodeSetState=ke;const l=W(e,n),m=w.get(e),d=void 0!==t?String(t).trim():m&&l.fixedMaskPattern===m.selected?m.fixed:l.fixedMaskPattern;l.fixedMaskPattern=d,w.set(e,{fixed:d,selected:e.dataset.maskPattern}),e.__sfCountryConfig=l,ee(e,l),se(e,8);const u=N(e),c=u.items;if(te(e),e.__sfCountryOptions=void 0===s?c.map(e=>Y(e,l.locale)):J(s,l.locale,l.maxItems),!l.showCode&&o?o.classList.add("hidden"):o&&o.classList.remove("hidden"),l.multiCountry)e.classList.remove("sf-country-code--fixed-dial-code"),u.list?.classList?.remove("hidden");else{e.classList.add("sf-country-code--fixed-dial-code"),e.classList.remove("open"),u.list?.classList?.add("hidden");const a=o?.querySelector?.(".sf-icon");a&&a.remove()}const h=ie(l,e);!a&&b.has(n)||b.set(n,h),h?fe(e,h,"init"):i&&(i.textContent="");const k=a=>{if(a.preventDefault(),!l.multiCountry||n.disabled||e.classList.contains("disabled"))return;const s=!e.classList.contains("open");U(e),V(e,s),s&&ae(e)},y=a=>{a.altKey||a.ctrlKey||a.metaKey||n.disabled||e.classList.contains("disabled")||!l.multiCountry||("Enter"!==a.key&&" "!==a.key||(a.preventDefault(),k(a),e.classList.contains("open")&&P()),"ArrowDown"!==a.key&&"ArrowUp"!==a.key||(a.preventDefault(),e.classList.contains("open")||k(a),P("ArrowUp"===a.key?-1:void 0)),"Escape"===a.key&&V(e,!1))},p=a=>{e.contains(a.target)||V(e,!1)},g=a=>{if(a.preventDefault(),n.disabled||e.classList.contains("disabled")||!l.multiCountry)return;const s=a.currentTarget;if("true"===s.getAttribute("aria-disabled")||s.classList.contains("disabled"))return;const t=Y(s,l.locale);t&&(fe(e,t,"item"),V(e,!1),("keydown"===a.type?o:n)?.focus({preventScroll:!0}))},E=()=>c.filter(e=>"true"!==e.getAttribute("aria-disabled")&&!e.classList.contains("disabled")&&!e.hidden),P=e=>{const a=E(),s=a.findIndex(e=>"true"===e.getAttribute("aria-selected")),t=void 0===e?Math.max(0,s):e<0?a.length-1:Math.min(e,a.length-1);c.forEach(e=>{e.tabIndex=-1});const n=a[t];if(!n)return;n.tabIndex=0,n.focus({preventScroll:!0});const o=u.itemsWrap;if(o){const e=o.getBoundingClientRect(),a=n.getBoundingClientRect();a.top<e.top?o.scrollTo({top:o.scrollTop-(e.top-a.top),behavior:"instant"}):a.bottom>e.bottom&&o.scrollTo({top:o.scrollTop+(a.bottom-e.bottom),behavior:"instant"})}};let C="",R=0;const j=a=>{if(a.altKey||a.ctrlKey||a.metaKey||n.disabled||e.classList.contains("disabled"))return;const s=E(),t=s.indexOf(a.currentTarget);if("Escape"===a.key)return a.preventDefault(),V(e,!1),void o?.focus({preventScroll:!0});if("Enter"!==a.key&&" "!==a.key){if(["ArrowDown","ArrowUp","Home","End"].includes(a.key)){a.preventDefault();const e="Home"===a.key?0:"End"===a.key?s.length-1:Math.max(0,t+("ArrowDown"===a.key?1:-1));return void P(e)}if(1===a.key.length){const e=performance.now();C=e-R>700?a.key:C+a.key,R=e;const n=[...C].every(e=>e===C[0])?C[0]:C,o=[...s.slice(t+1),...s.slice(0,t+1)].find(e=>(e.querySelector("span")?.textContent||e.textContent).trim().toLocaleLowerCase().startsWith(n.toLocaleLowerCase()));o&&(a.preventDefault(),P(s.indexOf(o)))}}else g(a)},_=a=>{e.contains(a.relatedTarget)||V(e,!1)},v=()=>{me(e,n,l),de(n,re(e,l)),S(e,n)},M=()=>{requestAnimationFrame(()=>{me(e,n,l),de(n,re(e,l))})},A=a=>{const s=re(e,l);if(!s)return;if(!["Backspace","Delete"].includes(a.key))return;const t=n.selectionStart??0,o=n.selectionEnd??t;return"Backspace"===a.key&&t<=s.length||"Delete"===a.key&&t<s.length?(a.preventDefault(),void de(n,s)):void((t<s.length||o<s.length)&&(a.preventDefault(),de(n,s)))};o&&(o.addEventListener("click",k),o.addEventListener("keydown",y),o.setAttribute("role","button")),n.addEventListener("input",v),n.addEventListener("paste",M),n.addEventListener("keydown",A),c.forEach(e=>{e.addEventListener("click",g),e.addEventListener("keydown",j)}),e.addEventListener("focusout",_),document.addEventListener("click",p),e.__sfCountryCodeToggleClick=k,e.__sfCountryCodeToggleKeydown=y,e.__sfCountryCodeDocClick=p,e.__sfCountryCodeItemClick=g,e.__sfCountryCodeItemKeydown=j,e.__sfCountryCodeFocusOut=_,e.__sfCountryCodeInput=v,e.__sfCountryCodePaste=M,e.__sfCountryCodeInputKeydown=A,e.__sfCountryReleaseReset=(0,r.z)(n,()=>{const a=b.get(n);a&&fe(e,a,"reset"),V(e,!1),S(e,n)}),e.__sfCountryRequiredObserver=new MutationObserver(()=>{S(e,n),x(e,n)}),e.__sfCountryRequiredObserver.observe(e,{attributes:!0,attributeFilter:["required","aria-label","aria-labelledby","aria-describedby","id"],childList:!0,characterData:!0,subtree:!0}),e.dataset[H]="1",le(e),e.__sfCountryViewport?.(e.classList.contains("open"))}function ce(e){if(!e||"function"!=typeof e.__sfCountryCodeInput)return;const{input:a,toggle:s,items:t}=N(e);e.__sfCountryReleaseReset?.(),delete e.__sfCountryReleaseReset,e.__sfCountryRequiredObserver?.disconnect(),delete e.__sfCountryRequiredObserver,e.__sfCountryViewport?.(!1),delete e.__sfCountryViewport,e.querySelectorAll("img[data-flag-src]").forEach(e=>E?.unobserve(e)),s&&e.__sfCountryCodeToggleClick&&s.removeEventListener("click",e.__sfCountryCodeToggleClick),s&&e.__sfCountryCodeToggleKeydown&&s.removeEventListener("keydown",e.__sfCountryCodeToggleKeydown),e.__sfCountryCodeDocClick&&document.removeEventListener("click",e.__sfCountryCodeDocClick),t.forEach(a=>{e.__sfCountryCodeItemKeydown&&a.removeEventListener("keydown",e.__sfCountryCodeItemKeydown),e.__sfCountryCodeItemClick&&a.removeEventListener("click",e.__sfCountryCodeItemClick)}),e.__sfCountryCodeFocusOut&&e.removeEventListener("focusout",e.__sfCountryCodeFocusOut),a&&e.__sfCountryCodeInput&&a.removeEventListener("input",e.__sfCountryCodeInput),a&&e.__sfCountryCodePaste&&a.removeEventListener("paste",e.__sfCountryCodePaste),a&&e.__sfCountryCodeInputKeydown&&a.removeEventListener("keydown",e.__sfCountryCodeInputKeydown),e.__sfCountryMask&&window.SF?.Mask?.destroy?.(e.__sfCountryMask),delete e.__sfCountryCodeToggleClick,delete e.__sfCountryCodeToggleKeydown,delete e.__sfCountryCodeDocClick,delete e.__sfCountryCodeItemClick,delete e.__sfCountryCodeItemKeydown,delete e.__sfCountryCodeFocusOut,delete e.__sfCountryCodeInput,delete e.__sfCountryCodePaste,delete e.__sfCountryCodeInputKeydown,delete e.__sfCountryMask,delete e.__sfCountryMaskToken,delete e.__sfCountrySelected,delete e.__sfCountryConfig,delete e.__sfCountryOptions,delete e.dataset[H]}function he(e=document){e.querySelectorAll(p).forEach(e=>{e.closest("sf-country-code")||ue(e)})}function ke(e,a={}){const s=e instanceof HTMLElement?e.closest(p)||e:null;if(!s)return!1;if(s.__sfCountryCodeSetState&&s.__sfCountryCodeSetState!==ke)return s.__sfCountryCodeSetState(s,a);const{input:t}=N(s);if(!t)return!1;if(Object.prototype.hasOwnProperty.call(a,"disabled")){const e=A(a.disabled,!1);t.disabled=e,s.classList.toggle("disabled",e),le(s)}if(Object.prototype.hasOwnProperty.call(a,"active")&&V(s,A(a.active,!1)),Object.prototype.hasOwnProperty.call(a,"open")&&V(s,A(a.open,!1)),Object.prototype.hasOwnProperty.call(a,"value")&&(t.value=String(a.value??""),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))),Object.prototype.hasOwnProperty.call(a,"iso2")){const e=X(s,a.iso2);e&&fe(s,e,"state")}if(Object.prototype.hasOwnProperty.call(a,"dialCode")){const e=X(s,"",a.dialCode);e&&fe(s,e,"state")}return!0}class ye extends n.y{static componentName="CountryCode";html=null;constructor(e){super(e);const{size:a="1",label:s="",required:t=!1,name:n="",form:o="",hint:i="",value:l="",placeholder:r="+7(___)___-__-__",disabled:m=!1,active:d=!1,open:u=d,countries:c=[],locale:h="ru",useMask:k=!1,useCountryMasks:y=!0,showCode:p=!0,maskStyle:H="native",multiCountry:g=!0,iso2:E="",dialCode:P="",maskPattern:C="",flagBase:b="",lazyFlags:R=!0,showMaskPlaceholder:j=!1,maskPlaceholderChar:w="_",maxItems:x=0}=this.params||{},S=this.attrs.class||this.attrs.className;this.template=document.createElement("label"),this.id&&(this.template.id=this.id),this.template.classList.add("sf-country-code",`sf-country-code--size-${(0,f.id)(a,"sf-country-code")}`),A(m)&&this.template.classList.add("disabled"),A(u)&&this.template.classList.add("open"),S&&this.template.classList.add(...`${S}`.split(" ").filter(Boolean)),this.template.dataset.locale=String(h),this.template.dataset.useMask=String(A(k,!1)),this.template.dataset.useCountryMasks=String(A(y,!0)),this.template.dataset.showCode=String(A(p,!0)),this.template.dataset.maskStyle="brackets"===String(H).toLowerCase()?"brackets":"native",this.template.dataset.multiCountry=String(A(g,!0)),this.template.dataset.lazyFlags=String(A(R,!0)),this.template.dataset.showMaskPlaceholder=String(A(j,!1)),this.template.dataset.maskPlaceholderChar=String(w||"_"),E&&(this.template.dataset.iso2=L(E)),P&&(this.template.dataset.dialCode=String(P)),C&&(this.template.dataset.maskPattern=String(C)),b&&(this.template.dataset.flagBase=String(b).replace(/\/$/,"")),Number(x)>0&&(this.template.dataset.maxItems=String(Number(x)));const _=document.createElement("span");_.classList.add("sf-country-code-label");const v=document.createElement("span");if(v.classList.add("sf-country-code-text"),v.textContent=String(s),_.append(v),A(t,!1)){const e=document.createElement("span");e.classList.add("sf-country-code-required"),e.textContent="*",_.append(e)}const M=document.createElement("span");M.classList.add("sf-country-code-field");const I=document.createElement("span");I.classList.add("sf-country-code-left");const B=document.createElement("div");B.classList.add("sf-country-code-flag-icon"),B.setAttribute("aria-hidden","true");const $=document.createElement("i");$.classList.add("sf-icon"),$.textContent=A(u)?"expand_less":"expand_more",I.append(B,$);const N=document.createElement("input");N.type="tel",N.name=String(n),o&&N.setAttribute("form",String(o)),N.required=A(t,!1),N.defaultValue=String(l??""),N.placeholder=String(r??""),N.disabled=A(m,!1),M.append(I,N),this.template.append(_,M);const O=J(c,h,x);if(O.length){const e=document.createElement("span");e.classList.add("sf-country-code-list");const a=document.createElement("span");a.classList.add("sf-country-code-items","flex","flex-col"),O.forEach(e=>{const s=document.createElement("span");s.classList.add("sf-country-code-item"),e?.iso2&&(s.dataset.iso2=L(e.iso2)),(e?.dialCode||e?.code)&&(s.dataset.code=String(e.dialCode||e.code)),void 0!==e?.maskPattern&&(s.dataset.maskPattern=String(e.maskPattern||""));const t=F({iso2:e?.iso2,flagEmoji:e?.flagEmoji||""},{flagBase:this.template.dataset.flagBase||T(),lazyFlags:A(this.template.dataset.lazyFlags,!0)},!0),n=document.createElement("span");if(e?.label)n.textContent=String(e.label);else{const a=e?.nameRu||e?.nameEn||e?.dialCode||"",s=e?.dialCode||e?.code||"";n.textContent=s?`${a} (${s})`:a}s.append(t,n),this.applyLayoutUtilities(s,".sf-country-code .sf-country-code-item"),this.applyLayoutUtilities(t,".sf-country-code .sf-country-code-flag"),a.append(s)}),e.append(a),this.template.append(e)}if(i){const e=document.createElement("span");e.classList.add("sf-country-code-hint"),e.textContent=String(i),this.template.append(e)}this.applyLayoutUtilities(this.template,".sf-country-code"),this.applyLayoutUtilities(_,".sf-country-code .sf-country-code-label"),this.applyLayoutUtilities(M,".sf-country-code .sf-country-code-field"),this.applyLayoutUtilities(I,".sf-country-code .sf-country-code-left"),this.applyLayoutUtilities(N,".sf-country-code .sf-country-code-field input"),this.applyLayoutUtilities(B,".sf-country-code .sf-country-code-flag-icon")}init(){ue(this.template,{maskPattern:this.params?.maskPattern||""})}destroyInternal(){ce(this.template)}}ye.utilityMap=i,(0,o.A)("CountryCode",ye),"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.CountryCode=window.SF.CountryCode||{},window.SF.CountryCode.setState=ke),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>he()):he();new MutationObserver(e=>{e.forEach(e=>{e.removedNodes.forEach(e=>{if(!(e instanceof Element))return;const a=[...e.querySelectorAll(p)];e.matches(p)&&a.unshift(e);for(const e of a)e.isConnected||e.closest("sf-country-code")||ce(e)}),e.addedNodes.forEach(e=>{e instanceof Element&&(e.matches?.(p)&&!e.closest("sf-country-code")&&ue(e),he(e))})})}).observe(document.documentElement,{childList:!0,subtree:!0}),t()}catch(pe){t(pe)}})},"98e26702f55a"(e,a,s){function t(){const e=globalThis.SF=globalThis.SF||{};return e.__deprecationNotes instanceof Map||Object.defineProperty(e,"__deprecationNotes",{value:new Map,configurable:!0}),e.__deprecationNotes}function n({component:e="",kind:a="attribute",attribute:s="",from:n,to:o=null}={}){if(!n)return;const i=[e,a,s,n].join("|"),l=t(),r=l.get(i);if(r)r.count+=1;else if(l.set(i,{component:e,kind:a,attribute:s,from:n,to:o,count:1}),function(){const e=globalThis.document?.documentElement;return"warn"===e?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const t=e?`${e}: `:"",i="value"===a?`${s}="${n}"`:`${a} ${n}`;globalThis.console?.warn?.(`[SIMAI Framework] ${t}${i} is a legacy name${o?`; write ${o}`:""}. See contracts/changes/journal.json.`)}}if(s.d(a,{id:()=>r,vl:()=>m}),"undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const e=globalThis.SF.deprecations||{};e.list=function(){return[...t().values()].map(e=>({...e}))},e.clear=function(){t().clear()},e.note=n,globalThis.SF.deprecations=e}const o=Object.freeze(["1/2","1","2"]),i=Object.freeze({"1/3":"1/2",3:"2"}),l=new Set;function r(e,a="field",s="1"){const t=String(e??"").trim().toLowerCase();if(o.includes(t))return t;if(Object.hasOwn(i,t)){const e=i[t];n({component:a,kind:"value",attribute:"size",from:t,to:e});const s=`${a}:${t}`;return l.has(s)||"undefined"==typeof console||(l.add(s),console.warn(`[SIMAI Framework] ${a}: size ${t} is retired for form fields; rendering size ${e}.`)),e}return s}function m(e,a){if(e?.classList)for(const[s,t]of Object.entries(i)){const t=`${a}--size-${s}`;e.classList.contains(t)&&e.classList.replace(t,`${a}--size-${r(s,a)}`)}}},"67eed2647f47"(e,a,s){s.d(a,{z:()=>o});const t=new WeakMap,n=new WeakSet;function o(e,a){const s=e.ownerDocument;n.has(s)||(s.addEventListener("reset",e=>{const a=e.target;if("FORM"!==a?.tagName)return;const s=Array.from(a.elements);setTimeout(()=>{if(!e.defaultPrevented)for(const e of s)if(e.isConnected&&e.form===a)for(const a of t.get(e)||[])a()},0)},!0),n.add(s));let o=t.get(e);return o||t.set(e,o=new Set),o.add(a),()=>o.delete(a)}},"0ab12d47912a"(e,a,s){s.d(a,{y:()=>n});let t=null;function n(){const e=()=>window.SF?.Mask?.create?window.SF.Mask:null,a=e();return a?Promise.resolve(a):t||(t=new Promise(a=>{const s=[[window,"sf-mask-ready"],[window,"sf-loader-ready"],[window,"load"],[document,"DOMContentLoaded"]],n=()=>{const o=e();o&&(s.forEach(([e,a])=>e.removeEventListener(a,n)),t=null,a(o))};s.forEach(([e,a])=>e.addEventListener(a,n))}),t)}},"58661bec99a6"(e,a,s){const t=function(e,a){if(e&&a)if("undefined"==typeof window||"function"!=typeof window.registerSfComponent){if("undefined"!=typeof window&&window.SF?.Loader?.registerComponent)window.SF.Loader.registerComponent(e,a);else if("undefined"!=typeof window){(window.SF_PENDING_COMPONENTS=window.SF_PENDING_COMPONENTS||[]).push([e,a])}}else window.registerSfComponent(e,a)};s.d(a,["A",0,t])},d7f974466839(e,a,s){s.d(a,{y:()=>t});class t{lifecycleName(){return this.componentName??this.constructor.componentName}constructor(e){this.props=e,this.id=e?.id,this.params=e?.param,this.attrs=e?.attrs||{},this.template=null,window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:beforeRender`,{detail:this}))}getUtilityMap(){return this.constructor.utilityMap||null}extractUtilityClasses(e){if(!Array.isArray(e))return[];const a=new Set;return e.forEach(e=>{if("string"!=typeof e)return;const s=e.match(/\(([^)]+)\)/g);s&&s.forEach(e=>{e.slice(1,-1).split(/\s+/).filter(Boolean).forEach(e=>{e.startsWith(".")&&e.length>1&&a.add(e.slice(1))})})}),Array.from(a)}applyLayoutUtilities(e,a){if(!e||!a)return;const s=this.getUtilityMap();if(!s||!s[a])return;this.extractUtilityClasses(s[a]).forEach(a=>e.classList.add(a))}render(){return this.html=this.template,"function"==typeof this.init&&this.init(),this.html&&window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:render`,{detail:this})),this.html}destroy(){this.destroyInternal?.(),this.props=null,this.id=null,this.params=null,this.template=null,this.html&&(this.html.remove(),this.html=null),window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:destroy`,{detail:this}))}destroyInternal(){}}},"2a25b3f4fc15"(e,a,s){s.a(e,async(e,a)=>{try{var t=s("c614c5e30b0d"),n=s("0d662e4d7d63"),o=s("c0450586011d"),i=s("fbe0570fcc69"),l=s("98e26702f55a"),r=s("788779012d8a"),m=e([n,o,i,r]);[n,o,i,r]=m.then?(await m)():m;var d=s.n(i);const f=".sf-country-code",u=Array.isArray(t?.items)?t.items:[];class c extends(d()){static get props(){return{size:{default:"1"},label:{default:""},required:{type:Boolean,default:!1},name:{default:""},form:{default:""},hint:{default:""},value:{default:""},placeholder:{default:"+7(___)___-__-__"},disabled:{type:Boolean,default:!1},open:{type:Boolean,default:!1},locale:{default:""},useMask:{type:Boolean,default:!1},useCountryMasks:{type:Boolean,default:!0},showCode:{type:Boolean,default:!0},maskStyle:{default:"native"},multiCountry:{type:Boolean,default:!0},iso2:{default:""},dialCode:{default:""},maskPattern:{default:""},flagBase:{default:""},lazyFlags:{type:Boolean,default:!0},showMaskPlaceholder:{type:Boolean,default:!1},maskPlaceholderChar:{default:"_"},maxItems:{type:Number,default:0}}}constructor(){super(),this._countries=null,this._boundRoot=null,this._renderAttributes=new Set}get size(){return(0,l.id)(this.getAttribute("size")||"1","sf-country-code")}get label(){return this.getAttribute("label")||""}get required(){return this.getBooleanAttr("required",!1)}get hint(){return this.getAttribute("hint")||""}get value(){return this.getAttribute("value")||""}get placeholder(){return this.getAttribute("placeholder")||"+7(___)___-__-__"}get disabled(){return this.getBooleanAttr("disabled",!1)}get open(){return this.getBooleanAttr("open",!1)||this.getBooleanAttr("active",!1)}get locale(){return"ru"===String(this.getAttribute("locale")||(0,n.pageLanguage)(this)).toLowerCase()?"ru":"en"}get useMask(){return this.getBooleanAttr("use-mask",!1)}get useCountryMasks(){return this.getBooleanAttr("use-country-masks",!0)}get showCode(){return this.getBooleanAttr("show-code",!0)}get maskStyle(){return"brackets"===String(this.getAttribute("mask-style")||"native").toLowerCase()?"brackets":"native"}get multiCountry(){return this.getBooleanAttr("multi-country",!0)}get iso2(){return(0,o.Xx)(this.getAttribute("iso2"))}get dialCode(){return String(this.getAttribute("dial-code")||"").trim()}get maskPattern(){return String(this.getAttribute("mask-pattern")||"").trim()}get flagBase(){return String(this.getAttribute("flag-base")||"").trim()||(0,o.Dk)()}get lazyFlags(){return this.getBooleanAttr("lazy-flags",!0)}get showMaskPlaceholder(){return this.getBooleanAttr("show-mask-placeholder",!1)}get maskPlaceholderChar(){return String(this.getAttribute("mask-placeholder-char")||"_")}get maxItems(){return Math.trunc(this.getNumberAttr("max-items",0))}get countries(){return(0,o.Ue)(this._countries,this.locale,this.maxItems)}set countries(e){this._countries=Array.isArray(e)?e:null,this.requestComponentUpdate("countries")}templateContext(){const e=this.getPropsContext(),a=this._boundRoot,s=a&&!this._renderAttributes.has("open")&&!this._renderAttributes.has("active"),t=a&&!this._renderAttributes.has("disabled");return this.createTemplateContext({...e,open:s?a.classList.contains("open"):this.open,disabled:t?!!a.querySelector("input")?.disabled||a.classList.contains("disabled"):this.disabled,countries:this.countries.length?this.countries:(0,o.Ue)(u,this.locale,this.maxItems),locale:this.locale,maskStyle:this.maskStyle,iso2:this.iso2,flagBase:this.flagBase,maxItems:this.maxItems})}onDisconnected(){this._boundRoot&&((0,o._i)(this._boundRoot),this._boundRoot=null)}beforeRender(e=[]){this._renderAttributes=new Set(e)}afterRender(e){if("function"==typeof e)return super.afterRender(e);this._boundRoot&&((0,o._i)(this._boundRoot),this._boundRoot=null),this._boundRoot=this.querySelector(f),this._boundRoot&&(0,o.nD)(this._boundRoot,{resetCountry:this._renderAttributes.has("iso2")||this._renderAttributes.has("dial-code"),countries:this.countries,maskPattern:this.maskPattern})}template(){return(0,r.o)(this.templateContext())}get state(){const e=this.querySelector(f),a=e?.querySelector?.(".sf-country-code-field input")||null;return{value:a?.value||"",iso2:e?.dataset?.iso2||"",dialCode:e?.dataset?.dialCode||"",open:e?.classList?.contains("open")||!1,disabled:e?.classList?.contains("disabled")||!1}}setState(e={}){const a=this.querySelector(f);return(0,o.nK)(a,e)}}c.define("sf-country-code"),a()}catch(e){a(e)}})},"788779012d8a"(e,a,s){s.a(e,async(e,t)=>{try{s.d(a,{o:()=>r});var n=s("ddf1cdb42ecc"),o=e([n]),i=o.then?(await o)():o;n=i[0];function l(e,a=""){const s=String(e?.iso2||"").trim().toLowerCase(),t=e?.flagEmoji||"",o=s&&a?`${a}/${s}.svg`:"";return o?n.html`
2
2
  <img
3
3
  alt=${e?.iso2?`${e.iso2} flag`:"flag"}
4
4
  decoding="async"
@@ -1,4 +1,4 @@
1
- (()=>{"use strict";var t={"98e26702f55a"(t,e,a){function s(){const t=globalThis.SF=globalThis.SF||{};return t.__deprecationNotes instanceof Map||Object.defineProperty(t,"__deprecationNotes",{value:new Map,configurable:!0}),t.__deprecationNotes}function n({component:t="",kind:e="attribute",attribute:a="",from:n,to:r=null}={}){if(!n)return;const i=[t,e,a,n].join("|"),o=s(),l=o.get(i);if(l)l.count+=1;else if(o.set(i,{component:t,kind:e,attribute:a,from:n,to:r,count:1}),function(){const t=globalThis.document?.documentElement;return"warn"===t?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const s=t?`${t}: `:"",i="value"===e?`${a}="${n}"`:`${e} ${n}`;globalThis.console?.warn?.(`[Simai Framework] ${s}${i} is a legacy name${r?`; write ${r}`:""}. See contracts/changes/journal.json.`)}}if(a.d(e,{id:()=>l}),"undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const t=globalThis.SF.deprecations||{};t.list=function(){return[...s().values()].map(t=>({...t}))},t.clear=function(){s().clear()},t.note=n,globalThis.SF.deprecations=t}const r=Object.freeze(["1/2","1","2"]),i=Object.freeze({"1/3":"1/2",3:"2"}),o=new Set;function l(t,e="field",a="1"){const s=String(t??"").trim().toLowerCase();if(r.includes(s))return s;if(Object.hasOwn(i,s)){const t=i[s];n({component:e,kind:"value",attribute:"size",from:s,to:t});const a=`${e}:${s}`;return o.has(a)||"undefined"==typeof console||(o.add(a),console.warn(`[Simai Framework] ${e}: size ${s} is retired for form fields; rendering size ${t}.`)),t}return a}},b9b65955223a(t,e,a){a.a(t,async(t,e)=>{try{var s=a("fbe0570fcc69"),n=a("98e26702f55a"),r=a("77b2f4107e3b"),i=a("5c1dc214bb5e"),o=a("0d662e4d7d63"),l=t([s,r,i,o]);[s,r,i,o]=l.then?(await l)():l;var u=a.n(s),h=a.n(i);const c=/^(\d{4})-(\d{2})-(\d{2})$/,d=18;let p=0;function g(t){return String(t).padStart(2,"0")}function m(t){return`${t.getFullYear()}-${g(t.getMonth()+1)}-${g(t.getDate())}`}function f(t,e="YYYY.MM.DD"){if(!t)return"";const a={YYYY:String(t.getFullYear()),YY:String(t.getFullYear()).slice(-2),MM:g(t.getMonth()+1),DD:g(t.getDate())};return String(e||"YYYY.MM.DD").replace(/YYYY|YY|MM|DD/g,t=>a[t]||t)}function b(t){return t instanceof Date&&!Number.isNaN(t.getTime())}function y(t){if(!t)return null;const e=String(t).match(c);if(!e)return null;const[,a,s,n]=e,r=new Date(Number(a),Number(s)-1,Number(n));return r.getFullYear()!==Number(a)||r.getMonth()!==Number(s)-1||r.getDate()!==Number(n)?null:r}function D(t,e="DD.MM.YYYY"){if(!t)return null;if(t instanceof Date)return b(t)?new Date(t.getFullYear(),t.getMonth(),t.getDate()):null;const a=String(t).trim(),s=y(a);if(s)return s;const n=a.match(/\d+/g),r=String(e||"DD.MM.YYYY").match(/YYYY|YY|MM|DD/g);if(!n||!r||n.length<3||r.length<3)return null;const i={};r.slice(0,3).forEach((t,e)=>{i[t]=Number(n[e])});let o=i.YYYY;!o&&i.YY&&(o=i.YY+2e3);const l=i.MM,u=i.DD;if(!o||!l||!u)return null;const h=new Date(o,l-1,u);return h.getFullYear()!==o||h.getMonth()!==l-1||h.getDate()!==u?null:h}function v(t,e=0){const a=(0,s.toNumber)(t,e);return Number.isFinite(a)?Math.max(0,Math.min(11,a)):e}function k(t,e){return t&&e&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}function w(t,e){if(!t||!e)return 0;return new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function S(t,e){const a=new Date(t.getFullYear(),t.getMonth()+e,1),s=new Date(a.getFullYear(),a.getMonth()+1,0).getDate();return a.setDate(Math.min(t.getDate(),s)),a}function M(t,e,a){return!!(t&&e&&a)&&(w(t,e)>0&&w(t,a)<0)}function $(t="",e=null){const a=String(t||"").trim();return a||(0,o.pageLocale)(e??globalThis.document?.documentElement??null)}function x(t=""){const e=String(t||"");return e?`${e.charAt(0).toLocaleUpperCase()}${e.slice(1)}`:""}function P(t,e){try{return x(new Intl.DateTimeFormat(e,{month:"long"}).format(new Date(2026,t,1)))}catch{return String(t+1)}}function Y(t,e){try{return new Intl.DateTimeFormat(e,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(t)}catch{return m(t)}}function A(t,e=1){const a=new Date(2026,0,4);return Array.from({length:7},(s,n)=>{const r=new Date(a);r.setDate(a.getDate()+(e+n)%7);try{return new Intl.DateTimeFormat(t,{weekday:"short"}).format(r)}catch{return String((e+n)%7)}})}const V=["today","yesterday","last-7-days","last-30-days","this-week","this-month","last-month"];function _(t,e){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+e)}function F(t,e,a=1){const s=new Date(e.getFullYear(),e.getMonth(),e.getDate());switch(t){case"today":return[s,s];case"yesterday":return[_(s,-1),_(s,-1)];case"last-7-days":return[_(s,-6),s];case"last-30-days":return[_(s,-29),s];case"this-week":return[_(s,-(s.getDay()-a+7)%7),s];case"this-month":return[new Date(s.getFullYear(),s.getMonth(),1),s];case"last-month":return[new Date(s.getFullYear(),s.getMonth()-1,1),new Date(s.getFullYear(),s.getMonth(),0)];default:return null}}const T={en:{previousMonth:"Previous month",nextMonth:"Next month",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",presets:"Quick ranges",customRange:"Custom range",preset_today:"Today",preset_yesterday:"Yesterday",preset_last7Days:"Last 7 days",preset_last30Days:"Last 30 days",preset_thisWeek:"This week",preset_thisMonth:"This month",preset_lastMonth:"Last month"},ru:{previousMonth:"Предыдущий месяц",nextMonth:"Следующий месяц",previousYears:"Предыдущие годы",nextYears:"Следующие годы",chooseMonth:"Выберите месяц",chooseYear:"Выберите год",presets:"Быстрый выбор",customRange:"Свой период",preset_today:"Сегодня",preset_yesterday:"Вчера",preset_last7Days:"Последние 7 дней",preset_last30Days:"Последние 30 дней",preset_thisWeek:"Эта неделя",preset_thisMonth:"Этот месяц",preset_lastMonth:"Прошлый месяц"}};class C extends(u()){constructor(){super(),this._input=null,this._documentClickHandler=this.handleDocumentClick.bind(this),this._documentKeydownHandler=this.handleDocumentKeydown.bind(this),this._viewportHandler=this.positionPanel.bind(this),this._focusCalendarOnOpen=!1,this._focusDateAfterRender=!1,this._panelId="sf-datepicker-panel-"+ ++p,this.state={openAbove:!1,yearPageStart:null,activeDate:""},this.refs={input:this.createRef(),datePickerRoot:this.createRef(),datePickerPanel:this.createRef()}}static get props(){return{templateName:{attribute:"template",default:"default"},value:{default:""},date:{default:""},startValue:{attribute:"start-value",default:""},endValue:{attribute:"end-value",default:""},maxDate:{default:""},minDate:{default:""},range:{type:Boolean,default:!1},month:{type:Number,default:null},year:{type:Number,default:null},context:{default:""},weekStart:{type:Number,default:null},locale:{default:""},format:{default:"DD.MM.YYYY"},rootClass:{default:""},closeOnSelect:{type:Boolean,default:!0},input:{type:Boolean,default:!0},open:{type:Boolean,default:!1},portal:{type:Boolean,default:!0},inputType:{attribute:"input-type",default:"bordered"},size:{default:"1"},inputSize:{attribute:"input-size",default:"1"},inputName:{attribute:"input-name",default:""},name:{attribute:"name",default:""},placeholder:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},iconStart:{type:String,attribute:"icon-start",default:null},leftIcon:{attribute:"left-icon",default:"calendar_today"},inputRootClass:{attribute:"input-root-class",default:""},mask:{type:Boolean,default:!1},maskPattern:{attribute:"mask-pattern",default:""},maskLazy:{attribute:"mask-lazy",default:!1},maskPlaceholderChar:{attribute:"mask-placeholder-char",default:"_"},maskOptions:{attribute:"mask-options",default:""},presets:{default:""},preset:{default:""}}}connectedCallback(){this.upgradeProperty("value"),this.upgradeProperty("presets"),super.connectedCallback()}upgradeProperty(t){if(!Object.prototype.hasOwnProperty.call(this,t))return;const e=this[t];delete this[t],this[t]=e}get componentName(){return"datepicker"}get templateName(){return this.getAttribute("template")||"default"}get selectedDate(){return D(this.date,this.format)}get primaryDate(){const t=this.activePreset;return t?t.to:this.selectedDate||this.startDate}get presets(){return this._presetList??(this.getAttribute("presets")||"")}set presets(t){if(Array.isArray(t))return this._presetList=t,void this.requestComponentUpdate("presets");this._presetList=null,this.setState({presets:t?String(t):""})}get preset(){return this.getAttribute("preset")||""}set preset(t){this.setState({preset:t?String(t):""})}get presetItems(){if(!this.range)return[];const t=Array.isArray(this.presets)?this.presets:String(this.presets).split(/[\s,]+/).filter(Boolean),e=new Date,a=this.setMinDate(),s=this.setMaxDate();return t.map(t=>{const n="string"==typeof t?{id:t,relative:t}:{...t};if(!n?.id)return null;let r=null;if(n.relative)r=F(n.relative,e,this.weekStart);else if(Array.isArray(n.range)){const t=D(n.range[0],this.format),e=D(n.range[1],this.format);t&&e&&(r=w(t,e)<=0?[t,e]:[e,t])}if(!r)return null;let[i,l]=r;a&&w(i,a)<0&&(i=a),s&&w(l,s)>0&&(l=s);const u=w(i,l)>0,h=n.label||(V.includes(n.id)?(0,o.pageText)(T,(c=n.id,`preset_${String(c).replace(/-([a-z0-9])/g,(t,e)=>e.toUpperCase())}`),this,"sf-datepicker"):n.id);var c;return{id:String(n.id),label:h,relative:n.relative||null,from:i,to:l,disabled:u,pressed:this.preset===String(n.id)}}).filter(Boolean)}get activePreset(){const t=this.preset;if(!t||!this.range)return null;const e=this.presetItems.find(e=>e.id===t);return e&&!e.disabled?e:null}get startDate(){return D(this.startValue,this.format)}get endDate(){return D(this.endValue,this.format)}get date(){return this.getAttribute("date")||this.getAttribute("value")||""}get value(){return this.range?[this.startValue,this.endValue]:this.date}set value(t){if(Array.isArray(t)){const[e="",a=""]=t;return void this.setState({date:e||"",startValue:e||"",endValue:a||""})}if(t&&"object"==typeof t){const e=t.start||t.startValue||t.date||"",a=t.end||t.endValue||"";return void this.setState({date:t.date||e||"",startValue:e,endValue:a})}this.setState({date:t?String(t):"",startValue:"",endValue:""})}setMaxDate(){return D(this.maxDate,this.format)}setMinDate(){return D(this.minDate,this.format)}get maxDate(){return this.getAttribute("max-date")||""}get minDate(){return this.getAttribute("min-date")||""}set date(t){this.setState({date:t?String(t):""})}get startValue(){const t=this.activePreset;return t?m(t.from):this.getAttribute("start-value")||""}set startValue(t){this.setState({startValue:t?String(t):""})}get endValue(){const t=this.activePreset;return t?m(t.to):this.getAttribute("end-value")||""}set endValue(t){this.setState({endValue:t?String(t):""})}get range(){return this.getBooleanAttr("range",!1)}get input(){return this.getBooleanAttr("input",!0)}get open(){return this.getBooleanAttr("open",!1)}get portal(){return this.getBooleanAttr("portal",!0)}get inputType(){return this.getAttribute("input-type")||"bordered"}get size(){return(0,n.id)(this.getAttribute("size")||this.getAttribute("input-size")||"1","sf-datepicker")}get inputSize(){return this.size}get inputName(){return this.getAttribute("input-name")||this.getAttribute("name")||""}get placeholder(){return this.getAttribute("placeholder")||""}get label(){return this.getAttribute("label")||""}get disabled(){return this.getBooleanAttr("disabled",!1)}get required(){return this.getBooleanAttr("required",!1)}get closeOnSelect(){return this.getBooleanAttr("close-on-select",!0)}get leftIcon(){return this.hasAttribute("icon-start")?this.getAttribute("icon-start"):this.getAttribute("left-icon")||"calendar_today"}get iconStart(){return this.leftIcon}get inputRootClass(){return this.getAttribute("input-root-class")||""}get mask(){return this.getBooleanAttr("mask",!1)}get maskPattern(){return this.getAttribute("mask-pattern")||this.formatToMask(this.format)}get maskLazy(){return!!this.hasAttribute("mask-lazy")&&this.getBooleanAttr("mask-lazy",!1)}get maskPlaceholderChar(){return this.getAttribute("mask-placeholder-char")||"_"}get maskOptions(){return this.getAttribute("mask-options")||""}get year(){const t=this.primaryDate,e=t?t.getFullYear():(new Date).getFullYear();return this.hasAttribute("year")?this.getNumberAttr("year",e):e}set year(t){this.setState({year:null==t||""===t?"":String((0,s.toNumber)(t,(new Date).getFullYear()))})}get month(){const t=this.primaryDate,e=t?t.getMonth():(new Date).getMonth();return this.hasAttribute("month")?v(this.getAttribute("month"),e):e}set month(t){this.setState({month:null==t||""===t?"":String(v(t,(new Date).getMonth()))})}get contextMode(){return this.getEnumAttr("context",["month","year",""],"")}get weekStart(){if(this.hasAttribute("week-start")){const t=this.getNumberAttr("week-start",1);return Number.isInteger(t)&&t>=0&&t<=7?t%7:1}try{const t=new Intl.Locale(this.locale),e="function"==typeof t.getWeekInfo?t.getWeekInfo():t.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 1}get locale(){return $(this.getAttribute("locale"),this)}get format(){return this.getAttribute("format")||"DD.MM.YYYY"}get formattedValue(){return f(this.selectedDate,this.format)}get formattedStartValue(){return f(this.startDate,this.format)}get formattedEndValue(){return f(this.endDate,this.format)}get displayValue(){return this.range?this.formattedStartValue&&this.formattedEndValue?`${this.formattedStartValue} - ${this.formattedEndValue}`:this.formattedStartValue||this.formattedEndValue||"":this.formattedValue}get displayDate(){return new Date(this.year,this.month,1)}get isRtl(){return"rtl"===(this.closest("[dir]")?.getAttribute("dir")||document.documentElement?.dir)}get labels(){return t=this,Object.fromEntries(["previousMonth","nextMonth","previousYears","nextYears","chooseMonth","chooseYear","presets","customRange"].map(e=>[e,(0,o.pageText)(T,e,t,"sf-datepicker")]));var t}get weekdays(){return A(this.locale,this.weekStart)}get calendarLabel(){try{return new Intl.DateTimeFormat(this.locale,{month:"long",year:"numeric"}).format(this.displayDate)}catch{return`${this.month+1}.${this.year}`}}get activeDate(){const t=y(this.state.activeDate)||this.primaryDate||this.displayDate,e=this.setMinDate(),a=this.setMaxDate();return e&&w(t,e)<0?e:a&&w(t,a)>0?a:t}get normalizedRange(){const t=this.startDate,e=this.endDate;return t&&e?w(t,e)<=0?{startDate:t,endDate:e}:{startDate:e,endDate:t}:{startDate:t,endDate:e}}get days(){const t=(new Date(this.year,this.month,1).getDay()-this.weekStart+7)%7,e=new Date(this.year,this.month,1-t),{startDate:a,endDate:s}=this.normalizedRange,n=Boolean(this.startValue&&this.endValue),r=this.setMinDate(),i=this.setMaxDate(),o=this.activeDate,l=new Date;return Array.from({length:42}).map((t,u)=>{const h=new Date(e.getFullYear(),e.getMonth(),e.getDate()+u),c=h.getTime(),d=Boolean(r&&c<r.getTime()||i&&c>i.getTime());return{date:h,value:m(h),formattedValue:f(h,this.format),label:Y(h,this.locale),day:h.getDate(),today:k(h,l),currentMonth:h.getMonth()===this.month,weekend:[0,6].includes(h.getDay()),disabled:d,selected:this.range?k(h,a)||k(h,s):k(h,this.selectedDate),rangeStart:this.range&&n&&k(h,a),rangeEnd:this.range&&n&&k(h,s),rangeSelected:this.range&&n&&M(h,a,s),tabIndex:!d&&k(h,o)?0:-1}})}get months(){const t=this.setMinDate(),e=this.setMaxDate(),a=t?new Date(t.getFullYear(),t.getMonth(),1):null,s=e?new Date(e.getFullYear(),e.getMonth(),1):null;return Array.from({length:12}).map((t,e)=>{const n=new Date(this.year,e,1).getTime(),r=Boolean(a&&n<a.getTime()||s&&n>s.getTime());return{index:e,label:P(e,this.locale),selected:e===this.month,disabled:r}})}get years(){const t=this.setMinDate(),e=this.setMaxDate(),a=this.yearPageStart;return Array.from({length:d}).map((s,n)=>{const r=a+n;return{year:r,disabled:Boolean(t&&r<t.getFullYear()||e&&r>e.getFullYear()),selected:r===this.year}})}get yearPageStart(){return this.state.yearPageStart??this.getYearPageStart(this.year)}get yearPageEnd(){return this.yearPageStart+d-1}getYearPageStart(t=this.year){const e=(0,s.toNumber)(t,(new Date).getFullYear());return e-e%d}formatToMask=t=>{let e=String(t).replace(/[A-Za-z]/g,"0");return this.range&&(e+=` - ${e}`),e};setContext(t=""){return this.setState({context:t||""}),this}toggleContext(t){const e=this.contextMode===t?"":t,a={context:e};return"year"===e&&(a.yearPageStart=this.getYearPageStart(this.year)),this.setState(a),this}shiftYearPage(t=1){return this.set({yearPageStart:this.yearPageStart+d*t}),this}shiftMonth(t=1){const e=new Date(this.year,this.month+t,1),a=this.setMinDate(),s=this.setMaxDate();return a&&e<new Date(a.getFullYear(),a.getMonth(),1)||s&&e>new Date(s.getFullYear(),s.getMonth(),1)||(this.setState({year:e.getFullYear(),month:e.getMonth(),context:""}),this.set({activeDate:m(e)})),this}setActiveDate(t){const e=y(t);return e&&this.state.activeDate!==t?(this.set({activeDate:m(e)}),this):this}moveActiveDate(t){const e=new Date(this.activeDate);e.setDate(e.getDate()+t);const a=this.setMinDate(),s=this.setMaxDate();return a&&w(e,a)<0||s&&w(e,s)>0||(this._focusDateAfterRender=!0,this.setState({year:e.getFullYear(),month:e.getMonth(),context:""}),this.set({activeDate:m(e)})),this}openPanel({focusCalendar:t=!1}={}){return this.disabled?this:(this._focusCalendarOnOpen=t,this.state.activeDate||this.set({activeDate:m(this.activeDate)}),this.open?(this.positionPanel(),this):(this.setState({open:!0}),this))}closePanel({restoreFocus:t=!1}={}){return this.open?(this.setState({open:!1,context:""}),t&&requestAnimationFrame(()=>this._input?.focus?.()),this):this}togglePanel(){return this.open?this.closePanel():this.openPanel()}handleInputClick(t){t?.preventDefault?.(),t?.stopPropagation?.(),this.openPanel()}handleInputKeydown(t){["ArrowDown","Enter"," "].includes(t.key)&&(t.preventDefault(),this.openPanel({focusCalendar:!0}))}handleDayKeydown(t,e){const a=this.isRtl?-1:1,s={ArrowLeft:-a,ArrowRight:a,ArrowUp:-7,ArrowDown:7};if(Object.prototype.hasOwnProperty.call(s,t.key))return t.preventDefault(),void this.moveActiveDate(s[t.key]);if("Home"===t.key||"End"===t.key){t.preventDefault();const a=((e?.date||this.activeDate).getDay()-this.weekStart+7)%7;return void this.moveActiveDate("Home"===t.key?-a:6-a)}if("PageUp"===t.key||"PageDown"===t.key){t.preventDefault();const e="PageUp"===t.key?-1:1;let a=S(this.activeDate,e);const s=this.setMinDate(),n=this.setMaxDate();s&&w(a,s)<0&&(a=s),n&&w(a,n)>0&&(a=n),this._focusDateAfterRender=!0,this.setState({year:a.getFullYear(),month:a.getMonth()}),this.set({activeDate:m(a)})}}handlePanelClick(t){t?.stopPropagation?.()}handleDocumentClick(t){if(!this.open)return;const e=t.target;this.contains(e)||this.refs.datePickerPanel.value?.contains?.(e)||this.closePanel()}handleDocumentKeydown(t){this.open&&"Escape"===t.key&&(t.preventDefault(),this.contextMode?this.setContext(""):(this.closePanel(),requestAnimationFrame(()=>this._input?.focus?.())))}syncOverlayListeners(){if(this.input&&this.open)return document.addEventListener("click",this._documentClickHandler),void document.addEventListener("keydown",this._documentKeydownHandler);this.removeOverlayListeners()}removeOverlayListeners(){document.removeEventListener("click",this._documentClickHandler),document.removeEventListener("keydown",this._documentKeydownHandler),this.stopPanelPosition(),window.removeEventListener("resize",this._viewportHandler),document.removeEventListener("scroll",this._viewportHandler,!0),window.visualViewport?.removeEventListener("resize",this._viewportHandler),window.visualViewport?.removeEventListener("scroll",this._viewportHandler)}positionPanel(){const t=this.refs.datePickerPanel.value,e=this._input?.closest(".sf-input-field")||this._input||this.querySelector("sf-input");if(this.isConnected&&this.input&&this.portal&&this.open&&t?.isConnected&&e)return this._panelAnchor&&this._panelAnchorPanel===t&&this._panelAnchorTrigger===e?void this._panelAnchor.update():(this.stopPanelPosition(),Object.assign(t.style,{overflowY:"auto",zIndex:"var(--sf-z-index-9)"}),this._panelAnchorPanel=t,this._panelAnchorTrigger=e,void(this._panelAnchor=(globalThis.SF?.Position||h()).anchor(e,t,{side:"block-end",align:"start",onPosition:({side:t})=>{const e="block-start"===t;Boolean(this.state.openAbove)!==e&&this.set({openAbove:e})}})));this.stopPanelPosition()}stopPanelPosition(){this._panelAnchor?.stop(),this._panelAnchor=null,this._panelAnchorPanel=null,this._panelAnchorTrigger=null}selectDate(t){return!t?.date||t.disabled?this:this.range?(this.selectRangeDate(t),this):(this.setState({year:t.date.getFullYear(),month:t.date.getMonth(),date:t.value,context:""}),this.set({activeDate:t.value}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this)}selectRangeDate(t){if(!this.startValue||this.startValue&&this.endValue)return this.setState({year:t.date.getFullYear(),month:t.date.getMonth(),startValue:t.value,endValue:"",date:t.value,context:"",preset:""}),this.set({activeDate:t.value}),this.emitChange(),this;const e=this.startDate,a={year:t.date.getFullYear(),month:t.date.getMonth(),context:"",preset:""};return e&&w(t.date,e)<0?(a.startValue=t.value,a.endValue=this.startValue,a.date=t.value):(a.endValue=t.value,a.date=this.startValue),this.setState(a),this.set({activeDate:t.value}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this}choosePreset(t){if(!t||t.disabled)return this;const e=m(t.from),a=m(t.to);return this.setState({preset:t.id,startValue:e,endValue:a,date:e,year:t.to.getFullYear(),month:t.to.getMonth(),context:""}),this.set({activeDate:a}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this}chooseCustomRange(){return this.preset&&this.setState({preset:"",startValue:"",endValue:"",date:""}),this._focusDateAfterRender=!0,this.requestComponentUpdate("custom-range"),this}handlePresetKeydown(t){const e={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};if(!(t.key in e)&&"Home"!==t.key&&"End"!==t.key)return;const a=[...t.currentTarget.querySelectorAll("button:not(:disabled)")];if(!a.length)return;t.preventDefault();const s=a.indexOf(t.target);let n="Home"===t.key?0:"End"===t.key?a.length-1:s+e[t.key];!this.isRtl||"ArrowRight"!==t.key&&"ArrowLeft"!==t.key||(n=s-e[t.key]),n=(n+a.length)%a.length,a.forEach((t,e)=>t.setAttribute("tabindex",e===n?"0":"-1")),a[n].focus()}selectMonth(t){return!t||t.disabled||(this.setState({month:t.index,context:""}),this.set({activeDate:m(new Date(this.year,t.index,1))})),this}selectYear(t){if(!t||t.disabled)return this;const e={year:t.year,context:""},a=this.getClosestEnabledMonth(t.year,this.month);return a!==this.month&&(e.month=a),this.setState(e),this.set({activeDate:m(new Date(t.year,a,1))}),this}getClosestEnabledMonth(t,e){const a=this.setMinDate(),s=this.setMaxDate();return a&&t===a.getFullYear()&&e<a.getMonth()?a.getMonth():s&&t===s.getFullYear()&&e>s.getMonth()?s.getMonth():e}emitChange(){const t=this.startValue&&this.endValue?`${this.startValue}/${this.endValue}`:this.startValue||"",e=this.range?{value:[this.startValue,this.endValue],date:t,startValue:this.startValue,endValue:this.endValue,formattedValue:this.displayValue,formattedStartValue:this.formattedStartValue,formattedEndValue:this.formattedEndValue,isoValue:t,startIsoValue:this.startValue,endIsoValue:this.endValue,range:!0,format:this.format,preset:this.activePreset?this.activePreset.relative?{id:this.activePreset.id,relative:this.activePreset.relative}:{id:this.activePreset.id}:null}:{value:this.date,date:this.date,formattedValue:this.formattedValue,isoValue:this.date,range:!1,format:this.format};this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:e})),this.dispatchEvent(new CustomEvent("sf-datepicker-change",{bubbles:!0,composed:!0,detail:e})),this.emitComponentEvent("change",e)}templateContext(){const t=this.getPropsContext();return this.createTemplateContext({...t,component:this,date:this.date,formattedValue:this.formattedValue,displayValue:this.displayValue,startValue:this.startValue,formattedStartValue:this.formattedStartValue,endValue:this.endValue,formattedEndValue:this.formattedEndValue,range:this.range,format:this.format,selectedDate:this.selectedDate,startDate:this.startDate,endDate:this.endDate,year:this.year,month:this.month,monthLabel:P(this.month,this.locale),calendarLabel:this.calendarLabel,labels:this.labels,weekdays:this.weekdays,panelId:this._panelId,previousIcon:this.isRtl?"chevron_right":"chevron_left",nextIcon:this.isRtl?"chevron_left":"chevron_right",context:this.contextMode,locale:this.locale,days:this.days,presetItems:this.presetItems,months:this.months,years:this.years,yearPageStart:this.yearPageStart,yearPageEnd:this.yearPageEnd,rootClass:this.getRootClass(),rootStyle:this.getRootStyle(),openAbove:Boolean(this.state.openAbove),input:this.input,open:this.open,portal:this.portal,inputType:this.inputType,inputSize:this.inputSize,inputName:this.inputName,placeholder:this.placeholder,label:this.label,disabled:this.disabled,required:this.required,leftIcon:this.leftIcon,iconStart:this.leftIcon,inputRootClass:this.inputRootClass,mask:this.mask,maskPattern:this.maskPattern,maskLazy:this.maskLazy,maskPlaceholderChar:this.maskPlaceholderChar,maskOptions:this.maskOptions})}template(){return(0,r.P)(this.templateContext())}afterRender(){this._input=this.refs.input?.value?.querySelector("input")||null,this._input&&(this._input.setAttribute("aria-haspopup","dialog"),this._input.setAttribute("aria-expanded",this.open?"true":"false"),this._input.setAttribute("aria-controls",this._panelId));const t=this.querySelector(".sf-datepicker-month-toggle button"),e=this.querySelector(".sf-datepicker-year-toggle button");t?.setAttribute("aria-expanded","month"===this.contextMode?"true":"false"),e?.setAttribute("aria-expanded","year"===this.contextMode?"true":"false"),this.syncOverlayListeners(),requestAnimationFrame(()=>{if(this.positionPanel(),this._focusCalendarOnOpen||this._focusDateAfterRender){const t=this.querySelector(`.sf-datepicker-day[data-date="${m(this.activeDate)}"]`);t?.focus?.(),this._focusCalendarOnOpen=!1,this._focusDateAfterRender=!1}})}onDisconnected(){this.removeOverlayListeners(),super.onDisconnected()}get data(){return{value:this.value,date:this.date,formattedValue:this.formattedValue,displayValue:this.displayValue,startValue:this.startValue,formattedStartValue:this.formattedStartValue,endValue:this.endValue,formattedEndValue:this.formattedEndValue,range:this.range,format:this.format,year:this.year,month:this.month,context:this.contextMode,maxDate:this.maxDate,minDate:this.minDate,locale:this.locale,input:this.input,open:this.open,portal:this.portal,mask:this.mask,maskPattern:this.maskPattern,maskOptions:this.maskOptions,presets:this.presetItems.map(({id:t,label:e,relative:a,disabled:s})=>({id:t,label:e,relative:a,disabled:s})),preset:this.preset}}}C.define("sf-datepicker"),e()}catch(E){e(E)}})},"77b2f4107e3b"(t,e,a){a.a(t,async(t,s)=>{try{a.d(e,{P:()=>b});var n=a("ddf1cdb42ecc"),r=a("5a8eddcd589d"),i=t([n,r]);[n,r]=i.then?(await i)():i;function o(...t){return t.flat().filter(Boolean).join(" ")}function l(t){return n.html`
1
+ (()=>{"use strict";var t={"98e26702f55a"(t,e,a){function s(){const t=globalThis.SF=globalThis.SF||{};return t.__deprecationNotes instanceof Map||Object.defineProperty(t,"__deprecationNotes",{value:new Map,configurable:!0}),t.__deprecationNotes}function n({component:t="",kind:e="attribute",attribute:a="",from:n,to:r=null}={}){if(!n)return;const i=[t,e,a,n].join("|"),o=s(),l=o.get(i);if(l)l.count+=1;else if(o.set(i,{component:t,kind:e,attribute:a,from:n,to:r,count:1}),function(){const t=globalThis.document?.documentElement;return"warn"===t?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const s=t?`${t}: `:"",i="value"===e?`${a}="${n}"`:`${e} ${n}`;globalThis.console?.warn?.(`[SIMAI Framework] ${s}${i} is a legacy name${r?`; write ${r}`:""}. See contracts/changes/journal.json.`)}}if(a.d(e,{id:()=>l}),"undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const t=globalThis.SF.deprecations||{};t.list=function(){return[...s().values()].map(t=>({...t}))},t.clear=function(){s().clear()},t.note=n,globalThis.SF.deprecations=t}const r=Object.freeze(["1/2","1","2"]),i=Object.freeze({"1/3":"1/2",3:"2"}),o=new Set;function l(t,e="field",a="1"){const s=String(t??"").trim().toLowerCase();if(r.includes(s))return s;if(Object.hasOwn(i,s)){const t=i[s];n({component:e,kind:"value",attribute:"size",from:s,to:t});const a=`${e}:${s}`;return o.has(a)||"undefined"==typeof console||(o.add(a),console.warn(`[SIMAI Framework] ${e}: size ${s} is retired for form fields; rendering size ${t}.`)),t}return a}},b9b65955223a(t,e,a){a.a(t,async(t,e)=>{try{var s=a("fbe0570fcc69"),n=a("98e26702f55a"),r=a("77b2f4107e3b"),i=a("5c1dc214bb5e"),o=a("0d662e4d7d63"),l=t([s,r,i,o]);[s,r,i,o]=l.then?(await l)():l;var u=a.n(s),h=a.n(i);const c=/^(\d{4})-(\d{2})-(\d{2})$/,d=18;let p=0;function g(t){return String(t).padStart(2,"0")}function m(t){return`${t.getFullYear()}-${g(t.getMonth()+1)}-${g(t.getDate())}`}function f(t,e="YYYY.MM.DD"){if(!t)return"";const a={YYYY:String(t.getFullYear()),YY:String(t.getFullYear()).slice(-2),MM:g(t.getMonth()+1),DD:g(t.getDate())};return String(e||"YYYY.MM.DD").replace(/YYYY|YY|MM|DD/g,t=>a[t]||t)}function b(t){return t instanceof Date&&!Number.isNaN(t.getTime())}function y(t){if(!t)return null;const e=String(t).match(c);if(!e)return null;const[,a,s,n]=e,r=new Date(Number(a),Number(s)-1,Number(n));return r.getFullYear()!==Number(a)||r.getMonth()!==Number(s)-1||r.getDate()!==Number(n)?null:r}function D(t,e="DD.MM.YYYY"){if(!t)return null;if(t instanceof Date)return b(t)?new Date(t.getFullYear(),t.getMonth(),t.getDate()):null;const a=String(t).trim(),s=y(a);if(s)return s;const n=a.match(/\d+/g),r=String(e||"DD.MM.YYYY").match(/YYYY|YY|MM|DD/g);if(!n||!r||n.length<3||r.length<3)return null;const i={};r.slice(0,3).forEach((t,e)=>{i[t]=Number(n[e])});let o=i.YYYY;!o&&i.YY&&(o=i.YY+2e3);const l=i.MM,u=i.DD;if(!o||!l||!u)return null;const h=new Date(o,l-1,u);return h.getFullYear()!==o||h.getMonth()!==l-1||h.getDate()!==u?null:h}function v(t,e=0){const a=(0,s.toNumber)(t,e);return Number.isFinite(a)?Math.max(0,Math.min(11,a)):e}function k(t,e){return t&&e&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}function w(t,e){if(!t||!e)return 0;return new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function S(t,e){const a=new Date(t.getFullYear(),t.getMonth()+e,1),s=new Date(a.getFullYear(),a.getMonth()+1,0).getDate();return a.setDate(Math.min(t.getDate(),s)),a}function M(t,e,a){return!!(t&&e&&a)&&(w(t,e)>0&&w(t,a)<0)}function $(t="",e=null){const a=String(t||"").trim();return a||(0,o.pageLocale)(e??globalThis.document?.documentElement??null)}function x(t=""){const e=String(t||"");return e?`${e.charAt(0).toLocaleUpperCase()}${e.slice(1)}`:""}function P(t,e){try{return x(new Intl.DateTimeFormat(e,{month:"long"}).format(new Date(2026,t,1)))}catch{return String(t+1)}}function A(t,e){try{return new Intl.DateTimeFormat(e,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(t)}catch{return m(t)}}function Y(t,e=1){const a=new Date(2026,0,4);return Array.from({length:7},(s,n)=>{const r=new Date(a);r.setDate(a.getDate()+(e+n)%7);try{return new Intl.DateTimeFormat(t,{weekday:"short"}).format(r)}catch{return String((e+n)%7)}})}const V=["today","yesterday","last-7-days","last-30-days","this-week","this-month","last-month"];function _(t,e){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+e)}function F(t,e,a=1){const s=new Date(e.getFullYear(),e.getMonth(),e.getDate());switch(t){case"today":return[s,s];case"yesterday":return[_(s,-1),_(s,-1)];case"last-7-days":return[_(s,-6),s];case"last-30-days":return[_(s,-29),s];case"this-week":return[_(s,-(s.getDay()-a+7)%7),s];case"this-month":return[new Date(s.getFullYear(),s.getMonth(),1),s];case"last-month":return[new Date(s.getFullYear(),s.getMonth()-1,1),new Date(s.getFullYear(),s.getMonth(),0)];default:return null}}const T={en:{previousMonth:"Previous month",nextMonth:"Next month",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",presets:"Quick ranges",customRange:"Custom range",preset_today:"Today",preset_yesterday:"Yesterday",preset_last7Days:"Last 7 days",preset_last30Days:"Last 30 days",preset_thisWeek:"This week",preset_thisMonth:"This month",preset_lastMonth:"Last month"},ru:{previousMonth:"Предыдущий месяц",nextMonth:"Следующий месяц",previousYears:"Предыдущие годы",nextYears:"Следующие годы",chooseMonth:"Выберите месяц",chooseYear:"Выберите год",presets:"Быстрый выбор",customRange:"Свой период",preset_today:"Сегодня",preset_yesterday:"Вчера",preset_last7Days:"Последние 7 дней",preset_last30Days:"Последние 30 дней",preset_thisWeek:"Эта неделя",preset_thisMonth:"Этот месяц",preset_lastMonth:"Прошлый месяц"}};class C extends(u()){constructor(){super(),this._input=null,this._documentClickHandler=this.handleDocumentClick.bind(this),this._documentKeydownHandler=this.handleDocumentKeydown.bind(this),this._viewportHandler=this.positionPanel.bind(this),this._focusCalendarOnOpen=!1,this._focusDateAfterRender=!1,this._panelId="sf-datepicker-panel-"+ ++p,this.state={openAbove:!1,yearPageStart:null,activeDate:""},this.refs={input:this.createRef(),datePickerRoot:this.createRef(),datePickerPanel:this.createRef()}}static get props(){return{templateName:{attribute:"template",default:"default"},value:{default:""},date:{default:""},startValue:{attribute:"start-value",default:""},endValue:{attribute:"end-value",default:""},maxDate:{default:""},minDate:{default:""},range:{type:Boolean,default:!1},month:{type:Number,default:null},year:{type:Number,default:null},context:{default:""},weekStart:{type:Number,default:null},locale:{default:""},format:{default:"DD.MM.YYYY"},rootClass:{default:""},closeOnSelect:{type:Boolean,default:!0},input:{type:Boolean,default:!0},open:{type:Boolean,default:!1},portal:{type:Boolean,default:!0},inputType:{attribute:"input-type",default:"bordered"},size:{default:"1"},inputSize:{attribute:"input-size",default:"1"},inputName:{attribute:"input-name",default:""},name:{attribute:"name",default:""},placeholder:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},iconStart:{type:String,attribute:"icon-start",default:null},leftIcon:{attribute:"left-icon",default:"calendar_today"},inputRootClass:{attribute:"input-root-class",default:""},mask:{type:Boolean,default:!1},maskPattern:{attribute:"mask-pattern",default:""},maskLazy:{attribute:"mask-lazy",default:!1},maskPlaceholderChar:{attribute:"mask-placeholder-char",default:"_"},maskOptions:{attribute:"mask-options",default:""},presets:{default:""},preset:{default:""}}}connectedCallback(){this.upgradeProperty("value"),this.upgradeProperty("presets"),super.connectedCallback()}upgradeProperty(t){if(!Object.prototype.hasOwnProperty.call(this,t))return;const e=this[t];delete this[t],this[t]=e}get componentName(){return"datepicker"}get templateName(){return this.getAttribute("template")||"default"}get selectedDate(){return D(this.date,this.format)}get primaryDate(){const t=this.activePreset;return t?t.to:this.selectedDate||this.startDate}get presets(){return this._presetList??(this.getAttribute("presets")||"")}set presets(t){if(Array.isArray(t))return this._presetList=t,void this.requestComponentUpdate("presets");this._presetList=null,this.setState({presets:t?String(t):""})}get preset(){return this.getAttribute("preset")||""}set preset(t){this.setState({preset:t?String(t):""})}get presetItems(){if(!this.range)return[];const t=Array.isArray(this.presets)?this.presets:String(this.presets).split(/[\s,]+/).filter(Boolean),e=new Date,a=this.setMinDate(),s=this.setMaxDate();return t.map(t=>{const n="string"==typeof t?{id:t,relative:t}:{...t};if(!n?.id)return null;let r=null;if(n.relative)r=F(n.relative,e,this.weekStart);else if(Array.isArray(n.range)){const t=D(n.range[0],this.format),e=D(n.range[1],this.format);t&&e&&(r=w(t,e)<=0?[t,e]:[e,t])}if(!r)return null;let[i,l]=r;a&&w(i,a)<0&&(i=a),s&&w(l,s)>0&&(l=s);const u=w(i,l)>0,h=n.label||(V.includes(n.id)?(0,o.pageText)(T,(c=n.id,`preset_${String(c).replace(/-([a-z0-9])/g,(t,e)=>e.toUpperCase())}`),this,"sf-datepicker"):n.id);var c;return{id:String(n.id),label:h,relative:n.relative||null,from:i,to:l,disabled:u,pressed:this.preset===String(n.id)}}).filter(Boolean)}get activePreset(){const t=this.preset;if(!t||!this.range)return null;const e=this.presetItems.find(e=>e.id===t);return e&&!e.disabled?e:null}get startDate(){return D(this.startValue,this.format)}get endDate(){return D(this.endValue,this.format)}get date(){return this.getAttribute("date")||this.getAttribute("value")||""}get value(){return this.range?[this.startValue,this.endValue]:this.date}set value(t){if(Array.isArray(t)){const[e="",a=""]=t;return void this.setState({date:e||"",startValue:e||"",endValue:a||""})}if(t&&"object"==typeof t){const e=t.start||t.startValue||t.date||"",a=t.end||t.endValue||"";return void this.setState({date:t.date||e||"",startValue:e,endValue:a})}this.setState({date:t?String(t):"",startValue:"",endValue:""})}setMaxDate(){return D(this.maxDate,this.format)}setMinDate(){return D(this.minDate,this.format)}get maxDate(){return this.getAttribute("max-date")||""}get minDate(){return this.getAttribute("min-date")||""}set date(t){this.setState({date:t?String(t):""})}get startValue(){const t=this.activePreset;return t?m(t.from):this.getAttribute("start-value")||""}set startValue(t){this.setState({startValue:t?String(t):""})}get endValue(){const t=this.activePreset;return t?m(t.to):this.getAttribute("end-value")||""}set endValue(t){this.setState({endValue:t?String(t):""})}get range(){return this.getBooleanAttr("range",!1)}get input(){return this.getBooleanAttr("input",!0)}get open(){return this.getBooleanAttr("open",!1)}get portal(){return this.getBooleanAttr("portal",!0)}get inputType(){return this.getAttribute("input-type")||"bordered"}get size(){return(0,n.id)(this.getAttribute("size")||this.getAttribute("input-size")||"1","sf-datepicker")}get inputSize(){return this.size}get inputName(){return this.getAttribute("input-name")||this.getAttribute("name")||""}get placeholder(){return this.getAttribute("placeholder")||""}get label(){return this.getAttribute("label")||""}get disabled(){return this.getBooleanAttr("disabled",!1)}get required(){return this.getBooleanAttr("required",!1)}get closeOnSelect(){return this.getBooleanAttr("close-on-select",!0)}get leftIcon(){return this.hasAttribute("icon-start")?this.getAttribute("icon-start"):this.getAttribute("left-icon")||"calendar_today"}get iconStart(){return this.leftIcon}get inputRootClass(){return this.getAttribute("input-root-class")||""}get mask(){return this.getBooleanAttr("mask",!1)}get maskPattern(){return this.getAttribute("mask-pattern")||this.formatToMask(this.format)}get maskLazy(){return!!this.hasAttribute("mask-lazy")&&this.getBooleanAttr("mask-lazy",!1)}get maskPlaceholderChar(){return this.getAttribute("mask-placeholder-char")||"_"}get maskOptions(){return this.getAttribute("mask-options")||""}get year(){const t=this.primaryDate,e=t?t.getFullYear():(new Date).getFullYear();return this.hasAttribute("year")?this.getNumberAttr("year",e):e}set year(t){this.setState({year:null==t||""===t?"":String((0,s.toNumber)(t,(new Date).getFullYear()))})}get month(){const t=this.primaryDate,e=t?t.getMonth():(new Date).getMonth();return this.hasAttribute("month")?v(this.getAttribute("month"),e):e}set month(t){this.setState({month:null==t||""===t?"":String(v(t,(new Date).getMonth()))})}get contextMode(){return this.getEnumAttr("context",["month","year",""],"")}get weekStart(){if(this.hasAttribute("week-start")){const t=this.getNumberAttr("week-start",1);return Number.isInteger(t)&&t>=0&&t<=7?t%7:1}try{const t=new Intl.Locale(this.locale),e="function"==typeof t.getWeekInfo?t.getWeekInfo():t.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 1}get locale(){return $(this.getAttribute("locale"),this)}get format(){return this.getAttribute("format")||"DD.MM.YYYY"}get formattedValue(){return f(this.selectedDate,this.format)}get formattedStartValue(){return f(this.startDate,this.format)}get formattedEndValue(){return f(this.endDate,this.format)}get displayValue(){return this.range?this.formattedStartValue&&this.formattedEndValue?`${this.formattedStartValue} - ${this.formattedEndValue}`:this.formattedStartValue||this.formattedEndValue||"":this.formattedValue}get displayDate(){return new Date(this.year,this.month,1)}get isRtl(){return"rtl"===(this.closest("[dir]")?.getAttribute("dir")||document.documentElement?.dir)}get labels(){return t=this,Object.fromEntries(["previousMonth","nextMonth","previousYears","nextYears","chooseMonth","chooseYear","presets","customRange"].map(e=>[e,(0,o.pageText)(T,e,t,"sf-datepicker")]));var t}get weekdays(){return Y(this.locale,this.weekStart)}get calendarLabel(){try{return new Intl.DateTimeFormat(this.locale,{month:"long",year:"numeric"}).format(this.displayDate)}catch{return`${this.month+1}.${this.year}`}}get activeDate(){const t=y(this.state.activeDate)||this.primaryDate||this.displayDate,e=this.setMinDate(),a=this.setMaxDate();return e&&w(t,e)<0?e:a&&w(t,a)>0?a:t}get normalizedRange(){const t=this.startDate,e=this.endDate;return t&&e?w(t,e)<=0?{startDate:t,endDate:e}:{startDate:e,endDate:t}:{startDate:t,endDate:e}}get days(){const t=(new Date(this.year,this.month,1).getDay()-this.weekStart+7)%7,e=new Date(this.year,this.month,1-t),{startDate:a,endDate:s}=this.normalizedRange,n=Boolean(this.startValue&&this.endValue),r=this.setMinDate(),i=this.setMaxDate(),o=this.activeDate,l=new Date;return Array.from({length:42}).map((t,u)=>{const h=new Date(e.getFullYear(),e.getMonth(),e.getDate()+u),c=h.getTime(),d=Boolean(r&&c<r.getTime()||i&&c>i.getTime());return{date:h,value:m(h),formattedValue:f(h,this.format),label:A(h,this.locale),day:h.getDate(),today:k(h,l),currentMonth:h.getMonth()===this.month,weekend:[0,6].includes(h.getDay()),disabled:d,selected:this.range?k(h,a)||k(h,s):k(h,this.selectedDate),rangeStart:this.range&&n&&k(h,a),rangeEnd:this.range&&n&&k(h,s),rangeSelected:this.range&&n&&M(h,a,s),tabIndex:!d&&k(h,o)?0:-1}})}get months(){const t=this.setMinDate(),e=this.setMaxDate(),a=t?new Date(t.getFullYear(),t.getMonth(),1):null,s=e?new Date(e.getFullYear(),e.getMonth(),1):null;return Array.from({length:12}).map((t,e)=>{const n=new Date(this.year,e,1).getTime(),r=Boolean(a&&n<a.getTime()||s&&n>s.getTime());return{index:e,label:P(e,this.locale),selected:e===this.month,disabled:r}})}get years(){const t=this.setMinDate(),e=this.setMaxDate(),a=this.yearPageStart;return Array.from({length:d}).map((s,n)=>{const r=a+n;return{year:r,disabled:Boolean(t&&r<t.getFullYear()||e&&r>e.getFullYear()),selected:r===this.year}})}get yearPageStart(){return this.state.yearPageStart??this.getYearPageStart(this.year)}get yearPageEnd(){return this.yearPageStart+d-1}getYearPageStart(t=this.year){const e=(0,s.toNumber)(t,(new Date).getFullYear());return e-e%d}formatToMask=t=>{let e=String(t).replace(/[A-Za-z]/g,"0");return this.range&&(e+=` - ${e}`),e};setContext(t=""){return this.setState({context:t||""}),this}toggleContext(t){const e=this.contextMode===t?"":t,a={context:e};return"year"===e&&(a.yearPageStart=this.getYearPageStart(this.year)),this.setState(a),this}shiftYearPage(t=1){return this.set({yearPageStart:this.yearPageStart+d*t}),this}shiftMonth(t=1){const e=new Date(this.year,this.month+t,1),a=this.setMinDate(),s=this.setMaxDate();return a&&e<new Date(a.getFullYear(),a.getMonth(),1)||s&&e>new Date(s.getFullYear(),s.getMonth(),1)||(this.setState({year:e.getFullYear(),month:e.getMonth(),context:""}),this.set({activeDate:m(e)})),this}setActiveDate(t){const e=y(t);return e&&this.state.activeDate!==t?(this.set({activeDate:m(e)}),this):this}moveActiveDate(t){const e=new Date(this.activeDate);e.setDate(e.getDate()+t);const a=this.setMinDate(),s=this.setMaxDate();return a&&w(e,a)<0||s&&w(e,s)>0||(this._focusDateAfterRender=!0,this.setState({year:e.getFullYear(),month:e.getMonth(),context:""}),this.set({activeDate:m(e)})),this}openPanel({focusCalendar:t=!1}={}){return this.disabled?this:(this._focusCalendarOnOpen=t,this.state.activeDate||this.set({activeDate:m(this.activeDate)}),this.open?(this.positionPanel(),this):(this.setState({open:!0}),this))}closePanel({restoreFocus:t=!1}={}){return this.open?(this.setState({open:!1,context:""}),t&&requestAnimationFrame(()=>this._input?.focus?.()),this):this}togglePanel(){return this.open?this.closePanel():this.openPanel()}handleInputClick(t){t?.preventDefault?.(),t?.stopPropagation?.(),this.openPanel()}handleInputKeydown(t){["ArrowDown","Enter"," "].includes(t.key)&&(t.preventDefault(),this.openPanel({focusCalendar:!0}))}handleDayKeydown(t,e){const a=this.isRtl?-1:1,s={ArrowLeft:-a,ArrowRight:a,ArrowUp:-7,ArrowDown:7};if(Object.prototype.hasOwnProperty.call(s,t.key))return t.preventDefault(),void this.moveActiveDate(s[t.key]);if("Home"===t.key||"End"===t.key){t.preventDefault();const a=((e?.date||this.activeDate).getDay()-this.weekStart+7)%7;return void this.moveActiveDate("Home"===t.key?-a:6-a)}if("PageUp"===t.key||"PageDown"===t.key){t.preventDefault();const e="PageUp"===t.key?-1:1;let a=S(this.activeDate,e);const s=this.setMinDate(),n=this.setMaxDate();s&&w(a,s)<0&&(a=s),n&&w(a,n)>0&&(a=n),this._focusDateAfterRender=!0,this.setState({year:a.getFullYear(),month:a.getMonth()}),this.set({activeDate:m(a)})}}handlePanelClick(t){t?.stopPropagation?.()}handleDocumentClick(t){if(!this.open)return;const e=t.target;this.contains(e)||this.refs.datePickerPanel.value?.contains?.(e)||this.closePanel()}handleDocumentKeydown(t){this.open&&"Escape"===t.key&&(t.preventDefault(),this.contextMode?this.setContext(""):(this.closePanel(),requestAnimationFrame(()=>this._input?.focus?.())))}syncOverlayListeners(){if(this.input&&this.open)return document.addEventListener("click",this._documentClickHandler),void document.addEventListener("keydown",this._documentKeydownHandler);this.removeOverlayListeners()}removeOverlayListeners(){document.removeEventListener("click",this._documentClickHandler),document.removeEventListener("keydown",this._documentKeydownHandler),this.stopPanelPosition(),window.removeEventListener("resize",this._viewportHandler),document.removeEventListener("scroll",this._viewportHandler,!0),window.visualViewport?.removeEventListener("resize",this._viewportHandler),window.visualViewport?.removeEventListener("scroll",this._viewportHandler)}positionPanel(){const t=this.refs.datePickerPanel.value,e=this._input?.closest(".sf-input-field")||this._input||this.querySelector("sf-input");if(this.isConnected&&this.input&&this.portal&&this.open&&t?.isConnected&&e)return this._panelAnchor&&this._panelAnchorPanel===t&&this._panelAnchorTrigger===e?void this._panelAnchor.update():(this.stopPanelPosition(),Object.assign(t.style,{overflowY:"auto",zIndex:"var(--sf-z-index-9)"}),this._panelAnchorPanel=t,this._panelAnchorTrigger=e,void(this._panelAnchor=(globalThis.SF?.Position||h()).anchor(e,t,{side:"block-end",align:"start",onPosition:({side:t})=>{const e="block-start"===t;Boolean(this.state.openAbove)!==e&&this.set({openAbove:e})}})));this.stopPanelPosition()}stopPanelPosition(){this._panelAnchor?.stop(),this._panelAnchor=null,this._panelAnchorPanel=null,this._panelAnchorTrigger=null}selectDate(t){return!t?.date||t.disabled?this:this.range?(this.selectRangeDate(t),this):(this.setState({year:t.date.getFullYear(),month:t.date.getMonth(),date:t.value,context:""}),this.set({activeDate:t.value}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this)}selectRangeDate(t){if(!this.startValue||this.startValue&&this.endValue)return this.setState({year:t.date.getFullYear(),month:t.date.getMonth(),startValue:t.value,endValue:"",date:t.value,context:"",preset:""}),this.set({activeDate:t.value}),this.emitChange(),this;const e=this.startDate,a={year:t.date.getFullYear(),month:t.date.getMonth(),context:"",preset:""};return e&&w(t.date,e)<0?(a.startValue=t.value,a.endValue=this.startValue,a.date=t.value):(a.endValue=t.value,a.date=this.startValue),this.setState(a),this.set({activeDate:t.value}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this}choosePreset(t){if(!t||t.disabled)return this;const e=m(t.from),a=m(t.to);return this.setState({preset:t.id,startValue:e,endValue:a,date:e,year:t.to.getFullYear(),month:t.to.getMonth(),context:""}),this.set({activeDate:a}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this}chooseCustomRange(){return this.preset&&this.setState({preset:"",startValue:"",endValue:"",date:""}),this._focusDateAfterRender=!0,this.requestComponentUpdate("custom-range"),this}handlePresetKeydown(t){const e={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};if(!(t.key in e)&&"Home"!==t.key&&"End"!==t.key)return;const a=[...t.currentTarget.querySelectorAll("button:not(:disabled)")];if(!a.length)return;t.preventDefault();const s=a.indexOf(t.target);let n="Home"===t.key?0:"End"===t.key?a.length-1:s+e[t.key];!this.isRtl||"ArrowRight"!==t.key&&"ArrowLeft"!==t.key||(n=s-e[t.key]),n=(n+a.length)%a.length,a.forEach((t,e)=>t.setAttribute("tabindex",e===n?"0":"-1")),a[n].focus()}selectMonth(t){return!t||t.disabled||(this.setState({month:t.index,context:""}),this.set({activeDate:m(new Date(this.year,t.index,1))})),this}selectYear(t){if(!t||t.disabled)return this;const e={year:t.year,context:""},a=this.getClosestEnabledMonth(t.year,this.month);return a!==this.month&&(e.month=a),this.setState(e),this.set({activeDate:m(new Date(t.year,a,1))}),this}getClosestEnabledMonth(t,e){const a=this.setMinDate(),s=this.setMaxDate();return a&&t===a.getFullYear()&&e<a.getMonth()?a.getMonth():s&&t===s.getFullYear()&&e>s.getMonth()?s.getMonth():e}emitChange(){const t=this.startValue&&this.endValue?`${this.startValue}/${this.endValue}`:this.startValue||"",e=this.range?{value:[this.startValue,this.endValue],date:t,startValue:this.startValue,endValue:this.endValue,formattedValue:this.displayValue,formattedStartValue:this.formattedStartValue,formattedEndValue:this.formattedEndValue,isoValue:t,startIsoValue:this.startValue,endIsoValue:this.endValue,range:!0,format:this.format,preset:this.activePreset?this.activePreset.relative?{id:this.activePreset.id,relative:this.activePreset.relative}:{id:this.activePreset.id}:null}:{value:this.date,date:this.date,formattedValue:this.formattedValue,isoValue:this.date,range:!1,format:this.format};this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:e})),this.dispatchEvent(new CustomEvent("sf-datepicker-change",{bubbles:!0,composed:!0,detail:e})),this.emitComponentEvent("change",e)}templateContext(){const t=this.getPropsContext();return this.createTemplateContext({...t,component:this,date:this.date,formattedValue:this.formattedValue,displayValue:this.displayValue,startValue:this.startValue,formattedStartValue:this.formattedStartValue,endValue:this.endValue,formattedEndValue:this.formattedEndValue,range:this.range,format:this.format,selectedDate:this.selectedDate,startDate:this.startDate,endDate:this.endDate,year:this.year,month:this.month,monthLabel:P(this.month,this.locale),calendarLabel:this.calendarLabel,labels:this.labels,weekdays:this.weekdays,panelId:this._panelId,previousIcon:this.isRtl?"chevron_right":"chevron_left",nextIcon:this.isRtl?"chevron_left":"chevron_right",context:this.contextMode,locale:this.locale,days:this.days,presetItems:this.presetItems,months:this.months,years:this.years,yearPageStart:this.yearPageStart,yearPageEnd:this.yearPageEnd,rootClass:this.getRootClass(),rootStyle:this.getRootStyle(),openAbove:Boolean(this.state.openAbove),input:this.input,open:this.open,portal:this.portal,inputType:this.inputType,inputSize:this.inputSize,inputName:this.inputName,placeholder:this.placeholder,label:this.label,disabled:this.disabled,required:this.required,leftIcon:this.leftIcon,iconStart:this.leftIcon,inputRootClass:this.inputRootClass,mask:this.mask,maskPattern:this.maskPattern,maskLazy:this.maskLazy,maskPlaceholderChar:this.maskPlaceholderChar,maskOptions:this.maskOptions})}template(){return(0,r.P)(this.templateContext())}afterRender(){this._input=this.refs.input?.value?.querySelector("input")||null,this._input&&(this._input.setAttribute("aria-haspopup","dialog"),this._input.setAttribute("aria-expanded",this.open?"true":"false"),this._input.setAttribute("aria-controls",this._panelId));const t=this.querySelector(".sf-datepicker-month-toggle button"),e=this.querySelector(".sf-datepicker-year-toggle button");t?.setAttribute("aria-expanded","month"===this.contextMode?"true":"false"),e?.setAttribute("aria-expanded","year"===this.contextMode?"true":"false"),this.syncOverlayListeners(),requestAnimationFrame(()=>{if(this.positionPanel(),this._focusCalendarOnOpen||this._focusDateAfterRender){const t=this.querySelector(`.sf-datepicker-day[data-date="${m(this.activeDate)}"]`);t?.focus?.(),this._focusCalendarOnOpen=!1,this._focusDateAfterRender=!1}})}onDisconnected(){this.removeOverlayListeners(),super.onDisconnected()}get data(){return{value:this.value,date:this.date,formattedValue:this.formattedValue,displayValue:this.displayValue,startValue:this.startValue,formattedStartValue:this.formattedStartValue,endValue:this.endValue,formattedEndValue:this.formattedEndValue,range:this.range,format:this.format,year:this.year,month:this.month,context:this.contextMode,maxDate:this.maxDate,minDate:this.minDate,locale:this.locale,input:this.input,open:this.open,portal:this.portal,mask:this.mask,maskPattern:this.maskPattern,maskOptions:this.maskOptions,presets:this.presetItems.map(({id:t,label:e,relative:a,disabled:s})=>({id:t,label:e,relative:a,disabled:s})),preset:this.preset}}}C.define("sf-datepicker"),e()}catch(E){e(E)}})},"77b2f4107e3b"(t,e,a){a.a(t,async(t,s)=>{try{a.d(e,{P:()=>b});var n=a("ddf1cdb42ecc"),r=a("5a8eddcd589d"),i=t([n,r]);[n,r]=i.then?(await i)():i;function o(...t){return t.flat().filter(Boolean).join(" ")}function l(t){return n.html`
2
2
  <div class="sf-datepicker-top flex content-main-between items-cross-center">
3
3
  <sf-icon-button appearance="link" scheme="on-surface" size="1"
4
4
  icon=${t.previousIcon} aria-label=${t.labels.previousYears}