vanilla-jui 1.4.8 → 1.5.2
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 +10 -4
- package/dist/index.d.ts +402 -977
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/src/components/accordion.ts +467 -349
- package/src/components/flow.ts +779 -1133
- package/src/components/form.ts +666 -509
- package/src/components/menu.ts +199 -326
- package/src/components/modal.ts +510 -747
- package/src/components/offcanvas.ts +281 -361
- package/src/components/pagination.ts +207 -374
- package/src/components/swiper.ts +688 -1168
- package/src/components/tabs.ts +468 -788
- package/src/components/toc.ts +191 -244
- package/src/core/component.ts +332 -0
- package/src/core/motion.ts +298 -0
- package/src/core/presence.ts +233 -0
- package/src/core/scheduler.ts +91 -0
- package/src/core/view.ts +31 -0
- package/src/css/accordion.css +94 -3
- package/src/css/color.css +4 -5
- package/src/css/color_p3.css +6 -5
- package/src/css/content.css +18 -24
- package/src/css/drop.css +4 -1
- package/src/css/form.css +8 -0
- package/src/css/gradient.css +64 -131
- package/src/css/layout.css +9 -23
- package/src/css/menu.css +10 -5
- package/src/css/modal.css +2 -1
- package/src/css/offcanvas.css +1 -17
- package/src/css/swiper.css +2 -1
- package/src/css/tabs.css +8 -17
- package/src/css/themes/default/accordion.css +0 -48
- package/src/css/themes/default/swiper.css +1 -1
- package/src/css/themes/default/tabs.css +4 -6
- package/src/css/toast.css +1 -17
- package/src/css/tokens.css +18 -35
- package/src/css/tooltip.css +2 -1
- package/src/index.ts +8 -3
- package/src/locales/index.ts +3 -0
- package/src/primitives/drop.ts +253 -262
- package/src/primitives/loading.ts +22 -4
- package/src/primitives/parabola.ts +123 -164
- package/src/primitives/sticky.ts +297 -0
- package/src/primitives/theme.ts +164 -222
- package/src/primitives/toast.ts +309 -284
- package/src/primitives/tooltip.ts +65 -66
- package/src/utilities/browser.ts +38 -0
- package/src/utilities/dom.ts +0 -54
- package/src/utilities/refs.ts +61 -0
- package/src/utilities/state.ts +73 -0
- package/src/utilities/timer.ts +11 -31
- package/src/validation/validator.ts +289 -389
- package/src/components/sticky.ts +0 -297
- package/src/core/Component.ts +0 -377
- package/src/utilities/scheduler.ts +0 -156
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bindAttr as e,bindClass as t,createDeepStore as n,createEffect as r,createRoot as i,createWatch as a,flushSync as o,h as s,jsx as c,onCleanup as l,render as u,untrack as d,unwrap as f}from"vanilla-signal";import{t as p}from"vanilla-signal-i18n";import{createStorage as ee}from"vanilla-create-storage";function te(){if(typeof navigator>`u`)return!1;if(typeof navigator.userAgentData?.mobile==`boolean`)return navigator.userAgentData.mobile;let e=navigator.userAgent||``;return/\b(BlackBerry|webOS|iPhone|IEMobile|Android|Windows Phone|iPad|iPod)\b/i.test(e)?!0:typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(pointer: coarse)`).matches&&window.matchMedia(`(max-width: 820px)`).matches}async function ne(e){if(typeof window>`u`||typeof document>`u`)return Promise.resolve(!1);let t=String(e);if(navigator.clipboard&&typeof navigator.clipboard.writeText==`function`)try{return await navigator.clipboard.writeText(t),!0}catch{return m(t)}return m(t)}function m(e){let t=null;try{return t=document.createElement(`textarea`),t.value=e,t.setAttribute(`readonly`,``),t.style.position=`absolute`,t.style.left=`-9999px`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),t.setSelectionRange(0,e.length),document.execCommand(`copy`)}catch{return!1}finally{t&&t.parentNode&&t.parentNode.removeChild(t)}}function re(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(16);if(typeof crypto.getRandomValues!=`function`)throw Error(`Your browser is too old to support secure login.`);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,20),t.slice(20,32)].join(`-`)}function h(e=8){if(!Number.isInteger(e)||e<1||e>87381)throw Error(`Length must be an integer between 1 and 87381`);let t=Math.ceil(e*3/4),n=new Uint8Array(t);crypto.getRandomValues(n);let r=``;for(let e of n)r+=String.fromCharCode(e);return btoa(r).substring(0,e).replace(/\+/g,`-`).replace(/\//g,`_`)}var ie=typeof global==`object`&&global&&global.Object===Object&&global,g=typeof self==`object`&&self&&self.Object===Object&&self,ae=ie||g||Function(`return this`)(),oe=ae.Symbol,se=Object.prototype,ce=se.hasOwnProperty,le=se.toString,_=oe?oe.toStringTag:void 0;function ue(e){var t=ce.call(e,_),n=e[_];try{e[_]=void 0;var r=!0}catch{}var i=le.call(e);return r&&(t?e[_]=n:delete e[_]),i}var de=Object.prototype.toString;function fe(e){return de.call(e)}var pe=`[object Null]`,me=`[object Undefined]`,he=oe?oe.toStringTag:void 0;function ge(e){return e==null?e===void 0?me:pe:he&&he in Object(e)?ue(e):fe(e)}function _e(e,t){return function(n){return e(t(n))}}var ve=_e(Object.getPrototypeOf,Object);function ye(e){return typeof e==`object`&&!!e}var be=`[object Object]`,xe=Function.prototype,Se=Object.prototype,Ce=xe.toString,we=Se.hasOwnProperty,Te=Ce.call(Object);function Ee(e){if(!ye(e)||ge(e)!=be)return!1;var t=ve(e);if(t===null)return!0;var n=we.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Ce.call(n)==Te}function v(e){return Ee(e)}function y(e){return e==null}function b(e){return typeof Node<`u`&&e instanceof Node}function De(e){return typeof Element<`u`&&e instanceof Element}function Oe(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function ke(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function Ae(e){return y(e)||ke(e)||typeof e==`function`||Array.isArray(e)||b(e)}const je=e=>e===null?`null`:Array.isArray(e)?`array`:Oe(e)?`HTMLElement`:b(e)?`Node`:typeof e;function Me(e){return Array.isArray(e)?e.slice():v(e)?{...e}:e}function Ne(e={}){return typeof e==`string`||Array.isArray(e)?{type:e}:!e||typeof e!=`object`?{}:e}function x(e,t){throw Error(`Validator: ${e} ${t}`)}function Pe(e){return typeof e==`string`?e:String(e)}function Fe(e){return typeof e==`string`?`string`:`array`}function Ie(e,t,n){if(y(t)||typeof t!=`string`&&!Array.isArray(t))return;let r=Fe(t);n.nonEmpty&&t.length===0&&x(e,`expects a non-empty ${r}.`),typeof n.minLength==`number`&&t.length<n.minLength&&x(e,`expects ${r} length to be at least ${n.minLength}.`),typeof n.maxLength==`number`&&t.length>n.maxLength&&x(e,`expects ${r} length to be at most ${n.maxLength}.`)}function Le(e,t,n){y(t)||typeof t!=`number`||(n.finite&&!Number.isFinite(t)&&x(e,`expects a finite number.`),n.integer&&!Number.isInteger(t)&&x(e,`expects an integer.`),typeof n.min==`number`&&t<n.min&&x(e,`expects a number greater than or equal to ${n.min}.`),typeof n.max==`number`&&t>n.max&&x(e,`expects a number less than or equal to ${n.max}.`),typeof n.greaterThan==`number`&&t<=n.greaterThan&&x(e,`expects a number greater than ${n.greaterThan}.`),typeof n.lessThan==`number`&&t>=n.lessThan&&x(e,`expects a number less than ${n.lessThan}.`))}function Re(e,t,n){!n.plain||y(t)||v(t)||x(e,`expects an object.`)}function ze(e,t,n){!n.items||y(t)||(Array.isArray(t)||x(e,`expects array.`),t.forEach((t,r)=>{S(String(r),t,n.items,e)}))}function Be(e,t,n){if(!n.shape||y(t))return;(!t||typeof t!=`object`||Array.isArray(t))&&x(e,`expects object.`);let r=t;for(let[t,i]of Object.entries(n.shape))S(t,r[t],i,e)}function Ve(e,t){return t===`renderable`?Ae(e):t===`Node`?b(e):t===`Element`?De(e):t===`HTMLElement`?Oe(e):t===`plainObject`?v(e):je(e)===t}function He(e){return v(e)?`object`:je(e)}function Ue(e,t,n=[]){let r=Array.isArray(n)?n:n?[n]:[];for(let n of r){let r,i;if(typeof n==`function`)r=n,i=`does not satisfy the required condition.`;else if(n&&typeof n.test==`function`)r=n.test,i=n.message||`condition failed.`;else throw Error(`Validator: Condition must be a function or { test, message }.`);r(t)||x(e,i)}}function We(e,t){return e?`${e}.${t}`:t}function S(e,t,n={},r=``){let i=Ne(n),a=We(r,e),o=Object.hasOwn(i,`types`)?i.types:i.type;if(i.required&&y(t)&&x(a,`is required.`),o!==void 0){let e=Array.isArray(o)?o:[o],n=He(t);e.some(e=>Ve(t,e))||x(a,`expects ${e.join(`, `)}, but got ${n}.`)}return Array.isArray(i.enum)&&!i.enum.includes(t)&&x(a,`expects one of ${i.enum.map(Pe).join(`, `)}.`),Ie(a,t,i),Le(a,t,i),Re(a,t,i),ze(a,t,i),Be(a,t,i),Ue(a,t,i.conditions),typeof i.validate==`function`&&(i.validate(t)||x(a,i.message||`does not satisfy the required condition.`)),t}function C(e={},t={},n=`Options`){let r=e??{};if(typeof r!=`object`||Array.isArray(r))throw Error(`${n} expects object.`);let i=r,a={...i},o=Object.entries(t||{});for(let[e,t]of o){let n=Ne(t);a[e]=Object.hasOwn(i,e)?i[e]:Ge(n)}for(let[e,n]of o){let r=Ne(n);typeof r.normalize==`function`&&(a[e]=r.normalize(a[e],{key:e,input:i,options:a,schema:t}))}for(let[e,t]of o)S(e,a[e],t,n);return a}function Ge(e){if(!Object.hasOwn(e,`default`))return;let t=e.default;return Me(e.factory&&typeof t==`function`?t():t)}const Ke=[`node`,`element`,`array`];function qe(e){return Ke.includes(e)}function w(e){return b(e)}function T(e){return De(e)}function Je(e){return typeof e==`string`||T(e)||w(e)||Array.isArray(e)}function Ye(e){return e.find(T)||null}function Xe(e,t=[]){for(let n of e){if(Array.isArray(n)){if(!Xe(n,t))return null;continue}if(w(n)){t.push(n);continue}return null}return t}function E(e,t){if(typeof e==`function`)return E(e(t),t);let n=e;if(n==null||n===!1||n===!0)return[];if(Array.isArray(n))return n.flatMap(e=>E(e,t));if(w(n))return[n];if(typeof n==`string`){let e=document.createElement(`template`);return e.innerHTML=n,Array.from(e.content.childNodes)}return[document.createTextNode(String(n))]}function D(e){if(e===!1||e==null)return null;if(typeof e==`string`){let t=j(e);return t.length>0?t:null}if(Array.isArray(e)){let t=Xe(e,[]);return t&&t.length>0?t:null}return w(e)?[e]:null}function Ze(e){return T(e)||w(e)?e:typeof e==`string`?document.querySelector(e):Array.isArray(e)&&(D(e)||[])[0]||null}function O(e){if(!Je(e))return null;if(typeof e==`string`){let t=document.querySelector(e);return T(t)?t:null}if(Array.isArray(e)){let t=D(e);return Array.isArray(t)?Ye(t):null}return T(e)?e:null}function Qe(e,t=`Component`,n=`element`){if(!qe(n))throw Error(`${t}: expect must be one of 'node', 'element', 'array'.`);return Je(e)?n===`array`?D(e):n===`node`?Ze(e):O(e):null}function k(e,t=`Component`,n=`element`){let r=Qe(e,t,n);if(r==null)throw Error(`${t}: container not found.`);return r}function $e(e){return Ae(e)}function et(e,t){return $e(e)?E(e,t):null}function A(e,t=document){return t.querySelector(e)}function j(e,t=document){return Array.from(t.querySelectorAll(e))}function tt(e,t,n={}){if(typeof t!=`function`)throw TypeError(`lazyRender: renderCallback expects function.`);let{threshold:r=.1,rootMargin:i=`0px`,root:a=null,waitForDOM:o=!0}=n,s={threshold:r,rootMargin:i,root:a};if(!rt(e))return console.warn(`lazyRender: target 必须是 CSS 选择器字符串或 DOM 元素`),nt;let c=nt,l=it(e);if(l&&document.body.contains(l))return c=at(l,t,s),c;if(!o||typeof MutationObserver>`u`)return t(),c;let u=new MutationObserver(()=>{let n=it(e);!n||!document.body.contains(n)||(l=n,u.disconnect(),c=at(l,t,s))});return u.observe(document.documentElement,{childList:!0,subtree:!0}),()=>{u.disconnect(),c()}}function nt(){}function rt(e){return typeof e==`string`||T(e)}function it(e){return typeof e==`string`?A(e):e}function at(e,t,n){if(typeof window>`u`||window.IntersectionObserver===void 0)return t(),nt;let r=new window.IntersectionObserver(n=>{for(let i of n)if(i.isIntersecting){r.unobserve(e),r.disconnect(),t();break}},n);return r.observe(e),()=>{r.unobserve(e),r.disconnect()}}function ot(e,t,n,r){let i=!0;return e.addEventListener(t,n,r),()=>{i&&(i=!1,e.removeEventListener(t,n,r))}}function M(){let e=new Map,t=t=>{let n=e.get(t);return n?(n(),e.delete(t),!0):!1};return{on(n,r,i,a,o){if(typeof n!=`string`||n.trim()===``)throw TypeError(`EventManager.on: key expects a non-empty string.`);if(t(n),r==null)return()=>{};let s=ot(r,i,a,o);return e.set(n,s),s},off:t,clear(){for(let t of e.values())t();e.clear()},size(){return e.size}}}const st=typeof window<`u`?`${window.location.origin}/wp-json`:``;async function ct(e,t,n={}){let r=new Headers(n.headers);return r.has(`Content-Type`)||r.set(`Content-Type`,`application/json`),(await fetch(e,{...n,method:`POST`,headers:r,body:JSON.stringify(t)})).json()}const N={timers:{},start(e,t,n){this.timers[e]&&clearTimeout(this.timers[e]),this.timers[e]=setTimeout(()=>{n(),delete this.timers[e]},t)},cancel(e){this.timers[e]&&(clearTimeout(this.timers[e]),delete this.timers[e])}};function lt(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var ut=function(){return ae.Date.now()},dt=/\s/;function ft(e){for(var t=e.length;t--&&dt.test(e.charAt(t)););return t}var pt=/^\s+/;function mt(e){return e&&e.slice(0,ft(e)+1).replace(pt,``)}var ht=`[object Symbol]`;function gt(e){return typeof e==`symbol`||ye(e)&&ge(e)==ht}var _t=NaN,vt=/^[-+]0x[0-9a-f]+$/i,yt=/^0b[01]+$/i,bt=/^0o[0-7]+$/i,xt=parseInt;function St(e){if(typeof e==`number`)return e;if(gt(e))return _t;if(lt(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=lt(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=mt(e);var n=yt.test(e);return n||bt.test(e)?xt(e.slice(2),n?2:8):vt.test(e)?_t:+e}var Ct=`Expected a function`,wt=Math.max,Tt=Math.min;function Et(e,t,n){var r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0;if(typeof e!=`function`)throw TypeError(Ct);t=St(t)||0,lt(n)&&(u=!!n.leading,d=`maxWait`in n,a=d?wt(St(n.maxWait)||0,t):a,f=`trailing`in n?!!n.trailing:f);function p(t){var n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function ee(e){return l=e,s=setTimeout(m,t),u?p(e):o}function te(e){var n=e-c,r=e-l,i=t-n;return d?Tt(i,a-r):i}function ne(e){var n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function m(){var e=ut();if(ne(e))return re(e);s=setTimeout(m,te(e))}function re(e){return s=void 0,f&&r?p(e):(r=i=void 0,o)}function h(){s!==void 0&&clearTimeout(s),l=0,r=c=i=s=void 0}function ie(){return s===void 0?o:re(ut())}function g(){var e=ut(),n=ne(e);if(r=arguments,i=this,c=e,n){if(s===void 0)return ee(c);if(d)return clearTimeout(s),s=setTimeout(m,t),p(c)}return s===void 0&&(s=setTimeout(m,t)),o}return g.cancel=h,g.flush=ie,g}var Dt=`Expected a function`;function Ot(e,t,n){var r=!0,i=!0;if(typeof e!=`function`)throw TypeError(Dt);return lt(n)&&(r=`leading`in n?!!n.leading:r,i=`trailing`in n?!!n.trailing:i),Et(e,t,{leading:r,maxWait:t,trailing:i})}let kt=null,P=null,At=!1;function jt(e){if(typeof queueMicrotask==`function`){queueMicrotask(e);return}Promise.resolve().then(e)}function Mt(){At||(At=!0,jt(Pt))}function Nt(e){P?P.next=e:kt=e,P=e,Mt()}function Pt(){At=!1;let e=kt;kt=null,P=null;let t=e;for(;t;){let e=t.next;t.next=null,!t.disposed&&t.queued&&(t.queued=!1,t.run()),t=e}}function Ft(e){let t={queued:!1,disposed:!1,next:null,run:e};return{schedule(){t.disposed||t.queued||(t.queued=!0,Nt(t))},flush(){t.disposed||(t.queued=!1,t.run())},cancel(){t.queued=!1},dispose(){t.disposed=!0,t.queued=!1,t.next=null}}}function F(e){if(e&&typeof e==`object`){let t=e.__version__;return typeof t==`number`?t:0}return 0}function It(e){return F(e),e}function I(e){return f(e)}function L(e,t,{deferInitial:n=!0,flushInitial:r=!1,flush:i=`microtask`}={}){let o=!1,s=!1,c,l=Ft(()=>{s&&(s=!1,d(()=>t(c)))}),u=a(e,e=>{let t=!o;if(o=!0,c=e,s=!0,t&&r||i===`sync`){l.flush();return}l.schedule()},{defer:n});return()=>{l.dispose(),u.dispose()}}var Lt={info:`<path d="M12 22C6.47715 22 2 17.5228 2 12 2 6.47715 6.47715 2 12 2 17.5228 2 22 6.47715 22 12 22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM13 10.5V15H14V17H10V15H11V12.5H10V10.5H13ZM13.5 8C13.5 8.82843 12.8284 9.5 12 9.5 11.1716 9.5 10.5 8.82843 10.5 8 10.5 7.17157 11.1716 6.5 12 6.5 12.8284 6.5 13.5 7.17157 13.5 8Z"></path>`,success:`<path d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM17.4571 9.45711L16.0429 8.04289L11 13.0858L8.20711 10.2929L6.79289 11.7071L11 15.9142L17.4571 9.45711Z"></path>`,warning:`<path d="M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11 15H13V17H11V15ZM11 7H13V13H11V7Z"></path>`,error:`<path d="M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM12 10.5858L14.8284 7.75736L16.2426 9.17157L13.4142 12L16.2426 14.8284L14.8284 16.2426L12 13.4142L9.17157 16.2426L7.75736 14.8284L10.5858 12L7.75736 9.17157L9.17157 7.75736L12 10.5858Z"></path>`,"arrow-left":`<path d="M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z"></path>`,"arrow-right":`<path d="M13.1717 12.0007L8.22192 7.05093L9.63614 5.63672L16.0001 12.0007L9.63614 18.3646L8.22192 16.9504L13.1717 12.0007Z"></path>`,"arrow-up":`<path d="M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"></path>`,"arrow-down":`<path d="M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"></path>`,more:`<path d="M5 10C3.9 10 3 10.9 3 12C3 13.1 3.9 14 5 14C6.1 14 7 13.1 7 12C7 10.9 6.1 10 5 10ZM19 10C17.9 10 17 10.9 17 12C17 13.1 17.9 14 19 14C20.1 14 21 13.1 21 12C21 10.9 20.1 10 19 10ZM12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z"></path>`,close:`<path d="M11.9997 10.5865L16.9495 5.63672L18.3637 7.05093L13.4139 12.0007L18.3637 16.9504L16.9495 18.3646L11.9997 13.4149L7.04996 18.3646L5.63574 16.9504L10.5855 12.0007L5.63574 7.05093L7.04996 5.63672L11.9997 10.5865Z"></path>`,loader:`<path d="M12 3C16.9706 3 21 7.02944 21 12H19C19 8.13401 15.866 5 12 5V3Z"></path>`,menu:`<path d="M3 4H21V6H3V4ZM3 11H21V13H3V11ZM3 18H21V20H3V18Z"></path>`,palette:`<path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C17.5222 2 22 5.97778 22 10.8889C22 13.9556 19.5111 16.4444 16.4444 16.4444H14.4778C13.5556 16.4444 12.8111 17.1889 12.8111 18.1111C12.8111 18.5333 12.9778 18.9222 13.2333 19.2111C13.5 19.5111 13.6667 19.9 13.6667 20.3333C13.6667 21.2556 12.9 22 12 22C6.47778 22 2 17.5222 2 12C2 6.47778 6.47778 2 12 2ZM10.8111 18.1111C10.8111 16.0843 12.451 14.4444 14.4778 14.4444H16.4444C18.4065 14.4444 20 12.851 20 10.8889C20 7.1392 16.4677 4 12 4C7.58235 4 4 7.58235 4 12C4 16.19 7.2226 19.6285 11.324 19.9718C10.9948 19.4168 10.8111 18.7761 10.8111 18.1111ZM7.5 12C6.67157 12 6 11.3284 6 10.5C6 9.67157 6.67157 9 7.5 9C8.32843 9 9 9.67157 9 10.5C9 11.3284 8.32843 12 7.5 12ZM16.5 12C15.6716 12 15 11.3284 15 10.5C15 9.67157 15.6716 9 16.5 9C17.3284 9 18 9.67157 18 10.5C18 11.3284 17.3284 12 16.5 12ZM12 9C11.1716 9 10.5 8.32843 10.5 7.5C10.5 6.67157 11.1716 6 12 6C12.8284 6 13.5 6.67157 13.5 7.5C13.5 8.32843 12.8284 9 12 9Z"></path>`,message:`<path d="M2 8.99374C2 5.68349 4.67654 3 8.00066 3H15.9993C19.3134 3 22 5.69478 22 8.99374V21H8.00066C4.68659 21 2 18.3052 2 15.0063V8.99374ZM20 19V8.99374C20 6.79539 18.2049 5 15.9993 5H8.00066C5.78458 5 4 6.78458 4 8.99374V15.0063C4 17.2046 5.79512 19 8.00066 19H20ZM14 11H16V13H14V11ZM8 11H10V13H8V11Z"></path>`,chat:`<path d="M10 3H14C18.4183 3 22 6.58172 22 11C22 15.4183 18.4183 19 14 19V22.5C9 20.5 2 17.5 2 11C2 6.58172 5.58172 3 10 3ZM12 17H14C17.3137 17 20 14.3137 20 11C20 7.68629 17.3137 5 14 5H10C6.68629 5 4 7.68629 4 11C4 14.61 6.46208 16.9656 12 19.4798V17Z"></path>`,discuss:`<path d="M14 22.5L11.2 19H6C5.44772 19 5 18.5523 5 18V7.10256C5 6.55028 5.44772 6.10256 6 6.10256H22C22.5523 6.10256 23 6.55028 23 7.10256V18C23 18.5523 22.5523 19 22 19H16.8L14 22.5ZM15.8387 17H21V8.10256H7V17H11.2H12.1613L14 19.2984L15.8387 17ZM2 2H19V4H3V15H1V3C1 2.44772 1.44772 2 2 2Z"></path>`};const Rt=`http://www.w3.org/2000/svg`,R=Lt;function zt(e){if(!(e in R))throw Error(`Icon "${e}" not found.`)}function Bt(e){return zt(e),`<svg xmlns="${Rt}" viewBox="0 0 24 24" fill="currentColor">${R[e]}</svg>`}function Vt(e){return e!==null&&e.namespaceURI===Rt}function z(e,t={}){let n=document.createElement(`template`);n.innerHTML=Bt(e);let r=n.content.firstElementChild;if(!Vt(r))throw Error(`Icon "${e}" cannot be rendered.`);for(let[e,n]of Object.entries(t||{})){if(n==null||n===!1)continue;let t=e===`className`?`class`:e;r.setAttribute(t,n===!0?``:String(n))}return r}function Ht(e){return Bt(e)}const Ut=Ht;function Wt(){return{...R}}function Gt(e){if(typeof e!=`object`||!e)throw Error(`Icons must be a valid object.`);for(let[t,n]of Object.entries(e)){if(typeof n!=`string`||!n.trim().startsWith(`<`))throw Error(`Invalid SVG path for icon "${t}".`);R[t]=n}}function B(){return c(`div`,{"aria-live":`polite`,style:{display:`flex`,justifyContent:`center`,alignItems:`center`,position:`absolute`,width:`100%`,height:`100%`,backdropFilter:`blur(4px)`},children:z(`loader`,{width:24,className:`animate-spin`})})}const Kt={className:{default:`j-popup-layout`,type:`string`},position:{default:`center`,type:`string`},component:{default:``,type:`string`},labelledby:{default:``,type:`string`},content:{default:``,type:`renderable`}};function qt(e){let t=C(e,Kt,`Popup`);return{className:t.className,position:t.position,component:t.component,labelledby:t.labelledby,content:t.content}}function Jt(e={}){let{className:t,position:n,component:r,labelledby:i,content:a}=qt(e),o={className:`${t} is-${n}`,role:`dialog`,children:a};return r&&(o[`data-${r}`]=`root`,o[`aria-${r}`]=`true`),i&&(o[`aria-labelledby`]=i),c(`div`,o)}const Yt={root:`j-drop`,container:`drop-container`},Xt={name:{default:null,types:[`string`,`null`]},mode:{default:`click`,type:`string`,enum:[`hover`,`click`]},position:{default:`auto`,type:`string`,enum:[`auto`,`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`,`left`,`right`]},offset:{default:10,type:`number`,min:0},content:{default:``,type:`renderable`},className:{default:Yt,type:`object`,normalize:e=>({...Yt,...e&&typeof e==`object`?e:{}})},id:{default:null,types:[`string`,`null`],normalize:e=>typeof e==`string`?e.trim()||h():e??h()},delay:{default:0,types:[`number`,`object`]},hoverIntent:{default:!0,type:`boolean`},onShown:{default:null,types:[`function`,`null`]},onHidden:{default:null,types:[`function`,`null`]}};function Zt(e){let t=C(e,Xt,`Drop`);return{name:t.name,mode:t.mode,position:t.position,offset:t.offset,content:t.content,className:t.className,id:t.id,delay:t.delay,hoverIntent:t.hoverIntent,onShown:t.onShown,onHidden:t.onHidden}}function Qt(e){return typeof e==`number`&&e>=0?{show:e,hide:e}:typeof e==`object`&&e?{show:Number(e.show)||0,hide:Number(e.hide)||0}:{show:0,hide:0}}var $t=class{target;props;dom;isVisible;cleanup;delayShow;delayHide;timer;hoverIntentData;lastX;lastY;constructor(e,t={}){this.target=O(e),this.props=Zt(t),this.dom={root:null},this.isVisible=!1,this.cleanup=null,this.delayShow=0,this.delayHide=0,this.timer={show:null,hide:null},this.hoverIntentData={x:0,y:0,lastMoveTime:0},this.lastX=0,this.lastY=0,this.init(this.props)}init(e){this.cleanup={events:M()};let t=Qt(e.delay);this.delayShow=t.show,this.delayHide=t.hide,this.buildDrop(e),this.bindEvents(e)}buildDrop(e){let{className:t,content:n,id:r,name:i}=e,a=w(n)&&n.nodeType===Node.ELEMENT_NODE?n:c(`div`,{className:t.container,"data-drop-container":i||r,children:E(n,this)});this.dom.root=c(`div`,{className:t.root,id:r,"data-drop":i||h(),children:a})}bindEvents(e){let{mode:t,hoverIntent:n}=e;this.unbindEvents(),!(!this.target||!this.cleanup)&&(t===`hover`?n?(this.cleanup.events.on(`target:enter`,this.target,`mouseenter`,()=>this.startHoverIntent()),this.cleanup.events.on(`target:leave`,this.target,`mouseleave`,()=>this.cancelHoverIntent())):(this.cleanup.events.on(`target:enter`,this.target,`mouseenter`,()=>this.show()),this.cleanup.events.on(`target:leave`,this.target,`mouseleave`,()=>this.hide())):(this.cleanup.events.on(`target:click`,this.target,`click`,()=>this.toggle()),this.cleanup.events.on(`document:click`,document,`click`,e=>this.docClick(e))))}bindRootEvents(){let{root:e}=this.dom;!e||this.props?.mode!==`hover`||!this.cleanup||(this.cleanup.events.on(`root:enter`,e,`mouseenter`,()=>this.show()),this.cleanup.events.on(`root:leave`,e,`mouseleave`,()=>this.hide()))}unbindRootEvents(){this.cleanup?.events.off(`root:enter`),this.cleanup?.events.off(`root:leave`)}unbindEvents(){this.cleanup?.events.clear()}startHoverIntent(){this.cleanup&&(this.cleanup.events.on(`document:mousemove`,document,`mousemove`,e=>this.onMouseMove(e)),this.timer.show&&clearTimeout(this.timer.show),this.timer.show=setTimeout(()=>{let e=Date.now()-this.hoverIntentData.lastMoveTime;Math.abs(this.hoverIntentData.x-this.lastX)+Math.abs(this.hoverIntentData.y-this.lastY)<5||e>100?(this.show(),this.cleanup?.events.off(`document:mousemove`)):this.startHoverIntent()},this.delayShow))}cancelHoverIntent(){this.timer.show&&clearTimeout(this.timer.show),this.cleanup?.events.off(`document:mousemove`),this.hide()}onMouseMove(e){e instanceof MouseEvent&&(this.lastX=e.clientX,this.lastY=e.clientY,this.hoverIntentData.lastMoveTime=Date.now(),this.hoverIntentData.x=e.clientX,this.hoverIntentData.y=e.clientY)}setPosition(){if(!this.target||!this.dom.root||!this.props)return;let e=this.target.getBoundingClientRect(),t=this.dom.root,{offset:n,position:r}=this.props;t.style.visibility=`hidden`,t.style.display=`block`;let i=t.getBoundingClientRect(),a=0,o=0,s=r;switch(s===`auto`&&(s=window.innerHeight-e.bottom>i.height+n?`top-center`:`bottom-center`),s){case`top-left`:a=e.top-i.height-n,o=e.left;break;case`top-center`:a=e.top-i.height-n,o=e.left+e.width/2-i.width/2;break;case`top-right`:a=e.top-i.height-n,o=e.right-i.width;break;case`bottom-left`:a=e.bottom+n,o=e.left;break;case`bottom-center`:a=e.bottom+n,o=e.left+e.width/2-i.width/2;break;case`bottom-right`:a=e.bottom+n,o=e.right-i.width;break;case`left`:a=e.top+e.height/2-i.height/2,o=e.left-i.width-n;break;case`right`:a=e.top+e.height/2-i.height/2,o=e.right+n;break;default:break}a=Math.max(8,Math.min(a,window.innerHeight-i.height-8)),o=Math.max(8,Math.min(o,window.innerWidth-i.width-8)),t.style.top=`${a+window.scrollY}px`,t.style.left=`${o+window.scrollX}px`,t.style.visibility=``,t.style.display=``}docClick(e){e.target instanceof Node&&(!this.dom.root||!this.target||!this.dom.root.contains(e.target)&&!this.target.contains(e.target)&&this.hide())}exec(e){let{root:t}=this.dom;!t||!this.props||(e?(t.parentNode||document.body.appendChild(t),this.bindRootEvents(),this.setPosition()):(this.unbindRootEvents(),t.style.top=``,t.style.left=``,t.remove()),t.setAttribute(`aria-hidden`,e?`false`:`true`),t.setAttribute(`aria-expanded`,e?`true`:`false`),this.isVisible=e)}show(e=!0){this.timer.hide&&clearTimeout(this.timer.hide),!this.isVisible&&(e&&this.delayShow>0?(this.timer.show&&clearTimeout(this.timer.show),this.timer.show=setTimeout(()=>this.exec(!0),this.delayShow)):this.exec(!0),this.props?.onShown?.(this))}hide(e=!0){this.timer.show&&clearTimeout(this.timer.show),this.isVisible&&(e&&this.delayHide>0?(this.timer.hide&&clearTimeout(this.timer.hide),this.timer.hide=setTimeout(()=>this.exec(!1),this.delayHide)):this.exec(!1),this.props?.onHidden?.(this))}toggle(){this.isVisible?this.hide():this.show()}destroy(){this.props&&(this.timer.show&&clearTimeout(this.timer.show),this.timer.hide&&clearTimeout(this.timer.hide),this.unbindEvents(),this.dom.root?.remove(),this.props=null,this.dom.root=null,this.target=null,this.timer={show:null,hide:null},this.cleanup?.events.clear(),this.cleanup=null,this.isVisible=!1)}};function en(e,t={}){return new $t(e,t)}function V(...e){return e.filter(Boolean).join(` `)}const tn={container:`j-tooltip`,message:`el-text`,ui:{reverse:`is-reverse`,primary:`is-primary`,success:`is-success`,warning:`is-warning`,error:`is-error`}};function nn(e){let t=e&&typeof e==`object`?e:{},n=`ui`in t&&t.ui&&typeof t.ui==`object`?t.ui:{};return{...tn,...t,ui:{...tn.ui,...n}}}const rn={name:{default:null,types:[`string`,`null`]},mode:{default:`hover`,type:`string`,enum:[`hover`,`click`]},position:{default:`auto`,type:`string`,enum:[`auto`,`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`,`left`,`right`]},offset:{default:8,type:`number`},message:{default:``,type:`string`,normalize:e=>typeof e==`string`?e.trim():e,nonEmpty:!0},theme:{default:!1,types:[`string`,`boolean`],enum:[!1,`reverse`,`primary`,`success`,`warning`,`error`]},className:{default:tn,type:`object`,normalize:nn},id:{default:null,types:[`string`,`null`]},delay:{default:100,types:[`number`,`object`]},hoverIntent:{default:!0,type:`boolean`},onShown:{default:null,types:[`function`,`null`]},onHidden:{default:null,types:[`function`,`null`]}};function an(e){let t=C(e,rn,`Tooltip.props`);return{name:t.name,mode:t.mode,position:t.position,offset:t.offset,message:t.message,theme:t.theme,className:t.className,id:t.id,delay:t.delay,hoverIntent:t.hoverIntent,onShown:t.onShown,onHidden:t.onHidden}}var on=class{dom;drop;props;constructor(e,t={}){let n=an(t);this.props=n,this.drop=en(e,{name:n.name,mode:n.mode,position:n.position,offset:n.offset,id:n.id,delay:n.delay,hoverIntent:n.hoverIntent,onShown:n.onShown,onHidden:n.onHidden,content:this.buildContent(n)}),this.dom=this.drop.dom}buildContent(e){return c(`div`,{className:V(e.className.container,e.theme&&e.className.ui[e.theme]),"data-tooltip":e.name||e.id||``,children:c(`div`,{className:e.className.message,"data-tooltip-message":``,children:e.message})})}show(e=!0){this.drop?.show(e)}hide(e=!0){this.drop?.hide(e)}toggle(){this.drop?.toggle()}destroy(){this.drop?.destroy(),this.drop=null,this.props=null}};function sn(e,t={}){return new on(e,t)}var H={en:{b:`Back`,t:`Customize`,sm:`Small`,md:`Medium`,lg:`Large`},zh:{b:`返回`,t:`自定义主题`,Primary:`主色`,Radius:`圆角`,Shadow:`阴影`,Font:`字号`,Mode:`模式`,Gray:`灰色`,Olive:`橄榄绿`,Tomato:`番茄红`,Ruby:`红宝石`,Pink:`粉红`,Violet:`紫罗兰`,Indigo:`靛蓝`,Blue:`蓝色`,Teal:`青色`,Grass:`草绿`,Mint:`薄荷绿`,Lime:`酸橙绿`,Yellow:`黄色`,Orange:`橙色`,Gold:`金色`,None:`无`,sm:`小`,md:`中`,lg:`大`,XL:`更大`,Round:`圆角`,Light:`浅色`,Dark:`深色`,Auto:`自动`,Close:`关闭`,Confirm:`确认`}};const cn={container:`j-toast-container`,toast:`j-toast`,icon:`el-icon`,message:`el-text`,lite:`j-toast-lite`,action:`j-toast is-action`,actions:`toast-actions`,button:`j-button is-sm`,closeBtn:`is-ghost`,actionBtn:`is-outline`,info:`is-info`,primary:`is-primary`,success:`is-success`,warning:`is-warning`,error:`is-error`},ln={type:`string`,enum:[`info`,`success`,`warning`,`error`,`primary`]},un={type:`number`,min:0},dn={type:`number`,greaterThan:0};function fn(e){return{...cn,...e}}var pn=class e{static timers=new Set;static disposers=new Map;static classNames=new WeakMap;static options={className:cn};static configure(t={}){return e.options={className:fn(t.className)},e.options}static resolveClassNames(t){return fn({...e.options.className,...t?.className})}static show(t=``,n=3e3,r=`info`,i={}){S(`message`,t,`string`,`Toast.show`),S(`duration`,n,un,`Toast.show`),S(`type`,r,ln,`Toast.show`);let a=e.resolveClassNames(i),o=e.getOrCreateContainer(a),s=h(),l=c(`div`,{className:V(a.toast,a[r]),"data-toast":s,role:`alert`,"aria-atomic":`true`,children:[c(`span`,{className:a.icon,"data-toast-icon":s,children:z(r===`primary`?`info`:r)}),c(`span`,{className:a.message,"data-toast-message":s,children:t})]});e.classNames.set(l,a),o.appendChild(l);let u=r===`error`?`assertive`:`polite`;e.setTimer(s,`show`,()=>l.setAttribute(`aria-live`,u),10),n>0&&e.setTimer(s,`hide`,()=>e.hide(l),n);let d=ot(l,`click`,()=>e.hide(l));return e.disposers.set(l,d),l}static success(t=``,n=3e3,r={}){return e.show(t,n,`success`,r)}static info(t=``,n=3e3,r={}){return e.show(t,n,`info`,r)}static primary(t=``,n=3e3,r={}){return e.show(t,n,`primary`,r)}static warning(t=``,n=3e3,r={}){return e.show(t,n,`warning`,r)}static error(t=``,n=3e3,r={}){return e.show(t,n,`error`,r)}static hide(t){if(!t)return;e.disposers.get(t)?.(),e.disposers.delete(t),t.removeAttribute(`aria-live`),t.setAttribute(`aria-hidden`,`true`);let n=t.dataset.toast||h();e.setTimer(n,`remove`,()=>{t.remove();let e=A(`[data-toast-container]`);e&&e.children.length===0&&e.remove()},300)}static lite(t=``,n=2e3,r={}){S(`message`,t,`string`,`Toast.lite`),S(`duration`,n,dn,`Toast.lite`);let i=e.resolveClassNames(r);A(`[data-toast-lite]`)?.remove();let a=h(),o=c(`div`,{className:i.lite,"data-toast":a,"data-toast-lite":``,children:t});return e.classNames.set(o,i),document.body.appendChild(o),e.setTimer(a,`show`,()=>o.setAttribute(`aria-live`,`polite`),10),e.setTimer(a,`hide`,()=>{o.removeAttribute(`aria-live`),o.setAttribute(`aria-hidden`,`true`),e.setTimer(a,`remove`,()=>o.remove(),300)},n),o}static action(t=``,n={}){S(`message`,t,`string`,`Toast.action`);let r=p(`Close`,H),i=p(`Confirm`,H),a=e.resolveClassNames(n),o=e.getOrCreateContainer(a),s=h(),l=c(`div`,{className:a.action,"data-toast":s,"data-toast-action":``,children:[c(`div`,{className:a.message,"data-toast-message":s,children:t}),c(`div`,{className:a.actions,"data-toast-actions":s,children:[c(`button`,{className:V(a.button,a.closeBtn),children:n.text?.close||r,"data-action":`close`,"aria-label":n.text?.close||r,onClick:async()=>{await n.onClose?.(),e.hide(l)}}),c(`button`,{className:V(a.button,a.actionBtn),children:n.text?.action||i,"data-action":`toast-action`,"aria-label":n.text?.action||i,onClick:async()=>{await n.onAction?.(),e.hide(l)}})]})]});return e.classNames.set(l,a),o.appendChild(l),e.setTimer(s,`show`,()=>{l.setAttribute(`aria-live`,`polite`),A(`[data-action="toast-action"]`,l)?.focus()},10),l}static getOrCreateContainer(e){let t=A(`[data-toast-container]`);return t?t.className=e.container:(t=c(`div`,{className:e.container,"data-toast-container":``}),document.body.appendChild(t)),t}static setTimer(t,n,r,i){let a=`${t}-${n}`;return e.timers.add(a),N.start(a,i,()=>{e.timers.delete(a),r()}),a}static clearAll(){for(let t of e.timers)N.cancel(t);e.timers.clear();for(let t of e.disposers.values())t();e.disposers.clear(),A(`[data-toast-container]`)?.remove(),A(`[data-toast-lite]`)?.remove()}static destroyAll(){e.clearAll()}};const mn={panel:`j-theme-palette`,title:`theme-palette-title`,container:`palette-container`,item:`palette-item`,itemTitle:`item-title`,items:`items`,button:`j-button is-default`,active:`is-active`,prefix:`el-prefix`,swatch:`item-hex`,buttonText:`button-text`},hn={mode:`dark`,theme:`indigo`,radius:`sm`,shadow:`sm`,font:`sm`,key:`ui-theme`,className:mn},gn={theme:`j-theme-`,radius:`j-radius-`,shadow:`j-shadow-`,font:`j-font-`};function _n(e){return{...mn,...e}}function vn(e={}){return{...hn,...e,className:_n(e.className)}}function yn(e){return e===`mode`||e===`theme`||e===`radius`||e===`shadow`||e===`font`}function bn(){return ee({driver:`cookie`,codec:`json`,driverOptions:{path:`/`,sameSite:`Lax`,secure:typeof location<`u`&&location.protocol===`https:`},ttl:864e5})}function xn(e){if(!v(e))return null;let t=e,n={};for(let e of[`mode`,`theme`,`radius`,`shadow`,`font`]){let r=t[e];typeof r==`string`&&(n[e]=r)}return Object.keys(n).length?n:null}var Sn=class{props;languages;cleanup;runtime;storage;constructor(e={}){this.props=n(vn(e)),this.languages=H,this.cleanup=null,this.runtime={configVersion:0,destroyed:!1},this.storage=bn(),this.init()}init(){this.cleanup={bindings:new Set,events:M()},this.loadConfig(),this.bindEvent()}translate(e){return p(e,this.languages)}loadConfig(){let e=this.runtime.configVersion;this.storage.get(this.props.key).then(t=>{if(this.runtime.destroyed||this.runtime.configVersion!==e)return;let n=xn(t);n&&o(()=>{Object.assign(this.props,n)})}).catch(()=>{})}saveConfig(){let{mode:e,theme:t,radius:n,shadow:r,font:i}=this.props,a={mode:e,theme:t,radius:n,shadow:r,font:i,render:e===`auto`?this.scheme():e};this.storage.set(this.props.key,a).catch(()=>{})}scheme(){return window.matchMedia?.(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}bindActiveButtons(n){let r=i(r=>{let i=j(`[data-theme-group]`,n);for(let n of i){let r=n.dataset.themeGroup;if(!yn(r))continue;let i=j(`[data-theme-button]`,n);for(let n of i){let i=()=>n.dataset.themeValue===String(this.props[r]);t(n,this.props.className.active,i),e(n,`aria-selected`,()=>i()?`true`:null)}}return r});this.cleanup?.bindings.add(r)}bindEvent(){this.cleanup?.events.on(`palette`,document.body,`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`[data-theme-button]`);if(!t)return;let n=t.closest(`[data-theme-group]`),r=n?.dataset.themeGroup,i=t.dataset.themeValue;if(!n||!yn(r)||!i||t.classList.contains(this.props.className.active))return;let a=this.props[r];this.runtime.configVersion+=1,o(()=>{this.props[r]=i});let s=document.documentElement;if(r===`mode`){let e=i===`auto`?this.scheme():i;s.classList.remove(`light`,`dark`,a),s.classList.add(e)}else{let e=gn[r],t=Array.from(s.classList).filter(t=>t.startsWith(e));t.length&&s.classList.remove(...t),s.classList.add(`${e}${i}`)}this.saveConfig()})}unbindEvent(){this.cleanup?.events.clear()}createPanel(e=null,t=null){let n=this.props.className,r=t||this.defaultPanelConfig(),i=c(`div`,{className:e||n.panel,"data-theme-palette":`root`,children:[c(`h3`,{className:n.title,"data-theme-title":``,style:{margin:`0 0 1rem`},children:this.translate(`t`)}),c(`div`,{className:n.container,"data-theme-container":``,children:r.map(e=>c(`div`,{className:n.item,"data-palette":e.type,"data-theme-group":e.type,children:[c(`div`,{className:n.itemTitle,"data-theme-group-title":e.type,children:e.title}),c(`div`,{className:n.items,"data-theme-items":e.type,children:e.buttons.map(([t,r])=>{let i=String(this.props[e.type])===String(t);return c(`button`,{className:V(n.button,i&&n.active),"data-palette":t,"data-theme-button":e.type,"data-theme-value":t,"aria-selected":i?`true`:null,children:[e.type===`theme`?c(`span`,{className:V(n.prefix,n.swatch),"data-theme-swatch":t,style:{backgroundColor:`var(--ui-${t})`}}):null,c(`span`,{className:n.buttonText,"data-theme-button-text":t,children:r})]})})})]}))})]});return this.bindActiveButtons(i),i}setConfig(e){this.runtime.configVersion+=1,o(()=>{Object.assign(this.props,e,{className:_n({...this.props.className,...e.className})})}),this.saveConfig()}destroy(){this.runtime.destroyed||(this.runtime.destroyed=!0,this.unbindEvent(),this.cleanup?.bindings.forEach(e=>e()),this.cleanup?.bindings.clear(),this.cleanup=null,this.storage.close().catch(()=>{}))}defaultPanelConfig(){return[{title:this.translate(`Primary`),type:`theme`,buttons:[[`gray`,this.translate(`Gray`)],[`olive`,this.translate(`Olive`)],[`tomato`,this.translate(`Tomato`)],[`ruby`,this.translate(`Ruby`)],[`pink`,this.translate(`Pink`)],[`violet`,this.translate(`Violet`)],[`indigo`,this.translate(`Indigo`)],[`blue`,this.translate(`Blue`)],[`teal`,this.translate(`Teal`)],[`grass`,this.translate(`Grass`)],[`mint`,this.translate(`Mint`)],[`lime`,this.translate(`Lime`)],[`yellow`,this.translate(`Yellow`)],[`orange`,this.translate(`Orange`)],[`gold`,this.translate(`Gold`)]]},{title:this.translate(`Radius`),type:`radius`,buttons:[[`none`,this.translate(`None`)],[`sm`,this.translate(`sm`)],[`md`,this.translate(`md`)],[`lg`,this.translate(`lg`)],[`xl`,this.translate(`XL`)],[`round`,this.translate(`Round`)]]},{title:this.translate(`Shadow`),type:`shadow`,buttons:[[`none`,this.translate(`None`)],[`sm`,this.translate(`sm`)],[`md`,this.translate(`md`)],[`lg`,this.translate(`lg`)]]},{title:this.translate(`Font`),type:`font`,buttons:[[`sm`,this.translate(`sm`)],[`md`,this.translate(`md`)]]},{title:this.translate(`Mode`),type:`mode`,buttons:[[`light`,this.translate(`Light`)],[`dark`,this.translate(`Dark`)],[`auto`,this.translate(`Auto`)]]}]}};function Cn(e={}){return new Sn(e)}const wn={color:`var(--tone-solid)`,size:`12px`},Tn={ball:`parabola-ball`},En={types:[`string`,`Node`,`array`,`null`,`undefined`]},Dn={ball:{default:wn,type:`plainObject`,normalize:e=>({...wn,...e&&typeof e==`object`?e:{}}),shape:{color:`string`,size:`string`}},className:{default:Tn,type:`object`,normalize:e=>({...Tn,...e&&typeof e==`object`?e:{}})},from:{default:null,...En},to:{default:null,...En},direction:{default:`center`,type:`string`,enum:[`center`,`top-right`,`top-left`,`bottom-right`,`bottom-left`]},showDelay:{default:0,type:`number`},onShow:{default:null,types:[`function`,`null`]},onHidden:{default:null,types:[`function`,`null`]}};function On(e){let t=C(e,Dn,`Parabola.props`);return{ball:t.ball,className:t.className,from:t.from,to:t.to,direction:t.direction,showDelay:t.showDelay,onShow:t.onShow,onHidden:t.onHidden}}var kn=class{props;dom;runtime;cache;constructor(e={}){this.props=On(e),this.dom={root:null,from:O(this.props.from),to:O(this.props.to),balls:new Set},this.runtime={destroyed:!1},this.cache={delays:new Map},this.createRoot()}createRoot(){if(!this.runtime.destroyed){if(this.dom.root){this.dom.root.isConnected||document.body.appendChild(this.dom.root);return}this.dom.root=c(`div`,{"data-parabola":`root`,style:{position:`fixed`,inset:`0`,pointerEvents:`none`,zIndex:`9999`}}),document.body.appendChild(this.dom.root)}}createBall(e){if(this.runtime.destroyed||(this.createRoot(),!this.dom.root))return null;let{color:t,size:n}=this.props.ball,r=c(`div`,{className:this.props.className.ball,"data-parabola":`ball`,style:{backgroundColor:t,width:n,height:n,position:`fixed`,borderRadius:`50%`,transform:`translate(-50%, -50%)`,pointerEvents:`none`,zIndex:`9999`,opacity:`1`,left:`${e.startX}px`,top:`${e.startY}px`}});return this.dom.root.appendChild(r),this.dom.balls.add(r),r}resolveTargets(){this.dom.from=O(this.props.from),this.dom.to=O(this.props.to)}calculatePath(){let e=this.dom.from?.getBoundingClientRect(),t=this.dom.to?.getBoundingClientRect();if(!e||!t)return null;let{left:n,top:r,width:i,height:a}=e,{left:o,top:s,width:c,height:l}=t,u,d;switch(this.props.direction){case`top-left`:u=n+i*.2,d=r+a*.2;break;case`top-right`:u=n+i*.8,d=r+a*.2;break;case`bottom-left`:u=n+i*.2,d=r+a*.8;break;case`bottom-right`:u=n+i*.8,d=r+a*.8;break;default:u=n+i/2,d=r+a/2}let f=o+c/2,p=s+l/2;return{startX:u,startY:d,endX:f,endY:p}}easeOutCubic(e){return 1-(1-e)**3}animate(e,t,n,r,i,a=800){if(!e.isConnected)return;let o=performance.now(),s=r-t,c=i-n,l=r=>{if(!e.isConnected)return;let i=r-o,u=Math.min(i/a,1),d=this.easeOutCubic(u),f=t+s*d,p=n+-100*Math.sin(Math.PI*d)+c*d,ee=1-u;e.style.left=`${f}px`,e.style.top=`${p}px`,e.style.opacity=`${ee}`,e.style.transform=`translate(-50%, -50%) scale(${1-d*.3})`,u<1?requestAnimationFrame(l):this.removeBall(e,!0)};requestAnimationFrame(l)}startDelay(e,t){let n=`parabola-show-${h()}`;this.cache.delays.set(n,t),N.start(n,this.props.showDelay,()=>{this.cache.delays.delete(n),e()})}cancelDelays(){for(let[e,t]of this.cache.delays)N.cancel(e),t();this.cache.delays.clear()}removeBall(e,t){this.dom.balls.has(e)&&(e.remove(),this.dom.balls.delete(e),t&&this.props.onHidden?.(this),this.removeRootIfIdle())}removeRootIfIdle(){!this.runtime.destroyed||this.dom.balls.size>0||(this.dom.root?.remove(),this.dom.root=null)}show(){return this.runtime.destroyed?Promise.resolve(!1):new Promise(e=>{this.startDelay(()=>{if(this.runtime.destroyed){e(!1);return}this.resolveTargets();let t=this.calculatePath();if(!t){e(!1);return}let n=this.createBall(t);if(!n){e(!1);return}this.props.onShow?.(this),this.animate(n,t.startX,t.startY,t.endX,t.endY),e(!0)},()=>e(!1))})}destroy(){this.runtime.destroyed||(this.cancelDelays(),this.dom.from=null,this.dom.to=null,this.runtime.destroyed=!0,this.removeRootIfIdle())}};function An(e={}){return new kn(e)}const jn={rules:{default:{},type:`object`},messages:{default:{},type:`object`},onSubmit:{default:null,types:[`function`,`null`]}};function Mn(e){let t=C(e,jn,`Validator.props`);return{rules:t.rules,messages:t.messages,onSubmit:t.onSubmit}}function Nn(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement}function Pn(e){if(!e)return null;if(e instanceof Element)return Nn(e)?e:null;for(let t of Array.from(e))if(t instanceof Element&&Nn(t))return t;return null}function Fn(){return{valid:!0,message:``,destroyed:!1}}function In(e){return e.closest(`[data-form-control]`)||e.parentElement}function Ln(e){return Array.from(e.selectedOptions).map(e=>e.value.trim())}function Rn(e){return e instanceof HTMLInputElement&&e.type===`file`}function zn(e){return!!e.files&&e.files.length>0}var Bn=class{dom;props;runtime;cleanup;constructor(e,t={},n=!1){this.props=Mn(t),this.dom={root:this.resolveRoot(e)},this.runtime=Fn(),this.cleanup={events:M()},this.validateOptions(n),n&&this.bindEvents()}resolveRoot(e){let t=O(e);if(!(t instanceof HTMLFormElement))throw Error(`Validator.element expects a form element.`);return t}validateOptions(e){S(`bindEvents`,e,`boolean`,`Validator`)}bindEvents(){this.unbindEvents();let{root:e}=this.dom;!e||!this.cleanup||(this.cleanup.events.on(`submit`,e,`submit`,e=>{e.preventDefault(),this.validate()}),this.cleanup.events.on(`reset`,e,`reset`,()=>{this.reset({native:!1})}))}unbindEvents(){this.cleanup?.events.clear()}validate(){let{root:e}=this.dom;if(!e||!this.props)return!1;this.runtime.valid=!0,this.runtime.message=``;for(let t of Array.from(e.elements))if(!(!Nn(t)||!t.name)&&this.props.rules[t.name]&&(this.runtime.valid=this.validateRule(t,t.name),!this.runtime.valid))break;return this.runtime.valid&&this.props.onSubmit&&this.props.onSubmit(this),this.runtime.valid}validateRule(e,t){if(!this.props)return!1;let n=this.props.rules[t];if(!n)return!0;if(this.hasNativeValidationRule(e))return this.runtime.valid;for(let r of Object.keys(n)){let i=n[r],a=``;switch(r){case`required`:this.runtime.valid=this.validateRequired(e,i);break;case`minLength`:this.runtime.valid=this.validateMinLength(e,i);break;case`maxLength`:this.runtime.valid=this.validateMaxLength(e,i);break;case`equalTo`:this.runtime.valid=this.validateEqualTo(e,i);break;case`email`:this.runtime.valid=this.validateEmail(e);break;case`checked`:this.runtime.valid=this.validateCheck(e,i);break;case`selected`:this.runtime.valid=this.validateSelected(e,i);break;case`multiple`:this.runtime.valid=this.validateMultiple(e,i);break;case`min`:this.runtime.valid=this.validateSelectMin(e,i);break;case`max`:this.runtime.valid=this.validateSelectMax(e,i);break;case`noSpace`:this.runtime.valid=this.validateNoSpace(e,i);break;case`noChinese`:this.runtime.valid=!/[\u4e00-\u9fa5]/.test(e.value);break;case`noSpecial`:this.runtime.valid=!/[@#$%^&*]+/g.test(e.value);break;case`pattern`:this.runtime.valid=this.validatePattern(e,i);break;case`file`:this.runtime.valid=this.validateFile(e,i);break;case`minSize`:this.runtime.valid=this.validateMinSize(e,i);break;case`maxSize`:this.runtime.valid=this.validateMaxSize(e,i);break;case`accept`:this.runtime.valid=this.validateAccept(e,i);break;case`validate`:{let t=this.validateCustom(e,i);this.runtime.valid=t===!0,a=typeof t==`string`?t:``;break}}if(!this.runtime.valid){this.showError(e,t,r,a);break}this.showSuccess(e)}return this.runtime.valid}hasNativeValidationRule(e){return e.hasAttribute(`required`)||e.hasAttribute(`minlength`)||e.hasAttribute(`maxlength`)||e.hasAttribute(`pattern`)||e.hasAttribute(`min`)||e.hasAttribute(`max`)||e.hasAttribute(`step`)}validateRequired(e,t){return t===!0?e instanceof HTMLSelectElement?Ln(e).some(e=>e.length>0):e.value.trim().length>=1:!0}validateMinLength(e,t){return typeof t!=`number`||e.value.length>=t}validateMaxLength(e,t){return typeof t!=`number`||e.value.length<=t}validateEmail(e){return/^([\w-.]+@([\w-]+\.)+[\w-]{2,4})?$/.test(e.value)}validateEqualTo(e,t){let{root:n}=this.dom;if(!n||typeof t!=`string`)return!0;let r=Pn(n.elements.namedItem(t));if(!r)throw Error(`Validator: target element "${t}" not found.`);return e.value===r.value}validateCheck(e,t){if(!(e instanceof HTMLInputElement)||e.type!==`checkbox`)throw Error(`Validator: element expects a checkbox input, but ${e.tagName.toLowerCase()} given.`);return e.checked===t}validateSelected(e,t){if(!(e instanceof HTMLSelectElement))throw Error(`Validator: element expects a select element, but ${e.tagName.toLowerCase()} given.`);return t!==!0||Ln(e).some(e=>e.length>0)}validateMultiple(e,t){if(!(e instanceof HTMLSelectElement))throw Error(`Validator: element expects a select element, but ${e.tagName.toLowerCase()} given.`);return t!==!0||e.selectedOptions.length>0}validateSelectMin(e,t){return!(e instanceof HTMLSelectElement)||typeof t!=`number`||e.selectedOptions.length>=t}validateSelectMax(e,t){return!(e instanceof HTMLSelectElement)||typeof t!=`number`||e.selectedOptions.length<=t}validateNoSpace(e,t){return!/\s/.test(e.value)||t!==!0}validatePattern(e,t){return typeof t==`string`||t instanceof RegExp?new RegExp(t).test(e.value):!0}validateFile(e,t){return!Rn(e)||t!==!0||zn(e)}validateMinSize(e,t){return!Rn(e)||!zn(e)||typeof t!=`number`||e.files[0].size>=t}validateMaxSize(e,t){return!Rn(e)||!zn(e)||typeof t!=`number`||e.files[0].size<=t}validateAccept(e,t){if(!Rn(e)||!zn(e)||typeof t!=`string`)return!0;let n=e.files[0];return t.split(`,`).map(e=>e.trim().toLowerCase()).some(e=>e.startsWith(`.`)?n.name.toLowerCase().endsWith(e):e.endsWith(`/*`)?n.type.startsWith(e.replace(`/*`,`/`)):n.type===e)}validateCustom(e,t){if(typeof t!=`function`)return!0;let n=t(e,this);return typeof n==`string`?n:!!n}showError(e,t,n,r=``){(!(e instanceof HTMLInputElement)||e.type!==`checkbox`)&&(e.classList.remove(`is-valid`),e.classList.add(`is-invalid`));let i=r||this.props?.messages[t]?.[n]||``;if(!i)return;this.runtime.message=i;let a=In(e);if(!a)return;let o=j(`[data-validator-help]`,a).find(e=>e.dataset.validatorHelp===t)||null;o||(o=c(`div`,{className:`help-block is-invalid`,"data-validator-help":t}),a.appendChild(o)),o.textContent=i}showSuccess(e){let t=In(e);if(t)for(let n of j(`[data-validator-help]`,t))n.dataset.validatorHelp===e.name&&n.remove();(!(e instanceof HTMLInputElement)||e.type!==`checkbox`)&&(e.classList.remove(`is-invalid`),e.classList.add(`is-valid`))}reset({native:e=!0}={}){let{root:t}=this.dom;if(t){e&&t.reset();for(let e of Array.from(t.elements))Nn(e)&&(e.classList.remove(`is-valid`),e.classList.remove(`is-invalid`));for(let e of j(`[data-validator-help]`,t))e.remove();this.runtime.valid=!0,this.runtime.message=``}}destroy(){this.runtime.destroyed||(this.runtime.destroyed=!0,this.unbindEvents(),this.reset({native:!1}),this.dom.root=null,this.props=null,this.runtime.valid=!1,this.runtime.message=``,this.cleanup?.events.clear(),this.cleanup=null)}};function Vn(e,t={},n=!1){return new Bn(e,t,n)}var U=class e{static globalPlugins=new Map;props;dom;cache;plugins;cleanup;_listeners;state;runtime;constructor(e={}){this.props=e||{},this.dom={root:null},this.cache={},this.plugins=new Map,this.cleanup={events:M(),plugins:new Map},this._listeners={init:[],beforeReCreate:[],afterReCreate:[],destroy:[]},this.state=n({}),this.runtime={destroyed:!1},this.installGlobalPlugins()}use(e,t){if(!e)return this;let n=typeof e==`function`?e(this,t):e.install?.(this,t);return this.cleanup.plugins.set(e,n),this}on(e,t){return!this._listeners[e]||typeof t!=`function`||this._listeners[e].push(t),this}off(e,t){return this._listeners[e]&&(this._listeners[e]=this._listeners[e].filter(e=>e!==t)),this}installGlobalPlugins(){for(let t of e.globalPlugins.values())this.use(t)}static useGlobal(t,n){!t||!n||e.globalPlugins.set(t,n)}emit(e,...t){let n=this._listeners[e];if(!n)return this;for(let e of n)try{e(...t)}catch{}return this}init(e={}){if(this.runtime.destroyed)throw Error(`Component.init: instance destroyed`);return v(e)&&(this.props=Object.assign({},this.props,e)),typeof this.onInit==`function`&&this.onInit(this.props),this.emit(`init`,this.props),this}setState(e={},t){if(this.runtime.destroyed)throw Error(`Component.setState: instance destroyed`);let n=typeof e==`string`&&arguments.length>1?{[e]:t}:e;if(!v(n))throw Error(`Component.setState: expects a plain object patch.`);let r=this.normalizeStatePatch(n);if(!v(r))throw Error(`Component.setState: expects a plain object patch.`);return this.validateStatePatch(r),o(()=>{for(let[e,t]of Object.entries(r)){if(!this.state)return;this.state[e]=t}}),this.afterSetState(r),this}reCreate(e={},{force:t=!1}={}){if(this.runtime.destroyed)throw Error(`Component.reCreate: instance destroyed`);if(!v(e))return this;let n=Object.assign({},this.props,e);this.emit(`beforeReCreate`,e,{force:t}),typeof this.onReCreate==`function`&&this.onReCreate(e,{force:t});let r=this.createInstance(n);return this.destroy(),r.emit(`afterReCreate`,e,{force:t}),r}createInstance(e){let t=this.constructor;return new t(e)}destroy(){if(!this.runtime.destroyed){this.runtime.destroyed=!0,typeof this.onDestroy==`function`&&this.onDestroy(),this.emit(`destroy`);for(let e of this.cleanup.plugins.values())try{typeof e==`function`?e():e&&typeof e.destroy==`function`&&e.destroy()}catch{}this.cleanup.plugins.clear(),this.cleanup.events.clear(),this.dom={root:null},this.cache={},this.state=null}}normalizeStatePatch(e){return e}validateStatePatch(e){if(this.state)for(let t of Object.keys(e)){let e=String(t);if(!Object.hasOwn(this.state,e))throw Error(`Component.setState: "${e}" is not a supported state key.`)}}afterSetState(e){}};const Hn={toc:`j-toc`,list:`toc-list`,link:`toc-link`,active:`is-active`,levelPrefix:`is-level-`},Un={target:{default:`.j-content`},headings:{default:`h2, h3`,type:`string`},offset:{default:80,type:`number`,min:0},className:{default:Hn,type:`object`,normalize:e=>({...Hn,...e&&typeof e==`object`?e:{}})},onChange:{default:null,types:[`function`,`null`]}};function Wn(e){let t=C(e,Un,`Toc.props`);return{target:t.target,headings:t.headings,offset:t.offset,className:t.className,onChange:t.onChange}}function Gn(e){let t=/^H([1-6])$/.exec(e.tagName);return t?Number(t[1]):1}function Kn(e,t){return e.id||=`toc-${h()}-${t}`,{id:e.id,text:e.textContent||``,level:Gn(e),element:e}}var qn=class extends U{constructor(e={}){let t=Wn(e);super(t),this.dom.target=null,this.dom.list=null,this.dom.headings=[],this.dom.links=[],this.runtime.built=!1,this.runtime.ticking=!1,this.state=n({items:[],current:{index:-1,item:null}})}build(){if(this.runtime.destroyed)throw Error(`Toc.build: instance destroyed`);return this.runtime.built?this:(this.init(this.props),this.dom.target=k(this.props.target,`Toc.target`),this.dom.list=c(`div`,{className:this.props.className.list,"data-toc-list":`root`}),this.dom.root=c(`nav`,{className:this.props.className.toc,"data-toc":`root`,children:this.dom.list}),this.runtime.built=!0,this.refresh(),this)}bindEvents(){this.dom.list&&(this.cleanup.events.on(`scroll`,window,`scroll`,()=>this.onScroll(),{passive:!0}),this.cleanup.events.on(`click`,this.dom.list,`click`,e=>this.onClick(e)))}onScroll(){this.runtime.ticking||(requestAnimationFrame(()=>{this.updateActive(),this.runtime.ticking=!1}),this.runtime.ticking=!0)}onClick(e){if(!(e.target instanceof Element)||!this.dom.list)return;let t=e.target.closest(`[data-toc-index]`);if(!t||!this.dom.list.contains(t))return;let n=Number(t.dataset.tocIndex),r=this.state?.items[n];r&&(e.preventDefault(),this.scrollToItem(r,{activeIndex:n,updateHash:!0}))}scrollToItem(e,{activeIndex:t=-1,updateHash:n=!1}={}){let r=window.scrollY||window.pageYOffset||0,i=Math.max(0,e.element.getBoundingClientRect().top+r-this.props.offset);window.scrollTo({top:i,behavior:`smooth`}),t>=0&&this.setActive(t),n&&window.history?.pushState&&window.history.pushState(null,``,`#${e.id}`)}linkClassName(e,t=!1){let n=[this.props.className.link,`${this.props.className.levelPrefix}${e.level}`];return t&&n.push(this.props.className.active),V(...n)}buildLink(e,t){return c(`a`,{className:this.linkClassName(e),href:`#${e.id}`,"data-toc-index":String(t),"data-toc-target":e.id,children:e.text})}updateActive(){if(!this.runtime.built)return;let e=-1,t=this.props.offset+1;for(let n=this.dom.headings.length-1;n>=0;n--)if(this.dom.headings[n].getBoundingClientRect().top<=t){e=n;break}this.setActive(e)}setActive(e){if(!this.state||e===this.state.current.index)return;let t=this.state.items[e]||null;this.setState({current:{index:e,item:t}});let n=this.state.items;this.dom.links.forEach((t,r)=>{let i=r===e;t.dataset.active=i?`1`:`0`,t.className=this.linkClassName(n[r],i)}),typeof this.props.onChange==`function`&&this.props.onChange(t,e,this)}refresh(){if(this.runtime.destroyed||!this.runtime.built||!this.dom.target||!this.dom.list)return this;this.cleanup.events.clear(),this.dom.headings=j(this.props.headings,this.dom.target);let e=this.dom.headings.map(Kn);this.dom.links=e.map((e,t)=>this.buildLink(e,t)),this.dom.list.innerHTML=``;for(let e of this.dom.links)this.dom.list.appendChild(e);return this.setState({items:e,current:{index:-1,item:null}}),this.bindEvents(),this.updateActive(),this}activate(e){return!this.runtime.built||!this.state||!Number.isInteger(e)||e<0||e>=this.dom.links.length||this.scrollToItem(this.state.items[e]),this}onDestroy(){this.cleanup.events.clear(),this.dom.root?.remove(),this.runtime.built=!1,this.runtime.ticking=!1,this.dom.target=null,this.dom.list=null,this.dom.headings=[],this.dom.links=[]}};function Jn(e={}){return new qn(e)}const Yn={target:{default:null},parent:{default:null},max:{default:10,type:`number`,integer:!0,greaterThan:0},top:{default:16,type:`number`,min:0},gap:{default:16,type:`number`,min:0},overflow:{default:`destroy`,type:`string`,enum:[`destroy`,`ignore`]},onRefresh:{default:null,types:[`function`,`null`]}};function Xn(e){let t=C(e,Yn,`Sticky.props`);return{target:t.target,parent:t.parent,max:t.max,top:t.top,gap:t.gap,overflow:t.overflow,onRefresh:t.onRefresh}}function Zn(e){let t=e.filter(e=>e instanceof HTMLElement);return Array.from(new Set(t))}function Qn(e){return e===!1||e==null?null:k(e,`Sticky.parent`,`element`)}function $n(e,t){if(e===!1||e==null)return[];if(typeof e==`string`){if(!t)return Zn(k(e,`Sticky.target`,`array`));let n=Zn(j(e,t));if(n.length===0)throw Error(`Sticky.target: target not found.`);return n}let n=Zn(k(e,`Sticky.target`,`array`));if(!t)return n;let r=n.filter(e=>e===t||t.contains(e));if(r.length===0)throw Error(`Sticky.target: target not found in parent.`);return r}var er=class extends U{constructor(e={}){let t=Xn(e);super(t),this.dom.parent=null,this.dom.targets=[],this.cache.originalStyles=[],this.runtime.built=!1,this.state=n({items:[]})}build(){if(this.runtime.destroyed)throw Error(`Sticky.build: instance destroyed`);return this.runtime.built||(this.init(this.props),this.dom.parent=Qn(this.props.parent),this.dom.targets=$n(this.props.target,this.dom.parent),this.dom.targets=this.resolveOverflow(this.dom.targets),this.runtime.built=!0,this.dom.targets.length===0)?this:(this.captureOriginalStyles(),this.apply(),this)}captureOriginalStyles(){this.cache.originalStyles=this.dom.targets.map(e=>({element:e,originalPosition:e.style.position,originalTop:e.style.top,originalZIndex:e.style.zIndex}))}resolveOverflow(e){let{max:t,overflow:n}=this.props;return e.length<=t?e:n===`ignore`?[]:e.slice(-t)}apply(e=this.props.top){let t=e,n=[];for(let e of this.dom.targets)e.style.position=`sticky`,e.style.top=`${t}px`,n.push({element:e,top:t}),t+=e.offsetHeight+this.props.gap;return this.setState({items:n}),typeof this.props.onRefresh==`function`&&this.props.onRefresh(this),t}restore(){for(let e of this.cache.originalStyles)e.element.style.position=e.originalPosition,e.element.style.top=e.originalTop,e.element.style.zIndex=e.originalZIndex}refresh(){return this.runtime.destroyed||!this.runtime.built||this.dom.targets.length===0||this.apply(),this}destroy(){this.runtime.destroyed||(this.restore(),super.destroy())}onDestroy(){this.runtime.built=!1,this.cache.originalStyles=[],this.dom.targets=[]}};function tr(e={}){return new er(e)}const nr={root:`j-accordion`,header:`accordion-header`,title:`header-title`,arrow:`header-arrow`,panel:`accordion-panel`,content:`panel-content`},rr={type:`array`,nonEmpty:!0,items:{type:`plainObject`,shape:{name:[`string`,`null`,`undefined`],title:`renderable`,content:`renderable`}}},ir={id:{default:null,types:[`string`,`null`],normalize:e=>typeof e==`string`?e.trim()||h():e??h()},active:{default:0,types:[`number`,`string`,`array`,`null`],validate:e=>e==null?!0:Array.isArray(e)?e.every(ar):ar(e),message:`expects a non-negative integer, non-empty string, array or null.`},collapsible:{default:!1,type:`boolean`},multiple:{default:!1,type:`boolean`},className:{default:nr,type:`object`,normalize:e=>({...nr,...e&&typeof e==`object`?e:{}})},onChange:{default:null,types:[`function`,`null`]},items:{default:[],...rr}};function ar(e){return typeof e==`number`?Number.isInteger(e)&&e>=0:typeof e==`string`&&e.trim().length>0}function or(e){let t=C(e,ir,`Accordion.props`);return{id:t.id,active:t.active,collapsible:t.collapsible,multiple:t.multiple,className:t.className,items:sr(t.items,!1),onChange:t.onChange}}function sr(e,t=!0){t&&S(`items`,e,rr,`Accordion`);let n=new Set;return e.map(e=>{let t=e,r=typeof t.name==`string`?t.name.trim():``;if(r){if(n.has(r))throw Error(`Accordion: item name "${r}" must be unique.`);n.add(r)}return{...t,name:r||h()}})}function cr(e,t){return t.some((t,n)=>e[n]?.name!==t.name)}function lr(e,t,n){if(e==null)return[];let r=Array.isArray(e)?e:[e],i=[];for(let e of r){let r=t[typeof e==`number`?e:t.findIndex(t=>t.name===e)]?.name;if(r&&(i.push(r),!n))break}return Array.from(new Set(i))}function ur(e,t,n){let r=new Set(t.map(e=>e.name).filter(Boolean)),i=e.filter(e=>r.has(e));return n?i:i.slice(0,1)}function dr(e,t){let n=e[0]||null;if(!n)return{index:null,name:null};let r=t.findIndex(e=>e.name===n);return r>=0?{index:r,name:n}:{index:null,name:null}}var fr=class extends U{bindingsDispose;itemsDispose;constructor(e){let t=or(e);super(t);let r=lr(t.active,t.items,t.multiple);this.dom.headers=[],this.dom.panels=[],this.bindingsDispose=null,this.itemsDispose=null,this.runtime.built=!1,this.state=n({items:t.items,activeNames:r,current:dr(r,t.items)})}onInit(e){this.dom.root=this.buildRoot(e),this.bindItems(),this.bindEvents()}buildRoot(e){return c(`div`,{className:e.className.root,id:e.id,"data-accordion":`root`})}bindItems(){this.itemsDispose?.(),this.syncItems(this.state.items),this.itemsDispose=L(()=>It(this.state.items),e=>this.syncItems(e))}syncItems(e){let t=sr(I(e));cr(e,t)&&(this.state.items=t);let n=ur(this.state.activeNames,t,this.props.multiple);this.buildItems(t,n),this.syncActiveNames(n,t)}buildItems(e,t){if(!this.dom.root)return;let n=document.createDocumentFragment();this.bindingsDispose?.(),this.bindingsDispose=null,this.dom.root.textContent=``,this.dom.headers=[],this.dom.panels=[],e.forEach((e,r)=>{let i=e.name||h(),a=t.includes(i),o=`${this.props.id}_header_${r}`,s=`${this.props.id}_panel_${r}`,l=c(`div`,{className:this.props.className.header,id:o,"data-accordion-header":i,role:`button`,tabindex:`0`,"aria-controls":s,children:[c(`span`,{className:this.props.className.title,"data-accordion-title":i,role:`heading`,children:this.contentView(e,r,`title`,a)}),c(`span`,{className:this.props.className.arrow,"data-accordion-arrow":i,"aria-hidden":`true`,children:z(`arrow-down`)})]}),u=c(`div`,{className:this.props.className.panel,"data-accordion-panel":i,id:s,role:`region`,"aria-labelledby":o,children:c(`div`,{className:this.props.className.content,"data-accordion-content":i,children:this.contentView(e,r,`content`,a)})});this.dom.headers.push(l),this.dom.panels.push(u),n.append(l,u)}),this.dom.root.append(n),this.bindItemState()}bindItemState(){this.bindingsDispose=i(t=>(this.dom.headers.forEach(t=>{let n=t.dataset.accordionHeader||``;e(t,`aria-expanded`,()=>this.state.activeNames.includes(n)?`true`:`false`)}),this.dom.panels.forEach((t,n)=>{let r=this.dom.headers[n]?.dataset.accordionHeader||``;e(t,`aria-hidden`,()=>this.state.activeNames.includes(r)?`false`:`true`),e(t,`hidden`,()=>!this.state.activeNames.includes(r))}),t))}contentView(e,t,n,r){return E(n===`title`?e.title:e.content,{accordion:this,item:e,index:t,type:n,active:r})}syncActiveNames(e,t=this.state.items){o(()=>{this.state.activeNames=e,this.state.current=dr(e,t)})}bindEvents(){this.unbindEvents(),this.dom.root&&(this.cleanup.events.on(`click`,this.dom.root,`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`[data-accordion-header]`);!t||!this.dom.root?.contains(t)||this.activate(t.dataset.accordionHeader)}),this.cleanup.events.on(`keydown`,this.dom.root,`keydown`,e=>{if(!(e instanceof KeyboardEvent)||e.key!==`Enter`&&e.key!==` `||!(e.target instanceof Element))return;let t=e.target.closest(`[data-accordion-header]`);!t||!this.dom.root?.contains(t)||(e.preventDefault(),this.activate(t.dataset.accordionHeader))}))}unbindEvents(){this.cleanup.events.clear()}isActive(e){return this.state.activeNames.includes(e)}getIndex(e){return typeof e==`number`?e:typeof e==`string`?this.dom.headers.findIndex(t=>t.dataset.accordionHeader===e):-1}async activate(e){this.assertActive(`activate`),this.assertBuilt(`activate`);let t=this.getIndex(e);if(t<0||t>=this.dom.headers.length)return;let n=this.dom.headers[t],r=this.dom.panels[t],i=n.dataset.accordionHeader||String(t),a=this.isActive(i);if(a&&!this.props.multiple&&!this.props.collapsible)return;let o;if(this.props.multiple)if(a){let e=this.state.activeNames.filter(e=>e!==i);o=!this.props.collapsible&&e.length===0?this.state.activeNames:e}else o=[...this.state.activeNames,i];else o=a?this.props.collapsible?[]:this.state.activeNames:[i];this.syncActiveNames(o),this.props.onChange&&await Promise.resolve(this.props.onChange(t,i,n,r,this))}build(){if(this.assertActive(`build`),this.runtime.built)return this;this.runtime.built=!0;try{this.init(this.props)}catch(e){throw this.runtime.built=!1,this.destroy(),e}return this}normalizeStatePatch(e){return{...e,...Object.hasOwn(e,`items`)?{items:sr(e.items)}:{}}}assertActive(e){if(this.runtime.destroyed)throw Error(`Accordion.${e}: instance has been destroyed.`)}assertBuilt(e){if(!this.runtime.built)throw Error(`Accordion.${e}: call build() first.`)}onDestroy(){this.unbindEvents(),this.itemsDispose?.(),this.bindingsDispose?.(),this.itemsDispose=null,this.bindingsDispose=null,this.dom.root?.parentNode&&this.dom.root.parentNode.removeChild(this.dom.root),this.runtime.built=!1}};function pr(e){return new fr(e)}const mr={form:`j-form`,vertical:`is-vertical`,horizontal:`is-horizontal`,itemVertical:`is-item-vertical`,itemHorizontal:`is-item-horizontal`,item:`form-item`,label:`item-label`,required:`is-required`,control:`form-control`,helpInvalid:`is-invalid`,buttons:`form-buttons`,button:`j-button`,input:`j-input`,textarea:`j-textarea`,select:`j-select`,radio:`j-radio`,checkbox:`j-checkbox`,choiceVertical:`is-vertical`,choiceHorizontal:`is-horizontal`,choiceGroup:`is-group`,radioLabel:`radio-label`,radioText:`radio-text`,switch:`j-switch`,switchDefault:`is-default`,switchSizeMd:`is-md`,switchSlider:`switch-slider`},hr=[{type:`submit`,text:`Submit`,theme:`primary`,action:`submit`},{type:`reset`,text:`Reset`,theme:`ghost`,action:`reset`}],gr={id:{default:null,types:[`string`,`null`],normalize:e=>typeof e==`string`?e.trim()?e.trim():h():e??h()},vertical:{default:!0,type:`boolean`},itemVertical:{default:!0,type:`boolean`},style:{default:``,types:[`string`,`object`,`null`]},fields:{default:[],type:`array`},buttons:{default:hr,types:[`boolean`,`array`],normalize:e=>e===!1?[]:e===!0?yr(hr):Array.isArray(e)?yr(e):e},className:{default:mr,type:`object`,normalize:e=>Sr(e)},validator:{default:{},type:`object`},onSubmit:{default:null,types:[`function`,`null`]},onReset:{default:null,types:[`function`,`null`]}};function _r(e){return Array.isArray(e)?e.map(e=>e&&typeof e==`object`?{...e}:e):[]}function vr(e){return Array.isArray(e)?e.map(e=>({...e,options:_r(e.options)})):[]}function yr(e){return Array.isArray(e)?e.map(e=>({...e})):[]}function br(e){return e&&typeof e==`object`?e:{value:e,text:String(e)}}function W(e){return e==null?``:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):e.name}function xr(e,t){return e.name?!!e.required||!!t?.[e.name]?.required:!!e.required}function Sr(e){return{...mr,...v(e)?e:{}}}function Cr(e,t){if(e.removeAttribute(`style`),!t)return;if(typeof t==`string`){e.style.cssText=t;return}if(!v(t))return;let n=t;for(let[t,r]of Object.entries(n)){if(r==null||typeof r!=`string`&&typeof r!=`number`)continue;let n=t.startsWith(`--`)?t:t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);e.style.setProperty(n,String(r))}}function wr(e){let t=v(e)?e:{};return{...t,rules:v(t.rules)?t.rules:{},messages:v(t.messages)?t.messages:{}}}function Tr(e){let t=C(e,gr,`Form.props`);return{...t,id:String(t.id),vertical:!!t.vertical,itemVertical:!!t.itemVertical,style:t.style,fields:vr(t.fields),buttons:yr(t.buttons),className:Sr(t.className),validator:wr(t.validator),onSubmit:t.onSubmit,onReset:t.onReset}}var Er=class extends U{validator;cache;constructor(e={}){let t=Tr(e);super(t),this.dom.fields=new Map,this.validator=null,this.cleanup.view=null,this.cache={initial:this.cloneProps(t),fieldIds:new Map},this.state=n({...this.cloneProps(t),submitting:!1,data:null})}get root(){return this.dom?.root||null}set root(e){this.dom.root=e}build(){if(this.runtime.destroyed)throw Error(`Form.build: instance destroyed`);if(this.cleanup.view)return this;this.init(this.props);let e=document.createElement(`div`);return this.cleanup.view=i(t=>(l(u(()=>this.view(),e)),t)),this}view(){let e=this.state.className;return c(`form`,{className:()=>V(this.state.className.form,this.state.vertical?e.vertical:e.horizontal,this.state.itemVertical?e.itemVertical:e.itemHorizontal),id:()=>this.state.id,style:()=>this.state.style,"data-form":`root`,"data-form-layout":()=>this.state.vertical?`vertical`:`horizontal`,"data-form-item-layout":()=>this.state.itemVertical?`vertical`:`horizontal`,ref:e=>{let t=this.root!==e;this.root=e,Cr(e,this.state.style),(t||!this.validator)&&this.syncValidator()},onSubmit:e=>this.handleSubmit(e),onReset:e=>this.handleReset(e),children:()=>[...this.state.fields.map((e,t)=>this.fieldView(e,t)),this.buttonsView()]})}fieldView(e,t){let n=this.resolveFieldId(e,t),r=e.type===`hidden`,i=this.state.className;return c(`div`,{className:i.item,"data-form-item":e.name||String(t),style:{display:r?`none`:``},children:[this.labelView(e,n),c(`div`,{className:i.control,"data-form-control":e.name||String(t),children:[this.controlView(e,n,t),e.help?c(`div`,{className:`help-block`,"data-form-help":e.name||String(t),children:e.help}):null]})]})}labelView(e,t){if(e.label===!1||e.label===void 0)return null;let n=this.state.className;return c(`label`,{className:V(n.label,xr(e,this.state.validator?.rules)?n.required:``),"data-form-label":e.name||t,for:t,children:e.label})}controlView(e,t,n){switch(e.type){case`textarea`:return this.textareaView(e,t);case`select`:return this.selectView(e,t);case`radio`:return this.choiceGroupView(e,t,`radio`);case`checkbox`:return Array.isArray(e.options)?this.choiceGroupView(e,t,`checkbox`):this.inputView(e,t);case`switch`:return this.switchView(e,t);case`custom`:return et(e.content,{form:this,field:e,index:n});default:return this.inputView(e,t)}}inputView(e,t){let n=e.type||`text`;return c(`input`,{...this.controlProps(e,t,{type:n,className:e.className||this.state.className.input,autocomplete:e.autocomplete||this.autoComplete(n),value:e.value??``}),checked:e.checked===void 0?void 0:!!e.checked})}textareaView(e,t){return c(`textarea`,this.controlProps(e,t,{className:e.className||this.state.className.textarea,autocomplete:e.autocomplete,value:e.value??``}))}selectView(e,t){let n=e.value;return c(`select`,this.controlProps(e,t,{className:e.className||this.state.className.select,autocomplete:e.autocomplete||`off`,multiple:!!e.multiple,children:(e.options||[]).map(e=>{let t=br(e);return c(`option`,{value:t.value??``,disabled:!!t.disabled,selected:this.isSelected(n,t.value),children:t.text??t.label??t.value??``})})}))}choiceGroupView(e,t,n){let r=e.vertical?`vertical`:`horizontal`,i=this.state.className;return c(`div`,{className:V(n===`radio`?i.radio:i.checkbox,r===`vertical`?i.choiceVertical:i.choiceHorizontal,e.group?i.choiceGroup:``,e.size?`is-${e.size}`:``),"data-form-choice-group":e.name||t,"data-choice-type":n,"data-choice-layout":r,children:(e.options||[]).map((r,a)=>{let o=br(r),s=`${t}_${a}`;return c(`label`,{className:n===`radio`?i.radioLabel:``,"data-form-choice":e.name||t,for:s,children:[c(`input`,{type:n,id:s,name:e.name,value:o.value??``,checked:n===`radio`?this.isSelected(e.value,o.value):this.isChecked(e.value,o.value,o.checked),disabled:!!o.disabled||!!e.disabled,required:!!e.required}),c(`span`,{className:n===`radio`?i.radioText:``,"data-form-choice-text":``,children:o.text??o.label??o.value??``})]})})})}switchView(e,t){let n=this.state.className;return c(`label`,{className:V(n.switch,e.variant?`is-${e.variant}`:n.switchDefault,e.size?`is-${e.size}`:n.switchSizeMd),"data-form-switch":e.name||t,for:t,children:[c(`input`,{type:`checkbox`,id:t,name:e.name,value:e.value??`1`,checked:!!e.checked,disabled:!!e.disabled,required:!!e.required}),c(`span`,{className:n.switchSlider,"data-form-switch-slider":``})]})}buttonsView(){if(!this.state.buttons.length)return null;let e=this.state.className;return c(`div`,{className:e.buttons,"data-form-buttons":``,children:this.state.buttons.map(t=>c(`button`,{type:t.type||`button`,className:V(e.button,t.theme?`is-${t.theme}`:``,t.className||``),"data-action":t.action||t.type||`button`,disabled:()=>!!this.state.submitting||!!t.disabled,children:t.text??t.label??``}))})}controlProps(e,t,n){return{...n,name:e.name,id:t,placeholder:e.placeholder||``,required:!!e.required,disabled:!!e.disabled,readonly:!!e.readonly,"data-form-field":e.name||t,ref:t=>{e.name&&this.dom.fields.set(e.name,t)}}}resolveFieldId(e,t){if(e.id)return e.id;let n=e.name||t;return this.cache.fieldIds.has(n)||this.cache.fieldIds.set(n,`${this.state.id}_field_${t}`),this.cache.fieldIds.get(n)||`${this.state.id}_field_${t}`}syncValidator(){if(!this.root)return;let e={...this.state.validator,onSubmit:null};if(this.validator?.dom.root===this.root){this.validator.props=e;return}this.validator?.destroy(),this.validator=Vn(this.root,e,!1)}validate(){return!this.validator||this.validator.validate()}reset(){return this.validator?.reset(),o(()=>{this.state.data=null}),this}async handleSubmit(e){if(e.preventDefault(),this.state.submitting||!this.validate())return;let t=this.collectData();o(()=>{this.state.submitting=!0,this.state.data=t});try{await Promise.resolve(this.state.onSubmit?.(t,this))}finally{this.runtime.destroyed||o(()=>{this.state.submitting=!1})}}handleReset(e){this.resetValidationState(),o(()=>{this.state.data=null}),this.state.onReset?.(e,this)}resetValidationState(){if(this.root){for(let e of Array.from(this.root.elements))e.classList.remove(`is-valid`),e.classList.remove(`is-invalid`);for(let e of j(`[data-form-help], [data-validator-help]`,this.root))(e.dataset.validatorHelp||e.classList.contains(`is-invalid`))&&e.remove()}}collectData(){return this.root?this.collectFormData(this.root):{}}collectFormData(e){let t={},n=new FormData(e);for(let[e,r]of n.entries())Object.hasOwn(t,e)?t[e]=Array.isArray(t[e])?[...t[e],r]:[t[e],r]:t[e]=r;return t}requestSubmit(){if(!this.root)return this;if(typeof this.root.requestSubmit==`function`)return this.root.requestSubmit(),this;let e=new Event(`submit`,{bubbles:!0,cancelable:!0});return this.root.dispatchEvent(e),this}setFields(e){return S(`fields`,e,`array`,`Form.setFields`),this.cache.fieldIds.clear(),o(()=>{this.state.fields=vr(e)}),this}resetFields(){return this.setFields(this.cache.initial.fields)}cloneProps(e){return{...e,fields:vr(e.fields),buttons:yr(e.buttons),className:Sr(e.className),validator:wr(e.validator)}}autoComplete(e){switch(e){case`password`:return`current-password`;case`email`:return`email`;default:return`on`}}isSelected(e,t){return Array.isArray(e)?e.map(e=>W(e)).includes(W(t)):e==t}isChecked(e,t,n){return n===void 0?Array.isArray(e)?e.map(e=>W(e)).includes(W(t)):typeof e!=`string`&&typeof e!=`boolean`&&!(e instanceof File)?!1:e===!0||W(e)===W(t):!!n}onDestroy(){let e=this.cleanup.view;typeof e==`function`&&e(),this.cleanup.view=null,this.validator?.destroy(),this.validator=null}};function Dr(e={}){return new Er(e)}const G={root:`j-flow`,header:`flow-header`,steps:`flow-steps`,step:`flow-step`,active:`is-active`,complete:`is-complete`,stepButton:`flow-step-button`,stepIndex:`flow-step-index`,stepTitle:`flow-step-title`,body:`flow-body`,footer:`flow-footer`,button:`j-button`,reset:`is-ghost flow-reset`,back:`is-ghost flow-back`,next:`is-primary flow-next`};function Or(e){return e==null||e===!1||typeof e==`function`}function K(e){return v(e)?{...e}:{}}function kr(e){return Array.isArray(e)?[...e]:[]}function Ar(e){return Array.isArray(e)?e.map(e=>{let t={...e};return delete t.description,delete t.view,{...t,data:K(t.data),modal:typeof t.modal==`function`||t.modal==null?t.modal:K(t.modal)}}):[]}function jr(e,t){if(typeof e==`string`)return{id:e};if(v(e)){let n=e;if(typeof n.id!=`string`)return{id:t};let r=v(n.data)||n.data==null?n.data:void 0;return{id:n.id,data:r}}return{id:t}}function Mr(e){if(typeof e==`string`){let t=e.trim();return{...G,root:t?`${G.root} ${t}`:G.root}}return{...G,...v(e)?e:{}}}function Nr(...e){return e.filter(Boolean).join(` `)}const Pr={type:`plainObject`,shape:{id:{type:`string`,nonEmpty:!0}}},Fr={type:`renderable`},Ir={type:`array`,nonEmpty:!0},q={types:[`plainObject`,`null`,`undefined`]},Lr={validate:Or,message:`expects function, false or null.`},Rr={default:{},type:`plainObject`,normalize:e=>{let t=v(e)?e:{};return{...Object.fromEntries(Object.entries(t).filter(([,e])=>typeof e==`string`)),back:typeof t.back==`string`?t.back:`Back`,next:typeof t.next==`string`?t.next:`Next`,finish:typeof t.finish==`string`?t.finish:`Finish`,reset:typeof t.reset==`string`?t.reset:`Reset`}}},zr={id:{default:null,types:[`string`,`null`],normalize:e=>typeof e==`string`?e.trim()||h():e??h()},steps:{default:[],...Ir},initial:{default:null,types:[`string`,`number`,`null`]},cache:{default:!0,type:`boolean`},linear:{default:!0,type:`boolean`},render:{default:!0,type:`boolean`},rollbackOnError:{default:!0,type:`boolean`},busyStrategy:{default:`ignore`,type:`string`,enum:[`ignore`,`throw`]},showBack:{default:!0,type:`boolean`},showNext:{default:!0,type:`boolean`},showReset:{default:!1,type:`boolean`},text:Rr,className:{default:G,types:[`object`,`string`],normalize:Mr},renderHeader:{default:null,...Lr},renderBody:{default:null,...Lr},renderFooter:{default:null,...Lr},onChange:{default:null,types:[`function`,`null`]},onNext:{default:null,types:[`function`,`null`]},onBack:{default:null,types:[`function`,`null`]},onFinish:{default:null,types:[`function`,`null`]},onError:{default:null,types:[`function`,`null`]},onBusy:{default:null,types:[`function`,`null`]}};function Br(e){let t=C(e,zr,`Flow.props`);return{id:t.id,steps:Ar(t.steps),initial:t.initial,cache:t.cache,linear:t.linear,render:t.render,rollbackOnError:t.rollbackOnError,busyStrategy:t.busyStrategy,showBack:t.showBack,showNext:t.showNext,showReset:t.showReset,text:t.text,className:t.className,renderHeader:t.renderHeader,renderBody:t.renderBody,renderFooter:t.renderFooter,onChange:t.onChange,onNext:t.onNext,onBack:t.onBack,onFinish:t.onFinish,onError:t.onError,onBusy:t.onBusy}}var Vr=class{props;steps;state;dom;runtime;stepMap;initialStepId;initialData;subscribers;renderDispose;cleanupTasks;constructor(e={}){this.props=Br(e),this.steps=this.props.steps,this.validateSteps(this.steps),this.stepMap=new Map(this.steps.map((e,t)=>[e.id,t])),this.initialStepId=this.resolveInitialStepId(this.props.initial),this.initialData=this.createInitialStepData(),this.subscribers=new Set,this.renderDispose=null,this.cleanupTasks=new Set,this.dom={root:null,header:null,body:null,footer:null},this.runtime={built:!1,destroyed:!1,activeAction:null,actionController:null},this.state=n({id:this.props.id,currentId:this.initialStepId,currentIndex:this.stepMap.get(this.initialStepId)??0,previousId:null,previousIndex:null,direction:null,history:[this.initialStepId],data:K(this.initialData.global),stepData:K(this.initialData.stepData),loading:!1,error:null,busyAction:null,version:0})}get currentStep(){return this.steps[this.state.currentIndex]}get currentData(){return this.getStepData(this.state.currentId)}get canBack(){return this.state.currentIndex>0&&!this.state.loading}get canNext(){return this.state.currentIndex<this.steps.length-1&&!this.state.loading}get isLast(){return this.state.currentIndex===this.steps.length-1}subscribe(e){if(this.assertActive(`subscribe`),typeof e!=`function`)throw Error(`Flow.subscribe: handler expects a function.`);return this.subscribers.add(e),e(this.snapshot(),this,null),()=>this.subscribers.delete(e)}snapshot(){let e=this.currentStep;return{id:this.state.id,currentId:this.state.currentId,currentIndex:this.state.currentIndex,previousId:this.state.previousId,previousIndex:this.state.previousIndex,direction:this.state.direction,history:[...this.state.history],data:K(this.state.data),stepData:K(this.state.stepData),currentData:this.currentData,currentStep:this.publicStep(e),canBack:this.canBack,canNext:this.canNext,isLast:this.isLast,loading:this.state.loading,busyAction:this.state.busyAction,error:this.state.error}}build(){return this.assertActive(`build`),this.runtime.built||(this.runtime.built=!0,!this.props.render)?this:(this.dom.root=this.buildRoot(),this.mountView(),this)}teardownView(){this.renderDispose?.(),this.renderDispose=null,this.dom.root?.remove(),this.dom.root=null,this.dom.header=null,this.dom.body=null,this.dom.footer=null,this.runtime.built=!1}async next(e=null){return this.assertActive(`next`),S(`payload`,e,q,`Flow.next`),this.handleBusy(`next`)||this.runAction(`next`,async()=>{if(this.isLast)return this.finish(e,{internal:!0});let t=this.currentStep,n=this.steps[this.state.currentIndex+1]?.id,{id:r,data:i}=jr(await this.runMoveHook(`next`,t,e,n),n);return this.goTo(r,i??e,{direction:`next`,internal:!0})})}async back(e=null){return this.assertActive(`back`),S(`payload`,e,q,`Flow.back`),this.handleBusy(`back`)||(this.canBack?this.runAction(`back`,async()=>{let t=this.currentStep,n=this.steps[this.state.currentIndex-1]?.id,{id:r,data:i}=jr(await this.runMoveHook(`back`,t,e,n),n);return this.goTo(r,i??e,{direction:`back`,internal:!0})}):this.snapshot())}async goTo(e,t=null,n={}){return this.assertActive(`goTo`),S(`payload`,t,q,`Flow.goTo`),(n.internal?null:this.handleBusy(`goTo`))||this.runAction(`goTo`,async()=>{let r=this.resolveStepIndex(e),i=this.steps[r],a=this.currentStep;return!i||i.id===this.state.currentId?(t&&this.setStepData(this.state.currentId,t),this.snapshot()):(await this.transitionTo(i,{direction:n.direction||`go`,payload:t,fromStep:a}),this.snapshot())},{internal:n.internal})}setData(e){return this.assertActive(`setData`),S(`data`,e,q,`Flow.setData`),e?(o(()=>{Object.assign(this.state.data,e),this.state.version+=1}),this.emitChange(),this):this}setStepData(e,t,n={}){return this.assertActive(`setStepData`),S(`stepId`,e,{type:`string`},`Flow.setStepData`),S(`data`,t,q,`Flow.setStepData`),!t||!this.stepMap.has(e)?this:(o(()=>{this.state.stepData[e]={...K(this.state.stepData[e]),...t},this.props.cache&&Object.assign(this.state.data,t),this.state.version+=1}),n.silent||this.emitChange(),this)}getStepData(e){return K(this.state.stepData[e])}reset(){return this.assertActive(`reset`),o(()=>{this.state.currentId=this.initialStepId,this.state.currentIndex=this.stepMap.get(this.initialStepId)??0,this.state.previousId=null,this.state.previousIndex=null,this.state.direction=null,this.state.history.splice(0,this.state.history.length,this.initialStepId),this.replaceObject(this.state.data,K(this.initialData.global)),this.replaceObject(this.state.stepData,K(this.initialData.stepData)),this.state.loading=!1,this.state.busyAction=null,this.state.error=null,this.state.version+=1}),this.emitChange(),this}async finish(e=null,t={}){return this.assertActive(`finish`),S(`payload`,e,q,`Flow.finish`),(t.internal?null:this.handleBusy(`finish`))||this.runAction(`finish`,async()=>(e&&this.setStepData(this.state.currentId,e),await this.callHook(this.props.onFinish,[this.snapshot(),this]),this.snapshot()),{internal:t.internal})}destroy(){if(!this.runtime.destroyed){this.runtime.destroyed=!0,this.abortActiveAction(),this.teardownView();for(let e of Array.from(this.cleanupTasks))e();this.cleanupTasks.clear(),this.subscribers.clear(),this.steps=[],this.stepMap.clear(),this.runtime.activeAction=null,this.runtime.actionController=null}}resolveInitialStepId(e){if(typeof e==`number`){let t=this.steps[e];if(!t)throw Error(`Flow.props.initial index is out of range.`);return t.id}if(typeof e==`string`){if(!this.stepMap.has(e))throw Error(`Flow.props.initial step "${e}" does not exist.`);return e}return this.steps[0].id}validateSteps(e){let t=new Set;for(let[n,r]of e.entries()){if(S(String(n),r,Pr,`Flow.props.steps`),S(`content`,r.content??null,Fr,`Flow.props.steps.${n}`),t.has(r.id))throw Error(`Flow.props.steps: duplicated step id "${r.id}".`);t.add(r.id)}}resolveStepIndex(e){if(typeof e==`number`){if(!this.steps[e])throw Error(`Flow.goTo target is out of range.`);return e}if(typeof e==`string`){let t=this.stepMap.get(e);if(t==null)throw Error(`Flow.goTo target "${e}" does not exist.`);return t}throw Error(`Flow.goTo target expects string or number.`)}createInitialStepData(){let e={},t={};for(let n of this.steps)e[n.id]=K(n.data),Object.assign(t,e[n.id]);return{stepData:e,global:t}}async runMoveHook(e,t,n,r){let i=e===`back`?this.props.onBack:this.props.onNext,a=e===`back`?t.onBack:t.onNext,o=this.createContext({payload:n,targetId:r});if(typeof a==`function`){let e=await this.callHook(a,[o]);if(e!=null)return e}if(typeof i==`function`){let e=await this.callHook(i,[o]);if(e!=null)return e}return r}async transitionTo(e,{direction:t,payload:n,fromStep:r}){let i=this.snapshot(),a=this.captureState();try{n&&this.setStepData(r.id,n,{silent:!0}),await this.assertCanLeave(r,e,t),await this.assertCanEnter(e,r,t),typeof r.onLeave==`function`&&await this.callHook(r.onLeave,[this.createContext({direction:t,step:r,targetId:e.id})]);let a=this.state.currentId,s=this.state.currentIndex,c=this.stepMap.get(e.id)??0;o(()=>{this.state.previousId=a,this.state.previousIndex=s,this.state.currentId=e.id,this.state.currentIndex=c,this.state.direction=t,t===`back`?this.state.history.pop():this.state.history.push(e.id),this.state.error=null,this.state.version+=1}),typeof e.onEnter==`function`&&await this.callHook(e.onEnter,[this.createContext({direction:t,fromId:a,step:e})]),this.emitChange(i)}catch(e){throw this.runtime.destroyed?e:(this.props.rollbackOnError&&this.restoreState(a,{keepLoading:!0}),this.handleError(e,i),e)}}async assertCanLeave(e,t,n){if(typeof e.canLeave==`function`&&await this.callHook(e.canLeave,[this.createContext({direction:n,targetId:t.id})])===!1)throw Error(`Flow: step "${e.id}" blocked leaving.`)}async assertCanEnter(e,t,n){if(typeof e.canEnter==`function`&&await this.callHook(e.canEnter,[this.createContext({direction:n,fromId:t.id})])===!1)throw Error(`Flow: step "${e.id}" blocked entering.`)}createContext(e={}){let t=e.step||this.currentStep,n=this.snapshot();return{...e,flow:this,step:t,state:this.state,signal:this.runtime.actionController?.signal||null,snapshot:n,data:K(this.state.data),currentData:this.getStepData(t.id),setData:e=>this.setData(e),setStepData:(e,t)=>this.setStepData(e,t),getStepData:e=>this.getStepData(e),next:e=>this.next(e),back:e=>this.back(e),goTo:(e,t,n)=>this.goTo(e,t,n),addCleanup:e=>this.addCleanup(e)}}async runAction(e,t,n={}){let r=!n.internal&&!this.state.loading;r&&(this.runtime.actionController=typeof AbortController<`u`?new AbortController:null,this.runtime.activeAction=e,this.setLoading(!0,e));try{return await t()}catch(e){if(this.runtime.destroyed)return null;throw this.state.error!==e&&this.handleError(e),e}finally{r&&!this.runtime.destroyed&&(this.setLoading(!1,null),this.runtime.activeAction=null,this.runtime.actionController=null)}}handleBusy(e){if(!this.state.loading)return null;let t=Error(`Flow: action "${e}" ignored while loading.`);if(t.code=`FLOW_BUSY`,typeof this.props.onBusy==`function`&&this.props.onBusy(e,this.snapshot(),this),this.props.busyStrategy===`throw`)throw t;return this.snapshot()}abortActiveAction(){this.runtime.actionController?.abort(),this.runtime.actionController=null,this.runtime.activeAction=null}async callHook(e,t){if(typeof e!=`function`)return;let n=await e(...t);if(this.runtime.destroyed)throw this.createAbortError();return n}createAbortError(){let e=Error(`Flow: active action was aborted.`);return e.code=`FLOW_ABORTED`,e}setLoading(e,t=this.state.busyAction){let n=this.snapshot(),r=e?t:null;(this.state.loading!==e||this.state.busyAction!==r)&&(o(()=>{this.state.loading=e,this.state.busyAction=r,this.state.version+=1}),this.emitChange(n))}handleError(e,t=null){o(()=>{this.state.error=e,this.state.version+=1}),typeof this.props.onError==`function`&&this.props.onError(e,this.snapshot(),this,t)}emitChange(e=null){let t=this.snapshot();for(let n of Array.from(this.subscribers))n(t,this,e);typeof this.props.onChange==`function`&&this.props.onChange(t,this,e)}replaceObject(e,t){for(let t of Object.keys(e))delete e[t];Object.assign(e,t)}captureState(){return{currentId:this.state.currentId,currentIndex:this.state.currentIndex,previousId:this.state.previousId,previousIndex:this.state.previousIndex,direction:this.state.direction,history:kr(this.state.history),data:K(this.state.data),stepData:K(this.state.stepData),loading:this.state.loading,busyAction:this.state.busyAction,error:this.state.error,version:this.state.version}}restoreState(e,t={}){o(()=>{this.state.currentId=e.currentId,this.state.currentIndex=e.currentIndex,this.state.previousId=e.previousId,this.state.previousIndex=e.previousIndex,this.state.direction=e.direction,this.state.history.splice(0,this.state.history.length,...e.history),this.replaceObject(this.state.data,e.data),this.replaceObject(this.state.stepData,e.stepData),this.state.loading=t.keepLoading?!0:e.loading,this.state.busyAction=e.busyAction,this.state.error=e.error,this.state.version=e.version+1})}addCleanup(e){if(typeof e!=`function`)throw Error(`Flow.addCleanup: cleanup expects a function.`);return this.runtime.destroyed?(e(),()=>{}):(this.cleanupTasks.add(e),()=>this.cleanupTasks.delete(e))}assertActive(e){if(this.runtime.destroyed)throw Error(`Flow.${e}: instance has been destroyed.`)}publicStep(e){if(!e)return null;let{onEnter:t,onLeave:n,onNext:r,onBack:i,canEnter:a,canLeave:o,...s}=e;return s}buildRoot(){return c(`div`,{className:this.props.className.root,id:this.props.id,role:`group`,"data-flow":`root`,"aria-busy":()=>this.state.loading?`true`:`false`})}mountView(){this.renderDispose||!this.dom.root||(this.renderDispose=i(e=>(l(u(()=>this.view(),this.dom.root)),e)))}view(){let e=this.snapshot();return[this.headerView(e),this.bodyView(e),this.footerView(e)]}renderSlot(e,t,n){let r=this.props[e];return r===!1?null:typeof r==`function`?r(this.createRenderContext(t,n)):n()}createRenderContext(e,t){return{flow:this,snapshot:e,state:this.state,steps:this.steps.map(e=>this.publicStep(e)),currentStep:e.currentStep,currentData:e.currentData,data:e.data,fallback:t,next:e=>this.next(e),back:e=>this.back(e),goTo:(e,t,n)=>this.goTo(e,t,n),reset:()=>this.reset()}}headerView(e){return c(`div`,{className:this.props.className.header,"data-flow-header":``,ref:e=>{this.dom.header=e},children:this.renderSlot(`renderHeader`,e,()=>this.stepsView(e))})}stepsView(e){return c(`ol`,{className:this.props.className.steps,"data-flow-steps":``,role:`list`,"aria-label":`Flow steps`,children:this.steps.map((t,n)=>c(`li`,{className:this.stepClass(n,e.currentIndex),"data-flow-step":t.id,"data-flow-step-index":String(n),"aria-current":n===e.currentIndex?`step`:void 0,children:[c(`button`,{type:`button`,className:this.props.className.stepButton,disabled:this.props.linear&&n>e.currentIndex,"aria-current":n===e.currentIndex?`step`:void 0,"aria-disabled":this.props.linear&&n>e.currentIndex?`true`:`false`,"aria-label":`${n+1}. ${t.title||t.id}`,"data-flow-step-action":`goTo`,onClick:()=>{n!==e.currentIndex&&this.goTo(n)},children:[c(`span`,{className:this.props.className.stepIndex,"data-flow-step-number":``,children:n+1}),c(`span`,{className:this.props.className.stepTitle,"data-flow-step-title":``,children:t.title||t.id})]})]}))})}bodyView(e){return c(`div`,{className:this.props.className.body,"data-flow-body":``,role:`region`,"aria-live":`polite`,"aria-busy":e.loading?`true`:`false`,ref:e=>{this.dom.body=e},children:this.renderSlot(`renderBody`,e,()=>this.contentView(this.currentStep.content))})}footerView(e){return c(`div`,{className:this.props.className.footer,"data-flow-footer":``,ref:e=>{this.dom.footer=e},children:this.renderSlot(`renderFooter`,e,()=>[this.props.showReset?c(`button`,{type:`button`,className:Nr(this.props.className.button,this.props.className.reset),"data-action":`reset`,onClick:()=>this.reset(),disabled:e.loading,"aria-disabled":e.loading?`true`:`false`,children:this.props.text.reset}):null,this.props.showBack?c(`button`,{type:`button`,className:Nr(this.props.className.button,this.props.className.back),"data-action":`back`,onClick:()=>void this.back(),disabled:!e.canBack,"aria-disabled":e.canBack?`false`:`true`,children:this.props.text.back}):null,this.props.showNext?c(`button`,{type:`button`,className:Nr(this.props.className.button,this.props.className.next),"data-action":`next`,onClick:()=>void this.next(),disabled:e.loading,"aria-disabled":e.loading?`true`:`false`,children:e.isLast?this.props.text.finish:this.props.text.next}):null])})}contentView(e){return typeof e==`function`?e(this.createContext()):e??``}stepClass(e,t=this.state.currentIndex){return Nr(this.props.className.step,e===t&&this.props.className.active,e<t&&this.props.className.complete)}};function Hr(e={}){return new Vr(e)}const Ur={layout:`j-popup-layout`,modal:`j-modal`,header:`modal-header`,body:`modal-body`,footer:`modal-footer`,title:`modal-title`,button:`j-button`,closeBtn:`is-icon is-sm is-ghost`,cancelBtn:`is-ghost`,confirmBtn:`is-primary`};function J(e){return Array.isArray(e)?e.map(e=>({...e,options:Array.isArray(e.options)?e.options.map(e=>e&&typeof e==`object`?{...e}:e):e.options})):[]}function Wr(e){return{...e,fields:Array.isArray(e.fields)?J(e.fields):null,text:{...e.text},className:{...e.className}}}function Gr(e){return{mode:e.mode,content:e.content,fields:Array.isArray(e.fields)?J(e.fields):null,loading:!1,processing:!1,visible:!1,data:null,extraData:null}}function Kr(e,t){return!t||typeof t!=`object`?e:Object.assign(e,t)}const qr={type:`renderable`},Jr={default:{},type:`object`,plain:!0,normalize:e=>{let t=v(e)?e:{};return{...t,title:typeof t.title==`string`?t.title:`Tip`,confirm:typeof t.confirm==`string`?t.confirm:`Confirm`,cancel:typeof t.cancel==`string`?t.cancel:`Cancel`}}},Yr={types:[`array`,`null`]},Xr={mode:{default:null,types:[`string`,`null`],enum:[`content`,`form`,null],normalize:(e,t)=>e??(Array.isArray(t.options.fields)?`form`:`content`)},content:{default:``,...qr},position:{default:`center`,type:`string`},showCancel:{default:!0,type:`boolean`},showClose:{default:!0,type:`boolean`},fullscreen:{default:!1,type:`boolean`},text:Jr,onShow:{default:null,types:[`function`,`null`]},onShown:{default:null,types:[`function`,`null`]},onHide:{default:null,types:[`function`,`null`]},onHidden:{default:null,types:[`function`,`null`]},onConfirm:{default:null,types:[`function`,`null`]},onSubmit:{default:null,types:[`function`,`null`]},onCancel:{default:null,types:[`function`,`null`]},fields:{default:null,...Yr},header:{default:!0,type:`boolean`},footer:{default:!0,type:`boolean`},id:{default:null,types:[`string`,`null`],normalize:e=>typeof e==`string`?e.trim()||h():e??h()},escClose:{default:!1,type:`boolean`},bgClose:{default:!1,type:`boolean`},className:{default:Ur,type:`object`,normalize:e=>({...Ur,...e&&typeof e==`object`?e:{}})}},Zr={mode:{type:`string`,enum:[`content`,`form`]},content:Xr.content,fields:Xr.fields,loading:{default:!1,type:`boolean`},processing:{default:!1,type:`boolean`},visible:{default:!1,type:`boolean`},data:{default:null,types:[`object`,`null`]},extraData:{default:null,types:[`object`,`null`]}},Qr={type:`plainObject`};function $r(e){let t=C(e,Xr,`Modal`);return{mode:t.mode,content:t.content,position:t.position,showCancel:t.showCancel,showClose:t.showClose,fullscreen:t.fullscreen,text:t.text,onShow:t.onShow,onShown:t.onShown,onHide:t.onHide,onHidden:t.onHidden,onConfirm:t.onConfirm,onSubmit:t.onSubmit,onCancel:t.onCancel,fields:Array.isArray(t.fields)?J(t.fields):null,header:t.header,footer:t.footer,id:t.id,escClose:t.escClose,bgClose:t.bgClose,className:t.className}}let Y=0,ei=``;var ti=class extends U{constructor(e={}){let t=$r(e);super(t),this.dom.modal=null,this.dom.header=null,this.dom.body=null,this.dom.footer=null,this.dom.form=null,this.dom.formContainer=null,this.cleanup.visibility=null,this.cleanup.view=null,this.cleanup.hideTimer=null,this.runtime.scrollLocked=!1,this.runtime.visibleApplied=!1,this.cache={initial:Wr(this.props),fieldIds:new Map,previousActiveElement:null,formId:`${this.props.id}_form`},this.state=n(Gr(this.props)),this.init(t)}onInit(){this.bindReactiveVisibility()}build(){if(this.assertActive(`build`),this.dom.root instanceof HTMLElement)return this;let{id:e,className:t}=this.props,n=c(`div`,{className:()=>V(this.props.className.modal,this.props.fullscreen&&`is-fullscreen`),id:e,role:`document`,"data-modal-dialog":e,ref:e=>{this.dom.modal=e},children:[c(`div`,{className:t.header,style:{display:this.props.header?``:`none`},ref:e=>{this.dom.header=e}}),c(`div`,{className:t.body,ref:e=>{this.dom.body=e}}),c(`div`,{className:t.footer,style:{display:this.props.footer?``:`none`},ref:e=>{this.dom.footer=e}})]}),r=Jt({className:t.layout,position:this.props.position,component:`modal`,labelledby:this.props.header?`${e}_title`:``,content:n});return this.props.header||r.setAttribute(`aria-label`,this.props.text.title||`Modal`),this.dom.root=r,this.mountView(),this}mountView(){this.cleanup.view||!this.dom.body||(this.cleanup.view=i(e=>(this.dom.header&&l(u(()=>this.headerView(),this.dom.header)),this.dom.body&&l(u(()=>this.bodyView(),this.dom.body)),this.dom.footer&&l(u(()=>this.footerView(),this.dom.footer)),this.bindReactiveLoading(),e)))}headerView(){return()=>this.props.header?[c(`div`,{className:this.props.className.title,id:`${this.props.id}_title`,"aria-label":this.props.text.title,children:this.props.text.title}),this.props.showClose?c(`button`,{type:`button`,className:V(this.props.className.button,this.props.className.closeBtn),"data-action":`close`,"aria-label":p(`Close`,H),children:z(`close`)}):null]:null}footerView(){return()=>this.props.footer?[this.props.showCancel?c(`button`,{type:`button`,className:V(this.props.className.button,this.props.className.cancelBtn),"data-action":`cancel`,disabled:()=>this.isBusy(),children:this.props.text.cancel}):null,c(`button`,{type:()=>this.state.mode===`form`?`submit`:`button`,className:V(this.props.className.button,this.props.className.confirmBtn),"data-action":()=>this.state.mode===`form`?`submit`:`confirm`,disabled:()=>this.isBusy(),children:this.props.text.confirm})]:null}bodyView(){return this.state.mode===`form`?this.formView():(this.destroyForm(),this.contentView(this.state.content))}formView(){return c(`div`,{ref:e=>{this.mountForm(e)}})}mountForm(e){if(!e)return;this.dom.formContainer=e;let t=this.createFormProps();if(this.dom.form){this.dom.form.setFields(t.fields||[]),this.dom.form.dom.root&&!e.contains(this.dom.form.dom.root)&&e.appendChild(this.dom.form.dom.root);return}this.dom.form=Dr(t).build(),this.dom.form.dom.root&&e.appendChild(this.dom.form.dom.root)}createFormProps(){return{id:this.cache.formId,fields:this.state.fields||[],buttons:!1,onSubmit:e=>this.handleFormSubmit(e)}}destroyForm(){this.dom.form?.destroy(),this.dom.form=null,this.dom.formContainer=null}contentView(e){return E(e,this)}bindReactiveLoading(){let e=null;r(()=>{this.state.loading&&!e?(e=B(),this.dom.modal?.appendChild(e)):!this.state.loading&&e&&(e.remove(),e=null)}),l(()=>{e?.remove(),e=null})}isBusy(){return!!(this.state.loading||this.state.processing)}bindReactiveVisibility(){this.cleanup.visibility=i(e=>(r(()=>{let e=!!this.state.visible;d(()=>this.applyVisibility(e))}),e))}applyVisibility(e){if(e!==this.runtime.visibleApplied){if(e){this.showFromState();return}this.hideFromState()}}showFromState(){if(this.runtime.destroyed)throw Error(`Modal: The current instance has been destroyed.`);if(!this.dom.root)throw Error(`Modal.show: build() must be called before show().`);this.cancelHideTimer(),this.resetAnimationStyles();let{onShow:e,onShown:t}=this.props;e?.(this),this.cache.previousActiveElement=document.activeElement instanceof HTMLElement?document.activeElement:null,this.dom.root&&!this.dom.root.parentNode&&document.body.appendChild(this.dom.root),this.lockScroll(),this.runtime.visibleApplied=!0,this.bindEvents(this.dom.root),this.focusFirst(),t?.(this)}hideFromState(){if(!this.runtime.visibleApplied||!this.dom.root)return;let{onHide:e,onHidden:t}=this.props;e?.(this),this.runtime.visibleApplied=!1,this.clearEvents(),o(()=>{this.state.loading=!1,this.state.extraData=null,this.state.data=null}),this.dom.modal&&(this.dom.modal.style.transition=`opacity 300ms ease-out, transform 300ms ease-out`,this.dom.modal.style.opacity=`0`,this.dom.modal.style.transform=`scale(0.3)`),this.cancelHideTimer(),this.cleanup.hideTimer=setTimeout(()=>this.finishHide(t),300)}bindEvents(e){this.clearEvents(),this.bindOverlayCloseEvent(e),this.bindDocumentKeyEvent(),this.bindInsideEvent()}bindOverlayCloseEvent(e){e&&this.cleanup.events.on(`bg`,e,`click`,t=>{this.props.bgClose&&t.target===e&&this.hide()})}bindDocumentKeyEvent(){this.cleanup.events.on(`keydown`,document,`keydown`,e=>{if(!(!this.state.visible||!(e instanceof KeyboardEvent))){if(e.key===`Escape`&&this.props.escClose){e.preventDefault(),this.hide();return}e.key===`Tab`&&this.trapFocus(e)}})}bindInsideEvent(){this.dom.modal&&this.cleanup.events.on(`inside`,this.dom.modal,`click`,e=>{let t=(e.target instanceof Element?e.target:null)?.closest(`[data-action]`);if(!t||!this.dom.modal?.contains(t))return;let n=t.dataset.action;if(n===`cancel`||n===`close`){this.handleCancel();return}if(n===`submit`){this.requestSubmit();return}if(n===`confirm`){if(this.state.mode===`form`){this.requestSubmit();return}this.handleConfirm()}})}clearEvents(){this.cleanup.events.clear()}requestSubmit(){if(this.state.mode!==`form`||!this.dom.form){this.handleConfirm();return}this.dom.form.requestSubmit()}async handleFormSubmit(e){if(this.isBusy())return;let t=Kr(e,this.state.extraData);o(()=>{this.state.data=t}),await this.handleSubmit(t)}async handleConfirm(){if(!this.isBusy()){o(()=>{this.state.processing=!0});try{await Promise.resolve(this.props.onConfirm?.(this))}catch(e){console.error(`Modal.onConfirm error:`,e)}finally{this.state&&o(()=>{this.state.processing=!1})}}}async handleCancel(){if(!this.isBusy()){o(()=>{this.state.processing=!0});try{await Promise.resolve(this.props.onCancel?.(this)),this.hide()}catch(e){console.error(`Modal.onCancel error:`,e)}finally{this.state&&o(()=>{this.state.processing=!1})}}}async handleSubmit(e){if(this.props.onSubmit){o(()=>{this.state.processing=!0});try{await Promise.resolve(this.props.onSubmit(e,this)),this.state.extraData=null}catch(e){console.error(`Modal.onSubmit error:`,e)}finally{this.state&&o(()=>{this.state.processing=!1})}}}trapFocus(e){if(!this.dom.modal)return;let t=Array.from(j(`a[href], button:not([disabled]):not([data-action=close]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`,this.dom.modal)).filter(e=>e.offsetParent!==null||e===document.activeElement);if(t.length===0){e.preventDefault(),this.dom.modal.focus();return}let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())}focusFirst(){if(!this.dom.modal)return;let e=A(`input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]):not([data-action=close]), [tabindex]:not([tabindex="-1"])`,this.dom.form?.root||this.dom.modal);e?e.focus():(this.dom.modal.setAttribute(`tabindex`,`-1`),this.dom.modal.focus())}lockScroll(){this.runtime.scrollLocked||(Y===0&&(ei=document.body.style.overflow,document.body.style.overflow=`hidden`),Y+=1,this.runtime.scrollLocked=!0)}unlockScroll(){this.runtime.scrollLocked&&(Y=Math.max(0,Y-1),Y===0&&(document.body.style.overflow=ei,ei=``),this.runtime.scrollLocked=!1)}cancelHideTimer(){this.cleanup.hideTimer&&(clearTimeout(this.cleanup.hideTimer),this.cleanup.hideTimer=null)}resetAnimationStyles(){this.dom.modal&&(this.dom.modal.style.removeProperty(`transition`),this.dom.modal.style.removeProperty(`opacity`),this.dom.modal.style.removeProperty(`transform`))}finishHide(e){this.cleanup.hideTimer=null,this.dom.root?.remove(),this.resetAnimationStyles(),this.unlockScroll(),this.restoreFocus(),e?.(this)}restoreFocus(){let e=this.cache.previousActiveElement;this.cache.previousActiveElement=null,e&&typeof e.focus==`function`&&document.contains(e)&&e.focus()}assertActive(e){if(this.runtime.destroyed)throw Error(`Modal.${e}: The current instance has been destroyed.`)}normalizeStatePatch(e){let t={...e};return Object.hasOwn(t,`fields`)&&(t.fields=Array.isArray(t.fields)?J(t.fields):null),t}validateStatePatch(e){S(`state`,e,Qr,`Modal.setState`);for(let t of Object.keys(e)){if(!Object.hasOwn(Zr,t))throw Error(`Modal.setState: "${t}" is not a supported state key.`);S(t,e[t],Zr[t],`Modal.setState`)}}afterSetState(e){Object.hasOwn(e,`fields`)&&this.cache.fieldIds?.clear(),this.state.mode===`form`&&this.dom.form&&this.dom.form.setFields(this.createFormProps().fields||[])}show(){if(this.assertActive(`show`),!this.dom.root)throw Error(`Modal.show: build() must be called before show().`);return this.setState({visible:!0}),this}hide(){return this.assertActive(`hide`),this.setState({visible:!1}),this}reset(){return this.cache.fieldIds?.clear(),this.cache.initial&&this.setState({mode:this.cache.initial.mode,content:this.cache.initial.content,fields:Array.isArray(this.cache.initial.fields)?J(this.cache.initial.fields):null,loading:!1,processing:!1,data:null,extraData:null}),this}onDestroy(){let e=!!this.runtime.visibleApplied,{onHide:t,onHidden:n}=this.props;e&&t?.(this),this.cancelHideTimer(),this.clearEvents(),this.destroyForm(),this.unlockScroll(),this.cleanup.visibility?.(),this.cleanup.visibility=null,this.cleanup.view?.(),this.cleanup.view=null,this.dom.root?.remove(),e&&n?.(this),this.cache={initial:null,fieldIds:null,previousActiveElement:null,formId:``}}destroy(){return this.runtime.destroyed||super.destroy(),this}};function ni(e={}){return new ti(e)}const ri={root:`j-swiper`,wrapper:`swiper-wrapper`,slide:`swiper-slide`,image:`swiper-image`,title:`swiper-slide-title`,pagination:`swiper-pagination`,paginationHorizontal:`is-horizontal`,paginationClickable:`is-clickable`,paginationBulletGroup:`is-bullet`,indicator:`swiper-pagination-indicator`,bullet:`swiper-pagination-bullet`,navigation:`swiper-navigation`,prev:`is-prev`,next:`is-next`,active:`is-active`,disabled:`is-disabled`,loading:`loading`,loaded:`loaded`,error:`error`},ii={id:{default:null,types:[`string`,`null`],nonEmpty:!0,normalize:e=>typeof e==`string`?e.trim():e},data:{default:[],type:`array`},loop:{default:!0,type:`boolean`},autoplay:{default:!0,type:`boolean`},delay:{default:3e3,type:`number`,min:0},lazyload:{default:!0,type:`boolean`},pagination:{default:!0,type:`boolean`},navigation:{default:!0,type:`boolean`},speed:{default:300,type:`number`,min:0},touchRatio:{default:1,type:`number`,greaterThan:0},touchAngle:{default:45,type:`number`,min:0,max:90},longSwipesMs:{default:300,type:`number`,min:0},longSwipesRatio:{default:.05,type:`number`,min:0,max:1},preventClick:{default:!0,type:`boolean`},className:{default:ri,type:`object`,normalize:e=>({...ri,...e&&typeof e==`object`?e:{}})}},ai={type:`plainObject`,shape:{image:[`string`,`null`,`undefined`],url:[`string`,`null`,`undefined`],title:[`string`,`null`,`undefined`],sort:[`number`,`null`,`undefined`],blank:[`boolean`,`null`,`undefined`],children:`renderable`}},oi={data:ii.data,index:{type:`number`},trackIndex:{type:`number`},transform:{type:`number`},animating:{type:`boolean`},width:{type:`number`}};function si(e){return e instanceof Element&&!!e.closest(`a, button, input, textarea, select, label, [data-swiper-ignore]`)}function X(e,t=0){let n=Number(e);return Number.isFinite(n)?n:t}function ci(e,t){return E(e,t)}function li(e){return Array.isArray(e)?e.map(e=>({...e})):[]}function ui(e={}){let t=C(e,ii,`Swiper.props`);return{...t,id:t.id?.trim()||null,data:li(t.data),className:{...t.className}}}function di(e){let t=Array.from(document.querySelectorAll(`[id]`)).filter(t=>t.id===e);return S(`id`,t,{type:`array`,maxLength:1},`Swiper.props`),t[0]||null}var fi=class extends U{constructor(e={}){let t=ui(e);super(t),this.dom.createdRoot=!1,this.dom.wrapper=null,this.dom.slides=[],this.dom.pagination=null,this.dom.prevButton=null,this.dom.nextButton=null,this.dom.bullets=[],this.dom.createdPagination=!1,this.dom.createdPrevButton=!1,this.dom.createdNextButton=!1,this.cleanup.data=null,this.cleanup.bindings=null,this.cleanup.navBindings=null,this.runtime.built=!1,this.runtime.logs=[],this.runtime.startTarget=null,this.runtime.touching=!1,this.runtime.scrolling=!1,this.runtime.swiping=!1,this.runtime.clickPrevented=!1,this.runtime.timer=null,this.runtime.mountRefreshId=null,this.runtime.imageCleanups=new Set,this.runtime.realCount=0,this.state=n({data:li(this.props.data),index:0,trackIndex:0,transform:0,animating:!1,width:0})}build(){if(this.runtime.destroyed)throw Error(`Swiper.build: instance destroyed`);if(this.runtime.built)return this;let e=this.props.id?di(this.props.id):null,t=e||s(`div`,{id:this.props.id||h(),className:this.props.className.root,"data-swiper":`root`});try{this.dom.root=t,this.dom.createdRoot=!e;let n=this.dom.createdRoot?this.createDataView(t,this.state.data):A(`[data-swiper-wrapper]`,t);S(`wrapper`,n,{validate:T,message:`expects [data-swiper-wrapper] in the root element.`},`Swiper`),this.dom.wrapper=n,this.dom.slides=j(`[data-swiper-slide]`,this.dom.wrapper),this.dom.pagination=A(`[data-swiper-pagination]`,t),this.dom.prevButton=A(`[data-action="prev"]`,t),this.dom.nextButton=A(`[data-action="next"]`,t),this.dom.bullets=[],this.dom.createdPagination=!1,this.dom.createdPrevButton=!1,this.dom.createdNextButton=!1,this.runtime.realCount=this.dom.slides.length,this.runtime.built=!0,this.dom.slides.length>0&&this.onInit(),this.dom.createdRoot&&this.bindStateData(),this.queueMountRefresh()}catch(e){throw this.destroy(),e}return this.emit(`init`,this.props),this}set index(e){this.setState({index:X(e)})}set trackIndex(e){this.setState({trackIndex:X(e)})}set transform(e){this.setState({transform:X(e)})}set animating(e){this.setState({animating:!!e})}set width(e){this.setState({width:X(e)})}get realCount(){return this.runtime?.destroyed?0:this.runtime?.realCount||0}get realIndex(){return this.toRealIndex()}assertBuilt(e){if(!this.runtime.built)throw Error(`Swiper.${e}: call build() first.`)}createDataView(e,t){let n=this.normalizeData(t),r=s(`div`,{className:this.props.className.wrapper,"data-swiper-wrapper":``,"aria-live":`polite`});return e.textContent=``,n.forEach((e,t)=>{r.appendChild(this.createDataSlide(e,t))}),e.appendChild(r),r}bindStateData(){this.cleanup.data||(this.cleanup.data=L(()=>It(this.state.data),e=>this.syncStateData(e)))}syncStateData(e){if(!this.runtime.built||!this.dom.createdRoot)return;let t=li(I(e));S(`data`,t,ii.data,`Swiper.state`);let n=this.state.index,r=this.dom.wrapper;!r&&this.dom.root&&(r=this.createDataView(this.dom.root,t),this.dom.wrapper=r),r&&(this.pause(),this.clearImageCleanups(),this.cleanup.bindings?.(),this.cleanup.bindings=null,this.cleanup.navBindings?.(),this.cleanup.navBindings=null,this.cleanup.events.clear(),j(`[data-clone]`,r).forEach(e=>e.remove()),r.textContent=``,this.normalizeData(t).forEach((e,t)=>{r.appendChild(this.createDataSlide(e,t))}),this.refreshSlides(),this.runtime.realCount=this.dom.slides.length,this.setState({index:Math.min(n,Math.max(0,this.realCount-1))}),this.reInitView())}normalizeData(e){e.forEach((e,t)=>{S(String(t),e,ai,`Swiper.options.data`)});let t=e.map((e,t)=>({...e,blank:e.blank!==!1,index:t}));return t.some(e=>e.sort!=null)?t.sort((e,t)=>e.sort==null&&t.sort==null?e.index-t.index:e.sort==null?1:t.sort==null?-1:e.sort-t.sort||e.index-t.index):t}createDataSlide(e,t){let n=s(e.url?`a`:`div`,{className:this.props.className.slide,href:e.url||void 0,target:e.url?e.blank?`_blank`:`_self`:void 0,"data-swiper-slide":String(t),"data-swiper-index":String(t),role:`group`,"aria-label":`Slide ${t+1}`});if(e.children!=null)return n.append(...ci(e.children,{swiper:this,item:e,index:t})),n;if(e.image){let t=s(`img`,{className:this.props.className.image,alt:e.title||``,loading:`lazy`});this.props.lazyload?t.dataset.lazy=e.image:t.src=e.image,n.appendChild(t)}return e.title&&n.appendChild(s(`span`,{className:this.props.className.title,children:e.title})),n}onInit(){!this.dom.root||!this.dom.wrapper||(this.dom.wrapper.setAttribute(`aria-live`,`polite`),this.updateSize(),this.props.loop&&this.realCount>1&&this.initLoop(),this.setupStyles(),this.setTrackIndex(+!!this.props.loop,!1),this.render(!1),this.bindEvents(),this.props.pagination&&this.initPagination(),this.props.navigation&&this.initNavigation(),this.props.lazyload&&this.loadImages(),this.props.autoplay&&this.play())}onDestroy(){this.pause(),this.cancelMountRefresh(),this.clearImageCleanups(),this.cleanup.events.clear(),this.cleanup.data?.(),this.cleanup.data=null,this.cleanup.bindings?.(),this.cleanup.bindings=null,this.cleanup.navBindings?.(),this.cleanup.navBindings=null,this.dom.wrapper&&j(`[data-clone]`,this.dom.wrapper).forEach(e=>e.remove()),this.dom.createdPagination&&this.dom.pagination?.remove(),this.dom.createdPrevButton&&this.dom.prevButton?.remove(),this.dom.createdNextButton&&this.dom.nextButton?.remove(),this.dom.createdRoot&&this.dom.root?.remove(),this.runtime.built=!1}updateSize(){if(this.assertBuilt(`updateSize`),!this.dom.root)return;let e=this.dom.root.clientWidth||this.dom.root.offsetWidth;(e>0||!this.dom.root.isConnected||this.state.width===0)&&(this.width=e)}refresh(){return this.assertBuilt(`refresh`),this.updateSize(),this.setupStyles(),this.setTrackIndex(this.trackIndexForRealIndex(this.state.index),!1),this.props.lazyload&&this.loadImages(),this.props.autoplay&&this.hasLayout()?this.resume():this.pause(),this}hasLayout(){return!!this.dom.root?.isConnected&&this.state.width>0}syncLayout(){return this.updateSize(),this.hasLayout()?(this.setupStyles(),!0):!1}queueMountRefresh(){if(!(!this.dom.createdRoot||!this.dom.root||this.runtime.mountRefreshId)){if(typeof requestAnimationFrame!=`function`){queueMicrotask(()=>{!this.runtime.destroyed&&this.runtime.built&&this.dom.root?.isConnected&&this.refresh()});return}this.runtime.mountRefreshId=requestAnimationFrame(()=>{this.runtime.mountRefreshId=null,!this.runtime.destroyed&&this.runtime.built&&this.dom.root?.isConnected&&this.refresh()})}}cancelMountRefresh(){if(this.runtime.mountRefreshId==null||typeof cancelAnimationFrame!=`function`){this.runtime.mountRefreshId=null;return}cancelAnimationFrame(this.runtime.mountRefreshId),this.runtime.mountRefreshId=null}refreshSlides(){this.dom.wrapper&&(this.dom.slides=j(`[data-swiper-slide]`,this.dom.wrapper),this.runtime.realCount=this.dom.slides.filter(e=>!e.hasAttribute(`data-clone`)).length)}initLoop(){if(!this.dom.wrapper||this.dom.slides.length===0)return;let e=this.dom.slides[0].cloneNode(!0),t=this.dom.slides[this.dom.slides.length-1].cloneNode(!0);e.setAttribute(`data-clone`,``),t.setAttribute(`data-clone`,``),e.removeAttribute(`data-swiper-index`),t.removeAttribute(`data-swiper-index`),this.dom.wrapper.appendChild(e),this.dom.wrapper.insertBefore(t,this.dom.slides[0]),this.refreshSlides()}setupStyles(){this.dom.root&&this.dom.root.style.setProperty(`--swiper-slide-width`,`${this.state.width}px`)}reInitView(){this.dom.wrapper&&(this.pause(),this.clearImageCleanups(),this.cleanup.bindings?.(),this.cleanup.bindings=null,this.cleanup.navBindings?.(),this.cleanup.navBindings=null,this.cleanup.events.clear(),j(`[data-clone]`,this.dom.wrapper).forEach(e=>e.remove()),this.refreshSlides(),this.props.loop&&this.realCount>1&&this.initLoop(),this.updateSize(),this.setupStyles(),this.setTrackIndex(this.trackIndexForRealIndex(this.state.index),!1),this.render(!1),this.bindEvents(),this.props.pagination?this.initPagination():this.clearPagination(),this.props.navigation?this.initNavigation():this.clearNavigation(),this.props.lazyload&&this.loadImages(),this.props.autoplay&&this.play())}clearPagination(){this.cleanup.bindings?.(),this.cleanup.bindings=null,this.dom.bullets.forEach((e,t)=>{this.cleanup.events.off(`bullet:${t}:click`),this.cleanup.events.off(`bullet:${t}:keydown`)}),this.dom.bullets=[],this.dom.createdPagination?(this.dom.pagination?.remove(),this.dom.pagination=null,this.dom.createdPagination=!1):this.dom.pagination&&(this.dom.pagination.textContent=``)}clearNavigation(){this.cleanup.navBindings?.(),this.cleanup.navBindings=null,this.cleanup.events.off(`nav:prev`),this.cleanup.events.off(`nav:next`),this.dom.createdPrevButton&&(this.dom.prevButton?.remove(),this.dom.prevButton=null,this.dom.createdPrevButton=!1),this.dom.createdNextButton&&(this.dom.nextButton?.remove(),this.dom.nextButton=null,this.dom.createdNextButton=!1)}bindEvents(){let e=this.dom.root,t=this.dom.wrapper;!e||!t||(this.cleanup.events.on(`touchstart`,t,`touchstart`,e=>{let t=e;t.touches[0]&&this.onStart(t.touches[0],t.target)},{passive:!0}),this.cleanup.events.on(`touchmove`,t,`touchmove`,e=>{let t=e;t.touches[0]&&this.onMove(t.touches[0],e)},{passive:!1}),this.cleanup.events.on(`touchend`,t,`touchend`,e=>{let t=e;t.changedTouches[0]&&this.pushLog(t.changedTouches[0]),this.onEnd()}),this.cleanup.events.on(`touchcancel`,t,`touchcancel`,()=>{this.resetDrag(!0)}),this.cleanup.events.on(`window:touchcancel`,window,`touchcancel`,()=>{this.resetDrag(!0)}),this.cleanup.events.on(`mousedown`,t,`mousedown`,e=>{let n=e;n.button===0&&(this.onStart(n,n.target),t.style.cursor=`grabbing`)}),this.cleanup.events.on(`mousemove`,t,`mousemove`,e=>{let t=e;t.buttons===1&&this.onMove(t,e)}),this.cleanup.events.on(`window:mousemove`,window,`mousemove`,e=>{let t=e;this.runtime.touching&&t.buttons===1&&this.onMove(t,e)}),this.cleanup.events.on(`mouseup`,t,`mouseup`,e=>{t.style.cursor=`grab`,this.pushLog(e),this.onEnd()}),this.cleanup.events.on(`window:mouseup`,window,`mouseup`,e=>{this.runtime.touching&&(t.style.cursor=`grab`,this.pushLog(e),this.onEnd())}),this.cleanup.events.on(`wrapper:mouseleave`,t,`mouseleave`,()=>{t.style.cursor=`grab`}),this.cleanup.events.on(`click`,t,`click`,e=>{!this.runtime.clickPrevented||!this.props.preventClick||(e.preventDefault(),e.stopPropagation(),this.runtime.clickPrevented=!1)},{capture:!0}),this.cleanup.events.on(`dragstart`,t,`dragstart`,e=>e.preventDefault()),this.cleanup.events.on(`transitionend`,t,`transitionend`,e=>this.onTransitionEnd(e)),this.cleanup.events.on(`window:resize`,window,`resize`,()=>this.refresh()),this.cleanup.events.on(`root:mouseenter`,e,`mouseenter`,()=>this.pause()),this.cleanup.events.on(`root:mouseleave`,e,`mouseleave`,()=>this.resume()))}onStart(e,t=null){this.state.animating||!this.syncLayout()||(this.runtime.logs=[],this.pushLog(e),this.runtime.startTarget=t,this.runtime.touching=!0,this.runtime.scrolling=!1,this.runtime.swiping=!1,this.runtime.clickPrevented=!1,this.pause(),this.dom.wrapper&&(this.dom.wrapper.style.transition=`none`))}onMove(e,t){if(!this.runtime.touching||this.runtime.scrolling||this.state.animating)return;this.pushLog(e);let n=this.getOffset(),r=Math.abs(n.x),i=Math.abs(n.y);if(!(r<6&&i<6)){if(!this.runtime.swiping)if(Math.atan2(i,r)*180/Math.PI<this.props.touchAngle)this.runtime.swiping=!0,this.runtime.clickPrevented=si(this.runtime.startTarget);else{this.runtime.scrolling=!0,this.resetDrag(!0);return}this.runtime.swiping&&(t.preventDefault(),this.transform=-this.state.trackIndex*this.state.width+n.x*this.props.touchRatio,this.render(!1))}}onEnd(){if(!this.runtime.touching)return;if(this.runtime.touching=!1,!this.runtime.swiping){this.resetDrag(!0);return}let e=this.getDuration(),t=this.getOffset().x,n=this.state.trackIndex;if(e>this.props.longSwipesMs){let e=Math.ceil(Math.abs(t)/this.state.width-this.props.longSwipesRatio);e>0&&(n=this.state.trackIndex+e*(t>0?-1:1))}else{let e=Math.abs(t)/this.state.width,r=e>=this.props.longSwipesRatio?Math.max(1,Math.ceil(e-this.props.longSwipesRatio)):0;r>0&&(n=t>0?this.state.trackIndex-r:this.state.trackIndex+r)}this.slideToTrack(n),this.runtime.logs=[],this.resume()}resetDrag(e=!0){let t=this.state.trackIndex===0?0:-this.state.trackIndex*this.state.width,n=e&&this.state.transform!==t;this.runtime.touching=!1,this.runtime.scrolling=!1,this.runtime.swiping=!1,this.runtime.logs=[],this.runtime.startTarget=null,this.transform=t,this.render(n),this.resume()}onTransitionEnd(e){e&&(e.target!==this.dom.wrapper||!(`propertyName`in e)||e.propertyName!==`transform`)||(this.animating=!1,this.props.loop&&(this.state.trackIndex===0?(this.setTrackIndex(this.realCount,!1),this.render(!1)):this.state.trackIndex===this.dom.slides.length-1&&(this.setTrackIndex(1,!1),this.render(!1))))}pushLog(e){this.runtime.logs.push({x:e.pageX??e.clientX??0,y:e.pageY??e.clientY??0,time:Date.now()}),this.runtime.logs.length>5&&this.runtime.logs.shift()}getDuration(){return this.runtime.logs.length===0?0:this.runtime.logs[this.runtime.logs.length-1].time-this.runtime.logs[0].time}getOffset(){if(this.runtime.logs.length===0)return{x:0,y:0};let e=this.runtime.logs[0],t=this.runtime.logs[this.runtime.logs.length-1];return{x:t.x-e.x,y:t.y-e.y}}toRealIndex(e=this.state.trackIndex){return this.realCount?this.props.loop?e===0?this.realCount-1:e===this.dom.slides.length-1?0:e-1:e:0}trackIndexForRealIndex(e){if(!this.realCount)return 0;let t=Math.max(0,Math.min(e,this.realCount-1));return this.props.loop&&this.realCount>1?t+1:t}setTrackIndex(e,t=!0){let n=X(e);this.setState({trackIndex:n,index:this.toRealIndex(n),transform:-n*this.state.width}),t!=null&&this.render(t)}slideTo(e){return this.slideToTrack(this.trackIndexForRealIndex(e))}slideToTrack(e){if(this.assertBuilt(`slideToTrack`),this.state.animating||this.dom.slides.length===0||!this.syncLayout())return;let t=e;this.props.loop?e<0?t=0:e>=this.dom.slides.length&&(t=this.dom.slides.length-1):t=Math.max(0,Math.min(e,this.dom.slides.length-1)),this.setTrackIndex(t,!0),this.props.lazyload&&this.loadImages()}next(){this.assertBuilt(`next`),!this.state.animating&&this.slideToTrack(this.state.trackIndex+1)}prev(){this.assertBuilt(`prev`),!this.state.animating&&this.slideToTrack(this.state.trackIndex-1)}render(e){if(this.assertBuilt(`render`),!this.dom.wrapper)return;let t=`translate3d(${this.state.transform}px, 0, 0)`;e&&this.props.speed>0&&this.state.width>0&&this.dom.wrapper.style.transform!==t?(this.dom.wrapper.style.transition=`transform ${this.props.speed}ms cubic-bezier(0.25, 0.46, 0.45, 0.94)`,this.animating=!0):(this.dom.wrapper.style.transition=`none`,this.animating=!1),this.dom.wrapper.style.transform=t}loadImages(){this.assertBuilt(`loadImages`);let e=[this.state.trackIndex];this.state.trackIndex>0&&e.push(this.state.trackIndex-1),this.state.trackIndex<this.dom.slides.length-1&&e.push(this.state.trackIndex+1),e.forEach(e=>{let t=this.dom.slides[e];if(!t)return;let n=A(`img[data-lazy]`,t);if(!n||n.src)return;n.classList.add(this.props.className.loading),n.src=n.dataset.lazy||``;let r=()=>{n.onload=null,n.onerror=null,this.runtime.imageCleanups.delete(r)};this.runtime.imageCleanups.add(r),n.onload=()=>{n.classList.remove(this.props.className.loading),n.classList.add(this.props.className.loaded),r()},n.onerror=()=>{n.classList.remove(this.props.className.loading),n.classList.add(this.props.className.error),r()}})}clearImageCleanups(){this.runtime.imageCleanups?.forEach(e=>e()),this.runtime.imageCleanups?.clear()}initPagination(){if(!this.dom.root)return;this.dom.pagination?(this.dom.pagination.classList.add(this.props.className.paginationHorizontal,this.props.className.paginationClickable,this.props.className.paginationBulletGroup),this.dom.pagination.setAttribute(`data-swiper-pagination`,``)):(this.dom.pagination=s(`div`,{className:V(this.props.className.pagination,this.props.className.paginationHorizontal,this.props.className.paginationClickable,this.props.className.paginationBulletGroup),"data-swiper-pagination":``}),this.dom.root.appendChild(this.dom.pagination),this.dom.createdPagination=!0);let n=this.dom.pagination;if(n){n.textContent=``,this.dom.bullets=[];for(let e=0;e<this.realCount;e++){let t=s(`button`,{type:`button`,className:V(this.props.className.indicator,this.props.className.bullet),"data-swiper-bullet":String(e),"aria-label":`Go to slide ${e+1}`});this.cleanup.events.on(`bullet:${e}:click`,t,`click`,()=>{this.slideTo(e)}),this.cleanup.events.on(`bullet:${e}:keydown`,t,`keydown`,t=>{let n=t;(n.key===`Enter`||n.key===` `)&&(t.preventDefault(),this.slideTo(e))}),this.dom.bullets.push(t),n.appendChild(t)}this.cleanup.bindings=i(n=>(this.dom.bullets.forEach((n,r)=>{t(n,this.props.className.active,()=>this.state.index===r),e(n,`aria-current`,()=>this.state.index===r?`true`:null)}),n))}}initNavigation(){let n=this.ensureNavigation(`prev`,`arrow-left`),r=this.ensureNavigation(`next`,`arrow-right`);this.dom.prevButton=n,this.dom.nextButton=r,this.cleanup.events.on(`nav:prev`,n,`click`,()=>this.prev()),this.cleanup.events.on(`nav:next`,r,`click`,()=>this.next()),this.props.loop||(this.cleanup.navBindings=i(i=>(t(n,this.props.className.disabled,()=>this.state.trackIndex<=0),e(n,`disabled`,()=>this.state.trackIndex<=0?``:null),t(r,this.props.className.disabled,()=>this.state.trackIndex>=this.dom.slides.length-1),e(r,`disabled`,()=>this.state.trackIndex>=this.dom.slides.length-1?``:null),i)))}ensureNavigation(e,t){if(!this.dom.root)throw Error(`Swiper.ensureNavigation: root not found.`);let n=e===`prev`?`createdPrevButton`:`createdNextButton`,r=e===`prev`?this.props.className.prev:this.props.className.next,i=V(this.props.className.navigation,r),a=A(`[data-action="${e}"]`,this.dom.root);return a?a.tagName.toLowerCase()===`button`?(a.classList.add(this.props.className.navigation,r),a.setAttribute(`data-swiper-navigation`,e)):(a.setAttribute(`role`,`button`),a.setAttribute(`tabindex`,`0`),a.classList.add(this.props.className.navigation,r),a.setAttribute(`data-swiper-navigation`,e)):(a=s(`button`,{type:`button`,className:i,"data-action":e,"data-swiper-navigation":e}),this.dom.root.appendChild(a),this.dom[n]=!0),a.setAttribute(`aria-label`,e===`prev`?`Previous slide`:`Next slide`),A(`svg`,a)||(a.textContent=``,a.appendChild(z(t))),a}play(){if(this.assertBuilt(`play`),this.runtime.destroyed||this.runtime.timer||this.realCount<=1||!this.syncLayout())return;let e=Math.max(this.props.delay,16);this.runtime.timer=setInterval(()=>this.next(),e)}pause(){this.runtime.timer&&(clearInterval(this.runtime.timer),this.runtime.timer=null)}resume(){this.runtime.destroyed||this.props.autoplay&&!this.runtime.timer&&this.play()}restartAutoplay(){this.pause(),this.props.autoplay&&this.play()}normalizeStatePatch(e){let t={...e};return Object.hasOwn(t,`data`)&&Array.isArray(t.data)&&(t.data=li(t.data)),t}validateStatePatch(e){S(`state`,e,{type:`plainObject`},`Swiper.setState`);for(let t of Object.keys(e)){if(!Object.hasOwn(oi,t))throw Error(`Swiper.setState: "${t}" is not a supported state key.`);S(t,e[t],oi[t],`Swiper.setState`)}Array.isArray(e.data)&&this.normalizeData(e.data)}};function pi(e={}){return new fi(e)}const mi={root:`j-tabs`,wrap:`tab-wrap`,list:`tab-list`,tab:`tab-item`,panelWrap:`tab-panel`,panel:`panel-item`,disabled:`is-disabled`,dragging:`dragging`},Z={id:{default:null,types:[`string`,`null`],normalize:e=>typeof e==`string`?e.trim()||h():e??h()},direction:{default:`top`,type:`string`,enum:[`top`,`bottom`,`left`,`right`]},active:{default:0,types:[`number`,`string`]},disabled:{default:[],types:[`number`,`string`,`array`]},onChange:{default:null,types:[`function`,`null`]},data:{default:[],type:`array`},className:{default:mi,type:`object`,normalize:e=>({...mi,...e&&typeof e==`object`?e:{}})}},hi={type:`plainObject`,shape:{title:`renderable`,panel:`renderable`}};function gi(e){return Array.isArray(e)?e.map(e=>{let t={...e};return t.name=t.name||h(),t}):[]}function _i(e){return Array.isArray(e)?e.slice():e}function vi(e,t){let n=e=>typeof e==`number`?t[e]?.name||null:typeof e==`string`?e:null,r=Array.isArray(e)?e.map(n).filter(e=>!!e):(()=>{let t=n(e);return t?[t]:[]})(),i=Array.from(new Set(r));return{names:i,indexes:i.map(e=>t.findIndex(t=>t.name===e)).filter(e=>e>=0)}}function yi(e){return typeof e==`number`&&e>0?e:0}function bi(e){let t=C(e,Z,`Tabs`);return{id:t.id,direction:t.direction,active:t.active,disabled:t.disabled,onChange:t.onChange,data:gi(t.data),className:t.className}}const Q={data:Z.data,active:Z.active,disabled:Z.disabled,direction:Z.direction};var xi=class extends U{bindingsDispose;stateDispose;isDragging;raf;resizeRaf;velocity;constructor(e={}){let t=bi(e);super(t),this.dom.tabs=[],this.dom.panels=[],this.bindingsDispose=null,this.stateDispose=null,this.isDragging=!1,this.raf=0,this.resizeRaf=0,this.velocity=0,this.state=n({data:gi(t.data),active:t.active,disabled:_i(t.disabled),direction:t.direction,current:{index:-1,name:null},isVertical:t.direction===`left`||t.direction===`right`,draggable:!1,loading:!1}),this.runtime.cache={panels:new Map},this.runtime.built=!1,this.runtime.panelLoadId=0}onInit(e){this.dom.root=this.buildRoot(e),this.renderItems(),this.activateInternal(this.state.active,!1),this.bindEvents(),this.initDrag(),this.bindState()}buildRoot(e){let{id:t,className:n}=e,r=c(`nav`,{className:n.list,"data-tabs-list":``}),i=c(`div`,{className:n.wrap,"data-tabs-wrap":``,children:r}),a=c(`div`,{className:n.panelWrap,"data-tabs-panel-wrap":``});return c(`div`,{className:n.root,id:t,"data-tabs":`root`,"data-tabs-direction":this.state.direction,children:[i,a]})}renderItems(t=this.state.data){if(!this.dom.root)return;let n=A(`[data-tabs-list]`,this.dom.root),r=A(`[data-tabs-panel-wrap]`,this.dom.root);if(!n||!r)return;n.textContent=``,r.textContent=``,this.dom.tabs=[],this.dom.panels=[];let a=document.createDocumentFragment(),o=document.createDocumentFragment();t.forEach((e,t)=>{let n=e.name||h(),r=c(`div`,{className:this.props.className.tab,"data-tabs-tab":n,role:`tab`,children:E(e.title,{tabs:this,item:e})});this.dom.tabs.push(r);let i=c(`div`,{className:this.props.className.panel,"data-tabs-panel":n,role:`tabpanel`});this.dom.panels.push(i),typeof e.panel!=`function`&&i.append(...E(e.panel,{tabs:this,item:e,index:t,name:n})),a.append(r),o.append(i)}),n.append(a),r.append(o),this.bindingsDispose?.(),this.bindingsDispose=i(t=>(this.dom.tabs.forEach((t,n)=>{let r=t.dataset.tabsTab||``;e(t,`aria-selected`,()=>this.state.current.index===n?`true`:`false`),e(t,`aria-disabled`,()=>this.isDisabledName(r)?`true`:`false`)}),this.dom.panels.forEach((t,n)=>{e(t,`aria-hidden`,()=>this.state.current.index===n?`false`:`true`)}),t))}bindState(){if(this.stateDispose)return;let e=this.state.data,t=F(e),n=this.state.direction,r=this.state.active;this.stateDispose=L(()=>{let i=this.state.data,a=F(i),o=this.state.direction,s=this.state.disabled,c=this.state.active,l={data:i,direction:o,disabled:s,active:c,dataChanged:i!==e||a!==t,directionChanged:o!==n,activeChanged:c!==r};return e=i,t=a,n=o,r=c,l},e=>this.syncStateView(e))}async syncStateView({data:e,direction:t,disabled:n,active:r,dataChanged:i,directionChanged:a,activeChanged:s}){if(!this.runtime.built||!this.dom.root)return;let c=gi(I(e));this.validateData(c),S(`direction`,t,Q.direction,`Tabs.state`),S(`disabled`,n,Q.disabled,`Tabs.state`),S(`active`,r,Q.active,`Tabs.state`),a&&(this.dom.root.setAttribute(`data-tabs-direction`,t),o(()=>{this.state.isVertical=t===`left`||t===`right`})),i&&(this.runtime.cache.panels.clear(),this.renderItems(c),this.bindEvents(),o(()=>{this.syncCurrent(-1)})),(i||s)&&await this.activateInternal(r,s),this.refreshDrag()}get disabledState(){return vi(this.state.disabled,this.state.data)}isDisabledName(e){return this.disabledState.names.includes(e)}syncCurrent(e){this.state.current={index:e,name:e>=0&&e<this.dom.tabs.length&&this.dom.tabs[e]?.dataset.tabsTab||null}}getPanelKey(e,t){return e.name||this.dom.tabs[t]?.dataset.tabsTab||String(t)}getCachedPanel(e,t){if(!e.cache)return null;let n=this.getPanelKey(e,t),r=this.runtime.cache.panels.get(n);if(!r)return null;let i=yi(e.ttl);return i&&Date.now()-r.updatedAt>i?(this.runtime.cache.panels.delete(n),null):r}setCachedPanel(e,t,n){e.cache&&this.runtime.cache.panels.set(this.getPanelKey(e,t),{content:n,updatedAt:Date.now()})}renderPanelContent(e,t){let n=this.dom.panels[e],r=this.state.data[e];!n||!r||(n.textContent=``,n.append(...E(t,{tabs:this,item:r,index:e,name:this.dom.tabs[e]?.dataset.tabsTab||r.name||e})))}async loadPanel(e){let t=this.state.data[e],n=this.dom.panels[e];if(!t||!n||typeof t.panel!=`function`){this.runtime.panelLoadId+=1,o(()=>{this.state.loading=!1});return}let r=this.getCachedPanel(t,e);if(r){this.runtime.panelLoadId+=1,o(()=>{this.state.loading=!1}),this.renderPanelContent(e,r.content);return}let i=++this.runtime.panelLoadId;o(()=>{this.state.loading=!0}),n.setAttribute(`aria-live`,`polite`),n.setAttribute(`aria-busy`,`true`),n.textContent=``,n.appendChild(B());try{let n=await Promise.resolve(t.panel({tabs:this,item:t,index:e,name:this.dom.tabs[e]?.dataset.tabsTab||t.name||e}));if(this.runtime.destroyed||i!==this.runtime.panelLoadId)return;this.setCachedPanel(t,e,n),this.renderPanelContent(e,n)}finally{!this.runtime.destroyed&&i===this.runtime.panelLoadId&&(o(()=>{this.state.loading=!1}),n.setAttribute(`aria-busy`,`false`))}}get activeIndex(){return this.state.current.index}get disabledNames(){return this.disabledState.names}bindEvents(){if(this.unbindEvents(),!this.dom.root)return;let e=A(`[data-tabs-list]`,this.dom.root);e&&this.cleanup.events.on(`tabClick`,e,`click`,t=>{if(!(t.target instanceof Element))return;let n=t.target.closest(`[data-tabs-tab]`);if(!n||!e.contains(n))return;let r=n.dataset.tabsTab;r&&!this.isDisabledName(r)&&this.activate(r)})}unbindEvents(){this.cleanup.events.clear()}assertActive(e){if(this.runtime.destroyed)throw Error(`Tabs.${e}: instance has been destroyed.`);if(!this.runtime.built)throw Error(`Tabs.${e}: call build() first.`)}getIndex(e){return typeof e==`number`?e:typeof e==`string`?this.dom.tabs.findIndex(t=>t.dataset.tabsTab===e):-1}async activateInternal(e,t=!0){let n=this.getIndex(e),r=this.dom.tabs[n]?.dataset.tabsTab||``;if(!(n<0||n>=this.dom.tabs.length||this.isDisabledName(r)||this.state.current.index===n)&&(o(()=>{this.syncCurrent(n)}),await this.loadPanel(n),t&&this.props.onChange)){let e=this.dom.tabs[n],t=this.dom.panels[n];await Promise.resolve(this.props.onChange(n,e?.dataset.tabsTab||n,e,t))}}async activate(e){this.assertActive(`activate`),this.state.active=e,await this.activateInternal(e,!0)}build(){if(this.runtime.destroyed)throw Error(`Tabs.build: instance has been destroyed.`);if(this.runtime.built)return this;try{this.runtime.built=!0,this.onInit(this.props)}catch(e){throw this.destroy(),e}return this.emit(`init`,this.props),this}refresh(){return this.assertActive(`refresh`),this.refreshDrag(),this}get dragContainer(){return this.dom.root?A(`[data-tabs-wrap]`,this.dom.root):null}get dragInner(){return this.dom.root?A(`[data-tabs-list]`,this.dom.root):null}initDrag(){let e=this.state.direction,t=this.dragContainer,n=this.dragInner;if(!t||!n)return;let r=e===`left`||e===`right`,i=r?n.scrollHeight>t.clientHeight+5:n.scrollWidth>t.clientWidth+5;if(o(()=>{this.state.isVertical=r,this.state.draggable=i}),!i){this.removeDragEvents();return}this.bindDragEvents(),this.cleanup.events.on(`resize`,window,`resize`,()=>{cancelAnimationFrame(this.resizeRaf),this.resizeRaf=requestAnimationFrame(()=>{this.refreshDrag()})})}bindDragEvents(){this.removeDragEvents();let e=this.dragContainer,t=this.dragInner;if(!e||!t)return;let n=this.state.isVertical,r=0,i=0,a=0,o=!1,s=e=>{if(`touches`in e){let t=e.touches[0]||e.changedTouches[0];return n?t.pageY:t.pageX}return n?e.pageY:e.pageX},c=o=>{!(o instanceof MouseEvent)&&!(o instanceof TouchEvent)||(this.isDragging=!0,t.classList.add(this.props.className.dragging),r=s(o),a=r,i=n?e.scrollTop:e.scrollLeft,this.velocity=0,cancelAnimationFrame(this.raf))},l=t=>{if(!this.isDragging||!(t instanceof MouseEvent)&&!(t instanceof TouchEvent))return;t.preventDefault();let c=s(t),l=r-c;this.velocity=a-c,a=c,o||(o=!0,requestAnimationFrame(()=>{o=!1,n?e.scrollTop=i+l:e.scrollLeft=i+l}))},u=()=>{this.isDragging&&(this.isDragging=!1,t.classList.remove(this.props.className.dragging),this.startInertiaScroll())};this.cleanup.events.on(`drag:mousedown`,t,`mousedown`,c),this.cleanup.events.on(`drag:touchstart`,t,`touchstart`,c,{passive:!0}),this.cleanup.events.on(`drag:mousemove`,window,`mousemove`,l,{passive:!1}),this.cleanup.events.on(`drag:touchmove`,window,`touchmove`,l,{passive:!1}),this.cleanup.events.on(`drag:mouseup`,window,`mouseup`,u),this.cleanup.events.on(`drag:touchend`,window,`touchend`,u)}startInertiaScroll(){let e=this.dragContainer;if(!e)return;let t=this.velocity,n=this.state.isVertical,r=performance.now(),i=a=>{let o=a-r;r=a,t*=.92,!(Math.abs(t)<.3)&&(n?e.scrollTop+=t*o*.05:e.scrollLeft+=t*o*.05,this.raf=requestAnimationFrame(i))};this.raf=requestAnimationFrame(i)}removeDragEvents(){this.cleanup.events.off(`drag:mousedown`),this.cleanup.events.off(`drag:touchstart`),this.cleanup.events.off(`drag:mousemove`),this.cleanup.events.off(`drag:touchmove`),this.cleanup.events.off(`drag:mouseup`),this.cleanup.events.off(`drag:touchend`)}refreshDrag(){this.initDrag()}onDestroy(){this.unbindEvents(),this.removeDragEvents(),this.bindingsDispose?.(),this.bindingsDispose=null,this.stateDispose?.(),this.stateDispose=null,cancelAnimationFrame(this.raf),cancelAnimationFrame(this.resizeRaf),this.cleanup.events.off(`resize`),this.dom.root?.remove(),this.runtime.built=!1}validateData(e){S(`data`,e,Q.data,`Tabs.state`),e.forEach((e,t)=>{S(String(t),e,hi,`Tabs.state.data`)})}normalizeStatePatch(e){let t={...e};return Object.hasOwn(t,`data`)&&Array.isArray(t.data)&&(t.data=gi(t.data)),Object.hasOwn(t,`disabled`)&&Array.isArray(t.disabled)&&(t.disabled=_i(t.disabled)),t}validateStatePatch(e){S(`state`,e,{type:`plainObject`},`Tabs.setState`);for(let t of Object.keys(e)){if(!Object.hasOwn(Q,t))throw Error(`Tabs.setState: "${t}" is not a supported state key.`);let n=t;S(t,e[t],Q[n],`Tabs.setState`)}Array.isArray(e.data)&&this.validateData(e.data)}};function Si(e={}){return new xi(e)}const Ci={root:`j-offcanvas`,overlay:`j-offcanvas-overlay`,content:`offcanvas-content`},wi={content:{default:``,type:`renderable`},overlay:{default:!0,type:`boolean`},filter:{default:!0,type:`boolean`},bodyOverflow:{default:!0,type:`boolean`},cache:{default:!1,type:`boolean`},ttl:{default:0,type:`number`},direction:{default:`left`,type:`string`,enum:[`top`,`right`,`bottom`,`left`]},animate:{default:`slide`,type:`string`},bgClose:{default:!0,type:`boolean`},escClose:{default:!0,type:`boolean`},id:{default:null,types:[`string`,`null`],normalize:e=>typeof e==`string`?e.trim()||h():e??h()},className:{default:Ci,type:`object`,normalize:e=>({...Ci,...e&&typeof e==`object`?e:{}})},onShow:{default:null,types:[`function`,`null`]},onShown:{default:null,types:[`function`,`null`]},onHide:{default:null,types:[`function`,`null`]},onHidden:{default:null,types:[`function`,`null`]}},Ti={content:wi.content};function Ei(e){return e>0?e:0}function Di(e){let t=C(e,wi,`Offcanvas`);return{content:t.content,overlay:t.overlay,filter:t.filter,bodyOverflow:t.bodyOverflow,cache:t.cache,ttl:t.ttl,direction:t.direction,animate:t.animate,bgClose:t.bgClose,escClose:t.escClose,id:t.id,className:t.className,onShow:t.onShow,onShown:t.onShown,onHide:t.onHide,onHidden:t.onHidden}}var Oi=class extends U{constructor(e={}){let t=Di(e);super(t),this.dom.overlay=null,this.dom.content=null,this.cleanup.state=null,this.runtime.built=!1,this.runtime.cache={content:null,hasContent:!1,updatedAt:0},this.runtime.contentLoadId=0,this.state=n({content:t.content,visible:!1,loading:!1})}build(){if(this.runtime.destroyed)throw Error(`Offcanvas.build: instance has been destroyed.`);if(this.runtime.built)return this;try{this.dom.root=this.buildRoot(),this.runtime.built=!0,this.bindState()}catch(e){throw this.destroy(),e}return this.emit(`init`,this.props),this}assertBuilt(e){if(this.runtime.destroyed)throw Error(`Offcanvas.${e}: instance has been destroyed.`);if(!this.runtime.built)throw Error(`Offcanvas.${e}: call build() first.`)}buildRoot(){return this.props.overlay&&(this.dom.overlay=this.buildOverlay()),this.buildPanel()}buildOverlay(){let e=this.props.filter?{backdropFilter:`blur(2px)`}:{};return c(`div`,{className:this.props.className.overlay,hidden:!0,"data-offcanvas-overlay":this.props.id,style:{...e}})}buildPanel(){let e=c(`div`,{className:this.props.className.content,"data-offcanvas-content":this.props.id});return this.dom.content=e,typeof this.state.content!=`function`&&this.renderContent(this.state.content),c(`div`,{className:this.props.className.root,id:this.props.id,role:`dialog`,"aria-modal":this.props.overlay?`true`:`false`,"aria-expanded":`false`,"data-offcanvas":`root`,"data-direction":this.props.direction,"data-animate":this.props.animate,children:e})}bindState(){this.cleanup.state||(this.cleanup.state=L(()=>this.state.content,e=>this.syncContent(e)))}async syncContent(e){if(this.runtime.built){if(S(`content`,e,Ti.content,`Offcanvas.state`),this.runtime.cache.hasContent=!1,this.runtime.cache.content=null,this.runtime.cache.updatedAt=0,typeof e==`function`){this.state.visible?await this.loadContent():this.clearContent();return}this.runtime.contentLoadId+=1,o(()=>{this.state.loading=!1}),this.renderContent(e)}}isCacheValid(){if(!this.props.cache||!this.runtime.cache.hasContent)return!1;let e=Ei(this.props.ttl);return!e||Date.now()-this.runtime.cache.updatedAt<=e}clearContent(){this.dom.content&&(this.dom.content.textContent=``)}renderContent(e){this.dom.content&&(this.clearContent(),this.dom.content.append(...E(e,this)))}async loadContent(){let{cache:e}=this.props,t=this.state.content;if(typeof t!=`function`){this.runtime.contentLoadId+=1,o(()=>{this.state.loading=!1});return}if(this.isCacheValid()){this.runtime.contentLoadId+=1,this.renderContent(this.runtime.cache.content),o(()=>{this.state.loading=!1});return}let n=++this.runtime.contentLoadId;o(()=>{this.state.loading=!0}),this.dom.content&&(this.clearContent(),this.dom.content.appendChild(B()));try{let r=await Promise.resolve(t(this));if(this.runtime.destroyed||n!==this.runtime.contentLoadId)return;e&&(this.runtime.cache.content=r,this.runtime.cache.hasContent=!0,this.runtime.cache.updatedAt=Date.now()),this.renderContent(r)}finally{!this.runtime.destroyed&&n===this.runtime.contentLoadId&&o(()=>{this.state.loading=!1})}}bindEvents(){this.unbindEvents();let{bgClose:e,escClose:t}=this.props;this.dom.overlay&&e&&this.cleanup.events.on(`overlay`,this.dom.overlay,`click`,()=>{this.hide()}),t&&this.cleanup.events.on(`esc`,document,`keydown`,e=>{e instanceof KeyboardEvent&&e.key===`Escape`&&this.state.visible&&this.hide()}),this.dom.root&&this.cleanup.events.on(`close`,this.dom.root,`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`[data-action]`)?.dataset.action;(t===`close`||t===`cancel`)&&this.hide()})}unbindEvents(){this.cleanup.events.clear()}showPanel(){let{id:e}=this.props;N.cancel(`oc-hide-${e}`),this.dom.overlay&&!this.dom.overlay.isConnected&&(this.dom.overlay.hidden=!1,document.body.appendChild(this.dom.overlay)),this.dom.root&&!this.dom.root.isConnected&&document.body.appendChild(this.dom.root),this.props.bodyOverflow&&(document.body.style.overflow=`hidden`),N.start(`oc-show-${e}`,10,()=>{this.dom.root?.setAttribute(`aria-expanded`,`true`)})}hidePanel(){let{id:e}=this.props;N.cancel(`oc-show-${e}`),N.cancel(`oc-shown-${e}`),this.dom.root?.setAttribute(`aria-expanded`,`false`),N.start(`oc-hide-${e}`,100,()=>{this.dom.overlay?.remove(),this.dom.root?.remove(),this.props.bodyOverflow&&(document.body.style.overflow=``)})}async show(){if(this.assertBuilt(`show`),this.state.visible)return;let{onShow:e,onShown:t,id:n}=this.props;e&&await Promise.resolve(e(this)),this.showPanel(),this.bindEvents(),o(()=>{this.state.visible=!0}),await this.loadContent(),N.start(`oc-shown-${n}`,300,()=>{this.runtime.destroyed||t?.(this)})}async hide(){if(this.assertBuilt(`hide`),!this.state.visible)return;let{onHide:e,onHidden:t}=this.props;e&&await Promise.resolve(e(this)),this.runtime.contentLoadId+=1,o(()=>{this.state.loading=!1}),this.unbindEvents(),this.hidePanel(),o(()=>{this.state.visible=!1}),t?.(this)}onDestroy(){let{id:e}=this.props;N.cancel(`oc-show-${e}`),N.cancel(`oc-hide-${e}`),N.cancel(`oc-shown-${e}`),this.unbindEvents(),this.cleanup.state?.(),this.cleanup.state=null,this.dom.root?.setAttribute(`aria-expanded`,`false`),this.dom.overlay?.remove(),this.dom.root?.remove(),this.props.bodyOverflow&&(document.body.style.overflow=``),this.runtime.built=!1}validateStatePatch(e){S(`state`,e,{type:`plainObject`},`Offcanvas.setState`);for(let t of Object.keys(e)){if(!Object.hasOwn(Ti,t))throw Error(`Offcanvas.setState: "${t}" is not a supported state key.`);let n=t;S(t,e[t],Ti[n],`Offcanvas.setState`)}}};function ki(e={}){return new Oi(e)}const Ai={size:10,current:1},ji={sibling:1,boundary:1},Mi={root:`j-pagination`,list:`pagination`,item:`item`,more:`more`,button:`j-button is-icon is-ghost`,current:`j-button is-icon is-active`,loading:`animate-spin`},Ni={default:0,type:`number`,finite:!0,min:0},Pi={type:`plainObject`,required:!0,shape:{size:{type:`number`,integer:!0,greaterThan:0},current:{type:`number`,integer:!0,greaterThan:0}}},Fi={type:`plainObject`,required:!0,shape:{sibling:{type:`number`,integer:!0,min:0},boundary:{type:`number`,integer:!0,min:0}}},Ii={total:Ni,page:{default:()=>({...Ai}),factory:!0,normalize:e=>({...Ai,...e&&typeof e==`object`?e:{}}),...Pi},count:{default:()=>({...ji}),factory:!0,normalize:e=>({...ji,...e&&typeof e==`object`?e:{}}),...Fi},lock:{default:!0,type:`boolean`},onChange:{default:null,types:[`function`,`null`]},className:{default:Mi,type:`object`,normalize:e=>({...Mi,...e&&typeof e==`object`?e:{}})}},Li={total:Ni,page:Pi,count:Fi};function Ri(e,t,n){return Math.min(Math.max(e,t),n)}function zi(e,t){return Math.max(1,Math.ceil(e/t))}function Bi(e){return{size:e.size,current:e.current}}function Vi(e){return{sibling:e.sibling,boundary:e.boundary}}function Hi(e={}){let t=C(e,Ii,`Pagination.props`),n=zi(t.total,t.page.size);return{...t,page:{size:t.page.size,current:Ri(t.page.current,1,n)},count:Vi(t.count),className:{...t.className}}}function Ui(e){return{type:`more`,key:e}}function Wi(e){return{type:`page`,key:`page-${e}`,page:e}}function Gi(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function Ki(e,t,n){if(t<=0)return[];let r=Math.max(0,n.boundary),i=Math.max(0,n.sibling);if(t<=r*2+i*2+3)return Gi(1,t).map(Wi);let a=new Set;for(let e=1;e<=Math.min(r,t);e++)a.add(e);for(let n=Math.max(1,e-i);n<=Math.min(t,e+i);n++)a.add(n);for(let e=Math.max(1,t-r+1);e<=t;e++)a.add(e);let o=Array.from(a).sort((e,t)=>e-t),s=[];for(let e of o){let t=s[s.length-1];t?.type===`page`&&e-t.page>1&&(e-t.page===2?s.push(Wi(t.page+1)):s.push(Ui(`more-${t.page}-${e}`))),s.push(Wi(e))}return s}var qi=class extends U{constructor(e={}){let t=Hi(e);super(t),this.dom.list=null,this.cleanup.state=null,this.runtime.built=!1,this.runtime.itemsKey=``,this.runtime.changeId=0,this.state=n({total:t.total,page:Bi(t.page),count:Vi(t.count),pageCount:zi(t.total,t.page.size),locked:!1})}build(){if(this.runtime.destroyed)throw Error(`Pagination.build: instance has been destroyed.`);return this.runtime.built?this:(this.dom.root=c(`div`,{className:this.props.className.root,role:`navigation`,"aria-label":`Pagination`,"data-pagination":`root`,children:c(`ul`,{className:this.props.className.list,"data-pagination-list":``,"aria-live":`polite`})}),this.dom.list=this.dom.root.querySelector(`[data-pagination-list]`),this.runtime.built=!0,this.bindState(),this.bindEvents(),this.emit(`init`,this.props),this)}go(e){if(this.assertActive(`go`),S(`page`,e,{type:`number`,integer:!0},`Pagination.go`),this.isLocked())return this;let t=Ri(e,1,this.state.pageCount);if(t===this.state.page.current)return this;let n=this.props.lock&&typeof this.props.onChange==`function`,r=n?++this.runtime.changeId:this.runtime.changeId;if(o(()=>{this.state.page.current=t,n&&(this.state.locked=!0)}),typeof this.props.onChange==`function`){let e;try{e=this.props.onChange(t,this)}catch(e){throw this.unlock(r),e}if(n&&e&&typeof e.then==`function`){let t=()=>this.unlock(r);Promise.resolve(e).then(t,t)}else this.unlock(r)}return this}bindState(){this.cleanup.state||(this.cleanup.state=L(()=>({total:this.state.total,size:this.state.page.size,current:this.state.page.current,sibling:this.state.count.sibling,boundary:this.state.count.boundary,locked:this.state.locked}),e=>this.syncState(e),{deferInitial:!1,flushInitial:!0,flush:`sync`}))}syncState(e){S(`total`,e.total,Ni,`Pagination.state`),S(`page`,{size:e.size,current:e.current},Pi,`Pagination.state`),S(`count`,{sibling:e.sibling,boundary:e.boundary},Fi,`Pagination.state`);let t=zi(e.total,e.size),n=Ri(e.current,1,t);(this.state.pageCount!==t||this.state.page.current!==n)&&o(()=>{this.state.pageCount=t,this.state.page.current=n}),this.renderItems()}renderItems(){if(!this.dom.list)return;let e=this.getPageItems(),t=[this.state.page.current,this.state.pageCount,this.isLocked()?`locked`:`unlocked`,...e.map(e=>e.key)].join(`|`);t!==this.runtime.itemsKey&&(this.runtime.itemsKey=t,this.dom.list.textContent=``,this.dom.list.append(this.buildControlItem(`prev`),...e.map(e=>this.buildPageItem(e)),this.buildControlItem(`next`)))}getPageItems(){return Ki(this.state.page.current,this.state.pageCount,{sibling:this.state.count.sibling,boundary:this.state.count.boundary})}isLocked(){return this.props.lock&&this.state.locked}isPrevDisabled(){return this.isLocked()||this.state.page.current<=1}isNextDisabled(){return this.isLocked()||this.state.page.current>=this.state.pageCount}buildControlItem(e){let t=e===`prev`?this.isPrevDisabled():this.isNextDisabled();return c(`li`,{className:this.props.className.item,"data-pagination-control":e,children:c(`button`,{className:this.props.className.button,type:`button`,"data-page-action":e,"aria-label":e===`prev`?`Go to previous page`:`Go to next page`,"aria-disabled":t?`true`:`false`,tabindex:t?`-1`:null,disabled:t,children:z(e===`prev`?`arrow-left`:`arrow-right`)})})}buildPageItem(e){let t=this.isLocked();return e.type===`more`?c(`li`,{className:[this.props.className.item,this.props.className.more].filter(Boolean).join(` `),"data-pagination-more":e.key,children:c(`span`,{className:this.props.className.button,children:z(`more`)})}):e.page===this.state.page.current?c(`li`,{className:this.props.className.item,"data-pagination-item":String(e.page),children:c(`span`,{className:this.props.className.current,"data-current-page":String(e.page),"aria-current":`page`,"aria-label":`Page ${e.page}, current page`,children:t?c(`i`,{className:this.props.className.loading,children:z(`loader`)}):String(e.page)})}):c(`li`,{className:this.props.className.item,"data-pagination-item":String(e.page),children:c(`button`,{className:this.props.className.button,type:`button`,"data-page":String(e.page),"aria-label":`Go to page ${e.page}`,"aria-disabled":t?`true`:`false`,tabindex:t?`-1`:null,disabled:t,children:String(e.page)})})}bindEvents(){this.unbindEvents();let e=this.dom.root;e&&this.cleanup.events.on(`click`,e,`click`,t=>{let n=t.target;if(!(n instanceof Element))return;let r=n.closest(`[data-page], [data-page-action]`);if(!r||!e.contains(r))return;t.preventDefault();let i=r.dataset.pageAction;if(i===`prev`&&!this.isPrevDisabled()){this.go(this.state.page.current-1);return}if(i===`next`&&!this.isNextDisabled()){this.go(this.state.page.current+1);return}r.dataset.page&&this.go(Number(r.dataset.page))})}unbindEvents(){this.cleanup.events.clear()}unlock(e){this.props.lock&&!this.runtime.destroyed&&e===this.runtime.changeId&&o(()=>{this.state.locked=!1})}assertActive(e){if(this.runtime.destroyed)throw Error(`Pagination.${e}: instance has been destroyed.`);if(!this.runtime.built)throw Error(`Pagination.${e}: call build() first.`)}normalizeStatePatch(e){let t={...e};return Object.hasOwn(t,`page`)&&v(t.page)&&(t.page={...this.state.page,...t.page}),Object.hasOwn(t,`count`)&&v(t.count)&&(t.count={...this.state.count,...t.count}),t}validateStatePatch(e){S(`state`,e,{type:`plainObject`},`Pagination.setState`);for(let t of Object.keys(e)){if(!Object.hasOwn(Li,t))throw Error(`Pagination.setState: "${t}" is not a supported state key.`);let n=t;S(t,e[t],Li[n],`Pagination.setState`)}}onDestroy(){this.unbindEvents(),this.cleanup.state?.(),this.cleanup.state=null,this.dom.root?.remove(),this.runtime.built=!1,this.runtime.itemsKey=``,this.runtime.changeId=0,this.dom.list=null}};function Ji(e={}){return new qi(e)}const Yi={root:`j-menu`,list:`menu`,item:`menu-item`,hasChildren:`menu-item-has-children`,link:`menu-link`,subMenu:`sub-menu`,active:`is-active`,text:`menu-text`,backItem:`menu-item back`,backIcon:`el-icon el-prefix`},Xi={type:`object`,validate:ia,message:`expects { title, id?, url?, target?, classes?, children? }.`},Zi={type:`array`,items:Xi},Qi={type:{default:void 0,types:[`string`,`undefined`]},id:{default:null,types:[`string`,`null`],normalize:e=>typeof e==`string`?e.trim()||h():e??h()},data:{default:[],type:`array`,normalize:$,items:Xi},backText:{default:p(`b`,H),type:`string`},className:{default:Yi,type:`object`,normalize:e=>({...Yi,...e&&typeof e==`object`?e:{}})}},$i={data:Zi};function ea(e={}){let t=C(e,Qi,`Menu.props`);return{...t,data:$(t.data),className:{...t.className}}}function ta(e){return e==null?[]:typeof e==`string`?e.trim().split(/\s+/).filter(Boolean):e.slice()}function na(e){return`menu-item-${e??h()}`}function ra(e){return typeof e==`string`?e.trim():``}function ia(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return(typeof t.title==`string`||typeof t.title==`number`)&&(t.id==null||typeof t.id==`string`||typeof t.id==`number`)&&(t.url==null||typeof t.url==`string`)&&(t.target==null||typeof t.target==`string`)&&(t.classes==null||typeof t.classes==`string`||Array.isArray(t.classes)&&t.classes.every(e=>typeof e==`string`))&&(t.children==null||Array.isArray(t.children)&&t.children.every(ia))}function $(e){return Array.isArray(e)?e.map(e=>{S(`item`,e,Xi,`Menu.data`);let t={...e};return Array.isArray(t.classes)&&(t.classes=t.classes.slice()),Array.isArray(t.children)&&(t.children=$(t.children)),t}):[]}function aa(e){return j(`[data-menu-link]`,e).find(t=>t.parentElement===e)||null}function oa(e){return j(`[data-menu-list="sub"]`,e).find(t=>t.parentElement===e)||null}function sa(e){return j(`[data-menu-back]`,e).find(t=>t.parentElement===e)||null}var ca=class extends U{constructor(e={}){let t=ea(e);super(t),this.dom.list=null,this.cleanup.state=null,this.runtime.built=!1,this.state=n({data:$(t.data)})}build(){if(this.runtime.destroyed)throw Error(`Menu.build: instance has been destroyed.`);return this.runtime.built?this:(this.validateData(this.state.data),this.dom.root=c(`nav`,{className:this.props.className.root,"data-menu":`root`,...this.props.type!==void 0&&{"data-menu-type":this.props.type},children:c(`ul`,{className:this.props.className.list,id:this.props.id,"data-menu-list":`root`})}),this.dom.list=this.dom.root.querySelector(`[data-menu-list="root"]`),this.runtime.built=!0,this.bindState(),this.bindEvents(),this.emit(`init`,this.props),this)}bindState(){this.cleanup.state||(this.cleanup.state=L(()=>({data:It(this.state.data)}),e=>this.renderSnapshot(e),{deferInitial:!1,flushInitial:!0}))}renderSnapshot(e){if(!this.runtime.built||!this.dom.root||!this.dom.list)return;this.validateData(e.data);let t=$(I(e.data));this.dom.list.textContent=``,this.dom.list.append(...t.map(e=>this.buildItem(e)))}buildItem(e){let{className:t}=this.props,n=e.children||[],r=n.length>0,i=[t.item];r&&i.push(t.hasChildren),i.push(...ta(e.classes));let a=ra(e.url),o=[!r&&!a?c(`span`,{className:t.link,"data-menu-link":``,children:e.title}):c(`a`,{className:t.link,href:a,...e.target&&{target:e.target},"data-menu-link":``,children:e.title})];return r&&o.push(c(`ul`,{className:t.subMenu,"data-menu-list":`sub`,children:n.map(e=>this.buildItem(e))})),c(`li`,{className:V(...i),id:na(e.id),"data-menu-item":e.id==null?``:String(e.id),...r&&{"data-menu-has-children":``},children:o})}bindEvents(){this.unbindEvents();let e=this.dom.root;e&&(this.props.type===`mobile`&&this.cleanup.events.on(`mobile`,e,`click`,t=>{let n=t.target;if(!(n instanceof Element))return;let r=n.closest(`[data-menu-back]`);if(r&&e.contains(r)){t.preventDefault(),this.handleBack(r);return}let i=n.closest(`[data-menu-has-children]`);if(!i||!e.contains(i)||oa(i)?.contains(n))return;let a=aa(i);(n===i||a&&(n===a||a.contains(n)))&&(t.preventDefault(),this.handleMenuClick(i))}),this.props.type===`bottom`&&this.cleanup.events.on(`bottom`,document,`click`,t=>{let n=t.target;if(!(n instanceof Element)||!e.isConnected)return;let r=n.closest(`[data-menu-list="sub"] [data-menu-link]`);if(r&&e.contains(r))return;let i=n.closest(`[data-menu-list="root"] > [data-menu-has-children]`);i&&e.contains(i)?(t.preventDefault(),this.toggleActive(i)):this.clearActive()}))}unbindEvents(){this.cleanup.events.clear()}handleMenuClick(e){e.classList.add(this.props.className.active);let t=oa(e);if(!t||sa(t))return;let{className:n}=this.props,r=c(`li`,{className:n.backItem,"data-menu-back":``,children:c(`a`,{className:n.link,href:``,"data-menu-link":``,children:[c(`span`,{className:n.backIcon,children:z(`arrow-left`)}),c(`span`,{className:n.text,children:this.props.backText})]})});t.insertBefore(r,t.firstChild)}handleBack(e){let t=e.closest(`[data-menu-back]`);if(!t)return;let n=t.parentElement?.parentElement;n?.hasAttribute(`data-menu-has-children`)&&n.classList.remove(this.props.className.active),t.remove()}toggleActive(e){let t=e.classList.contains(this.props.className.active);this.clearActive(),t||e.classList.add(this.props.className.active)}clearActive(){this.dom.root&&j(`[data-menu-item]`,this.dom.root).forEach(e=>{e.classList.remove(this.props.className.active)})}validateData(e){S(`data`,e,Zi,`Menu`)}assertStatePatchKey(e){if(!Object.hasOwn($i,e))throw Error(`Menu.setState: "${e}" is not a supported state key.`)}normalizeStatePatch(e){let t={...e};return Object.hasOwn(t,`data`)&&(t.data=$(t.data)),t}validateStatePatch(e){S(`state`,e,{type:`plainObject`},`Menu.setState`);for(let t of Object.keys(e)){this.assertStatePatchKey(t);let n=t;S(t,e[t],$i[n],`Menu.setState`)}}onDestroy(){this.unbindEvents(),this.cleanup.state?.(),this.cleanup.state=null,this.dom.root?.remove(),this.dom.list=null,this.runtime.built=!1}};function la(e={}){return new ca(e)}export{U as Component,pn as Toast,Gt as addIcons,j as all,ne as copy,pr as createAccordion,en as createDrop,M as createEventManager,Hr as createFlow,Dr as createForm,B as createLoading,la as createMenu,ni as createModal,ki as createOffcanvas,Ji as createPagination,An as createParabola,Jt as createPopup,Ft as createScheduledTask,L as createStateSync,tr as createSticky,pi as createSwiper,Si as createTabs,Cn as createTheme,Jn as createToc,sn as createTooltip,Vn as createValidator,Et as debounce,Wt as getRegistedIconPath,F as getStoreVersion,je as getType,z as icon,Ht as iconHtml,Ut as iconMarkup,De as isDomElementValue,b as isDomNodeValue,T as isElement,Oe as isHtmlElementValue,te as isMobile,y as isNilValue,w as isNode,v as isPlainObject,$e as isRenderableContent,ke as isRenderablePrimitive,Ae as isRenderableValue,tt as lazyRender,ot as listen,E as normalizeContentNodes,et as normalizeRenderableContentNodes,ct as postJson,A as q,h as randomId,k as requireContainer,Qe as resolveContainer,O as resolveElement,Ze as resolveNode,D as resolveNodeList,C as resolveProps,st as restUrl,I as stateSnapshot,Ot as throttle,N as timer,It as trackStoreVersion,re as uuid,S as validateParam};
|
|
1
|
+
import{t as e}from"vanilla-signal-i18n";import{For as t,bindAttr as n,bindClass as r,createDeepStore as i,createEffect as a,createMemo as o,createRoot as s,createSignal as c,createWatch as l,flushSync as u,insert as d,jsx as f,onCleanup as p,untrack as m,unwrap as h}from"vanilla-signal";import{createStorage as g}from"vanilla-create-storage";var _={en:{b:`Back`,t:`Customize`,sm:`Small`,md:`Medium`,lg:`Large`,wn:`Your browser is outdated and may pose security risks. Please upgrade your browser to access this site.`},zh:{b:`返回`,t:`自定义主题`,Primary:`主色`,Radius:`圆角`,Shadow:`阴影`,Font:`字号`,Mode:`模式`,Gray:`灰色`,Olive:`橄榄绿`,Tomato:`番茄红`,Ruby:`红宝石`,Pink:`粉红`,Violet:`紫罗兰`,Indigo:`靛蓝`,Blue:`蓝色`,Teal:`青色`,Grass:`草绿`,Mint:`薄荷绿`,Lime:`酸橙绿`,Yellow:`黄色`,Orange:`橙色`,Gold:`金色`,None:`无`,sm:`小`,md:`中`,lg:`大`,XL:`更大`,Round:`圆角`,Light:`浅色`,Dark:`深色`,Auto:`自动`,Close:`关闭`,Confirm:`确认`,Upgrade:`升级`,wn:`您的浏览器版本过低,存在安全风险。请升级浏览器后再访问本站。`}},v={info:`<path d="M12 22C6.47715 22 2 17.5228 2 12 2 6.47715 6.47715 2 12 2 17.5228 2 22 6.47715 22 12 22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM13 10.5V15H14V17H10V15H11V12.5H10V10.5H13ZM13.5 8C13.5 8.82843 12.8284 9.5 12 9.5 11.1716 9.5 10.5 8.82843 10.5 8 10.5 7.17157 11.1716 6.5 12 6.5 12.8284 6.5 13.5 7.17157 13.5 8Z"></path>`,success:`<path d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM17.4571 9.45711L16.0429 8.04289L11 13.0858L8.20711 10.2929L6.79289 11.7071L11 15.9142L17.4571 9.45711Z"></path>`,warning:`<path d="M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11 15H13V17H11V15ZM11 7H13V13H11V7Z"></path>`,error:`<path d="M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM12 10.5858L14.8284 7.75736L16.2426 9.17157L13.4142 12L16.2426 14.8284L14.8284 16.2426L12 13.4142L9.17157 16.2426L7.75736 14.8284L10.5858 12L7.75736 9.17157L9.17157 7.75736L12 10.5858Z"></path>`,"arrow-left":`<path d="M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z"></path>`,"arrow-right":`<path d="M13.1717 12.0007L8.22192 7.05093L9.63614 5.63672L16.0001 12.0007L9.63614 18.3646L8.22192 16.9504L13.1717 12.0007Z"></path>`,"arrow-up":`<path d="M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"></path>`,"arrow-down":`<path d="M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"></path>`,more:`<path d="M5 10C3.9 10 3 10.9 3 12C3 13.1 3.9 14 5 14C6.1 14 7 13.1 7 12C7 10.9 6.1 10 5 10ZM19 10C17.9 10 17 10.9 17 12C17 13.1 17.9 14 19 14C20.1 14 21 13.1 21 12C21 10.9 20.1 10 19 10ZM12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z"></path>`,close:`<path d="M11.9997 10.5865L16.9495 5.63672L18.3637 7.05093L13.4139 12.0007L18.3637 16.9504L16.9495 18.3646L11.9997 13.4149L7.04996 18.3646L5.63574 16.9504L10.5855 12.0007L5.63574 7.05093L7.04996 5.63672L11.9997 10.5865Z"></path>`,loader:`<path d="M12 3C16.9706 3 21 7.02944 21 12H19C19 8.13401 15.866 5 12 5V3Z"></path>`,menu:`<path d="M3 4H21V6H3V4ZM3 11H21V13H3V11ZM3 18H21V20H3V18Z"></path>`,palette:`<path fill="none" d="M0 0h24v24H0z"></path><path d="M12 2C17.5222 2 22 5.97778 22 10.8889C22 13.9556 19.5111 16.4444 16.4444 16.4444H14.4778C13.5556 16.4444 12.8111 17.1889 12.8111 18.1111C12.8111 18.5333 12.9778 18.9222 13.2333 19.2111C13.5 19.5111 13.6667 19.9 13.6667 20.3333C13.6667 21.2556 12.9 22 12 22C6.47778 22 2 17.5222 2 12C2 6.47778 6.47778 2 12 2ZM10.8111 18.1111C10.8111 16.0843 12.451 14.4444 14.4778 14.4444H16.4444C18.4065 14.4444 20 12.851 20 10.8889C20 7.1392 16.4677 4 12 4C7.58235 4 4 7.58235 4 12C4 16.19 7.2226 19.6285 11.324 19.9718C10.9948 19.4168 10.8111 18.7761 10.8111 18.1111ZM7.5 12C6.67157 12 6 11.3284 6 10.5C6 9.67157 6.67157 9 7.5 9C8.32843 9 9 9.67157 9 10.5C9 11.3284 8.32843 12 7.5 12ZM16.5 12C15.6716 12 15 11.3284 15 10.5C15 9.67157 15.6716 9 16.5 9C17.3284 9 18 9.67157 18 10.5C18 11.3284 17.3284 12 16.5 12ZM12 9C11.1716 9 10.5 8.32843 10.5 7.5C10.5 6.67157 11.1716 6 12 6C12.8284 6 13.5 6.67157 13.5 7.5C13.5 8.32843 12.8284 9 12 9Z"></path>`,message:`<path d="M2 8.99374C2 5.68349 4.67654 3 8.00066 3H15.9993C19.3134 3 22 5.69478 22 8.99374V21H8.00066C4.68659 21 2 18.3052 2 15.0063V8.99374ZM20 19V8.99374C20 6.79539 18.2049 5 15.9993 5H8.00066C5.78458 5 4 6.78458 4 8.99374V15.0063C4 17.2046 5.79512 19 8.00066 19H20ZM14 11H16V13H14V11ZM8 11H10V13H8V11Z"></path>`,chat:`<path d="M10 3H14C18.4183 3 22 6.58172 22 11C22 15.4183 18.4183 19 14 19V22.5C9 20.5 2 17.5 2 11C2 6.58172 5.58172 3 10 3ZM12 17H14C17.3137 17 20 14.3137 20 11C20 7.68629 17.3137 5 14 5H10C6.68629 5 4 7.68629 4 11C4 14.61 6.46208 16.9656 12 19.4798V17Z"></path>`,discuss:`<path d="M14 22.5L11.2 19H6C5.44772 19 5 18.5523 5 18V7.10256C5 6.55028 5.44772 6.10256 6 6.10256H22C22.5523 6.10256 23 6.55028 23 7.10256V18C23 18.5523 22.5523 19 22 19H16.8L14 22.5ZM15.8387 17H21V8.10256H7V17H11.2H12.1613L14 19.2984L15.8387 17ZM2 2H19V4H3V15H1V3C1 2.44772 1.44772 2 2 2Z"></path>`};const y=`http://www.w3.org/2000/svg`,b=v;function x(e){if(!(e in b))throw Error(`Icon "${e}" not found.`)}function S(e){return x(e),`<svg xmlns="${y}" viewBox="0 0 24 24" fill="currentColor">${b[e]}</svg>`}function C(e){return e!==null&&e.namespaceURI===y}function w(e,t={}){let n=document.createElement(`template`);n.innerHTML=S(e);let r=n.content.firstElementChild;if(!C(r))throw Error(`Icon "${e}" cannot be rendered.`);for(let[e,n]of Object.entries(t||{})){if(n==null||n===!1)continue;let t=e===`className`?`class`:e;r.setAttribute(t,n===!0?``:String(n))}return r}function T(e){return S(e)}const E=T;function D(){return{...b}}function O(e){if(typeof e!=`object`||!e)throw Error(`Icons must be a valid object.`);for(let[t,n]of Object.entries(e)){if(typeof n!=`string`||!n.trim().startsWith(`<`))throw Error(`Invalid SVG path for icon "${t}".`);b[t]=n}}function k(...e){return e.filter(Boolean).join(` `)}var A=typeof global==`object`&&global&&global.Object===Object&&global,j=typeof self==`object`&&self&&self.Object===Object&&self,M=A||j||Function(`return this`)(),N=M.Symbol,P=Object.prototype,F=P.hasOwnProperty,I=P.toString,L=N?N.toStringTag:void 0;function ee(e){var t=F.call(e,L),n=e[L];try{e[L]=void 0;var r=!0}catch{}var i=I.call(e);return r&&(t?e[L]=n:delete e[L]),i}var R=Object.prototype.toString;function te(e){return R.call(e)}var ne=`[object Null]`,re=`[object Undefined]`,ie=N?N.toStringTag:void 0;function z(e){return e==null?e===void 0?re:ne:ie&&ie in Object(e)?ee(e):te(e)}function ae(e,t){return function(n){return e(t(n))}}var oe=ae(Object.getPrototypeOf,Object);function se(e){return typeof e==`object`&&!!e}var ce=`[object Object]`,le=Function.prototype,ue=Object.prototype,de=le.toString,fe=ue.hasOwnProperty,pe=de.call(Object);function me(e){if(!se(e)||z(e)!=ce)return!1;var t=oe(e);if(t===null)return!0;var n=fe.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&de.call(n)==pe}function B(e){return me(e)}function V(e){return e==null}function he(e){return typeof Node<`u`&&e instanceof Node}function ge(e){return typeof Element<`u`&&e instanceof Element}function _e(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function ve(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function ye(e){return V(e)||ve(e)||typeof e==`function`||Array.isArray(e)||he(e)}const be=e=>e===null?`null`:Array.isArray(e)?`array`:_e(e)?`HTMLElement`:he(e)?`Node`:typeof e;function xe(e){return Array.isArray(e)?e.slice():B(e)?{...e}:e}function Se(e={}){return typeof e==`string`||Array.isArray(e)?{type:e}:!e||typeof e!=`object`?{}:e}function H(e,t){throw Error(`Validator: ${e} ${t}`)}function Ce(e){return typeof e==`string`?e:String(e)}function we(e){return typeof e==`string`?`string`:`array`}function Te(e,t,n){if(V(t)||typeof t!=`string`&&!Array.isArray(t))return;let r=we(t);n.nonEmpty&&t.length===0&&H(e,`expects a non-empty ${r}.`),typeof n.minLength==`number`&&t.length<n.minLength&&H(e,`expects ${r} length to be at least ${n.minLength}.`),typeof n.maxLength==`number`&&t.length>n.maxLength&&H(e,`expects ${r} length to be at most ${n.maxLength}.`)}function Ee(e,t,n){V(t)||typeof t!=`number`||(n.finite&&!Number.isFinite(t)&&H(e,`expects a finite number.`),n.integer&&!Number.isInteger(t)&&H(e,`expects an integer.`),typeof n.min==`number`&&t<n.min&&H(e,`expects a number greater than or equal to ${n.min}.`),typeof n.max==`number`&&t>n.max&&H(e,`expects a number less than or equal to ${n.max}.`),typeof n.greaterThan==`number`&&t<=n.greaterThan&&H(e,`expects a number greater than ${n.greaterThan}.`),typeof n.lessThan==`number`&&t>=n.lessThan&&H(e,`expects a number less than ${n.lessThan}.`))}function De(e,t,n){!n.plain||V(t)||B(t)||H(e,`expects an object.`)}function Oe(e,t,n){!n.items||V(t)||(Array.isArray(t)||H(e,`expects array.`),t.forEach((t,r)=>{U(String(r),t,n.items,e)}))}function ke(e,t,n){if(!n.shape||V(t))return;(!t||typeof t!=`object`||Array.isArray(t))&&H(e,`expects object.`);let r=t;for(let[t,i]of Object.entries(n.shape))U(t,r[t],i,e)}function Ae(e,t){return t===`renderable`?ye(e):t===`Node`?he(e):t===`Element`?ge(e):t===`HTMLElement`?_e(e):t===`plainObject`?B(e):be(e)===t}function je(e){return B(e)?`object`:be(e)}function Me(e,t,n=[]){let r=Array.isArray(n)?n:n?[n]:[];for(let n of r){let r,i;if(typeof n==`function`)r=n,i=`does not satisfy the required condition.`;else if(n&&typeof n.test==`function`)r=n.test,i=n.message||`condition failed.`;else throw Error(`Validator: Condition must be a function or { test, message }.`);r(t)||H(e,i)}}function Ne(e,t){return e?`${e}.${t}`:t}function U(e,t,n={},r=``){let i=Se(n),a=Ne(r,e),o=Object.hasOwn(i,`types`)?i.types:i.type;if(i.required&&V(t)&&H(a,`is required.`),o!==void 0){let e=Array.isArray(o)?o:[o],n=je(t);e.some(e=>Ae(t,e))||H(a,`expects ${e.join(`, `)}, but got ${n}.`)}return Array.isArray(i.enum)&&!i.enum.includes(t)&&H(a,`expects one of ${i.enum.map(Ce).join(`, `)}.`),Te(a,t,i),Ee(a,t,i),De(a,t,i),Oe(a,t,i),ke(a,t,i),Me(a,t,i.conditions),typeof i.validate==`function`&&(i.validate(t)||H(a,i.message||`does not satisfy the required condition.`)),t}function W(e={},t={},n=`Options`){let r=e??{};if(typeof r!=`object`||Array.isArray(r))throw Error(`${n} expects object.`);let i=r,a={...i},o=Object.entries(t||{});for(let[e,t]of o){let n=Se(t);a[e]=Object.hasOwn(i,e)?i[e]:Pe(n)}for(let[e,n]of o){let r=Se(n);typeof r.normalize==`function`&&(a[e]=r.normalize(a[e],{key:e,input:i,options:a,schema:t}))}for(let[e,t]of o)U(e,a[e],t,n);return a}function Pe(e){if(!Object.hasOwn(e,`default`))return;let t=e.default;return xe(e.factory&&typeof t==`function`?t():t)}const Fe=[`node`,`element`,`array`];function Ie(e){return Fe.includes(e)}function Le(e){return he(e)}function Re(e){return ge(e)}function ze(e){return typeof e==`string`||Re(e)||Le(e)||Array.isArray(e)}function Be(e){return e.find(Re)||null}function Ve(e,t=[]){for(let n of e){if(Array.isArray(n)){if(!Ve(n,t))return null;continue}if(Le(n)){t.push(n);continue}return null}return t}function He(e){if(e===!1||e==null)return null;if(typeof e==`string`){let t=q(e);return t.length>0?t:null}if(Array.isArray(e)){let t=Ve(e,[]);return t&&t.length>0?t:null}return Le(e)?[e]:null}function Ue(e){return Re(e)||Le(e)?e:typeof e==`string`?document.querySelector(e):Array.isArray(e)&&(He(e)||[])[0]||null}function G(e){if(!ze(e))return null;if(typeof e==`string`){let t=document.querySelector(e);return Re(t)?t:null}if(Array.isArray(e)){let t=He(e);return Array.isArray(t)?Be(t):null}return Re(e)?e:null}function We(e,t=`Component`,n=`element`){if(!Ie(n))throw Error(`${t}: expect must be one of 'node', 'element', 'array'.`);return ze(e)?n===`array`?He(e):n===`node`?Ue(e):G(e):null}function Ge(e,t=`Component`,n=`element`){let r=We(e,t,n);if(r==null)throw Error(`${t}: container not found.`);return r}function Ke(e){return ye(e)}function K(e,t=document){return t.querySelector(e)}function q(e,t=document){return Array.from(t.querySelectorAll(e))}function qe(e,t,n={}){if(typeof t!=`function`)throw TypeError(`lazyRender: renderCallback expects function.`);let{threshold:r=.1,rootMargin:i=`0px`,root:a=null,waitForDOM:o=!0}=n,s={threshold:r,rootMargin:i,root:a};if(!Ye(e))return console.warn(`lazyRender: target 必须是 CSS 选择器字符串或 DOM 元素`),Je;let c=Je,l=Xe(e);if(l&&document.body.contains(l))return c=Ze(l,t,s),c;if(!o||typeof MutationObserver>`u`)return t(),c;let u=new MutationObserver(()=>{let n=Xe(e);!n||!document.body.contains(n)||(l=n,u.disconnect(),c=Ze(l,t,s))});return u.observe(document.documentElement,{childList:!0,subtree:!0}),()=>{u.disconnect(),c()}}function Je(){}function Ye(e){return typeof e==`string`||Re(e)}function Xe(e){return typeof e==`string`?K(e):e}function Ze(e,t,n){if(typeof window>`u`||window.IntersectionObserver===void 0)return t(),Je;let r=new window.IntersectionObserver(n=>{for(let i of n)if(i.isIntersecting){r.unobserve(e),r.disconnect(),t();break}},n);return r.observe(e),()=>{r.unobserve(e),r.disconnect()}}function Qe(e,t,n,r){let i=!0;return e.addEventListener(t,n,r),()=>{i&&(i=!1,e.removeEventListener(t,n,r))}}function J(){let e=new Map,t=t=>{let n=e.get(t);return n?(n(),e.delete(t),!0):!1};return{on(n,r,i,a,o){if(typeof n!=`string`||n.trim()===``)throw TypeError(`EventManager.on: key expects a non-empty string.`);if(t(n),r==null)return()=>{};let s=Qe(r,i,a,o);return e.set(n,s),s},off:t,clear(){for(let t of e.values())t();e.clear()},size(){return e.size}}}function $e(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(16);if(typeof crypto.getRandomValues!=`function`)throw Error(`Your browser is too old to support secure login.`);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,20),t.slice(20,32)].join(`-`)}function Y(e=8){if(!Number.isInteger(e)||e<1||e>87381)throw Error(`Length must be an integer between 1 and 87381`);let t=Math.ceil(e*3/4),n=new Uint8Array(t);crypto.getRandomValues(n);let r=``;for(let e of n)r+=String.fromCharCode(e);return btoa(r).substring(0,e).replace(/\+/g,`-`).replace(/\//g,`_`)}const X={},et={timers:X,start(e,t,n){X[e]&&clearTimeout(X[e]),X[e]=setTimeout(()=>{n(),delete X[e]},t)},cancel(e){X[e]&&(clearTimeout(X[e]),delete X[e])}},tt={container:`j-toast-container`,toast:`j-toast`,icon:`el-icon`,message:`el-text`,lite:`j-toast-lite`,action:`j-toast is-action`,actions:`toast-actions`,button:`j-button is-sm`,closeBtn:`is-ghost`,actionBtn:`is-outline`,info:`is-info`,primary:`is-primary`,success:`is-success`,warning:`is-warning`,error:`is-error`},nt={type:`string`,enum:[`info`,`success`,`warning`,`error`,`primary`]},rt={type:`number`,min:0},it={type:`number`,greaterThan:0},at=new Set,ot=new Map,Z=new Map,st=new Map;let ct=tt;function lt(e){return{...tt,...e}}function ut(e){return lt({...ct,...e?.className})}function dt(e){let t=K(`[data-toast-container]`);return t?t.className=e.container:(t=f(`div`,{className:e.container,"data-toast-container":``}),d(document.body,t)),t}function ft(e,t,n,r){let i=`${e}-${t}`;return at.add(i),et.start(i,r,()=>{at.delete(i),n()}),i}function pt(e){for(let t of Array.from(at))t.startsWith(`${e}-`)&&(et.cancel(t),at.delete(t))}function mt(e){Z.get(e)?.cancel(),Z.delete(e),st.delete(e),e.remove(),ot.get(e)?.(),ot.delete(e);let t=K(`[data-toast-container]`);t&&t.children.length===0&&t.remove()}function ht(e,t,n){return{duration:e.ownerDocument.defaultView?.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches?0:t,easing:n,fill:`both`}}function gt(e){return e.finished.then(()=>void 0,()=>void 0)}function _t(e,t){let n=e.hasAttribute(`data-toast-lite`);return n&&t===`enter`?[{opacity:0},{opacity:1}]:n?[{opacity:1,transform:`translate(-50%, -50%)`},{opacity:0,transform:`translate(-50%, calc(-50% - 8px))`}]:t===`enter`?[{opacity:0,transform:`translate3d(0, -16px, 0)`},{opacity:1,transform:`translate3d(0, 0, 0)`}]:[{opacity:1,transform:`translate3d(0, 0, 0)`},{opacity:0,transform:`translate3d(0, -16px, 0)`}]}async function vt(e,t){let n=(st.get(e)||0)+1;if(st.set(e,n),Z.get(e)?.cancel(),Z.delete(e),typeof e.animate!=`function`)return;let r=e.hasAttribute(`data-toast-lite`),i=e.animate(_t(e,t),ht(e,t===`enter`?r?150:240:r?120:180,t===`enter`?`cubic-bezier(0.16, 1, 0.3, 1)`:`cubic-bezier(0.4, 0, 1, 1)`));Z.set(e,i),await gt(i),st.get(e)===n&&Z.get(e)===i&&Z.delete(e)}function yt(e,t,n,r){e.removeAttribute(`data-mount`),e.setAttribute(`aria-live`,n),t(),e.getBoundingClientRect(),vt(e,`enter`).then(()=>{!e.isConnected||e.dataset.mount===`false`||r?.()})}function bt(e){e&&e.getAttribute(`data-mount`)!==`false`&&(ot.get(e)?.(),ot.delete(e),pt(e.dataset.toast||Y()),e.removeAttribute(`aria-live`),e.setAttribute(`data-mount`,`false`),vt(e,`leave`).then(()=>{e.dataset.mount===`false`&&mt(e)}))}function xt(e=``,t=3e3,n=`info`,r={}){U(`message`,e,`string`,`Toast.show`),U(`duration`,t,rt,`Toast.show`),U(`type`,n,nt,`Toast.show`);let i=ut(r),a=Y(),o=f(`div`,{className:k(i.toast,i[n]),"data-toast":a,role:`alert`,"aria-atomic":`true`,children:[f(`span`,{className:i.icon,"data-toast-icon":a,children:w(n===`primary`?`info`:n)}),f(`span`,{className:i.message,"data-toast-message":a,children:e})]});return yt(o,()=>d(dt(i),o),n===`error`?`assertive`:`polite`),t>0&&ft(a,`hide`,()=>bt(o),t),ot.set(o,Qe(o,`click`,()=>bt(o))),o}function St(e=``,t=2e3,n={}){U(`message`,e,`string`,`Toast.lite`),U(`duration`,t,it,`Toast.lite`);let r=ut(n),i=K(`[data-toast-lite]`);i&&(pt(i.dataset.toast||``),Z.get(i)?.cancel(),mt(i));let a=Y(),o=f(`div`,{className:r.lite,"data-toast":a,"data-toast-lite":``,children:e});return yt(o,()=>d(document.body,o),`polite`),ft(a,`hide`,()=>bt(o),t),o}function Ct(t=``,n={}){U(`message`,t,`string`,`Toast.action`);let r=n.text?.close||e(`Close`,_),i=n.text?.action||e(`Confirm`,_),a=ut(n),o=Y(),s=f(`div`,{className:k(a.action,a[n.type||`info`]),"data-toast":o,"data-toast-action":``,children:[f(`div`,{className:a.message,"data-toast-message":o,children:t}),f(`div`,{className:a.actions,"data-toast-actions":o,children:[f(`button`,{className:k(a.button,a.closeBtn),children:r,"data-action":`close`,"aria-label":r,onClick:async()=>{await n.onClose?.(),bt(s)}}),f(`button`,{className:k(a.button,a.actionBtn),children:i,"data-action":`toast-action`,"aria-label":i,onClick:async()=>{await n.onAction?.(),bt(s)}})]})]});return yt(s,()=>d(dt(a),s),`polite`,()=>{K(`[data-action="toast-action"]`,s)?.focus()}),s}function wt(){for(let e of at)et.cancel(e);at.clear();for(let e of ot.values())e();ot.clear();for(let e of Z.values())e.cancel();Z.clear(),st.clear(),K(`[data-toast-container]`)?.remove(),K(`[data-toast-lite]`)?.remove()}const Tt={timers:at,disposers:ot,configure(e={}){return ct=lt(e.className),{className:ct}},show:xt,success:(e=``,t=3e3,n={})=>xt(e,t,`success`,n),info:(e=``,t=3e3,n={})=>xt(e,t,`info`,n),primary:(e=``,t=3e3,n={})=>xt(e,t,`primary`,n),warning:(e=``,t=3e3,n={})=>xt(e,t,`warning`,n),error:(e=``,t=3e3,n={})=>xt(e,t,`error`,n),hide:bt,lite:St,action:Ct,clearAll:wt,destroyAll:wt};function Et(){if(typeof navigator>`u`)return!1;if(typeof navigator.userAgentData?.mobile==`boolean`)return navigator.userAgentData.mobile;let e=navigator.userAgent||``;return/\b(BlackBerry|webOS|iPhone|IEMobile|Android|Windows Phone|iPad|iPod)\b/i.test(e)?!0:typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(pointer: coarse)`).matches&&window.matchMedia(`(max-width: 820px)`).matches}async function Dt(e){if(typeof window>`u`||typeof document>`u`)return Promise.resolve(!1);let t=String(e);if(navigator.clipboard&&typeof navigator.clipboard.writeText==`function`)try{return await navigator.clipboard.writeText(t),!0}catch{return Ot(t)}return Ot(t)}function Ot(e){let t=null;try{return t=document.createElement(`textarea`),t.value=e,t.setAttribute(`readonly`,``),t.style.position=`absolute`,t.style.left=`-9999px`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),t.setSelectionRange(0,e.length),document.execCommand(`copy`)}catch{return!1}finally{t&&t.parentNode&&t.parentNode.removeChild(t)}}function kt(){try{return typeof Object.hasOwn==`function`&&typeof[].at==`function`}catch{return!1}}function At(){return kt()?!0:(Tt.action(e(`wn`,_),{type:`error`,onAction:()=>{window.open(`https://www.google.cn/chrome/fallback/`,`_blank`)},className:{actionBtn:`j-button is-sm is-danger`}}),!1)}const jt=typeof window<`u`?`${window.location.origin}/wp-json`:``;async function Mt(e,t,n={}){let r=new Headers(n.headers);return r.has(`Content-Type`)||r.set(`Content-Type`,`application/json`),(await fetch(e,{...n,method:`POST`,headers:r,body:JSON.stringify(t)})).json()}function Nt(...e){return{async enter(t){await Promise.all(e.map(e=>e.enter(t)))},async leave(t){await Promise.all(e.map(e=>e.leave(t)))},cancel(){for(let t of e)t.cancel()}}}function Pt(e,t){let n=e.finished.then(()=>void 0,()=>void 0);return t?new Promise(e=>{let r=()=>{t.removeEventListener(`abort`,r),e()};if(t.aborted){r();return}t.addEventListener(`abort`,r,{once:!0}),n.then(r)}):n}function Ft(e,t){let n={fill:`both`,...t.options},r=e.ownerDocument.defaultView;return t.respectReducedMotion!==!1&&r?.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches&&(n.duration=0,n.delay=0,n.endDelay=0),n}function It(e,t){let n=null,r=()=>{let t=e()||null;return!t||typeof t.animate!=`function`?null:t},i=e=>e===1||!Array.isArray(t.keyframes)?t.keyframes:t.keyframes.slice().reverse(),a=async(e,a)=>{if(a?.aborted)return;let o=r();o&&(n?.cancel(),n=o.animate(i(e),Ft(o,t)),await Pt(n,a),a?.aborted)};return{enter:e=>a(1,e),leave:e=>a(-1,e),cancel(){n?.cancel(),n=null}}}function Lt(e,t={}){let n=t.axis||`vertical`,r=null,i=null,a=null,o=`1`,s=0,c=e=>n===`vertical`?e.style.height:e.style.width,l=(e,t)=>{n===`vertical`?e.style.height=t:e.style.width=t},u=()=>{!r||!a||(l(r,a.size),r.style.opacity=a.opacity,r.style.overflow=a.overflow,r.style.visibility=a.visibility)},d=()=>{let t=e()||null;return t===r?r:(i?.cancel(),u(),i=null,r=t,a=t?{size:c(t),opacity:t.style.opacity,overflow:t.style.overflow,visibility:t.style.visibility}:null,o=t?.ownerDocument.defaultView?.getComputedStyle(t).opacity||`1`,r)},f=e=>{let n=d();if(!(!n||!a)){if(e){u();return}l(n,`0px`),n.style.overflow=`hidden`,n.style.visibility=`hidden`,t.fade!==!1&&(n.style.opacity=`0`)}},p=e=>{if(!a)return 0;let t=c(e),r=e.style.visibility;l(e,a.size),e.style.visibility=a.visibility;let i=e.getBoundingClientRect(),o=n===`vertical`?Math.max(i.height,e.scrollHeight):Math.max(i.width,e.scrollWidth);return l(e,t),e.style.visibility=r,o},m=async(e,r)=>{if(r?.aborted)return;let c=d();if(!c||!a)return;let l=c.getBoundingClientRect(),u=n===`vertical`?l.height:l.width,m=c.ownerDocument.defaultView?.getComputedStyle(c).opacity,h=i?m||(e?`0`:o):c.style.opacity||m||(e?`0`:o),g=++s;i?.cancel(),i=null;let _=e?p(c):0;if(c.style.overflow=`hidden`,c.style.visibility=a.visibility,typeof c.animate!=`function`){f(e);return}let v=Ft(c,{keyframes:[],options:{duration:250,easing:`ease`,...t.options,fill:`both`},respectReducedMotion:t.respectReducedMotion});i=c.animate([{[n===`vertical`?`height`:`width`]:`${u}px`,...t.fade===!1?{}:{opacity:h}},{[n===`vertical`?`height`:`width`]:`${_}px`,...t.fade===!1?{}:{opacity:e?o:`0`}}],v);let y=i;await Pt(y,r),!(g!==s||r?.aborted)&&(y.cancel(),i===y&&(i=null),f(e))};return{enter:e=>m(!0,e),leave:e=>m(!1,e),setExpanded(e){s+=1,i?.cancel(),i=null,f(e)},cancel(){s+=1,i?.cancel(),i=null,u(),r=null,a=null}}}function Rt(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var zt=function(){return M.Date.now()},Bt=/\s/;function Vt(e){for(var t=e.length;t--&&Bt.test(e.charAt(t)););return t}var Ht=/^\s+/;function Ut(e){return e&&e.slice(0,Vt(e)+1).replace(Ht,``)}var Wt=`[object Symbol]`;function Gt(e){return typeof e==`symbol`||se(e)&&z(e)==Wt}var Kt=NaN,qt=/^[-+]0x[0-9a-f]+$/i,Jt=/^0b[01]+$/i,Yt=/^0o[0-7]+$/i,Xt=parseInt;function Zt(e){if(typeof e==`number`)return e;if(Gt(e))return Kt;if(Rt(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=Rt(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=Ut(e);var n=Jt.test(e);return n||Yt.test(e)?Xt(e.slice(2),n?2:8):qt.test(e)?Kt:+e}var Qt=`Expected a function`,$t=Math.max,en=Math.min;function tn(e,t,n){var r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0;if(typeof e!=`function`)throw TypeError(Qt);t=Zt(t)||0,Rt(n)&&(u=!!n.leading,d=`maxWait`in n,a=d?$t(Zt(n.maxWait)||0,t):a,f=`trailing`in n?!!n.trailing:f);function p(t){var n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function m(e){return l=e,s=setTimeout(_,t),u?p(e):o}function h(e){var n=e-c,r=e-l,i=t-n;return d?en(i,a-r):i}function g(e){var n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function _(){var e=zt();if(g(e))return v(e);s=setTimeout(_,h(e))}function v(e){return s=void 0,f&&r?p(e):(r=i=void 0,o)}function y(){s!==void 0&&clearTimeout(s),l=0,r=c=i=s=void 0}function b(){return s===void 0?o:v(zt())}function x(){var e=zt(),n=g(e);if(r=arguments,i=this,c=e,n){if(s===void 0)return m(c);if(d)return clearTimeout(s),s=setTimeout(_,t),p(c)}return s===void 0&&(s=setTimeout(_,t)),o}return x.cancel=y,x.flush=b,x}var nn=`Expected a function`;function rn(e,t,n){var r=!0,i=!0;if(typeof e!=`function`)throw TypeError(nn);return Rt(n)&&(r=`leading`in n?!!n.leading:r,i=`trailing`in n?!!n.trailing:i),tn(e,t,{leading:r,maxWait:t,trailing:i})}let an=null,on=null,sn=!1;function cn(e){if(typeof queueMicrotask==`function`){queueMicrotask(e);return}Promise.resolve().then(e)}function ln(){sn||(sn=!0,cn(dn))}function un(e){e.enqueued=!0,on?on.next=e:an=e,on=e,ln()}function dn(){sn=!1;let e=an;an=null,on=null;let t=e;for(;t;){let e=t.next;t.next=null,t.enqueued=!1,!t.disposed&&t.queued&&(t.queued=!1,t.run()),t=e}}function fn(e){let t={queued:!1,enqueued:!1,disposed:!1,next:null,run:e};return{schedule(){t.disposed||t.queued||(t.queued=!0,t.enqueued||un(t))},flush(){t.disposed||(t.queued=!1,t.run())},cancel(){t.queued=!1},dispose(){t.disposed=!0,t.queued=!1}}}function pn(e){if(e&&typeof e==`object`){let t=e.__version__;return typeof t==`number`?t:0}return 0}function mn(e){return pn(e),e}function hn(e){return h(e)}function gn(e,t,{deferInitial:n=!0,flushInitial:r=!1,flush:i=`microtask`}={}){let a=!1,o=!1,s,c=fn(()=>{o&&(o=!1,m(()=>t(s)))}),u=l(e,e=>{let t=!a;if(a=!0,s=e,o=!0,t&&r||i===`sync`){c.flush();return}c.schedule()},{defer:n});return()=>{c.dispose(),u.dispose()}}function _n(){let e=null;return{get current(){return e},set(t){e=t},clear(){e=null}}}function vn(){let e=new Map;return{elements:e,get(t){return e.get(t)},bind(t){return n=>{e.set(t,n),p(()=>{e.get(t)===n&&e.delete(t)})}},delete(t){e.delete(t)},clear(){e.clear()}}}function yn(e,t={}){let n,r=t.removeOnDispose!==!1,i=s(t=>(n=m(e),r&&p(()=>n.remove()),t));return{element:n,dispose:i}}function bn(e){return e.filter(e=>e!=null&&e.isConnected)}function xn(e){e[0]?.getBoundingClientRect()}function Sn(e){return e.split(`,`).map(e=>{let t=e.trim();return t.endsWith(`ms`)?Number.parseFloat(t)||0:t.endsWith(`s`)?(Number.parseFloat(t)||0)*1e3:0})}function Cn(e){return e.split(`,`).map(e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0})}function wn(e,t,n=[1],r=[!0]){let i=Math.max(e.length,t.length,n.length,r.length),a=0;for(let o=0;o<i;o+=1){if(!r[o%r.length])continue;let i=(e[o%e.length]||0)*(n[o%n.length]||0)+(t[o%t.length]||0);a=Math.max(a,i)}return Math.max(0,a)}function Tn(e){let t=e.ownerDocument.defaultView;if(!t)return 0;let n=t.getComputedStyle(e),r=wn(Sn(n.transitionDuration),Sn(n.transitionDelay),[1],n.transitionProperty.split(`,`).map(e=>e.trim()!==`none`)),i=wn(Sn(n.animationDuration),Sn(n.animationDelay),Cn(n.animationIterationCount),n.animationName.split(`,`).map(e=>e.trim()!==`none`));return Math.max(r,i)}function En(e,t){return new Promise(n=>{if(t?.aborted){n();return}let r=()=>{clearTimeout(i),t?.removeEventListener(`abort`,r),n()},i=setTimeout(r,e);t?.addEventListener(`abort`,r,{once:!0})})}async function Dn(e,t){let n=new Set,r=0;for(let t of e){if(typeof t.getAnimations!=`function`){r=Math.max(r,Tn(t));continue}for(let e of t.getAnimations()){let t=e.effect?.getComputedTiming().endTime;(typeof t!=`number`||Number.isFinite(t))&&n.add(e)}}let i=Array.from(n,e=>e.finished);if(r>0&&i.push(En(r,t)),i.length===0)return;let a=Promise.allSettled(i);if(!t){await a;return}await new Promise(e=>{let n=()=>{t.removeEventListener(`abort`,n),e()};if(t.aborted){n();return}t.addEventListener(`abort`,n,{once:!0}),a.then(n)})}function On(e){let t=`hidden`,n=0,r=null,i=null,a=null,o=()=>(a?.abort(),a=new AbortController,a.signal);return{get phase(){return t},enter:()=>{if(t===`visible`)return Promise.resolve(!1);if(t===`entering`&&r)return r;let i=++n,a=o();return t=`entering`,r=(async()=>{e.mount();let r=bn(e.elements());return xn(r),u(e.activate),e.motion?await e.motion.enter(a):await Dn(r,a),i===n?(t=`visible`,!0):!1})(),r},leave:()=>{if(t===`hidden`)return Promise.resolve(!1);if(t===`leaving`&&i)return i;let r=++n,a=o();return t=`leaving`,i=(async()=>{u(e.deactivate);let i=bn(e.elements());return e.motion?await e.motion.leave(a):await Dn(i,a),r===n?(e.unmount(),t=`hidden`,!0):!1})(),i},cancel(){n+=1,a?.abort(),a=null,e.motion?.cancel(),t=`hidden`,r=null,i=null}}}function kn(e=`center`,t=`center`){let n=w(`loader`,{width:24});return requestAnimationFrame(()=>{typeof n.animate==`function`&&n.animate([{transform:`rotate(0deg)`},{transform:`rotate(360deg)`}],{duration:1e3,iterations:1/0,easing:`linear`})}),f(`div`,{"aria-live":`polite`,style:{display:`flex`,justifyContent:e,alignItems:t,position:`absolute`,width:`100%`,height:`100%`,borderRadius:`inherit`,backdropFilter:`blur(4px)`},children:n})}const An={className:{default:`j-popup-layout`,type:`string`},position:{default:`center`,type:`string`},component:{default:``,type:`string`},labelledby:{default:``,type:`string`},content:{default:``,type:`renderable`}};function jn(e){let t=W(e,An,`Popup`);return{className:t.className,position:t.position,component:t.component,labelledby:t.labelledby,content:t.content}}function Mn(e={}){let{className:t,position:n,component:r,labelledby:i,content:a}=jn(e),o={className:`${t} is-${n}`,role:`dialog`,children:a};return r&&(o[`data-${r}`]=`root`,o[`aria-${r}`]=`true`),i&&(o[`aria-labelledby`]=i),f(`div`,o)}const Nn={root:`j-drop`,container:`drop-container`},Pn={name:{default:null,types:[`string`,`null`]},mode:{default:`click`,type:`string`,enum:[`hover`,`click`]},position:{default:`auto`,type:`string`,enum:[`auto`,`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`,`left`,`right`]},offset:{default:10,type:`number`,min:0},content:{default:``,type:`renderable`},cache:{default:!1,type:`boolean`},ttl:{default:0,type:`number`,min:0},className:{default:Nn,type:`object`,normalize:e=>({...Nn,...e&&typeof e==`object`?e:{}})},id:{default:null,types:[`string`,`null`],normalize:e=>typeof e==`string`?e.trim()||Y():e??Y()},delay:{default:0,types:[`number`,`object`]},hoverIntent:{default:!0,type:`boolean`},onShown:{default:null,types:[`function`,`null`]},onHidden:{default:null,types:[`function`,`null`]}};function Fn(e){let t=W(e,Pn,`Drop`);return{name:t.name,mode:t.mode,position:t.position,offset:t.offset,content:t.content,cache:t.cache,ttl:t.ttl,className:t.className,id:t.id,delay:t.delay,hoverIntent:t.hoverIntent,onShown:t.onShown,onHidden:t.onHidden}}function In(e){return typeof e==`number`&&e>=0?{show:e,hide:e}:typeof e==`object`&&e?{show:Number(e.show)||0,hide:Number(e.hide)||0}:{show:0,hide:0}}function Ln(e){return typeof e==`number`&&e>0?e:0}function Rn(e,t={}){let n=G(e),r=Fn(t),i=J(),a=In(r.delay),o={show:null,hide:null},l={x:0,y:0,lastMoveTime:0},u=0,p=0,m=!1,h=!1,g,_=null,v=null,y=0,b=()=>{},[x,S]=c(typeof r.content==`function`?null:r.content),[C,w]=c(!1),T=()=>{if(C())return kn();let e=x();return typeof e==`function`?e(g):e},{root:E}=s(e=>{b=e;let t=f(`div`,{className:r.className.container,"data-drop-container":r.name||r.id,"aria-live":()=>typeof r.content==`function`?`polite`:null,"aria-busy":()=>String(C()),children:T});return{root:f(`div`,{className:r.className.root,id:r.id,"data-drop":r.name||Y(),"aria-expanded":`false`,children:t})}}),D=e=>{o[e]&&clearTimeout(o[e]),o[e]=null},O=async()=>{let e=r.content;if(typeof e!=`function`){S(e);return}let t=Ln(r.ttl);if(r.cache&&_&&(!t||Date.now()-_.updatedAt<=t)){S(_.content);return}if(v)return v;let n=++y;w(!0);let i=Promise.resolve().then(()=>e(g)).then(e=>{h||n!==y||(r.cache&&(_={content:e,updatedAt:Date.now()}),S(e))}).finally(()=>{n===y&&!h&&w(!1),v===i&&(v=null)});return v=i,i},k=()=>{if(!n)return;let e=n.getBoundingClientRect(),{offset:t,position:i}=r;E.style.visibility=`hidden`,E.style.display=`block`;let a=E.getBoundingClientRect(),o=0,s=0,c=i;switch(c===`auto`&&(c=window.innerHeight-e.bottom>a.height+t?`bottom-center`:`top-center`),c){case`top-left`:o=e.top-a.height-t,s=e.left;break;case`top-center`:o=e.top-a.height-t,s=e.left+e.width/2-a.width/2;break;case`top-right`:o=e.top-a.height-t,s=e.right-a.width;break;case`bottom-left`:o=e.bottom+t,s=e.left;break;case`bottom-center`:o=e.bottom+t,s=e.left+e.width/2-a.width/2;break;case`bottom-right`:o=e.bottom+t,s=e.right-a.width;break;case`left`:o=e.top+e.height/2-a.height/2,s=e.left-a.width-t;break;case`right`:o=e.top+e.height/2-a.height/2,s=e.right+t;break;default:break}o=Math.max(8,Math.min(o,window.innerHeight-a.height-8)),s=Math.max(8,Math.min(s,window.innerWidth-a.width-8)),E.style.top=`${o+window.scrollY}px`,E.style.left=`${s+window.scrollX}px`,E.style.visibility=``,E.style.display=``},A=e=>{h||m===e||(e?(E.parentNode||d(document.body,E),k(),O().then(()=>{m&&!h&&k()})):(y+=1,v=null,w(!1),E.style.top=``,E.style.left=``,E.remove()),E.setAttribute(`aria-expanded`,e?`true`:`false`),m=e,e?r.onShown?.(g):r.onHidden?.(g))},j=e=>{e.target instanceof Node&&n&&!E.contains(e.target)&&!n.contains(e.target)&&g.hide()},M=e=>{e instanceof MouseEvent&&(u=e.clientX,p=e.clientY,l.lastMoveTime=Date.now(),l.x=e.clientX,l.y=e.clientY)},N=()=>{i.on(`document:mousemove`,document,`mousemove`,M),D(`show`),o.show=setTimeout(()=>{let e=Date.now()-l.lastMoveTime;Math.abs(l.x-u)+Math.abs(l.y-p)<5||e>100?(g.show(!1),i.off(`document:mousemove`)):N()},a.show)};return g={get target(){return n},props:r,get element(){return h?null:E},get isVisible(){return m},delayShow:a.show,delayHide:a.hide,show(e=!0){D(`hide`),!(m||h)&&(e&&a.show>0?(D(`show`),o.show=setTimeout(()=>A(!0),a.show)):A(!0))},hide(e=!0){D(`show`),!(!m||h)&&(e&&a.hide>0?(D(`hide`),o.hide=setTimeout(()=>A(!1),a.hide)):A(!1))},toggle(){m?g.hide():g.show()},destroy(){h||(h=!0,D(`show`),D(`hide`),i.clear(),y+=1,v=null,w(!1),E.remove(),b(),n=null,m=!1)}},n&&(r.mode===`hover`?(i.on(`target:enter`,n,`mouseenter`,()=>{r.hoverIntent?N():g.show()}),i.on(`target:leave`,n,`mouseleave`,()=>{D(`show`),i.off(`document:mousemove`),g.hide()}),i.on(`root:enter`,E,`mouseenter`,()=>g.show()),i.on(`root:leave`,E,`mouseleave`,()=>g.hide())):(i.on(`target:click`,n,`click`,()=>g.toggle()),i.on(`document:click`,document,`click`,j))),g}const zn={container:`j-tooltip`,message:`el-text`,ui:{reverse:`is-reverse`,primary:`is-primary`,success:`is-success`,warning:`is-warning`,error:`is-error`}};function Bn(e){let t=e&&typeof e==`object`?e:{},n=`ui`in t&&t.ui&&typeof t.ui==`object`?t.ui:{};return{...zn,...t,ui:{...zn.ui,...n}}}const Vn={name:{default:null,types:[`string`,`null`]},mode:{default:`hover`,type:`string`,enum:[`hover`,`click`]},position:{default:`auto`,type:`string`,enum:[`auto`,`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`,`left`,`right`]},offset:{default:8,type:`number`},message:{default:``,type:`string`,normalize:e=>typeof e==`string`?e.trim():e,nonEmpty:!0},theme:{default:!1,types:[`string`,`boolean`],enum:[!1,`reverse`,`primary`,`success`,`warning`,`error`]},cache:{default:!1,type:`boolean`},ttl:{default:0,type:`number`,min:0},className:{default:zn,type:`object`,normalize:Bn},id:{default:null,types:[`string`,`null`]},delay:{default:100,types:[`number`,`object`]},hoverIntent:{default:!0,type:`boolean`},onShown:{default:null,types:[`function`,`null`]},onHidden:{default:null,types:[`function`,`null`]}};function Hn(e){let t=W(e,Vn,`Tooltip.props`);return{name:t.name,mode:t.mode,position:t.position,offset:t.offset,message:t.message,theme:t.theme,cache:t.cache,ttl:t.ttl,className:t.className,id:t.id,delay:t.delay,hoverIntent:t.hoverIntent,onShown:t.onShown,onHidden:t.onHidden}}function Un(e,t={}){let n=Hn(t),r=f(`div`,{className:k(n.className.container,n.theme&&n.className.ui[n.theme]),"data-tooltip":n.name||n.id||``,children:f(`div`,{className:n.className.message,"data-tooltip-message":``,children:n.message})}),i=Rn(e,{name:n.name,mode:n.mode,position:n.position,offset:n.offset,cache:n.cache,ttl:n.ttl,id:n.id,delay:n.delay,hoverIntent:n.hoverIntent,onShown:n.onShown,onHidden:n.onHidden,content:r});return{get element(){return i?.element||null},get drop(){return i},show(e=!0){i?.show(e)},hide(e=!0){i?.hide(e)},toggle(){i?.toggle()},destroy(){i?.destroy(),i=null}}}const Wn={panel:`j-theme-palette`,title:`theme-palette-title`,container:`palette-container`,item:`palette-item`,itemTitle:`item-title`,items:`items`,button:`j-button is-default`,active:`is-active`,prefix:`el-prefix`,swatch:`item-hex`,buttonText:`button-text`},Gn={mode:`dark`,theme:`indigo`,radius:`sm`,shadow:`sm`,font:`sm`,key:`ui-theme`,className:Wn},Kn={theme:`j-theme-`,radius:`j-radius-`,shadow:`j-shadow-`,font:`j-font-`};function qn(e){return{...Wn,...e}}function Jn(e={}){return{...Gn,...e,className:qn(e.className)}}function Yn(e){return e===`mode`||e===`theme`||e===`radius`||e===`shadow`||e===`font`}function Xn(){return g({driver:`cookie`,codec:`json`,namespace:``,keySeparator:``,driverOptions:{path:`/`,sameSite:`Lax`,secure:typeof location<`u`&&location.protocol===`https:`},ttl:864e5*7})}function Zn(e){if(!B(e))return null;let t=e,n={};for(let e of[`mode`,`theme`,`radius`,`shadow`,`font`]){let r=t[e];typeof r==`string`&&(n[e]=r)}return Object.keys(n).length?n:null}function Qn(e){return[{title:e(`Primary`),type:`theme`,buttons:[[`gray`,e(`Gray`)],[`olive`,e(`Olive`)],[`tomato`,e(`Tomato`)],[`ruby`,e(`Ruby`)],[`pink`,e(`Pink`)],[`violet`,e(`Violet`)],[`indigo`,e(`Indigo`)],[`blue`,e(`Blue`)],[`teal`,e(`Teal`)],[`grass`,e(`Grass`)],[`mint`,e(`Mint`)],[`lime`,e(`Lime`)],[`yellow`,e(`Yellow`)],[`orange`,e(`Orange`)],[`gold`,e(`Gold`)]]},{title:e(`Radius`),type:`radius`,buttons:[[`none`,e(`None`)],[`sm`,e(`sm`)],[`md`,e(`md`)],[`lg`,e(`lg`)],[`xl`,e(`XL`)],[`round`,e(`Round`)]]},{title:e(`Shadow`),type:`shadow`,buttons:[[`none`,e(`None`)],[`sm`,e(`sm`)],[`md`,e(`md`)],[`lg`,e(`lg`)]]},{title:e(`Font`),type:`font`,buttons:[[`sm`,e(`sm`)],[`md`,e(`md`)]]},{title:e(`Mode`),type:`mode`,buttons:[[`light`,e(`Light`)],[`dark`,e(`Dark`)],[`auto`,e(`Auto`)]]}]}function $n(t={}){let a=i(Jn(t)),o={configVersion:0,destroyed:!1},c=Xn(),l=new Set,d=J(),p=t=>e(t,_),m=()=>window.matchMedia?.(`(prefers-color-scheme: dark)`).matches?`dark`:`light`,h=()=>{let{mode:e,theme:t,radius:n,shadow:r,font:i}=a,o={mode:e,theme:t,radius:n,shadow:r,font:i,render:e===`auto`?m():e};c.set(a.key,o).catch(()=>{})},g=e=>{let t=s(t=>{for(let t of q(`[data-theme-group]`,e)){let e=t.dataset.themeGroup;if(Yn(e))for(let i of q(`[data-theme-button]`,t)){let t=()=>i.dataset.themeValue===String(a[e]);r(i,a.className.active,t),n(i,`aria-selected`,()=>t()?`true`:null)}}return t});l.add(t)},v=(e=null,t=null)=>{let n=a.className,r=t||Qn(p),i=f(`div`,{className:e||n.panel,"data-theme-palette":`root`,children:[f(`h3`,{className:n.title,"data-theme-title":``,style:{margin:`0 0 1rem`},children:p(`t`)}),f(`div`,{className:n.container,"data-theme-container":``,children:r.map(e=>f(`div`,{className:n.item,"data-palette":e.type,"data-theme-group":e.type,children:[f(`div`,{className:n.itemTitle,"data-theme-group-title":e.type,children:e.title}),f(`div`,{className:n.items,"data-theme-items":e.type,children:e.buttons.map(([t,r])=>{let i=String(a[e.type])===String(t);return f(`button`,{className:k(n.button,i&&n.active),"data-palette":t,"data-theme-button":e.type,"data-theme-value":t,"aria-selected":i?`true`:null,children:[e.type===`theme`?f(`span`,{className:k(n.prefix,n.swatch),"data-theme-swatch":t,style:{backgroundColor:`var(--ui-${t})`}}):null,f(`span`,{className:n.buttonText,"data-theme-button-text":t,children:r})]})})})]}))})]});return g(i),i},y=e=>{o.configVersion+=1,u(()=>{Object.assign(a,e,{className:qn({...a.className,...e.className})})}),h()},b=()=>{if(!o.destroyed){o.destroyed=!0,d.clear();for(let e of l)e();l.clear(),c.close().catch(()=>{})}};d.on(`palette`,document.body,`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`[data-theme-button]`),n=(t?.closest(`[data-theme-group]`))?.dataset.themeGroup,r=t?.dataset.themeValue;if(!t||!Yn(n)||!r||t.classList.contains(a.className.active))return;let i=a[n];o.configVersion+=1,u(()=>{a[n]=r});let s=document.documentElement;if(n===`mode`)s.classList.remove(`light`,`dark`,i),s.classList.add(r===`auto`?m():r);else{let e=Kn[n],t=Array.from(s.classList).filter(t=>t.startsWith(e));t.length&&s.classList.remove(...t),s.classList.add(`${e}${r}`)}h()});let x=o.configVersion;return c.get(a.key).then(e=>{if(o.destroyed||o.configVersion!==x)return;let t=Zn(e);t&&u(()=>{Object.assign(a,t)})}).catch(()=>{}),{props:a,createPanel:v,setConfig:y,destroy:b}}const er={color:`var(--tone-solid)`,size:`12px`},tr={ball:`parabola-ball`},nr={types:[`string`,`Node`,`array`,`null`,`undefined`]},rr={ball:{default:er,type:`plainObject`,normalize:e=>({...er,...e&&typeof e==`object`?e:{}}),shape:{color:`string`,size:`string`}},className:{default:tr,type:`object`,normalize:e=>({...tr,...e&&typeof e==`object`?e:{}})},from:{default:null,...nr},to:{default:null,...nr},direction:{default:`center`,type:`string`,enum:[`center`,`top-right`,`top-left`,`bottom-right`,`bottom-left`]},showDelay:{default:0,type:`number`},onShow:{default:null,types:[`function`,`null`]},onHidden:{default:null,types:[`function`,`null`]}};function ir(e){let t=W(e,rr,`Parabola.props`);return{ball:t.ball,className:t.className,from:t.from,to:t.to,direction:t.direction,showDelay:t.showDelay,onShow:t.onShow,onHidden:t.onHidden}}function ar(e={}){let t=ir(e),n={destroyed:!1},r=new Set,i=new Map,a=new Map,o=null,s=G(t.from),c=G(t.to),l,u=()=>{if(!n.destroyed){if(o){o.isConnected||d(document.body,o);return}o=f(`div`,{"data-parabola":`root`,style:{position:`fixed`,inset:`0`,pointerEvents:`none`,zIndex:`9999`}}),d(document.body,o)}},p=()=>{!n.destroyed||r.size>0||(o?.remove(),o=null)},m=(e,n)=>{if(!r.has(e))return;let i=a.get(e);i&&cancelAnimationFrame(i),a.delete(e),e.remove(),r.delete(e),n&&t.onHidden?.(l),p()},h=e=>{if(n.destroyed||(u(),!o))return null;let{color:i,size:a}=t.ball,s=f(`div`,{className:t.className.ball,"data-parabola":`ball`,style:{backgroundColor:i,width:a,height:a,position:`fixed`,borderRadius:`50%`,transform:`translate(-50%, -50%)`,pointerEvents:`none`,zIndex:`9999`,opacity:`1`,left:`${e.startX}px`,top:`${e.startY}px`}});return d(o,s),r.add(s),s},g=()=>{let e=s?.getBoundingClientRect(),n=c?.getBoundingClientRect();if(!e||!n)return null;let{left:r,top:i,width:a,height:o}=e,{left:l,top:u,width:d,height:f}=n,p,m;switch(t.direction){case`top-left`:p=r+a*.2,m=i+o*.2;break;case`top-right`:p=r+a*.8,m=i+o*.2;break;case`bottom-left`:p=r+a*.2,m=i+o*.8;break;case`bottom-right`:p=r+a*.8,m=i+o*.8;break;default:p=r+a/2,m=i+o/2}let h=l+d/2,g=u+f/2;return{startX:p,startY:m,endX:h,endY:g}},_=(e,t,r,i,o,s=800)=>{if(!e.isConnected)return;let c=performance.now(),l=i-t,u=o-r,d=i=>{if(n.destroyed||!e.isConnected){a.delete(e);return}let o=i-c,f=Math.min(o/s,1),p=1-(1-f)**3,h=t+l*p,g=r+-100*Math.sin(Math.PI*p)+u*p,_=1-f;e.style.left=`${h}px`,e.style.top=`${g}px`,e.style.opacity=`${_}`,e.style.transform=`translate(-50%, -50%) scale(${1-p*.3})`,f<1?a.set(e,requestAnimationFrame(d)):(a.delete(e),m(e,!0))};a.set(e,requestAnimationFrame(d))},v=(e,n)=>{let r=`parabola-show-${Y()}`;i.set(r,n),et.start(r,t.showDelay,()=>{i.delete(r),e()})},y=()=>{for(let[e,t]of i)et.cancel(e),t();i.clear()};return l={props:t,runtime:n,get element(){return o},show(){return n.destroyed?Promise.resolve(!1):new Promise(e=>{v(()=>{if(n.destroyed){e(!1);return}s=G(t.from),c=G(t.to);let r=g();if(!r){e(!1);return}let i=h(r);if(!i){e(!1);return}t.onShow?.(l),_(i,r.startX,r.startY,r.endX,r.endY),e(!0)},()=>e(!1))})},destroy(){if(!n.destroyed){y(),s=null,c=null,n.destroyed=!0;for(let e of r)m(e,!1);a.clear(),p()}}},u(),l}const or={target:{default:null},parent:{default:null},max:{default:10,type:`number`,integer:!0,greaterThan:0},top:{default:16,type:`number`,min:0},gap:{default:16,type:`number`,min:0},overflow:{default:`destroy`,type:`string`,enum:[`destroy`,`ignore`]},reactive:{default:!1,type:`boolean`},onReBuild:{default:null,types:[`function`,`null`]}};function sr(e){let t=W(e,or,`Sticky.props`);return{target:t.target,parent:t.parent,max:t.max,top:t.top,gap:t.gap,overflow:t.overflow,reactive:t.reactive,onReBuild:t.onReBuild}}function cr(e){let t=e.filter(e=>e instanceof HTMLElement);return Array.from(new Set(t))}function lr(e){return e===!1||e==null?null:Ge(e,`Sticky.parent`,`element`)}function ur(e,t){if(e===!1||e==null)return[];if(typeof e==`string`){if(!t)return cr(Ge(e,`Sticky.target`,`array`));let n=cr(q(e,t));if(n.length===0)throw Error(`Sticky.target: target not found.`);return n}let n=cr(Ge(e,`Sticky.target`,`array`));if(!t)return n;let r=n.filter(e=>e===t||t.contains(e));if(r.length===0)throw Error(`Sticky.target: target not found in parent.`);return r}function dr(e={}){let t=sr(e),n=i({items:[]}),r={built:!1,destroyed:!1,reBuilding:!1,reBuildFrameId:0},a={originalStyles:new Map,keys:new WeakMap},o=null,s=[],c=null,l,d=e=>e.length<=t.max?e:t.overflow===`ignore`?[]:e.slice(-t.max),f=()=>{for(let e of a.originalStyles.values())p(e)},p=e=>{e.element.style.position=e.originalPosition,e.element.style.top=e.originalTop,e.element.style.zIndex=e.originalZIndex},m=(e,t)=>{if(e.id)return e.id;let n=a.keys.get(e);if(n)return n;let r=`sticky-${Y()}-${t}`;return a.keys.set(e,r),r},h=e=>{a.originalStyles.has(e)||a.originalStyles.set(e,{element:e,originalPosition:e.style.position,originalTop:e.style.top,originalZIndex:e.style.zIndex})},g=()=>d(ur(t.target,o)),_=(e=t.top)=>{let r=e,i=[],o=new Set(s);for(let[e,t]of a.originalStyles)o.has(e)||(p(t),a.originalStyles.delete(e));return s.forEach((e,n)=>{h(e),e.style.position=`sticky`,e.style.top=`${r}px`,i.push({key:m(e,n),index:n,top:r}),r+=e.offsetHeight+t.gap}),u(()=>{n.items=i}),t.onReBuild?.(l),r},v=()=>{if(c?.disconnect(),c=null,!t.reactive)return;let e=o||document.body;c=new MutationObserver(()=>{r.reBuilding||r.destroyed||!r.built||(r.reBuilding=!0,r.reBuildFrameId=requestAnimationFrame(()=>{r.reBuilding=!1,r.reBuildFrameId=0,l.reBuild()}))}),c.observe(e,{childList:!0,subtree:!0})};return l={props:t,state:n,runtime:r,build:()=>{if(r.destroyed)throw Error(`Sticky.build: instance destroyed`);return r.built?l:(o=lr(t.parent),s=g(),r.built=!0,v(),s.length===0?(u(()=>{n.items=[]}),l):(_(),l))},reBuild:()=>(!r.destroyed&&r.built&&(s=g(),_()),l),destroy:()=>{r.destroyed||(r.reBuildFrameId&&cancelAnimationFrame(r.reBuildFrameId),c?.disconnect(),c=null,f(),r.destroyed=!0,r.built=!1,r.reBuilding=!1,r.reBuildFrameId=0,a.originalStyles.clear(),s=[],o=null)}},l}const fr={rules:{default:{},type:`object`},messages:{default:{},type:`object`},onSubmit:{default:null,types:[`function`,`null`]}};function pr(e){let t=W(e,fr,`Validator.props`);return{rules:t.rules,messages:t.messages,onSubmit:t.onSubmit}}function mr(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement}function hr(e){if(!e)return null;if(e instanceof Element)return mr(e)?e:null;for(let t of Array.from(e))if(t instanceof Element&&mr(t))return t;return null}function gr(){return{valid:!0,message:``,destroyed:!1}}function _r(e){return e.closest(`[data-form-control]`)||e.parentElement}function vr(e){return Array.from(e.selectedOptions).map(e=>e.value.trim())}function yr(e){return e instanceof HTMLInputElement&&e.type===`file`}function br(e){return!!e.files&&e.files.length>0}function xr(e,t){return t===!0?e instanceof HTMLSelectElement?vr(e).some(e=>e.length>0):e.value.trim().length>=1:!0}function Sr(e,t){return typeof t!=`number`||e.value.length>=t}function Cr(e,t){return typeof t!=`number`||e.value.length<=t}function wr(e){return/^([\w-.]+@([\w-]+\.)+[\w-]{2,4})?$/.test(e.value)}function Tr(e,t,n){if(!e||typeof n!=`string`)return!0;let r=hr(e.elements.namedItem(n));if(!r)throw Error(`Validator: target element "${n}" not found.`);return t.value===r.value}function Er(e,t){if(!(e instanceof HTMLInputElement)||e.type!==`checkbox`)throw Error(`Validator: element expects a checkbox input, but ${e.tagName.toLowerCase()} given.`);return e.checked===t}function Dr(e,t){if(!(e instanceof HTMLSelectElement))throw Error(`Validator: element expects a select element, but ${e.tagName.toLowerCase()} given.`);return t!==!0||vr(e).some(e=>e.length>0)}function Or(e,t){if(!(e instanceof HTMLSelectElement))throw Error(`Validator: element expects a select element, but ${e.tagName.toLowerCase()} given.`);return t!==!0||e.selectedOptions.length>0}function kr(e,t){return!(e instanceof HTMLSelectElement)||typeof t!=`number`||e.selectedOptions.length>=t}function Ar(e,t){return!(e instanceof HTMLSelectElement)||typeof t!=`number`||e.selectedOptions.length<=t}function jr(e,t){return!/\s/.test(e.value)||t!==!0}function Mr(e,t){return typeof t==`string`||t instanceof RegExp?new RegExp(t).test(e.value):!0}function Nr(e,t){return!yr(e)||t!==!0||br(e)}function Pr(e,t){return!yr(e)||!br(e)||typeof t!=`number`||e.files[0].size>=t}function Fr(e,t){return!yr(e)||!br(e)||typeof t!=`number`||e.files[0].size<=t}function Ir(e,t){if(!yr(e)||!br(e)||typeof t!=`string`)return!0;let n=e.files[0];return t.split(`,`).map(e=>e.trim().toLowerCase()).some(e=>e.startsWith(`.`)?n.name.toLowerCase().endsWith(e):e.endsWith(`/*`)?n.type.startsWith(e.replace(`/*`,`/`)):n.type===e)}function Lr(e,t,n,r,i,a=``){(!(n instanceof HTMLInputElement)||n.type!==`checkbox`)&&(n.classList.remove(`is-valid`),n.classList.add(`is-invalid`));let o=a||e?.messages[r]?.[i]||``;if(!o)return;t.message=o;let s=_r(n);if(!s)return;let c=q(`[data-validator-help]`,s).find(e=>e.dataset.validatorHelp===r)||null;c||(c=f(`div`,{className:`help-block is-invalid`,"data-validator-help":r}),s.appendChild(c)),c.textContent=o}function Rr(e){let t=_r(e);if(t)for(let n of q(`[data-validator-help]`,t))n.dataset.validatorHelp===e.name&&n.remove();(!(e instanceof HTMLInputElement)||e.type!==`checkbox`)&&(e.classList.remove(`is-invalid`),e.classList.add(`is-valid`))}function zr(e,t={},n=!1){U(`bindEvents`,n,`boolean`,`Validator`);let r=G(e);if(!(r instanceof HTMLFormElement))throw Error(`Validator.element expects a form element.`);let i=r,a=pr(t),o=gr(),s=J(),c,l=(e,t)=>{if(typeof t!=`function`)return!0;let n=t(e,c);return typeof n==`string`?n:!!n},u=(e,t)=>{let n=a?.rules[t];if(!n)return!0;for(let r of Object.keys(n)){let s=n[r],c=``;switch(r){case`required`:o.valid=xr(e,s);break;case`minLength`:o.valid=Sr(e,s);break;case`maxLength`:o.valid=Cr(e,s);break;case`equalTo`:o.valid=Tr(i,e,s);break;case`email`:o.valid=wr(e);break;case`checked`:o.valid=Er(e,s);break;case`selected`:o.valid=Dr(e,s);break;case`multiple`:o.valid=Or(e,s);break;case`min`:o.valid=kr(e,s);break;case`max`:o.valid=Ar(e,s);break;case`noSpace`:o.valid=jr(e,s);break;case`noChinese`:o.valid=!/[\u4e00-\u9fa5]/.test(e.value);break;case`noSpecial`:o.valid=!/[@#$%^&*]+/g.test(e.value);break;case`pattern`:o.valid=Mr(e,s);break;case`file`:o.valid=Nr(e,s);break;case`minSize`:o.valid=Pr(e,s);break;case`maxSize`:o.valid=Fr(e,s);break;case`accept`:o.valid=Ir(e,s);break;case`validate`:{let t=l(e,s);o.valid=t===!0,c=typeof t==`string`?t:``;break}}if(!o.valid){Lr(a,o,e,t,r,c);break}Rr(e)}return o.valid},d=()=>{if(!i||!a||o.destroyed)return!1;o.valid=!0,o.message=``;for(let e of Array.from(i.elements))if(!(!mr(e)||!e.name)&&a.rules[e.name]&&(o.valid=u(e,e.name),!o.valid))break;return o.valid&&a.onSubmit?.(c),o.valid},f=({native:e=!0}={})=>{if(i){e&&i.reset();for(let e of Array.from(i.elements))mr(e)&&e.classList.remove(`is-valid`,`is-invalid`);for(let e of q(`[data-validator-help]`,i))e.remove();o.valid=!0,o.message=``}};return c={get element(){return i},get props(){return a},set props(e){a=e},runtime:o,validate:d,reset:f,destroy:()=>{o.destroyed||(o.destroyed=!0,s.clear(),f({native:!1}),i=null,a=null,o.valid=!1,o.message=``)}},n&&(s.on(`submit`,i,`submit`,e=>{e.preventDefault(),d()}),s.on(`reset`,i,`reset`,()=>f({native:!1}))),c}const Br=new Map;function Vr(e,t){!e||!t||Br.set(e,t)}function Hr(e){Br.delete(e)}function Ur(e){typeof e==`function`?e():e&&typeof e.destroy==`function`&&e.destroy()}function Q(e){let t={built:!1,mounted:!1,destroyed:!1},n=new Map,r=new Set,i=new Map,a=null,o=null,s,c=n=>{if(t.destroyed)throw Error(`${e.name}.${n}: instance destroyed`)},l=(e,...t)=>{for(let r of n.get(e)||[])try{r(...t)}catch{}},d={props:e.props,state:e.state,runtime:t,get element(){return a},own(e){e&&r.add(e)},assertActive:c,emit:l},f={props:e.props,state:e.state,runtime:t,get element(){return a},build(){if(c(`build`),t.built)return s;let n=yn(()=>e.view(d),{removeOnDispose:e.ownsElement});return a=n.element,o=n.dispose,t.built=!0,e.onBuild?.(d),l(`build`,s),s},mount(n){if(c(`mount`),t.built||s.build(),!a)throw Error(`${e.name}.mount: view did not create an element.`);return a.parentNode!==n&&n.appendChild(a),t.mounted=!0,e.onMount?.(d),l(`mount`,s,n),s},unmount(){return c(`unmount`),!t.mounted&&!a?.parentNode?s:(e.onUnmount?.(d),e.ownsElement!==!1&&a?.remove(),t.mounted=!1,l(`unmount`,s),s)},setState(t={},n){c(`setState`);let r=typeof t==`string`&&arguments.length>1?{[t]:n}:t;if(!B(r))throw Error(`${e.name}.setState: expects a plain object patch.`);let i=e.normalizeStatePatch?e.normalizeStatePatch(r):r;if(!B(i))throw Error(`${e.name}.setState: expects a plain object patch.`);if(e.validateStatePatch)e.validateStatePatch(i,e.state);else for(let t of Object.keys(i))if(!Object.hasOwn(e.state,t))throw Error(`${e.name}.setState: "${t}" is not a supported state key.`);return u(()=>{Object.assign(e.state,i)}),s},own(e){return e&&r.add(e),s},use(e,t){if(!e)return s;let n=typeof e==`function`?e(s,t):e.install(s,t);return i.set(e,n),s},on(e,t){if(!e||typeof t!=`function`)return s;let r=n.get(e);return r||(r=new Set,n.set(e,r)),r.add(t),s},off(e,t){return n.get(e)?.delete(t),s},emit(e,...t){return l(e,...t),s},destroy(){if(!t.destroyed){t.destroyed=!0,e.onDestroy?.(d),l(`destroy`,s);for(let e of r)try{Ur(e)}catch{}r.clear();for(let e of i.values())try{Ur(e)}catch{}i.clear(),o?.(),o=null,e.ownsElement!==!1&&a?.remove(),a=null,t.built=!1,t.mounted=!1,n.clear()}}};s=Object.assign(f,e.actions||{});for(let e of Br.values())s.use(e);return s}const Wr={toc:`j-toc`,list:`toc-list`,link:`toc-link`,active:`is-active`,levelPrefix:`is-level-`},Gr={target:{default:`.j-content`},headings:{default:`h2, h3`,type:`string`},offset:{default:80,type:`number`,min:0},reactive:{default:!1,type:`boolean`},className:{default:Wr,type:`object`,normalize:e=>({...Wr,...e&&typeof e==`object`?e:{}})},onChange:{default:null,types:[`function`,`null`]}};function Kr(e){let t=W(e,Gr,`Toc.props`);return{target:t.target,headings:t.headings,offset:t.offset,reactive:t.reactive,className:t.className,onChange:t.onChange}}function qr(e){let t=/^H([1-6])$/.exec(e.tagName);return t?Number(t[1]):1}function Jr(e,t){return e.id||=`toc-${Y()}-${t}`,{id:e.id,text:e.textContent||``,level:qr(e)}}function Yr(e={}){let n=Kr(e),r=i({items:[],current:{index:-1,item:null}}),a={ticking:!1,frameId:0,refreshing:!1,refreshFrameId:0},s=J(),c=null,l=[],d=null,p,m=o(()=>r.items),h=e=>{if(e===r.current.index)return;let t=r.items[e]||null;u(()=>{r.current={index:e,item:t}}),n.onChange?.(t,e,p)},g=()=>{if(!p.runtime.built)return;let e=-1,t=n.offset+1;for(let n=l.length-1;n>=0;n--)if(l[n].getBoundingClientRect().top<=t){e=n;break}h(e)},_=()=>{a.ticking||(a.ticking=!0,a.frameId=requestAnimationFrame(()=>{a.ticking=!1,a.frameId=0,g()}))},v=()=>{a.refreshing||(a.refreshing=!0,a.refreshFrameId=requestAnimationFrame(()=>{a.refreshing=!1,a.refreshFrameId=0,b()}))},y=(e,{activeIndex:t=-1,updateHash:r=!1}={})=>{let i=l.find(t=>t.id===e.id);if(!i)return;let a=window.scrollY||window.pageYOffset||0,o=Math.max(0,i.getBoundingClientRect().top+a-n.offset);window.scrollTo({top:o,behavior:`smooth`}),t>=0&&h(t),r&&window.history?.pushState&&window.history.pushState(null,``,`#${e.id}`)},b=()=>{if(p.runtime.destroyed||!p.runtime.built||!c)return;l=q(n.headings,c);let e=l.map(Jr);u(()=>{r.items=e,r.current={index:-1,item:null}}),g()};return p=Q({name:`Toc`,props:n,state:r,actions:{activate:e=>(p.runtime.built&&Number.isInteger(e)&&e>=0&&e<r.items.length&&y(r.items[e]),p)},view:()=>f(`nav`,{className:n.className.toc,"data-toc":`root`,children:f(`div`,{className:n.className.list,"data-toc-list":`root`,children:t({each:m,key:e=>e.id,children:(e,t)=>f(`a`,{className:()=>{let i=e();return k(n.className.link,`${n.className.levelPrefix}${i.level}`,r.current.index===t()?n.className.active:``)},href:()=>`#${e().id}`,"data-toc-index":()=>String(t()),"data-toc-target":()=>e().id,"data-active":()=>r.current.index===t()?`1`:`0`,onClick:n=>{n.preventDefault(),y(e(),{activeIndex:t(),updateHash:!0})},children:()=>e().text})})})}),onBuild(e){c=Ge(n.target,`Toc.target`),s.on(`scroll`,window,`scroll`,_,{passive:!0}),e.own(()=>s.clear()),b(),n.reactive&&(d=new MutationObserver(v),d.observe(c,{childList:!0,subtree:!0,characterData:!0}),e.own(()=>{d?.disconnect(),d=null}))},onDestroy(){a.frameId&&cancelAnimationFrame(a.frameId),a.refreshFrameId&&cancelAnimationFrame(a.refreshFrameId),a.frameId=0,a.refreshFrameId=0,a.ticking=!1,a.refreshing=!1,d?.disconnect(),d=null,c=null,l=[]}}),p}const Xr={root:`j-accordion`,header:`accordion-header`,title:`header-title`,arrow:`header-arrow j-button is-icon is-ghost is-sm`,panel:`accordion-panel`,content:`panel-content`},Zr={type:`plainObject`,shape:{name:[`string`,`null`,`undefined`],title:`renderable`,content:`renderable`,cache:[`boolean`,`undefined`],ttl:[`number`,`undefined`]}},Qr={type:`array`,nonEmpty:!0,items:Zr},$r={id:{default:null,types:[`string`,`null`],normalize:e=>typeof e==`string`?e.trim()||Y():e??Y()},active:{default:0,types:[`number`,`string`,`array`,`null`],validate:e=>e==null?!0:Array.isArray(e)?e.every(ei):ei(e),message:`expects a non-negative integer, non-empty string, array or null.`},collapsible:{default:!1,type:`boolean`},multiple:{default:!1,type:`boolean`},direction:{default:`vertical`,type:`string`,enum:[`vertical`,`horizontal`]},className:{default:Xr,type:`object`,normalize:e=>({...Xr,...e&&typeof e==`object`?e:{}})},onChange:{default:null,types:[`function`,`null`]},data:{default:[],...Qr}};function ei(e){return typeof e==`number`?Number.isInteger(e)&&e>=0:typeof e==`string`&&e.trim().length>0}function ti(e){let t=W(e,$r,`Accordion.props`);return{id:t.id,active:t.active,collapsible:t.collapsible,multiple:t.multiple,direction:t.direction,className:t.className,data:ri(t.data,!1),onChange:t.onChange}}function ni(e,t,n=!0){n&&U(String(t),e,Zr,`Accordion.data`);let r=e,i=typeof r.name==`string`?r.name.trim():``;return{...r,name:i||Y()}}function ri(e,t=!0){t&&U(`data`,e,Qr,`Accordion`);let n=new Set;return e.map((e,t)=>{let r=ni(e,t,!1),i=r.name;if(n.has(i))throw Error(`Accordion: item name "${i}" must be unique.`);return n.add(i),r})}function ii(e,t,n){if(e==null)return[];let r=Array.isArray(e)?e:[e],i=[];for(let e of r){let r=t[typeof e==`number`?e:t.findIndex(t=>t.name===e)]?.name;if(r&&(i.push(r),!n))break}return Array.from(new Set(i))}function ai(e,t,n){let r=new Set(t.map(e=>e.name).filter(Boolean)),i=e.filter(e=>r.has(e));return n?i:i.slice(0,1)}function oi(e,t){let n=e[0]||null;if(!n)return{index:null,name:null};let r=t.findIndex(e=>e.name===n);return r>=0?{index:r,name:n}:{index:null,name:null}}function si(e){return typeof e==`number`&&e>0?e:0}function ci(e){let n=ti(e),r=ii(n.active,n.data,n.multiple),o=i({data:n.data,activeNames:r,loading:!1}),s=new WeakMap,l=vn(),d=vn(),m=new Map,h=new Map,g=new Map,_=new Set(r),v=Promise.resolve(),y=0,b=0,x=!1,S,C=e=>(typeof e.name==`string`?e.name.trim():``)||(s.has(e)||s.set(e,Y()),s.get(e)),T=()=>{let e=o.data.map(e=>({...e,name:C(e)}));return oi(ai(o.activeNames,e,n.multiple),e)},E=e=>o.activeNames.includes(e),D=()=>{b+=1,!x&&!S.runtime.destroyed&&(x=!0,u(()=>{o.loading=!0}))},O=()=>{b=Math.max(0,b-1),b===0&&x&&!S.runtime.destroyed&&(x=!1,u(()=>{o.loading=!1}))},k=e=>typeof e==`number`?e:typeof e==`string`?o.data.findIndex(t=>C(t)===e):-1,A=e=>{let t=new Set(e),n=new Set([..._,...t]),r=[];for(let e of n){let n=_.has(e),i=t.has(e);if(n===i)continue;let a=d.get(e);a&&(a.inert=!i);let o=m.get(e);o&&r.push(i?o.enter():o.leave())}return _=t,r.length>0&&(v=Promise.all(r).then(()=>void 0)),v},j=e=>t=>{d.bind(e)(t),m.get(e)?.cancel();let r=Lt(()=>d.get(e),{axis:n.direction,options:{duration:250,easing:`ease`}});m.set(e,r);let i=E(e);t.inert=!i,r.setExpanded(i),p(()=>{m.get(e)===r&&(r.cancel(),m.delete(e),_.delete(e),o.activeNames.includes(e)&&u(()=>{o.activeNames=o.activeNames.filter(t=>t!==e)}))})},M=async e=>{if(S.runtime.destroyed)throw Error(`Accordion.activate: instance destroyed`);if(!S.runtime.built)throw Error(`Accordion.activate: call build() first.`);let t=k(e),r=o.data[t];if(!r)return;let i=C(r),a=E(i);if(a&&!n.multiple&&!n.collapsible)return;let s;if(n.multiple)if(a){let e=o.activeNames.filter(e=>e!==i);s=!n.collapsible&&e.length===0?[...o.activeNames]:e}else s=[...o.activeNames,i];else s=a?n.collapsible?[]:[...o.activeNames]:[i];u(()=>{o.activeNames=s});let c=A(s),f=s.includes(i)&&g.get(i)?.()||Promise.resolve(),p=l.get(i),m=d.get(i),h=n.onChange&&p&&m?f.then(()=>n.onChange?.(t,i,p,m,S)):Promise.resolve();await Promise.all([c,h])},N=(e,t,n)=>{let r=C(e);return{accordion:S,item:e,index:t,type:n,active:E(r)}},P=(e,t,n)=>typeof e==`function`?e(N(t,n,`title`)):e,F=(e,t,n)=>{let r=e().content,[i,o]=c(typeof r==`function`?null:r),[s,l]=c(!1),u=r,d=0,f=null,m=()=>N(e(),t(),`content`),_=async()=>{let t=e(),r=t.content;if(typeof r!=`function`){o(r);return}let i=t.cache?h.get(n):null,a=si(t.ttl);if(i&&(!a||Date.now()-i.updatedAt<=a)){o(i.content);return}if(f)return f;let s=++d;y+=1;let c=y;l(!0),D();let u=Promise.resolve().then(()=>r(m())).then(t=>{s!==d||S.runtime.destroyed||(e().cache&&h.set(n,{content:t,updatedAt:Date.now()}),o(t))}).finally(()=>{s===d&&!S.runtime.destroyed&&l(!1),c<=y&&O(),f===u&&(f=null)});return f=u,u};return g.set(n,_),p(()=>{d+=1,h.delete(n),g.delete(n),f=null}),a(()=>{let t=e().content;t!==u&&(u=t,d+=1,f=null,h.delete(n),o(typeof t==`function`?null:t)),E(n)&&_()}),{loading:s,isAsync:()=>typeof e().content==`function`,render:()=>{if(s())return kn(`flex-start`,`flex-start`);let e=i();return typeof e==`function`?e(m()):e}}},I=(e,t)=>{let r=C(e()),i=F(e,t,r),a=`${n.id}_header_${r}`,o=`${n.id}_panel_${r}`;return[f(`div`,{className:n.className.header,id:a,"data-accordion-header":r,role:`button`,tabindex:`0`,"aria-controls":o,"aria-expanded":()=>E(r)?`true`:`false`,ref:l.bind(r),onClick:()=>void M(r),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),M(r))},children:[f(`span`,{className:n.className.title,"data-accordion-title":r,role:`heading`,children:()=>{let n=e();return P(n.title,n,t())}}),f(`span`,{className:n.className.arrow,"data-accordion-arrow":r,"aria-hidden":`true`,children:w(`arrow-down`)})]}),f(`div`,{className:n.className.panel,"data-accordion-panel":r,id:o,role:`region`,"aria-labelledby":a,"aria-hidden":()=>E(r)?`false`:`true`,"aria-live":()=>i.isAsync()?`polite`:null,"aria-busy":()=>String(i.loading()),"data-state":()=>E(r)?`open`:`closed`,ref:j(r),children:f(`div`,{className:n.className.content,"data-accordion-content":r,children:i.render})})]};return S=Q({name:`Accordion`,props:n,state:o,actions:{isActive:E,getIndex:k,activate:M},normalizeStatePatch(e){return{...e,...Object.hasOwn(e,`data`)?{data:ri(e.data)}:{}}},view:()=>{let e=f(`div`,{className:n.className.root,id:n.id,"data-accordion":`root`,"data-direction":n.direction,children:t({each:()=>o.data,key:e=>C(e),children:(e,t)=>I(e,t)})});return _=new Set(o.activeNames),a(()=>{A([...o.activeNames])}),e},onDestroy(){y+=1,b=0,x=!1,h.clear(),g.clear();for(let e of m.values())e.cancel();m.clear(),l.clear(),d.clear()}}),Object.defineProperty(S,"current",{enumerable:!0,get:T}),S}const li={form:`j-form`,vertical:`is-vertical`,horizontal:`is-horizontal`,itemVertical:`is-item-vertical`,itemHorizontal:`is-item-horizontal`,item:`form-item`,label:`item-label`,required:`is-required`,control:`form-control`,helpInvalid:`is-invalid`,buttons:`form-buttons`,button:`j-button`,input:`j-input`,textarea:`j-textarea`,select:`j-select`,radio:`j-radio`,checkbox:`j-checkbox`,choiceVertical:`is-vertical`,choiceHorizontal:`is-horizontal`,choiceGroup:`is-group`,radioLabel:`radio-label`,radioText:`radio-text`,switch:`j-switch`,switchDefault:`is-default`,switchSizeMd:`is-md`,switchSlider:`switch-slider`},ui=[{type:`submit`,text:`Submit`,theme:`primary`,action:`submit`},{type:`reset`,text:`Reset`,theme:`ghost`,action:`reset`}],di={id:{default:null,types:[`string`,`null`],normalize:e=>typeof e==`string`?e.trim()?e.trim():Y():e??Y()},vertical:{default:!0,type:`boolean`},itemVertical:{default:!0,type:`boolean`},style:{default:``,types:[`string`,`object`,`null`]},fields:{default:[],type:`array`},buttons:{default:ui,types:[`boolean`,`array`],normalize:e=>e===!1?[]:e===!0?gi(ui):Array.isArray(e)?gi(e):e},className:{default:li,type:`object`,normalize:e=>xi(e)},validator:{default:{},type:`object`},onSubmit:{default:null,types:[`function`,`null`]},onReset:{default:null,types:[`function`,`null`]}};function fi(e){return Array.isArray(e)?e.map(e=>e&&typeof e==`object`?{...e}:e):[]}function pi(e){return{...e,options:fi(e.options)}}function mi(e){return{...e.id?{id:e.id}:{},type:e.type,payload:pi(e.payload),next:e.next||null}}function hi(e){return Array.isArray(e)?e.map(e=>mi(e)):[]}function gi(e){return Array.isArray(e)?e.map(e=>({...e})):[]}function _i(e,t){let n=[],r=Array.isArray(e)?e:[],i=new WeakSet,a=e=>{let t=r.indexOf(e);return t>=0&&r[t+1]||null};for(let e of r){if(i.has(e))continue;let r=e,o=[],s=0;for(;r&&s<1e3&&(s+=1,!i.has(r));){i.add(r),n.push(r),o.push(r);let e=r.next?r.next(r,o):a(r);r=e?t(e):null}}return n}function vi(e){return e&&typeof e==`object`?e:{value:e,text:String(e)}}function yi(e){return e==null?``:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):e.name}function bi(e,t){return e.name?!!e.required||!!t?.[e.name]?.required:!!e.required}function xi(e){return{...li,...B(e)?e:{}}}function Si(e,t){if(e.removeAttribute(`style`),!t)return;if(typeof t==`string`){e.style.cssText=t;return}if(!B(t))return;let n=t;for(let[t,r]of Object.entries(n)){if(r==null||typeof r!=`string`&&typeof r!=`number`)continue;let n=t.startsWith(`--`)?t:t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);e.style.setProperty(n,String(r))}}function Ci(e){let t=B(e)?e:{};return{...t,rules:B(t.rules)?t.rules:{},messages:B(t.messages)?t.messages:{}}}function wi(e){let t=W(e,di,`Form.props`),n=hi(t.fields);return{...t,id:String(t.id),vertical:!!t.vertical,itemVertical:!!t.itemVertical,style:t.style,fields:n,buttons:gi(t.buttons),className:xi(t.className),validator:Ci(t.validator),onSubmit:t.onSubmit,onReset:t.onReset}}function Ti(e){return{...e,fields:hi(e.fields),buttons:gi(e.buttons),className:xi(e.className),validator:Ci(e.validator)}}function Ei(e){return e===`password`?`current-password`:e===`email`?`email`:`on`}function Di(e,t){return Array.isArray(e)?e.map(e=>yi(e)).includes(yi(t)):e==t}function Oi(e,t,n){return n===void 0?Array.isArray(e)?e.map(e=>yi(e)).includes(yi(t)):typeof e!=`string`&&typeof e!=`boolean`&&!(e instanceof File)?!1:e===!0||yi(e)===yi(t):n}function ki(e){return e instanceof RadioNodeList?Array.from(e):[e]}function Ai(e={}){let n=wi(e),r=Ti(n),s=i({...Ti(n),submitting:!1,data:null}),l={initial:r,fieldIds:new Map},d=new WeakMap,[p,m]=c(0),h=new WeakMap,g=null,_,v=e=>{if(s.fields.includes(e))return e;let t=h.get(e);if(t)return t;let n=i(mi(e));return h.set(e,n),n},y=o(()=>(p(),_i(s.fields,v))),b=e=>e.id?`id:${e.id}`:e.name?`name:${e.name}`:(d.has(e)||d.set(e,Y()),d.get(e)),x=(e,t)=>{if(e.id)return`item:${e.id}`;let n=e.payload;return n&&typeof n==`object`?`${b(n)}:${e.type}`:`item:${e.type}:${t}`},S=(e,t)=>{if(e.id)return e.id;let n=e.name||t;return l.fieldIds.has(n)||l.fieldIds.set(n,`${s.id}_field_${t}`),l.fieldIds.get(n)},C=()=>{let e=_.element;if(!e)return;let t={...s.validator,onSubmit:null};if(g?.element===e){g.props=t;return}g?.destroy(),g=zr(e,t,!1)},w=()=>g?.validate()??!0,T=()=>{let e=_.element;if(e){for(let t of Array.from(e.elements))t.classList.remove(`is-valid`,`is-invalid`);for(let t of q(`[data-form-help], [data-validator-help]`,e))(t.dataset.validatorHelp||t.classList.contains(`is-invalid`))&&t.remove()}},E=()=>{let e={};if(!_.element)return e;for(let[t,n]of new FormData(_.element).entries())Object.hasOwn(e,t)?e[t]=Array.isArray(e[t])?[...e[t],n]:[e[t],n]:e[t]=n;return e},D=async e=>{if(e.preventDefault(),s.submitting||!w())return;let t=E();u(()=>{s.submitting=!0,s.data=t});try{await Promise.resolve(s.onSubmit?.(t,_))}finally{_.runtime.destroyed||u(()=>{s.submitting=!1})}},O=e=>{if(!e.name||!_.element)return[];let t=_.element.elements.namedItem(e.name);return t?ki(t).filter(e=>e instanceof Element):[]},A=(e,t,n=`text`)=>{u(()=>{if(t instanceof HTMLSelectElement){e.value=t.multiple?Array.from(t.selectedOptions).map(e=>e.value):t.value;return}if(t instanceof HTMLTextAreaElement){e.value=t.value;return}if(n===`switch`){e.checked=t.checked,e.value=t.checked?t.value:``;return}if(n===`radio`){t.checked&&(e.value=t.value);return}if(n===`checkbox`){if(Array.isArray(e.options)){e.value=O(e).filter(e=>e instanceof HTMLInputElement&&e.checked).map(e=>e.value);return}e.checked=t.checked,e.value=t.checked?t.value:``;return}e.value=t.value,t.type===`checkbox`&&(e.checked=t.checked)}),m(e=>e+1)},j=(e,t,n)=>({...n,name:e.name,id:t,placeholder:e.placeholder||``,required:!!e.required,disabled:()=>s.submitting||!!e.disabled,readonly:!!e.readonly,"data-form-field":e.name||t}),M=(e,t,n)=>{let r=e.vertical?`vertical`:`horizontal`,i=s.className;return f(`div`,{className:k(n===`radio`?i.radio:i.checkbox,r===`vertical`?i.choiceVertical:i.choiceHorizontal,e.group?i.choiceGroup:``,e.size?`is-${e.size}`:``),"data-form-choice-group":e.name||t,"data-choice-type":n,"data-choice-layout":r,children:(e.options||[]).map((r,a)=>{let o=vi(r),c=`${t}_${a}`;return f(`label`,{className:n===`radio`?i.radioLabel:``,"data-form-choice":e.name||t,for:c,children:[f(`input`,{type:n,id:c,name:e.name,value:o.value??``,checked:n===`radio`?Di(e.value,o.value):Oi(e.value,o.value,o.checked),disabled:()=>s.submitting||!!o.disabled||!!e.disabled,required:!!e.required,onChange:t=>{let r=t.currentTarget;r instanceof HTMLInputElement&&A(e,r,n)}}),f(`span`,{className:n===`radio`?i.radioText:``,"data-form-choice-text":``,children:o.text??o.label??o.value??``})]})})})},N=(e,t,n,r,i)=>{let a=s.className;if(e===`textarea`)return f(`textarea`,j(t,n,{className:t.className||a.textarea,autocomplete:t.autocomplete,value:t.value??``,onInput:e=>{let n=e.currentTarget;n instanceof HTMLTextAreaElement&&A(t,n,`textarea`)}}));if(e===`select`)return f(`select`,j(t,n,{className:t.className||a.select,autocomplete:t.autocomplete||`off`,multiple:!!t.multiple,onChange:e=>{let n=e.currentTarget;n instanceof HTMLSelectElement&&A(t,n,`select`)},children:(t.options||[]).map(e=>{let n=vi(e);return f(`option`,{value:n.value??``,disabled:!!n.disabled,selected:Di(t.value,n.value),children:n.text??n.label??n.value??``})})}));if(e===`radio`)return M(t,n,`radio`);if(e===`checkbox`&&Array.isArray(t.options))return M(t,n,`checkbox`);if(e===`switch`)return f(`label`,{className:k(a.switch,t.variant?`is-${t.variant}`:a.switchDefault,t.size?`is-${t.size}`:a.switchSizeMd),"data-form-switch":t.name||n,for:n,children:[f(`input`,{type:`checkbox`,id:n,name:t.name,value:t.value??`1`,checked:!!t.checked,disabled:()=>s.submitting||!!t.disabled,required:!!t.required,onChange:e=>{let n=e.currentTarget;n instanceof HTMLInputElement&&A(t,n,`switch`)}}),f(`span`,{className:a.switchSlider,"data-form-switch-slider":``})]});if(e===`custom`)return typeof t.content==`function`?t.content({form:_,field:t,index:r,item:i}):t.content;let o=e||`text`;return f(`input`,{...j(t,n,{type:o,className:t.className||a.input,autocomplete:t.autocomplete||Ei(o),value:t.value??``,onInput:e=>{let n=e.currentTarget;n instanceof HTMLInputElement&&A(t,n,o)}}),checked:t.checked===void 0?void 0:!!t.checked})},P=(e,t)=>{let n=e(),r=n.payload,i=()=>e().payload,a=t(),o=S(r,a);return f(`div`,{className:()=>s.className.item,"data-form-item":()=>i().name||String(t()),style:()=>({display:e().type===`hidden`?`none`:``}),children:[()=>{let e=i();return e.label===!1||e.label===void 0?null:f(`label`,{className:()=>k(s.className.label,bi(i(),s.validator.rules)?s.className.required:``),"data-form-label":()=>i().name||o,for:o,children:()=>i().label})},f(`div`,{className:()=>s.className.control,"data-form-control":()=>i().name||String(t()),children:[N(n.type,r,o,a,n),()=>i().help?f(`div`,{className:`help-block`,"data-form-help":()=>i().name||String(t()),children:()=>i().help}):null]})]})},F=(e,t)=>P(e,t),I=()=>f(`div`,{className:()=>s.className.buttons,"data-form-buttons":``,hidden:()=>s.buttons.length===0,children:t({each:()=>s.buttons,key:(e,t)=>`${e.action||e.type||`button`}:${t}`,children:e=>f(`button`,{type:()=>e().type||`button`,className:()=>{let t=e();return k(s.className.button,t.theme?`is-${t.theme}`:``,t.className||``)},"data-action":()=>{let t=e();return t.action||t.type||`button`},disabled:()=>s.submitting||!!e().disabled,children:()=>{let t=e(),n=t.text??t.label??``;return s.submitting&&(t.type===`submit`||t.action===`submit`)?[kn(),n]:n}})})});return _=Q({name:`Form`,props:n,state:s,actions:{validate:w,reset(){return g?.reset(),u(()=>{s.data=null}),_},collectData:E,requestSubmit(){let e=_.element;return e&&(typeof e.requestSubmit==`function`?e.requestSubmit():e.dispatchEvent(new Event(`submit`,{bubbles:!0,cancelable:!0}))),_},setFields(e){return U(`fields`,e,`array`,`Form.setFields`),l.fieldIds.clear(),h=new WeakMap,u(()=>{s.fields=hi(e)}),_},resetFields(){return l.fieldIds.clear(),h=new WeakMap,u(()=>{s.fields=hi(r.fields)}),_}},normalizeStatePatch(e){return{...e,...Object.hasOwn(e,`fields`)?{fields:hi(e.fields)}:{},...Object.hasOwn(e,`buttons`)?{buttons:gi(e.buttons)}:{},...Object.hasOwn(e,`className`)?{className:xi(e.className)}:{},...Object.hasOwn(e,`validator`)?{validator:Ci(e.validator)}:{}}},view:()=>{let e=f(`form`,{className:()=>k(s.className.form,s.vertical?s.className.vertical:s.className.horizontal,s.itemVertical?s.className.itemVertical:s.className.itemHorizontal),id:()=>s.id,"data-form":`root`,"data-form-layout":()=>s.vertical?`vertical`:`horizontal`,"data-form-item-layout":()=>s.itemVertical?`vertical`:`horizontal`,onSubmit:e=>void D(e),onReset:e=>{T(),u(()=>{s.data=null}),s.onReset?.(e,_)},children:[t({each:y,key:x,children:F}),I()]});return a(()=>Si(e,s.style)),a(()=>{g&&(g.props={...s.validator,onSubmit:null})}),e},onBuild(){C()},onDestroy(){g?.destroy(),g=null,l.fieldIds.clear(),h=new WeakMap}}),_}const ji={root:`j-flow`,header:`flow-header`,steps:`flow-steps`,step:`flow-step`,active:`is-active`,complete:`is-complete`,stepButton:`flow-step-button`,stepIndex:`flow-step-index`,stepTitle:`flow-step-title`,body:`flow-body`,footer:`flow-footer`,button:`j-button`,reset:`is-ghost flow-reset`,back:`is-ghost flow-back`,next:`is-primary flow-next`},Mi={type:`plainObject`,shape:{id:{type:`string`,nonEmpty:!0}}},Ni={type:`renderable`},Pi={types:[`plainObject`,`null`,`undefined`]};function $(e){return B(e)?{...e}:{}}function Fi(e){return Array.isArray(e)?e.map(e=>{let t={...e};return delete t.description,delete t.view,{...t,data:$(t.data),modal:typeof t.modal==`function`||t.modal==null?t.modal:$(t.modal)}}):[]}function Ii(e){return typeof e==`string`?{...ji,root:[ji.root,e.trim()].filter(Boolean).join(` `)}:{...ji,...B(e)?e:{}}}function Li(e,t){if(typeof e==`string`)return{id:e};if(!B(e))return{id:t};let n=e;return typeof n.id==`string`?{id:n.id,data:B(n.data)||n.data==null?n.data:void 0}:{id:t}}const Ri={id:{default:null,types:[`string`,`null`],normalize:e=>typeof e==`string`&&e.trim()||Y()},steps:{default:[],type:`array`,nonEmpty:!0},initial:{default:null,types:[`string`,`number`,`null`]},cache:{default:!0,type:`boolean`},linear:{default:!0,type:`boolean`},render:{default:!0,type:`boolean`},rollbackOnError:{default:!0,type:`boolean`},busyStrategy:{default:`ignore`,type:`string`,enum:[`ignore`,`throw`]},showBack:{default:!0,type:`boolean`},showNext:{default:!0,type:`boolean`},showReset:{default:!1,type:`boolean`},text:{default:{},type:`plainObject`,normalize:e=>{let t=B(e)?e:{};return{back:typeof t.back==`string`?t.back:`Back`,next:typeof t.next==`string`?t.next:`Next`,finish:typeof t.finish==`string`?t.finish:`Finish`,reset:typeof t.reset==`string`?t.reset:`Reset`}}},className:{default:ji,types:[`object`,`string`],normalize:Ii},renderHeader:{default:null,validate:e=>e==null||e===!1||typeof e==`function`},renderBody:{default:null,validate:e=>e==null||e===!1||typeof e==`function`},renderFooter:{default:null,validate:e=>e==null||e===!1||typeof e==`function`},onChange:{default:null,types:[`function`,`null`]},onNext:{default:null,types:[`function`,`null`]},onBack:{default:null,types:[`function`,`null`]},onFinish:{default:null,types:[`function`,`null`]},onError:{default:null,types:[`function`,`null`]},onBusy:{default:null,types:[`function`,`null`]}};function zi(e){let t=W(e,Ri,`Flow.props`);return{id:t.id,steps:Fi(t.steps),initial:t.initial,cache:t.cache,linear:t.linear,render:t.render,rollbackOnError:t.rollbackOnError,busyStrategy:t.busyStrategy,showBack:t.showBack,showNext:t.showNext,showReset:t.showReset,text:t.text,className:t.className,renderHeader:t.renderHeader,renderBody:t.renderBody,renderFooter:t.renderFooter,onChange:t.onChange,onNext:t.onNext,onBack:t.onBack,onFinish:t.onFinish,onError:t.onError,onBusy:t.onBusy}}function Bi(e={}){let t=zi(e),n=t.steps,r=new Map;for(let[e,t]of n.entries()){if(U(String(e),t,Mi,`Flow.props.steps`),U(`content`,t.content??null,Ni,`Flow.props.steps.${e}`),r.has(t.id))throw Error(`Flow.props.steps: duplicated step id "${t.id}".`);r.set(t.id,e)}let a=(()=>{if(typeof t.initial==`number`){let e=n[t.initial];if(!e)throw Error(`Flow.props.initial index is out of range.`);return e.id}if(typeof t.initial==`string`){if(!r.has(t.initial))throw Error(`Flow.props.initial step "${t.initial}" does not exist.`);return t.initial}return n[0].id})(),o={},s={};for(let e of n)o[e.id]=$(e.data),Object.assign(s,o[e.id]);let c=i({id:t.id,currentId:a,currentIndex:r.get(a)??0,previousId:null,previousIndex:null,direction:null,history:[a],data:$(s),stepData:$(o),loading:!1,error:null,busyAction:null,version:0}),l={built:!1,mounted:!1,destroyed:!1,activeAction:null,actionController:null},d=new Set,p=new Set,m=null,h,g=e=>{if(l.destroyed)throw Error(`Flow.${e}: instance has been destroyed.`)},_=()=>n[c.currentIndex],v=e=>$(c.stepData[e]),y=e=>{if(!e)return null;let{onEnter:t,onLeave:n,onNext:r,onBack:i,canEnter:a,canLeave:o,...s}=e;return s},b=()=>({id:c.id,currentId:c.currentId,currentIndex:c.currentIndex,previousId:c.previousId,previousIndex:c.previousIndex,direction:c.direction,history:[...c.history],data:$(c.data),stepData:$(c.stepData),currentData:v(c.currentId),currentStep:y(_()),canBack:c.currentIndex>0&&!c.loading,canNext:c.currentIndex<n.length-1&&!c.loading,isLast:c.currentIndex===n.length-1,loading:c.loading,busyAction:c.busyAction,error:c.error}),x=(e=null)=>{let n=b();for(let t of d)t(n,h,e);t.onChange?.(n,h,e)},S=(e,t)=>{for(let t of Object.keys(e))delete e[t];Object.assign(e,t)},C=(e,n,i={})=>(g(`setStepData`),U(`stepId`,e,{type:`string`},`Flow.setStepData`),U(`data`,n,Pi,`Flow.setStepData`),!n||!r.has(e)?h:(u(()=>{c.stepData[e]={...$(c.stepData[e]),...n},t.cache&&Object.assign(c.data,n),c.version+=1}),i.silent||x(),h)),w=e=>(g(`setData`),U(`data`,e,Pi,`Flow.setData`),e?(u(()=>{Object.assign(c.data,e),c.version+=1}),x(),h):h),T=e=>{if(typeof e!=`function`)throw Error(`Flow.addCleanup: cleanup expects a function.`);return l.destroyed?(e(),()=>{}):(p.add(e),()=>p.delete(e))},E=()=>{let e=Error(`Flow: active action was aborted.`);return e.code=`FLOW_ABORTED`,e},D=async(e,t)=>{if(typeof e!=`function`)return;let n=await e(...t);if(l.destroyed)throw E();return n},O=(e={})=>{let t=e.step||_();return{...e,flow:h,step:t,state:c,signal:l.actionController?.signal||null,snapshot:b(),data:$(c.data),currentData:v(t.id),setData:w,setStepData:(e,t)=>C(e,t),getStepData:v,next:e=>h.next(e),back:e=>h.back(e),goTo:(e,t,n)=>h.goTo(e,t,n),addCleanup:T}},k=(e,n=null)=>{u(()=>{c.error=e,c.version+=1}),t.onError?.(e,b(),h,n)},A=(e,t)=>{let n=b();(c.loading!==e||c.busyAction!==t)&&(u(()=>{c.loading=e,c.busyAction=e?t:null,c.version+=1}),x(n))},j=e=>{if(!c.loading)return null;let n=Error(`Flow: action "${e}" ignored while loading.`);if(n.code=`FLOW_BUSY`,t.onBusy?.(e,b(),h),t.busyStrategy===`throw`)throw n;return b()},M=async(e,t,n=!1)=>{let r=!n&&!c.loading;r&&(l.actionController=new AbortController,l.activeAction=e,A(!0,e));try{return await t()}catch(e){if(l.destroyed)return null;throw c.error!==e&&k(e),e}finally{r&&!l.destroyed&&(A(!1,null),l.activeAction=null,l.actionController=null)}},N=()=>({currentId:c.currentId,currentIndex:c.currentIndex,previousId:c.previousId,previousIndex:c.previousIndex,direction:c.direction,history:[...c.history],data:$(c.data),stepData:$(c.stepData),loading:c.loading,busyAction:c.busyAction,error:c.error,version:c.version}),P=e=>{u(()=>{c.currentId=e.currentId,c.currentIndex=e.currentIndex,c.previousId=e.previousId,c.previousIndex=e.previousIndex,c.direction=e.direction,c.history.splice(0,c.history.length,...e.history),S(c.data,e.data),S(c.stepData,e.stepData),c.loading=!0,c.busyAction=e.busyAction,c.error=e.error,c.version=e.version+1})},F=e=>{if(typeof e==`number`){if(!n[e])throw Error(`Flow.goTo target is out of range.`);return e}let t=r.get(e);if(t==null)throw Error(`Flow.goTo target "${e}" does not exist.`);return t},I=async(e,n,i,a)=>{let o=b(),s=N();try{if(i&&C(a.id,i,{silent:!0}),a.canLeave&&await D(a.canLeave,[O({direction:n,targetId:e.id})])===!1)throw Error(`Flow: step "${a.id}" blocked leaving.`);if(e.canEnter&&await D(e.canEnter,[O({direction:n,fromId:a.id,step:e})])===!1)throw Error(`Flow: step "${e.id}" blocked entering.`);await D(a.onLeave,[O({direction:n,step:a,targetId:e.id})]);let t=c.currentId,s=c.currentIndex;u(()=>{c.previousId=t,c.previousIndex=s,c.currentId=e.id,c.currentIndex=r.get(e.id)??0,c.direction=n,n===`back`?c.history.pop():c.history.push(e.id),c.error=null,c.version+=1}),await D(e.onEnter,[O({direction:n,fromId:t,step:e})]),x(o)}catch(e){throw l.destroyed?e:(t.rollbackOnError&&P(s),k(e,o),e)}},L=async(e,n,r,i)=>{let a=e===`back`?n.onBack:n.onNext,o=e===`back`?t.onBack:t.onNext,s=O({payload:r,targetId:i});return await D(a,[s])??await D(o,[s])??i},ee=e=>{let t=b();return{flow:h,snapshot:t,state:c,steps:n.map(y),currentStep:t.currentStep,currentData:t.currentData,data:t.data,fallback:e,next:e=>h.next(e),back:e=>h.back(e),goTo:(e,t,n)=>h.goTo(e,t,n),reset:()=>h.reset()}},R=(e,n)=>{let r=t[e];return r===!1?null:typeof r==`function`?()=>c.version>=0?r(ee(n)):null:n()},te=()=>{let e=_().content;return typeof e==`function`?e(O()):e??``},ne=()=>Q({name:`FlowView`,props:{},state:c,view:()=>f(`div`,{className:t.className.root,id:t.id,role:`group`,"data-flow":`root`,"aria-busy":()=>c.loading?`true`:`false`,children:[f(`div`,{className:t.className.header,"data-flow-header":``,children:R(`renderHeader`,()=>f(`ol`,{className:t.className.steps,"data-flow-steps":``,role:`list`,"aria-label":`Flow steps`,children:n.map((e,n)=>f(`li`,{className:()=>[t.className.step,n===c.currentIndex?t.className.active:``,n<c.currentIndex?t.className.complete:``].filter(Boolean).join(` `),"data-flow-step":e.id,"data-flow-step-index":String(n),"aria-current":()=>n===c.currentIndex?`step`:null,children:f(`button`,{type:`button`,className:t.className.stepButton,disabled:()=>t.linear&&n>c.currentIndex,"aria-current":()=>n===c.currentIndex?`step`:null,onClick:()=>{n!==c.currentIndex&&h.goTo(n)},children:[f(`span`,{className:t.className.stepIndex,"data-flow-step-number":``,children:n+1}),f(`span`,{className:t.className.stepTitle,"data-flow-step-title":``,children:e.title||e.id})]})}))}))}),f(`div`,{className:t.className.body,"data-flow-body":``,role:`region`,"aria-live":`polite`,"aria-busy":()=>c.loading?`true`:`false`,children:R(`renderBody`,()=>()=>c.version>=0?te():null)}),f(`div`,{className:t.className.footer,"data-flow-footer":``,children:R(`renderFooter`,()=>[t.showReset?f(`button`,{type:`button`,className:[t.className.button,t.className.reset].filter(Boolean).join(` `),"data-action":`reset`,onClick:()=>h.reset(),disabled:()=>c.loading,children:t.text.reset}):null,t.showBack?f(`button`,{type:`button`,className:[t.className.button,t.className.back].filter(Boolean).join(` `),"data-action":`back`,onClick:()=>void h.back(),disabled:()=>!h.canBack,children:t.text.back}):null,t.showNext?f(`button`,{type:`button`,className:[t.className.button,t.className.next].filter(Boolean).join(` `),"data-action":`next`,onClick:()=>void h.next(),disabled:()=>c.loading,children:()=>h.isLast?t.text.finish:t.text.next}):null])})]})});return h={props:t,steps:n,state:c,runtime:l,get element(){return m?.element||null},get currentStep(){return _()},get currentData(){return v(c.currentId)},get canBack(){return c.currentIndex>0&&!c.loading},get canNext(){return c.currentIndex<n.length-1&&!c.loading},get isLast(){return c.currentIndex===n.length-1},build(){return g(`build`),l.built?h:(t.render&&(m||=ne(),m.build()),l.built=!0,h)},mount(e){return g(`mount`),h.build(),m&&m.mount(e),l.mounted=!!m,h},unmount(){return g(`unmount`),m?.unmount(),l.mounted=!1,h},subscribe(e){if(g(`subscribe`),typeof e!=`function`)throw Error(`Flow.subscribe: handler expects a function.`);return d.add(e),e(b(),h,null),()=>d.delete(e)},snapshot:b,async next(e=null){return g(`next`),U(`payload`,e,Pi,`Flow.next`),j(`next`)||M(`next`,async()=>{if(h.isLast)return e&&C(c.currentId,e),await D(t.onFinish,[b(),h]),b();let r=_(),i=n[c.currentIndex+1]?.id,a=Li(await L(`next`,r,e,i),i);return h.goTo(a.id,a.data??e,{direction:`next`,internal:!0})})},async back(e=null){return g(`back`),U(`payload`,e,Pi,`Flow.back`),j(`back`)||(h.canBack?M(`back`,async()=>{let t=_(),r=n[c.currentIndex-1]?.id,i=Li(await L(`back`,t,e,r),r);return h.goTo(i.id,i.data??e,{direction:`back`,internal:!0})}):b())},async goTo(e,t=null,r={}){return g(`goTo`),U(`payload`,t,Pi,`Flow.goTo`),(r.internal?null:j(`goTo`))||M(`goTo`,async()=>{let i=F(e),a=n[i],o=_();return a.id===c.currentId?(t&&C(c.currentId,t),b()):(await I(a,r.direction||`go`,t,o),b())},!!r.internal)},setData:w,setStepData:C,getStepData:v,reset(){return g(`reset`),u(()=>{c.currentId=a,c.currentIndex=r.get(a)??0,c.previousId=null,c.previousIndex=null,c.direction=null,c.history.splice(0,c.history.length,a),S(c.data,$(s)),S(c.stepData,$(o)),c.loading=!1,c.busyAction=null,c.error=null,c.version+=1}),x(),h},async finish(e=null){return g(`finish`),U(`payload`,e,Pi,`Flow.finish`),j(`finish`)||M(`finish`,async()=>(e&&C(c.currentId,e),await D(t.onFinish,[b(),h]),b()))},destroy(){if(!l.destroyed){l.destroyed=!0,l.actionController?.abort(),l.actionController=null,l.activeAction=null,m?.destroy(),m=null;for(let e of p)e();p.clear(),d.clear(),l.built=!1,l.mounted=!1,r.clear()}}},h}const Vi={layout:`j-popup-layout`,modal:`j-modal`,header:`modal-header`,body:`modal-body`,footer:`modal-footer`,title:`modal-title`,button:`j-button`,closeBtn:`is-icon is-sm is-ghost`,cancelBtn:`is-ghost`,confirmBtn:`is-primary`};function Hi(e){return{...e,text:{...e.text},className:{...e.className}}}function Ui(e){return{content:e.content,loading:!1,processing:!1,visible:!1}}function Wi(e){return!!e&&typeof e.then==`function`}function Gi(e){return Number.isFinite(e)?Math.max(0,e):0}const Ki={type:`renderable`},qi={default:{},type:`object`,plain:!0,normalize:e=>{let t=B(e)?e:{};return{...t,title:typeof t.title==`string`?t.title:`Tip`,confirm:typeof t.confirm==`string`?t.confirm:`Confirm`,cancel:typeof t.cancel==`string`?t.cancel:`Cancel`}}},Ji={content:{default:``,...Ki},cache:{default:!1,type:`boolean`},ttl:{default:0,type:`number`},position:{default:`center`,type:`string`},showCancel:{default:!0,type:`boolean`},showClose:{default:!0,type:`boolean`},fullscreen:{default:!1,type:`boolean`},text:qi,onShow:{default:null,types:[`function`,`null`]},onShown:{default:null,types:[`function`,`null`]},onHide:{default:null,types:[`function`,`null`]},onHidden:{default:null,types:[`function`,`null`]},onConfirm:{default:null,types:[`function`,`null`]},onCancel:{default:null,types:[`function`,`null`]},header:{default:!0,type:`boolean`},footer:{default:!0,type:`boolean`},id:{default:null,types:[`string`,`null`],normalize:e=>typeof e==`string`?e.trim()||Y():e??Y()},escClose:{default:!1,type:`boolean`},bgClose:{default:!1,type:`boolean`},className:{default:Vi,type:`object`,normalize:e=>({...Vi,...e&&typeof e==`object`?e:{}})}},Yi={content:Ji.content,loading:{default:!1,type:`boolean`},processing:{default:!1,type:`boolean`},visible:{default:!1,type:`boolean`}},Xi={type:`plainObject`};function Zi(e){let t=W(e,Ji,`Modal`);return{content:t.content,cache:t.cache,ttl:Gi(t.ttl),position:t.position,showCancel:t.showCancel,showClose:t.showClose,fullscreen:t.fullscreen,text:t.text,onShow:t.onShow,onShown:t.onShown,onHide:t.onHide,onHidden:t.onHidden,onConfirm:t.onConfirm,onCancel:t.onCancel,header:t.header,footer:t.footer,id:t.id,escClose:t.escClose,bgClose:t.bgClose,className:t.className}}let Qi=0,$i=``;function ea(t={}){let n=Zi(t),r=i(Ui(n)),o={initial:Hi(n),previousActiveElement:null,content:null,contentSource:null,hasContent:!1,updatedAt:0},s=new Map,[l,d]=c(!1),[p,h]=c({value:null}),g,v=null,y=null,b=!1,x=0,S=()=>r.processing,C=e=>{if(!n.cache||!o.hasContent||o.contentSource!==e)return!1;let t=Gi(n.ttl);return!t||Date.now()-o.updatedAt<=t},T=(e,t)=>{n.cache&&(o.content=t,o.contentSource=e,o.hasContent=!0,o.updatedAt=Date.now())},E=()=>{o.content=null,o.contentSource=null,o.hasContent=!1,o.updatedAt=0},D=()=>{for(let e of s.values())e();s.clear()},O=(e,t,n,r)=>{s.get(e)?.(),t.addEventListener(n,r),s.set(e,()=>t.removeEventListener(n,r))},A=()=>{b||=(Qi===0&&($i=document.body.style.overflow,document.body.style.overflow=`hidden`),Qi+=1,!0)},j=()=>{b&&=(Qi=Math.max(0,Qi-1),Qi===0&&(document.body.style.overflow=$i,$i=``),!1)},M=()=>{let e=o.previousActiveElement;o.previousActiveElement=null,e&&document.contains(e)&&e.focus()},N=On({elements:()=>[g.element,v],mount:()=>{g.mount(document.body),A()},activate:()=>d(!0),deactivate:()=>d(!1),motion:Nt(It(()=>g.element,{keyframes:[{opacity:0},{opacity:1}],options:{duration:220,easing:`ease`}}),It(()=>v,{keyframes:[{opacity:0,transform:`scale(0.96)`},{opacity:1,transform:`scale(1)`}],options:{duration:220,easing:`ease`}})),unmount:()=>{g.unmount(),j(),M()}}),P=()=>{if(r.loading||r.processing){y||=kn(),v&&y.parentElement!==v&&v.append(y);return}y?.remove(),y=null},F=e=>{r.processing!==e&&u(()=>{r.processing=e})},I=()=>{r.visible&&N.phase!==`leaving`&&F(!1)},L=(e=r.content)=>{if(C(e)){x+=1,u(()=>{h({value:o.content}),r.loading=!1});return}let t=++x;if(typeof e!=`function`){E(),u(()=>{h({value:e}),r.loading=!1});return}let n;try{n=e(g)}catch(e){console.error(`Modal.content error:`,e),u(()=>{h({value:null}),r.loading=!1});return}if(!Wi(n)){T(e,n),u(()=>{h({value:n}),r.loading=!1});return}u(()=>{r.loading=!0,h({value:null})}),Promise.resolve(n).then(n=>{g.runtime.destroyed||t!==x||(T(e,n),u(()=>{h({value:n})}))}).catch(e=>{g.runtime.destroyed||t!==x||(console.error(`Modal.content error:`,e),u(()=>{h({value:null})}))}).finally(()=>{!g.runtime.destroyed&&t===x&&u(()=>{r.loading=!1})})},ee=()=>{if(S())return;let e;try{e=n.onConfirm?.(g)}catch(e){console.error(`Modal.onConfirm error:`,e);return}Wi(e)&&(F(!0),Promise.resolve(e).catch(e=>{console.error(`Modal.onConfirm error:`,e)}).finally(()=>{g.runtime.destroyed||I()}))},R=()=>{if(S())return;let e;try{e=n.onCancel?.(g)}catch(e){console.error(`Modal.onCancel error:`,e);return}if(!Wi(e)){g.hide();return}F(!0),Promise.resolve(e).then(()=>{g.runtime.destroyed||g.hide()}).catch(e=>{console.error(`Modal.onCancel error:`,e)}).finally(()=>{g.runtime.destroyed||I()})},te=e=>{if(!v)return;let t=q(`a[href], button:not([disabled]):not([data-action=close]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`,v).filter(e=>e.offsetParent!==null||e===document.activeElement);if(!t.length){e.preventDefault(),v.focus();return}let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())},ne=()=>{if(!v)return;let e=K(`input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]):not([data-action=close]), [tabindex]:not([tabindex="-1"])`,v);e?e.focus():(v.setAttribute(`tabindex`,`-1`),v.focus())},re=()=>{let e=g.element;!e||!v||(D(),O(`root`,e,`click`,t=>{n.bgClose&&!S()&&t.target===e&&g.hide()}),O(`dialog`,v,`click`,e=>{let t=(e.target instanceof Element?e.target:null)?.closest(`[data-action]`)?.dataset.action;t===`cancel`||t===`close`?R():t===`confirm`&&ee()}),O(`keyboard`,document,`keydown`,e=>{!(e instanceof KeyboardEvent)||!r.visible||(e.key===`Escape`&&n.escClose&&!S()?(e.preventDefault(),g.hide()):e.key===`Tab`&&te(e))}))},ie=()=>{if(N.phase===`visible`||N.phase===`entering`)return;if(!g.element)throw Error(`Modal.show: build() must be called before show().`);n.onShow?.(g),o.previousActiveElement=document.activeElement instanceof HTMLElement?document.activeElement:null;let e=N.enter();re(),ne(),e.then(e=>{e&&!g.runtime.destroyed&&n.onShown?.(g)})},z=()=>{N.phase!==`hidden`&&N.phase!==`leaving`&&(n.onHide?.(g),D(),x+=1,N.leave().then(e=>{e&&!g.runtime.destroyed&&(u(()=>{r.loading=!1,r.processing=!1,n.cache||h({value:null})}),n.onHidden?.(g))}))};return g=Q({name:`Modal`,props:n,state:r,actions:{show(){if(!g.runtime.built)throw Error(`Modal.show: build() must be called before show().`);return g.setState(`visible`,!0),g},hide(){return u(()=>{r.visible=!1}),g},reset(){return g.setState({content:o.initial.content,loading:!1,processing:!1}),E(),h({value:null}),g}},normalizeStatePatch(e){return{...e}},validateStatePatch(e){U(`state`,e,Xi,`Modal.setState`);for(let t of Object.keys(e)){if(!Object.hasOwn(Yi,t))throw Error(`Modal.setState: "${t}" is not a supported state key.`);U(t,e[t],Yi[t],`Modal.setState`)}},view:()=>{v=f(`div`,{className:k(n.className.modal,n.fullscreen?`is-fullscreen`:``),id:n.id,role:`document`,"data-modal-dialog":n.id,"data-mount":()=>l()?`true`:`false`,children:[f(`div`,{className:n.className.header,hidden:()=>!n.header||r.loading,children:()=>n.header&&!r.loading?[f(`div`,{className:n.className.title,id:`${n.id}_title`,"aria-label":n.text.title,children:n.text.title}),n.showClose?f(`button`,{type:`button`,className:k(n.className.button,n.className.closeBtn),"data-action":`close`,"aria-label":e(`Close`,_),disabled:S,children:w(`close`)}):null]:null}),f(`div`,{className:n.className.body,"data-modal-body":``,children:()=>p().value}),f(`div`,{className:n.className.footer,hidden:()=>!n.footer||r.loading,children:()=>n.footer&&!r.loading?[n.showCancel?f(`button`,{type:`button`,className:k(n.className.button,n.className.cancelBtn),"data-action":`cancel`,disabled:S,children:n.text.cancel}):null,f(`button`,{type:`button`,className:k(n.className.button,n.className.confirmBtn),"data-action":`confirm`,disabled:S,children:n.text.confirm})]:null})]});let t=Mn({className:n.className.layout,position:n.position,component:`modal`,labelledby:n.header?`${n.id}_title`:``,content:v});return t.setAttribute(`data-mount`,`false`),n.header||t.setAttribute(`aria-label`,n.text.title||`Modal`),a(()=>{t.setAttribute(`data-mount`,l()?`true`:`false`)}),a(P),a(()=>{let e=r.visible;m(()=>e?ie():z())}),a(()=>{let e=r.visible,t=r.content;m(()=>{e?L(t):x+=1})}),t},onDestroy(){let e=N.phase!==`hidden`;e&&n.onHide?.(g),N.cancel(),D(),j(),M(),y?.remove(),y=null,v=null,e&&n.onHidden?.(g)}}),g}const ta={root:`j-swiper`,wrapper:`swiper-wrapper`,slide:`swiper-slide`,image:`swiper-image`,title:`swiper-slide-title`,pagination:`swiper-pagination`,paginationHorizontal:`is-horizontal`,paginationClickable:`is-clickable`,paginationBulletGroup:`is-bullet`,indicator:`swiper-pagination-indicator`,bullet:`swiper-pagination-bullet`,navigation:`swiper-navigation`,prev:`is-prev`,next:`is-next`,active:`is-active`,disabled:`is-disabled`},na={id:{default:null,types:[`string`,`null`],nonEmpty:!0,normalize:e=>typeof e==`string`?e.trim():e},data:{default:[],types:[`array`,`function`]},loop:{default:!0,type:`boolean`},autoplay:{default:!0,type:`boolean`},delay:{default:3e3,type:`number`,min:0},lazyload:{default:!0,type:`boolean`},pagination:{default:!0,type:`boolean`},navigation:{default:!0,type:`boolean`},speed:{default:300,type:`number`,min:0},touchRatio:{default:1,type:`number`,greaterThan:0},touchAngle:{default:45,type:`number`,min:0,max:90},longSwipesMs:{default:300,type:`number`,min:0},longSwipesRatio:{default:.05,type:`number`,min:0,max:1},preventClick:{default:!0,type:`boolean`},className:{default:ta,type:`object`,normalize:e=>({...ta,...e&&typeof e==`object`?e:{}})}},ra={type:`plainObject`,shape:{image:[`string`,`null`,`undefined`],url:[`string`,`null`,`undefined`],title:[`string`,`null`,`undefined`],sort:[`number`,`null`,`undefined`],blank:[`boolean`,`null`,`undefined`],children:`renderable`}},ia={data:{type:`array`},loading:{type:`boolean`},index:{type:`number`},trackIndex:{type:`number`},transform:{type:`number`},animating:{type:`boolean`},width:{type:`number`}};function aa(e){return e instanceof Element&&!!e.closest(`a, button, input, textarea, select, label, [data-swiper-ignore]`)}function oa(e,t=0){let n=Number(e);return Number.isFinite(n)?n:t}function sa(e){return Array.isArray(e)?e.map(e=>({...e})):[]}function ca(e){return Array.isArray(e)?sa(e):e}function la(e={}){let t=W(e,na,`Swiper.props`);return{...t,id:t.id?.trim()||null,data:ca(t.data),className:{...t.className}}}function ua(e={}){let n=la(e),r=i({data:sa(Array.isArray(n.data)?n.data:[]),loading:!1,index:0,trackIndex:0,transform:0,animating:!1,width:0}),s=J(),c=new WeakMap,l=new Set,d,p=null,m=[],h=()=>[],g=()=>[],_=0,v=null,y=null,b=[],x=null,S=!1,C=!1,T=!1,E=!1,D=e=>(c.has(e)||c.set(e,Y()),c.get(e)),O=e=>{let t=e.map((e,t)=>(U(String(t),e,ra,`Swiper.state.data`),{...e,blank:e.blank!==!1,index:t,key:D(e)}));return t.some(e=>e.sort!=null)?t.sort((e,t)=>e.sort==null&&t.sort==null?e.index-t.index:e.sort==null?1:t.sort==null?-1:e.sort-t.sort||e.index-t.index):t},A=e=>{let t=e.map((e,t)=>({item:e,index:t,clone:null,key:`real:${e.key}:${!!e.url}`}));if(!n.loop||e.length<=1)return t;let r=e[0],i=e[e.length-1];return[{item:i,index:e.length-1,clone:`last`,key:`clone:last:${i.key}:${!!i.url}`},...t,{item:r,index:0,clone:`first`,key:`clone:first:${r.key}:${!!r.url}`}]},j=()=>h().length,M=()=>g().length,N=(e=r.trackIndex)=>{let t=j();return t?!n.loop||t<=1?Math.max(0,Math.min(e,t-1)):e===0?t-1:e===M()-1?0:e-1:0},P=e=>{let t=j();if(!t)return 0;let r=Math.max(0,Math.min(e,t-1));return n.loop&&t>1?r+1:r},F=()=>{m=p?q(`[data-swiper-slide]`,p):[]},I=()=>{for(let e of l)e();l.clear()},L=()=>{let e=d.element;if(!e)return;let t=e.clientWidth||e.offsetWidth;(t>0||!e.isConnected||r.width===0)&&u(()=>{r.width=t})},ee=()=>!!d.element?.isConnected&&r.width>0,R=()=>(L(),ee()),te=(e,t=!0)=>{let i=oa(e),a=-i*r.width,o=t&&n.speed>0&&r.width>0&&r.transform!==a;u(()=>{r.trackIndex=i,r.index=N(i),r.transform=a,r.animating=o})},ne=()=>{let e=[r.trackIndex];r.trackIndex>0&&e.push(r.trackIndex-1),r.trackIndex<m.length-1&&e.push(r.trackIndex+1);for(let t of e){let e=m[t]?K(`img[data-lazy]`,m[t]):null;if(!e)continue;let n=!!e.getAttribute(`src`);if(n&&!e.complete&&(e.onload||e.onerror))continue;e.dataset.status=`loading`;let r=()=>{e.onload=null,e.onerror=null,l.delete(r)};l.add(r);let i=()=>{e.dataset.status=`loaded`,r()},a=()=>{e.dataset.status=`error`,r()};e.onload=i,e.onerror=a,n||(e.src=e.dataset.lazy||``),e.complete&&(e.naturalWidth>0?i():a())}},re=()=>{v&&=(clearInterval(v),null)},ie=()=>{d.runtime.destroyed||v||j()<=1||R()&&(v=setInterval(()=>d.next(),Math.max(n.delay,16)))},z=()=>{n.autoplay&&!v&&!d.runtime.destroyed&&ie()},ae=()=>{re(),n.autoplay&&ie()},oe=e=>{b.push({x:e.pageX??e.clientX??0,y:e.pageY??e.clientY??0,time:Date.now()}),b.length>5&&b.shift()},se=()=>b.length?{x:b[b.length-1].x-b[0].x,y:b[b.length-1].y-b[0].y}:{x:0,y:0},ce=(e=!0)=>{let t=-r.trackIndex*r.width,n=e&&r.transform!==t;S=!1,C=!1,T=!1,b=[],x=null,u(()=>{r.transform=t,r.animating=n}),z()},le=(e,t)=>{r.animating||!R()||(b=[],oe(e),x=t,S=!0,C=!1,T=!1,E=!1,re(),u(()=>{r.animating=!1}))},ue=(e,t)=>{if(!S||C||r.animating)return;oe(e);let i=se(),a=Math.abs(i.x),o=Math.abs(i.y);if(!(a<6&&o<6)){if(!T)if(Math.atan2(o,a)*180/Math.PI<n.touchAngle)T=!0,E=aa(x);else{C=!0,ce(!0);return}t.preventDefault(),u(()=>{r.transform=-r.trackIndex*r.width+i.x*n.touchRatio})}},de=()=>{if(!S)return;if(S=!1,!T||r.width<=0){ce(!0);return}let e=b.length?b[b.length-1].time-b[0].time:0,t=se().x,i=Math.abs(t)/r.width,a=0;e>n.longSwipesMs?a=Math.ceil(i-n.longSwipesRatio):i>=n.longSwipesRatio&&(a=Math.max(1,Math.ceil(i-n.longSwipesRatio))),d.slideToTrack(r.trackIndex+a*(t>0?-1:1)),b=[],z()},fe=e=>{e.target!==p||!(`propertyName`in e)||e.propertyName!==`transform`||(u(()=>{r.animating=!1}),!(!n.loop||j()<=1)&&(r.trackIndex===0?te(j(),!1):r.trackIndex===M()-1&&te(1,!1)))},pe=()=>{let e=d.element;!e||!p||(s.clear(),s.on(`touchstart`,p,`touchstart`,e=>{let t=e.touches[0];t&&le(t,e.target)},{passive:!0}),s.on(`touchmove`,p,`touchmove`,e=>{let t=e.touches[0];t&&ue(t,e)},{passive:!1}),s.on(`touchend`,p,`touchend`,e=>{let t=e.changedTouches[0];t&&oe(t),de()}),s.on(`touchcancel`,window,`touchcancel`,()=>ce(!0)),s.on(`mousedown`,p,`mousedown`,e=>{let t=e;t.button===0&&(le(t,t.target),p?.style.setProperty(`cursor`,`grabbing`))}),s.on(`mousemove`,window,`mousemove`,e=>{let t=e;S&&t.buttons===1&&ue(t,e)}),s.on(`mouseup`,window,`mouseup`,e=>{S&&(p?.style.setProperty(`cursor`,`grab`),oe(e),de())}),s.on(`click`,p,`click`,e=>{!E||!n.preventClick||(e.preventDefault(),e.stopPropagation(),E=!1)},{capture:!0}),s.on(`dragstart`,p,`dragstart`,e=>e.preventDefault()),s.on(`transitionend`,p,`transitionend`,fe),s.on(`resize`,window,`resize`,me),s.on(`mouseenter`,e,`mouseenter`,re),s.on(`mouseleave`,e,`mouseleave`,z),s.on(`controls`,e,`click`,t=>{if(!(t.target instanceof Element))return;let n=t.target.closest(`[data-action], [data-swiper-bullet]`);!n||!e.contains(n)||(n.dataset.action===`prev`?d.prev():n.dataset.action===`next`?d.next():n.dataset.swiperBullet!=null&&d.slideTo(Number(n.dataset.swiperBullet)))}))},me=()=>{if(!d.runtime.built)return;re(),I(),F();let e=Math.min(r.index,Math.max(0,j()-1));L(),te(P(e),!1),n.lazyload&&ne(),n.autoplay&&ee()&&z()},B=fn(me),V=()=>{y==null&&typeof requestAnimationFrame==`function`&&(y=requestAnimationFrame(()=>{y=null,!d.runtime.destroyed&&d.element?.isConnected&&me()}))},he=async()=>{if(typeof n.data!=`function`)return;let e=++_;u(()=>{r.loading=!0});try{let t=await Promise.resolve(n.data(d));if(d.runtime.destroyed||e!==_)return;U(`data`,t,{type:`array`},`Swiper.data`);let i=sa(t);O(i),u(()=>{r.data=i})}finally{!d.runtime.destroyed&&e===_&&u(()=>{r.loading=!1})}},ge=()=>{he().catch(e=>{d.runtime.destroyed||console.error(`Swiper.data error:`,e)})},_e=e=>f(e().item.url?`a`:`div`,{className:n.className.slide,href:()=>e().item.url||void 0,target:()=>e().item.url?e().item.blank?`_blank`:`_self`:void 0,"data-swiper-slide":()=>String(e().index),"data-swiper-index":()=>e().clone?null:String(e().index),"data-clone":()=>e().clone,role:`group`,"aria-label":()=>`Slide ${e().index+1}`,children:()=>{let{item:t,index:r}=e(),i={swiper:d,item:t,index:r};return t.children==null?[t.image?f(`img`,{className:n.className.image,alt:t.title||``,loading:`lazy`,...n.lazyload?{"data-lazy":t.image}:{src:t.image}}):null,t.title?f(`span`,{className:n.className.title,children:t.title}):null]:typeof t.children==`function`?t.children(i):t.children}});return d=Q({name:`Swiper`,props:n,state:r,actions:{slideTo(e){d.slideToTrack(P(e))},slideToTrack(e){if(!d.runtime.built)throw Error(`Swiper.slideToTrack: call build() first.`);if(r.animating||!m.length||!R())return;let t=n.loop?Math.max(0,Math.min(e,m.length-1)):Math.max(0,Math.min(e,j()-1));te(t,!0),n.lazyload&&ne()},next(){r.animating||d.slideToTrack(r.trackIndex+1)},prev(){r.animating||d.slideToTrack(r.trackIndex-1)},play:ie,pause:re,resume:z,restartAutoplay:ae},normalizeStatePatch(e){return{...e,...Object.hasOwn(e,`data`)&&Array.isArray(e.data)?{data:sa(e.data)}:{}}},validateStatePatch(e){U(`state`,e,{type:`plainObject`},`Swiper.setState`);for(let t of Object.keys(e)){if(!Object.hasOwn(ia,t))throw Error(`Swiper.setState: "${t}" is not a supported state key.`);U(t,e[t],ia[t],`Swiper.setState`)}Array.isArray(e.data)&&O(e.data)},view:()=>{h=o(()=>O(r.data)),g=o(()=>A(h()));let e=()=>{let e=kn();return e.setAttribute(`data-swiper-loading`,``),e};p=f(`div`,{className:n.className.wrapper,"data-swiper-wrapper":``,"aria-live":`polite`,children:()=>r.loading?e():t({each:g,key:e=>e.key,children:_e})});let i=f(`div`,{id:n.id||Y(),className:n.className.root,"data-swiper":`root`,"data-status":()=>r.loading?`loading`:`loaded`,children:[p,n.pagination?f(`div`,{className:k(n.className.pagination,n.className.paginationHorizontal,n.className.paginationClickable,n.className.paginationBulletGroup),"data-swiper-pagination":``,children:t({each:h,key:e=>e.key,children:(e,t)=>f(`button`,{type:`button`,className:()=>k(n.className.indicator,n.className.bullet,r.index===t()?n.className.active:``),"data-swiper-bullet":()=>String(t()),"aria-label":()=>`Go to slide ${t()+1}`,"aria-current":()=>r.index===t()?`true`:null})})}):null,n.navigation?f(`button`,{type:`button`,className:()=>k(n.className.navigation,n.className.prev,!n.loop&&r.index<=0?n.className.disabled:``),"data-action":`prev`,"data-swiper-navigation":`prev`,"aria-label":`Previous slide`,disabled:()=>!n.loop&&r.index<=0,children:w(`arrow-left`)}):null,n.navigation?f(`button`,{type:`button`,className:()=>k(n.className.navigation,n.className.next,!n.loop&&r.index>=j()-1?n.className.disabled:``),"data-action":`next`,"data-swiper-navigation":`next`,"aria-label":`Next slide`,disabled:()=>!n.loop&&r.index>=j()-1,children:w(`arrow-right`)}):null]});return a(()=>{p?.style.setProperty(`transform`,`translate3d(${r.transform}px, 0, 0)`),p?.style.setProperty(`transition`,r.animating?`transform ${n.speed}ms cubic-bezier(0.25, 0.46, 0.45, 0.94)`:`none`),i.style.setProperty(`--swiper-slide-width`,`${r.width}px`)}),a(()=>{(h().map(e=>`${e.key}:${e.sort??``}:${!!e.url}`).join(`|`)||r.data.length===0)&&B.schedule()}),i},onBuild(e){!e.element||!p||(p.setAttribute(`aria-live`,`polite`),F(),pe(),L(),te(P(r.index),!1),n.lazyload&&ne(),n.autoplay&&ee()&&ie(),e.own(()=>s.clear()),ge(),V())},onMount(){me(),V()},onDestroy(){re(),B.dispose(),_+=1,I(),y!=null&&cancelAnimationFrame(y),y=null,p=null,m=[]}}),Object.defineProperties(d,{realCount:{enumerable:!0,get:j},realIndex:{enumerable:!0,get:()=>N()}}),d}const da={root:`j-tabs`,wrap:`tab-wrap`,list:`tab-list`,tab:`tab-item`,panelWrap:`panel-list`,panel:`panel-item`,dragging:`dragging`},fa={id:{default:null,types:[`string`,`null`],normalize:e=>typeof e==`string`?e.trim()||Y():e??Y()},direction:{default:`top`,type:`string`,enum:[`top`,`bottom`,`left`,`right`]},active:{default:0,types:[`number`,`string`]},disabled:{default:[],types:[`number`,`string`,`array`]},onChange:{default:null,types:[`function`,`null`]},data:{default:[],type:`array`},className:{default:da,type:`object`,normalize:e=>({...da,...e&&typeof e==`object`?e:{}})}},pa={type:`plainObject`,shape:{name:[`string`,`null`,`undefined`],title:`renderable`,content:`renderable`,cache:[`boolean`,`undefined`],ttl:[`number`,`undefined`]}},ma={data:fa.data,active:fa.active,disabled:fa.disabled};function ha(e,t,n=`Tabs.data`){U(String(t),e,pa,n);let r=(typeof e.name==`string`?e.name.trim():``)||Y();return{...e,name:r}}function ga(e,t=`Tabs.data`){U(`data`,e,ma.data,t);let n=new Set;return e.map((e,r)=>{let i=ha(e,r,t),a=i.name;if(n.has(a))throw Error(`${t}: item name "${a}" must be unique.`);return n.add(a),i})}function _a(e){return Array.isArray(e)?[...e]:e}function va(e){let t=W(e,fa,`Tabs.props`);return{id:t.id,direction:t.direction,active:t.active,disabled:_a(t.disabled),onChange:t.onChange,data:ga(t.data,`Tabs.props.data`),className:t.className}}function ya(e){return typeof e==`number`&&e>0?e:0}function ba(e={}){let n=va(e),r=i({data:n.data,active:n.active,disabled:n.disabled,draggable:!1,dragging:!1,loading:!1}),s=J(),l=_n(),d=_n(),m=vn(),h=vn(),g=new Map,_=new Map,v,y=0,b=!1,x=0,S=0,C=0,w=e=>typeof e==`number`?e:r.data.findIndex(t=>t.name===e),T=()=>{let e=w(r.active),t=r.data[e];return t?{index:e,name:t.name}:{index:-1,name:null}},E=()=>{if(typeof r.active==`string`)return r.active;let e=r.data[r.active];return e?e.name:null},D=()=>{let e=Array.isArray(r.disabled)?r.disabled:[r.disabled];return Array.from(new Set(e.map(e=>typeof e==`number`?r.data[e]?.name:e).filter(e=>typeof e==`string`)))},O=e=>D().includes(e),A=e=>E()===e,j=o(()=>r.data),M=()=>{let e=l.current,t=d.current;if(!e||!t)return;let i=n.direction===`left`||n.direction===`right`?t.scrollHeight>e.clientHeight+5:t.scrollWidth>e.clientWidth+5;r.draggable!==i&&u(()=>{r.draggable=i})},N=fn(M),P=()=>{let e=l.current;if(!e)return;let t=C,r=performance.now(),i=n.direction===`left`||n.direction===`right`,a=n=>{let o=n-r;r=n,t*=.92,!(Math.abs(t)<.3)&&(i?e.scrollTop+=t*o*.05:e.scrollLeft+=t*o*.05,x=requestAnimationFrame(a))};x=requestAnimationFrame(a)},F=()=>{let e=l.current,t=d.current;if(!e||!t)return;let i=0,a=0,o=0,c=!1,f=0,p=e=>{let t=n.direction===`left`||n.direction===`right`;if(`touches`in e){let n=e.touches[0]||e.changedTouches[0];return t?n.pageY:n.pageX}return t?e.pageY:e.pageX},m=t=>{r.draggable&&(!(t instanceof MouseEvent)&&!(t instanceof TouchEvent)||(b=!0,u(()=>{r.dragging=!0}),i=p(t),o=i,a=n.direction===`left`||n.direction===`right`?e.scrollTop:e.scrollLeft,C=0,cancelAnimationFrame(x)))},h=t=>{if(!b||!(t instanceof MouseEvent)&&!(t instanceof TouchEvent))return;t.preventDefault();let r=p(t);f=i-r,C=o-r,o=r,!c&&(c=!0,requestAnimationFrame(()=>{c=!1,n.direction===`left`||n.direction===`right`?e.scrollTop=a+f:e.scrollLeft=a+f}))},g=()=>{b&&(b=!1,u(()=>{r.dragging=!1}),P())};s.on(`drag:mousedown`,t,`mousedown`,m),s.on(`drag:touchstart`,t,`touchstart`,m,{passive:!0}),s.on(`drag:mousemove`,window,`mousemove`,h,{passive:!1}),s.on(`drag:touchmove`,window,`touchmove`,h,{passive:!1}),s.on(`drag:mouseup`,window,`mouseup`,g),s.on(`drag:touchend`,window,`touchend`,g)},I=async e=>{if(!v.runtime.built)throw Error(`Tabs.activate: call build() first.`);let t=w(e),i=r.data[t];if(!i)return;let a=i.name;O(a)||A(a)||(u(()=>{r.active=e}),await _.get(a)?.(),await Promise.resolve(n.onChange?.(t,a,m.get(a),h.get(a))))},L=(e,t)=>{let i=e().name,o=e().content,[s,l]=c(typeof o==`function`?null:o),[d,m]=c(!1),b=o,x=0,S=null,C=()=>({tabs:v,item:e(),index:t(),name:i}),w=async()=>{let t=e(),n=t.content;if(typeof n!=`function`){l(n);return}let a=t.cache?g.get(i):null,o=ya(t.ttl);if(a&&(!o||Date.now()-a.updatedAt<=o)){l(a.content);return}if(S)return S;let s=++x;y+=1;let c=y;m(!0),u(()=>{r.loading=!0});let d=Promise.resolve().then(()=>n(C())).then(t=>{s!==x||v.runtime.destroyed||(e().cache&&g.set(i,{content:t,updatedAt:Date.now()}),l(t))}).finally(()=>{s===x&&m(!1),c===y&&!v.runtime.destroyed&&u(()=>{r.loading=!1}),S===d&&(S=null)});return S=d,d};return _.set(i,w),p(()=>{g.delete(i),_.delete(i)}),a(()=>{let t=e().content;t!==b&&(b=t,x+=1,S=null,g.delete(i),l(typeof t==`function`?null:t)),A(i)&&w()}),f(`div`,{className:n.className.panel,"data-tabs-panel":i,role:`tabpanel`,"aria-hidden":()=>A(i)?`false`:`true`,"aria-live":()=>typeof e().content==`function`?`polite`:null,"aria-busy":()=>String(d()),hidden:()=>!A(i),ref:h.bind(i),children:()=>{if(d())return kn(`flex-start`,`flex-start`);let e=s();return typeof e==`function`?e(C()):e}})},ee=(e,t)=>{let r=e().name;return f(`div`,{className:n.className.tab,"data-tabs-tab":r,role:`tab`,"aria-selected":()=>A(r)?`true`:`false`,"aria-disabled":()=>O(r)?`true`:`false`,ref:m.bind(r),children:e().title})};return v=Q({name:`Tabs`,props:n,state:r,actions:{activate:I},normalizeStatePatch(e){return{...e,...Object.hasOwn(e,`data`)?{data:ga(e.data,`Tabs.setState.data`)}:{},...Object.hasOwn(e,`disabled`)&&Array.isArray(e.disabled)?{disabled:_a(e.disabled)}:{}}},validateStatePatch(e){U(`state`,e,{type:`plainObject`},`Tabs.setState`);for(let t of Object.keys(e)){if(!Object.hasOwn(ma,t))throw Error(`Tabs.setState: "${t}" is not a supported state key.`);let n=t;U(t,e[t],ma[n],`Tabs.setState`)}},view:()=>(a(()=>{let e=r.data.length;return N.schedule(),e}),f(`div`,{className:n.className.root,id:n.id,"data-tabs":`root`,"data-tabs-direction":n.direction,children:[f(`div`,{className:n.className.wrap,"data-tabs-wrap":``,ref:l.set,children:f(`nav`,{className:()=>k(n.className.list,r.dragging&&n.className.dragging),"data-tabs-list":``,ref:d.set,children:t({each:j,key:e=>e.name,children:(e,t)=>ee(e,t)})})}),f(`div`,{className:n.className.panelWrap,"data-tabs-panel-wrap":``,children:t({each:j,key:e=>e.name,children:(e,t)=>L(e,t)})})]})),onBuild(e){let t=e.element;t&&(s.on(`click`,t,`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`[data-tabs-tab]`)?.dataset.tabsTab;t&&!O(t)&&I(t)}),s.on(`resize`,window,`resize`,()=>{cancelAnimationFrame(S),S=requestAnimationFrame(M)}),F(),e.own(()=>s.clear()),N.schedule(),_.get(T().name||``)?.())},onMount(){N.schedule()},onDestroy(){y+=1,N.dispose(),cancelAnimationFrame(x),cancelAnimationFrame(S),g.clear(),_.clear(),m.clear(),h.clear()}}),Object.defineProperties(v,{current:{enumerable:!0,get:T},activeIndex:{enumerable:!0,get:()=>T().index},disabledNames:{enumerable:!0,get:D}}),v}const xa={root:`j-offcanvas`,overlay:`j-offcanvas-overlay`,content:`offcanvas-content`},Sa={top:`translateY(-100%)`,right:`translateX(100%)`,bottom:`translateY(100%)`,left:`translateX(-100%)`},Ca={content:{default:``,type:`renderable`},overlay:{default:!0,type:`boolean`},filter:{default:!0,type:`boolean`},bodyOverflow:{default:!0,type:`boolean`},cache:{default:!1,type:`boolean`},ttl:{default:0,type:`number`},direction:{default:`left`,type:`string`,enum:[`top`,`right`,`bottom`,`left`]},animate:{default:`slide`,type:`string`},bgClose:{default:!0,type:`boolean`},escClose:{default:!0,type:`boolean`},id:{default:null,types:[`string`,`null`],normalize:e=>typeof e==`string`?e.trim()||Y():e??Y()},className:{default:xa,type:`object`,normalize:e=>({...xa,...e&&typeof e==`object`?e:{}})},onShow:{default:null,types:[`function`,`null`]},onShown:{default:null,types:[`function`,`null`]},onHide:{default:null,types:[`function`,`null`]},onHidden:{default:null,types:[`function`,`null`]}},wa={content:Ca.content,resolvedContent:{type:`renderable`},visible:{type:`boolean`},loading:{type:`boolean`}};function Ta(e){return e>0?e:0}function Ea(e){let t=W(e,Ca,`Offcanvas`);return{content:t.content,overlay:t.overlay,filter:t.filter,bodyOverflow:t.bodyOverflow,cache:t.cache,ttl:t.ttl,direction:t.direction,animate:t.animate,bgClose:t.bgClose,escClose:t.escClose,id:t.id,className:t.className,onShow:t.onShow,onShown:t.onShown,onHide:t.onHide,onHidden:t.onHidden}}let Da=0,Oa=``;function ka(e){U(`state`,e,{type:`plainObject`},`Offcanvas.setState`);for(let t of Object.keys(e)){if(!Object.hasOwn(wa,t))throw Error(`Offcanvas.setState: "${t}" is not a supported state key.`);let n=t;U(t,e[t],wa[n],`Offcanvas.setState`)}}function Aa(e={}){let t=Ea(e),n=i({content:t.content,resolvedContent:typeof t.content==`function`?null:t.content,visible:!1,loading:!1}),r={cache:{content:null,hasContent:!1,updatedAt:0},contentLoadId:0},o=J(),s=_n(),c,l=!1,p=()=>{!t.bodyOverflow||l||(Da===0&&(Oa=document.body.style.overflow,document.body.style.overflow=`hidden`),Da+=1,l=!0)},h=()=>{l&&=(Da=Math.max(0,Da-1),Da===0&&(document.body.style.overflow=Oa,Oa=``),!1)},g=It(()=>c.element,{keyframes:[{transform:Sa[t.direction]},{transform:`translate(0, 0)`}],options:{duration:300,easing:`ease`}}),_=On({elements:()=>[s.current,c.element],mount:()=>{let e=s.current;e&&!e.isConnected&&d(document.body,e),c.mount(document.body),p()},activate:()=>{n.visible=!0},deactivate:()=>{n.visible=!1},motion:Nt(...t.animate===`slide`?[g]:[],It(()=>s.current,{keyframes:[{opacity:0},{opacity:1}],options:{duration:300,easing:`ease`}})),unmount:()=>{s.current?.remove(),c.unmount(),h()}}),v=()=>{r.cache={content:null,hasContent:!1,updatedAt:0}},y=()=>{if(!t.cache||!r.cache.hasContent)return!1;let e=Ta(t.ttl);return!e||Date.now()-r.cache.updatedAt<=e},b=async()=>{let e=n.content;if(typeof e!=`function`){r.contentLoadId+=1,u(()=>{n.resolvedContent=e,n.loading=!1});return}if(y()){r.contentLoadId+=1,u(()=>{n.resolvedContent=r.cache.content,n.loading=!1});return}let i=++r.contentLoadId;u(()=>{n.loading=!0,n.resolvedContent=null});try{let a=await Promise.resolve(e(c));if(c.runtime.destroyed||i!==r.contentLoadId)return;t.cache&&(r.cache={content:a,hasContent:!0,updatedAt:Date.now()}),u(()=>{n.resolvedContent=a})}finally{!c.runtime.destroyed&&i===r.contentLoadId&&u(()=>{n.loading=!1})}};return c=Q({name:`Offcanvas`,props:t,state:n,actions:{async show(){if(!c.runtime.built)throw Error(`Offcanvas.show: call build() first.`);if(n.visible)return;await Promise.resolve(t.onShow?.(c));let e=_.enter(),r=b();await e&&!c.runtime.destroyed&&t.onShown?.(c),await r},async hide(){if(!c.runtime.built)throw Error(`Offcanvas.hide: call build() first.`);if(!n.visible)return;let e=t.onHide?.(c);e&&await e,r.contentLoadId+=1,u(()=>{n.loading=!1}),await _.leave()&&t.onHidden?.(c)}},validateStatePatch:ka,view(e){let i=t.overlay?f(`div`,{ref:s.set,className:t.className.overlay,"data-offcanvas-overlay":t.id,"data-mount":()=>n.visible?`true`:`false`,style:t.filter?{backdropFilter:`blur(2px)`}:{},onClick:()=>{t.bgClose&&c.hide()}}):null;return i&&e.own(()=>i.remove()),a(()=>{let e=n.content;U(`content`,e,wa.content,`Offcanvas.state`),v(),typeof e==`function`?(n.resolvedContent=null,m(()=>n.visible)&&b()):(r.contentLoadId+=1,n.resolvedContent=e,n.loading=!1)}),f(`div`,{className:t.className.root,id:t.id,role:`dialog`,"aria-modal":t.overlay?`true`:`false`,"aria-expanded":()=>String(n.visible),"data-mount":()=>n.visible?`true`:`false`,"data-offcanvas":`root`,"data-direction":t.direction,"data-animate":t.animate,onClick:e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`[data-action]`);(t?.dataset.action===`close`||t?.dataset.action===`cancel`)&&c.hide()},children:f(`div`,{className:t.className.content,"data-offcanvas-content":t.id,children:()=>n.loading?kn():typeof n.resolvedContent==`function`?n.resolvedContent(c):n.resolvedContent})})},onBuild(e){t.escClose&&o.on(`esc`,document,`keydown`,e=>{e instanceof KeyboardEvent&&e.key===`Escape`&&n.visible&&c.hide()}),e.own(()=>o.clear())},onDestroy(){_.cancel(),r.contentLoadId+=1,s.current?.remove(),h()}}),c}const ja={size:10,current:1},Ma={sibling:1,boundary:1},Na={root:`j-pagination`,list:`pagination`,item:`item`,more:`more`,button:`j-button is-icon is-ghost`,current:`j-button is-icon is-active`,loading:`animate-spin`},Pa={default:0,type:`number`,finite:!0,min:0},Fa={type:`plainObject`,required:!0,shape:{size:{type:`number`,integer:!0,greaterThan:0},current:{type:`number`,integer:!0,greaterThan:0}}},Ia={type:`plainObject`,required:!0,shape:{sibling:{type:`number`,integer:!0,min:0},boundary:{type:`number`,integer:!0,min:0}}},La={total:Pa,page:{default:()=>({...ja}),factory:!0,normalize:e=>({...ja,...e&&typeof e==`object`?e:{}}),...Fa},count:{default:()=>({...Ma}),factory:!0,normalize:e=>({...Ma,...e&&typeof e==`object`?e:{}}),...Ia},lock:{default:!0,type:`boolean`},onChange:{default:null,types:[`function`,`null`]},className:{default:Na,type:`object`,normalize:e=>({...Na,...e&&typeof e==`object`?e:{}})}},Ra={total:Pa,page:Fa,count:Ia,locked:{type:`boolean`}};function za(e,t,n){return Math.min(Math.max(e,t),n)}function Ba(e,t){return Math.max(1,Math.ceil(e/t))}function Va(e){return{size:e.size,current:e.current}}function Ha(e){return{sibling:e.sibling,boundary:e.boundary}}function Ua(e={}){let t=W(e,La,`Pagination.props`),n=Ba(t.total,t.page.size);return{...t,page:{size:t.page.size,current:za(t.page.current,1,n)},count:Ha(t.count),className:{...t.className}}}function Wa(e){return{type:`more`,key:e}}function Ga(e){return{type:`page`,key:`page-${e}`,page:e}}function Ka(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function qa(e,t,n){if(t<=0)return[];let r=Math.max(0,n.boundary),i=Math.max(0,n.sibling);if(t<=r*2+i*2+3)return Ka(1,t).map(Ga);let a=new Set;for(let e=1;e<=Math.min(r,t);e++)a.add(e);for(let n=Math.max(1,e-i);n<=Math.min(t,e+i);n++)a.add(n);for(let e=Math.max(1,t-r+1);e<=t;e++)a.add(e);let o=Array.from(a).sort((e,t)=>e-t),s=[];for(let e of o){let t=s[s.length-1];t?.type===`page`&&e-t.page>1&&s.push(e-t.page===2?Ga(t.page+1):Wa(`more-${t.page}-${e}`)),s.push(Ga(e))}return s}function Ja(e){if(e.type!==`page`)throw Error(`Pagination.itemView: expects page item.`);return e}function Ya(e={}){let n=Ua(e),r=i({total:n.total,page:Va(n.page),count:Ha(n.count),locked:!1}),s=0,c,l=o(()=>Ba(r.total,r.page.size)),d=()=>n.lock&&r.locked,p=()=>d()||r.page.current<=1,m=()=>d()||r.page.current>=l(),h=o(()=>qa(r.page.current,l(),r.count)),g=e=>{n.lock&&!c.runtime.destroyed&&e===s&&u(()=>{r.locked=!1})},_=e=>{if(c.runtime.destroyed)throw Error(`Pagination.go: instance destroyed`);if(!c.runtime.built)throw Error(`Pagination.go: call build() first.`);if(U(`page`,e,{type:`number`,integer:!0},`Pagination.go`),d())return c;let t=za(e,1,l());if(t===r.page.current)return c;let i=n.lock&&typeof n.onChange==`function`,a=i?++s:s;if(u(()=>{r.page.current=t,i&&(r.locked=!0)}),n.onChange){let e;try{e=n.onChange(t,c)}catch(e){throw g(a),e}if(i&&e&&typeof e.then==`function`){let t=()=>g(a);Promise.resolve(e).then(t,t)}else g(a)}return c},v=e=>{let t=e===`prev`?p:m;return f(`li`,{className:n.className.item,"data-pagination-control":e,children:f(`button`,{className:n.className.button,type:`button`,"data-page-action":e,"aria-label":e===`prev`?`Go to previous page`:`Go to next page`,"aria-disabled":()=>t()?`true`:`false`,tabindex:()=>t()?`-1`:null,disabled:t,onClick:()=>{t()||_(r.page.current+(e===`prev`?-1:1))},children:w(e===`prev`?`arrow-left`:`arrow-right`)})})},y=e=>{if(e().type===`more`)return f(`li`,{className:()=>k(n.className.item,e().type===`more`?n.className.more:``),"data-pagination-more":()=>e().type===`more`?e().key:null,children:f(`span`,{className:n.className.button,children:w(`more`)})});let t=()=>Ja(e()).page,i=()=>t()===r.page.current;return f(`li`,{className:()=>k(n.className.item,e().type===`more`?n.className.more:``),"data-pagination-more":()=>e().type===`more`?e().key:null,"data-pagination-item":()=>{let t=e();return t.type===`page`?String(t.page):null},children:f(`button`,{className:()=>i()?n.className.current:n.className.button,type:`button`,"data-page":()=>String(t()),"data-current-page":()=>i()?String(t()):null,"aria-current":()=>i()?`page`:null,"aria-label":()=>i()?`Page ${t()}, current page`:`Go to page ${t()}`,"aria-disabled":()=>d()||i()?`true`:`false`,tabindex:()=>d()||i()?`-1`:null,disabled:()=>d()||i(),onClick:()=>{let e=t();!d()&&!i()&&_(e)},children:()=>d()&&i()?f(`i`,{className:n.className.loading,children:w(`loader`)}):String(t())})})};return c=Q({name:`Pagination`,props:n,state:r,actions:{go:_},normalizeStatePatch(e){let t={...e};return Object.hasOwn(t,`page`)&&B(t.page)&&(t.page={...r.page,...t.page}),Object.hasOwn(t,`count`)&&B(t.count)&&(t.count={...r.count,...t.count}),t},validateStatePatch(e){for(let t of Object.keys(e)){if(!Object.hasOwn(Ra,t))throw Error(`Pagination.setState: "${t}" is not supported.`);let n=t;U(t,e[t],Ra[n],`Pagination.setState`)}},view:()=>(a(()=>{let e=za(r.page.current,1,l());e!==r.page.current&&(r.page.current=e)}),f(`div`,{className:n.className.root,role:`navigation`,"aria-label":`Pagination`,"data-pagination":`root`,children:f(`ul`,{className:n.className.list,"data-pagination-list":``,"aria-live":`polite`,children:[v(`prev`),t({each:h,key:e=>e.key,children:e=>y(e)}),v(`next`)]})}))}),Object.defineProperty(c,"pageCount",{enumerable:!0,get:l}),c}const Xa={root:`j-menu`,list:`menu`,item:`menu-item`,hasChildren:`menu-item-has-children`,link:`menu-link`,subMenu:`sub-menu`,active:`is-active`,text:`menu-text`,backItem:`menu-item back`,backIcon:`el-icon el-prefix`},Za={type:`object`,validate:ao,message:`expects { title, id?, url?, target?, classes?, children? }.`},Qa={type:`array`,items:Za},$a={type:{default:void 0,types:[`string`,`undefined`]},id:{default:null,types:[`string`,`null`],normalize:e=>typeof e==`string`?e.trim()||Y():e??Y()},data:{default:[],type:`array`,normalize:oo,items:Za},backText:{default:e(`b`,_),type:`string`},className:{default:Xa,type:`object`,normalize:e=>({...Xa,...e&&typeof e==`object`?e:{}})}},eo={data:Qa,activeKeys:{type:`array`,items:`string`}};function to(e={}){let t=W(e,$a,`Menu.props`);return{...t,data:oo(t.data),className:{...t.className}}}function no(e){return e==null?[]:typeof e==`string`?e.trim().split(/\s+/).filter(Boolean):e.slice()}function ro(e){return`menu-item-${e??Y()}`}function io(e){return typeof e==`string`?e.trim():``}function ao(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return(typeof t.title==`string`||typeof t.title==`number`)&&(t.id==null||typeof t.id==`string`||typeof t.id==`number`)&&(t.url==null||typeof t.url==`string`)&&(t.target==null||typeof t.target==`string`)&&(t.classes==null||typeof t.classes==`string`||Array.isArray(t.classes)&&t.classes.every(e=>typeof e==`string`))&&(t.children==null||Array.isArray(t.children)&&t.children.every(ao))}function oo(e){return Array.isArray(e)?e.map(e=>{U(`item`,e,Za,`Menu.data`);let t={...e};return Array.isArray(t.classes)&&(t.classes=t.classes.slice()),Array.isArray(t.children)&&(t.children=oo(t.children)),t}):[]}function so(e={}){let n=to(e),r=i({data:oo(n.data),activeKeys:[]}),a=new WeakMap,o=J(),s,c=e=>e.id==null?(a.has(e)||a.set(e,Y()),a.get(e)):String(e.id),l=e=>r.activeKeys.includes(e),d=e=>{u(()=>{r.activeKeys=n.type===`bottom`?[e]:r.activeKeys.includes(e)?r.activeKeys:[...r.activeKeys,e]})},p=e=>{u(()=>{r.activeKeys=r.activeKeys.filter(t=>t!==e)})},m=e=>{u(()=>{r.activeKeys=l(e)?[]:[e]})},h=e=>f(`li`,{className:n.className.backItem,"data-menu-back":``,children:f(`a`,{className:n.className.link,href:``,"data-menu-link":``,onClick:t=>{t.preventDefault(),p(e)},children:[f(`span`,{className:n.className.backIcon,children:w(`arrow-left`)}),f(`span`,{className:n.className.text,children:n.backText})]})}),g=(e,r=!1,i)=>f(`ul`,{className:r?n.className.list:n.className.subMenu,...r?{id:n.id}:{},"data-menu-list":r?`root`:`sub`,children:[t({each:()=>n.type===`mobile`&&i&&l(i)?[i]:[],key:e=>e,children:e=>h(e())}),t({each:e,key:e=>c(e),children:e=>{let t=c(e());return f(`li`,{className:()=>{let r=e();return k(n.className.item,r.children?.length?n.className.hasChildren:``,...no(r.classes),l(t)?n.className.active:``)},id:()=>e().id==null?`menu-item-${t}`:ro(e().id),"data-menu-item":()=>e().id==null?``:String(e().id),"data-menu-has-children":()=>e().children?.length?``:null,onClick:r=>{n.type===`mobile`&&r.target===r.currentTarget&&e().children?.length&&d(t)},children:[()=>{let r=e(),i=!!r.children?.length,a=io(r.url);return!i&&!a?f(`span`,{className:n.className.link,"data-menu-link":``,children:r.title}):f(`a`,{className:n.className.link,href:a,target:r.target,"data-menu-link":``,onClick:e=>{i&&(n.type===`mobile`||n.type===`bottom`)&&(e.preventDefault(),n.type===`bottom`?m(t):d(t))},children:r.title})},()=>e().children?.length?g(()=>e().children||[],!1,t):null]})}})]});return s=Q({name:`Menu`,props:n,state:r,normalizeStatePatch(e){let t={...e};return Object.hasOwn(t,`data`)&&(t.data=oo(t.data)),t},validateStatePatch(e){for(let t of Object.keys(e)){if(!Object.hasOwn(eo,t))throw Error(`Menu.setState: "${t}" is not supported.`);let n=t;U(t,e[t],eo[n],`Menu.setState`)}},view:()=>(U(`data`,r.data,Qa,`Menu`),f(`nav`,{className:n.className.root,"data-menu":`root`,"data-menu-type":n.type,children:g(()=>r.data,!0)})),onBuild(e){n.type===`bottom`&&(o.on(`outside`,document,`click`,t=>{let n=t.target;!(n instanceof Node)||e.element?.contains(n)||u(()=>{r.activeKeys=[]})}),e.own(()=>o.clear()))}}),s}export{Tt as Toast,O as addIcons,q as all,At as checkModernBrowser,Dt as copy,ci as createAccordion,Lt as createCollapseTransition,Rn as createDrop,_n as createElementRef,J as createEventManager,Bi as createFlow,Ai as createForm,vn as createKeyedElementRefs,kn as createLoading,so as createMenu,ea as createModal,Nt as createMotionGroup,Aa as createOffcanvas,yn as createOwnedView,Ya as createPagination,ar as createParabola,Mn as createPopup,On as createPresence,fn as createScheduledTask,gn as createStateSync,dr as createSticky,ua as createSwiper,ba as createTabs,$n as createTheme,Yr as createToc,Un as createTooltip,It as createTransition,zr as createValidator,tn as debounce,Q as defineComponent,D as getRegistedIconPath,pn as getStoreVersion,be as getType,w as icon,T as iconHtml,E as iconMarkup,ge as isDomElementValue,he as isDomNodeValue,Re as isElement,_e as isHtmlElementValue,Et as isMobile,kt as isModernBrowser,V as isNilValue,Le as isNode,B as isPlainObject,Ke as isRenderableContent,ve as isRenderablePrimitive,ye as isRenderableValue,qe as lazyRender,Qe as listen,Mt as postJson,K as q,Y as randomId,Hr as removeComponentPlugin,Ge as requireContainer,We as resolveContainer,G as resolveElement,Ue as resolveNode,He as resolveNodeList,W as resolveProps,jt as restUrl,hn as stateSnapshot,rn as throttle,et as timer,mn as trackStoreVersion,Vr as useComponentPlugin,$e as uuid,U as validateParam,Dn as waitForMotion};
|