@simai-studio/ui 5.20261020.1647 → 5.20261020.1738
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.
- package/README.md +4 -4
- package/distr/component/modal/js/modal.min.js +1 -1
- package/distr/smart/modal/js/modal.min.js +8 -6
- package/distr/smart/modal/smart.manifest.json +1 -1
- package/distr/smart/spinner/js/spinner.min.js +1 -1
- package/distr/smart/spinner/smart.manifest.json +2 -2
- package/package-manifest.json +8 -8
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @simai-studio/ui
|
|
2
2
|
|
|
3
|
-
SIMAI Framework, release `ui-
|
|
3
|
+
SIMAI Framework, release `ui-ef202b45f12d` (commit ef202b45f12df11f31b564cbdb6b1f1380fcf903 of [simai/ui](https://github.com/simai/ui)).
|
|
4
4
|
|
|
5
5
|
```html
|
|
6
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@simai-studio/ui@5.20261020.
|
|
7
|
-
<script>window.sfPath = 'https://cdn.jsdelivr.net/npm/@simai-studio/ui@5.20261020.
|
|
8
|
-
<script src="https://cdn.jsdelivr.net/npm/@simai-studio/ui@5.20261020.
|
|
6
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@simai-studio/ui@5.20261020.1738/distr/core/css/core.css">
|
|
7
|
+
<script>window.sfPath = 'https://cdn.jsdelivr.net/npm/@simai-studio/ui@5.20261020.1738/distr/';</script>
|
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/@simai-studio/ui@5.20261020.1738/distr/core/js/core.js"></script>
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
Components, utilities and Smart Components ship in their minified form (the Loader asks for it); Core in both forms. Documentation: https://ui.simai.io/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";class t{lifecycleName(){return this.componentName??this.constructor.componentName}constructor(t){this.props=t,this.id=t?.id,this.params=t?.param,this.attrs=t?.attrs||{},this.template=null,window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:beforeRender`,{detail:this}))}getUtilityMap(){return this.constructor.utilityMap||null}extractUtilityClasses(t){if(!Array.isArray(t))return[];const e=new Set;return t.forEach(t=>{if("string"!=typeof t)return;const s=t.match(/\(([^)]+)\)/g);s&&s.forEach(t=>{t.slice(1,-1).split(/\s+/).filter(Boolean).forEach(t=>{t.startsWith(".")&&t.length>1&&e.add(t.slice(1))})})}),Array.from(e)}applyLayoutUtilities(t,e){if(!t||!e)return;const s=this.getUtilityMap();if(!s||!s[e])return;this.extractUtilityClasses(s[e]).forEach(e=>t.classList.add(e))}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(){}}const e=function(t,e){if(t&&e)if("undefined"==typeof window||"function"!=typeof window.registerSfComponent){if("undefined"!=typeof window&&window.SF?.Loader?.registerComponent)window.SF.Loader.registerComponent(t,e);else if("undefined"!=typeof window){(window.SF_PENDING_COMPONENTS=window.SF_PENDING_COMPONENTS||[]).push([t,e])}}else window.registerSfComponent(t,e)},s=(()=>{const t="undefined"!=typeof globalThis?globalThis:{},e="__sfPageLanguage";return t[e]||(t[e]={listeners:new Set,registered:new Map,chosen:null}),t[e]})(),n=s.listeners,o=s.registered,i=t=>String(t??"").trim().toLowerCase().replace("_","-"),a=()=>{for(const t of[...n])try{t()}catch{}};function r(t){let e=t;for(;e;){const t="function"==typeof e.closest?e.closest("[lang]"):null;if(t)return t;const s="function"==typeof e.getRootNode?e.getRootNode():null;e=s&&s!==e&&s.host?s.host:null}return null}function l(t){if(s.chosen)return s.chosen.split("-")[0];const e=r(t),n=e?.getAttribute("lang")||globalThis.document?.documentElement?.lang||"en";return i(n).split("-")[0]||"en"}function d(t){if(s.chosen)return s.chosen;const e=r(t);return i(e?.getAttribute("lang")||globalThis.document?.documentElement?.lang||"en")}function c(t,e,s,n){const a=n??(t=>{const e=t?.tagName;return"string"==typeof e?e.toLowerCase():null})(s);for(const n of(t=>{const e=i(t),s=e.split("-")[0],n=[];for(const t of[e,s,"en"])t&&!n.includes(t)&&n.push(t);return n})(d(s))){const s=a?o.get(a)?.get(n)?.[e]:void 0;if(void 0!==s)return s;const i=t?.[n]?.[e];if(void 0!==i)return i}return e}const h={current:(t=globalThis.document?.documentElement??null)=>d(t),use(t){const e=null==t?null:i(t);return e===s.chosen||(s.chosen=e,a()),s.chosen},register(t,e,s){const n=String(t??"").toLowerCase(),r=i(e);if(!n||!r)throw new TypeError("a component and a language are required");o.has(n)||o.set(n,new Map);const l=o.get(n);return null===s?l.delete(r):l.set(r,{...l.get(r)??{},...s}),a(),this},registerAll(t,e={}){for(const[s,n]of Object.entries(e))this.register(s,t,n);return this},known(t){const e=String(t??"").toLowerCase();return[...o.get(e)?.keys()??[]]},components:()=>[...o.keys()],onChange:t=>"function"!=typeof t?()=>{}:(n.add(t),()=>n.delete(t)),forget(){return o.clear(),s.chosen=null,a(),this}};"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.language=h,window.SF.pageLanguage=l,window.SF.pageText=c);const m=["a[href]","area[href]","button","input","select","textarea","iframe","summary","audio[controls]","video[controls]","[contenteditable]","[tabindex]"].join(","),u=Symbol.for("simai.modal.focus-guards");function f(t,e){return"INPUT"===t?.tagName&&"INPUT"===e?.tagName&&"radio"===t.type&&"radio"===e.type&&!!t.name&&t.name===e.name&&t.form===e.form&&t.getRootNode()===e.getRootNode()}function p(t,e=!1){const s=t.ownerDocument.defaultView,n=Array.from(t.querySelectorAll(m)).filter(t=>t.tabIndex>=0&&!t.matches(":disabled")&&!t.closest("[inert]")&&t.getClientRects().length>0&&"visible"===s.getComputedStyle(t).visibility).sort((t,e)=>(t.tabIndex||1/0)-(e.tabIndex||1/0));return n.filter(t=>{if(!f(t,t))return!0;const s=n.filter(e=>f(t,e)),o=s.find(t=>t.checked);return t===(o||s.at(e?-1:0))})}const g=t=>{const e=Number.parseFloat(t);return Number.isFinite(e)?e*(t.trim().endsWith("ms")?1:1e3):0};function b(t,e=window){let s=!1,n=null,o=null;const i=()=>{s||(s=!0,null!==n&&(e.cancelAnimationFrame(n),n=null),null!==o&&(e.clearTimeout(o),o=null),t())};return n=e.requestAnimationFrame(i),o=e.setTimeout(i,50),"function"==typeof e.queueMicrotask&&e.queueMicrotask(i),()=>{s=!0,null!==n&&e.cancelAnimationFrame(n),null!==o&&e.clearTimeout(o)}}function y(t,e,s=window){let n=null,o=!1;const i=b(()=>{if(o)return;const i=t(),a=i?.querySelectorAll("[data-sf-modal-panel], [data-sf-modal-overlay]")||[],r=Math.max(0,...Array.from(a,t=>{const e=s.getComputedStyle(t);return"none"===e.display?0:function(t){const e=t.transitionProperty.split(",").map(t=>t.trim()),s=t.transitionDuration.split(",").map(g),n=t.transitionDelay.split(",").map(g);return Math.max(0,...e.map((t,e)=>["all","opacity","transform","-webkit-transform"].includes(t)?Math.max(0,s[e%s.length])+n[e%n.length]:0))}(e)}));n=s.setTimeout(()=>{o||e()},r)},s);return()=>{o=!0,i(),null!==n&&s.clearTimeout(n)}}function v(t,e={}){const s=document.createElementNS("http://www.w3.org/2000/svg",t);return Object.entries(e).forEach(([t,e])=>{null!=e&&""!==e&&s.setAttribute(t,String(e))}),s}const w=t=>Math.round(1e3*t)/1e3;function C(t={}){return function({width:t=24,height:e=24,stroke:s=2,dots:n=8,filled:o=3,dotRadius:i=null,direction:a="clockwise",pixel:r=!1}={}){const l=t/2,d=e/2,c=Math.min(t,e)/2,h=Math.max(1,c-s/2),m=v("svg",{class:"sf-loader-svg",viewBox:`0 0 ${t} ${e}`,width:r?t:null,height:r?e:null,"aria-hidden":"true",focusable:"false"}),u={cx:l,cy:d,r:w(h),fill:"none",stroke:"currentColor","stroke-width":s},f=v("circle",{class:"sf-loader-ring-filled",...u,opacity:"0.3"}),p=v("circle",{class:"sf-loader-ring-accent",...u,"stroke-linecap":"round",pathLength:100,"stroke-dasharray":"0 100",transform:`rotate(90 ${l} ${d})`}),g=v("g",{class:"sf-loader-comet",display:"none",transform:`rotate(-90 ${l} ${d})`});for(let t=0;t<10;t+=1){const e=9===t;g.append(v("circle",{class:"sf-loader-comet-segment"+(e?" sf-loader-comet-head":""),...u,"stroke-linecap":e?"round":"butt",pathLength:100,"stroke-dasharray":`${w(4)} ${w(96)}`,"stroke-dashoffset":w(-4*t),opacity:w(((t+1)/10)**1.6)}))}const b=Math.max(3,Math.min(32,Math.floor(Number(n)||8))),y=Math.max(1,Math.min(b,Math.floor(Number(o)||3))),C=Math.min(s,.7*Math.PI*(c-s)/b),_=null==i||""===i?C:Math.max(1,Math.min(Number(i)||C,c/4)),E=Math.max(_,c-_),A=v("g",{class:"sf-loader-dots",display:"none",style:`--sf-loader-dot-count:${b}; --sf-loader-dot-filled:${y};`});for(let t=0;t<b;t+=1){const e=2*Math.PI/b*t-Math.PI/2,s="counterclockwise"===a?t:(b-t)%b;A.append(v("circle",{class:"sf-loader-dot"+(t<y?" sf-loader-dot--active":""),cx:w(l+E*Math.cos(e)),cy:w(d+E*Math.sin(e)),r:w(_),fill:"currentColor",style:`--sf-loader-dot-index:${t}; --sf-loader-dot-step:${s};`}))}return m.append(f,p,g,A),m}({...t,width:24,height:24,stroke:2,dotRadius:null,pixel:!1})}const _=Symbol.for("simai.modal.document-stack");function E(){return document[_]||Object.defineProperty(document,_,{value:{items:[],lockOwner:null},configurable:!0}),document[_]}function A(){return E().items.at(-1)||null}function S(){E().items.forEach((t,e)=>t.applyStackPosition(e)),function(t){const e=t?.getModalRoot?.()||t?.template,s=e?.querySelector?.("[data-sf-modal-panel]"),n=document[u];if(n&&n.panel===s&&n.before.isConnected&&n.after.isConnected)return;if(n?.before.remove(),n?.after.remove(),delete document[u],!s?.parentNode)return;const o={panel:s,relaying:!1};for(const t of["before","after"]){const n=s.ownerDocument.createElement("span");n.tabIndex=0,n.className="sf-modal-focus-guard",n.setAttribute("aria-hidden","true"),n.addEventListener("focus",()=>{if(o.relaying||!s.isConnected||e.inert||"true"===e.getAttribute("aria-hidden"))return;const n="before"===t,i=p(s,n),a=n?i.at(-1):i[0];a&&"IFRAME"!==a.tagName?a.focus({preventScroll:!0}):s.focus({preventScroll:!0})}),o[t]=n}s.before(o.before),s.after(o.after),document[u]=o}(A())}const x=t=>!t.inContainer;function L(t,e=!1){if(!t?.isConnected||"function"!=typeof t.focus||t.matches(":disabled")||t.closest('[inert], [hidden], [aria-hidden="true"]')||!t.getClientRects().length||"visible"!==t.ownerDocument.defaultView.getComputedStyle(t).visibility)return!1;const s=e&&!t.hasAttribute("tabindex");let n;const o=()=>{n?.disconnect(),t.removeEventListener("blur",o),s&&"-1"===t.getAttribute("tabindex")&&t.removeAttribute("tabindex")};s&&(t.setAttribute("tabindex","-1"),t.addEventListener("blur",o,{once:!0}),n=new t.ownerDocument.defaultView.MutationObserver(()=>{t.isConnected||o()}),n.observe(t.ownerDocument.documentElement,{childList:!0,subtree:!0}));let i=!1;try{return t.focus({preventScroll:!0}),i=t.ownerDocument.activeElement===t,i}catch{return!1}finally{s&&!i&&o()}}const k="[data-sf-overlay-container], [data-sf-drawer-container]";function T(...t){return t.filter(Boolean).join(" ").trim()}function N(t="medium"){const e=String(t||"medium").trim().toLowerCase();return["none","small","medium","large"].includes(e)?e:"medium"}function O(t="medium"){return`backdrop-blur-${N(t)}`}function M(t){return["none","small","medium","large"].includes(String(t||"").trim().toLowerCase())}function P(t){return String(t||"").trim()}const F={en:{title:"Dialog",close:"Close"},ru:{title:"Окно",close:"Закрыть"}},B=t=>c(F,"title",t);class I extends t{static componentName="Modal";static registry=new Map;static globalBound=!1;static stack=[];static openCount=0;static uid=0;static lockState=null;static baseZIndex=9e3;static getTopModal(){return A()}static isTopModal(t){return I.getTopModal()===t}static addToStack(t){t&&"inline"!==t.display&&(I.stack=I.stack.filter(e=>e!==t),I.stack.push(t),I.openCount=I.stack.length,function(t,e){const s=E();s.items.includes(t)||(x(t)&&!s.lockOwner&&(s.lockOwner=e,e.lockPage(t.preserveScrollGap)),s.items.push(t),S())}(t,I))}static removeFromStack(t){t&&"inline"!==t.display&&(I.stack=I.stack.filter(e=>e!==t),I.openCount=I.stack.length,function(t){const e=E(),s=e.items.indexOf(t);s<0||(e.items.splice(s,1),e.lockOwner&&!e.items.some(x)&&(e.lockOwner.unlockPage(),e.lockOwner=null),S())}(t))}static bringToFront(t){t&&"inline"!==t.display&&I.stack.includes(t)&&(I.stack=I.stack.filter(e=>e!==t),I.stack.push(t),function(t){const e=E(),s=e.items.indexOf(t);s<0||(e.items.splice(s,1),e.items.push(t),S())}(t))}static updateStackStyles(){S()}constructor(t){super(t);const e=this.params||{};this.modalId=this.id||e.id||"sf-modal-"+ ++I.uid,this.isOpen=!1,this.lastActive=null,this.root=e.root||null,this.container=e.container||null,this.overlay=this.toBoolean(e.overlay,!0),this.unclose=this.toBoolean(e.unclose,!1),this.showClose=this.toBoolean(e.showClose,!0)&&!this.unclose,this.showFooter=this.toBoolean(e.showFooter,!0),this.closeOnEsc=this.toBoolean(e.closeOnEsc,!0)&&!this.unclose,this.closeOnOverlay=this.toBoolean(e.closeOnOverlay,!0)&&!this.unclose,this.preserveScrollGap=this.toBoolean(e.preserveScrollGap,!0),this.autoload=this.toBoolean(e.autoload,!1),this.position=function(t="center"){const e=String(t||"center").trim().toLowerCase();return["center","left","right","inline-start","inline-end","top","bottom"].includes(e)?e:"center"}(e.position),this.fullscreen=this.toBoolean(e.fullscreen,!1),this.mode=function(t){const e=String(t||"inline").trim().toLowerCase();return["inline","ajax","iframe"].includes(e)?e:"inline"}(e.mode),this.display=function(t){const e=String(t||"modal").trim().toLowerCase();return["modal","inline"].includes(e)?e:"modal"}(e.display),this.src=e.src||"",this.preload=this.toBoolean(e.preload,!0),this._fetchController=null,this._contentLoaded=!1,this._contentError=null,this._loadingTimer=null,this._loadingShown=!1,this._loadingDebounceMs=500,this.blur=!!M(e.blur)||this.toBoolean(e.blur,!1),this.hasCustomBlurType=M(e.blurType)||M(e.blur),this.blurType=N(e.blurType||(M(e.blur)?e.blur:"")),this.onOverlayClick=this.onOverlayClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this._modalState="closed",this._stackIndex=-1,this._closeTimer=null,this._closeTransitionAbort=null,this.template=this.buildTemplate(e),this.template.id=this.modalId,this.template.setAttribute("data-sf-modal-id",this.modalId),this.template.setAttribute("aria-hidden","true"),this.init()}overlayHomeFor(t=null){let e=this.container;if("string"==typeof e&&(e=document.querySelector(e)),e instanceof Element)return e.matches(k)||e.setAttribute("data-sf-overlay-container",""),e;return(t instanceof Element?t.closest(k):null)||document.body}get overlayHome(){return this.overlayHomeFor()}get inContainer(){return Boolean(this.template?.parentElement?.closest(k))}placeIn(t){"inline"!==this.display&&!this.root&&this.template&&t&&this.template.parentElement!==t&&t.append(this.template)}emitEvent(t,{cancelable:e=!1,detail:s={}}={}){const n={modal:this,id:this.modalId,isOpen:this.isOpen,...s};let o=!1;if(this.template){const s=new CustomEvent(t,{bubbles:!0,cancelable:e,detail:n});this.template.dispatchEvent(s),o=o||s.defaultPrevented}if("undefined"!=typeof window){const e=new CustomEvent(t,{cancelable:!1,detail:n});window.dispatchEvent(e)}return!o}runCallback(t,e={}){const s=this.params?.[t];if("function"==typeof s)return s({modal:this,id:this.modalId,isOpen:this.isOpen,...e})}emitBeforeOpen(){const t=this.emitEvent("modal:before-open",{cancelable:!0,detail:{phase:"before-open"}}),e=this.emitEvent("SFModalBeforeOpenWindow",{cancelable:!0,detail:{phase:"before-open"}});if(!t||!e)return!1;const s=this.runCallback("beforeOpen",{phase:"before-open"}),n=this.runCallback("beforeOpenWindow",{phase:"before-open"});return!1!==s&&!1!==n}emitAfterOpen(){this.emitEvent("modal:after-open",{detail:{phase:"after-open"}}),this.emitEvent("SFModalAfterOpenWindow",{detail:{phase:"after-open"}}),this.runCallback("afterOpen",{phase:"after-open"}),this.runCallback("afterOpenWindow",{phase:"after-open"})}emitBeforeClose(){const t=this.emitEvent("modal:before-close",{cancelable:!0,detail:{phase:"before-close"}}),e=this.emitEvent("SFModalBeforeCloseWindow",{cancelable:!0,detail:{phase:"before-close"}});if(!t||!e)return!1;const s=this.runCallback("beforeClose",{phase:"before-close"}),n=this.runCallback("beforeCloseWindow",{phase:"before-close"});return!1!==s&&!1!==n}emitAfterClose(){this.emitEvent("modal:after-close",{detail:{phase:"after-close"}}),this.emitEvent("SFModalAfterCloseWindow",{detail:{phase:"after-close"}}),this.runCallback("afterClose",{phase:"after-close"}),this.runCallback("afterCloseWindow",{phase:"after-close"})}toBoolean(t,e){if(null==t)return e;if("boolean"==typeof t)return t;const s=`${t}`.trim().toLowerCase();return!!["1","true","yes","on"].includes(s)||!["0","false","no","off"].includes(s)&&e}getBlurClasses(){return this.hasCustomBlurType?[O(this.blurType)]:[]}setOverlay(t){this.overlay=this.toBoolean(t,!0);const e=this.template?.querySelector("[data-sf-modal-overlay]");return e?(e.classList.toggle("hidden",!this.overlay||"inline"===this.display),this):this}buildTemplate(t){const e="inline"===this.display,s=document.createElement("div");s.className=e?`sf-modal sf-modal--inline sf-modal--position-${this.position} sf-modal--positon-${this.position} inline-block w-full`:`sf-modal sf-modal--position-${this.position} sf-modal--positon-${this.position} hidden fixed top-0 inline-start-0 w-full h-full z-9 p-3 items-cross-center content-main-center`,s.setAttribute("role",e?"region":"dialog"),s.setAttribute("aria-modal",e?"false":"true"),s.setAttribute("data-sf-modal-position",this.position),s.setAttribute("data-sf-modal-fullscreen",String(this.fullscreen)),s.setAttribute("data-sf-modal-display",this.display),s.setAttribute("data-sf-modal-state",e?"inline":"closed");const n=document.createElement("div");n.className=T("absolute top-0 inline-start-0 w-full h-full",this.blur?this.hasCustomBlurType?this.getBlurClasses().join(" "):"bg-surface-overlay":"bg-black opacity-6",t.overlayClass),n.setAttribute("data-sf-modal-overlay",""),this.overlay&&!e||n.classList.add("hidden");const o=document.createElement("section");o.className=T("relative overflow-visible",t.panelClass),o.setAttribute("data-sf-modal-panel","");const i=P(t.width),a=P(t.height);i&&(o.style.setProperty("--sf-modal-width",i),o.setAttribute("data-sf-modal-has-width","")),a&&(o.style.setProperty("--sf-modal-height",a),o.setAttribute("data-sf-modal-has-height",""));const r=document.createElement("div");r.className=T(e?"bg-surface border border-outline-variant radius-surface p-2 flex flex-col gap-1 min-w-0":"bg-surface border border-outline-variant radius-surface shadow-3 p-2 flex flex-col gap-1 min-w-0",t.surfaceClass),r.setAttribute("data-sf-modal-surface","");const l=document.createElement("header");if(l.className=T("sf-modal-header flex items-start min-w-0 border-b border-outline-variant gap-1",t.headerClass),Array.isArray(t.headerNodes)&&t.headerNodes.length)s.setAttribute("aria-label",t.title||B(s)),t.headerNodes.forEach(t=>{t instanceof Node&&l.append(t)});else{const e=document.createElement("h2");if(e.id=`${this.modalId}-title`,s.setAttribute("aria-labelledby",e.id),e.className="sf-modal-header-content title-3 m-0",e.textContent=t.title||B(s),l.append(e),this.showClose){const e=document.createElement("button");e.type="button",e.className=T("sf-icon-button sf-modal-header-action sf-modal-close-button sf-icon-button--close sf-icon-button--link sf-icon-button--on-surface sf-icon-button--size-1/3 m-0",t.closeClass),e.setAttribute("aria-label",c(F,"close",e.isConnected?e:document.documentElement)),e.setAttribute("data-sf-modal-close",this.modalId),e.innerHTML=' <span\n class="sf-close sf-close--size-1/3 flex justify-center items-center"\n aria-hidden="true"\n >\n <span class="sf-close-icon"></span>\n </span>',l.append(e)}}const d=document.createElement("div");d.className="sf-modal-body flex flex-col gap-1 min-w-0 overflow-visible",d.setAttribute("data-sf-modal-body","");const h=document.createElement("div");h.className="sf-modal-body-viewport min-w-0 overflow-visible",h.setAttribute("data-sf-modal-body-viewport","");const m=document.createElement("div");m.className=T("sf-modal-body-scroll h-full min-w-0 overflow-y-auto flex flex-col gap-1 p-1/4",t.bodyClass),m.setAttribute("data-sf-modal-body-scroll","");const u=document.createElement("div");if(u.className="sf-modal-content-placeholder flex flex-col gap-2 min-h-8 items-cross-center content-main-center",u.setAttribute("data-sf-modal-content-placeholder",""),"ajax"!==this.mode&&"iframe"!==this.mode||!this.src){if(Array.isArray(t.contentNodes)&&t.contentNodes.length){const e=document.createElement("div");e.className=T("sf-modal-content flex flex-col gap-2",t.contentClass),t.contentNodes.forEach(t=>{t instanceof Node&&e.append(t)}),m.append(e)}}else this._scheduleLoading(u),m.append(u);if(Array.isArray(t.footerNodes)&&t.footerNodes.length&&this.showFooter){const e=document.createElement("div");e.className=T("sf-modal-footer flex flex-wrap gap-2",t.footerClass),t.footerNodes.forEach(t=>{t instanceof Node&&e.append(t)}),d.append(e)}else if("string"==typeof t.html&&t.html.trim())m.innerHTML=t.html;else if("ajax"===this.mode&&this.src||"iframe"===this.mode&&this.src);else{const e=document.createElement("p");e.className="m-0 text-2",e.textContent=t.text||"",m.append(e)}return h.append(m),d.prepend(h),r.append(l,d),o.append(r),s.append(n,o),s}_scheduleLoading(t){this._cancelLoadingTimer(),this._loadingShown=!1,this._loadingTimer=setTimeout(()=>{this._showLoading(t),this._loadingShown=!0},this._loadingDebounceMs)}_cancelLoadingTimer(){this._loadingTimer&&(clearTimeout(this._loadingTimer),this._loadingTimer=null)}_finishLoading(){this._cancelLoadingTimer()}_showLoading(t){t.innerHTML="";const e=document.createElement("div");e.className="sf-modal-loading flex flex-col gap-2 items-cross-center content-main-center p-4",e.setAttribute("data-sf-modal-state","loading"),e.innerHTML='\n <p class="m-0 text-2 color-on-surface-variant">Loading...</p>\n ',e.prepend(function({className:t="",overlay:e=!1}={}){const s=document.createElement("span");s.className=["sf-loader-container","sf-loader--infinite",t,t&&e?`${t}--overlay`:""].filter(Boolean).join(" "),s.dataset.sfSpinnerBound="1",s.dataset.infinite="true",s.setAttribute("aria-hidden","true");const n=document.createElement("span");return n.className="sf-loader--loading-indicator",n.append(C()),s.append(n),s}({className:"sf-modal-spinner"})),t.append(e)}_showError(t,e){t.innerHTML="";const s=document.createElement("div");s.className="sf-modal-error flex flex-col gap-2 items-cross-center content-main-center p-4",s.setAttribute("data-sf-modal-state","error"),s.innerHTML=`\n <div class="sf-modal-error-icon text-4 color-error">⚠</div>\n <p class="sf-modal-error-text m-0 text-2 color-error">${this.escapeHtml(e||"Failed to load content")}</p>\n `,t.append(s)}_abortFetch(){this._fetchController&&(this._fetchController.abort(),this._fetchController=null)}async _loadContent(){this.src&&("iframe"!==this.mode?"ajax"===this.mode&&this._loadAjax():this._loadIframe())}async _loadAjax(){if(this.src.startsWith("#")){const t=document.querySelector(this.src);if(t){this._emitBeforeContentUpload();const e=t.cloneNode(!0);e.removeAttribute("id"),this._finishLoading(),this._replaceContentWithNode(e),this._contentLoaded=!0,this._emitAfterContentUpload()}else this._contentError=`Element not found: ${this.src}`,this._finishLoading(),this._showContentError();return}this._abortFetch(),this._fetchController=new AbortController;try{this._emitBeforeContentUpload();const t=await fetch(this.src,{signal:this._fetchController.signal});if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);const e=await t.text();this._contentLoaded=!0,this._finishLoading(),this._replaceContentWithHtml(e),this._fetchController=null,this._emitAfterContentUpload()}catch(t){if("AbortError"===t.name)return void this._finishLoading();this._contentError=t.message,this._finishLoading(),this._showContentError()}}_loadIframe(){this._emitBeforeContentUpload();const t=this.template?.querySelector("[data-sf-modal-body-scroll]");if(!t)return;t.innerHTML="";const e=document.createElement("iframe");e.className="sf-modal-iframe w-full border-0 radius-surface",e.src=this.src,e.setAttribute("data-sf-modal-iframe",""),e.setAttribute("allowfullscreen",""),e.style.minHeight="var(--sf-modal-iframe-min-height)",e.style.height="100%",e.addEventListener("load",()=>{this._contentLoaded=!0,this._finishLoading(),this._emitAfterContentUpload()}),e.addEventListener("error",()=>{this._contentError="Failed to load iframe content",this._finishLoading(),this._showContentError()}),t.append(e)}_replaceContentWithNode(t){const e=this.template?.querySelector("[data-sf-modal-body-scroll]");if(!e)return;e.innerHTML="";const s=document.createElement("div");s.className="sf-modal-content flex flex-col gap-2",s.append(t),e.append(s)}_replaceContentWithHtml(t){const e=this.template?.querySelector("[data-sf-modal-body-scroll]");if(!e)return;e.innerHTML="";const s=document.createElement("div");s.className="sf-modal-content flex flex-col gap-2",s.innerHTML=t,e.append(s)}_showContentError(){const t=this.template?.querySelector("[data-sf-modal-body-scroll]");if(!t)return;t.innerHTML="";const e=document.createElement("div");e.className="sf-modal-error flex flex-col gap-2 items-cross-center content-main-center p-4",e.setAttribute("data-sf-modal-state","error"),e.innerHTML=`\n <div class="sf-modal-error-icon text-4 color-error">⚠</div>\n <p class="sf-modal-error-text m-0 text-2 color-error">${this.escapeHtml(this._contentError||"Failed to load content")}</p>\n `,t.append(e)}_emitBeforeContentUpload(){this.emitEvent("modal:before-content-upload",{detail:{src:this.src}}),this.runCallback("beforeContentUpload",{src:this.src})}_emitAfterContentUpload(){this.emitEvent("modal:after-content-upload",{detail:{src:this.src}}),this.runCallback("afterContentUpload",{src:this.src})}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}init(){if("inline"===this.display)return this._modalState="open",this.template.setAttribute("data-sf-modal-state","open"),this.template.classList.remove("hidden"),this.toBoolean(this.params?.open,!0)?this.isOpen=!0:(this.isOpen=!1,this._modalState="closed",this.template.setAttribute("data-sf-modal-state","closed"),this.template.classList.add("hidden")),this.template.setAttribute("aria-hidden",String(!this.isOpen)),this.root&&this.root.append(this.template),I.registry.set(this.modalId,this),void("ajax"!==this.mode&&"iframe"!==this.mode||!this.src||!1===this.preload||this._loadContent());if(this.template.isConnected||this.overlayHome.append(this.template),"inline"===this.display)return this.isOpen=!0,this._modalState="open",this.template.setAttribute("data-sf-modal-state","inline"),this.template.classList.remove("hidden"),I.registry.set(this.modalId,this),void("ajax"!==this.mode&&"iframe"!==this.mode||!this.src||!1===this.preload||this._loadContent());this.template.addEventListener("click",this.onOverlayClick),document.addEventListener("keydown",this.onKeyDown),I.registry.set(this.modalId,this),I.bindGlobalEvents();(this.toBoolean(this.params?.open,!1)||this.autoload)&&requestAnimationFrame(()=>{this.open({animate:!1})}),"ajax"!==this.mode&&"iframe"!==this.mode||!this.src||!1===this.preload||this._loadContent()}destroyInternal(){this._abortFetch(),this._cancelLoadingTimer(),this.cancelCloseTransition(),"inline"===this.display||!this.isOpen&&"closing"!==this._modalState||(this._modalState="closing",this.finishClose()),I.removeFromStack(this),this.template.removeEventListener("click",this.onOverlayClick),document.removeEventListener("keydown",this.onKeyDown),I.registry.delete(this.modalId)}onOverlayClick(t){t.target===this.template.querySelector("[data-sf-modal-overlay]")&&this.closeOnOverlay&&this.close()}onKeyDown(t){if((this.isOpen||"closing"===this._modalState)&&I.isTopModal(this))return"Escape"!==t.key||!this.closeOnEsc||"closing"===this._modalState||t.defaultPrevented||document.documentElement?.dataset?.sfPopoverOpen?void("Tab"===t.key&&this.trapFocus(t)):(t.preventDefault(),t.stopImmediatePropagation(),void this.close())}trapFocus(t){if(!I.isTopModal(this))return;!function(t,e){if(!t)return;const s=p(t,e.shiftKey),n=t.ownerDocument.activeElement;if(!s.length)return e.preventDefault(),void t.focus();const o=s[0],i=s[s.length-1],a=e.shiftKey?o:i;if(!t.contains(n)||n===t||n===a||f(n,a)){const s=e.shiftKey?i:o,n=t.ownerDocument[u];if("IFRAME"===s.tagName&&n?.panel===t){n.relaying=!0;try{(e.shiftKey?n.after:n.before).focus({preventScroll:!0})}finally{n.relaying=!1}return}e.preventDefault(),s.focus()}}(this.template.querySelector("[data-sf-modal-panel]"),t)}focusFirst(){if("inline"!==this.display&&!I.isTopModal(this))return;const t=this.template.querySelector("[data-sf-modal-panel]");t&&(t.setAttribute("tabindex","-1"),t.focus())}applyStackPosition(t=function(t){return E().items.indexOf(t)}(this)){return this._stackIndex=t,this.template&&"inline"!==this.display?t<0?(this.template.style.removeProperty("z-index"),this.template.style.removeProperty("--sf-modal-stack-index"),this):(this.template.style.setProperty("--sf-modal-stack-index",String(t)),this.template.style.zIndex=String(I.baseZIndex+2*t),this):this}open(t={}){const{animate:e=!0}="boolean"==typeof t?{animate:t}:t;if("inline"===this.display){if(this.isOpen)return;if(!this.emitBeforeOpen())return;return this.isOpen=!0,this._modalState="open",this.template.setAttribute("data-sf-modal-state","open"),this.template.classList.remove("hidden"),this.template.setAttribute("aria-hidden","false"),void this.emitAfterOpen()}if(this.isOpen)return I.bringToFront(this),void this.cancelCloseTransition();if(this.emitBeforeOpen()){if(("ajax"===this.mode||"iframe"===this.mode)&&this.src&&!this._contentLoaded&&!this._contentError){const t=this.template?.querySelector("[data-sf-modal-body-scroll]");t&&this._scheduleLoading(t),this._loadContent()}if(this._releaseClosingContent?.(),this._releaseClosingContent=null,"closing"!==this._modalState&&(this.lastActive=document.activeElement,this._focusReturnAncestors=function(t){const e=[];for(let s=t?.parentElement;s;s=s.parentElement)s.matches('main, section, article, [role="main"], [role="region"]')&&e.push(s);return e}(this.lastActive),this.placeIn(this.overlayHomeFor(this.lastActive))),this.cancelCloseTransition(),this.template.classList.remove("hidden"),this.template.classList.add("flex"),this.template.setAttribute("aria-hidden","false"),this.template.classList.toggle("animate",Boolean(e)),this.template.setAttribute("data-sf-modal-state","opening"),this.isOpen=!0,I.addToStack(this),!e)return this._modalState="open",this.template.setAttribute("data-sf-modal-state","open"),this.focusFirst(),void this.emitAfterOpen();b(()=>{this.isOpen&&"closing"!==this._modalState&&(this._modalState="open",this.template.setAttribute("data-sf-modal-state","open"),this.focusFirst(),this.emitAfterOpen())})}}close(){if("inline"===this.display){if(!this.emitBeforeClose())return;return this.isOpen=!1,this._modalState="closed",this.template.setAttribute("data-sf-modal-state","closed"),this.template.classList.add("hidden"),this.template.setAttribute("aria-hidden","true"),void this.emitAfterClose()}if(!this.isOpen||"closing"===this._modalState)return;if(!this.emitBeforeClose())return;this._modalState="closing",this.template.setAttribute("data-sf-modal-state","closing"),this.isOpen=!1;const t=this.template.querySelector("[data-sf-modal-panel]");this._releaseClosingContent=function(t,e=!1){if(!t)return()=>{};const s=new Set,n=()=>{for(const e of t.children)e.hasAttribute("inert")||(e.setAttribute("inert",""),s.add(e))};e&&t.focus({preventScroll:!0}),n();const o=new t.ownerDocument.defaultView.MutationObserver(n);return o.observe(t,{childList:!0}),()=>{o.disconnect();for(const t of s)""===t.getAttribute("inert")&&t.removeAttribute("inert");s.clear()}}(t,I.isTopModal(this)),this._closeTransitionAbort=y(()=>this.template,()=>this.finishClose())}toggle(){this.isOpen?this.close():this.open()}setSrc(t){if(this.src=t||"",this._contentLoaded=!1,this._contentError=null,this._loadingShown=!1,this._abortFetch(),!this.template||!this.isOpen)return this;const e=this.template?.querySelector("[data-sf-modal-body-scroll]");return e&&this._scheduleLoading(e),"ajax"!==this.mode&&"iframe"!==this.mode||!this.src||!1===this.preload||this._loadContent(),this}reloadContent(){if(("ajax"===this.mode||"iframe"===this.mode)&&this.src){this._contentLoaded=!1,this._contentError=null,this._loadingShown=!1,this._abortFetch();const t=this.template?.querySelector("[data-sf-modal-body-scroll]");t&&this._scheduleLoading(t),this._loadContent()}return this}cancelCloseTransition(){this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null),this._closeTransitionAbort&&(this._closeTransitionAbort(),this._closeTransitionAbort=null),"closing"===this._modalState&&(this._modalState="open",this.template.setAttribute("data-sf-modal-state","open"))}finishClose(){if("closing"!==this._modalState)return;this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null),this._closeTransitionAbort&&(this._closeTransitionAbort(),this._closeTransitionAbort=null),this.template.classList.remove("flex"),this.template.classList.add("hidden"),this.template.setAttribute("data-sf-modal-state","closed"),this.template.setAttribute("aria-hidden","true"),this._releaseClosingContent?.(),this._releaseClosingContent=null,this._modalState="closed";const t=I.isTopModal(this);I.removeFromStack(this),function(t,e,s=[]){if(!t)return;const n=A(),o=n?.getModalRoot?.()||n?.template;if((!n||o?.contains(e))&&L(e))return;if(n)return void n.focusFirst();const i=new Set([...s,...document.querySelectorAll('main, [role="main"]'),document.body]);for(const t of i)if(L(t,!0))return}(t,this.lastActive,this._focusReturnAncestors),this.emitAfterClose()}static bindGlobalEvents(){I.globalBound||"undefined"==typeof document||(document.addEventListener("click",t=>{const e=t.target.closest("[data-sf-modal-open]");if(e){const t=e.getAttribute("data-sf-modal-open"),s=I.registry.get(t);return void(s&&s.open())}const s=t.target.closest("[data-sf-modal-close]");if(!s)return;const n=s.getAttribute("data-sf-modal-close");if(n){const t=I.registry.get(n);return void(t&&t.close())}const o=s.closest(".sf-modal");if(!o)return;const i=o.getAttribute("data-sf-modal-id"),a=I.registry.get(i);a&&a.close()}),I.globalBound=!0)}static lockPage(t=!0){I.lockState||(I.lockState=function(t=!0){const e=document.documentElement,s=document.body;if(!e||!s)return null;const n=Math.max(0,window.innerWidth-e.clientWidth),o=parseFloat(window.getComputedStyle(s).paddingInlineEnd)||0,i={docEl:e,body:s,htmlLocked:e.classList.contains("overflow-hidden"),bodyLocked:s.classList.contains("overflow-hidden"),bodyPaddingInlineEnd:s.style.getPropertyValue("padding-inline-end"),paddingPriority:s.style.getPropertyPriority("padding-inline-end"),appliedPadding:null};return e.classList.add("overflow-hidden"),s.classList.add("overflow-hidden"),t&&n>0&&(s.style.setProperty("padding-inline-end",`${o+n}px`,i.paddingPriority),i.appliedPadding=s.style.getPropertyValue("padding-inline-end")),i}(t))}static unlockPage(){!function(t){if(!t)return;const{docEl:e,body:s}=t;t.htmlLocked||e.classList.remove("overflow-hidden"),t.bodyLocked||s.classList.remove("overflow-hidden"),null!==t.appliedPadding&&s.style.getPropertyValue("padding-inline-end")===t.appliedPadding&&s.style.getPropertyPriority("padding-inline-end")===t.paddingPriority&&(t.bodyPaddingInlineEnd?s.style.setProperty("padding-inline-end",t.bodyPaddingInlineEnd,t.paddingPriority):s.style.removeProperty("padding-inline-end"))}(I.lockState),I.lockState=null}}e("Modal",I)})();
|
|
1
|
+
(()=>{"use strict";class t{lifecycleName(){return this.componentName??this.constructor.componentName}constructor(t){this.props=t,this.id=t?.id,this.params=t?.param,this.attrs=t?.attrs||{},this.template=null,window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:beforeRender`,{detail:this}))}getUtilityMap(){return this.constructor.utilityMap||null}extractUtilityClasses(t){if(!Array.isArray(t))return[];const e=new Set;return t.forEach(t=>{if("string"!=typeof t)return;const s=t.match(/\(([^)]+)\)/g);s&&s.forEach(t=>{t.slice(1,-1).split(/\s+/).filter(Boolean).forEach(t=>{t.startsWith(".")&&t.length>1&&e.add(t.slice(1))})})}),Array.from(e)}applyLayoutUtilities(t,e){if(!t||!e)return;const s=this.getUtilityMap();if(!s||!s[e])return;this.extractUtilityClasses(s[e]).forEach(e=>t.classList.add(e))}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(){}}const e=function(t,e){if(t&&e)if("undefined"==typeof window||"function"!=typeof window.registerSfComponent){if("undefined"!=typeof window&&window.SF?.Loader?.registerComponent)window.SF.Loader.registerComponent(t,e);else if("undefined"!=typeof window){(window.SF_PENDING_COMPONENTS=window.SF_PENDING_COMPONENTS||[]).push([t,e])}}else window.registerSfComponent(t,e)},s=(()=>{const t="undefined"!=typeof globalThis?globalThis:{},e="__sfPageLanguage";return t[e]||(t[e]={listeners:new Set,registered:new Map,chosen:null}),t[e]})(),o=s.listeners,n=s.registered,i=t=>String(t??"").trim().toLowerCase().replace("_","-"),a=()=>{for(const t of[...o])try{t()}catch{}};function l(t){let e=t;for(;e;){const t="function"==typeof e.closest?e.closest("[lang]"):null;if(t)return t;const s="function"==typeof e.getRootNode?e.getRootNode():null;e=s&&s!==e&&s.host?s.host:null}return null}function r(t){if(s.chosen)return s.chosen.split("-")[0];const e=l(t),o=e?.getAttribute("lang")||globalThis.document?.documentElement?.lang||"en";return i(o).split("-")[0]||"en"}function d(t){if(s.chosen)return s.chosen;const e=l(t);return i(e?.getAttribute("lang")||globalThis.document?.documentElement?.lang||"en")}function c(t,e,s,o){const a=o??(t=>{const e=t?.tagName;return"string"==typeof e?e.toLowerCase():null})(s);for(const o of(t=>{const e=i(t),s=e.split("-")[0],o=[];for(const t of[e,s,"en"])t&&!o.includes(t)&&o.push(t);return o})(d(s))){const s=a?n.get(a)?.get(o)?.[e]:void 0;if(void 0!==s)return s;const i=t?.[o]?.[e];if(void 0!==i)return i}return e}const h={current:(t=globalThis.document?.documentElement??null)=>d(t),use(t){const e=null==t?null:i(t);return e===s.chosen||(s.chosen=e,a()),s.chosen},register(t,e,s){const o=String(t??"").toLowerCase(),l=i(e);if(!o||!l)throw new TypeError("a component and a language are required");n.has(o)||n.set(o,new Map);const r=n.get(o);return null===s?r.delete(l):r.set(l,{...r.get(l)??{},...s}),a(),this},registerAll(t,e={}){for(const[s,o]of Object.entries(e))this.register(s,t,o);return this},known(t){const e=String(t??"").toLowerCase();return[...n.get(e)?.keys()??[]]},components:()=>[...n.keys()],onChange:t=>"function"!=typeof t?()=>{}:(o.add(t),()=>o.delete(t)),forget(){return n.clear(),s.chosen=null,a(),this}};"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.language=h,window.SF.pageLanguage=r,window.SF.pageText=c);const m=["a[href]","area[href]","button","input","select","textarea","iframe","summary","audio[controls]","video[controls]","[contenteditable]","[tabindex]"].join(","),u=Symbol.for("simai.modal.focus-guards");function f(t,e){return"INPUT"===t?.tagName&&"INPUT"===e?.tagName&&"radio"===t.type&&"radio"===e.type&&!!t.name&&t.name===e.name&&t.form===e.form&&t.getRootNode()===e.getRootNode()}function p(t,e=!1){const s=t.ownerDocument.defaultView,o=Array.from(t.querySelectorAll(m)).filter(t=>t.tabIndex>=0&&!t.matches(":disabled")&&!t.closest("[inert]")&&t.getClientRects().length>0&&"visible"===s.getComputedStyle(t).visibility).sort((t,e)=>(t.tabIndex||1/0)-(e.tabIndex||1/0));return o.filter(t=>{if(!f(t,t))return!0;const s=o.filter(e=>f(t,e)),n=s.find(t=>t.checked);return t===(n||s.at(e?-1:0))})}const g=t=>{const e=Number.parseFloat(t);return Number.isFinite(e)?e*(t.trim().endsWith("ms")?1:1e3):0};function b(t,e=window){let s=!1,o=null,n=null;const i=()=>{s||(s=!0,null!==o&&(e.cancelAnimationFrame(o),o=null),null!==n&&(e.clearTimeout(n),n=null),t())};return o=e.requestAnimationFrame(i),n=e.setTimeout(i,50),"function"==typeof e.queueMicrotask&&e.queueMicrotask(i),()=>{s=!0,null!==o&&e.cancelAnimationFrame(o),null!==n&&e.clearTimeout(n)}}function y(t,e,s=window){let o=null,n=!1;const i=b(()=>{if(n)return;const i=t(),a=i?.querySelectorAll("[data-sf-modal-panel], [data-sf-modal-overlay]")||[],l=Math.max(0,...Array.from(a,t=>{const e=s.getComputedStyle(t);return"none"===e.display?0:function(t){const e=t.transitionProperty.split(",").map(t=>t.trim()),s=t.transitionDuration.split(",").map(g),o=t.transitionDelay.split(",").map(g);return Math.max(0,...e.map((t,e)=>["all","opacity","transform","-webkit-transform"].includes(t)?Math.max(0,s[e%s.length])+o[e%o.length]:0))}(e)}));o=s.setTimeout(()=>{n||e()},l)},s);return()=>{n=!0,i(),null!==o&&s.clearTimeout(o)}}function v(t,e={}){const s=document.createElementNS("http://www.w3.org/2000/svg",t);return Object.entries(e).forEach(([t,e])=>{null!=e&&""!==e&&s.setAttribute(t,String(e))}),s}const w=t=>Math.round(1e3*t)/1e3;function C(t={}){return function({width:t=24,height:e=24,stroke:s=2,dots:o=8,filled:n=3,dotRadius:i=null,direction:a="clockwise",pixel:l=!1}={}){const r=t/2,d=e/2,c=Math.min(t,e)/2,h=Math.max(1,c-s/2),m=v("svg",{class:"sf-loader-svg",viewBox:`0 0 ${t} ${e}`,width:l?t:null,height:l?e:null,"aria-hidden":"true",focusable:"false"}),u={cx:r,cy:d,r:w(h),fill:"none",stroke:"currentColor","stroke-width":s},f=v("circle",{class:"sf-loader-ring-filled",...u,opacity:"0.3"}),p=v("circle",{class:"sf-loader-ring-accent",...u,"stroke-linecap":"round",pathLength:100,"stroke-dasharray":"0 100",transform:`rotate(90 ${r} ${d})`}),g=v("g",{class:"sf-loader-comet",display:"none",transform:`rotate(-90 ${r} ${d})`});for(let t=0;t<10;t+=1){const e=9===t;g.append(v("circle",{class:"sf-loader-comet-segment"+(e?" sf-loader-comet-head":""),...u,"stroke-linecap":e?"round":"butt",pathLength:100,"stroke-dasharray":`${w(4)} ${w(96)}`,"stroke-dashoffset":w(-4*t),opacity:w(((t+1)/10)**1.6)}))}const b=Math.max(3,Math.min(32,Math.floor(Number(o)||8))),y=Math.max(1,Math.min(b,Math.floor(Number(n)||3))),C=Math.min(s,.7*Math.PI*(c-s)/b),_=null==i||""===i?C:Math.max(1,Math.min(Number(i)||C,c/4)),E=Math.max(_,c-_),A=v("g",{class:"sf-loader-dots",display:"none",style:`--sf-loader-dot-count:${b}; --sf-loader-dot-filled:${y};`});for(let t=0;t<b;t+=1){const e=2*Math.PI/b*t-Math.PI/2,s="counterclockwise"===a?t:(b-t)%b;A.append(v("circle",{class:"sf-loader-dot"+(t<y?" sf-loader-dot--active":""),cx:w(r+E*Math.cos(e)),cy:w(d+E*Math.sin(e)),r:w(_),fill:"currentColor",style:`--sf-loader-dot-index:${t}; --sf-loader-dot-step:${s};`}))}return m.append(f,p,g,A),m}({...t,width:24,height:24,stroke:2,dotRadius:null,pixel:!1})}const _=Symbol.for("simai.modal.document-stack");function E(){return document[_]||Object.defineProperty(document,_,{value:{items:[],lockOwner:null},configurable:!0}),document[_]}function A(){return E().items.at(-1)||null}function S(){E().items.forEach((t,e)=>t.applyStackPosition(e)),function(t){const e=t?.getModalRoot?.()||t?.template,s=e?.querySelector?.("[data-sf-modal-panel]"),o=document[u];if(o&&o.panel===s&&o.before.isConnected&&o.after.isConnected)return;if(o?.before.remove(),o?.after.remove(),delete document[u],!s?.parentNode)return;const n={panel:s,relaying:!1};for(const t of["before","after"]){const o=s.ownerDocument.createElement("span");o.tabIndex=0,o.className="sf-modal-focus-guard",o.setAttribute("aria-hidden","true"),o.addEventListener("focus",()=>{if(n.relaying||!s.isConnected||e.inert||"true"===e.getAttribute("aria-hidden"))return;const o="before"===t,i=p(s,o),a=o?i.at(-1):i[0];a&&"IFRAME"!==a.tagName?a.focus({preventScroll:!0}):s.focus({preventScroll:!0})}),n[t]=o}s.before(n.before),s.after(n.after),document[u]=n}(A())}const x=t=>!t.inContainer;function L(t,e=!1){if(!t?.isConnected||"function"!=typeof t.focus||t.matches(":disabled")||t.closest('[inert], [hidden], [aria-hidden="true"]')||!t.getClientRects().length||"visible"!==t.ownerDocument.defaultView.getComputedStyle(t).visibility)return!1;const s=e&&!t.hasAttribute("tabindex");let o;const n=()=>{o?.disconnect(),t.removeEventListener("blur",n),s&&"-1"===t.getAttribute("tabindex")&&t.removeAttribute("tabindex")};s&&(t.setAttribute("tabindex","-1"),t.addEventListener("blur",n,{once:!0}),o=new t.ownerDocument.defaultView.MutationObserver(()=>{t.isConnected||n()}),o.observe(t.ownerDocument.documentElement,{childList:!0,subtree:!0}));let i=!1;try{return t.focus({preventScroll:!0}),i=t.ownerDocument.activeElement===t,i}catch{return!1}finally{s&&!i&&n()}}const k="[data-sf-overlay-container], [data-sf-drawer-container]";function T(...t){return t.filter(Boolean).join(" ").trim()}function N(t="medium"){const e=String(t||"medium").trim().toLowerCase();return["none","small","medium","large"].includes(e)?e:"medium"}function O(t="medium"){return`backdrop-blur-${N(t)}`}function M(t){return["none","small","medium","large"].includes(String(t||"").trim().toLowerCase())}function F(t){return String(t||"").trim()}const P={en:{title:"Dialog",close:"Close",loading:"Loading…",loadFailed:"Failed to load content",frameFailed:"Failed to load iframe content"},ru:{title:"Окно",close:"Закрыть",loading:"Загрузка…",loadFailed:"Не удалось загрузить содержимое",frameFailed:"Не удалось загрузить встроенную страницу"}},B=(t,e)=>c(P,t,e?.isConnected?e:document.documentElement,"sf-modal"),I=t=>c(P,"title",t);class $ extends t{static componentName="Modal";static registry=new Map;static globalBound=!1;static stack=[];static openCount=0;static uid=0;static lockState=null;static baseZIndex=9e3;static getTopModal(){return A()}static isTopModal(t){return $.getTopModal()===t}static addToStack(t){t&&"inline"!==t.display&&($.stack=$.stack.filter(e=>e!==t),$.stack.push(t),$.openCount=$.stack.length,function(t,e){const s=E();s.items.includes(t)||(x(t)&&!s.lockOwner&&(s.lockOwner=e,e.lockPage(t.preserveScrollGap)),s.items.push(t),S())}(t,$))}static removeFromStack(t){t&&"inline"!==t.display&&($.stack=$.stack.filter(e=>e!==t),$.openCount=$.stack.length,function(t){const e=E(),s=e.items.indexOf(t);s<0||(e.items.splice(s,1),e.lockOwner&&!e.items.some(x)&&(e.lockOwner.unlockPage(),e.lockOwner=null),S())}(t))}static bringToFront(t){t&&"inline"!==t.display&&$.stack.includes(t)&&($.stack=$.stack.filter(e=>e!==t),$.stack.push(t),function(t){const e=E(),s=e.items.indexOf(t);s<0||(e.items.splice(s,1),e.items.push(t),S())}(t))}static updateStackStyles(){S()}constructor(t){super(t);const e=this.params||{};this.modalId=this.id||e.id||"sf-modal-"+ ++$.uid,this.isOpen=!1,this.lastActive=null,this.root=e.root||null,this.container=e.container||null,this.overlay=this.toBoolean(e.overlay,!0),this.unclose=this.toBoolean(e.unclose,!1),this.showClose=this.toBoolean(e.showClose,!0)&&!this.unclose,this.showFooter=this.toBoolean(e.showFooter,!0),this.closeOnEsc=this.toBoolean(e.closeOnEsc,!0)&&!this.unclose,this.closeOnOverlay=this.toBoolean(e.closeOnOverlay,!0)&&!this.unclose,this.preserveScrollGap=this.toBoolean(e.preserveScrollGap,!0),this.autoload=this.toBoolean(e.autoload,!1),this.position=function(t="center"){const e=String(t||"center").trim().toLowerCase();return["center","left","right","inline-start","inline-end","top","bottom"].includes(e)?e:"center"}(e.position),this.fullscreen=this.toBoolean(e.fullscreen,!1),this.mode=function(t){const e=String(t||"inline").trim().toLowerCase();return["inline","ajax","iframe"].includes(e)?e:"inline"}(e.mode),this.display=function(t){const e=String(t||"modal").trim().toLowerCase();return["modal","inline"].includes(e)?e:"modal"}(e.display),this.src=e.src||"",this.preload=this.toBoolean(e.preload,!0),this._fetchController=null,this._contentLoaded=!1,this._contentError=null,this._loadingTimer=null,this._loadingShown=!1,this._loadingDebounceMs=500,this.blur=!!M(e.blur)||this.toBoolean(e.blur,!1),this.hasCustomBlurType=M(e.blurType)||M(e.blur),this.blurType=N(e.blurType||(M(e.blur)?e.blur:"")),this.onOverlayClick=this.onOverlayClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this._modalState="closed",this._stackIndex=-1,this._closeTimer=null,this._closeTransitionAbort=null,this.template=this.buildTemplate(e),this.template.id=this.modalId,this.template.setAttribute("data-sf-modal-id",this.modalId),this.template.setAttribute("aria-hidden","true"),this.init()}overlayHomeFor(t=null){let e=this.container;if("string"==typeof e&&(e=document.querySelector(e)),e instanceof Element)return e.matches(k)||e.setAttribute("data-sf-overlay-container",""),e;return(t instanceof Element?t.closest(k):null)||document.body}get overlayHome(){return this.overlayHomeFor()}get inContainer(){return Boolean(this.template?.parentElement?.closest(k))}placeIn(t){"inline"!==this.display&&!this.root&&this.template&&t&&this.template.parentElement!==t&&t.append(this.template)}emitEvent(t,{cancelable:e=!1,detail:s={}}={}){const o={modal:this,id:this.modalId,isOpen:this.isOpen,...s};let n=!1;if(this.template){const s=new CustomEvent(t,{bubbles:!0,cancelable:e,detail:o});this.template.dispatchEvent(s),n=n||s.defaultPrevented}if("undefined"!=typeof window){const e=new CustomEvent(t,{cancelable:!1,detail:o});window.dispatchEvent(e)}return!n}runCallback(t,e={}){const s=this.params?.[t];if("function"==typeof s)return s({modal:this,id:this.modalId,isOpen:this.isOpen,...e})}emitBeforeOpen(){const t=this.emitEvent("modal:before-open",{cancelable:!0,detail:{phase:"before-open"}}),e=this.emitEvent("SFModalBeforeOpenWindow",{cancelable:!0,detail:{phase:"before-open"}});if(!t||!e)return!1;const s=this.runCallback("beforeOpen",{phase:"before-open"}),o=this.runCallback("beforeOpenWindow",{phase:"before-open"});return!1!==s&&!1!==o}emitAfterOpen(){this.emitEvent("modal:after-open",{detail:{phase:"after-open"}}),this.emitEvent("SFModalAfterOpenWindow",{detail:{phase:"after-open"}}),this.runCallback("afterOpen",{phase:"after-open"}),this.runCallback("afterOpenWindow",{phase:"after-open"})}emitBeforeClose(){const t=this.emitEvent("modal:before-close",{cancelable:!0,detail:{phase:"before-close"}}),e=this.emitEvent("SFModalBeforeCloseWindow",{cancelable:!0,detail:{phase:"before-close"}});if(!t||!e)return!1;const s=this.runCallback("beforeClose",{phase:"before-close"}),o=this.runCallback("beforeCloseWindow",{phase:"before-close"});return!1!==s&&!1!==o}emitAfterClose(){this.emitEvent("modal:after-close",{detail:{phase:"after-close"}}),this.emitEvent("SFModalAfterCloseWindow",{detail:{phase:"after-close"}}),this.runCallback("afterClose",{phase:"after-close"}),this.runCallback("afterCloseWindow",{phase:"after-close"})}toBoolean(t,e){if(null==t)return e;if("boolean"==typeof t)return t;const s=`${t}`.trim().toLowerCase();return!!["1","true","yes","on"].includes(s)||!["0","false","no","off"].includes(s)&&e}getBlurClasses(){return this.hasCustomBlurType?[O(this.blurType)]:[]}setOverlay(t){this.overlay=this.toBoolean(t,!0);const e=this.template?.querySelector("[data-sf-modal-overlay]");return e?(e.classList.toggle("hidden",!this.overlay||"inline"===this.display),this):this}buildTemplate(t){const e="inline"===this.display,s=document.createElement("div");s.className=e?`sf-modal sf-modal--inline sf-modal--position-${this.position} sf-modal--positon-${this.position} inline-block w-full`:`sf-modal sf-modal--position-${this.position} sf-modal--positon-${this.position} hidden fixed top-0 inline-start-0 w-full h-full z-9 p-3 items-cross-center content-main-center`,s.setAttribute("role",e?"region":"dialog"),s.setAttribute("aria-modal",e?"false":"true"),s.setAttribute("data-sf-modal-position",this.position),s.setAttribute("data-sf-modal-fullscreen",String(this.fullscreen)),s.setAttribute("data-sf-modal-display",this.display),s.setAttribute("data-sf-modal-state",e?"inline":"closed");const o=document.createElement("div");o.className=T("absolute top-0 inline-start-0 w-full h-full",this.blur?this.hasCustomBlurType?this.getBlurClasses().join(" "):"bg-surface-overlay":"bg-black opacity-6",t.overlayClass),o.setAttribute("data-sf-modal-overlay",""),this.overlay&&!e||o.classList.add("hidden");const n=document.createElement("section");n.className=T("relative overflow-visible",t.panelClass),n.setAttribute("data-sf-modal-panel","");const i=F(t.width),a=F(t.height);i&&(n.style.setProperty("--sf-modal-width",i),n.setAttribute("data-sf-modal-has-width","")),a&&(n.style.setProperty("--sf-modal-height",a),n.setAttribute("data-sf-modal-has-height",""));const l=document.createElement("div");l.className=T(e?"bg-surface border border-outline-variant radius-surface p-2 flex flex-col gap-1 min-w-0":"bg-surface border border-outline-variant radius-surface shadow-3 p-2 flex flex-col gap-1 min-w-0",t.surfaceClass),l.setAttribute("data-sf-modal-surface","");const r=document.createElement("header");if(r.className=T("sf-modal-header flex items-start min-w-0 border-b border-outline-variant gap-1",t.headerClass),Array.isArray(t.headerNodes)&&t.headerNodes.length)s.setAttribute("aria-label",t.title||I(s)),t.headerNodes.forEach(t=>{t instanceof Node&&r.append(t)});else{const e=document.createElement("h2");if(e.id=`${this.modalId}-title`,s.setAttribute("aria-labelledby",e.id),e.className="sf-modal-header-content title-3 m-0",e.textContent=t.title||I(s),r.append(e),this.showClose){const e=document.createElement("button");e.type="button",e.className=T("sf-icon-button sf-modal-header-action sf-modal-close-button sf-icon-button--close sf-icon-button--link sf-icon-button--on-surface sf-icon-button--size-1/3 m-0",t.closeClass),e.setAttribute("aria-label",c(P,"close",e.isConnected?e:document.documentElement)),e.setAttribute("data-sf-modal-close",this.modalId),e.innerHTML=' <span\n class="sf-close sf-close--size-1/3 flex justify-center items-center"\n aria-hidden="true"\n >\n <span class="sf-close-icon"></span>\n </span>',r.append(e)}}const d=document.createElement("div");d.className="sf-modal-body flex flex-col gap-1 min-w-0 overflow-visible",d.setAttribute("data-sf-modal-body","");const h=document.createElement("div");h.className="sf-modal-body-viewport min-w-0 overflow-visible",h.setAttribute("data-sf-modal-body-viewport","");const m=document.createElement("div");m.className=T("sf-modal-body-scroll h-full min-w-0 overflow-y-auto flex flex-col gap-1 p-1/4",t.bodyClass),m.setAttribute("data-sf-modal-body-scroll","");const u=document.createElement("div");if(u.className="sf-modal-content-placeholder flex flex-col gap-2 min-h-8 items-cross-center content-main-center",u.setAttribute("data-sf-modal-content-placeholder",""),"ajax"!==this.mode&&"iframe"!==this.mode||!this.src){if(Array.isArray(t.contentNodes)&&t.contentNodes.length){const e=document.createElement("div");e.className=T("sf-modal-content flex flex-col gap-2",t.contentClass),t.contentNodes.forEach(t=>{t instanceof Node&&e.append(t)}),m.append(e)}}else this._scheduleLoading(u),m.append(u);if(Array.isArray(t.footerNodes)&&t.footerNodes.length&&this.showFooter){const e=document.createElement("div");e.className=T("sf-modal-footer flex flex-wrap gap-2",t.footerClass),t.footerNodes.forEach(t=>{t instanceof Node&&e.append(t)}),d.append(e)}else if("string"==typeof t.html&&t.html.trim())m.innerHTML=t.html;else if("ajax"===this.mode&&this.src||"iframe"===this.mode&&this.src);else{const e=document.createElement("p");e.className="m-0 text-2",e.textContent=t.text||"",m.append(e)}return h.append(m),d.prepend(h),l.append(r,d),n.append(l),s.append(o,n),s}_scheduleLoading(t){this._cancelLoadingTimer(),this._loadingShown=!1,this._loadingTimer=setTimeout(()=>{this._showLoading(t),this._loadingShown=!0},this._loadingDebounceMs)}_cancelLoadingTimer(){this._loadingTimer&&(clearTimeout(this._loadingTimer),this._loadingTimer=null)}_finishLoading(){this._cancelLoadingTimer()}_showLoading(t){t.innerHTML="";const e=document.createElement("div");e.className="sf-modal-loading flex flex-col gap-2 items-cross-center content-main-center p-4",e.setAttribute("data-sf-modal-state","loading");const s=B("loading",this.template);e.setAttribute("role","status"),e.setAttribute("aria-label",s);const o=document.createElement("p");o.className="m-0 text-2 color-on-surface-variant",o.textContent=s,e.append(o),e.prepend(function({className:t="",overlay:e=!1}={}){const s=document.createElement("span");s.className=["sf-loader-container","sf-loader--infinite",t,t&&e?`${t}--overlay`:""].filter(Boolean).join(" "),s.dataset.sfSpinnerBound="1",s.dataset.infinite="true",s.setAttribute("aria-hidden","true");const o=document.createElement("span");return o.className="sf-loader--loading-indicator",o.append(C()),s.append(o),s}({className:"sf-modal-spinner"})),t.append(e)}_showError(t,e){t.innerHTML="";const s=document.createElement("div");s.className="sf-modal-error flex flex-col gap-2 items-cross-center content-main-center p-4",s.setAttribute("data-sf-modal-state","error"),s.innerHTML=`\n <div class="sf-modal-error-icon text-4 color-error">⚠</div>\n <p class="sf-modal-error-text m-0 text-2 color-error">${this.escapeHtml(e||B("loadFailed",this.template))}</p>\n `,t.append(s)}_abortFetch(){this._fetchController&&(this._fetchController.abort(),this._fetchController=null)}async _loadContent(){this.src&&("iframe"!==this.mode?"ajax"===this.mode&&this._loadAjax():this._loadIframe())}async _loadAjax(){if(this.src.startsWith("#")){const t=document.querySelector(this.src);if(t){this._emitBeforeContentUpload();const e=t.cloneNode(!0);e.removeAttribute("id"),this._finishLoading(),this._replaceContentWithNode(e),this._contentLoaded=!0,this._emitAfterContentUpload()}else this._contentError=`Element not found: ${this.src}`,this._finishLoading(),this._showContentError();return}this._abortFetch();const t=new AbortController;this._fetchController=t;try{this._emitBeforeContentUpload();const e=await fetch(this.src,{signal:t.signal});if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);const s=await e.text();this._contentLoaded=!0,this._finishLoading(),this._replaceContentWithHtml(s),this._fetchController=null,this._emitAfterContentUpload()}catch(e){if("AbortError"===e.name)return void(this._fetchController&&this._fetchController!==t||this._finishLoading());this._contentError=e.message,this._finishLoading(),this._showContentError()}}_loadIframe(){this._emitBeforeContentUpload();const t=this.template?.querySelector("[data-sf-modal-body-scroll]");if(!t)return;t.innerHTML="";const e=document.createElement("iframe");e.className="sf-modal-iframe w-full border-0 radius-surface",e.src=this.src,e.setAttribute("data-sf-modal-iframe",""),e.setAttribute("allowfullscreen",""),e.style.minHeight="var(--sf-modal-iframe-min-height)",e.style.height="100%",e.addEventListener("load",()=>{this._contentLoaded=!0,this._finishLoading(),this._emitAfterContentUpload()}),e.addEventListener("error",()=>{this._contentError=B("frameFailed",this.template),this._finishLoading(),this._showContentError()}),t.append(e)}_replaceContentWithNode(t){const e=this.template?.querySelector("[data-sf-modal-body-scroll]");if(!e)return;e.innerHTML="";const s=document.createElement("div");s.className="sf-modal-content flex flex-col gap-2",s.append(t),e.append(s)}_replaceContentWithHtml(t){const e=this.template?.querySelector("[data-sf-modal-body-scroll]");if(!e)return;e.innerHTML="";const s=document.createElement("div");s.className="sf-modal-content flex flex-col gap-2",s.innerHTML=t,e.append(s)}_showContentError(){const t=this.template?.querySelector("[data-sf-modal-body-scroll]");if(!t)return;t.innerHTML="";const e=document.createElement("div");e.className="sf-modal-error flex flex-col gap-2 items-cross-center content-main-center p-4",e.setAttribute("data-sf-modal-state","error"),e.innerHTML=`\n <div class="sf-modal-error-icon text-4 color-error">⚠</div>\n <p class="sf-modal-error-text m-0 text-2 color-error">${this.escapeHtml(this._contentError||B("loadFailed",this.template))}</p>\n `,t.append(e)}_emitBeforeContentUpload(){this.emitEvent("modal:before-content-upload",{detail:{src:this.src}}),this.runCallback("beforeContentUpload",{src:this.src})}_emitAfterContentUpload(){this.emitEvent("modal:after-content-upload",{detail:{src:this.src}}),this.runCallback("afterContentUpload",{src:this.src})}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}init(){if("inline"===this.display)return this._modalState="open",this.template.setAttribute("data-sf-modal-state","open"),this.template.classList.remove("hidden"),this.toBoolean(this.params?.open,!0)?this.isOpen=!0:(this.isOpen=!1,this._modalState="closed",this.template.setAttribute("data-sf-modal-state","closed"),this.template.classList.add("hidden")),this.template.setAttribute("aria-hidden",String(!this.isOpen)),this.root&&this.root.append(this.template),$.registry.set(this.modalId,this),void("ajax"!==this.mode&&"iframe"!==this.mode||!this.src||!1===this.preload||this._loadContent());if(this.template.isConnected||this.overlayHome.append(this.template),"inline"===this.display)return this.isOpen=!0,this._modalState="open",this.template.setAttribute("data-sf-modal-state","inline"),this.template.classList.remove("hidden"),$.registry.set(this.modalId,this),void("ajax"!==this.mode&&"iframe"!==this.mode||!this.src||!1===this.preload||this._loadContent());this.template.addEventListener("click",this.onOverlayClick),document.addEventListener("keydown",this.onKeyDown),$.registry.set(this.modalId,this),$.bindGlobalEvents();(this.toBoolean(this.params?.open,!1)||this.autoload)&&requestAnimationFrame(()=>{this.open({animate:!1})}),"ajax"!==this.mode&&"iframe"!==this.mode||!this.src||!1===this.preload||this._loadContent()}destroyInternal(){this._abortFetch(),this._cancelLoadingTimer(),this.cancelCloseTransition(),"inline"===this.display||!this.isOpen&&"closing"!==this._modalState||(this._modalState="closing",this.finishClose()),$.removeFromStack(this),this.template.removeEventListener("click",this.onOverlayClick),document.removeEventListener("keydown",this.onKeyDown),$.registry.delete(this.modalId)}onOverlayClick(t){t.target===this.template.querySelector("[data-sf-modal-overlay]")&&this.closeOnOverlay&&this.close()}onKeyDown(t){if((this.isOpen||"closing"===this._modalState)&&$.isTopModal(this))return"Escape"!==t.key||!this.closeOnEsc||"closing"===this._modalState||t.defaultPrevented||document.documentElement?.dataset?.sfPopoverOpen?void("Tab"===t.key&&this.trapFocus(t)):(t.preventDefault(),t.stopImmediatePropagation(),void this.close())}trapFocus(t){if(!$.isTopModal(this))return;!function(t,e){if(!t)return;const s=p(t,e.shiftKey),o=t.ownerDocument.activeElement;if(!s.length)return e.preventDefault(),void t.focus();const n=s[0],i=s[s.length-1],a=e.shiftKey?n:i;if(!t.contains(o)||o===t||o===a||f(o,a)){const s=e.shiftKey?i:n,o=t.ownerDocument[u];if("IFRAME"===s.tagName&&o?.panel===t){o.relaying=!0;try{(e.shiftKey?o.after:o.before).focus({preventScroll:!0})}finally{o.relaying=!1}return}e.preventDefault(),s.focus()}}(this.template.querySelector("[data-sf-modal-panel]"),t)}focusFirst(){if("inline"!==this.display&&!$.isTopModal(this))return;const t=this.template.querySelector("[data-sf-modal-panel]");t&&(t.setAttribute("tabindex","-1"),t.focus())}applyStackPosition(t=function(t){return E().items.indexOf(t)}(this)){return this._stackIndex=t,this.template&&"inline"!==this.display?t<0?(this.template.style.removeProperty("z-index"),this.template.style.removeProperty("--sf-modal-stack-index"),this):(this.template.style.setProperty("--sf-modal-stack-index",String(t)),this.template.style.zIndex=String($.baseZIndex+2*t),this):this}open(t={}){const{animate:e=!0}="boolean"==typeof t?{animate:t}:t;if("inline"===this.display){if(this.isOpen)return;if(!this.emitBeforeOpen())return;return this.isOpen=!0,this._modalState="open",this.template.setAttribute("data-sf-modal-state","open"),this.template.classList.remove("hidden"),this.template.setAttribute("aria-hidden","false"),void this.emitAfterOpen()}if(this.isOpen)return $.bringToFront(this),void this.cancelCloseTransition();if(this.emitBeforeOpen()){if(("ajax"===this.mode||"iframe"===this.mode)&&this.src&&!this._contentLoaded&&!this._contentError){const t=this.template?.querySelector("[data-sf-modal-body-scroll]");t&&this._scheduleLoading(t),this._loadContent()}if(this._releaseClosingContent?.(),this._releaseClosingContent=null,"closing"!==this._modalState&&(this.lastActive=document.activeElement,this._focusReturnAncestors=function(t){const e=[];for(let s=t?.parentElement;s;s=s.parentElement)s.matches('main, section, article, [role="main"], [role="region"]')&&e.push(s);return e}(this.lastActive),this.placeIn(this.overlayHomeFor(this.lastActive))),this.cancelCloseTransition(),this.template.classList.remove("hidden"),this.template.classList.add("flex"),this.template.setAttribute("aria-hidden","false"),this.template.classList.toggle("animate",Boolean(e)),this.template.setAttribute("data-sf-modal-state","opening"),this.isOpen=!0,$.addToStack(this),!e)return this._modalState="open",this.template.setAttribute("data-sf-modal-state","open"),this.focusFirst(),void this.emitAfterOpen();b(()=>{this.isOpen&&"closing"!==this._modalState&&(this._modalState="open",this.template.setAttribute("data-sf-modal-state","open"),this.focusFirst(),this.emitAfterOpen())})}}close(){if("inline"===this.display){if(!this.emitBeforeClose())return;return this.isOpen=!1,this._modalState="closed",this.template.setAttribute("data-sf-modal-state","closed"),this.template.classList.add("hidden"),this.template.setAttribute("aria-hidden","true"),void this.emitAfterClose()}if(!this.isOpen||"closing"===this._modalState)return;if(!this.emitBeforeClose())return;this._modalState="closing",this.template.setAttribute("data-sf-modal-state","closing"),this.isOpen=!1;const t=this.template.querySelector("[data-sf-modal-panel]");this._releaseClosingContent=function(t,e=!1){if(!t)return()=>{};const s=new Set,o=()=>{for(const e of t.children)e.hasAttribute("inert")||(e.setAttribute("inert",""),s.add(e))};e&&t.focus({preventScroll:!0}),o();const n=new t.ownerDocument.defaultView.MutationObserver(o);return n.observe(t,{childList:!0}),()=>{n.disconnect();for(const t of s)""===t.getAttribute("inert")&&t.removeAttribute("inert");s.clear()}}(t,$.isTopModal(this)),this._closeTransitionAbort=y(()=>this.template,()=>this.finishClose())}toggle(){this.isOpen?this.close():this.open()}setSrc(t){if(this.src=t||"",this._contentLoaded=!1,this._contentError=null,this._loadingShown=!1,this._abortFetch(),!this.template||!this.isOpen)return this;const e=this.template?.querySelector("[data-sf-modal-body-scroll]");return e&&this._scheduleLoading(e),"ajax"!==this.mode&&"iframe"!==this.mode||!this.src||!1===this.preload||this._loadContent(),this}reloadContent(){if(("ajax"===this.mode||"iframe"===this.mode)&&this.src){this._contentLoaded=!1,this._contentError=null,this._loadingShown=!1,this._abortFetch();const t=this.template?.querySelector("[data-sf-modal-body-scroll]");t&&this._scheduleLoading(t),this._loadContent()}return this}cancelCloseTransition(){this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null),this._closeTransitionAbort&&(this._closeTransitionAbort(),this._closeTransitionAbort=null),"closing"===this._modalState&&(this._modalState="open",this.template.setAttribute("data-sf-modal-state","open"))}finishClose(){if("closing"!==this._modalState)return;this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null),this._closeTransitionAbort&&(this._closeTransitionAbort(),this._closeTransitionAbort=null),this.template.classList.remove("flex"),this.template.classList.add("hidden"),this.template.setAttribute("data-sf-modal-state","closed"),this.template.setAttribute("aria-hidden","true"),this._releaseClosingContent?.(),this._releaseClosingContent=null,this._modalState="closed";const t=$.isTopModal(this);$.removeFromStack(this),function(t,e,s=[]){if(!t)return;const o=A(),n=o?.getModalRoot?.()||o?.template;if((!o||n?.contains(e))&&L(e))return;if(o)return void o.focusFirst();const i=new Set([...s,...document.querySelectorAll('main, [role="main"]'),document.body]);for(const t of i)if(L(t,!0))return}(t,this.lastActive,this._focusReturnAncestors),this.emitAfterClose()}static bindGlobalEvents(){$.globalBound||"undefined"==typeof document||(document.addEventListener("click",t=>{const e=t.target.closest("[data-sf-modal-open]");if(e){const t=e.getAttribute("data-sf-modal-open"),s=$.registry.get(t);return void(s&&s.open())}const s=t.target.closest("[data-sf-modal-close]");if(!s)return;const o=s.getAttribute("data-sf-modal-close");if(o){const t=$.registry.get(o);return void(t&&t.close())}const n=s.closest(".sf-modal");if(!n)return;const i=n.getAttribute("data-sf-modal-id"),a=$.registry.get(i);a&&a.close()}),$.globalBound=!0)}static lockPage(t=!0){$.lockState||($.lockState=function(t=!0){const e=document.documentElement,s=document.body;if(!e||!s)return null;const o=Math.max(0,window.innerWidth-e.clientWidth),n=parseFloat(window.getComputedStyle(s).paddingInlineEnd)||0,i={docEl:e,body:s,htmlLocked:e.classList.contains("overflow-hidden"),bodyLocked:s.classList.contains("overflow-hidden"),bodyPaddingInlineEnd:s.style.getPropertyValue("padding-inline-end"),paddingPriority:s.style.getPropertyPriority("padding-inline-end"),appliedPadding:null};return e.classList.add("overflow-hidden"),s.classList.add("overflow-hidden"),t&&o>0&&(s.style.setProperty("padding-inline-end",`${n+o}px`,i.paddingPriority),i.appliedPadding=s.style.getPropertyValue("padding-inline-end")),i}(t))}static unlockPage(){!function(t){if(!t)return;const{docEl:e,body:s}=t;t.htmlLocked||e.classList.remove("overflow-hidden"),t.bodyLocked||s.classList.remove("overflow-hidden"),null!==t.appliedPadding&&s.style.getPropertyValue("padding-inline-end")===t.appliedPadding&&s.style.getPropertyPriority("padding-inline-end")===t.paddingPriority&&(t.bodyPaddingInlineEnd?s.style.setProperty("padding-inline-end",t.bodyPaddingInlineEnd,t.paddingPriority):s.style.removeProperty("padding-inline-end"))}($.lockState),$.lockState=null}}e("Modal",$)})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{"use strict";var e={"3f3a6e2680d5"(e,t,o){function i(e,t=!1){if(!e)return()=>{};const o=new Set,i=()=>{for(const t of e.children)t.hasAttribute("inert")||(t.setAttribute("inert",""),o.add(t))};t&&e.focus({preventScroll:!0}),i();const s=new e.ownerDocument.defaultView.MutationObserver(i);return s.observe(e,{childList:!0}),()=>{s.disconnect();for(const e of o)""===e.getAttribute("inert")&&e.removeAttribute("inert");o.clear()}}o.d(t,{e:()=>i})},c8d66dd2c299(e,t,o){o.d(t,{Zg:()=>l,ro:()=>n});const i=["a[href]","area[href]","button","input","select","textarea","iframe","summary","audio[controls]","video[controls]","[contenteditable]","[tabindex]"].join(","),s=Symbol.for("simai.modal.focus-guards");function n(e){const t=e?.getModalRoot?.()||e?.template,o=t?.querySelector?.("[data-sf-modal-panel]"),i=document[s];if(i&&i.panel===o&&i.before.isConnected&&i.after.isConnected)return;if(i?.before.remove(),i?.after.remove(),delete document[s],!o?.parentNode)return;const n={panel:o,relaying:!1};for(const e of["before","after"]){const i=o.ownerDocument.createElement("span");i.tabIndex=0,i.className="sf-modal-focus-guard",i.setAttribute("aria-hidden","true"),i.addEventListener("focus",()=>{if(n.relaying||!o.isConnected||t.inert||"true"===t.getAttribute("aria-hidden"))return;const i="before"===e,s=r(o,i),a=i?s.at(-1):s[0];a&&"IFRAME"!==a.tagName?a.focus({preventScroll:!0}):o.focus({preventScroll:!0})}),n[e]=i}o.before(n.before),o.after(n.after),document[s]=n}function a(e,t){return"INPUT"===e?.tagName&&"INPUT"===t?.tagName&&"radio"===e.type&&"radio"===t.type&&!!e.name&&e.name===t.name&&e.form===t.form&&e.getRootNode()===t.getRootNode()}function r(e,t=!1){const o=e.ownerDocument.defaultView,s=Array.from(e.querySelectorAll(i)).filter(e=>e.tabIndex>=0&&!e.matches(":disabled")&&!e.closest("[inert]")&&e.getClientRects().length>0&&"visible"===o.getComputedStyle(e).visibility).sort((e,t)=>(e.tabIndex||1/0)-(t.tabIndex||1/0));return s.filter(e=>{if(!a(e,e))return!0;const o=s.filter(t=>a(e,t)),i=o.find(e=>e.checked);return e===(i||o.at(t?-1:0))})}function l(e,t){if(!e)return;const o=r(e,t.shiftKey),i=e.ownerDocument.activeElement;if(!o.length)return t.preventDefault(),void e.focus();const n=o[0],l=o[o.length-1],d=t.shiftKey?n:l;if(!e.contains(i)||i===e||i===d||a(i,d)){const o=t.shiftKey?l:n,i=e.ownerDocument[s];if("IFRAME"===o.tagName&&i?.panel===e){i.relaying=!0;try{(t.shiftKey?i.after:i.before).focus({preventScroll:!0})}finally{i.relaying=!1}return}t.preventDefault(),o.focus()}}},"201fd0b17b8b"(e,t,o){o.d(t,{Gp:()=>s,ju:()=>n});const i=e=>{const t=Number.parseFloat(e);return Number.isFinite(t)?t*(e.trim().endsWith("ms")?1:1e3):0};function s(e,t=window){let o=!1,i=null,s=null;const n=()=>{o||(o=!0,null!==i&&(t.cancelAnimationFrame(i),i=null),null!==s&&(t.clearTimeout(s),s=null),e())};return i=t.requestAnimationFrame(n),s=t.setTimeout(n,50),"function"==typeof t.queueMicrotask&&t.queueMicrotask(n),()=>{o=!0,null!==i&&t.cancelAnimationFrame(i),null!==s&&t.clearTimeout(s)}}function n(e,t,o=window){let n=null,a=!1;const r=s(()=>{if(a)return;const s=e(),r=s?.querySelectorAll("[data-sf-modal-panel], [data-sf-modal-overlay]")||[],l=Math.max(0,...Array.from(r,e=>{const t=o.getComputedStyle(e);return"none"===t.display?0:function(e){const t=e.transitionProperty.split(",").map(e=>e.trim()),o=e.transitionDuration.split(",").map(i),s=e.transitionDelay.split(",").map(i);return Math.max(0,...t.map((e,t)=>["all","opacity","transform","-webkit-transform"].includes(e)?Math.max(0,o[t%o.length])+s[t%s.length]:0))}(t)}));n=o.setTimeout(()=>{a||t()},l)},o);return()=>{a=!0,r(),null!==n&&o.clearTimeout(n)}}},ed3ae3576d0a(e,t,o){function i(e=!0){const t=document.documentElement,o=document.body;if(!t||!o)return null;const i=Math.max(0,window.innerWidth-t.clientWidth),s=parseFloat(window.getComputedStyle(o).paddingInlineEnd)||0,n={docEl:t,body:o,htmlLocked:t.classList.contains("overflow-hidden"),bodyLocked:o.classList.contains("overflow-hidden"),bodyPaddingInlineEnd:o.style.getPropertyValue("padding-inline-end"),paddingPriority:o.style.getPropertyPriority("padding-inline-end"),appliedPadding:null};return t.classList.add("overflow-hidden"),o.classList.add("overflow-hidden"),e&&i>0&&(o.style.setProperty("padding-inline-end",`${s+i}px`,n.paddingPriority),n.appliedPadding=o.style.getPropertyValue("padding-inline-end")),n}function s(e){if(!e)return;const{docEl:t,body:o}=e;e.htmlLocked||t.classList.remove("overflow-hidden"),e.bodyLocked||o.classList.remove("overflow-hidden"),null!==e.appliedPadding&&o.style.getPropertyValue("padding-inline-end")===e.appliedPadding&&o.style.getPropertyPriority("padding-inline-end")===e.paddingPriority&&(e.bodyPaddingInlineEnd?o.style.setProperty("padding-inline-end",e.bodyPaddingInlineEnd,e.paddingPriority):o.style.removeProperty("padding-inline-end"))}o.d(t,{i:()=>i,l:()=>s})},"93025a68d8ab"(e,t,o){o.d(t,{BK:()=>p,M$:()=>m,Rm:()=>u,ZT:()=>c,fI:()=>r,k8:()=>h,oN:()=>a,rI:()=>l});var i=o("c8d66dd2c299");const s=Symbol.for("simai.modal.document-stack");function n(){return document[s]||Object.defineProperty(document,s,{value:{items:[],lockOwner:null},configurable:!0}),document[s]}function a(){return n().items.at(-1)||null}function r(e){return n().items.indexOf(e)}function l(){n().items.forEach((e,t)=>e.applyStackPosition(t)),(0,i.ro)(a())}const d=e=>!e.inContainer;function h(e,t){const o=n();o.items.includes(e)||(d(e)&&!o.lockOwner&&(o.lockOwner=t,t.lockPage(e.preserveScrollGap)),o.items.push(e),l())}function c(e){const t=n(),o=t.items.indexOf(e);o<0||(t.items.splice(o,1),t.lockOwner&&!t.items.some(d)&&(t.lockOwner.unlockPage(),t.lockOwner=null),l())}function u(e){const t=n(),o=t.items.indexOf(e);o<0||(t.items.splice(o,1),t.items.push(e),l())}function m(e){const t=[];for(let o=e?.parentElement;o;o=o.parentElement)o.matches('main, section, article, [role="main"], [role="region"]')&&t.push(o);return t}function f(e,t=!1){if(!e?.isConnected||"function"!=typeof e.focus||e.matches(":disabled")||e.closest('[inert], [hidden], [aria-hidden="true"]')||!e.getClientRects().length||"visible"!==e.ownerDocument.defaultView.getComputedStyle(e).visibility)return!1;const o=t&&!e.hasAttribute("tabindex");let i;const s=()=>{i?.disconnect(),e.removeEventListener("blur",s),o&&"-1"===e.getAttribute("tabindex")&&e.removeAttribute("tabindex")};o&&(e.setAttribute("tabindex","-1"),e.addEventListener("blur",s,{once:!0}),i=new e.ownerDocument.defaultView.MutationObserver(()=>{e.isConnected||s()}),i.observe(e.ownerDocument.documentElement,{childList:!0,subtree:!0}));let n=!1;try{return e.focus({preventScroll:!0}),n=e.ownerDocument.activeElement===e,n}catch{return!1}finally{o&&!n&&s()}}function p(e,t,o=[]){if(!e)return;const i=a(),s=i?.getModalRoot?.()||i?.template;if((!i||s?.contains(t))&&f(t))return;if(i)return void i.focusFirst();const n=new Set([...o,...document.querySelectorAll('main, [role="main"]'),document.body]);for(const e of n)if(f(e,!0))return}},"50d2a204ba4c"(e,t,o){o.d(t,{le:()=>a});function i(e,t={}){const o=document.createElementNS("http://www.w3.org/2000/svg",e);return Object.entries(t).forEach(([e,t])=>{null!=t&&""!==t&&o.setAttribute(e,String(t))}),o}const s=e=>Math.round(1e3*e)/1e3;function n(e={}){return function({width:e=24,height:t=24,stroke:o=2,dots:n=8,filled:a=3,dotRadius:r=null,direction:l="clockwise",pixel:d=!1}={}){const h=e/2,c=t/2,u=Math.min(e,t)/2,m=Math.max(1,u-o/2),f=i("svg",{class:"sf-loader-svg",viewBox:`0 0 ${e} ${t}`,width:d?e:null,height:d?t:null,"aria-hidden":"true",focusable:"false"}),p={cx:h,cy:c,r:s(m),fill:"none",stroke:"currentColor","stroke-width":o},g=i("circle",{class:"sf-loader-ring-filled",...p,opacity:"0.3"}),b=i("circle",{class:"sf-loader-ring-accent",...p,"stroke-linecap":"round",pathLength:100,"stroke-dasharray":"0 100",transform:`rotate(90 ${h} ${c})`}),y=i("g",{class:"sf-loader-comet",display:"none",transform:`rotate(-90 ${h} ${c})`});for(let e=0;e<10;e+=1){const t=9===e;y.append(i("circle",{class:"sf-loader-comet-segment"+(t?" sf-loader-comet-head":""),...p,"stroke-linecap":t?"round":"butt",pathLength:100,"stroke-dasharray":`${s(4)} ${s(96)}`,"stroke-dashoffset":s(-4*e),opacity:s(((e+1)/10)**1.6)}))}const v=Math.max(3,Math.min(32,Math.floor(Number(n)||8))),C=Math.max(1,Math.min(v,Math.floor(Number(a)||3))),_=Math.min(o,.7*Math.PI*(u-o)/v),w=null==r||""===r?_:Math.max(1,Math.min(Number(r)||_,u/4)),S=Math.max(w,u-w),A=i("g",{class:"sf-loader-dots",display:"none",style:`--sf-loader-dot-count:${v}; --sf-loader-dot-filled:${C};`});for(let e=0;e<v;e+=1){const t=2*Math.PI/v*e-Math.PI/2,o="counterclockwise"===l?e:(v-e)%v;A.append(i("circle",{class:"sf-loader-dot"+(e<C?" sf-loader-dot--active":""),cx:s(h+S*Math.cos(t)),cy:s(c+S*Math.sin(t)),r:s(w),fill:"currentColor",style:`--sf-loader-dot-index:${e}; --sf-loader-dot-step:${o};`}))}return f.append(g,b,y,A),f}({...e,width:24,height:24,stroke:2,dotRadius:null,pixel:!1})}function a({className:e="",overlay:t=!1}={}){const o=document.createElement("span");o.className=["sf-loader-container","sf-loader--infinite",e,e&&t?`${e}--overlay`:""].filter(Boolean).join(" "),o.dataset.sfSpinnerBound="1",o.dataset.infinite="true",o.setAttribute("aria-hidden","true");const i=document.createElement("span");return i.className="sf-loader--loading-indicator",i.append(n()),o.append(i),o}},f98b7a216869(e,t,o){o.a(e,async(e,t)=>{try{var i=o("ddf1cdb42ecc"),s=o("7b69af8ef2e5"),n=o("fbe0570fcc69"),a=o("0d662e4d7d63"),r=o("e45eac6c719d"),l=o("c8d66dd2c299"),d=o("3f3a6e2680d5"),h=o("201fd0b17b8b"),c=o("ed3ae3576d0a"),u=o("50d2a204ba4c"),m=o("93025a68d8ab"),f=e([i,s,n,a,r]);[i,s,n,a,r]=f.then?(await f)():f;var p=o.n(n);const g="[data-sf-overlay-container], [data-sf-drawer-container]",b={en:{close:"Close",minimize:"Minimize",title:"Dialog"},ru:{close:"Закрыть",minimize:"Свернуть",title:"Окно"}};let y=0;function v(e){return["none","small","medium","large"].includes(String(e||"").trim().toLowerCase())}class C extends(p()){static registry=new Map;static globalBound=!1;static stack=[];static openCount=0;static lockState=null;static baseZIndex=9e3;static defaultTrueAttributes=new Set(["overlay","show-close","show-footer","close-on-esc","close-on-overlay","preserve-scroll-gap","preload"]);static getTopModal(){return(0,m.oN)()}static isTopModal(e){return C.getTopModal()===e}static getStackIndex(e){return(0,m.fI)(e)}static addToStack(e){e&&"inline"!==e.display&&(C.stack=C.stack.filter(t=>t!==e),C.stack.push(e),C.openCount=C.stack.length,e.hiddenState||(0,m.k8)(e,C))}static removeFromStack(e){e&&"inline"!==e.display&&(C.stack=C.stack.filter(t=>t!==e),C.openCount=C.stack.length,(0,m.ZT)(e))}static bringToFront(e){e&&"inline"!==e.display&&C.stack.includes(e)&&(C.stack=C.stack.filter(t=>t!==e),C.stack.push(e),(0,m.Rm)(e))}static updateStackStyles(){(0,m.rI)()}static get props(){return{templateName:{attribute:"template",default:"default"},modalId:{default:""},title:{default:""},ariaLabel:{attribute:"aria-label",default:""},text:{default:""},open:{type:Boolean,default:!1},autoload:{type:Boolean,default:!1},unclose:{type:Boolean,default:!1},hide:{type:Boolean,default:!1},hideModifier:{default:""},minimized:{type:Boolean,default:!1},overlay:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},showFooter:{type:Boolean,default:!0},closeOnEsc:{type:Boolean,default:!0},closeOnOverlay:{type:Boolean,default:!0},preserveScrollGap:{type:Boolean,default:!0},position:{default:"center",values:["center","left","right","inline-start","inline-end","top","bottom"]},mode:{default:"inline",values:["inline","ajax","iframe"]},display:{default:"modal",values:["modal","inline"]},src:{default:""},rootClass:{default:""},preload:{type:Boolean,default:!0},fullscreen:{type:Boolean,default:!1},width:{default:""},height:{default:""},blur:{default:""},blurType:{default:"medium",values:["none","small","medium","large"]},overlayPreset:{default:"default",values:["default","focus"]},overlayClass:{default:""},closeClass:{default:""},surfaceClass:{default:""},surfacePadding:{default:""},panelClass:{default:""},headerClass:{default:""},bodyClass:{default:""},contentClass:{default:""},footerClass:{default:""}}}constructor(){super(),this._modalId="",this._syncingOpenAttribute=!1,this._portalRoot=null,this._renderTarget=null,this._hostClearedForPortal=!1,this._slotEventHandlers=new Map,this._slotEventId=0,this._readyDetail=null,this._hasEmittedReady=!1,this._hasAutoloaded=!1,this._isOpen=!1,this._isHidden=!1,this._modalState="closed",this._animatePanel=!1,this._stackIndex=-1,this._closeTimer=null,this._closeTransitionAbort=null,this._lastActive=null,this._fetchController=null,this._remoteHtml="",this._remoteError="",this._isLoadingRemote=!1,this._remoteLoaded=!1,this.onKeyDown=this.onKeyDown.bind(this),this.handleOverlayClick=this.handleOverlayClick.bind(this),this.handleCloseClick=this.handleCloseClick.bind(this),this.handleHideClick=this.handleHideClick.bind(this)}connectedCallback(){this._modalId||(this._modalId=this.getAttribute("modal-id")||this.id||"sf-modal-"+ ++y),super.connectedCallback(),C.registry.set(this.modalId,this),C.bindGlobalEvents()}captureSlotTemplates(){const e=!this._slotTemplatesCaptured;if(super.captureSlotTemplates(),!e)return;const t=Array.from(this.childNodes).filter(e=>e.nodeType===Node.ELEMENT_NODE?"template"!==e.tagName.toLowerCase():e.nodeType===Node.TEXT_NODE&&""!==e.textContent.trim());t.length&&(this._liveSlotNodes.has("content")||this._liveSlotNodes.set("content",[]),this._liveSlotNodes.get("content").push(...t),t.forEach(e=>e.remove()))}disconnectedCallback(){this.teardownModal(),C.registry.delete(this.modalId),super.disconnectedCallback()}get templateName(){return this.getAttribute("template")||"default"}get modalId(){return this.getAttribute("modal-id")||this._modalId||this.id||""}get title(){return this.getAttribute("title")||(0,a.pageText)(b,"title",this)}get ariaLabel(){return this.getAttribute("aria-label")||""}get text(){return this.getAttribute("text")||""}get openState(){return this._isOpen||this.hasAttribute("open")||"inline"===this.display&&!this._inlineClosed}get autoload(){return this.getBooleanAttr("autoload",!1)}get unclose(){return this.getBooleanAttr("unclose",!1)}get hideButton(){return this.getBooleanAttr("hide",!1)}get hideModifier(){return this.getAttribute("hide-modifier")||""}get hiddenState(){return"inline"!==this.display&&(this._isHidden||this.hasAttribute("minimized"))}get overlay(){return this.getBooleanAttr("overlay",!0)}get closeOnEsc(){return this.getBooleanAttr("close-on-esc",!0)}get showClose(){return this.getBooleanAttr("show-close",!0)&&!this.unclose}get showHeader(){return this.getBooleanAttr("show-header",!0)}get showFooter(){return this.getBooleanAttr("show-footer",!0)}get closeOnOverlay(){return this.getBooleanAttr("close-on-overlay",!0)}get preserveScrollGap(){return this.getBooleanAttr("preserve-scroll-gap",!0)}get position(){return this.getEnumAttr("position",["center","left","right","inline-start","inline-end","top","bottom"],"center")}get mode(){return this.getEnumAttr("mode",["inline","ajax","iframe"],"inline")}get display(){return this.getEnumAttr("display",["modal","inline"],"modal")}get src(){return this.getAttribute("src")||""}get preload(){return this.getBooleanAttr("preload",!0)}get fullscreen(){return this.getBooleanAttr("fullscreen",!1)}get width(){return this.getAttribute("width")||""}get height(){return this.getAttribute("height")||""}get blur(){return v(this.getAttribute("blur"))||this.getBooleanAttr("blur",!1)}get blurType(){const e=this.getAttribute("blur"),t=this.getAttribute("blur-type")||(v(e)?e:"medium");return this.normalizeEnum(t,["none","small","medium","large"],"medium")}get hasCustomBlurType(){return this.hasAttribute("blur-type")||v(this.getAttribute("blur"))}get overlayPreset(){return this.normalizeEnum(this.getAttribute("overlay-preset")||"default",["default","focus"],"default")}get headerClass(){return this.getAttribute("header-class")||""}get overlayClass(){return this.getAttribute("overlay-class")||""}get closeClass(){return this.getAttribute("close-class")||""}get surfaceClass(){return this.getAttribute("surface-class")||""}get surfacePadding(){return this.getAttribute("surface-padding")||""}get panelClass(){return this.getAttribute("panel-class")||""}get bodyClass(){return this.getAttribute("body-class")||""}get contentClass(){return this.getAttribute("content-class")||""}get footerClass(){return this.getAttribute("footer-class")||""}get modalRoot(){return this._renderTarget?.querySelector?.(".sf-modal")||null}get state(){return{modalId:this.modalId,title:this.title,ariaLabel:this.ariaLabel,text:this.text,open:this.openState,autoload:this.autoload,unclose:this.unclose,hide:this.hideButton,hideModifier:this.hideModifier,minimized:this.hiddenState,overlay:this.overlay,showHeader:this.showHeader,showClose:this.showClose,showFooter:this.showFooter,closeOnEsc:this.closeOnEsc,closeOnOverlay:this.closeOnOverlay,preserveScrollGap:this.preserveScrollGap,position:this.position,mode:this.mode,display:this.display,src:this.src,preload:this.preload,fullscreen:this.fullscreen,width:this.width,height:this.height,blur:this.blur,blurType:this.blurType,overlayPreset:this.overlayPreset,overlayClass:this.overlayClass,closeClass:this.closeClass,surfaceClass:this.surfaceClass,surfacePadding:this.surfacePadding,panelClass:this.panelClass,headerClass:this.headerClass,bodyClass:this.bodyClass,contentClass:this.contentClass,footerClass:this.footerClass,lifecycle:this.renderModalState,remote:{error:this._remoteError,status:this._isLoadingRemote?"loading":this._remoteError?"error":this._remoteLoaded?"success":"idle"},stackIndex:this._stackIndex}}get renderOpenState(){return this.openState||"closing"===this._modalState}get renderModalState(){return"inline"===this.display?this.openState?"open":"closed":this.renderOpenState&&"closed"===this._modalState?"open":this._modalState}get modalZIndex(){return"inline"===this.display||this._stackIndex<0?"":C.baseZIndex+2*this._stackIndex}get remoteContent(){return"iframe"===this.mode&&this.src?i.html`
|
|
1
|
+
(()=>{"use strict";var e={"3f3a6e2680d5"(e,t,o){function i(e,t=!1){if(!e)return()=>{};const o=new Set,i=()=>{for(const t of e.children)t.hasAttribute("inert")||(t.setAttribute("inert",""),o.add(t))};t&&e.focus({preventScroll:!0}),i();const s=new e.ownerDocument.defaultView.MutationObserver(i);return s.observe(e,{childList:!0}),()=>{s.disconnect();for(const e of o)""===e.getAttribute("inert")&&e.removeAttribute("inert");o.clear()}}o.d(t,{e:()=>i})},c8d66dd2c299(e,t,o){o.d(t,{Zg:()=>l,ro:()=>n});const i=["a[href]","area[href]","button","input","select","textarea","iframe","summary","audio[controls]","video[controls]","[contenteditable]","[tabindex]"].join(","),s=Symbol.for("simai.modal.focus-guards");function n(e){const t=e?.getModalRoot?.()||e?.template,o=t?.querySelector?.("[data-sf-modal-panel]"),i=document[s];if(i&&i.panel===o&&i.before.isConnected&&i.after.isConnected)return;if(i?.before.remove(),i?.after.remove(),delete document[s],!o?.parentNode)return;const n={panel:o,relaying:!1};for(const e of["before","after"]){const i=o.ownerDocument.createElement("span");i.tabIndex=0,i.className="sf-modal-focus-guard",i.setAttribute("aria-hidden","true"),i.addEventListener("focus",()=>{if(n.relaying||!o.isConnected||t.inert||"true"===t.getAttribute("aria-hidden"))return;const i="before"===e,s=r(o,i),a=i?s.at(-1):s[0];a&&"IFRAME"!==a.tagName?a.focus({preventScroll:!0}):o.focus({preventScroll:!0})}),n[e]=i}o.before(n.before),o.after(n.after),document[s]=n}function a(e,t){return"INPUT"===e?.tagName&&"INPUT"===t?.tagName&&"radio"===e.type&&"radio"===t.type&&!!e.name&&e.name===t.name&&e.form===t.form&&e.getRootNode()===t.getRootNode()}function r(e,t=!1){const o=e.ownerDocument.defaultView,s=Array.from(e.querySelectorAll(i)).filter(e=>e.tabIndex>=0&&!e.matches(":disabled")&&!e.closest("[inert]")&&e.getClientRects().length>0&&"visible"===o.getComputedStyle(e).visibility).sort((e,t)=>(e.tabIndex||1/0)-(t.tabIndex||1/0));return s.filter(e=>{if(!a(e,e))return!0;const o=s.filter(t=>a(e,t)),i=o.find(e=>e.checked);return e===(i||o.at(t?-1:0))})}function l(e,t){if(!e)return;const o=r(e,t.shiftKey),i=e.ownerDocument.activeElement;if(!o.length)return t.preventDefault(),void e.focus();const n=o[0],l=o[o.length-1],d=t.shiftKey?n:l;if(!e.contains(i)||i===e||i===d||a(i,d)){const o=t.shiftKey?l:n,i=e.ownerDocument[s];if("IFRAME"===o.tagName&&i?.panel===e){i.relaying=!0;try{(t.shiftKey?i.after:i.before).focus({preventScroll:!0})}finally{i.relaying=!1}return}t.preventDefault(),o.focus()}}},"201fd0b17b8b"(e,t,o){o.d(t,{Gp:()=>s,ju:()=>n});const i=e=>{const t=Number.parseFloat(e);return Number.isFinite(t)?t*(e.trim().endsWith("ms")?1:1e3):0};function s(e,t=window){let o=!1,i=null,s=null;const n=()=>{o||(o=!0,null!==i&&(t.cancelAnimationFrame(i),i=null),null!==s&&(t.clearTimeout(s),s=null),e())};return i=t.requestAnimationFrame(n),s=t.setTimeout(n,50),"function"==typeof t.queueMicrotask&&t.queueMicrotask(n),()=>{o=!0,null!==i&&t.cancelAnimationFrame(i),null!==s&&t.clearTimeout(s)}}function n(e,t,o=window){let n=null,a=!1;const r=s(()=>{if(a)return;const s=e(),r=s?.querySelectorAll("[data-sf-modal-panel], [data-sf-modal-overlay]")||[],l=Math.max(0,...Array.from(r,e=>{const t=o.getComputedStyle(e);return"none"===t.display?0:function(e){const t=e.transitionProperty.split(",").map(e=>e.trim()),o=e.transitionDuration.split(",").map(i),s=e.transitionDelay.split(",").map(i);return Math.max(0,...t.map((e,t)=>["all","opacity","transform","-webkit-transform"].includes(e)?Math.max(0,o[t%o.length])+s[t%s.length]:0))}(t)}));n=o.setTimeout(()=>{a||t()},l)},o);return()=>{a=!0,r(),null!==n&&o.clearTimeout(n)}}},ed3ae3576d0a(e,t,o){function i(e=!0){const t=document.documentElement,o=document.body;if(!t||!o)return null;const i=Math.max(0,window.innerWidth-t.clientWidth),s=parseFloat(window.getComputedStyle(o).paddingInlineEnd)||0,n={docEl:t,body:o,htmlLocked:t.classList.contains("overflow-hidden"),bodyLocked:o.classList.contains("overflow-hidden"),bodyPaddingInlineEnd:o.style.getPropertyValue("padding-inline-end"),paddingPriority:o.style.getPropertyPriority("padding-inline-end"),appliedPadding:null};return t.classList.add("overflow-hidden"),o.classList.add("overflow-hidden"),e&&i>0&&(o.style.setProperty("padding-inline-end",`${s+i}px`,n.paddingPriority),n.appliedPadding=o.style.getPropertyValue("padding-inline-end")),n}function s(e){if(!e)return;const{docEl:t,body:o}=e;e.htmlLocked||t.classList.remove("overflow-hidden"),e.bodyLocked||o.classList.remove("overflow-hidden"),null!==e.appliedPadding&&o.style.getPropertyValue("padding-inline-end")===e.appliedPadding&&o.style.getPropertyPriority("padding-inline-end")===e.paddingPriority&&(e.bodyPaddingInlineEnd?o.style.setProperty("padding-inline-end",e.bodyPaddingInlineEnd,e.paddingPriority):o.style.removeProperty("padding-inline-end"))}o.d(t,{i:()=>i,l:()=>s})},"93025a68d8ab"(e,t,o){o.d(t,{BK:()=>p,M$:()=>m,Rm:()=>u,ZT:()=>c,fI:()=>r,k8:()=>h,oN:()=>a,rI:()=>l});var i=o("c8d66dd2c299");const s=Symbol.for("simai.modal.document-stack");function n(){return document[s]||Object.defineProperty(document,s,{value:{items:[],lockOwner:null},configurable:!0}),document[s]}function a(){return n().items.at(-1)||null}function r(e){return n().items.indexOf(e)}function l(){n().items.forEach((e,t)=>e.applyStackPosition(t)),(0,i.ro)(a())}const d=e=>!e.inContainer;function h(e,t){const o=n();o.items.includes(e)||(d(e)&&!o.lockOwner&&(o.lockOwner=t,t.lockPage(e.preserveScrollGap)),o.items.push(e),l())}function c(e){const t=n(),o=t.items.indexOf(e);o<0||(t.items.splice(o,1),t.lockOwner&&!t.items.some(d)&&(t.lockOwner.unlockPage(),t.lockOwner=null),l())}function u(e){const t=n(),o=t.items.indexOf(e);o<0||(t.items.splice(o,1),t.items.push(e),l())}function m(e){const t=[];for(let o=e?.parentElement;o;o=o.parentElement)o.matches('main, section, article, [role="main"], [role="region"]')&&t.push(o);return t}function f(e,t=!1){if(!e?.isConnected||"function"!=typeof e.focus||e.matches(":disabled")||e.closest('[inert], [hidden], [aria-hidden="true"]')||!e.getClientRects().length||"visible"!==e.ownerDocument.defaultView.getComputedStyle(e).visibility)return!1;const o=t&&!e.hasAttribute("tabindex");let i;const s=()=>{i?.disconnect(),e.removeEventListener("blur",s),o&&"-1"===e.getAttribute("tabindex")&&e.removeAttribute("tabindex")};o&&(e.setAttribute("tabindex","-1"),e.addEventListener("blur",s,{once:!0}),i=new e.ownerDocument.defaultView.MutationObserver(()=>{e.isConnected||s()}),i.observe(e.ownerDocument.documentElement,{childList:!0,subtree:!0}));let n=!1;try{return e.focus({preventScroll:!0}),n=e.ownerDocument.activeElement===e,n}catch{return!1}finally{o&&!n&&s()}}function p(e,t,o=[]){if(!e)return;const i=a(),s=i?.getModalRoot?.()||i?.template;if((!i||s?.contains(t))&&f(t))return;if(i)return void i.focusFirst();const n=new Set([...o,...document.querySelectorAll('main, [role="main"]'),document.body]);for(const e of n)if(f(e,!0))return}},"50d2a204ba4c"(e,t,o){o.d(t,{le:()=>a});function i(e,t={}){const o=document.createElementNS("http://www.w3.org/2000/svg",e);return Object.entries(t).forEach(([e,t])=>{null!=t&&""!==t&&o.setAttribute(e,String(t))}),o}const s=e=>Math.round(1e3*e)/1e3;function n(e={}){return function({width:e=24,height:t=24,stroke:o=2,dots:n=8,filled:a=3,dotRadius:r=null,direction:l="clockwise",pixel:d=!1}={}){const h=e/2,c=t/2,u=Math.min(e,t)/2,m=Math.max(1,u-o/2),f=i("svg",{class:"sf-loader-svg",viewBox:`0 0 ${e} ${t}`,width:d?e:null,height:d?t:null,"aria-hidden":"true",focusable:"false"}),p={cx:h,cy:c,r:s(m),fill:"none",stroke:"currentColor","stroke-width":o},g=i("circle",{class:"sf-loader-ring-filled",...p,opacity:"0.3"}),b=i("circle",{class:"sf-loader-ring-accent",...p,"stroke-linecap":"round",pathLength:100,"stroke-dasharray":"0 100",transform:`rotate(90 ${h} ${c})`}),y=i("g",{class:"sf-loader-comet",display:"none",transform:`rotate(-90 ${h} ${c})`});for(let e=0;e<10;e+=1){const t=9===e;y.append(i("circle",{class:"sf-loader-comet-segment"+(t?" sf-loader-comet-head":""),...p,"stroke-linecap":t?"round":"butt",pathLength:100,"stroke-dasharray":`${s(4)} ${s(96)}`,"stroke-dashoffset":s(-4*e),opacity:s(((e+1)/10)**1.6)}))}const v=Math.max(3,Math.min(32,Math.floor(Number(n)||8))),C=Math.max(1,Math.min(v,Math.floor(Number(a)||3))),_=Math.min(o,.7*Math.PI*(u-o)/v),w=null==r||""===r?_:Math.max(1,Math.min(Number(r)||_,u/4)),S=Math.max(w,u-w),A=i("g",{class:"sf-loader-dots",display:"none",style:`--sf-loader-dot-count:${v}; --sf-loader-dot-filled:${C};`});for(let e=0;e<v;e+=1){const t=2*Math.PI/v*e-Math.PI/2,o="counterclockwise"===l?e:(v-e)%v;A.append(i("circle",{class:"sf-loader-dot"+(e<C?" sf-loader-dot--active":""),cx:s(h+S*Math.cos(t)),cy:s(c+S*Math.sin(t)),r:s(w),fill:"currentColor",style:`--sf-loader-dot-index:${e}; --sf-loader-dot-step:${o};`}))}return f.append(g,b,y,A),f}({...e,width:24,height:24,stroke:2,dotRadius:null,pixel:!1})}function a({className:e="",overlay:t=!1}={}){const o=document.createElement("span");o.className=["sf-loader-container","sf-loader--infinite",e,e&&t?`${e}--overlay`:""].filter(Boolean).join(" "),o.dataset.sfSpinnerBound="1",o.dataset.infinite="true",o.setAttribute("aria-hidden","true");const i=document.createElement("span");return i.className="sf-loader--loading-indicator",i.append(n()),o.append(i),o}},f98b7a216869(e,t,o){o.a(e,async(e,t)=>{try{var i=o("ddf1cdb42ecc"),s=o("7b69af8ef2e5"),n=o("fbe0570fcc69"),a=o("0d662e4d7d63"),r=o("e45eac6c719d"),l=o("c8d66dd2c299"),d=o("3f3a6e2680d5"),h=o("201fd0b17b8b"),c=o("ed3ae3576d0a"),u=o("50d2a204ba4c"),m=o("93025a68d8ab"),f=e([i,s,n,a,r]);[i,s,n,a,r]=f.then?(await f)():f;var p=o.n(n);const g="[data-sf-overlay-container], [data-sf-drawer-container]",b={en:{close:"Close",minimize:"Minimize",title:"Dialog",loading:"Loading…",loadFailed:"Failed to load content",frameFailed:"Failed to load iframe content"},ru:{close:"Закрыть",minimize:"Свернуть",title:"Окно",loading:"Загрузка…",loadFailed:"Не удалось загрузить содержимое",frameFailed:"Не удалось загрузить встроенную страницу"}};let y=0;function v(e){return["none","small","medium","large"].includes(String(e||"").trim().toLowerCase())}class C extends(p()){static registry=new Map;static globalBound=!1;static stack=[];static openCount=0;static lockState=null;static baseZIndex=9e3;static defaultTrueAttributes=new Set(["overlay","show-close","show-footer","close-on-esc","close-on-overlay","preserve-scroll-gap","preload"]);static getTopModal(){return(0,m.oN)()}static isTopModal(e){return C.getTopModal()===e}static getStackIndex(e){return(0,m.fI)(e)}static addToStack(e){e&&"inline"!==e.display&&(C.stack=C.stack.filter(t=>t!==e),C.stack.push(e),C.openCount=C.stack.length,e.hiddenState||(0,m.k8)(e,C))}static removeFromStack(e){e&&"inline"!==e.display&&(C.stack=C.stack.filter(t=>t!==e),C.openCount=C.stack.length,(0,m.ZT)(e))}static bringToFront(e){e&&"inline"!==e.display&&C.stack.includes(e)&&(C.stack=C.stack.filter(t=>t!==e),C.stack.push(e),(0,m.Rm)(e))}static updateStackStyles(){(0,m.rI)()}static get props(){return{templateName:{attribute:"template",default:"default"},modalId:{default:""},title:{default:""},ariaLabel:{attribute:"aria-label",default:""},text:{default:""},open:{type:Boolean,default:!1},autoload:{type:Boolean,default:!1},unclose:{type:Boolean,default:!1},hide:{type:Boolean,default:!1},hideModifier:{default:""},minimized:{type:Boolean,default:!1},overlay:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},showFooter:{type:Boolean,default:!0},closeOnEsc:{type:Boolean,default:!0},closeOnOverlay:{type:Boolean,default:!0},preserveScrollGap:{type:Boolean,default:!0},position:{default:"center",values:["center","left","right","inline-start","inline-end","top","bottom"]},mode:{default:"inline",values:["inline","ajax","iframe"]},display:{default:"modal",values:["modal","inline"]},src:{default:""},rootClass:{default:""},preload:{type:Boolean,default:!0},fullscreen:{type:Boolean,default:!1},width:{default:""},height:{default:""},blur:{default:""},blurType:{default:"medium",values:["none","small","medium","large"]},overlayPreset:{default:"default",values:["default","focus"]},overlayClass:{default:""},closeClass:{default:""},surfaceClass:{default:""},surfacePadding:{default:""},panelClass:{default:""},headerClass:{default:""},bodyClass:{default:""},contentClass:{default:""},footerClass:{default:""}}}constructor(){super(),this._modalId="",this._syncingOpenAttribute=!1,this._portalRoot=null,this._renderTarget=null,this._hostClearedForPortal=!1,this._slotEventHandlers=new Map,this._slotEventId=0,this._readyDetail=null,this._hasEmittedReady=!1,this._hasAutoloaded=!1,this._isOpen=!1,this._isHidden=!1,this._modalState="closed",this._animatePanel=!1,this._stackIndex=-1,this._closeTimer=null,this._closeTransitionAbort=null,this._lastActive=null,this._fetchController=null,this._remoteHtml="",this._remoteError="",this._isLoadingRemote=!1,this._remoteLoaded=!1,this.onKeyDown=this.onKeyDown.bind(this),this.handleOverlayClick=this.handleOverlayClick.bind(this),this.handleCloseClick=this.handleCloseClick.bind(this),this.handleHideClick=this.handleHideClick.bind(this)}connectedCallback(){this._modalId||(this._modalId=this.getAttribute("modal-id")||this.id||"sf-modal-"+ ++y),super.connectedCallback(),C.registry.set(this.modalId,this),C.bindGlobalEvents()}captureSlotTemplates(){const e=!this._slotTemplatesCaptured;if(super.captureSlotTemplates(),!e)return;const t=Array.from(this.childNodes).filter(e=>e.nodeType===Node.ELEMENT_NODE?"template"!==e.tagName.toLowerCase():e.nodeType===Node.TEXT_NODE&&""!==e.textContent.trim());t.length&&(this._liveSlotNodes.has("content")||this._liveSlotNodes.set("content",[]),this._liveSlotNodes.get("content").push(...t),t.forEach(e=>e.remove()))}disconnectedCallback(){this.teardownModal(),C.registry.delete(this.modalId),super.disconnectedCallback()}get templateName(){return this.getAttribute("template")||"default"}get modalId(){return this.getAttribute("modal-id")||this._modalId||this.id||""}get title(){return this.getAttribute("title")||(0,a.pageText)(b,"title",this)}get ariaLabel(){return this.getAttribute("aria-label")||""}get text(){return this.getAttribute("text")||""}get openState(){return this._isOpen||this.hasAttribute("open")||"inline"===this.display&&!this._inlineClosed}get autoload(){return this.getBooleanAttr("autoload",!1)}get unclose(){return this.getBooleanAttr("unclose",!1)}get hideButton(){return this.getBooleanAttr("hide",!1)}get hideModifier(){return this.getAttribute("hide-modifier")||""}get hiddenState(){return"inline"!==this.display&&(this._isHidden||this.hasAttribute("minimized"))}get overlay(){return this.getBooleanAttr("overlay",!0)}get closeOnEsc(){return this.getBooleanAttr("close-on-esc",!0)}get showClose(){return this.getBooleanAttr("show-close",!0)&&!this.unclose}get showHeader(){return this.getBooleanAttr("show-header",!0)}get showFooter(){return this.getBooleanAttr("show-footer",!0)}get closeOnOverlay(){return this.getBooleanAttr("close-on-overlay",!0)}get preserveScrollGap(){return this.getBooleanAttr("preserve-scroll-gap",!0)}get position(){return this.getEnumAttr("position",["center","left","right","inline-start","inline-end","top","bottom"],"center")}get mode(){return this.getEnumAttr("mode",["inline","ajax","iframe"],"inline")}get display(){return this.getEnumAttr("display",["modal","inline"],"modal")}get src(){return this.getAttribute("src")||""}get preload(){return this.getBooleanAttr("preload",!0)}get fullscreen(){return this.getBooleanAttr("fullscreen",!1)}get width(){return this.getAttribute("width")||""}get height(){return this.getAttribute("height")||""}get blur(){return v(this.getAttribute("blur"))||this.getBooleanAttr("blur",!1)}get blurType(){const e=this.getAttribute("blur"),t=this.getAttribute("blur-type")||(v(e)?e:"medium");return this.normalizeEnum(t,["none","small","medium","large"],"medium")}get hasCustomBlurType(){return this.hasAttribute("blur-type")||v(this.getAttribute("blur"))}get overlayPreset(){return this.normalizeEnum(this.getAttribute("overlay-preset")||"default",["default","focus"],"default")}get headerClass(){return this.getAttribute("header-class")||""}get overlayClass(){return this.getAttribute("overlay-class")||""}get closeClass(){return this.getAttribute("close-class")||""}get surfaceClass(){return this.getAttribute("surface-class")||""}get surfacePadding(){return this.getAttribute("surface-padding")||""}get panelClass(){return this.getAttribute("panel-class")||""}get bodyClass(){return this.getAttribute("body-class")||""}get contentClass(){return this.getAttribute("content-class")||""}get footerClass(){return this.getAttribute("footer-class")||""}get modalRoot(){return this._renderTarget?.querySelector?.(".sf-modal")||null}get state(){return{modalId:this.modalId,title:this.title,ariaLabel:this.ariaLabel,text:this.text,open:this.openState,autoload:this.autoload,unclose:this.unclose,hide:this.hideButton,hideModifier:this.hideModifier,minimized:this.hiddenState,overlay:this.overlay,showHeader:this.showHeader,showClose:this.showClose,showFooter:this.showFooter,closeOnEsc:this.closeOnEsc,closeOnOverlay:this.closeOnOverlay,preserveScrollGap:this.preserveScrollGap,position:this.position,mode:this.mode,display:this.display,src:this.src,preload:this.preload,fullscreen:this.fullscreen,width:this.width,height:this.height,blur:this.blur,blurType:this.blurType,overlayPreset:this.overlayPreset,overlayClass:this.overlayClass,closeClass:this.closeClass,surfaceClass:this.surfaceClass,surfacePadding:this.surfacePadding,panelClass:this.panelClass,headerClass:this.headerClass,bodyClass:this.bodyClass,contentClass:this.contentClass,footerClass:this.footerClass,lifecycle:this.renderModalState,remote:{error:this._remoteError,status:this._isLoadingRemote?"loading":this._remoteError?"error":this._remoteLoaded?"success":"idle"},stackIndex:this._stackIndex}}get renderOpenState(){return this.openState||"closing"===this._modalState}get renderModalState(){return"inline"===this.display?this.openState?"open":"closed":this.renderOpenState&&"closed"===this._modalState?"open":this._modalState}get modalZIndex(){return"inline"===this.display||this._stackIndex<0?"":C.baseZIndex+2*this._stackIndex}get remoteContent(){if("iframe"===this.mode&&this.src)return i.html`
|
|
2
2
|
<iframe
|
|
3
3
|
class="sf-modal-iframe w-full border-0 radius-surface"
|
|
4
4
|
src=${this.src}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
@load=${this.handleIframeLoad}
|
|
9
9
|
@error=${this.handleIframeError}
|
|
10
10
|
></iframe>
|
|
11
|
-
|
|
11
|
+
`;if(this._remoteError)return i.html`
|
|
12
12
|
<div
|
|
13
13
|
class="sf-modal-error flex flex-col gap-2 items-cross-center content-main-center p-4"
|
|
14
14
|
data-sf-modal-state="error"
|
|
@@ -18,17 +18,19 @@
|
|
|
18
18
|
${this._remoteError}
|
|
19
19
|
</p>
|
|
20
20
|
</div>
|
|
21
|
-
|
|
21
|
+
`;if(this._remoteHtml)return i.html`<div class="sf-modal-content flex flex-col gap-2">
|
|
22
22
|
${(0,s.unsafeHTML)(this._remoteHtml)}
|
|
23
|
-
</div
|
|
23
|
+
</div>`;if(this._isLoadingRemote){const e=(0,a.pageText)(b,"loading",this);return i.html`
|
|
24
24
|
<div
|
|
25
25
|
class="sf-modal-loading flex flex-col gap-2 items-cross-center content-main-center p-4"
|
|
26
26
|
data-sf-modal-state="loading"
|
|
27
|
+
role="status"
|
|
28
|
+
aria-label=${e}
|
|
27
29
|
>
|
|
28
30
|
${this._loadingSpinnerNode()}
|
|
29
|
-
<p class="m-0 text-2 color-on-surface-variant"
|
|
31
|
+
<p class="m-0 text-2 color-on-surface-variant">${e}</p>
|
|
30
32
|
</div>
|
|
31
|
-
`:i.nothing}_loadingSpinnerNode(){return this._loadingSpinner||(this._loadingSpinner=(0,u.le)({className:"sf-modal-spinner"})),this._loadingSpinner}templateContext(){this._slotEventHandlers.clear(),this._slotEventId=0;const e=this.getPropsContext();return this.createTemplateContext({...e,component:this,closeText:(0,a.pageText)(b,"close",this),minimizeText:(0,a.pageText)(b,"minimize",this),title:this.title,modalId:this.modalId,open:this.renderOpenState,modalState:this.renderModalState,animate:this._animatePanel&&"inline"!==this.display,modalZIndex:this.modalZIndex,hide:this.hideButton,minimized:this.hiddenState,showClose:this.showClose,blur:this.blur,blurType:this.blurType,hasCustomBlurType:this.hasCustomBlurType,hasHeaderContent:this.hasSlotContent("header"),hasContentContent:this.hasSlotContent("content"),hasFooterContent:this.hasSlotContent("footer"),headerContent:(0,s.unsafeHTML)(this.getSlotHtml("header")),contentContent:(0,s.unsafeHTML)(this.getSlotHtml("content")),footerContent:(0,s.unsafeHTML)(this.getSlotHtml("footer")),remoteContent:this.remoteContent,onCloseClick:this.handleCloseClick,onHideClick:this.handleHideClick})}getSlotHtml(e){return[...this._liveSlotNodes.get(e)||[],...this._slotTemplates.get(e)||[]].map(e=>{if(e instanceof HTMLElement){const t=e.cloneNode(!0);return this.copyRuntimeData(e,t),this.assignSlotEventIds(t),this.cleanNestedSmartComponentRender(t),t.outerHTML}return e.textContent||""}).join("")}assignSlotEventIds(e){[e,...Array.from(e.querySelectorAll?.("*")||[])].forEach(e=>{if(!e.__sfCreateEventHandlers?.length)return;const t="sf-modal-slot-event-"+ ++this._slotEventId;e.setAttribute("data-sf-runtime-event-id",t),this._slotEventHandlers.set(t,e.__sfCreateEventHandlers.slice())})}cleanNestedSmartComponentRender(e){[e,...Array.from(e.querySelectorAll?.("*")||[])].forEach(e=>{(e.tagName?.toLowerCase?.()||"").startsWith("sf-")&&Array.from(e.childNodes).forEach(e=>{e instanceof HTMLElement&&(e.hasAttribute("slot")||"slot"===e.tagName.toLowerCase()||e.tagName.toLowerCase().startsWith("sf-"))||e.remove()})})}template(){return(0,r.Q)(this.templateContext())}async renderComponent(e=[]){const t=++this._renderToken;if(!this._isMounted)return;this.beforeRender(e),this.emitComponentEvent("before-render",{changedAttributes:e}),this.runExternalHook("beforeRender",{changedAttributes:e,root:this});const o=await this.resolveTemplateResult(e);this._isMounted&&t===this._renderToken&&((0,i.render)(o,this.resolveRenderTarget()),this.afterRender(e),this.runExternalHook("afterRender",{changedAttributes:e,root:this}),this.emitComponentEvent("after-render",{changedAttributes:e}))}resolveRenderTarget(){return"inline"===this.display?(this.clearPortal(),this._hostClearedForPortal=!1,this._renderTarget=this,this):(this._hostClearedForPortal||((0,i.render)(i.nothing,this),this._hostClearedForPortal=!0),this._portalRoot||(this._portalRoot=this.resolvePortalRoot()),this.dedupePortalRoots(),this._renderTarget=this._portalRoot,this._portalRoot)}get overlayHome(){return this.closest(g)||document.body}get inContainer(){return this.overlayHome!==document.body}resolvePortalRoot(){const e=this.overlayHome,t=e.querySelector(`[data-sf-modal-portal="${this.modalId}"]`);if(t)return t;const o=document.createElement("div");return o.setAttribute("data-sf-modal-portal",this.modalId),e.append(o),o}dedupePortalRoots(){Array.from(document.querySelectorAll(`[data-sf-modal-portal="${this.modalId}"]`)).forEach(e=>{e!==this._portalRoot&&((0,i.render)(i.nothing,e),e.remove())}),this._portalRoot.isConnected||(this._portalRoot.setAttribute("data-sf-modal-portal",this.modalId),this.overlayHome.append(this._portalRoot))}applyStackPosition(e=C.getStackIndex(this)){this._stackIndex=e;const t=this.getModalRoot();return t&&"inline"!==this.display?e<0?(t.style.removeProperty("z-index"),t.style.removeProperty("--sf-modal-stack-index"),this):(t.style.setProperty("--sf-modal-stack-index",String(e)),t.style.zIndex=String(this.modalZIndex),this):this}open(e={}){const{animate:t=!0}="boolean"==typeof e?{animate:e}:e,o="closing"===this._modalState;return(this._isOpen||"inline"===this.display&&this.openState)&&!o?(this.cancelCloseTransition(),C.bringToFront(this),this):this.emitBeforeOpen()?(o||(this._lastActive=document.activeElement,this._focusReturnAncestors=(0,m.M$)(this._lastActive)),o&&(this.cancelCloseTransition(),this._releaseClosingContent?.(),this._releaseClosingContent=null),this._isOpen=!0,this._inlineClosed=!1,this._animatePanel=Boolean(t),this._modalState=t&&"inline"!==this.display?"opening":"open",this.syncOpenAttribute(!0),"inline"===this.display||o?"inline"!==this.display&&C.bringToFront(this):C.addToStack(this),this.requestComponentUpdate("open"),(0,h.Gp)(()=>{if(!this._isOpen||"closing"===this._modalState)return;this._modalState="open";const e=new Promise(e=>{const t=o=>{o.detail?.changedAttributes?.includes("open-state")&&(this.removeEventListener("sf-updated",t),e())};this.addEventListener("sf-updated",t)});this.requestComponentUpdate("open-state"),e.then(()=>{this._isOpen&&"open"===this._modalState&&(this.focusFirst(),this.emitAfterOpen(),this.loadRemoteContentIfNeeded())})}),this):this}close(){if(!this.openState||"closing"===this._modalState)return this;if(!this.emitBeforeClose())return this;if("inline"===this.display)return this.finishClose(),this;this._modalState="closing",this._isOpen=!1,this.requestComponentUpdate("close");const e=this.getModalRoot()?.querySelector("[data-sf-modal-panel]");return this._releaseClosingContent=(0,d.e)(e,C.isTopModal(this)),this._closeTransitionAbort=(0,h.ju)(()=>this.getModalRoot(),()=>this.finishClose()),this}hide(){return!this.openState||"inline"===this.display||this.hiddenState?this:this.emitBeforeHide()?(this._isHidden=!0,this.setAttribute("minimized",""),this.requestComponentUpdate("hide"),this.emitAfterHide(),this):this}show(){return this.openState&&"inline"!==this.display&&this.hiddenState&&this.emitBeforeShow()?(this._isHidden=!1,this.removeAttribute("minimized"),this.requestComponentUpdate("show"),this.emitAfterShow(),this):this}syncMinimizedLayer(){if(!this._isMounted||!this.openState||"inline"===this.display||"closed"===this._modalState||"closing"===this._modalState)return;const e=this.getModalRoot();if(this.hiddenState){const t=C.isTopModal(this);(0,m.ZT)(this),this.applyStackPosition(),(0,m.BK)(t,this._lastActive,this._focusReturnAncestors),e&&(e.inert=!0,e.setAttribute("aria-hidden","true"))}else e&&(e.inert=!1,e.setAttribute("aria-hidden","false")),(0,m.k8)(this,C),C.bringToFront(this),requestAnimationFrame(()=>this.focusFirst())}toggle(){return this.openState?this.close():this.open()}finishClose(){if("inline"!==this.display&&"closing"!==this._modalState)return this;const e=C.isTopModal(this);this.cancelCloseTransition(),this._isOpen=!1,"inline"===this.display&&(this._inlineClosed=!0),this._isHidden=!1,this._modalState="closed",this.removeAttribute("minimized"),this.syncOpenAttribute(!1);const t=this.getModalRoot();return t&&(t.inert=!0,t.setAttribute("aria-hidden","true")),this._releaseClosingContent?.(),this._releaseClosingContent=null,"inline"!==this.display&&C.removeFromStack(this),"inline"!==this.display&&(0,m.BK)(e,this._lastActive,this._focusReturnAncestors),this.requestComponentUpdate("after-close"),this.emitAfterClose(),this}cancelCloseTransition(){this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null),this._closeTransitionAbort&&(this._closeTransitionAbort(),this._closeTransitionAbort=null)}setSrc(e){return this.setAttribute("src",e||""),this.resetRemoteContent(),this.loadRemoteContentIfNeeded(),this}reloadContent(){return this.resetRemoteContent(),this.loadRemoteContentIfNeeded(!0),this}getModalRoot(){return this.modalRoot}afterRender(){this.bindRenderedEvents(),this.bindSlotEventHandlers(),"closing"===this._modalState&&(this._releaseClosingContent?.(),this._releaseClosingContent=(0,d.e)(this.getModalRoot()?.querySelector("[data-sf-modal-panel]"),C.isTopModal(this))),this._readyDetail={component:this,modal:this,modalId:this.modalId,root:this.getModalRoot()},this._hasEmittedReady?this.dispatchEvent(new CustomEvent("modal:update",{bubbles:!0,composed:!0,detail:this._readyDetail})):(this._hasEmittedReady=!0,this.dispatchEvent(new CustomEvent("modal:ready",{bubbles:!0,composed:!0,detail:this._readyDetail}))),this.hasAttribute("open")&&!this._isOpen&&"closing"!==this._modalState&&(this._isOpen=!0,this._modalState="open","inline"!==this.display&&C.addToStack(this),this.focusFirst(),this.loadRemoteContentIfNeeded()),this.applyStackPosition(),(0,m.rI)(),!this.autoload||this.openState||this._hasAutoloaded||(this._hasAutoloaded=!0,requestAnimationFrame(()=>this.open({animate:!1})))}bindRenderedEvents(){const e=this.getModalRoot();e&&(e.removeEventListener("click",this.handleOverlayClick),e.addEventListener("click",this.handleOverlayClick),document.removeEventListener("keydown",this.onKeyDown),document.addEventListener("keydown",this.onKeyDown))}bindSlotEventHandlers(){const e=this.getModalRoot();e&&this._slotEventHandlers.size&&this._slotEventHandlers.forEach((t,o)=>{const i=e.querySelector(`[data-sf-runtime-event-id="${o}"]`);i&&t.forEach(({eventName:e,handler:t})=>{i.addEventListener(e,t)})})}handleOverlayClick(e){e.target===this.getModalRoot()?.querySelector("[data-sf-modal-overlay]")&&this.closeOnOverlay&&!this.unclose&&this.close()}handleCloseClick(e){e.preventDefault(),this.unclose||this.close()}handleHideClick(e){e.preventDefault(),this.hide()}onKeyDown(e){if((this.openState||"closing"===this._modalState)&&"inline"!==this.display&&C.isTopModal(this)&&!this.hiddenState)return"Escape"!==e.key||!this.closeOnEsc||this.unclose||"closing"===this._modalState||e.defaultPrevented||document.documentElement?.dataset?.sfPopoverOpen?void("Tab"===e.key&&this.trapFocus(e)):(e.preventDefault(),e.stopImmediatePropagation(),void this.close())}trapFocus(e){if(!C.isTopModal(this))return;if(this.hiddenState)return;const t=this.getModalRoot()?.querySelector("[data-sf-modal-panel]");(0,l.Zg)(t,e)}focusFirst(){if("inline"===this.display)return;if("inline"!==this.display&&!C.isTopModal(this))return;if(this.hiddenState)return;const e=this.getModalRoot()?.querySelector("[data-sf-modal-panel]");e&&e.focus()}resetRemoteContent(){this._remoteHtml="",this._remoteError="",this._remoteLoaded=!1,this._isLoadingRemote=!1,this.abortRemoteContent()}abortRemoteContent(){this._fetchController&&(this._fetchController.abort(),this._fetchController=null)}loadRemoteContentIfNeeded(e=!1){if(this.src&&("ajax"===this.mode||"iframe"===this.mode)&&(this.preload||this.openState||e))return"iframe"===this.mode?(this._remoteLoaded=!0,void this.requestComponentUpdate("remote-content")):void(this._remoteLoaded&&!e||this.loadAjaxContent())}async loadAjaxContent(){this.abortRemoteContent(),this._isLoadingRemote=!0,this._remoteError="";let e=!1;this.requestComponentUpdate("remote-loading"),this.emitContentEvent("modal:before-content-upload"),this._fetchController=new AbortController;try{if(this.src.startsWith("#")){const e=document.querySelector(this.src);if(!e)throw new Error(`Element not found: ${this.src}`);this._remoteHtml=e.innerHTML}else{const e=await fetch(this.src,{signal:this._fetchController.signal});if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);this._remoteHtml=await e.text()}this._remoteLoaded=!0}catch(t){"AbortError"===t.name?e=!0:this._remoteError=t.message||"Failed to load content"}finally{this._fetchController=null,this._isLoadingRemote=!1,this.requestComponentUpdate("remote-content"),e||this.emitContentEvent("modal:after-content-upload")}}handleIframeLoad=()=>{this._remoteLoaded=!0,this.emitContentEvent("modal:after-content-upload")};handleIframeError=()=>{this._remoteError="Failed to load iframe content",this.requestComponentUpdate("remote-content")};emitContentEvent(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:{component:this,modal:this,modalId:this.modalId,src:this.src,remote:this.state.remote}}))}emitModalEvent(e,{cancelable:t=!1,detail:o={}}={}){const i=new CustomEvent(e,{bubbles:!0,composed:!0,cancelable:t,detail:{component:this,modal:this,modalId:this.modalId,root:this.getModalRoot(),...o}});return this.dispatchEvent(i),!i.defaultPrevented}emitBeforeOpen(){return this.emitModalEvent("modal:before-open",{cancelable:!0,detail:{phase:"before-open"}})}emitAfterOpen(){this.emitModalEvent("modal:after-open",{detail:{phase:"after-open"}})}emitBeforeClose(){return this.emitModalEvent("modal:before-close",{cancelable:!0,detail:{phase:"before-close"}})}emitAfterClose(){this.emitModalEvent("modal:after-close",{detail:{phase:"after-close"}})}emitBeforeHide(){return this.emitModalEvent("modal:before-hide",{cancelable:!0,detail:{phase:"before-hide"}})}emitAfterHide(){this.emitModalEvent("modal:after-hide",{detail:{phase:"after-hide"}})}emitBeforeShow(){return this.emitModalEvent("modal:before-show",{cancelable:!0,detail:{phase:"before-show"}})}emitAfterShow(){this.emitModalEvent("modal:after-show",{detail:{phase:"after-show"}})}syncOpenAttribute(e){this._syncingOpenAttribute=!0,e?this.setAttribute("open",""):this.removeAttribute("open"),this._syncingOpenAttribute=!1}attributeChangedCallback(e,t,o){if(!this._syncingOpenAttribute||"open"!==e){if("open"===e&&t!==o)return this._isMounted?void(null===o?(this.close(),this.requestComponentUpdate("open-attribute")):this.open()):void super.attributeChangedCallback(e,t,o);["src","mode","preload"].includes(e)&&t!==o&&this.resetRemoteContent(),"minimized"===e&&t!==o&&(this._isHidden=null!==o,this.syncMinimizedLayer()),super.attributeChangedCallback(e,t,o)}}teardownModal(){const e=C.isTopModal(this);this.abortRemoteContent(),this.cancelCloseTransition(),document.removeEventListener("keydown",this.onKeyDown),"inline"!==this.display&&C.removeFromStack(this),this._isOpen=!1,this._modalState="closed",this.clearPortal(),this._releaseClosingContent?.(),this._releaseClosingContent=null,(0,m.BK)(e,this._lastActive,this._focusReturnAncestors)}clearPortal(){this._portalRoot&&((0,i.render)(i.nothing,this._portalRoot),this._portalRoot.remove(),this._portalRoot=null)}ownModalHandler(e){return t=>{t.detail?.modal===this&&e.call(this,t)}}onBeforeOpen(e,t){return"function"==typeof e&&this.addEventListener("modal:before-open",this.ownModalHandler(e),t),this}onAfterOpen(e,t){return"function"==typeof e&&this.addEventListener("modal:after-open",this.ownModalHandler(e),t),this}onBeforeClose(e,t){return"function"==typeof e&&this.addEventListener("modal:before-close",this.ownModalHandler(e),t),this}onAfterClose(e,t){return"function"==typeof e&&this.addEventListener("modal:after-close",this.ownModalHandler(e),t),this}onBeforeHide(e,t){return"function"==typeof e&&this.addEventListener("modal:before-hide",this.ownModalHandler(e),t),this}onAfterHide(e,t){return"function"==typeof e&&this.addEventListener("modal:after-hide",this.ownModalHandler(e),t),this}onBeforeShow(e,t){return"function"==typeof e&&this.addEventListener("modal:before-show",this.ownModalHandler(e),t),this}onAfterShow(e,t){return"function"==typeof e&&this.addEventListener("modal:after-show",this.ownModalHandler(e),t),this}onModalReady(e,t){return"function"!=typeof e?this:this._readyDetail?(e(new CustomEvent("modal:ready",{detail:this._readyDetail})),this):(this.addEventListener("modal:ready",this.ownModalHandler(e),t),this)}onModalUpdate(e,t){return"function"==typeof e&&this.addEventListener("modal:update",this.ownModalHandler(e),t),this}static bindGlobalEvents(){C.globalBound||"undefined"==typeof document||(document.addEventListener("click",e=>{const t=e.target.closest("[data-sf-modal-open]");if(t)return void C.registry.get(t.getAttribute("data-sf-modal-open"))?.open();const o=e.target.closest("[data-sf-modal-show]");if(o)return void C.registry.get(o.getAttribute("data-sf-modal-show"))?.show();const i=e.target.closest("[data-sf-modal-hide]");if(i)return void C.registry.get(i.getAttribute("data-sf-modal-hide"))?.hide();const s=e.target.closest("[data-sf-modal-close]");if(!s)return;const n=s.getAttribute("data-sf-modal-close")||s.closest(".sf-modal")?.getAttribute("data-sf-modal-id");C.registry.get(n)?.close()}),C.globalBound=!0)}static lockPage(e=!0){C.lockState||(C.lockState=(0,c.i)(e))}static unlockPage(){(0,c.l)(C.lockState),C.lockState=null}}C.define("sf-modal"),t()}catch(_){t(_)}})},e45eac6c719d(e,t,o){o.a(e,async(e,i)=>{try{o.d(t,{Q:()=>d});var s=o("ddf1cdb42ecc"),n=e([s]),a=n.then?(await n)():n;s=a[0];function r(...e){return e.filter(Boolean).join(" ").trim()}function l(e){const t=e.blur?`backdrop-blur-${e.blurType}`:"focus"===e.overlayPreset?"backdrop-blur-small":"";return r(`sf-modal-overlay--${e.overlayPreset}`,t)}function d(e){const t="inline"===e.display,o=Boolean(e.src)&&("ajax"===e.mode||"iframe"===e.mode),i=!1!==e.showHeader,n=e.hasHeaderContent,a=`${e.modalId}-title`,d=e.ariaLabel||(n||!i?e.title:""),h=e.hasContentContent,c=e.hasFooterContent&&e.showFooter,u=[e.width?`--sf-modal-width:${e.width}`:"",e.height?`--sf-modal-height:${e.height}`:""].filter(Boolean).join(";"),m=[e.surfacePadding?`--sf-modal-surface-padding:${e.surfacePadding}`:""].filter(Boolean).join(";"),f=[e.modalZIndex?`z-index:${e.modalZIndex}`:""].filter(Boolean).join(";");return s.html`
|
|
33
|
+
`}return i.nothing}_loadingSpinnerNode(){return this._loadingSpinner||(this._loadingSpinner=(0,u.le)({className:"sf-modal-spinner"})),this._loadingSpinner}templateContext(){this._slotEventHandlers.clear(),this._slotEventId=0;const e=this.getPropsContext();return this.createTemplateContext({...e,component:this,closeText:(0,a.pageText)(b,"close",this),minimizeText:(0,a.pageText)(b,"minimize",this),title:this.title,modalId:this.modalId,open:this.renderOpenState,modalState:this.renderModalState,animate:this._animatePanel&&"inline"!==this.display,modalZIndex:this.modalZIndex,hide:this.hideButton,minimized:this.hiddenState,showClose:this.showClose,blur:this.blur,blurType:this.blurType,hasCustomBlurType:this.hasCustomBlurType,hasHeaderContent:this.hasSlotContent("header"),hasContentContent:this.hasSlotContent("content"),hasFooterContent:this.hasSlotContent("footer"),headerContent:(0,s.unsafeHTML)(this.getSlotHtml("header")),contentContent:(0,s.unsafeHTML)(this.getSlotHtml("content")),footerContent:(0,s.unsafeHTML)(this.getSlotHtml("footer")),remoteContent:this.remoteContent,onCloseClick:this.handleCloseClick,onHideClick:this.handleHideClick})}getSlotHtml(e){return[...this._liveSlotNodes.get(e)||[],...this._slotTemplates.get(e)||[]].map(e=>{if(e instanceof HTMLElement){const t=e.cloneNode(!0);return this.copyRuntimeData(e,t),this.assignSlotEventIds(t),this.cleanNestedSmartComponentRender(t),t.outerHTML}return e.textContent||""}).join("")}assignSlotEventIds(e){[e,...Array.from(e.querySelectorAll?.("*")||[])].forEach(e=>{if(!e.__sfCreateEventHandlers?.length)return;const t="sf-modal-slot-event-"+ ++this._slotEventId;e.setAttribute("data-sf-runtime-event-id",t),this._slotEventHandlers.set(t,e.__sfCreateEventHandlers.slice())})}cleanNestedSmartComponentRender(e){[e,...Array.from(e.querySelectorAll?.("*")||[])].forEach(e=>{(e.tagName?.toLowerCase?.()||"").startsWith("sf-")&&Array.from(e.childNodes).forEach(e=>{e instanceof HTMLElement&&(e.hasAttribute("slot")||"slot"===e.tagName.toLowerCase()||e.tagName.toLowerCase().startsWith("sf-"))||e.remove()})})}template(){return(0,r.Q)(this.templateContext())}async renderComponent(e=[]){const t=++this._renderToken;if(!this._isMounted)return;this.beforeRender(e),this.emitComponentEvent("before-render",{changedAttributes:e}),this.runExternalHook("beforeRender",{changedAttributes:e,root:this});const o=await this.resolveTemplateResult(e);this._isMounted&&t===this._renderToken&&((0,i.render)(o,this.resolveRenderTarget()),this.afterRender(e),this.runExternalHook("afterRender",{changedAttributes:e,root:this}),this.emitComponentEvent("after-render",{changedAttributes:e}))}resolveRenderTarget(){return"inline"===this.display?(this.clearPortal(),this._hostClearedForPortal=!1,this._renderTarget=this,this):(this._hostClearedForPortal||((0,i.render)(i.nothing,this),this._hostClearedForPortal=!0),this._portalRoot||(this._portalRoot=this.resolvePortalRoot()),this.dedupePortalRoots(),this._renderTarget=this._portalRoot,this._portalRoot)}get overlayHome(){return this.closest(g)||document.body}get inContainer(){return this.overlayHome!==document.body}resolvePortalRoot(){const e=this.overlayHome,t=e.querySelector(`[data-sf-modal-portal="${this.modalId}"]`);if(t)return t;const o=document.createElement("div");return o.setAttribute("data-sf-modal-portal",this.modalId),e.append(o),o}dedupePortalRoots(){Array.from(document.querySelectorAll(`[data-sf-modal-portal="${this.modalId}"]`)).forEach(e=>{e!==this._portalRoot&&((0,i.render)(i.nothing,e),e.remove())}),this._portalRoot.isConnected||(this._portalRoot.setAttribute("data-sf-modal-portal",this.modalId),this.overlayHome.append(this._portalRoot))}applyStackPosition(e=C.getStackIndex(this)){this._stackIndex=e;const t=this.getModalRoot();return t&&"inline"!==this.display?e<0?(t.style.removeProperty("z-index"),t.style.removeProperty("--sf-modal-stack-index"),this):(t.style.setProperty("--sf-modal-stack-index",String(e)),t.style.zIndex=String(this.modalZIndex),this):this}open(e={}){const{animate:t=!0}="boolean"==typeof e?{animate:e}:e,o="closing"===this._modalState;return(this._isOpen||"inline"===this.display&&this.openState)&&!o?(this.cancelCloseTransition(),C.bringToFront(this),this):this.emitBeforeOpen()?(o||(this._lastActive=document.activeElement,this._focusReturnAncestors=(0,m.M$)(this._lastActive)),o&&(this.cancelCloseTransition(),this._releaseClosingContent?.(),this._releaseClosingContent=null),this._isOpen=!0,this._inlineClosed=!1,this._animatePanel=Boolean(t),this._modalState=t&&"inline"!==this.display?"opening":"open",this.syncOpenAttribute(!0),"inline"===this.display||o?"inline"!==this.display&&C.bringToFront(this):C.addToStack(this),this.requestComponentUpdate("open"),(0,h.Gp)(()=>{if(!this._isOpen||"closing"===this._modalState)return;this._modalState="open";const e=new Promise(e=>{const t=o=>{o.detail?.changedAttributes?.includes("open-state")&&(this.removeEventListener("sf-updated",t),e())};this.addEventListener("sf-updated",t)});this.requestComponentUpdate("open-state"),e.then(()=>{this._isOpen&&"open"===this._modalState&&(this.focusFirst(),this.emitAfterOpen(),this.loadRemoteContentIfNeeded())})}),this):this}close(){if(!this.openState||"closing"===this._modalState)return this;if(!this.emitBeforeClose())return this;if("inline"===this.display)return this.finishClose(),this;this._modalState="closing",this._isOpen=!1,this.requestComponentUpdate("close");const e=this.getModalRoot()?.querySelector("[data-sf-modal-panel]");return this._releaseClosingContent=(0,d.e)(e,C.isTopModal(this)),this._closeTransitionAbort=(0,h.ju)(()=>this.getModalRoot(),()=>this.finishClose()),this}hide(){return!this.openState||"inline"===this.display||this.hiddenState?this:this.emitBeforeHide()?(this._isHidden=!0,this.setAttribute("minimized",""),this.requestComponentUpdate("hide"),this.emitAfterHide(),this):this}show(){return this.openState&&"inline"!==this.display&&this.hiddenState&&this.emitBeforeShow()?(this._isHidden=!1,this.removeAttribute("minimized"),this.requestComponentUpdate("show"),this.emitAfterShow(),this):this}syncMinimizedLayer(){if(!this._isMounted||!this.openState||"inline"===this.display||"closed"===this._modalState||"closing"===this._modalState)return;const e=this.getModalRoot();if(this.hiddenState){const t=C.isTopModal(this);(0,m.ZT)(this),this.applyStackPosition(),(0,m.BK)(t,this._lastActive,this._focusReturnAncestors),e&&(e.inert=!0,e.setAttribute("aria-hidden","true"))}else e&&(e.inert=!1,e.setAttribute("aria-hidden","false")),(0,m.k8)(this,C),C.bringToFront(this),requestAnimationFrame(()=>this.focusFirst())}toggle(){return this.openState?this.close():this.open()}finishClose(){if("inline"!==this.display&&"closing"!==this._modalState)return this;const e=C.isTopModal(this);this.cancelCloseTransition(),this._isOpen=!1,"inline"===this.display&&(this._inlineClosed=!0),this._isHidden=!1,this._modalState="closed",this.removeAttribute("minimized"),this.syncOpenAttribute(!1);const t=this.getModalRoot();return t&&(t.inert=!0,t.setAttribute("aria-hidden","true")),this._releaseClosingContent?.(),this._releaseClosingContent=null,"inline"!==this.display&&C.removeFromStack(this),"inline"!==this.display&&(0,m.BK)(e,this._lastActive,this._focusReturnAncestors),this.requestComponentUpdate("after-close"),this.emitAfterClose(),this}cancelCloseTransition(){this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null),this._closeTransitionAbort&&(this._closeTransitionAbort(),this._closeTransitionAbort=null)}setSrc(e){return this.setAttribute("src",e||""),this.resetRemoteContent(),this.loadRemoteContentIfNeeded(),this}reloadContent(){return this.resetRemoteContent(),this.loadRemoteContentIfNeeded(!0),this}getModalRoot(){return this.modalRoot}afterRender(){this.bindRenderedEvents(),this.bindSlotEventHandlers(),"closing"===this._modalState&&(this._releaseClosingContent?.(),this._releaseClosingContent=(0,d.e)(this.getModalRoot()?.querySelector("[data-sf-modal-panel]"),C.isTopModal(this))),this._readyDetail={component:this,modal:this,modalId:this.modalId,root:this.getModalRoot()},this._hasEmittedReady?this.dispatchEvent(new CustomEvent("modal:update",{bubbles:!0,composed:!0,detail:this._readyDetail})):(this._hasEmittedReady=!0,this.dispatchEvent(new CustomEvent("modal:ready",{bubbles:!0,composed:!0,detail:this._readyDetail}))),this.hasAttribute("open")&&!this._isOpen&&"closing"!==this._modalState&&(this._isOpen=!0,this._modalState="open","inline"!==this.display&&C.addToStack(this),this.focusFirst(),this.loadRemoteContentIfNeeded()),this.applyStackPosition(),(0,m.rI)(),!this.autoload||this.openState||this._hasAutoloaded||(this._hasAutoloaded=!0,requestAnimationFrame(()=>this.open({animate:!1})))}bindRenderedEvents(){const e=this.getModalRoot();e&&(e.removeEventListener("click",this.handleOverlayClick),e.addEventListener("click",this.handleOverlayClick),document.removeEventListener("keydown",this.onKeyDown),document.addEventListener("keydown",this.onKeyDown))}bindSlotEventHandlers(){const e=this.getModalRoot();e&&this._slotEventHandlers.size&&this._slotEventHandlers.forEach((t,o)=>{const i=e.querySelector(`[data-sf-runtime-event-id="${o}"]`);i&&t.forEach(({eventName:e,handler:t})=>{i.addEventListener(e,t)})})}handleOverlayClick(e){e.target===this.getModalRoot()?.querySelector("[data-sf-modal-overlay]")&&this.closeOnOverlay&&!this.unclose&&this.close()}handleCloseClick(e){e.preventDefault(),this.unclose||this.close()}handleHideClick(e){e.preventDefault(),this.hide()}onKeyDown(e){if((this.openState||"closing"===this._modalState)&&"inline"!==this.display&&C.isTopModal(this)&&!this.hiddenState)return"Escape"!==e.key||!this.closeOnEsc||this.unclose||"closing"===this._modalState||e.defaultPrevented||document.documentElement?.dataset?.sfPopoverOpen?void("Tab"===e.key&&this.trapFocus(e)):(e.preventDefault(),e.stopImmediatePropagation(),void this.close())}trapFocus(e){if(!C.isTopModal(this))return;if(this.hiddenState)return;const t=this.getModalRoot()?.querySelector("[data-sf-modal-panel]");(0,l.Zg)(t,e)}focusFirst(){if("inline"===this.display)return;if("inline"!==this.display&&!C.isTopModal(this))return;if(this.hiddenState)return;const e=this.getModalRoot()?.querySelector("[data-sf-modal-panel]");e&&e.focus()}resetRemoteContent(){this._remoteHtml="",this._remoteError="",this._remoteLoaded=!1,this._isLoadingRemote=!1,this.abortRemoteContent()}abortRemoteContent(){this._fetchController&&(this._fetchController.abort(),this._fetchController=null)}loadRemoteContentIfNeeded(e=!1){if(this.src&&("ajax"===this.mode||"iframe"===this.mode)&&(this.preload||this.openState||e))return"iframe"===this.mode?(this._remoteLoaded=!0,void this.requestComponentUpdate("remote-content")):void(this._remoteLoaded&&!e||this.loadAjaxContent())}async loadAjaxContent(){this.abortRemoteContent(),this._isLoadingRemote=!0,this._remoteError="";let e=!1;this.requestComponentUpdate("remote-loading"),this.emitContentEvent("modal:before-content-upload");const t=new AbortController;this._fetchController=t;try{if(this.src.startsWith("#")){const e=document.querySelector(this.src);if(!e)throw new Error(`Element not found: ${this.src}`);this._remoteHtml=e.innerHTML}else{const e=await fetch(this.src,{signal:t.signal});if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);this._remoteHtml=await e.text()}this._remoteLoaded=!0}catch(t){"AbortError"===t.name?e=!0:this._remoteError=t.message||(0,a.pageText)(b,"loadFailed",this)}finally{e&&this._fetchController&&this._fetchController!==t||(this._fetchController=null,this._isLoadingRemote=!1,this.requestComponentUpdate("remote-content"),e||this.emitContentEvent("modal:after-content-upload"))}}handleIframeLoad=()=>{this._remoteLoaded=!0,this.emitContentEvent("modal:after-content-upload")};handleIframeError=()=>{this._remoteError=(0,a.pageText)(b,"frameFailed",this),this.requestComponentUpdate("remote-content")};emitContentEvent(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:{component:this,modal:this,modalId:this.modalId,src:this.src,remote:this.state.remote}}))}emitModalEvent(e,{cancelable:t=!1,detail:o={}}={}){const i=new CustomEvent(e,{bubbles:!0,composed:!0,cancelable:t,detail:{component:this,modal:this,modalId:this.modalId,root:this.getModalRoot(),...o}});return this.dispatchEvent(i),!i.defaultPrevented}emitBeforeOpen(){return this.emitModalEvent("modal:before-open",{cancelable:!0,detail:{phase:"before-open"}})}emitAfterOpen(){this.emitModalEvent("modal:after-open",{detail:{phase:"after-open"}})}emitBeforeClose(){return this.emitModalEvent("modal:before-close",{cancelable:!0,detail:{phase:"before-close"}})}emitAfterClose(){this.emitModalEvent("modal:after-close",{detail:{phase:"after-close"}})}emitBeforeHide(){return this.emitModalEvent("modal:before-hide",{cancelable:!0,detail:{phase:"before-hide"}})}emitAfterHide(){this.emitModalEvent("modal:after-hide",{detail:{phase:"after-hide"}})}emitBeforeShow(){return this.emitModalEvent("modal:before-show",{cancelable:!0,detail:{phase:"before-show"}})}emitAfterShow(){this.emitModalEvent("modal:after-show",{detail:{phase:"after-show"}})}syncOpenAttribute(e){this._syncingOpenAttribute=!0,e?this.setAttribute("open",""):this.removeAttribute("open"),this._syncingOpenAttribute=!1}attributeChangedCallback(e,t,o){if(!this._syncingOpenAttribute||"open"!==e){if("open"===e&&t!==o)return this._isMounted?void(null===o?(this.close(),this.requestComponentUpdate("open-attribute")):this.open()):void super.attributeChangedCallback(e,t,o);["src","mode","preload"].includes(e)&&t!==o&&this.resetRemoteContent(),"minimized"===e&&t!==o&&(this._isHidden=null!==o,this.syncMinimizedLayer()),super.attributeChangedCallback(e,t,o)}}teardownModal(){const e=C.isTopModal(this);this.abortRemoteContent(),this.cancelCloseTransition(),document.removeEventListener("keydown",this.onKeyDown),"inline"!==this.display&&C.removeFromStack(this),this._isOpen=!1,this._modalState="closed",this.clearPortal(),this._releaseClosingContent?.(),this._releaseClosingContent=null,(0,m.BK)(e,this._lastActive,this._focusReturnAncestors)}clearPortal(){this._portalRoot&&((0,i.render)(i.nothing,this._portalRoot),this._portalRoot.remove(),this._portalRoot=null)}ownModalHandler(e){return t=>{t.detail?.modal===this&&e.call(this,t)}}onBeforeOpen(e,t){return"function"==typeof e&&this.addEventListener("modal:before-open",this.ownModalHandler(e),t),this}onAfterOpen(e,t){return"function"==typeof e&&this.addEventListener("modal:after-open",this.ownModalHandler(e),t),this}onBeforeClose(e,t){return"function"==typeof e&&this.addEventListener("modal:before-close",this.ownModalHandler(e),t),this}onAfterClose(e,t){return"function"==typeof e&&this.addEventListener("modal:after-close",this.ownModalHandler(e),t),this}onBeforeHide(e,t){return"function"==typeof e&&this.addEventListener("modal:before-hide",this.ownModalHandler(e),t),this}onAfterHide(e,t){return"function"==typeof e&&this.addEventListener("modal:after-hide",this.ownModalHandler(e),t),this}onBeforeShow(e,t){return"function"==typeof e&&this.addEventListener("modal:before-show",this.ownModalHandler(e),t),this}onAfterShow(e,t){return"function"==typeof e&&this.addEventListener("modal:after-show",this.ownModalHandler(e),t),this}onModalReady(e,t){return"function"!=typeof e?this:this._readyDetail?(e(new CustomEvent("modal:ready",{detail:this._readyDetail})),this):(this.addEventListener("modal:ready",this.ownModalHandler(e),t),this)}onModalUpdate(e,t){return"function"==typeof e&&this.addEventListener("modal:update",this.ownModalHandler(e),t),this}static bindGlobalEvents(){C.globalBound||"undefined"==typeof document||(document.addEventListener("click",e=>{const t=e.target.closest("[data-sf-modal-open]");if(t)return void C.registry.get(t.getAttribute("data-sf-modal-open"))?.open();const o=e.target.closest("[data-sf-modal-show]");if(o)return void C.registry.get(o.getAttribute("data-sf-modal-show"))?.show();const i=e.target.closest("[data-sf-modal-hide]");if(i)return void C.registry.get(i.getAttribute("data-sf-modal-hide"))?.hide();const s=e.target.closest("[data-sf-modal-close]");if(!s)return;const n=s.getAttribute("data-sf-modal-close")||s.closest(".sf-modal")?.getAttribute("data-sf-modal-id");C.registry.get(n)?.close()}),C.globalBound=!0)}static lockPage(e=!0){C.lockState||(C.lockState=(0,c.i)(e))}static unlockPage(){(0,c.l)(C.lockState),C.lockState=null}}C.define("sf-modal"),t()}catch(_){t(_)}})},e45eac6c719d(e,t,o){o.a(e,async(e,i)=>{try{o.d(t,{Q:()=>d});var s=o("ddf1cdb42ecc"),n=e([s]),a=n.then?(await n)():n;s=a[0];function r(...e){return e.filter(Boolean).join(" ").trim()}function l(e){const t=e.blur?`backdrop-blur-${e.blurType}`:"focus"===e.overlayPreset?"backdrop-blur-small":"";return r(`sf-modal-overlay--${e.overlayPreset}`,t)}function d(e){const t="inline"===e.display,o=Boolean(e.src)&&("ajax"===e.mode||"iframe"===e.mode),i=!1!==e.showHeader,n=e.hasHeaderContent,a=`${e.modalId}-title`,d=e.ariaLabel||(n||!i?e.title:""),h=e.hasContentContent,c=e.hasFooterContent&&e.showFooter,u=[e.width?`--sf-modal-width:${e.width}`:"",e.height?`--sf-modal-height:${e.height}`:""].filter(Boolean).join(";"),m=[e.surfacePadding?`--sf-modal-surface-padding:${e.surfacePadding}`:""].filter(Boolean).join(";"),f=[e.modalZIndex?`z-index:${e.modalZIndex}`:""].filter(Boolean).join(";");return s.html`
|
|
32
34
|
<div
|
|
33
35
|
id=${e.modalId}
|
|
34
36
|
class=${r("sf-modal",`sf-modal--position-${e.position}`,`sf-modal--positon-${e.position}`,t?"sf-modal--inline inline-block w-full":"fixed top-0 inline-start-0 w-full h-full z-9 p-3 items-cross-center content-main-center",e.open?"flex":"hidden",!t&&e.animate&&"animate",e.rootClass)}
|
|
@@ -1030,7 +1030,7 @@
|
|
|
1030
1030
|
"source_artifacts": [
|
|
1031
1031
|
{
|
|
1032
1032
|
"path": "src/smart/modal/index.js",
|
|
1033
|
-
"sha256": "
|
|
1033
|
+
"sha256": "1c5ccb019f5a18101b1ada5399e6c014a2dcdd75277cf0aa819b17b22138ecd5"
|
|
1034
1034
|
}
|
|
1035
1035
|
],
|
|
1036
1036
|
"generated_runtime": [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{"use strict";var t={"58661bec99a6"(t,e,i){const n=function(t,e){if(t&&e)if("undefined"==typeof window||"function"!=typeof window.registerSfComponent){if("undefined"!=typeof window&&window.SF?.Loader?.registerComponent)window.SF.Loader.registerComponent(t,e);else if("undefined"!=typeof window){(window.SF_PENDING_COMPONENTS=window.SF_PENDING_COMPONENTS||[]).push([t,e])}}else window.registerSfComponent(t,e)};i.d(e,["A",0,n])},"50d2a204ba4c"(t,e,i){i.d(e,{Gw:()=>r,_E:()=>s,l8:()=>a});const n=["arc","breathing","comet","dots"];function a(t,e={}){const i=document.createElementNS("http://www.w3.org/2000/svg",t);return Object.entries(e).forEach(([t,e])=>{null!=e&&""!==e&&i.setAttribute(t,String(e))}),i}const o=t=>Math.round(1e3*t)/1e3;function r({width:t=24,height:e=24,stroke:i=2,dots:n=8,filled:r=3,dotRadius:s=null,direction:l="clockwise",pixel:d=!1}={}){const c=t/2,h=e/2,u=Math.min(t,e)/2,f=Math.max(1,u-i/2),p=a("svg",{class:"sf-loader-svg",viewBox:`0 0 ${t} ${e}`,width:d?t:null,height:d?e:null,"aria-hidden":"true",focusable:"false"}),m={cx:c,cy:h,r:o(f),fill:"none",stroke:"currentColor","stroke-width":i},g=a("circle",{class:"sf-loader-ring-filled",...m,opacity:"0.3"}),b=a("circle",{class:"sf-loader-ring-accent",...m,"stroke-linecap":"round",pathLength:100,"stroke-dasharray":"0 100",transform:`rotate(90 ${c} ${h})`}),w=a("g",{class:"sf-loader-comet",display:"none",transform:`rotate(-90 ${c} ${h})`});for(let t=0;t<10;t+=1){const e=9===t;w.append(a("circle",{class:"sf-loader-comet-segment"+(e?" sf-loader-comet-head":""),...m,"stroke-linecap":e?"round":"butt",pathLength:100,"stroke-dasharray":`${o(4)} ${o(96)}`,"stroke-dashoffset":o(-4*t),opacity:o(((t+1)/10)**1.6)}))}const y=Math.max(3,Math.min(32,Math.floor(Number(n)||8))),S=Math.max(1,Math.min(y,Math.floor(Number(r)||3))),v=Math.min(i,.7*Math.PI*(u-i)/y),M=null==s||""===s?v:Math.max(1,Math.min(Number(s)||v,u/4)),k=Math.max(M,u-M),x=a("g",{class:"sf-loader-dots",display:"none",style:`--sf-loader-dot-count:${y}; --sf-loader-dot-filled:${S};`});for(let t=0;t<y;t+=1){const e=2*Math.PI/y*t-Math.PI/2,i="counterclockwise"===l?t:(y-t)%y;x.append(a("circle",{class:"sf-loader-dot"+(t<S?" sf-loader-dot--active":""),cx:o(c+k*Math.cos(e)),cy:o(h+k*Math.sin(e)),r:o(M),fill:"currentColor",style:`--sf-loader-dot-index:${t}; --sf-loader-dot-step:${i};`}))}return p.append(g,b,w,x),p}function s(t={}){return r({...t,width:24,height:24,stroke:2,dotRadius:null,pixel:!1})}i.d(e,["vv",0,n])},eecc41af23fd(t,e,i){i.a(t,async(t,n)=>{try{i.d(e,{AM:()=>_,KH:()=>E,t7:()=>$});var a=i("d7f974466839"),o=i("58661bec99a6"),r=i("0d662e4d7d63"),s=i("06e8cd089f28"),l=i("50d2a204ba4c"),d=t([r]),c=d.then?(await d)():d;r=c[0];const h={en:{label:"Loading…"},ru:{label:"Загрузка…"}},u=".sf-loader-container",f="sfSpinnerBound";function p(t,e){const i=Number.parseFloat(String(t??""));return Number.isFinite(i)?i:e}function m(t,e,i){return Math.min(Math.max(t,e),i)}function g(t,e,i){const n=String(t||"").trim().toLowerCase();return e.includes(n)?n:i}const b=[["width","data-width","width"],["w","data-w","width"],["height","data-height","height"],["h","data-h","height"],["strokeWidth","data-stroke-width","stroke-width"],["dotRadius","data-dot-radius","dot-radius"]];function w(t){const e=t.closest?.("sf-spinner"),i=b.filter(([e])=>{const i=t.dataset[e];return void 0!==i&&""!==i});return i.forEach(([,t,i])=>{(0,s.YB)({component:e?"sf-spinner":"spinner",kind:"attribute",from:e?i:t,to:e?"size":null})}),i.length>0}function y(t={}){return["width","height","strokeWidth"].some(e=>{const i=t?.[e];return null!=i&&""!==i})?S(t):(0,l._E)(t)}function S({width:t=58,height:e=58,strokeWidth:i=4,dots:n=8,filled:a=3,dotRadius:o=null,direction:r="clockwise"}={}){const s=m(p(t,58),16,256),d=m(p(e,s),16,256),c=m(p(i,4),1,Math.min(s,d)/2);return(0,l.Gw)({width:s,height:d,stroke:c,dots:n,filled:a,dotRadius:o,direction:r,pixel:!0})}function v({width:t=58,height:e=58,dots:i=16,filled:n=6,dotRadius:a=null,direction:o="clockwise"}={}){const r=m(p(t,58),16,256),s=m(p(e,r),16,256),d=m(Math.floor(p(i,16)),3,32),c=m(Math.floor(p(n,6)),1,d),h=null===a?Math.max(1.5,.06*Math.min(r,s)):m(p(a,1),1,Math.min(r,s)/4),u=Math.max(h,Math.min(r,s)/2-h-1),f=r/2,g=s/2,b=(0,l.l8)("svg",{class:"sf-loader-svg",viewBox:`0 0 ${r} ${s}`,width:r,height:s,"aria-hidden":"true",style:`--sf-loader-dot-count:${d}; --sf-loader-dot-filled:${c};`});for(let t=0;t<d;t+=1){const e=2*Math.PI/d*t-Math.PI/2,i=f+u*Math.cos(e),n=g+u*Math.sin(e),a="counterclockwise"===o?t:(d-t)%d,r=(0,l.l8)("circle",{class:"sf-loader-dot"+(t<c?" sf-loader-dot--active":""),cx:i,cy:n,r:h,style:`--sf-loader-dot-index:${t}; --sf-loader-dot-step:${a};`});b.append(r)}return b}function M(t){const e=t.querySelector(".sf-loader--loading-indicator"),i=t.querySelector(".sf-loader--circles"),n=t.querySelector(".sf-loader--text"),a=Object.prototype.hasOwnProperty.call(t.dataset,"width")||Object.prototype.hasOwnProperty.call(t.dataset,"w"),o=Object.prototype.hasOwnProperty.call(t.dataset,"height")||Object.prototype.hasOwnProperty.call(t.dataset,"h"),r=w(t),s=m(p(t.dataset.width,p(t.dataset.w,58)),16,256),d=m(p(t.dataset.height,p(t.dataset.h,s)),16,256),c=t.dataset.strokeWidth?m(p(t.dataset.strokeWidth,4),1,Math.min(s,d)/2):null,h=m(Math.floor(p(t.dataset.dots,8)),3,32);return{pixel:r,width:s,height:d,strokeWidth:c,dots:h,filled:m(Math.floor(p(t.dataset.filled,3)),1,h),dotRadius:t.dataset.dotRadius?m(p(t.dataset.dotRadius,1),1,Math.min(s,d)/4):null,direction:g(t.dataset.direction,["clockwise","counterclockwise"],"clockwise"),variant:t.dataset.variant?g(t.dataset.variant,l.vv,"arc"):i?"dots":"",hasExplicitWidth:a,hasExplicitHeight:o,infinite:"true"===t.dataset.infinite,announce:"true"===t.dataset.announce,label:void 0!==t.dataset.label?t.dataset.label:n?.textContent?.trim?.()||"",indicator:e,circles:i,labelNode:n}}function k(t,e){const i=Boolean(e.label);if(t.toggleAttribute("aria-hidden",!i),e.announce&&i)return t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),void(t.dataset.sfSpinnerSemantics="status");"status"===t.dataset.sfSpinnerSemantics&&(t.removeAttribute("role"),t.removeAttribute("aria-live"),t.removeAttribute("aria-atomic"),delete t.dataset.sfSpinnerSemantics)}function x(t,e,i){let n=t.querySelector(e);return n?(n.innerHTML="",n):(n=document.createElement("div"),n.className=i,n.dataset.sfSpinnerPart=i,t.append(n),n)}function E(t){if(!(t instanceof HTMLElement))return t;const e=M(t);t.classList.add("sf-loader-container"),e.infinite?t.classList.add("sf-loader--infinite"):t.classList.remove("sf-loader--infinite"),e.pixel&&e.hasExplicitWidth?t.style.setProperty("--sf-loader-svg-width",`${e.width}px`):t.style.removeProperty("--sf-loader-svg-width"),e.pixel&&(e.hasExplicitHeight||e.hasExplicitWidth)?t.style.setProperty("--sf-loader-svg-height",`${e.height}px`):t.style.removeProperty("--sf-loader-svg-height"),null!==e.strokeWidth?t.style.setProperty("--sf-loader-stroke-width",`${e.strokeWidth}px`):t.style.removeProperty("--sf-loader-stroke-width"),t.classList.toggle("sf-loader--pixel-geometry",e.pixel),e.variant&&t.dataset.variant!==e.variant&&(t.dataset.variant=e.variant);const i=t.querySelector(".sf-loader--circles");if(i&&!t.querySelector(".sf-loader--loading-indicator")){const t=document.createElement("div");t.className="sf-loader--loading-indicator",t.dataset.sfSpinnerPart="sf-loader--loading-indicator",i.replaceWith(t)}const n=x(t,".sf-loader--loading-indicator","sf-loader--loading-indicator"),a=e.label||e.labelNode?x(t,".sf-loader--text","sf-loader--text"):null,o=e.pixel?S({...e,strokeWidth:e.strokeWidth??4}):(0,l._E)(e);return n.append(o),a&&(a.textContent=e.label||""),k(t,e),t}function $(t){return t instanceof HTMLElement&&"1"!==t.dataset[f]?(E(t),t.dataset[f]="1",t):t}function _(t){t instanceof HTMLElement&&delete t.dataset[f]}function F(t){(t instanceof Element||t===document)&&(t instanceof Element&&t.matches?.(u)&&$(t),t.querySelectorAll?.(u).forEach($))}class A extends a.y{static componentName="Spinner";constructor(t){super(t);const{width:e,height:i,label:n=(0,r.pageText)(h,"label",t?.root??document.documentElement),variant:a,dots:o=8,filled:s=3,strokeWidth:l=null,dotRadius:d=null,infinite:c=!1,announce:u=!1,direction:f="clockwise"}=this.params||{},p=this.attrs.class||this.attrs.className;this.template=document.createElement("div"),this.id&&(this.template.id=this.id),this.template.classList.add("sf-loader-container"),p&&this.template.classList.add(...`${p}`.split(" ").filter(Boolean)),Object.entries(this.attrs).filter(([t])=>!["class","className"].includes(t)).forEach(([t,e])=>{null!=e&&this.template.setAttribute(t,e)}),null!=e&&""!==e&&(this.template.dataset.width=String(e)),null!=i&&""!==i&&(this.template.dataset.height=String(i)),this.template.dataset.label=String(n??""),null!=a&&""!==a&&(this.template.dataset.variant=String(a)),this.template.dataset.dots=String(o),this.template.dataset.filled=String(s),null!=l&&""!==l&&(this.template.dataset.strokeWidth=String(l)),this.template.dataset.infinite=String(c),this.template.dataset.announce=String(u),this.template.dataset.direction=String(f),null!=d&&(this.template.dataset.dotRadius=String(d))}init(){$(this.template)}destroyInternal(){_(this.template)}}(0,o.A)("Spinner",A),"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.Spinner=window.SF.Spinner||{},window.SF.Spinner.bind=$,window.SF.Spinner.render=E,window.SF.Spinner.unbind=_,window.SF.Spinner.createArcSvg=y,window.SF.Spinner.createDotsSvg=v),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>F(document)):F(document);new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{t instanceof Element&&F(t)})})}).observe(document.documentElement,{childList:!0,subtree:!0}),n()}catch(T){n(T)}})},d7f974466839(t,e,i){i.d(e,{y:()=>n});class n{lifecycleName(){return this.componentName??this.constructor.componentName}constructor(t){this.props=t,this.id=t?.id,this.params=t?.param,this.attrs=t?.attrs||{},this.template=null,window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:beforeRender`,{detail:this}))}getUtilityMap(){return this.constructor.utilityMap||null}extractUtilityClasses(t){if(!Array.isArray(t))return[];const e=new Set;return t.forEach(t=>{if("string"!=typeof t)return;const i=t.match(/\(([^)]+)\)/g);i&&i.forEach(t=>{t.slice(1,-1).split(/\s+/).filter(Boolean).forEach(t=>{t.startsWith(".")&&t.length>1&&e.add(t.slice(1))})})}),Array.from(e)}applyLayoutUtilities(t,e){if(!t||!e)return;const i=this.getUtilityMap();if(!i||!i[e])return;this.extractUtilityClasses(i[e]).forEach(e=>t.classList.add(e))}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(){}}},"06e8cd089f28"(t,e,i){function n(){const t=globalThis.SF=globalThis.SF||{};return t.__deprecationNotes instanceof Map||Object.defineProperty(t,"__deprecationNotes",{value:new Map,configurable:!0}),t.__deprecationNotes}function a({component:t="",kind:e="attribute",attribute:i="",from:a,to:o=null}={}){if(!a)return;const r=[t,e,i,a].join("|"),s=n(),l=s.get(r);if(l)l.count+=1;else if(s.set(r,{component:t,kind:e,attribute:i,from:a,to:o,count:1}),function(){const t=globalThis.document?.documentElement;return"warn"===t?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const n=t?`${t}: `:"",r="value"===e?`${i}="${a}"`:`${e} ${a}`;globalThis.console?.warn?.(`[SIMAI Framework] ${n}${r} is a legacy name${o?`; write ${o}`:""}. See contracts/changes/journal.json.`)}}if(i.d(e,{YB:()=>a}),"undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const t=globalThis.SF.deprecations||{};t.list=function(){return[...n().values()].map(t=>({...t}))},t.clear=function(){n().clear()},t.note=a,globalThis.SF.deprecations=t}},"100381bfa317"(t,e,i){i.a(t,async(t,e)=>{try{var n=i("fbe0570fcc69"),a=i("eecc41af23fd"),o=i("50d2a204ba4c"),r=i("f4cc1d3fd22e"),s=i("0d662e4d7d63"),l=t([n,a,r,s]);[n,a,r,s]=l.then?(await l)():l;var d=i.n(n);const c={en:{label:"Loading..."},ru:{label:"Загрузка…"}};class h extends(d()){static get props(){return{size:{default:"1"},width:{default:""},height:{default:""},label:{default:""},kind:{default:"",values:["",...o.vv],aliases:["variant"]},dots:{default:String(8)},filled:{default:String(3)},strokeWidth:{default:""},dotRadius:{default:""},infinite:{type:Boolean,default:!1},announce:{type:Boolean,default:!1},direction:{default:"clockwise"},rootClass:{default:""}}}constructor(){super(),this._boundRoot=null}get size(){return this.getAttribute("size")||"1"}get width(){return this.getAttribute("width")||""}get height(){return this.getAttribute("height")||""}get label(){return this.hasAttribute("label")?this.getAttribute("label"):(0,s.pageText)(c,"label",this)}get kind(){return this.getProp("kind")}get variant(){return this.kind}get dots(){return this.getAttribute("dots")||String(8)}get filled(){return this.getAttribute("filled")||String(3)}get strokeWidth(){return this.getAttribute("stroke-width")||""}get dotRadius(){return this.getAttribute("dot-radius")||""}get infinite(){return this.getBooleanAttr("infinite",!1)}get announce(){return this.getBooleanAttr("announce",!1)}get direction(){return this.getAttribute("direction")||"clockwise"}templateContext(){const t=this.getPropsContext();return this.createTemplateContext({...t,label:this.label,component:this,rootClass:this.getRootClass()})}template(){return(0,r.a)(this.templateContext())}afterRender(){this._boundRoot&&((0,a.AM)(this._boundRoot),this._boundRoot=null),this._boundRoot=this.getSpinnerRoot(),this._boundRoot&&(0,a.t7)(this._boundRoot)}afterUpdate(){this._boundRoot&&(0,a.KH)(this._boundRoot)}onDisconnected(){this._boundRoot&&((0,a.AM)(this._boundRoot),this._boundRoot=null)}getSpinnerRoot(){return this.querySelector(".sf-loader-container")}refreshSpinner(){return this._boundRoot&&(0,a.KH)(this._boundRoot),this}}h.define("sf-spinner"),e()}catch(t){e(t)}})},f4cc1d3fd22e(t,e,i){i.a(t,async(t,n)=>{try{i.d(e,{a:()=>c});var a=i("ddf1cdb42ecc"),o=t([a]),r=o.then?(await o)():o;a=r[0];function s(...t){return t.flat().filter(Boolean).join(" ")}function l(t){return""===t||null==t?a.nothing:String(t)}function d(t,e,i){const n=String(t||"").trim().toLowerCase();return e.includes(n)?n:i}function c(t){const e=s("sf-loader-container",`sf-loader--size-${d(t.size,["1/3","1/2","1","2","3"],"1")}`,t.rootClass);return a.html`
|
|
1
|
+
(()=>{"use strict";var t={"58661bec99a6"(t,e,i){const n=function(t,e){if(t&&e)if("undefined"==typeof window||"function"!=typeof window.registerSfComponent){if("undefined"!=typeof window&&window.SF?.Loader?.registerComponent)window.SF.Loader.registerComponent(t,e);else if("undefined"!=typeof window){(window.SF_PENDING_COMPONENTS=window.SF_PENDING_COMPONENTS||[]).push([t,e])}}else window.registerSfComponent(t,e)};i.d(e,["A",0,n])},"50d2a204ba4c"(t,e,i){i.d(e,{Gw:()=>r,_E:()=>s,l8:()=>a});const n=["arc","breathing","comet","dots"];function a(t,e={}){const i=document.createElementNS("http://www.w3.org/2000/svg",t);return Object.entries(e).forEach(([t,e])=>{null!=e&&""!==e&&i.setAttribute(t,String(e))}),i}const o=t=>Math.round(1e3*t)/1e3;function r({width:t=24,height:e=24,stroke:i=2,dots:n=8,filled:r=3,dotRadius:s=null,direction:l="clockwise",pixel:d=!1}={}){const c=t/2,h=e/2,u=Math.min(t,e)/2,f=Math.max(1,u-i/2),p=a("svg",{class:"sf-loader-svg",viewBox:`0 0 ${t} ${e}`,width:d?t:null,height:d?e:null,"aria-hidden":"true",focusable:"false"}),m={cx:c,cy:h,r:o(f),fill:"none",stroke:"currentColor","stroke-width":i},g=a("circle",{class:"sf-loader-ring-filled",...m,opacity:"0.3"}),b=a("circle",{class:"sf-loader-ring-accent",...m,"stroke-linecap":"round",pathLength:100,"stroke-dasharray":"0 100",transform:`rotate(90 ${c} ${h})`}),w=a("g",{class:"sf-loader-comet",display:"none",transform:`rotate(-90 ${c} ${h})`});for(let t=0;t<10;t+=1){const e=9===t;w.append(a("circle",{class:"sf-loader-comet-segment"+(e?" sf-loader-comet-head":""),...m,"stroke-linecap":e?"round":"butt",pathLength:100,"stroke-dasharray":`${o(4)} ${o(96)}`,"stroke-dashoffset":o(-4*t),opacity:o(((t+1)/10)**1.6)}))}const y=Math.max(3,Math.min(32,Math.floor(Number(n)||8))),S=Math.max(1,Math.min(y,Math.floor(Number(r)||3))),v=Math.min(i,.7*Math.PI*(u-i)/y),M=null==s||""===s?v:Math.max(1,Math.min(Number(s)||v,u/4)),k=Math.max(M,u-M),x=a("g",{class:"sf-loader-dots",display:"none",style:`--sf-loader-dot-count:${y}; --sf-loader-dot-filled:${S};`});for(let t=0;t<y;t+=1){const e=2*Math.PI/y*t-Math.PI/2,i="counterclockwise"===l?t:(y-t)%y;x.append(a("circle",{class:"sf-loader-dot"+(t<S?" sf-loader-dot--active":""),cx:o(c+k*Math.cos(e)),cy:o(h+k*Math.sin(e)),r:o(M),fill:"currentColor",style:`--sf-loader-dot-index:${t}; --sf-loader-dot-step:${i};`}))}return p.append(g,b,w,x),p}function s(t={}){return r({...t,width:24,height:24,stroke:2,dotRadius:null,pixel:!1})}i.d(e,["vv",0,n])},eecc41af23fd(t,e,i){i.a(t,async(t,n)=>{try{i.d(e,{AM:()=>_,KH:()=>E,t7:()=>$});var a=i("d7f974466839"),o=i("58661bec99a6"),r=i("0d662e4d7d63"),s=i("06e8cd089f28"),l=i("50d2a204ba4c"),d=t([r]),c=d.then?(await d)():d;r=c[0];const h={en:{label:"Loading…"},ru:{label:"Загрузка…"}},u=".sf-loader-container",f="sfSpinnerBound";function p(t,e){const i=Number.parseFloat(String(t??""));return Number.isFinite(i)?i:e}function m(t,e,i){return Math.min(Math.max(t,e),i)}function g(t,e,i){const n=String(t||"").trim().toLowerCase();return e.includes(n)?n:i}const b=[["width","data-width","width"],["w","data-w","width"],["height","data-height","height"],["h","data-h","height"],["strokeWidth","data-stroke-width","stroke-width"],["dotRadius","data-dot-radius","dot-radius"]];function w(t){const e=t.closest?.("sf-spinner"),i=b.filter(([e])=>{const i=t.dataset[e];return void 0!==i&&""!==i});return i.forEach(([,t,i])=>{(0,s.YB)({component:e?"sf-spinner":"spinner",kind:"attribute",from:e?i:t,to:e?"size":null})}),i.length>0}function y(t={}){return["width","height","strokeWidth"].some(e=>{const i=t?.[e];return null!=i&&""!==i})?S(t):(0,l._E)(t)}function S({width:t=58,height:e=58,strokeWidth:i=4,dots:n=8,filled:a=3,dotRadius:o=null,direction:r="clockwise"}={}){const s=m(p(t,58),16,256),d=m(p(e,s),16,256),c=m(p(i,4),1,Math.min(s,d)/2);return(0,l.Gw)({width:s,height:d,stroke:c,dots:n,filled:a,dotRadius:o,direction:r,pixel:!0})}function v({width:t=58,height:e=58,dots:i=16,filled:n=6,dotRadius:a=null,direction:o="clockwise"}={}){const r=m(p(t,58),16,256),s=m(p(e,r),16,256),d=m(Math.floor(p(i,16)),3,32),c=m(Math.floor(p(n,6)),1,d),h=null===a?Math.max(1.5,.06*Math.min(r,s)):m(p(a,1),1,Math.min(r,s)/4),u=Math.max(h,Math.min(r,s)/2-h-1),f=r/2,g=s/2,b=(0,l.l8)("svg",{class:"sf-loader-svg",viewBox:`0 0 ${r} ${s}`,width:r,height:s,"aria-hidden":"true",style:`--sf-loader-dot-count:${d}; --sf-loader-dot-filled:${c};`});for(let t=0;t<d;t+=1){const e=2*Math.PI/d*t-Math.PI/2,i=f+u*Math.cos(e),n=g+u*Math.sin(e),a="counterclockwise"===o?t:(d-t)%d,r=(0,l.l8)("circle",{class:"sf-loader-dot"+(t<c?" sf-loader-dot--active":""),cx:i,cy:n,r:h,style:`--sf-loader-dot-index:${t}; --sf-loader-dot-step:${a};`});b.append(r)}return b}function M(t){const e=t.querySelector(".sf-loader--loading-indicator"),i=t.querySelector(".sf-loader--circles"),n=t.querySelector(".sf-loader--text"),a=Object.prototype.hasOwnProperty.call(t.dataset,"width")||Object.prototype.hasOwnProperty.call(t.dataset,"w"),o=Object.prototype.hasOwnProperty.call(t.dataset,"height")||Object.prototype.hasOwnProperty.call(t.dataset,"h"),r=w(t),s=m(p(t.dataset.width,p(t.dataset.w,58)),16,256),d=m(p(t.dataset.height,p(t.dataset.h,s)),16,256),c=t.dataset.strokeWidth?m(p(t.dataset.strokeWidth,4),1,Math.min(s,d)/2):null,h=m(Math.floor(p(t.dataset.dots,8)),3,32);return{pixel:r,width:s,height:d,strokeWidth:c,dots:h,filled:m(Math.floor(p(t.dataset.filled,3)),1,h),dotRadius:t.dataset.dotRadius?m(p(t.dataset.dotRadius,1),1,Math.min(s,d)/4):null,direction:g(t.dataset.direction,["clockwise","counterclockwise"],"clockwise"),variant:t.dataset.variant?g(t.dataset.variant,l.vv,"arc"):i?"dots":"",hasExplicitWidth:a,hasExplicitHeight:o,infinite:"true"===t.dataset.infinite,announce:"true"===t.dataset.announce,label:void 0!==t.dataset.label?t.dataset.label:n?.textContent?.trim?.()||"",indicator:e,circles:i,labelNode:n}}function k(t,e){const i=Boolean(e.label);if(t.toggleAttribute("aria-hidden",!i),e.announce&&i)return t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),void(t.dataset.sfSpinnerSemantics="status");"status"===t.dataset.sfSpinnerSemantics&&(t.removeAttribute("role"),t.removeAttribute("aria-live"),t.removeAttribute("aria-atomic"),delete t.dataset.sfSpinnerSemantics)}function x(t,e,i){let n=t.querySelector(e);return n?(n.innerHTML="",n):(n=document.createElement("div"),n.className=i,n.dataset.sfSpinnerPart=i,t.append(n),n)}function E(t){if(!(t instanceof HTMLElement))return t;const e=M(t);t.classList.add("sf-loader-container"),e.infinite?t.classList.add("sf-loader--infinite"):t.classList.remove("sf-loader--infinite"),e.pixel&&e.hasExplicitWidth?t.style.setProperty("--sf-loader-svg-width",`${e.width}px`):t.style.removeProperty("--sf-loader-svg-width"),e.pixel&&(e.hasExplicitHeight||e.hasExplicitWidth)?t.style.setProperty("--sf-loader-svg-height",`${e.height}px`):t.style.removeProperty("--sf-loader-svg-height"),null!==e.strokeWidth?t.style.setProperty("--sf-loader-stroke-width",`${e.strokeWidth}px`):t.style.removeProperty("--sf-loader-stroke-width"),t.classList.toggle("sf-loader--pixel-geometry",e.pixel),e.variant&&t.dataset.variant!==e.variant&&(t.dataset.variant=e.variant);const i=t.querySelector(".sf-loader--circles");if(i&&!t.querySelector(".sf-loader--loading-indicator")){const t=document.createElement("div");t.className="sf-loader--loading-indicator",t.dataset.sfSpinnerPart="sf-loader--loading-indicator",i.replaceWith(t)}const n=x(t,".sf-loader--loading-indicator","sf-loader--loading-indicator"),a=e.label||e.labelNode?x(t,".sf-loader--text","sf-loader--text"):null,o=e.pixel?S({...e,strokeWidth:e.strokeWidth??4}):(0,l._E)(e);return n.append(o),a&&(a.textContent=e.label||""),k(t,e),t}function $(t){return t instanceof HTMLElement&&"1"!==t.dataset[f]?(E(t),t.dataset[f]="1",t):t}function _(t){t instanceof HTMLElement&&delete t.dataset[f]}function F(t){(t instanceof Element||t===document)&&(t instanceof Element&&t.matches?.(u)&&$(t),t.querySelectorAll?.(u).forEach($))}class A extends a.y{static componentName="Spinner";constructor(t){super(t);const{width:e,height:i,label:n=(0,r.pageText)(h,"label",t?.root??document.documentElement),variant:a,dots:o=8,filled:s=3,strokeWidth:l=null,dotRadius:d=null,infinite:c=!1,announce:u=!1,direction:f="clockwise"}=this.params||{},p=this.attrs.class||this.attrs.className;this.template=document.createElement("div"),this.id&&(this.template.id=this.id),this.template.classList.add("sf-loader-container"),p&&this.template.classList.add(...`${p}`.split(" ").filter(Boolean)),Object.entries(this.attrs).filter(([t])=>!["class","className"].includes(t)).forEach(([t,e])=>{null!=e&&this.template.setAttribute(t,e)}),null!=e&&""!==e&&(this.template.dataset.width=String(e)),null!=i&&""!==i&&(this.template.dataset.height=String(i)),this.template.dataset.label=String(n??""),null!=a&&""!==a&&(this.template.dataset.variant=String(a)),this.template.dataset.dots=String(o),this.template.dataset.filled=String(s),null!=l&&""!==l&&(this.template.dataset.strokeWidth=String(l)),this.template.dataset.infinite=String(c),this.template.dataset.announce=String(u),this.template.dataset.direction=String(f),null!=d&&(this.template.dataset.dotRadius=String(d))}init(){$(this.template)}destroyInternal(){_(this.template)}}(0,o.A)("Spinner",A),"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.Spinner=window.SF.Spinner||{},window.SF.Spinner.bind=$,window.SF.Spinner.render=E,window.SF.Spinner.unbind=_,window.SF.Spinner.createArcSvg=y,window.SF.Spinner.createDotsSvg=v),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>F(document)):F(document);new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{t instanceof Element&&F(t)})})}).observe(document.documentElement,{childList:!0,subtree:!0}),n()}catch(T){n(T)}})},d7f974466839(t,e,i){i.d(e,{y:()=>n});class n{lifecycleName(){return this.componentName??this.constructor.componentName}constructor(t){this.props=t,this.id=t?.id,this.params=t?.param,this.attrs=t?.attrs||{},this.template=null,window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:beforeRender`,{detail:this}))}getUtilityMap(){return this.constructor.utilityMap||null}extractUtilityClasses(t){if(!Array.isArray(t))return[];const e=new Set;return t.forEach(t=>{if("string"!=typeof t)return;const i=t.match(/\(([^)]+)\)/g);i&&i.forEach(t=>{t.slice(1,-1).split(/\s+/).filter(Boolean).forEach(t=>{t.startsWith(".")&&t.length>1&&e.add(t.slice(1))})})}),Array.from(e)}applyLayoutUtilities(t,e){if(!t||!e)return;const i=this.getUtilityMap();if(!i||!i[e])return;this.extractUtilityClasses(i[e]).forEach(e=>t.classList.add(e))}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(){}}},"06e8cd089f28"(t,e,i){function n(){const t=globalThis.SF=globalThis.SF||{};return t.__deprecationNotes instanceof Map||Object.defineProperty(t,"__deprecationNotes",{value:new Map,configurable:!0}),t.__deprecationNotes}function a({component:t="",kind:e="attribute",attribute:i="",from:a,to:o=null}={}){if(!a)return;const r=[t,e,i,a].join("|"),s=n(),l=s.get(r);if(l)l.count+=1;else if(s.set(r,{component:t,kind:e,attribute:i,from:a,to:o,count:1}),function(){const t=globalThis.document?.documentElement;return"warn"===t?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const n=t?`${t}: `:"",r="value"===e?`${i}="${a}"`:`${e} ${a}`;globalThis.console?.warn?.(`[SIMAI Framework] ${n}${r} is a legacy name${o?`; write ${o}`:""}. See contracts/changes/journal.json.`)}}if(i.d(e,{YB:()=>a}),"undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const t=globalThis.SF.deprecations||{};t.list=function(){return[...n().values()].map(t=>({...t}))},t.clear=function(){n().clear()},t.note=a,globalThis.SF.deprecations=t}},"100381bfa317"(t,e,i){i.a(t,async(t,e)=>{try{var n=i("fbe0570fcc69"),a=i("eecc41af23fd"),o=i("50d2a204ba4c"),r=i("f4cc1d3fd22e"),s=i("0d662e4d7d63"),l=t([n,a,r,s]);[n,a,r,s]=l.then?(await l)():l;var d=i.n(n);const c={en:{label:"Loading…"},ru:{label:"Загрузка…"}};class h extends(d()){static get props(){return{size:{default:"1"},width:{default:""},height:{default:""},label:{default:""},kind:{default:"",values:["",...o.vv],aliases:["variant"]},dots:{default:String(8)},filled:{default:String(3)},strokeWidth:{default:""},dotRadius:{default:""},infinite:{type:Boolean,default:!1},announce:{type:Boolean,default:!1},direction:{default:"clockwise"},rootClass:{default:""}}}constructor(){super(),this._boundRoot=null}get size(){return this.getAttribute("size")||"1"}get width(){return this.getAttribute("width")||""}get height(){return this.getAttribute("height")||""}get label(){return this.hasAttribute("label")?this.getAttribute("label"):(0,s.pageText)(c,"label",this)}get kind(){return this.getProp("kind")}get variant(){return this.kind}get dots(){return this.getAttribute("dots")||String(8)}get filled(){return this.getAttribute("filled")||String(3)}get strokeWidth(){return this.getAttribute("stroke-width")||""}get dotRadius(){return this.getAttribute("dot-radius")||""}get infinite(){return this.getBooleanAttr("infinite",!1)}get announce(){return this.getBooleanAttr("announce",!1)}get direction(){return this.getAttribute("direction")||"clockwise"}templateContext(){const t=this.getPropsContext();return this.createTemplateContext({...t,label:this.label,component:this,rootClass:this.getRootClass()})}template(){return(0,r.a)(this.templateContext())}afterRender(){this._boundRoot&&((0,a.AM)(this._boundRoot),this._boundRoot=null),this._boundRoot=this.getSpinnerRoot(),this._boundRoot&&(0,a.t7)(this._boundRoot)}afterUpdate(){this._boundRoot&&(0,a.KH)(this._boundRoot)}onDisconnected(){this._boundRoot&&((0,a.AM)(this._boundRoot),this._boundRoot=null)}getSpinnerRoot(){return this.querySelector(".sf-loader-container")}refreshSpinner(){return this._boundRoot&&(0,a.KH)(this._boundRoot),this}}h.define("sf-spinner"),e()}catch(t){e(t)}})},f4cc1d3fd22e(t,e,i){i.a(t,async(t,n)=>{try{i.d(e,{a:()=>c});var a=i("ddf1cdb42ecc"),o=t([a]),r=o.then?(await o)():o;a=r[0];function s(...t){return t.flat().filter(Boolean).join(" ")}function l(t){return""===t||null==t?a.nothing:String(t)}function d(t,e,i){const n=String(t||"").trim().toLowerCase();return e.includes(n)?n:i}function c(t){const e=s("sf-loader-container",`sf-loader--size-${d(t.size,["1/3","1/2","1","2","3"],"1")}`,t.rootClass);return a.html`
|
|
2
2
|
<div
|
|
3
3
|
class=${e}
|
|
4
4
|
style=${t.rootStyle||a.nothing}
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"label": {
|
|
57
57
|
"type": "string",
|
|
58
58
|
"default": "",
|
|
59
|
-
"description": "Empty: the text of the page's language (\"Loading
|
|
59
|
+
"description": "Empty: the text of the page's language (\"Loading…\" in English)."
|
|
60
60
|
},
|
|
61
61
|
"kind": {
|
|
62
62
|
"type": "string",
|
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
"source_artifacts": [
|
|
273
273
|
{
|
|
274
274
|
"path": "src/smart/spinner/index.js",
|
|
275
|
-
"sha256": "
|
|
275
|
+
"sha256": "39528a07fd66a5afd26eeab0e80f6e558dd9c6c205f60272c6093f04a3900f7b"
|
|
276
276
|
},
|
|
277
277
|
{
|
|
278
278
|
"path": "src/smart/spinner/js/templates/default.js",
|
package/package-manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release": "ui-
|
|
3
|
-
"commit": "
|
|
4
|
-
"version": "5.20261020.
|
|
2
|
+
"release": "ui-ef202b45f12d",
|
|
3
|
+
"commit": "ef202b45f12df11f31b564cbdb6b1f1380fcf903",
|
|
4
|
+
"version": "5.20261020.1738",
|
|
5
5
|
"files": {
|
|
6
6
|
"distr/component/accordion/css/accordion.min.css": "sha256-Sn5M6q2XskfMvRHwMFgraYLTGk0vOUDCRFJGQfCsZ4Y=",
|
|
7
7
|
"distr/component/accordion/js/accordion.min.js": "sha256-HiHgZKWDDIOVBjMwOgKFlJqGKvZWwN3NeJluAWwE6ck=",
|
|
@@ -588,7 +588,7 @@
|
|
|
588
588
|
"distr/component/menu/js/menu.min.js": "sha256-UKCL7nLHHRnR45VU5B8P2NKxafYzv8lSNPQNcB1wFK8=",
|
|
589
589
|
"distr/component/menu/json/menu.utility.json": "sha256-ULonFm8I+Yez31D8MtkIF5VG/IZlo9VXgqkcz4eF1Dk=",
|
|
590
590
|
"distr/component/modal/css/modal.min.css": "sha256-F7K7x/b/IQZ5QqmoZUv/jTFh1JrdrwcxsH7iqYhK64A=",
|
|
591
|
-
"distr/component/modal/js/modal.min.js": "sha256-
|
|
591
|
+
"distr/component/modal/js/modal.min.js": "sha256-AN1DDDNM28XNA61RKBJSq2DKVH0IHsDd6fRazxLE1VE=",
|
|
592
592
|
"distr/component/outline/css/outline.min.css": "sha256-HPcK6/vQK/kgpEh70HAsfED0mi+5z7XO6hZtFKw8Q2M=",
|
|
593
593
|
"distr/component/outline/js/outline.min.js": "sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=",
|
|
594
594
|
"distr/component/overbox/css/overbox.min.css": "sha256-Q05DaW/du6OpcxUsSNj5pTyT5s1m/AEJDnlxbpRiQas=",
|
|
@@ -1735,8 +1735,8 @@
|
|
|
1735
1735
|
"distr/smart/list-item/studio.scenario.json": "sha256-QV96Pj3s2y5VrEQS+5NTJGPB4kBTSuDfnyLu5+ntF18=",
|
|
1736
1736
|
"distr/smart/list-item/template/default.js": "sha256-vsUITMMOuTviBpd9UiGbeS2HJP7GgiFzPvCcE4Y+8uI=",
|
|
1737
1737
|
"distr/smart/modal/contract.json": "sha256-GDaaHGEkDYDATpFEuU9kaORWORJ0kjtIEZoZaUbTJOs=",
|
|
1738
|
-
"distr/smart/modal/js/modal.min.js": "sha256-
|
|
1739
|
-
"distr/smart/modal/smart.manifest.json": "sha256-
|
|
1738
|
+
"distr/smart/modal/js/modal.min.js": "sha256-a+l8zl4Pm6ojiQP0OWZUOmtkx2W9om9/BYTx5JZpBhg=",
|
|
1739
|
+
"distr/smart/modal/smart.manifest.json": "sha256-WgHy1b0t1Wmh9ZWOKxRUoDkR2XVVUPaHLaTCfEh52jU=",
|
|
1740
1740
|
"distr/smart/modal/studio.fixture.json": "sha256-jzGT/qtAlMGv5qNfVRoAvSV0Y9cqZv/PcQZ8699NAbQ=",
|
|
1741
1741
|
"distr/smart/modal/studio.scenario.json": "sha256-Xl5opdE1PhytliQt++Cr5Uk9MGImk/t/EPCkAxXCNl0=",
|
|
1742
1742
|
"distr/smart/modal/template/default.js": "sha256-hFV4VaW3Le7pOwq1jdD1fkstWWxOTItQXpfoPlapP0w=",
|
|
@@ -1807,8 +1807,8 @@
|
|
|
1807
1807
|
"distr/smart/sortable/smart.manifest.json": "sha256-Y+QqmaZN0Dz5WQrVhd1OE/yy0vmFDr4xAjhnPDum6Pk=",
|
|
1808
1808
|
"distr/smart/sortable/studio.fixture.json": "sha256-jyS0j3s74TnL9aeUmVj3Usd3PLIswNZu01R0fZPdGHQ=",
|
|
1809
1809
|
"distr/smart/sortable/studio.scenario.json": "sha256-5/a9AnHKFp7NxNEOd5Dnl+9IpLIBl0QKXywfNA1tGnc=",
|
|
1810
|
-
"distr/smart/spinner/js/spinner.min.js": "sha256-
|
|
1811
|
-
"distr/smart/spinner/smart.manifest.json": "sha256
|
|
1810
|
+
"distr/smart/spinner/js/spinner.min.js": "sha256-WeiQf/qW5blLtEbCWYBkwtqW+w6ok/cNAanoSVw0Bck=",
|
|
1811
|
+
"distr/smart/spinner/smart.manifest.json": "sha256-+/u+kpDmUi/UJp1Rh71+h6TYL92dpAfhbM0Obe9hMfI=",
|
|
1812
1812
|
"distr/smart/spinner/studio.fixture.json": "sha256-obxROVRecLp7BXSERF4lHEgTnPrf3yAHrxsGwHatAyA=",
|
|
1813
1813
|
"distr/smart/spinner/studio.scenario.json": "sha256-cjLxETLt4toOqem1SNv5lC9iVHfcncywCWnxtFJUTls=",
|
|
1814
1814
|
"distr/smart/spinner/template/default.js": "sha256-JX/HWpKeWEMl5GBdp2QwoBLTRxLnMiZ3VOa13o4DOF4=",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simai-studio/ui",
|
|
3
|
-
"version": "5.20261020.
|
|
4
|
-
"description": "SIMAI Framework distribution, release ui-
|
|
3
|
+
"version": "5.20261020.1738",
|
|
4
|
+
"description": "SIMAI Framework distribution, release ui-ef202b45f12d: Core, the Loader, components, utilities and Smart Components, ready to serve from distr/.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://ui.simai.io/",
|
|
7
7
|
"repository": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
19
|
"simai": {
|
|
20
|
-
"release": "ui-
|
|
21
|
-
"commit": "
|
|
20
|
+
"release": "ui-ef202b45f12d",
|
|
21
|
+
"commit": "ef202b45f12df11f31b564cbdb6b1f1380fcf903"
|
|
22
22
|
}
|
|
23
23
|
}
|