@lattice-php/lattice 0.73.0 → 0.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,138 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./date-picker-view-tr6cuOIN.js","./rolldown-runtime-hePW80VL.js","./react-CwJFpaho.js","./react-dom-Dl-LT-t1.js","./locale-D9oL6nV7.js","./jsx-runtime-NZYk81nU.js","./floating-ui.dom-C6CLKWO6.js","./clsx-CjueKrWZ.js","./input-B7b-fHQh.js","./pattern-input-view-CjbnNynq.js","./instance-CloWXP86.js","./timezone-gE1nfovq.js","./dist-CDI2N5YZ.js","./registry-context-gXwNT8GJ.js","./w3c-keyname-BOAvb0qz.js","./with-selector-Cse0iXU1.js","./dist-BTYZr5rg.js","./rich-editor-view-4ZhBfx6i.js","./notifications-echo-BLO9_g1w.js","./dist-D2qBbka0.js","./chart-view-CPIF_gTM.js","./materialize-CWqnSEHR.js","./color-CXV-Y5Qv.js","./code-block-view-4IbUdTmO.js","./subscriptions-B37pUVGa.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{t as r}from"./react-CwJFpaho.js";import{n as i,t as a}from"./materialize-CWqnSEHR.js";import{t as o}from"./react-dom-Dl-LT-t1.js";import{a as s,n as c,o as l,r as u,s as d}from"./locale-D9oL6nV7.js";import{t as f}from"./jsx-runtime-NZYk81nU.js";import{i as p,n as m,t as h}from"./registry-context-gXwNT8GJ.js";import{_ as g,a as _,d as v,f as y,g as b,h as x,i as S,l as C,m as w,n as T,o as E,p as D,r as O,s as k,t as ee,u as A,v as j,y as M}from"./floating-ui.dom-C6CLKWO6.js";import{a as te,c as N,i as P,n as F,o as ne,r as I,s as re}from"./instance-CloWXP86.js";import{a as L,i as R,o as ie,r as ae,s as oe}from"./timezone-gE1nfovq.js";import{$ as z,$t as se,A as ce,At as le,B as ue,Bt as de,C as fe,Cn as pe,Ct as me,Dt as he,Et as ge,Ft as _e,Gt as ve,Ht as ye,It as be,J as xe,Jt as Se,Kt as Ce,M as we,Mt as Te,Nt as Ee,Ot as De,Pt as Oe,Q as ke,Qt as Ae,R as je,Rt as Me,Sn as Ne,St as Pe,Tt as Fe,Ut as Ie,V as Le,Vt as Re,W as ze,Wt as Be,X as Ve,Xt as He,Y as Ue,Yt as We,Z as Ge,Zt as Ke,_ as qe,_n as Je,_t as Ye,an as Xe,b as Ze,bn as Qe,c as $e,cn as et,ct as tt,d as nt,dn as rt,dt as it,en as at,et as ot,fn as st,ft as ct,g as lt,gn as ut,gt as dt,h as ft,hn as pt,ht as mt,i as ht,in as gt,it as _t,j as vt,jt as yt,k as bt,kt as xt,l as St,ln as Ct,lt as wt,m as Tt,mn as Et,mt as Dt,nn as Ot,nt as kt,o as At,on as jt,ot as Mt,pn as Nt,pt as Pt,qt as Ft,rn as It,sn as Lt,st as Rt,tn as zt,tt as Bt,un as Vt,ut as Ht,vn as Ut,vt as Wt,wn as Gt,wt as Kt,xn as qt,xt as Jt,y as Yt,yn as Xt,yt as Zt,z as Qt,zt as $t}from"./dist-CDI2N5YZ.js";import{n as en,r as tn,t as nn}from"./input-B7b-fHQh.js";import{i as rn,n as an,r as on,t as sn}from"./color-CXV-Y5Qv.js";var B=t(r(),1),cn=`modulepreload`,ln=function(e,t){return new URL(e,t).href},un={},dn=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=ln(t,n),t=s(t),t in un)return;un[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:cn,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function V(e){return{component:e,mode:`eager`}}var fn=[250,1e3,4e3];function pn(e){return async()=>{try{return await e()}catch(t){for(let t of fn){await new Promise(e=>setTimeout(e,t));try{return await e()}catch{continue}}throw t}}}function mn(e){let t=pn(e);return{component:(0,B.lazy)(t),load:t,mode:`lazy`}}var hn=e=>dn(()=>import(e),[],import.meta.url);function gn(e){return e===void 0||a(e)&&Object.values(e).every(e=>a(e)&&(e.mode===`eager`&&typeof e.component==`function`||e.mode===`lazy`&&a(e.component)&&typeof e.load==`function`))}function _n(e){return e===void 0||a(e)&&Object.values(e).every(e=>a(e))}function vn(e,t){let n=a(e)?e.default:void 0;if(!a(n)||typeof n.name!=`string`||n.name.trim()===``||!gn(n.components)||!_n(n.extensions)||n.i18n!==void 0&&(!a(n.i18n)||typeof n.i18n.namespace!=`string`||n.i18n.namespace.trim()===``))throw TypeError(`[lattice] Plugin module [${t}] must default export a Plugin object.`);return n}function yn(e,t=hn){return Promise.all(e.map(async e=>vn(await t(e),e)))}function bn(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n??{}))t[e]={...t[e],...r};return t}function xn(...e){return e.reduce((e,t)=>({components:{...e.components,...t.components},extensions:bn(e.extensions,t.extensions)}),{components:{},extensions:{}})}function Sn(e,...t){return xn({name:`registry`,...e},...t)}var Cn=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function wn(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function Tn(){}function En(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function Dn(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function On(e){if(En(e))return e;if(Array.isArray(e)||Dn(e)||e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0);let t=Object.getPrototypeOf(e);if(t==null)return Object.assign(Object.create(t),e);let n=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new n(e);if(e instanceof RegExp){let t=new n(e);return t.lastIndex=e.lastIndex,t}if(e instanceof DataView)return new n(e.buffer.slice(0));if(e instanceof Error){let t;return t=e instanceof AggregateError?new n(e.errors,e.message,{cause:e.cause}):new n(e.message,{cause:e.cause}),t.stack=e.stack,Object.assign(t,e),t}return typeof File<`u`&&e instanceof File?new n([e],e.name,{type:e.type,lastModified:e.lastModified}):typeof e==`object`?Object.assign(Object.create(t),e):e}function kn(e){return Cn.Buffer!==void 0&&Cn.Buffer.isBuffer(e)}function An(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function jn(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var Mn=`[object RegExp]`,Nn=`[object String]`,Pn=`[object Number]`,Fn=`[object Boolean]`,In=`[object Arguments]`,Ln=`[object Symbol]`,Rn=`[object Date]`,zn=`[object Map]`,Bn=`[object Set]`,Vn=`[object Array]`,Hn=`[object Function]`,Un=`[object ArrayBuffer]`,Wn=`[object Object]`,Gn=`[object Error]`,Kn=`[object DataView]`,qn=`[object Uint8Array]`,Jn=`[object Uint8ClampedArray]`,Yn=`[object Uint16Array]`,Xn=`[object Uint32Array]`,Zn=`[object BigUint64Array]`,Qn=`[object Int8Array]`,$n=`[object Int16Array]`,er=`[object Int32Array]`,tr=`[object BigInt64Array]`,nr=`[object Float32Array]`,rr=`[object Float64Array]`;function ir(e,t){return ar(e,void 0,e,new Map,t)}function ar(e,t,n,r=new Map,i=void 0){let a=i?.(e,t,n,r);if(a!==void 0)return a;if(En(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=ar(e[a],a,n,r,i);return Object.hasOwn(e,`index`)&&(t.index=e.index),Object.hasOwn(e,`input`)&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){let t=new Map;r.set(e,t);for(let[a,o]of e)t.set(a,ar(o,a,n,r,i));return t}if(e instanceof Set){let t=new Set;r.set(e,t);for(let a of e)t.add(ar(a,void 0,n,r,i));return t}if(kn(e))return e.subarray();if(Dn(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=ar(e[a],a,n,r,i);return t}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,t),or(t,e,n,r,i),t}if(typeof File<`u`&&e instanceof File){let t=new File([e],e.name,{type:e.type});return r.set(e,t),or(t,e,n,r,i),t}if(typeof Blob<`u`&&e instanceof Blob){let t=new Blob([e],{type:e.type});return r.set(e,t),or(t,e,n,r,i),t}if(e instanceof Error){let t=structuredClone(e);return r.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,t.constructor=e.constructor,or(t,e,n,r,i),t}if(e instanceof Boolean){let t=new Boolean(e.valueOf());return r.set(e,t),or(t,e,n,r,i),t}if(e instanceof Number){let t=new Number(e.valueOf());return r.set(e,t),or(t,e,n,r,i),t}if(e instanceof String){let t=new String(e.valueOf());return r.set(e,t),or(t,e,n,r,i),t}if(typeof e==`object`&&sr(e)){let t=Object.create(Object.getPrototypeOf(e));return r.set(e,t),or(t,e,n,r,i),t}return e}function or(e,t,n=e,r,i){let a=[...Object.keys(t),...An(t)];for(let o=0;o<a.length;o++){let s=a[o],c=Object.getOwnPropertyDescriptor(e,s);(c==null||c.writable)&&(e[s]=ar(t[s],s,n,r,i))}}function sr(e){switch(jn(e)){case In:case Vn:case Un:case Kn:case Fn:case Rn:case nr:case rr:case Qn:case $n:case er:case zn:case Pn:case Wn:case Mn:case Bn:case Nn:case Ln:case qn:case Jn:case Yn:case Xn:return!0;default:return!1}}function cr(e){return ar(e,void 0,e,new Map,void 0)}function lr(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:Object.prototype.toString.call(e)===`[object Object]`}function ur(e){return e===`__proto__`}function dr(e){if(typeof e!=`object`||!e)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!==`[object Object]`){let t=e[Symbol.toStringTag];return t==null||!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable?!1:e.toString()===`[object ${t}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function fr(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function pr(e,t,n){return mr(e,t,void 0,void 0,void 0,void 0,n)}function mr(e,t,n,r,i,a,o){let s=o(e,t,n,r,i,a);if(s!==void 0)return s;if(typeof e==typeof t)switch(typeof e){case`bigint`:case`string`:case`boolean`:case`symbol`:case`undefined`:return e===t;case`number`:return e===t||Object.is(e,t);case`function`:return e===t;case`object`:return hr(e,t,a,o)}return hr(e,t,a,o)}function hr(e,t,n,r){if(Object.is(e,t))return!0;let i=jn(e),a=jn(t);if(i===`[object Arguments]`&&(i=Wn),a===`[object Arguments]`&&(a=Wn),i!==a)return!1;switch(i){case Nn:return e.toString()===t.toString();case Pn:return fr(e.valueOf(),t.valueOf());case Fn:case Rn:case Ln:return Object.is(e.valueOf(),t.valueOf());case Mn:return e.source===t.source&&e.flags===t.flags;case Hn:return e===t}n??=new Map;let o=n.get(e),s=n.get(t);if(o!=null&&s!=null)return o===t;n.set(e,t),n.set(t,e);try{switch(i){case zn:if(e.size!==t.size)return!1;for(let[i,a]of e.entries())if(!t.has(i)||!mr(a,t.get(i),i,e,t,n,r))return!1;return!0;case Bn:{if(e.size!==t.size)return!1;let i=Array.from(e.values()),a=Array.from(t.values());for(let o=0;o<i.length;o++){let s=i[o],c=a.findIndex(i=>mr(s,i,void 0,e,t,n,r));if(c===-1)return!1;a.splice(c,1)}return!0}case Vn:case qn:case Jn:case Yn:case Xn:case Zn:case Qn:case $n:case er:case tr:case nr:case rr:if(kn(e)!==kn(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!mr(e[i],t[i],i,e,t,n,r))return!1;return!0;case Un:return e.byteLength===t.byteLength&&hr(new Uint8Array(e),new Uint8Array(t),n,r);case Kn:return e.byteLength!==t.byteLength||e.byteOffset!==t.byteOffset?!1:hr(new Uint8Array(e),new Uint8Array(t),n,r);case Gn:return e.name===t.name&&e.message===t.message;case Wn:{if(!(hr(e.constructor,t.constructor,n,r)||lr(e)&&lr(t)))return!1;let i=[...Object.keys(e),...An(e)],a=[...Object.keys(t),...An(t)];if(i.length!==a.length)return!1;for(let a=0;a<i.length;a++){let o=i[a],s=e[o];if(!Object.hasOwn(t,o))return!1;let c=t[o];if(!mr(s,c,o,e,t,n,r))return!1}return!0}default:return!1}}finally{n.delete(e),n.delete(t)}}function gr(e,t){return pr(e,t,Tn)}function _r(e){return Number.isSafeInteger(e)&&e>=0}var vr={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`};function yr(e){return e.replace(/[&<>"']/g,e=>vr[e])}function br(e){return e!=null&&typeof e!=`function`&&_r(e.length)}function xr(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(xr).join(`,`);let t=String(e);return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function Sr(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function Cr(e){if(Array.isArray(e))return e.map(Sr);if(typeof e==`symbol`)return[e];e=xr(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1;for(e.charCodeAt(0)===46&&t.push(``);r<n;){let s=e[r];if(a)s===`\\`&&r+1<n?(r++,i+=e[r]):s===a?a=``:i+=s;else if(o)s===`"`||s===`'`?a=s:s===`]`?(o=!1,t.push(i),i=``):i+=s;else if(s===`[`)o=!0,i&&=(t.push(i),``);else if(s===`.`){i&&=(t.push(i),``);let n=e[r+1];(n===void 0||n===`.`)&&t.push(``)}else i+=s;r++}return i&&t.push(i),t}var wr=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function Tr(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:wr.test(e);default:return!1}}function Er(e,t,n){if(e==null)return n;switch(typeof t){case`string`:{if(ur(t))return n;let r=e[t];return r===void 0?Tr(t)&&!Object.hasOwn(e,t)?Er(e,Cr(t),n):n:r}case`number`:case`symbol`:{typeof t==`number`&&(t=Sr(t));let r=e[t];return r===void 0?n:r}default:{if(Array.isArray(t))return Dr(e,t,n);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),ur(t))return n;let r=e[t];return r===void 0?n:r}}}function Dr(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||ur(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}function Or(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function kr(e,t){return ir(e,(n,r,i,a)=>{let o=t?.(n,r,i,a);if(o!==void 0)return o;if(typeof e==`object`){if(jn(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return a.set(e,t),or(t,e,i,a),t}switch(Object.prototype.toString.call(e)){case Pn:case Nn:case Fn:{let t=new e.constructor(e?.valueOf());return or(t,e),t}case In:{let t={};return or(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function Ar(e){return kr(e)}function jr(e){return typeof e==`object`&&!!e&&jn(e)===`[object Arguments]`}var Mr=/^(?:0|[1-9]\d*)$/;function Nr(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e<t;case`symbol`:return!1;case`string`:return Mr.test(e)}}function Pr(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&Tr(t)&&!(t in Object(e))?Cr(t):[t],n.length===0)return!1;let r=e;for(let e=0;e<n.length;e++){let t=n[e];if((r==null||!Object.hasOwn(r,t))&&!((Array.isArray(r)||jr(r))&&Nr(t)&&t<r.length))return!1;r=r[t]}return!0}function Fr(e){return typeof e==`object`&&!!e}function Ir(e){return Fr(e)&&br(e)}function Lr(e){return typeof e==`symbol`||e instanceof Symbol}var Rr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zr=/^\w*$/;function Br(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||Lr(e)?!0:typeof e==`string`&&(zr.test(e)||!Rr.test(e))||t!=null&&Object.hasOwn(t,e)}function Vr(e){return Dn(e)}var Hr=(e,t,n)=>{let r=e[t];(!(Object.hasOwn(e,t)&&fr(r,n))||n===void 0&&!(t in e))&&(e[t]=n)};function Ur(e,t,n,r){if(e==null&&!Or(e))return e;let i;i=Br(t,e)?[t]:Array.isArray(t)?t:Cr(t);let a=n(Er(e,i)),o=e;for(let t=0;t<i.length&&o!=null;t++){let n=Sr(i[t]);if(ur(n))continue;let s;if(t===i.length-1)s=a;else{let a=o[n],c=r?.(a,n,e);s=c===void 0?Or(a)?a:Nr(i[t+1])?[]:{}:c}Hr(o,n,s),o=o[n]}return e}function Wr(e,t,n){return Ur(e,t,()=>n,()=>void 0)}function Gr(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=wn(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?(s=e.apply(this,t),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function Kr(e,...t){let n=t.slice(0,-1),r=t[t.length-1],i=e;for(let e=0;e<n.length;e++){let t=n[e];i=qr(i,t,r,new Map)}return i}function qr(e,t,n,r){if(En(e)&&(e=Object(e)),typeof t!=`object`||!t)return e;if(r.has(t))return On(r.get(t));if(r.set(t,e),Array.isArray(t)){t=t.slice();for(let e=0;e<t.length;e++)t[e]=t[e]??void 0}let i=[...Object.keys(t),...An(t)];for(let a=0;a<i.length;a++){let o=i[a];if(ur(o))continue;let s=t[o],c=e[o];if(jr(s)&&(s={...s}),jr(c)&&(c={...c}),kn(s)&&(s=Ar(s)),Array.isArray(s))if(Array.isArray(c)){let e=[],t=Reflect.ownKeys(c);for(let n=0;n<t.length;n++){let r=t[n];e[r]=c[r]}c=e}else if(Ir(c)){let e=[];for(let t=0;t<c.length;t++)e[t]=c[t];c=e}else c=[];let l=n(c,s,o,e,t,r);l===void 0?Array.isArray(s)||Fr(c)&&Fr(s)&&(dr(c)||dr(s)||Vr(c)||Vr(s))?e[o]=qr(c,s,n,r):c==null&&dr(s)?e[o]=qr({},s,n,r):c==null&&Vr(s)?e[o]=Ar(s):(c===void 0||s!==void 0)&&(e[o]=s):e[o]=l}return e}function Jr(e,...t){return Kr(e,...t,Tn)}function Yr(e){return yr(xr(e))}var Xr=e=>typeof File<`u`&&e instanceof File||e instanceof Blob||typeof FileList<`u`&&e instanceof FileList&&e.length>0,Zr=e=>e instanceof FormData||Xr(e)||typeof e==`object`&&!!e&&Object.values(e).some(e=>Zr(e)),Qr=class extends Error{response;constructor(e){super(`HTTP error ${e.status}`),this.name=`HttpResponseError`,this.response=e}},$r=class extends Error{constructor(e=`Request was cancelled`){super(e),this.name=`HttpCancelledError`}},ei=class extends Error{constructor(e=`Network error`){super(e),this.name=`HttpNetworkError`}};function ti(e){let t=new URLSearchParams;return Object.entries(e).forEach(([e,n])=>{n!=null&&(Array.isArray(n)?n.forEach(n=>t.append(`${e}[]`,String(n))):typeof n==`object`?t.append(e,JSON.stringify(n)):t.append(e,String(n)))}),t.toString()}function ni(e,t,n){if(t&&!e.startsWith(`http://`)&&!e.startsWith(`https://`)&&(e=t.replace(/\/$/,``)+`/`+e.replace(/^\//,``)),n&&Object.keys(n).length>0){let t=ti(n);t&&(e+=(e.includes(`?`)?`&`:`?`)+t)}return e}function ri(){return typeof window>`u`?null:window.axios?.defaults?.headers?.common?.[`X-Requested-With`]??null}function ii(e,t=new FormData,n=null){for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&ai(t,n?`${n}[${r}]`:r,e[r]);return t}function ai(e,t,n){if(Array.isArray(n))return n.forEach((n,r)=>ai(e,`${t}[${r}]`,n));if(n instanceof Date)return e.append(t,n.toISOString());if(typeof File<`u`&&n instanceof File)return e.append(t,n,n.name);if(n instanceof Blob)return e.append(t,n);if(typeof n==`boolean`)return e.append(t,n?`1`:`0`);if(typeof n==`string`)return e.append(t,n);if(typeof n==`number`)return e.append(t,`${n}`);if(n==null)return e.append(t,``);ii(n,e,t)}function oi(e,t){if(e!=null)return e instanceof FormData?e:typeof e==`object`&&Zr(e)?ii(e):typeof e==`object`||t[`Content-Type`]?.includes(`application/json`)?JSON.stringify(e):String(e)}function si(e){let t={};return e.forEach((e,n)=>{t[n.toLowerCase()]=e}),t}function ci(e={}){let t=e.xsrfCookieName??`XSRF-TOKEN`,n=e.xsrfHeaderName??`X-XSRF-TOKEN`;function r(){if(typeof document>`u`)return null;let e=document.cookie.match(RegExp(`(^|;\\s*)`+t+`=([^;]*)`));return e?decodeURIComponent(e[2]):null}return{setXsrfCookieName(e){t=e},setXsrfHeaderName(e){n=e},async request(e){let t=ni(e.url,e.baseURL,e.params),i=e.method.toUpperCase(),a={},o=ri();o&&(a[`X-Requested-With`]=o),e.data!==void 0&&![`GET`,`DELETE`].includes(i)&&!(e.data instanceof FormData)&&!Zr(e.data)&&(a[`Content-Type`]=`application/json`),e.headers&&Object.entries(e.headers).forEach(([e,t])=>{t!==void 0&&(a[e]=String(t))});let s=r();s&&![`GET`,`HEAD`,`OPTIONS`].includes(i)&&(a[n]=s);let c=e.signal,l,u=e.timeout??3e4;if(u>0&&!c){let e=new AbortController;c=e.signal,l=setTimeout(()=>e.abort(),u)}let d=[`GET`,`DELETE`].includes(i)?void 0:oi(e.data,a);d instanceof FormData&&delete a[`Content-Type`];try{let n=await fetch(t,{method:i,headers:a,body:d,signal:c,credentials:e.credentials??`same-origin`});l&&clearTimeout(l);let r;r=n.headers.get(`content-type`)?.includes(`application/json`)?await n.json():await n.text();let o={status:n.status,data:r,headers:si(n.headers)};if(!n.ok)throw new Qr(o);return o}catch(e){throw l&&clearTimeout(l),e instanceof Qr?e:e instanceof DOMException&&e.name===`AbortError`?new $r:e instanceof TypeError?new ei(e.message):e}}}}var li=ci(),ui=li,di=void 0,fi=void 0,pi=`same-origin`,mi=e=>`${e.method}:${e.baseURL??di??``}${e.url}`,hi=e=>e.status===204&&e.headers[`precognition-success`]===`true`,gi={},_i={get:(e,t={},n={})=>yi(vi(`get`,e,t,n)),post:(e,t={},n={})=>yi(vi(`post`,e,t,n)),patch:(e,t={},n={})=>yi(vi(`patch`,e,t,n)),put:(e,t={},n={})=>yi(vi(`put`,e,t,n)),delete:(e,t={},n={})=>yi(vi(`delete`,e,t,n)),useHttpClient(e){return ui=e,_i},withBaseURL(e){return di=e,_i},withTimeout(e){return fi=e,_i},withCredentials(e){return pi=typeof e==`string`?e:e?`include`:`omit`,_i},fingerprintRequestsUsing(e){return mi=e===null?()=>null:e,_i},determineSuccessUsing(e){return hi=e,_i},withXsrfCookieName(e){return li.setXsrfCookieName(e),_i},withXsrfHeaderName(e){return li.setXsrfHeaderName(e),_i}},vi=(e,t,n,r)=>({url:t,method:e,...r,...[`get`,`delete`].includes(e)?{params:Jr({},n,r?.params)}:{data:Jr({},n,r?.data)}}),yi=(e={})=>{let t=[bi,Si,Ci].reduce((e,t)=>t(e),e);return(t.onBefore??(()=>!0))()===!1?Promise.resolve(null):((t.onStart??(()=>null))(),ui.request({method:t.method,url:t.url,baseURL:t.baseURL??di,data:t.data,params:t.params,headers:t.headers,signal:t.signal,timeout:t.timeout,credentials:pi}).then(async e=>{t.precognitive&&wi(e);let n=e.status,r=e;return t.precognitive&&t.onPrecognitionSuccess&&hi(e)&&(r=await Promise.resolve(t.onPrecognitionSuccess(e)??r)),t.onSuccess&&xi(n)&&(r=await Promise.resolve(t.onSuccess(r)??r)),(Ei(t,n)??(e=>e))(r)??r},e=>{if(Ti(e))return Promise.reject(e);let n=e;return t.precognitive&&wi(n.response),(Ei(t,n.response.status)??((e,t)=>Promise.reject(t)))(n.response,n)}).finally(t.onFinish??(()=>null)))},bi=e=>{let t=e.only??e.validate;return{...e,timeout:e.timeout??fi,precognitive:e.precognitive!==!1,fingerprint:e.fingerprint===void 0?mi(e,ui):e.fingerprint,headers:{...e.headers,Accept:`application/json`,"Content-Type":Di(e),...e.precognitive===!1?{}:{Precognition:!0},...t?{"Precognition-Validate-Only":Array.from(t).join()}:{}}}},xi=e=>e>=200&&e<300,Si=e=>typeof e.fingerprint==`string`?(gi[e.fingerprint]?.abort(),delete gi[e.fingerprint],e):e,Ci=e=>typeof e.fingerprint!=`string`||e.signal||!e.precognitive?e:(gi[e.fingerprint]=new AbortController,{...e,signal:gi[e.fingerprint].signal}),wi=e=>{if(e.headers?.precognition!==`true`)throw Error(`Did not receive a Precognition response. Ensure you have the Precognition middleware in place for the route.`)},Ti=e=>!(e instanceof Qr)||typeof e.response?.status!=`number`,Ei=(e,t)=>({401:e.onUnauthorized,403:e.onForbidden,404:e.onNotFound,409:e.onConflict,422:e.onValidationError,423:e.onLocked})[t],Di=e=>e.headers?.[`Content-Type`]??e.headers?.[`Content-type`]??e.headers?.[`content-type`]??(Zr(e.data)?`multipart/form-data`:`application/json`),Oi=(e,t)=>{if(!e.includes(`*`))return[e];let n=e.split(`.`),r=[``];for(let e of n)if(e===`*`){let e=[];for(let n of r){let r=n?Er(t,n):t;if(Array.isArray(r))for(let t=0;t<r.length;t++)e.push(n?`${n}.${t}`:String(t));else if(typeof r==`object`&&r)for(let t of Object.keys(r))e.push(n?`${n}.${t}`:t)}r=e}else r=r.map(t=>t?`${t}.${e}`:e);return r},ki=(e,t)=>t.includes(`*`)?RegExp(`^`+t.replace(/\./g,`\\.`).replace(/\*/g,`[^.]+`)+`$`).test(e):e===t,Ai=(e,t)=>Object.fromEntries(Object.entries(e).filter(([e])=>!t.some(t=>ki(e,t)))),H=(e,t={})=>{let n={errorsChanged:[],touchedChanged:[],validatingChanged:[],validatedChanged:[]},r=!1,i=!1,a=e=>e===i?[]:(i=e,n.validatingChanged),o=[],s=e=>{let t=[...new Set(e)];return o.length!==t.length||!t.every(e=>o.includes(e))?(o=t,n.validatedChanged):[]},c=()=>o.filter(e=>d[e]===void 0),l=[],u=e=>{let t=[...new Set(e)];return l.length!==t.length||!t.every(e=>l.includes(e))?(l=t,n.touchedChanged):[]},d={},f=e=>{let t=Mi(e);return gr(d,t)?[]:(d=t,n.errorsChanged)},p=e=>{let t={...d};return delete t[Ni(e)],f(t)},m=()=>Object.keys(d).length>0,h=1500,g=e=>{h=e,S.cancel(),S=x()},_=t,v=null,y=[],b=null,x=()=>Gr(t=>{e({get:(e,n={},r={})=>_i.get(e,T(n),C(r,t,n)),post:(e,n={},r={})=>_i.post(e,T(n),C(r,t,n)),patch:(e,n={},r={})=>_i.patch(e,T(n),C(r,t,n)),put:(e,n={},r={})=>_i.put(e,T(n),C(r,t,n)),delete:(e,n={},r={})=>_i.delete(e,T(n),C(r,t,n))}).catch(e=>e instanceof $r||e instanceof Qr&&e.response?.status===422?null:Promise.reject(e))},h,{leading:!0,trailing:!0}),S=x(),C=(e,t,n={})=>{let r={...e,...t},i=Array.from(r.only??r.validate??l);return{...t,...Jr({},e,t),only:i,timeout:r.timeout??5e3,onValidationError:(e,t)=>([...s([...o,...i]),...f(Jr(Ai({...d},i),e.data.errors))].forEach(e=>e()),r.onValidationError?r.onValidationError(e,t):Promise.reject(t)),onSuccess:e=>(s([...o,...i]).forEach(e=>e()),r.onSuccess?r.onSuccess(e):e),onPrecognitionSuccess:e=>([...s([...o,...i]),...f(Ai({...d},i))].forEach(e=>e()),r.onPrecognitionSuccess?r.onPrecognitionSuccess(e):e),onBefore:()=>{let e=l.some(e=>e.includes(`*`)),t=e?[...new Set(l.flatMap(e=>Oi(e,n)))]:l;return r.onBeforeValidation&&r.onBeforeValidation({data:n,touched:t},{data:_,touched:y})===!1||(r.onBefore||(()=>!0))()===!1?!1:(e&&u(t).forEach(e=>e()),b=l,v=n,!0)},onStart:()=>{a(!0).forEach(e=>e()),(r.onStart??(()=>null))()},onFinish:()=>{a(!1).forEach(e=>e()),y=b,_=v,b=v=null,(r.onFinish??(()=>null))()}}},w=(e,t,n)=>{if(e===void 0){let e=Array.from(n?.only??n?.validate??[]);u([...l,...e]).forEach(e=>e()),S(n??{});return}if(Xr(t)&&!r){console.warn(`Precognition file validation is not active. Call the "validateFiles" function on your form to enable it.`);return}e=Ni(e),(e.includes(`*`)||Er(_,e)!==t)&&(u([e,...l]).forEach(e=>e()),S(n??{}))},T=e=>r===!1?Pi(e):e,E={touched:()=>l,validate(e,t,n){return typeof e==`object`&&!(`target`in e)&&(n=e,e=t=void 0),w(e,t,n),E},touch(e){let t=Array.isArray(e)?e:[Ni(e)];return u([...l,...t]).forEach(e=>e()),E},validating:()=>i,valid:c,errors:()=>d,hasErrors:m,setErrors(e){return f(e).forEach(e=>e()),E},forgetError(e){return p(e).forEach(e=>e()),E},defaults(e){return t=e,_=e,E},reset(...e){if(e.length===0)u([]).forEach(e=>e());else{let n=[...l];e.forEach(e=>{n.includes(e)&&n.splice(n.indexOf(e),1),Wr(_,e,Er(t,e))}),u(n).forEach(e=>e())}return E},setTimeout(e){return g(e),E},on(e,t){return n[e].push(t),E},validateFiles(){return r=!0,E},withoutFileValidation(){return r=!1,E}};return E},ji=e=>Object.keys(e).reduce((t,n)=>({...t,[n]:Array.isArray(e[n])?e[n][0]:e[n]}),{}),Mi=e=>Object.keys(e).reduce((t,n)=>({...t,[n]:typeof e[n]==`string`?[e[n]]:e[n]}),{}),Ni=e=>typeof e==`string`?e:e.target.name,Pi=e=>{let t={...e};return Object.keys(t).forEach(e=>{let n=t[e];if(n!==null){if(Xr(n)){delete t[e];return}if(Array.isArray(n)){t[e]=Object.values(Pi({...n}));return}if(typeof n==`object`){t[e]=Pi(t[e]);return}}}),t},Fi=new class{config={};defaults;constructor(e){this.defaults=e}extend(e){return e&&(this.defaults={...this.defaults,...e}),this}replace(e){this.config=e}get(e){return Pr(this.config,e)?Er(this.config,e):Er(this.defaults,e)}set(e,t){typeof e==`string`?Wr(this.config,e,t):Object.entries(e).forEach(([e,t])=>{Wr(this.config,e,t)})}}({form:{recentlySuccessfulDuration:2e3,forceIndicesArrayFormatInFormData:!0,withAllErrors:!1},prefetch:{cacheFor:3e4,hoverDelay:75}});function Ii(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}function Li(e,t){return document.dispatchEvent(new CustomEvent(`inertia:${e}`,t))}var Ri=e=>Li(`before`,{cancelable:!0,detail:{visit:e}}),zi=(e,{page:t,visitId:n}={})=>Li(`error`,{detail:{errors:e,page:t,visitId:n}}),Bi=e=>Li(`networkError`,{cancelable:!0,detail:{error:e}}),Vi=e=>Li(`finish`,{detail:{visit:e}}),Hi=e=>Li(`httpException`,{cancelable:!0,detail:{response:e}}),Ui=e=>Li(`beforeUpdate`,{detail:{page:e}}),Wi=(e,{cached:t=!1,visitId:n}={})=>Li(`navigate`,{detail:{page:e,cached:t,visitId:n}}),Gi=(e,{replace:t,visitId:n})=>Li(`clientVisit`,{detail:{page:e,replace:t,visitId:n}}),Ki=e=>Li(`progress`,{detail:{progress:e}}),qi=e=>Li(`start`,{detail:{visit:e}}),Ji=(e,{visitId:t}={})=>Li(`success`,{detail:{page:e,visitId:t}}),Yi=(e,t)=>Li(`prefetched`,{detail:{fetchedAt:Date.now(),response:e,visit:t}}),Xi=e=>Li(`prefetching`,{detail:{visit:e}}),Zi=e=>Li(`flash`,{detail:{flash:e}}),Qi=(e,t)=>Li(`location`,{cancelable:!0,detail:{url:e,versionChange:t}}),$i=class{static locationVisitKey=`inertiaLocationVisit`;static set(e,t){typeof window<`u`&&window.sessionStorage.setItem(e,JSON.stringify(t))}static get(e){if(typeof window<`u`)return JSON.parse(window.sessionStorage.getItem(e)||`null`)}static merge(e,t){let n=this.get(e);n===null?this.set(e,t):this.set(e,{...n,...t})}static remove(e){typeof window<`u`&&window.sessionStorage.removeItem(e)}static removeNested(e,t){let n=this.get(e);n!==null&&(delete n[t],this.set(e,n))}static exists(e){try{return this.get(e)!==null}catch{return!1}}static clear(){typeof window<`u`&&window.sessionStorage.clear()}},ea=async e=>{if(typeof window>`u`)throw Error(`Unable to encrypt history`);let t=aa(),n=await ca(await la());if(!n)throw Error(`Unable to encrypt history`);return await ra(t,n,e)},ta={key:`historyKey`,iv:`historyIv`},na=async e=>{let t=aa(),n=await la();if(!n)throw Error(`Unable to decrypt history`);return await ia(t,n,e)},ra=async(e,t,n)=>{if(typeof window>`u`)throw Error(`Unable to encrypt history`);if(window.crypto.subtle===void 0)return console.warn(`Encryption is not supported in this environment. SSL is required.`),Promise.resolve(n);let r=new TextEncoder,i=JSON.stringify(n),a=new Uint8Array(i.length*3),o=r.encodeInto(i,a);return window.crypto.subtle.encrypt({name:`AES-GCM`,iv:e},t,a.subarray(0,o.written))},ia=async(e,t,n)=>{if(window.crypto.subtle===void 0)return console.warn(`Decryption is not supported in this environment. SSL is required.`),Promise.resolve(n);let r=await window.crypto.subtle.decrypt({name:`AES-GCM`,iv:e},t,n);return JSON.parse(new TextDecoder().decode(r))},aa=()=>{let e=$i.get(ta.iv);if(e)return new Uint8Array(e);let t=window.crypto.getRandomValues(new Uint8Array(12));return $i.set(ta.iv,Array.from(t)),t},oa=async()=>window.crypto.subtle===void 0?(console.warn(`Encryption is not supported in this environment. SSL is required.`),Promise.resolve(null)):window.crypto.subtle.generateKey({name:`AES-GCM`,length:256},!0,[`encrypt`,`decrypt`]),sa=async e=>{if(window.crypto.subtle===void 0)return console.warn(`Encryption is not supported in this environment. SSL is required.`),Promise.resolve();let t=await window.crypto.subtle.exportKey(`raw`,e);$i.set(ta.key,Array.from(new Uint8Array(t)))},ca=async e=>{if(e)return e;let t=await oa();return t?(await sa(t),t):null},la=async()=>{let e=$i.get(ta.key);return e?await window.crypto.subtle.importKey(`raw`,new Uint8Array(e),{name:`AES-GCM`,length:256},!0,[`encrypt`,`decrypt`]):null},ua=e=>{let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t},da=(e,t,n)=>{if(e===t)return!0;for(let r in e)if(!n.includes(r)&&e[r]!==t[r]&&!fa(e[r],t[r]))return!1;for(let r in t)if(!n.includes(r)&&!(r in e))return!1;return!0},fa=(e,t)=>{switch(typeof e){case`object`:return da(e,t,[]);case`function`:return e.toString()===t.toString();default:return e===t}},pa={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},ma=e=>{if(typeof e==`number`)return e;for(let[t,n]of Object.entries(pa))if(e.endsWith(t))return parseFloat(e)*n;return parseInt(e)},ha=new class{cached=[];inFlightRequests=[];removalTimers=[];currentUseId=null;add(e,t,{cacheFor:n,cacheTags:r}){if(this.findInFlight(e))return Promise.resolve();let i=this.findCached(e);if(!e.fresh&&i&&i.staleTimestamp>Date.now())return Promise.resolve();let[a,o]=this.extractStaleValues(n),s=new Promise((n,r)=>{t({...e,onCancel:()=>{this.remove(e),e.onCancel(),r()},onError:t=>{this.remove(e),e.onError(t),r()},onPrefetching(t){e.onPrefetching(t)},onPrefetched(t,n){e.onPrefetched(t,n)},onPrefetchResponse(e){n(e)},onPrefetchError(t){ha.removeFromInFlight(e),r(t)}})}).then(t=>{this.remove(e);let n=t.getPageResponse();U.mergeOncePropsIntoResponse(n),this.cached.push({params:{...e},staleTimestamp:Date.now()+a,expiresAt:Date.now()+o,response:s,singleUse:o===0,timestamp:Date.now(),inFlight:!1,tags:Array.isArray(r)?r:[r]});let i=this.getShortestOncePropTtl(n);return this.scheduleForRemoval(e,i?Math.min(o,i):o),this.removeFromInFlight(e),t.handlePrefetch(),t});return this.inFlightRequests.push({params:{...e},response:s,staleTimestamp:null,inFlight:!0}),s}removeAll(){this.cached=[],this.removalTimers.forEach(e=>{clearTimeout(e.timer)}),this.removalTimers=[]}removeByTags(e){this.cached=this.cached.filter(t=>!t.tags.some(t=>e.includes(t)))}remove(e){this.cached=this.cached.filter(t=>!this.paramsAreEqual(t.params,e)),this.clearTimer(e)}removeFromInFlight(e){this.inFlightRequests=this.inFlightRequests.filter(t=>!this.paramsAreEqual(t.params,e))}extractStaleValues(e){let[t,n]=this.cacheForToStaleAndExpires(e);return[ma(t),ma(n)]}cacheForToStaleAndExpires(e){if(!Array.isArray(e))return[e,e];switch(e.length){case 0:return[0,0];case 1:return[e[0],e[0]];default:return[e[0],e[1]]}}clearTimer(e){let t=this.removalTimers.find(t=>this.paramsAreEqual(t.params,e));t&&(clearTimeout(t.timer),this.removalTimers=this.removalTimers.filter(e=>e!==t))}scheduleForRemoval(e,t){if(!(typeof window>`u`)&&(this.clearTimer(e),t>0)){let n=window.setTimeout(()=>this.remove(e),t);this.removalTimers.push({params:e,timer:n})}}get(e){return this.findCached(e)||this.findInFlight(e)}use(e,t){let n=`${t.url.pathname}-${Date.now()}-${Math.random().toString(36).substring(7)}`;this.currentUseId=n;let r={...t,cached:!0};return e.response.then(e=>{if(this.currentUseId===n)return e.mergeParams({...r,onPrefetched:()=>{}}),this.removeSingleUseItems(t),e.handle()})}removeSingleUseItems(e){this.cached=this.cached.filter(t=>!this.paramsAreEqual(t.params,e)||!t.singleUse)}findCached(e){return this.cached.find(t=>this.paramsAreEqual(t.params,e))||null}findInFlight(e){return this.inFlightRequests.find(t=>this.paramsAreEqual(t.params,e))||null}withoutPurposePrefetchHeader(e){let t=cr(e);return t.headers.Purpose===`prefetch`&&delete t.headers.Purpose,t}paramsAreEqual(e,t){return da(this.withoutPurposePrefetchHeader(e),this.withoutPurposePrefetchHeader(t),[`id`,`showProgress`,`replace`,`prefetch`,`preserveScroll`,`preserveState`,`onBefore`,`onBeforeUpdate`,`onStart`,`onProgress`,`onFinish`,`onCancel`,`onSuccess`,`onError`,`onFlash`,`onPrefetched`,`onCancelToken`,`onPrefetching`,`async`,`viewTransition`,`optimistic`,`component`,`pageProps`,`cached`])}updateCachedOncePropsFromCurrentPage(){this.cached.forEach(e=>{e.response.then(t=>{let n=t.getPageResponse();U.mergeOncePropsIntoResponse(n,{force:!0});for(let[e,t]of Object.entries(n.deferredProps??{})){let r=t.filter(e=>Er(n.props,e)===void 0);r.length>0?n.deferredProps[e]=r:delete n.deferredProps[e]}let r=this.getShortestOncePropTtl(n);if(r===null)return;let i=e.expiresAt-Date.now(),a=Math.min(i,r);a>0?this.scheduleForRemoval(e.params,a):this.remove(e.params)})})}getShortestOncePropTtl(e){let t=Object.values(e.onceProps??{}).map(e=>e.expiresAt).filter(e=>!!e);return t.length===0?null:Math.min(...t)-Date.now()}},ga=e=>{if(e.offsetParent===null)return!1;let t=e.getBoundingClientRect(),n=t.top<window.innerHeight&&t.bottom>=0,r=t.left<window.innerWidth&&t.right>=0;return n&&r},_a=e=>{let t=e=>{let t=window.getComputedStyle(e);return t.overflowY===`scroll`?!0:t.overflowY===`auto`?[`visible`,`clip`].includes(t.overflowX)?!0:r(t.maxHeight,e.style.height)||i(e,`height`):!1},n=e=>{let t=window.getComputedStyle(e);return t.overflowX===`scroll`?!0:t.overflowX===`auto`?[`visible`,`clip`].includes(t.overflowY)?!0:r(t.maxWidth,e.style.width)||i(e,`width`):!1},r=(e,t)=>!!(e&&e!==`none`&&e!==`0px`||t&&t!==`auto`&&t!==`0`),i=(e,t)=>{let n=e.parentElement;if(!n)return!1;let r=window.getComputedStyle(n);if([`flex`,`inline-flex`].includes(r.display)){let e=[`column`,`column-reverse`].includes(r.flexDirection);return t===`height`?e:!e}return[`grid`,`inline-grid`].includes(r.display)},a=e?.parentElement;for(;a;){let e=t(a)||n(a);if(window.getComputedStyle(a).display!==`contents`&&e)return a;a=a.parentElement}return null},va=(e,t)=>{if(!t)return e.filter(e=>ga(e));let n=e.indexOf(t),r=[],i=[];for(let t=n;t>=0;t--){let n=e[t];if(ga(n))r.push(n);else break}for(let t=n+1;t<e.length;t++){let n=e[t];if(ga(n))i.push(n);else break}return[...r.reverse(),...i]},ya=(e,t=1)=>{window.requestAnimationFrame(()=>{t>1?ya(e,t-1):e()})},ba=e=>{if(typeof window>`u`)return null;let t=document.querySelector(`script[data-page="${e}"][type="application/json"]`);return t?.textContent?JSON.parse(t.textContent):null},xa=typeof window>`u`,Sa=!xa&&/Firefox/i.test(window.navigator.userAgent),Ca=class{static save(){W.saveScrollPositions(this.getScrollRegions())}static getScrollRegions(){return Array.from(this.regions()).map(e=>({top:e.scrollTop,left:e.scrollLeft}))}static regions(){return document.querySelectorAll(`[scroll-region]`)}static scrollToTop(){if(Sa&&getComputedStyle(document.documentElement).scrollBehavior===`smooth`)return ya(()=>window.scrollTo(0,0),2);window.scrollTo(0,0)}static reset(){!xa&&window.location.hash||this.scrollToTop(),this.regions().forEach(e=>{typeof e.scrollTo==`function`?e.scrollTo(0,0):(e.scrollTop=0,e.scrollLeft=0)}),this.save(),this.scrollToAnchor()}static scrollToAnchor(){let e=xa?null:window.location.hash;e&&setTimeout(()=>{let t=document.getElementById(e.slice(1));t?t.scrollIntoView():this.scrollToTop()})}static restore(e){xa||window.requestAnimationFrame(()=>{this.restoreDocument(),this.restoreScrollRegions(e)})}static restoreScrollRegions(e){xa||this.regions().forEach((t,n)=>{let r=e[n];r&&(typeof t.scrollTo==`function`?t.scrollTo(r.left,r.top):(t.scrollTop=r.top,t.scrollLeft=r.left))})}static restoreDocument(){let e=W.getDocumentScrollPosition();window.scrollTo(e.left,e.top)}static onScroll(e){let t=e.target;typeof t.hasAttribute==`function`&&t.hasAttribute(`scroll-region`)&&this.save()}static onWindowScroll(){W.saveDocumentScrollPosition({top:window.scrollY,left:window.scrollX})}},wa=e=>typeof File<`u`&&e instanceof File||e instanceof Blob||typeof FileList<`u`&&e instanceof FileList&&e.length>0;function Ta(e){return wa(e)||e instanceof FormData&&Array.from(e.values()).some(e=>Ta(e))||typeof e==`object`&&!!e&&Object.values(e).some(e=>Ta(e))}var Ea=e=>e instanceof FormData;function Da(e,t=new FormData,n=null,r=`brackets`){e||={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&ka(t,Oa(n,i,`indices`),e[i],r);return t}function Oa(e,t,n){return e?n===`brackets`?`${e}[]`:`${e}[${t}]`:t}function ka(e,t,n,r){if(Array.isArray(n))return Array.from(n.keys()).forEach(i=>ka(e,Oa(t,i.toString(),r),n[i],r));if(n instanceof Date)return e.append(t,n.toISOString());if(n instanceof File)return e.append(t,n,n.name);if(n instanceof Blob)return e.append(t,n);if(typeof n==`boolean`)return e.append(t,n?`1`:`0`);if(typeof n==`string`)return e.append(t,n);if(typeof n==`number`)return e.append(t,`${n}`);if(n==null)return e.append(t,``);Da(n,e,t,r)}function Aa(e){return/\[\d+\]/.test(decodeURIComponent(e.search))}function ja(e){if(!e||e===`?`)return{};let t={};return e.replace(/^\?/,``).split(`&`).filter(Boolean).forEach(e=>{let[n,r]=Na(e);Fa(t,Pa(n),Pa(r))}),t}function Ma(e,t){let n=[];return La(e,``,n,t),n.length?`?`+n.join(`&`):``}function Na(e){let t=e.indexOf(`=`);return t===-1?[e,``]:[e.substring(0,t),e.substring(t+1)]}function Pa(e){return decodeURIComponent(e.replace(/\+/g,` `))}function Fa(e,t,n){let r=Ia(t);if(r.some(e=>e===`__proto__`))return;let i=e;for(;r.length>1;){let e=r.shift(),t=r[0]===``;(typeof i[e]!=`object`||i[e]===null)&&(i[e]=t?[]:{}),i=i[e]}let a=r.shift();a===``&&Array.isArray(i)?i.push(n):i[a]=n}function Ia(e){let t=[],n=e.split(`[`)[0];n&&t.push(n);let r,i=/\[([^\]]*)\]/g;for(;(r=i.exec(e))!==null;)t.push(r[1]);return t}function La(e,t,n,r){if(e!==void 0){if(e===null){n.push(`${t}=`);return}if(Array.isArray(e)){e.forEach((e,i)=>{La(e,r===`indices`?`${t}[${i}]`:`${t}[]`,n,r)});return}if(typeof e==`object`){Object.keys(e).forEach(i=>{La(e[i],t?`${t}[${i}]`:i,n,r)});return}n.push(`${t}=${encodeURIComponent(String(e))}`)}}function Ra(e){return new URL(e.toString(),typeof window>`u`?void 0:window.location.toString())}var za=(e,t,n,r,i)=>{let a=typeof e==`string`?Ra(e):e;if((Ta(t)||r)&&!Ea(t)&&(Fi.get(`form.forceIndicesArrayFormatInFormData`)&&(i=`indices`),t=Da(t,new FormData,null,i)),Ea(t))return[a,t];let[o,s]=Ba(n,a,t,i);return[Ra(o),s]};function Ba(e,t,n,r=`brackets`){let i=e===`get`&&!Ea(n)&&Object.keys(n).length>0,a=qa(t.toString()),o=a||t.toString().startsWith(`/`)||t.toString()===``,s=!o&&!t.toString().startsWith(`#`)&&!t.toString().startsWith(`?`),c=/^[.]{1,2}([/]|$)/.test(t.toString()),l=t.toString().includes(`?`)||i,u=t.toString().includes(`#`),d=new URL(t.toString(),typeof window>`u`?`http://localhost`:window.location.toString());if(i){let e=Aa(d)?`indices`:r;d.search=Ma({...ja(d.search),...n},e)}return[[a?`${d.protocol}//${d.host}`:``,o?d.pathname:``,s?d.pathname.substring(+!c):``,l?d.search:``,u?d.hash:``].join(``),i?{}:n]}function Va(e){return e=new URL(e.href),e.hash=``,e}var Ha=(e,t)=>{e.hash&&!t.hash&&Va(e).href===t.href&&(t.hash=e.hash)},Ua=(e,t)=>Va(e).href===Va(t).href,Wa=(e,t)=>e.origin===t.origin&&e.pathname===t.pathname;function Ga(e){return typeof e==`object`&&!!e&&e!==void 0&&`url`in e&&`method`in e}function Ka(e){return e.component?typeof e.component==`string`?e.component:(console.error(`The "component" property on the URL method pair received multiple components (${Object.keys(e.component).join(`, `)}), but only a single component string is supported for instant visits. Use the withComponent() method to specify which component to use.`),null):null}function qa(e){return/^([a-z][a-z0-9+.-]*:)?\/\/[^/]/i.test(e)}function Ja(e,t){let n=typeof e==`string`?Ra(e):e;return t?`${n.protocol}//${n.host}${n.pathname}${n.search}${n.hash}`:`${n.pathname}${n.search}${n.hash}`}var U=new class{page;swapComponent;resolveComponent;onFlashCallback;componentId={};listeners=[];isFirstPageLoad=!0;cleared=!1;pendingDeferredProps=null;historyQuotaExceeded=!1;optimisticBaseline={};pendingOptimistics=[];optimisticCounter=0;init({initialPage:e,swapComponent:t,resolveComponent:n,onFlash:r}){return this.page={...e,flash:e.flash??{},rescuedProps:e.rescuedProps??[]},this.swapComponent=t,this.resolveComponent=n,this.onFlashCallback=r,eo.on(`historyQuotaExceeded`,()=>{this.historyQuotaExceeded=!0}),this}set(e,{replace:t=!1,preserveScroll:n=!1,preserveState:r=!1,viewTransition:i=!1,cached:a=!1,visitId:o}={}){Object.keys(e.deferredProps||{}).length&&(this.pendingDeferredProps={deferredProps:e.deferredProps,component:e.component,url:e.url},e.initialDeferredProps===void 0&&(e.initialDeferredProps=e.deferredProps)),this.componentId={};let s=this.componentId;return e.clearHistory&&W.clear(),this.resolve(e.component,e).then(c=>{if(s!==this.componentId)return;e.rememberedState??={};let l=typeof window>`u`,u=l?new URL(e.url):window.location,d=!l&&n?Ca.getScrollRegions():[];t||=Ua(Ra(e.url),u);let f={...e,flash:{}};return new Promise(e=>t?W.replaceState(f,e):W.pushState(f,e)).then(()=>{let s=!this.isTheSame(e);if(!s&&Object.keys(e.props.errors||{}).length>0&&(i=!1),this.page=e,this.cleared=!1,this.hasOnceProps()&&ha.updateCachedOncePropsFromCurrentPage(),s&&this.fireEventsFor(`newComponent`),this.isFirstPageLoad&&this.fireEventsFor(`firstLoad`),this.isFirstPageLoad=!1,this.historyQuotaExceeded){this.historyQuotaExceeded=!1;return}return this.swap({component:c,page:e,preserveState:r,viewTransition:i}).then(()=>{n?window.requestAnimationFrame(()=>Ca.restoreScrollRegions(d)):Ca.reset(),this.pendingDeferredProps&&this.pendingDeferredProps.component===e.component&&this.pendingDeferredProps.url===e.url&&eo.fireInternalEvent(`loadDeferredProps`,this.pendingDeferredProps.deferredProps),this.pendingDeferredProps=null,t||Wi(e,{cached:a,visitId:o})})})})}setQuietly(e,{preserveState:t=!1}={}){return this.resolve(e.component,e).then(n=>(this.page=e,this.cleared=!1,W.setCurrent(e),this.swap({component:n,page:e,preserveState:t,viewTransition:!1})))}clear(){this.cleared=!0}isCleared(){return this.cleared}get(){return this.page}getWithoutFlashData(){return{...this.page,flash:{}}}hasOnceProps(){return Object.keys(this.page.onceProps??{}).length>0}merge(e){this.page={...this.page,...e}}setPropsQuietly(e){return this.page={...this.page,props:e},this.resolve(this.page.component,this.page).then(e=>this.swap({component:e,page:this.page,preserveState:!0,viewTransition:!1}))}setFlash(e){this.page={...this.page,flash:e},this.onFlashCallback?.(e)}setUrlHash(e){this.page.url.includes(e)||(this.page.url+=e)}remember(e){this.page.rememberedState=e}swap({component:e,page:t,preserveState:n,viewTransition:r}){let i=()=>this.swapComponent({component:e,page:t,preserveState:n});if(!r||!document?.startViewTransition||document.visibilityState===`hidden`)return i();let a=typeof r==`boolean`?()=>null:r;return new Promise(e=>{let t=document.startViewTransition(()=>i().then(e));t.ready.catch(()=>{}),a(t)})}resolve(e,t){return Promise.resolve(this.resolveComponent(e,t))}nextOptimisticId(){return++this.optimisticCounter}setBaseline(e,t){e in this.optimisticBaseline||(this.optimisticBaseline[e]=t)}updateBaseline(e,t){e in this.optimisticBaseline&&(this.optimisticBaseline[e]=t)}hasBaseline(e){return e in this.optimisticBaseline}registerOptimistic(e,t){this.pendingOptimistics.push({id:e,callback:t})}unregisterOptimistic(e){this.pendingOptimistics=this.pendingOptimistics.filter(t=>t.id!==e)}replayOptimistics(){let e=Object.keys(this.optimisticBaseline);if(e.length===0)return{};let t=cr(this.page.props);for(let n of e)t[n]=cr(this.optimisticBaseline[n]);for(let{callback:e}of this.pendingOptimistics){let n=e(cr(t));n&&Object.assign(t,n)}let n={};for(let r of e)n[r]=t[r];return n}pendingOptimisticCount(){return this.pendingOptimistics.length}clearOptimisticState(){this.optimisticBaseline={},this.pendingOptimistics=[]}isTheSame(e){return this.page.component===e.component}on(e,t){return this.listeners.push({event:e,callback:t}),()=>{this.listeners=this.listeners.filter(n=>n.event!==e&&n.callback!==t)}}fireEventsFor(e){this.listeners.filter(t=>t.event===e).forEach(e=>e.callback())}mergeOncePropsIntoResponse(e,{force:t=!1}={}){Object.entries(e.onceProps??{}).forEach(([n,r])=>{let i=this.page.onceProps?.[n];i!==void 0&&(t||Er(e.props,r.prop)===void 0)&&(Wr(e.props,r.prop,Er(this.page.props,i.prop)),e.onceProps[n].expiresAt=i.expiresAt)})}},Ya=class{items=[];processingPromise=null;add(e){return this.items.push(e),this.process()}process(){return this.processingPromise??=this.processNext().finally(()=>{this.processingPromise=null}),this.processingPromise}processNext(){let e=this.items.shift();return e?Promise.resolve(e()).then(()=>this.processNext()):Promise.resolve()}},Xa=typeof window>`u`,Za=new Ya,Qa=!Xa&&/CriOS/.test(window.navigator.userAgent),$a=class{rememberedState=`rememberedState`;scrollRegions=`scrollRegions`;preserveUrl=!1;current={};initialState=null;remember(e,t){this.replaceState({...U.getWithoutFlashData(),rememberedState:{...U.get()?.rememberedState??{},[t]:e}})}restore(e){if(!Xa)return this.current[this.rememberedState]?.[e]===void 0?this.initialState?.[this.rememberedState]?.[e]:this.current[this.rememberedState]?.[e]}pushState(e,t=null){if(!Xa){if(this.preserveUrl){t&&t();return}this.current=e,Za.add(()=>this.getPageData(e).then(n=>{let r=()=>this.doPushState({page:n},e.url).then(()=>t?.());return Qa?new Promise(e=>{setTimeout(()=>r().then(e))}):r()}))}}clonePageProps(e){try{return structuredClone(e.props),e}catch{return{...e,props:cr(e.props)}}}getPageData(e){let t=this.clonePageProps(e);return new Promise(n=>e.encryptHistory?ea(t).then(n):n(t))}processQueue(){return Za.process()}decrypt(e=null){if(Xa)return Promise.resolve(e??U.get());let t=e??window.history.state?.page;return this.decryptPageData(t).then(e=>{if(!e)throw Error(`Unable to decrypt history`);return this.initialState===null?this.initialState=e??void 0:this.current=e??{},e})}decryptPageData(e){return e instanceof ArrayBuffer?na(e):Promise.resolve(e)}saveScrollPositions(e){Za.add(()=>Promise.resolve().then(()=>{if(window.history.state?.page&&!gr(this.getScrollRegions(),e))return this.doReplaceState({page:window.history.state.page,scrollRegions:e})}))}saveDocumentScrollPosition(e){Za.add(()=>Promise.resolve().then(()=>{if(window.history.state?.page&&!gr(this.getDocumentScrollPosition(),e))return this.doReplaceState({page:window.history.state.page,documentScrollPosition:e})}))}getScrollRegions(){return window.history.state?.scrollRegions||[]}getDocumentScrollPosition(){return window.history.state?.documentScrollPosition||{top:0,left:0}}replaceState(e,t=null){if(gr(this.current,e)){t&&t();return}let{flash:n,...r}=e;if(U.merge(r),!Xa){if(this.preserveUrl){t&&t();return}this.current=e,Za.add(()=>this.getPageData(e).then(n=>{let r=()=>this.doReplaceState({page:n},e.url).then(()=>t?.());return Qa?new Promise(e=>{setTimeout(()=>r().then(e))}):r()}))}}isHistoryThrottleError(e){return e instanceof Error&&e.name===`SecurityError`&&(e.message.includes(`history.pushState`)||e.message.includes(`history.replaceState`))}isQuotaExceededError(e){return e instanceof Error&&e.name===`QuotaExceededError`}withThrottleProtection(e){return Promise.resolve().then(()=>{try{return e()}catch(e){if(!this.isHistoryThrottleError(e))throw e;console.error(e.message)}})}doReplaceState(e,t){return this.withThrottleProtection(()=>{window.history.replaceState({...e,scrollRegions:e.scrollRegions??window.history.state?.scrollRegions,documentScrollPosition:e.documentScrollPosition??window.history.state?.documentScrollPosition},``,t)})}doPushState(e,t){return this.withThrottleProtection(()=>{try{window.history.pushState(e,``,t)}catch(e){if(!this.isQuotaExceededError(e))throw e;eo.fireInternalEvent(`historyQuotaExceeded`,t)}})}getState(e,t){return this.current?.[e]??t}deleteState(e){this.current[e]!==void 0&&(delete this.current[e],this.replaceState(this.current))}clearInitialState(e){this.initialState&&this.initialState[e]!==void 0&&delete this.initialState[e]}browserHasHistoryEntry(){return!Xa&&!!window.history.state?.page}clear(){$i.remove(ta.key),$i.remove(ta.iv)}setCurrent(e){this.current=e}isValidState(e){return!!e.page}getAllState(){return this.current}};typeof window<`u`&&window.history.scrollRestoration&&(window.history.scrollRestoration=`manual`);var W=new $a,eo=new class{internalListeners=[];init(){typeof window<`u`&&(window.addEventListener(`popstate`,this.handlePopstateEvent.bind(this)),window.addEventListener(`pageshow`,this.handlePageshowEvent.bind(this)),window.addEventListener(`scroll`,Ii(Ca.onWindowScroll.bind(Ca),100),!0)),typeof document<`u`&&document.addEventListener(`scroll`,Ii(Ca.onScroll.bind(Ca),100),!0)}onGlobalEvent(e,t){return this.registerListener(`inertia:${e}`,(e=>{let n=t(e);e.cancelable&&!e.defaultPrevented&&n===!1&&e.preventDefault()}))}on(e,t){return this.internalListeners.push({event:e,listener:t}),()=>{this.internalListeners=this.internalListeners.filter(e=>e.listener!==t)}}onMissingHistoryItem(){U.clear(),this.fireInternalEvent(`missingHistoryItem`)}fireInternalEvent(e,...t){this.internalListeners.filter(t=>t.event===e).forEach(e=>e.listener(...t))}registerListener(e,t){return document.addEventListener(e,t),()=>document.removeEventListener(e,t)}handlePageshowEvent(e){e.persisted&&W.decrypt().catch(()=>this.onMissingHistoryItem())}handlePopstateEvent(e){let t=e.state||null;if(t===null){let e=Ra(U.get().url);e.hash=window.location.hash,W.replaceState({...U.getWithoutFlashData(),url:e.href}),Ca.reset();return}if(!W.isValidState(t))return this.onMissingHistoryItem();W.decrypt(t.page).then(e=>{if(U.get().version!==e.version){this.onMissingHistoryItem();return}K.cancelAll({prefetch:!1}),U.setQuietly(e,{preserveState:!1}).then(()=>{Ca.restore(W.getScrollRegions()),Wi(U.get());let t={},n=U.get().props;for(let[r,i]of Object.entries(e.initialDeferredProps??e.deferredProps??{})){let e=i.filter(e=>Er(n,e)===void 0);e.length>0&&(t[r]=e)}Object.keys(t).length>0&&this.fireInternalEvent(`loadDeferredProps`,t)})}).catch(()=>{this.onMissingHistoryItem()})}},to=new class{type;constructor(){this.type=this.resolveType()}resolveType(){return typeof window>`u`?`navigate`:window.performance?.getEntriesByType(`navigation`)[0]?.type??`navigate`}get(){return this.type}isBackForward(){return this.type===`back_forward`}isReload(){return this.type===`reload`}};function no(){let e=typeof window<`u`?window.crypto:void 0;if(e?.randomUUID)return e.randomUUID();let t=()=>e?.getRandomValues?e.getRandomValues(new Uint8Array(1))[0]:Math.floor(Math.random()*256);return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^t()&15>>e/4).toString(16))}var ro=class{static handle(){this.clearRememberedStateOnReload(),[this.handleBackForward,this.handleLocation,this.handleDefault].find(e=>e.bind(this)())}static clearRememberedStateOnReload(){to.isReload()&&(W.deleteState(W.rememberedState),W.clearInitialState(W.rememberedState))}static handleBackForward(){if(!to.isBackForward()||!W.browserHasHistoryEntry())return!1;let e=W.getScrollRegions();return W.decrypt().then(t=>{let n=no();U.set(t,{preserveScroll:!0,preserveState:!0,visitId:n}).then(()=>{Ca.restore(e),Wi(U.get(),{visitId:n})})}).catch(()=>{eo.onMissingHistoryItem()}),!0}static handleLocation(){if(!$i.exists($i.locationVisitKey))return!1;let e=$i.get($i.locationVisitKey)||{};return $i.remove($i.locationVisitKey),typeof window<`u`&&U.setUrlHash(window.location.hash),W.decrypt(U.get()).then(()=>{let t=no(),n=W.getState(W.rememberedState,{}),r=W.getScrollRegions();U.remember(n),U.set(U.get(),{preserveScroll:e.preserveScroll,preserveState:!0,visitId:t}).then(()=>{e.preserveScroll&&Ca.restore(r),this.fireInitialEvents(t)})}).catch(()=>{eo.onMissingHistoryItem()}),!0}static handleDefault(){typeof window<`u`&&U.setUrlHash(window.location.hash);let e=no();U.set(U.get(),{preserveScroll:!0,preserveState:!0,visitId:e}).then(()=>{to.isReload()?Ca.restore(W.getScrollRegions()):Ca.scrollToAnchor(),this.fireInitialEvents(e)})}static fireInitialEvents(e){let t=U.get();Wi(t,{visitId:e}),Object.keys(t.flash).length>0&&queueMicrotask(()=>Zi(t.flash))}},io=class{intervalId=null;timeoutId=null;throttle=!1;keepAlive=!1;cb;interval;cbCount=0;mode;inFlight=!1;currentCancel=null;stopped=!0;instanceId=0;constructor(e,t,n){this.keepAlive=n.keepAlive??!1,this.mode=n.mode??`overlap`,this.cb=t,this.interval=e,(n.autoStart??!0)&&this.start()}stop(){this.stopped=!0,this.instanceId++,this.inFlight=!1,this.currentCancel=null,this.intervalId&&=(clearInterval(this.intervalId),null),this.timeoutId&&=(clearTimeout(this.timeoutId),null)}start(){if(!(typeof window>`u`)){if(this.stop(),this.stopped=!1,this.mode===`rest`){this.scheduleNext();return}this.intervalId=window.setInterval(()=>this.tick(),this.interval)}}isInBackground(e){this.throttle=!this.keepAlive&&e,this.throttle&&(this.cbCount=0)}scheduleNext(){this.stopped||(this.timeoutId=window.setTimeout(()=>{this.timeoutId=null,this.tick()},this.interval))}tick(){!this.throttle||this.cbCount%10==0?this.fire():this.mode===`rest`&&this.scheduleNext(),this.throttle&&this.cbCount++}fire(){this.inFlight&&this.mode===`cancel`&&this.currentCancel?.();let e=this.instanceId;this.cb({onStart:t=>{e===this.instanceId&&(this.inFlight=!0,this.currentCancel=t)},onFinish:()=>{e===this.instanceId&&(this.inFlight=!1,this.currentCancel=null,this.mode===`rest`&&this.scheduleNext())}})}},ao=new class{polls=[];constructor(){this.setupVisibilityListener()}get count(){return this.polls.length}add(e,t,n){let r=new io(e,t,n);return this.polls.push(r),{stop:()=>r.stop(),start:()=>r.start(),destroy:()=>{r.stop(),this.polls=this.polls.filter(e=>e!==r)}}}clear(){this.polls.forEach(e=>e.stop()),this.polls=[]}setupVisibilityListener(){typeof document>`u`||document.addEventListener(`visibilitychange`,()=>{this.polls.forEach(e=>e.isInBackground(document.hidden))},!1)}},oo=new class{requestHandlers=[];responseHandlers=[];errorHandlers=[];onRequest(e){return this.requestHandlers.push(e),()=>{this.requestHandlers=this.requestHandlers.filter(t=>t!==e)}}onResponse(e){return this.responseHandlers.push(e),()=>{this.responseHandlers=this.responseHandlers.filter(t=>t!==e)}}onError(e){return this.errorHandlers.push(e),()=>{this.errorHandlers=this.errorHandlers.filter(t=>t!==e)}}async processRequest(e){let t=e;for(let e of this.requestHandlers)t=await e(t);return t}async processResponse(e){let t=e;for(let e of this.responseHandlers)t=await e(t);return t}async processError(e){for(let t of this.errorHandlers)await t(e)}},G=class extends Error{code;url;constructor(e,t,n){super(n?`${e} (${n})`:e),this.name=`HttpError`,this.code=t,this.url=n}},so=class extends G{response;constructor(e,t,n){super(e,`ERR_HTTP_RESPONSE`,n),this.name=`HttpResponseError`,this.response=t}},co=class extends G{constructor(e=`Request was cancelled`,t){super(e,`ERR_CANCELLED`,t),this.name=`HttpCancelledError`}},lo=class extends G{cause;constructor(e,t,n){super(e,`ERR_NETWORK`,t),this.name=`HttpNetworkError`,this.cause=n}};function uo(e){let t=document.cookie.match(RegExp(`(^|;\\s*)(`+e+`)=([^;]*)`));return t?decodeURIComponent(t[3]):null}function fo(e){let t={};return e.getAllResponseHeaders().split(`\r
3
+ `).forEach(e=>{let n=e.indexOf(`:`);n>0&&(t[e.slice(0,n).toLowerCase().trim()]=e.slice(n+1).trim())}),t}function po(e){return typeof FormData<`u`&&e instanceof FormData}function mo(e){return typeof e==`string`||po(e)||typeof Blob<`u`&&e instanceof Blob||typeof ArrayBuffer<`u`&&e instanceof ArrayBuffer||typeof ArrayBuffer<`u`&&ArrayBuffer.isView(e)||typeof URLSearchParams<`u`&&e instanceof URLSearchParams}function ho(e,t){if(!t.headers)return;let n=po(t.data);Object.entries(t.headers).forEach(([t,r])=>{(t.toLowerCase()!==`content-type`||!n)&&e.setRequestHeader(t,String(r))})}function go(e,t){if(!t||Object.keys(t).length===0)return e;let[n]=Ba(`get`,e,t);return n}var _o=class{xsrfCookieName;xsrfHeaderName;constructor(e={}){this.xsrfCookieName=e.xsrfCookieName??`XSRF-TOKEN`,this.xsrfHeaderName=e.xsrfHeaderName??`X-XSRF-TOKEN`}async request(e){let t=await oo.processRequest(e);try{let e=await this.doRequest(t);return await oo.processResponse(e)}catch(e){throw(e instanceof so||e instanceof lo||e instanceof co)&&await oo.processError(e),e}}doRequest(e){return new Promise((t,n)=>{let r=new XMLHttpRequest,i=go(e.url,e.params);r.open(e.method.toUpperCase(),i,!0);let a=uo(this.xsrfCookieName);a&&r.setRequestHeader(this.xsrfHeaderName,a),Object.keys(e.headers??{}).some(e=>e.toLowerCase()===`x-requested-with`)||r.setRequestHeader(`X-Requested-With`,`XMLHttpRequest`);let o=null;e.data!==null&&e.data!==void 0&&(mo(e.data)?o=e.data:typeof e.data==`object`?(o=JSON.stringify(e.data),!e.headers?.[`Content-Type`]&&!e.headers?.[`content-type`]&&r.setRequestHeader(`Content-Type`,`application/json`)):o=String(e.data)),ho(r,e),e.onUploadProgress&&(r.upload.onprogress=t=>{let n=t.lengthComputable?t.loaded/t.total:void 0;e.onUploadProgress({progress:n,percentage:n?Math.round(n*100):0,loaded:t.loaded,total:t.lengthComputable?t.total:void 0})}),e.signal&&e.signal.addEventListener(`abort`,()=>r.abort()),r.onabort=()=>n(new co(`Request was cancelled`,e.url)),r.onerror=()=>n(new lo(`Network error`,e.url)),r.onload=()=>{let i={status:r.status,data:r.responseText,headers:fo(r)};r.status>=400?n(new so(`Request failed with status ${r.status}`,i,e.url)):t(i)},r.send(o)})}},vo=new _o;function yo(e){return!(`request`in e)}var bo={getClient(){return vo},setClient(e){if(!yo(e)){vo=e;return}vo=new _o(e),e.xsrfCookieName&&_i.withXsrfCookieName(e.xsrfCookieName),e.xsrfHeaderName&&_i.withXsrfHeaderName(e.xsrfHeaderName)},onRequest:oo.onRequest.bind(oo),onResponse:oo.onResponse.bind(oo),onError:oo.onError.bind(oo),processRequest:oo.processRequest.bind(oo),processResponse:oo.processResponse.bind(oo),processError:oo.processError.bind(oo)},xo=new class{requestHandlers=[];responseHandlers=[];onVisitRequest(e){return this.requestHandlers.push(e),()=>{this.requestHandlers=this.requestHandlers.filter(t=>t!==e)}}onVisitResponse(e){return this.responseHandlers.push(e),()=>{this.responseHandlers=this.responseHandlers.filter(t=>t!==e)}}async processRequest(e,t){let n=t;for(let t of this.requestHandlers)n=await t(e,n);return n}async processResponse(e,t){let n=t;for(let t of this.responseHandlers)n=await t(e,n);return n}};function So(){typeof window>`u`||(window.__inertia_interceptors__=xo)}var Co=class e{callbacks=[];params;constructor(e){if(!e.prefetch)this.params=e;else{let t={onBefore:this.wrapCallback(e,`onBefore`),onBeforeUpdate:this.wrapCallback(e,`onBeforeUpdate`),onStart:this.wrapCallback(e,`onStart`),onProgress:this.wrapCallback(e,`onProgress`),onFinish:this.wrapCallback(e,`onFinish`),onCancel:this.wrapCallback(e,`onCancel`),onSuccess:this.wrapCallback(e,`onSuccess`),onError:this.wrapCallback(e,`onError`),onHttpException:this.wrapCallback(e,`onHttpException`),onNetworkError:this.wrapCallback(e,`onNetworkError`),onFlash:this.wrapCallback(e,`onFlash`),onCancelToken:this.wrapCallback(e,`onCancelToken`),onPrefetched:this.wrapCallback(e,`onPrefetched`),onPrefetching:this.wrapCallback(e,`onPrefetching`)};this.params={...e,...t,onPrefetchResponse:e.onPrefetchResponse||(()=>{}),onPrefetchError:e.onPrefetchError||(()=>{})}}}static create(t){return new e(t)}data(){return this.params.method===`get`?null:this.params.data}queryParams(){return this.params.method===`get`?this.params.data:{}}isPartial(){return this.params.only.length>0||this.params.except.length>0||this.params.reset.length>0}isPrefetch(){return this.params.prefetch===!0}isDeferredPropsRequest(){return this.params.deferredProps===!0}isPollRequest(){return this.params.poll===!0}onCancelToken(e){this.params.onCancelToken({cancel:e})}markAsFinished(){this.params.completed=!0,this.params.cancelled=!1,this.params.interrupted=!1}markAsCancelled({cancelled:e=!0,interrupted:t=!1}){this.params.onCancel(),this.params.completed=!1,this.params.cancelled=e,this.params.interrupted=t}wasCancelledAtAll(){return this.params.cancelled||this.params.interrupted}onFinish(){this.params.onFinish(this.params)}onStart(){this.params.onStart(this.params)}onPrefetching(){this.params.onPrefetching(this.params)}onPrefetchResponse(e){this.params.onPrefetchResponse&&this.params.onPrefetchResponse(e)}onPrefetchError(e){this.params.onPrefetchError&&this.params.onPrefetchError(e)}all(){return this.params}headers(){let e={...this.params.headers};this.isPartial()&&(e[`X-Inertia-Partial-Component`]=U.get().component);let t=this.params.only.concat(this.params.reset);return t.length>0&&(e[`X-Inertia-Partial-Data`]=t.join(`,`)),this.params.except.length>0&&(e[`X-Inertia-Partial-Except`]=this.params.except.join(`,`)),this.params.reset.length>0&&(e[`X-Inertia-Reset`]=this.params.reset.join(`,`)),this.params.errorBag&&this.params.errorBag.length>0&&(e[`X-Inertia-Error-Bag`]=this.params.errorBag),e}setPreserveOptions(t){this.params.preserveScroll=e.resolvePreserveOption(this.params.preserveScroll,t),this.params.preserveState=e.resolvePreserveOption(this.params.preserveState,t)}runCallbacks(){this.callbacks.forEach(({name:e,args:t})=>{this.params[e](...t)})}merge(e){this.params={...this.params,...e}}wrapCallback(e,t){return(...n)=>{this.recordCallback(t,n),e[t](...n)}}recordCallback(e,t){this.callbacks.push({name:e,args:t})}static resolvePreserveOption(e,t){return typeof e==`function`?e(t):e===`errors`?Object.keys(t.props.errors||{}).length>0:e}},wo={createIframeAndPage(e){typeof e==`object`&&(e=`All Inertia requests must receive a valid Inertia response, however a plain JSON response was received.<hr>${JSON.stringify(e)}`);let t=document.createElement(`html`);t.innerHTML=e,t.querySelectorAll(`a`).forEach(e=>e.setAttribute(`target`,`_top`));let n=document.createElement(`iframe`);return n.style.backgroundColor=`white`,n.style.borderRadius=`5px`,n.style.width=`100%`,n.style.height=`100%`,n.setAttribute(`sandbox`,`allow-scripts`),{iframe:n,page:t}},show(e){let{iframe:t,page:n}=this.createIframeAndPage(e);t.style.boxSizing=`border-box`,t.style.display=`block`;let r=document.createElement(`dialog`);r.id=`inertia-error-dialog`,Object.assign(r.style,{width:`calc(100vw - 100px)`,height:`calc(100vh - 100px)`,padding:`0`,margin:`auto`,border:`none`,backgroundColor:`transparent`});let i=document.createElement(`style`);i.textContent=`
4
+ dialog#inertia-error-dialog::backdrop {
5
+ background-color: rgba(0, 0, 0, 0.6);
6
+ }
7
+
8
+ dialog#inertia-error-dialog:focus {
9
+ outline: none;
10
+ }
11
+ `;let a=Fi.get(`nonce`);a&&(i.nonce=a),document.head.appendChild(i),r.addEventListener(`click`,e=>{e.target===r&&r.close()}),r.addEventListener(`close`,()=>{i.remove(),r.remove()}),r.appendChild(t),document.body.prepend(r),r.showModal(),r.focus(),t.srcdoc=n.outerHTML}},To=(e,t)=>e===t||e.startsWith(`${t}.`),Eo=(e,t)=>{let{only:n,except:r}=e;return!(n.length===0&&r.length===0||n.length>0&&!n.some(e=>To(t,e))||r.length>0&&r.some(e=>To(t,e)))},Do=new Ya,Oo=class e{constructor(e,t,n){this.requestParams=e,this.response=t,this.originatingPage=n}requestParams;response;originatingPage;wasPrefetched=!1;processed=!1;static create(t,n,r){return new e(t,n,r)}isProcessed(){return this.processed}async handlePrefetch(){Ua(this.requestParams.all().url,window.location)&&this.handle()}async handle(){return Do.add(()=>this.process())}async process(){if(this.requestParams.all().prefetch)return this.wasPrefetched=!0,this.requestParams.all().prefetch=!1,this.requestParams.all().onPrefetched(this.response,this.requestParams.all()),Yi(this.response,this.requestParams.all()),Promise.resolve();if(this.requestParams.runCallbacks(),this.processed=!0,!this.isInertiaResponse())return this.handleNonInertiaResponse();if(this.isHttpException()){let e={...this.response,data:this.getDataFromResponse(this.response.data)};if(this.requestParams.all().onHttpException(e)===!1||!Hi(e))return}await W.processQueue(),W.preserveUrl=this.requestParams.all().preserveUrl,await this.setPage();let{flash:e}=U.get();Object.keys(e).length>0&&!this.requestParams.isDeferredPropsRequest()&&(Zi(e),this.requestParams.all().onFlash(e));let t=U.get().props.errors||{};if(Object.keys(t).length>0){let e=this.getScopedErrors(t);return zi(e,{page:U.get(),visitId:this.requestParams.all().id}),this.requestParams.all().onError(e)}K.flushByCacheTags(this.requestParams.all().invalidateCacheTags||[]),this.wasPrefetched||K.flush(U.get().url),Ji(U.get(),{visitId:this.requestParams.all().id}),await this.requestParams.all().onSuccess(U.get()),W.preserveUrl=!1}mergeParams(e){this.requestParams.merge(e)}getPageResponse(){let e=this.getDataFromResponse(this.response.data);return typeof e==`object`?this.response.data={...e,flash:e.flash??{},rescuedProps:e.rescuedProps??[]}:this.response.data=e}async handleNonInertiaResponse(){if(this.isInertiaRedirect()){K.visit(this.getHeader(`x-inertia-redirect`),{...this.requestParams.all(),method:`get`,data:{}});return}if(this.isLocationVisit()){let e=Ra(this.getHeader(`x-inertia-location`));return Ha(this.requestParams.all().url,e),this.locationVisit(e)}let e={...this.response,data:this.getDataFromResponse(this.response.data)};if(this.requestParams.all().onHttpException(e)!==!1&&Hi(e))return wo.show(e.data)}isInertiaResponse(){return this.hasHeader(`x-inertia`)}isHttpException(){return this.response.status>=400}hasStatus(e){return this.response.status===e}getHeader(e){return this.response.headers[e]}hasHeader(e){return this.getHeader(e)!==void 0}isInertiaRedirect(){return this.hasStatus(409)&&this.hasHeader(`x-inertia-redirect`)}isLocationVisit(){return this.hasStatus(409)&&this.hasHeader(`x-inertia-location`)}locationVisit(e){try{if(typeof window>`u`)return;let t=this.getHeader(`x-inertia-version`),n=!!t&&t!==U.get().version;if(!Qi(e,n)||n&&this.requestParams.all().async)return;$i.set($i.locationVisitKey,{preserveScroll:this.requestParams.all().preserveScroll===!0}),Ua(window.location,e)?window.location.reload():window.location.href=e.href}catch{return!1}}async setPage(){let e=this.getPageResponse();return this.shouldSetPage(e)?(this.response=await xo.processResponse(this.requestParams.all(),this.response),this.mergeProps(e),U.mergeOncePropsIntoResponse(e),this.preserveOptimisticProps(e),this.preserveEqualProps(e),await this.setRememberedState(e),this.requestParams.setPreserveOptions(e),e.url=W.preserveUrl?U.get().url:this.pageUrl(e),this.requestParams.all().onBeforeUpdate(e),Ui(e),U.set(e,{replace:this.requestParams.all().replace,preserveScroll:this.requestParams.all().preserveScroll,preserveState:this.requestParams.all().preserveState,viewTransition:this.requestParams.all().viewTransition,cached:this.requestParams.all().cached,visitId:this.requestParams.all().id})):Promise.resolve()}getDataFromResponse(e){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}}shouldSetPage(e){if(!this.requestParams.all().async||this.originatingPage.component!==e.component)return!0;if(this.originatingPage.component!==U.get().component)return!1;let t=Ra(this.originatingPage.url),n=Ra(U.get().url);return t.origin===n.origin&&t.pathname===n.pathname}pageUrl(e){let t=Ra(e.url);return e.preserveFragment?t.hash=this.requestParams.all().url.hash:Ha(this.requestParams.all().url,t),t.pathname+t.search+t.hash}preserveOptimisticProps(e){if(K.hasPendingOptimistic())for(let t of Object.keys(e.props))U.hasBaseline(t)&&(U.updateBaseline(t,e.props[t]),e.props[t]=U.get().props[t])}preserveEqualProps(e){if(e.component!==U.get().component)return;let t=U.get().props;Object.entries(e.props).forEach(([n,r])=>{gr(r,t[n])&&(e.props[n]=t[n])})}mergeProps(e){if(!this.requestParams.isPartial()||e.component!==U.get().component)return;let t=e.mergeProps||[],n=e.prependProps||[],r=e.deepMergeProps||[],i=e.matchPropsOn||[],a=(t,n)=>{let r=Er(U.get().props,t),a=Er(e.props,t);if(Array.isArray(a)){let o=this.mergeOrMatchItems(r||[],a,t,i,n);Wr(e.props,t,o)}else if(typeof a==`object`&&a){let n={...r||{},...a};Wr(e.props,t,n)}};t.forEach(e=>a(e,!0)),n.forEach(e=>a(e,!1)),r.forEach(t=>{let n=Er(U.get().props,t),r=Er(e.props,t),a=(e,t,n)=>Array.isArray(t)?this.mergeOrMatchItems(e,t,n,i):typeof t==`object`&&t?Object.keys(t).reduce((r,i)=>(r[i]=a(e?e[i]:void 0,t[i],`${n}.${i}`),r),{...e}):t;Wr(e.props,t,a(n,r,t))});let o=new Set([...this.requestParams.all().only,...this.requestParams.all().except].filter(e=>e.includes(`.`)).map(e=>e.split(`.`)[0]));for(let t of o){let n=U.get().props[t];this.isObject(n)&&this.isObject(e.props[t])&&(e.props[t]=this.deepMergeObjects(n,e.props[t]))}e.props={...U.get().props,...e.props},this.shouldPreserveErrors(e)&&(e.props.errors=U.get().props.errors),U.get().scrollProps&&(e.scrollProps={...U.get().scrollProps||{},...e.scrollProps||{}}),U.hasOnceProps()&&(e.onceProps={...U.get().onceProps||{},...e.onceProps||{}}),this.requestParams.isDeferredPropsRequest()&&(e.flash={...U.get().flash});let s=U.get().initialDeferredProps;s&&Object.keys(s).length>0&&(e.initialDeferredProps=s),e.rescuedProps=this.mergeRescuedProps(e)}mergeRescuedProps(e){let t=U.get().rescuedProps??[],n=e.rescuedProps??[],r=new Set(t.filter(e=>!Eo(this.requestParams.all(),e)));return n.forEach(e=>r.add(e)),Array.from(r)}shouldPreserveErrors(e){if(!this.requestParams.all().preserveErrors)return!1;let t=U.get().props.errors;if(!t||Object.keys(t).length===0)return!1;let n=e.props.errors;return!(n&&Object.keys(n).length>0)}isObject(e){return e&&typeof e==`object`&&!Array.isArray(e)}deepMergeObjects(e,t){let n={...e};for(let r of Object.keys(t)){let i=e[r],a=t[r];n[r]=this.isObject(i)&&this.isObject(a)?this.deepMergeObjects(i,a):a}return n}mergeOrMatchItems(e,t,n,r,i=!0){let a=Array.isArray(e)?e:[],o=r.find(e=>e.split(`.`).slice(0,-1).join(`.`)===n);if(!o)return i?[...a,...t]:[...t,...a];let s=o.split(`.`).pop()||``,c=new Map;return t.forEach(e=>{this.hasUniqueProperty(e,s)&&c.set(e[s],e)}),i?this.appendWithMatching(a,t,c,s):this.prependWithMatching(a,t,c,s)}appendWithMatching(e,t,n,r){let i=e.map(e=>this.hasUniqueProperty(e,r)&&n.has(e[r])?n.get(e[r]):e),a=t.filter(t=>!this.hasUniqueProperty(t,r)||!e.some(e=>this.hasUniqueProperty(e,r)&&e[r]===t[r]));return[...i,...a]}prependWithMatching(e,t,n,r){let i=e.filter(e=>!this.hasUniqueProperty(e,r)||!n.has(e[r]));return[...t,...i]}hasUniqueProperty(e,t){return e&&typeof e==`object`&&t in e}async setRememberedState(e){let t=await W.getState(W.rememberedState,{});this.requestParams.all().preserveState&&t&&e.component===U.get().component&&(e.rememberedState=t)}getScopedErrors(e){return this.requestParams.all().errorBag?e[this.requestParams.all().errorBag||``]||{}:e}},ko=class e{constructor(e,t,{optimistic:n=!1}={}){this.page=t,this.requestParams=Co.create(e),this.cancelToken=new AbortController,this.optimistic=n}page;response;cancelToken;requestParams;requestHasFinished=!1;optimistic;static create(t,n,r){return new e(t,n,r)}isPrefetch(){return this.requestParams.isPrefetch()}isOptimistic(){return this.optimistic}isPendingOptimistic(){return this.isOptimistic()&&(!this.response||!this.response.isProcessed())}async send(){this.requestParams.onCancelToken(()=>this.cancel({cancelled:!0})),qi(this.requestParams.all()),this.requestParams.onStart(),this.requestParams.all().prefetch&&(this.requestParams.onPrefetching(),Xi(this.requestParams.all()));let e=this.requestParams.all().prefetch,t={method:this.requestParams.all().method,url:Va(this.requestParams.all().url).href,data:this.requestParams.data(),signal:this.cancelToken.signal,headers:this.getHeaders(),onUploadProgress:this.onProgress.bind(this)},n=await xo.processRequest(this.requestParams.all(),t);return bo.getClient().request(n).then(e=>(this.response=Oo.create(this.requestParams,e,this.page),this.response.handle())).catch(e=>e instanceof so?(this.response=Oo.create(this.requestParams,e.response,this.page),this.response.handle()):Promise.reject(e)).catch(t=>{if(!(t instanceof co)&&this.requestParams.all().onNetworkError(t)!==!1&&Bi(t))return e&&this.requestParams.onPrefetchError(t),Promise.reject(t)}).finally(()=>{this.finish(),e&&this.response&&this.requestParams.onPrefetchResponse(this.response)})}finish(){this.requestParams.wasCancelledAtAll()||(this.requestParams.markAsFinished(),this.fireFinishEvents())}fireFinishEvents(){this.requestHasFinished||(this.requestHasFinished=!0,Vi(this.requestParams.all()),this.requestParams.onFinish())}cancel({cancelled:e=!1,interrupted:t=!1}){this.requestHasFinished||(this.cancelToken.abort(),this.requestParams.markAsCancelled({cancelled:e,interrupted:t}),this.fireFinishEvents())}onProgress(e){this.requestParams.data()instanceof FormData&&(Ki(e),this.requestParams.all().onProgress(e))}getHeaders(){let e={...this.requestParams.headers(),Accept:`text/html, application/xhtml+xml`,"X-Requested-With":`XMLHttpRequest`,"X-Inertia":!0},t=U.get();t.version&&(e[`X-Inertia-Version`]=t.version);let n=Object.entries(t.onceProps||{}).filter(([,e])=>Er(t.props,e.prop)===void 0?!1:!e.expiresAt||e.expiresAt>Date.now()).map(([e])=>e);return n.length>0&&(e[`X-Inertia-Except-Once-Props`]=n.join(`,`)),e}},Ao=class{requests=[];maxConcurrent;interruptible;constructor({maxConcurrent:e,interruptible:t}){this.maxConcurrent=e,this.interruptible=t}send(e){this.requests.push(e),e.send().finally(()=>{this.requests=this.requests.filter(t=>t!==e)})}interruptInFlight(){this.cancel({interrupted:!0},!1)}cancelInFlight({prefetch:e=!0,optimistic:t=!0}={}){this.requests.filter(t=>e||!t.isPrefetch()).filter(e=>t||!e.isOptimistic()).forEach(e=>e.cancel({cancelled:!0}))}cancel({cancelled:e=!1,interrupted:t=!1}={},n=!1){!n&&!this.shouldCancel()||this.requests.shift()?.cancel({cancelled:e,interrupted:t})}shouldCancel(){return this.interruptible&&this.requests.length>=this.maxConcurrent}hasPendingOptimistic(){return this.requests.some(e=>e.isPendingOptimistic())}},jo=()=>{},Mo=class{syncRequestStream=new Ao({maxConcurrent:1,interruptible:!0});asyncRequestStream=new Ao({maxConcurrent:1/0,interruptible:!1});clientVisitQueue=new Ya;pendingOptimisticCallback=void 0;init({initialPage:e,resolveComponent:t,swapComponent:n,onFlash:r}){U.init({initialPage:e,resolveComponent:t,swapComponent:n,onFlash:r}),ro.handle(),eo.init(),eo.on(`missingHistoryItem`,()=>{typeof window<`u`&&this.visit(window.location.href,{preserveState:!0,preserveScroll:!0,replace:!0})}),eo.on(`loadDeferredProps`,e=>{this.loadDeferredProps(e)}),eo.on(`historyQuotaExceeded`,e=>{window.location.href=e})}optimistic(e){return this.pendingOptimisticCallback=e,this}get(e,t={},n={}){return this.visit(e,{...n,method:`get`,data:t})}post(e,t={},n={}){return this.visit(e,{preserveState:!0,...n,method:`post`,data:t})}put(e,t={},n={}){return this.visit(e,{preserveState:!0,...n,method:`put`,data:t})}patch(e,t={},n={}){return this.visit(e,{preserveState:!0,...n,method:`patch`,data:t})}delete(e,t={}){return this.visit(e,{preserveState:!0,...t,method:`delete`})}reload(e={}){return this.doReload(e)}doReload(e={}){if(!(typeof window>`u`))return this.visit(window.location.href,{...e,preserveScroll:!0,preserveState:!0,async:!0,headers:{...e.headers||{},"Cache-Control":`no-cache`}})}remember(e,t=`default`){W.remember(e,t)}restore(e=`default`){return W.restore(e)}on(e,t){return typeof window>`u`?()=>{}:eo.onGlobalEvent(e,t)}once(e,t){if(typeof window>`u`)return()=>{};let n=this.on(e,e=>(n(),t(e)));return n}hasPendingOptimistic(){return this.asyncRequestStream.hasPendingOptimistic()}get activePolls(){return ao.count}cancelAll({async:e=!0,prefetch:t=!0,sync:n=!0}={}){e&&this.asyncRequestStream.cancelInFlight({prefetch:t}),n&&this.syncRequestStream.cancelInFlight()}poll(e,t={},n={}){return ao.add(e,({onStart:e,onFinish:n})=>{let r=typeof t==`function`?t():t;this.doReload({poll:!0,preserveErrors:!0,...r,onCancelToken:t=>{e(t.cancel),r.onCancelToken?.(t)},onFinish:e=>{n(),r.onFinish?.(e)}})},{autoStart:n.autoStart??!0,keepAlive:n.keepAlive??!1,mode:n.mode})}visit(e,t={}){t.optimistic=t.optimistic??this.pendingOptimisticCallback,this.pendingOptimisticCallback=void 0,t.optimistic&&(t.async=t.async??!0);let n=this.getPendingVisit(e,{...t,showProgress:t.showProgress??(!t.async||!!t.optimistic)}),r=this.getVisitEvents(t);if(r.onBefore(n)===!1||!Ri(n))return;let i=Ra(U.get().url);(n.only.length>0||n.except.length>0||n.reset.length>0?Wa(n.url,i):Ua(n.url,i))||this.asyncRequestStream.cancelInFlight({prefetch:!1,optimistic:!1}),n.async||this.syncRequestStream.interruptInFlight(),t.optimistic&&this.applyOptimisticUpdate(t.optimistic,r),!U.isCleared()&&!n.preserveUrl&&Ca.save();let a={...n,...r},o=()=>{let e=ha.get(a);e?(zs.reveal(e.inFlight),ha.use(e,a)):(zs.reveal(!0),(n.async?this.asyncRequestStream:this.syncRequestStream).send(ko.create(a,U.get(),{optimistic:!!t.optimistic})))};Array.isArray(n.component)&&(console.error(`The "component" prop received an array of components (${n.component.join(`, `)}), but only a single component string is supported for instant visits. Pass an explicit component name instead.`),n.component=null),n.component?W.processQueue().then(()=>{this.performInstantSwap(n).then(()=>{a.preserveScroll=!0,a.preserveState=!0,a.replace=!0,a.viewTransition=!1,o()})}):o()}getCached(e,t={}){return ha.findCached(this.getPrefetchParams(e,t))}flush(e,t={}){ha.remove(this.getPrefetchParams(e,t))}flushAll(){ha.removeAll()}flushByCacheTags(e){ha.removeByTags(Array.isArray(e)?e:[e])}getPrefetching(e,t={}){return ha.findInFlight(this.getPrefetchParams(e,t))}prefetch(e,t={},n={}){if((t.method??(Ga(e)?e.method:`get`))!==`get`)throw Error(`Prefetch requests must use the GET method`);let r=this.getPendingVisit(e,{...t,async:!0,showProgress:!1,prefetch:!0,viewTransition:!1});if(r.url.origin+r.url.pathname+r.url.search===window.location.origin+window.location.pathname+window.location.search)return;let i=this.getVisitEvents(t);if(i.onBefore(r)===!1||!Ri(r))return;zs.hide(),this.asyncRequestStream.interruptInFlight();let a={...r,...i};new Promise(e=>{let t=()=>{U.get()?e():setTimeout(t,50)};t()}).then(()=>{ha.add(a,e=>{this.asyncRequestStream.send(ko.create(e,U.get()))},{cacheFor:Fi.get(`prefetch.cacheFor`),cacheTags:[],...n})})}clearHistory(){W.clear()}decryptHistory(){return W.decrypt()}resolveComponent(e,t){return U.resolve(e,t)}replace(e){this.clientVisit(e,{replace:!0})}replaceProp(e,t,n){this.replace({preserveScroll:!0,preserveState:!0,props(n){let r=typeof t==`function`?t(Er(n,e),n):t;return Wr(cr(n),e,r)},...n||{}})}appendToProp(e,t,n){this.replaceProp(e,(e,n)=>{let r=typeof t==`function`?t(e,n):t;return Array.isArray(e)||(e=e===void 0?[]:[e]),[...e,r]},n)}prependToProp(e,t,n){this.replaceProp(e,(e,n)=>{let r=typeof t==`function`?t(e,n):t;return Array.isArray(e)||(e=e===void 0?[]:[e]),[r,...e]},n)}push(e){this.clientVisit(e)}flash(e,t){let n=U.get().flash,r;if(typeof e==`function`)r=e(n);else if(typeof e==`string`)r={...n,[e]:t};else if(e&&Object.keys(e).length)r={...n,...e};else return;U.setFlash(r),Object.keys(r).length&&Zi(r)}clientVisit(e,{replace:t=!1}={}){this.clientVisitQueue.add(()=>this.performClientVisit(e,{replace:t}))}performClientVisit(e,{replace:t=!1}={}){let n=U.get(),r=typeof e.props==`function`?Object.fromEntries(Object.values(n.onceProps??{}).map(e=>[e.prop,Er(n.props,e.prop)])):{},i=typeof e.props==`function`?e.props(n.props,r):e.props??n.props,a=typeof e.flash==`function`?e.flash(n.flash):e.flash,{viewTransition:o,onError:s,onFinish:c,onFlash:l,onSuccess:u,...d}=e,f={...n,...d,flash:a??{},props:i},p=Co.resolvePreserveOption(e.preserveScroll??!1,f),m=Co.resolvePreserveOption(e.preserveState??!1,f),h=this.createVisitId();return U.set(f,{replace:t,preserveScroll:p,preserveState:m,viewTransition:o,visitId:h}).then(()=>{Gi(U.get(),{replace:t,visitId:h});let n=U.get().flash;Object.keys(n).length>0&&(Zi(n),l?.(n));let r=U.get().props.errors||{};if(Object.keys(r).length===0){u?.(U.get());return}let i=e.errorBag?r[e.errorBag||``]||{}:r;s?.(i)}).finally(()=>c?.(e))}performInstantSwap(e){let t=U.get(),n=Object.fromEntries((t.sharedProps??[]).filter(e=>e in t.props).map(e=>[e,t.props[e]])),r=typeof e.pageProps==`function`?e.pageProps(cr(t.props),cr(n)):e.pageProps,i=r===null?{...n}:{...r},a={component:e.component,url:e.url.pathname+e.url.search+e.url.hash,version:t.version,props:{...i,errors:{}},flash:{},rescuedProps:[],clearHistory:!1,encryptHistory:t.encryptHistory,sharedProps:t.sharedProps,rememberedState:{}};return U.set(a,{replace:e.replace,preserveScroll:Co.resolvePreserveOption(e.preserveScroll,a),preserveState:!1,viewTransition:e.viewTransition,visitId:e.id})}getPrefetchParams(e,t){return{...this.getPendingVisit(e,{...t,async:!0,showProgress:!1,prefetch:!0,viewTransition:!1}),...this.getVisitEvents(t)}}createVisitId(){return no()}getPendingVisit(e,t){if(Ga(e)){let n=e;e=n.url,t.method=t.method??n.method}let n=Fi.get(`visitOptions`),r=n&&n(e.toString(),cr(t))||{},i={method:`get`,data:{},replace:!1,preserveScroll:!1,preserveState:!1,only:[],except:[],headers:{},errorBag:``,forceFormData:!1,queryStringArrayFormat:`brackets`,async:!1,showProgress:!0,fresh:!1,reset:[],preserveUrl:!1,preserveErrors:!1,prefetch:!1,invalidateCacheTags:[],viewTransition:!1,component:null,pageProps:null,cached:!1,...ua(t),...ua(r)},[a,o]=za(e,i.data,i.method,i.forceFormData,i.queryStringArrayFormat),s={id:this.createVisitId(),cancelled:!1,completed:!1,interrupted:!1,...i,url:a,data:o};return s.prefetch&&(s.headers.Purpose=`prefetch`),s}getVisitEvents(e){return{onCancelToken:e.onCancelToken||jo,onBefore:e.onBefore||jo,onBeforeUpdate:e.onBeforeUpdate||jo,onStart:e.onStart||jo,onProgress:e.onProgress||jo,onFinish:e.onFinish||jo,onCancel:e.onCancel||jo,onSuccess:e.onSuccess||jo,onError:e.onError||jo,onHttpException:e.onHttpException||jo,onNetworkError:e.onNetworkError||jo,onFlash:e.onFlash||jo,onPrefetched:e.onPrefetched||jo,onPrefetching:e.onPrefetching||jo}}applyOptimisticUpdate(e,t){let n=U.get().props,r=e(cr(n));if(!r)return;let i=[];for(let e of Object.keys(r))gr(n[e],r[e])||i.push(e);if(i.length===0)return;let a=U.nextOptimisticId(),o=U.get().component;for(let e of i)U.setBaseline(e,cr(n[e]));U.registerOptimistic(a,e),U.setPropsQuietly({...n,...r});let s=!0,c=t.onSuccess;t.onSuccess=e=>(s=!1,c(e));let l=t.onFinish;t.onFinish=e=>{if(U.unregisterOptimistic(a),s&&U.get().component===o){let e=U.replayOptimistics();Object.keys(e).length>0&&U.setPropsQuietly({...U.get().props,...e})}return U.pendingOptimisticCount()===0&&U.clearOptimisticState(),l(e)}}loadDeferredProps(e){e&&Object.values(e).forEach(e=>{this.doReload({only:e,deferredProps:!0,preserveErrors:!0})})}},No=class{static createWayfinderCallback(...e){return()=>e.length===1?Ga(e[0])?e[0]:e[0]():{method:typeof e[0]==`function`?e[0]():e[0],url:typeof e[1]==`function`?e[1]():e[1]}}static parseUseFormArguments(...e){return e.length===0?{rememberKey:null,data:{},precognitionEndpoint:null}:e.length===1?{rememberKey:null,data:e[0],precognitionEndpoint:null}:e.length===2?typeof e[0]==`string`?{rememberKey:e[0],data:e[1],precognitionEndpoint:null}:{rememberKey:null,data:e[1],precognitionEndpoint:this.createWayfinderCallback(e[0])}:{rememberKey:null,data:e[2],precognitionEndpoint:this.createWayfinderCallback(e[0],e[1])}}static parseSubmitArguments(e,t){return e.length===3||e.length===2&&typeof e[0]==`string`?{method:e[0],url:e[1],options:e[2]??{}}:Ga(e[0])?{...e[0],options:e[1]??{}}:{...t(),options:e[0]??{}}}static mergeHeadersForValidation(e,t,n){let r=e=>(e.headers={...n??{},...e.headers??{}},e);return e&&typeof e==`object`&&!(`target`in e)?e=r(e):t&&typeof t==`object`?t=r(t):typeof e==`string`?t=r(t??{}):e=r(e??{}),[e,t]}};function Po(e){return e.includes(`.`)?e.replace(/\\\./g,`__ESCAPED_DOT__`).split(/(\[[^\]]*\])/).filter(Boolean).map(e=>e.startsWith(`[`)&&e.endsWith(`]`)?e:e.split(`.`).reduce((e,t,n)=>n===0?t:`${e}[${t}]`)).join(``).replace(/__ESCAPED_DOT__/g,`.`):e}function Fo(e){let t=[],n=/([^\[\]]+)|\[(\d*)\]/g,r;for(;(r=n.exec(e))!==null;)r[1]===void 0?r[2]!==void 0&&t.push(r[2]===``?``:Number(r[2])):t.push(r[1]);return t}function Io(e,t,n){let r=e;for(let e=0;e<t.length-1;e++)t[e]in r||(r[t[e]]={}),r=r[t[e]];r[t[t.length-1]]=n}function Lo(e){let t=Object.keys(e),n=t.filter(e=>/^\d+$/.test(e)).map(Number).sort((e,t)=>e-t);return t.length===n.length&&n.length>0&&n[0]===0&&n.every((e,t)=>e===t)}function Ro(e){if(Array.isArray(e))return e.map(Ro);if(typeof e!=`object`||!e||wa(e))return e;if(Lo(e)){let t=[];for(let n=0;n<Object.keys(e).length;n++)t[n]=Ro(e[n]);return t}let t={};for(let n in e)t[n]=Ro(e[n]);return t}function zo(e){let t={};for(let[n,r]of e.entries()){if(r instanceof File&&r.size===0&&r.name===``)continue;let e=Fo(Po(n));if(e[e.length-1]===``){let n=e.slice(0,-1),i=Er(t,n);if(Array.isArray(i))i.push(r);else if(i&&typeof i==`object`&&!wa(i)){let e=Object.keys(i).filter(e=>/^\d+$/.test(e)).map(Number).sort((e,t)=>e-t);Wr(t,n,e.length>0?[...e.map(e=>i[e]),r]:[r])}else Wr(t,n,[r]);continue}Io(t,e.map(String),r)}return Ro(t)}var Bo=`server`;function Vo(e,t){return e.match(/\sdata-inertia(=|\s|>)/)?e:e.replace(/^<([a-zA-Z][^\s/>]*)/,`<$1 data-inertia="server-head-${t}"`)}function Ho(e,t){if(!t)return[];let n=typeof t==`function`?t(e):e.props[t===!0?`head`:t];return Array.isArray(n)?n.map(e=>typeof e==`string`?e.trim():e).filter(e=>typeof e==`string`&&e.length>0).map(Vo):[]}var Uo={buildDOMElement(e){let t=document.createElement(`template`);t.innerHTML=e;let n=t.content.firstChild;if(!e.startsWith(`<script `))return n;let r=document.createElement(`script`);return r.innerHTML=n.innerHTML,n.getAttributeNames().forEach(e=>{r.setAttribute(e,n.getAttribute(e)||``)}),r},isInertiaManagedElement(e){return e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(`data-inertia`)!==null},findMatchingElementIndex(e,t){let n=e.getAttribute(`data-inertia`);return n===null?-1:t.findIndex(e=>e.getAttribute(`data-inertia`)===n)},update:Ii(function(e){let t=e.map(e=>this.buildDOMElement(e)),n=Array.from(document.head.childNodes).filter(e=>this.isInertiaManagedElement(e));t.some(e=>e instanceof HTMLTitleElement)&&document.head.querySelectorAll(`title:not([data-inertia])`).forEach(e=>e.remove()),n.forEach(e=>{let n=this.findMatchingElementIndex(e,t);if(n===-1){e.remove();return}let r=t.splice(n,1)[0];r&&!e.isEqualNode(r)&&e.replaceWith(r)}),t.forEach(e=>{document.head.appendChild(e)})},1)};function Wo(e,t,n,r=[]){let i=r.length?{[Bo]:r}:{},a=0;function o(){let e=a+=1;return i[e]=[],e.toString()}function s(e){e!==null&&Object.keys(i).indexOf(e)!==-1&&(delete i[e],f())}function c(e){Object.keys(i).indexOf(e)===-1&&(i[e]=[])}function l(e,t=[]){e!==null&&Object.keys(i).indexOf(e)>-1&&(i[e]=t),f()}function u(e=[]){e.length?i[Bo]=e:delete i[Bo],f()}function d(){let e=t(``),n=i[Bo]||[],r=Object.keys(i).filter(e=>e!==Bo).flatMap(e=>i[e]),a={...e?{title:`<title data-inertia="">${e}</title>`}:{}},o=n.concat(r).reduce((e,n)=>{if(n.indexOf(`<`)===-1)return e;if(n.indexOf(`<title `)===0){let r=n.match(/(<title [^>]+>)(.*?)(<\/title>)/s);return e.title=r?`${r[1]}${t(r[2])}${r[3]}`:n,e}let r=n.match(/ data-inertia=(["'])[^"']+\1/);return r?e[r[0]]=n:e[Object.keys(e).length]=n,e},a);return Object.values(o)}function f(){e?n(d()):Uo.update(d())}return f(),{forceUpdate:f,updateServerHead:u,createProvider:function(){let e=o();return{reconnect:()=>c(e),update:t=>l(e,t),disconnect:()=>s(e)}}}}var Go=`X-Inertia-Infinite-Scroll-Merge-Intent`,Ko=e=>{let t=()=>{let t=U.get().scrollProps?.[e.getPropName()];if(t)return t;throw Error(`The page object does not contain a scroll prop named "${e.getPropName()}".`)},n={component:null,loading:!1,previousPage:null,nextPage:null,lastLoadedPage:null,requestCount:0},r=()=>{let e=t();n.component=U.get().component,n.loading=!1,n.previousPage=e.previousPage,n.nextPage=e.nextPage,n.lastLoadedPage=e.currentPage,n.requestCount=0},i=()=>`inertia:infinite-scroll-data:${e.getPropName()}`;if(typeof window<`u`){r();let e=K.restore(i());e&&typeof e==`object`&&e.lastLoadedPage===t().currentPage&&(n.previousPage=e.previousPage,n.nextPage=e.nextPage,n.lastLoadedPage=e.lastLoadedPage,n.requestCount=e.requestCount||0)}let a=K.on(`success`,i=>{n.component===i.detail.page.component&&t().reset&&(r(),e.onReset?.())}),o=e=>e===`next`?`nextPage`:`previousPage`,s=e=>{let t=o(e);return n[t]},c=e=>{let r=t(),a=o(e);n.lastLoadedPage=r.currentPage,n[a]=r[a],n.requestCount+=1,K.remember({previousPage:n.previousPage,nextPage:n.nextPage,lastLoadedPage:n.lastLoadedPage,requestCount:n.requestCount},i())},l=()=>t().pageName,u=()=>n.requestCount,d=(t,r={})=>{let i=s(t);n.loading||i===null||(n.loading=!0,K.reload({preserveErrors:!0,...r,data:{...r.data||{},[l()]:i},only:[...r.only||[],e.getPropName()],preserveUrl:!0,headers:{[Go]:t===`previous`?`prepend`:`append`,...r.headers},onBefore:n=>{t===`next`?e.onBeforeNextRequest():e.onBeforePreviousRequest(),r.onBefore?.(n)},onBeforeUpdate:t=>{e.onBeforeUpdate(),r.onBeforeUpdate?.(t)},onSuccess:e=>{c(t),r.onSuccess?.(e)},onFinish:i=>{n.loading=!1;let a=i.completed,o=a?n.lastLoadedPage:null;t===`next`?e.onCompleteNextRequest(o,{page:o,completed:a}):e.onCompletePreviousRequest(o,{page:o,completed:a}),r.onFinish?.(i)}}))};return{getLastLoadedPage:()=>n.lastLoadedPage,getPageName:l,getRequestCount:u,hasPrevious:()=>!!n.previousPage,hasNext:()=>!!n.nextPage,fetchNext:e=>d(`next`,e),fetchPrevious:e=>d(`previous`,e),removeEventListener:a}},qo=()=>{let e=[];return{new:(t,n={})=>{let r=new IntersectionObserver(e=>{for(let n of e)n.isIntersecting&&t(n)},n);return e.push(r),r},flushAll:()=>{e.forEach(e=>e.disconnect()),e.length=0}}},Jo=`infiniteScrollPage`,Yo=`infiniteScrollIgnore`,Xo=e=>e.dataset[Jo],Zo=e=>{let t=qo(),n,r,i,a,o=!1,s=()=>{a=new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{e.nodeType===Node.ELEMENT_NODE&&f.add(e)})}),b()}),a.observe(e.getItemsElement(),{childList:!0}),n=t.new(t=>e.onItemIntersected(t.target));let o={root:e.getScrollableParent(),rootMargin:`${Math.max(1,e.getTriggerMargin())}px`};r=t.new(e.onPreviousTriggered,o),i=t.new(e.onNextTriggered,o)},c=()=>{o&&l();let t=e.getStartElement(),n=e.getEndElement();t&&e.shouldFetchPrevious()&&r.observe(t),n&&e.shouldFetchNext()&&i.observe(n),o=!0},l=()=>{o&&=(r.disconnect(),i.disconnect(),!1)},u=()=>{o&&c()},d=()=>{l(),t.flushAll(),a?.disconnect()},f=new Set,p=e=>!(Jo in e.dataset)&&!(Yo in e.dataset),m=()=>{Array.from(f).forEach(e=>{p(e)&&(e.dataset[Yo]=`true`),n.observe(e)}),f.clear()},h=e=>Array.from(e.querySelectorAll(`:scope > *:not([data-infinite-scroll-page]):not([data-infinite-scroll-ignore])`)),g=!1,_=t=>{!g&&(g=!0,x())||(h(e.getItemsElement()).forEach(e=>{p(e)&&(e.dataset[Jo]=t?.toString()||`1`),n.observe(e)}),y())},v=()=>`inertia:infinite-scroll-elements:${e.getPropName()}`,y=()=>{let t={},n=e.getItemsElement().childNodes;for(let e=0;e<n.length;e++){let r=n[e];if(r.nodeType!==Node.ELEMENT_NODE)continue;let i=Xo(r);i!==void 0&&(i in t?t[i].to=e:t[i]={from:e,to:e})}K.remember(t,v())},b=Ii(y,250),x=()=>{let t=K.restore(v());if(!t||typeof t!=`object`)return!1;let r=e.getItemsElement().childNodes;for(let e=0;e<r.length;e++){let i=r[e];if(i.nodeType!==Node.ELEMENT_NODE)continue;let a=i,o;for(let[n,r]of Object.entries(t))if(e>=r.from&&e<=r.to){o=n;break}if(o)a.dataset[Jo]=o;else if(p(a))a.dataset[Yo]=`true`;else continue;n.observe(a)}return!0};return{setupObservers:s,enableTriggers:c,disableTriggers:l,refreshTriggers:u,flushAll:d,processManuallyAddedElements:m,processServerLoadedElements:_}},Qo=new Ya,$o,es,ts=null,ns=e=>{let t=!0,n=n=>{Qo.add(()=>new Promise(r=>{if(!t)return $o=es=null,r();if(!$o||!es){let e=U.get().url;$o=Ra(e),es=Ra(e),ts=qa(e)}let i=e.getPageName(),a=es.searchParams;n===`1`?a.delete(i):a.set(i,n),setTimeout(()=>r())})).finally(()=>{t&&$o&&es&&$o.href!==es.href&&ts!==null&&K.replace({url:Ja(es,ts),preserveScroll:!0,preserveState:!0}),$o=es=ts=null})};return{onItemIntersected:Ii(r=>{let i=e.getItemsElement();if(!t||e.shouldPreserveUrl()||!r||!i)return;let a=new Map;va([...i.children],r).forEach(e=>{let t=Xo(e)??`1`;a.has(t)?a.set(t,a.get(t)+1):a.set(t,1)});let o=Array.from(a.entries()).sort((e,t)=>t[1]-e[1])[0]?.[0];o!==void 0&&n(o)},250),cancel:()=>t=!1}},rs=e=>({createCallbacks:()=>{let t,n=null,r=0;return{captureScrollPosition:()=>{let i=e.getScrollableParent(),a=e.getItemsElement();t=i?.scrollTop||window.scrollY;let o=va([...a.children]);if(o.length>0){n=o[0];let e=i?.getBoundingClientRect()||{top:0},t=i?e.top:0;r=n.getBoundingClientRect().top-t}},restoreScrollPosition:()=>{if(!n)return;let i=0,a=!1,o=()=>{if(i++,a||i>10)return!1;let s=e.getScrollableParent(),c=s?.getBoundingClientRect()||{top:0},l=s?c.top:0,u=n.getBoundingClientRect().top-l-r;if(u===0){window.requestAnimationFrame(o);return}s?s.scrollTo({top:t+u}):window.scrollTo(0,window.scrollY+u),a=!0};window.requestAnimationFrame(o)}}}});function is(e){let t=ns({...e,getPageName:()=>i.getPageName()}),n=rs(e),r=Zo({...e,onItemIntersected:t.onItemIntersected,onPreviousTriggered:()=>i.fetchPrevious(),onNextTriggered:()=>i.fetchNext()}),i=Ko({...e,onBeforeUpdate:r.processManuallyAddedElements,onCompletePreviousRequest:(t,n)=>{e.onCompletePreviousRequest(n),n.completed&&ya(()=>r.processServerLoadedElements(n.page),2)},onCompleteNextRequest:(t,n)=>{e.onCompleteNextRequest(n),n.completed&&ya(()=>r.processServerLoadedElements(n.page),2)},onReset:e.onDataReset}),a=e=>{let{captureScrollPosition:t,restoreScrollPosition:r}=n.createCallbacks(),i=e.onBeforeUpdate||(()=>{}),a=e.onSuccess||(()=>{});return e.onBeforeUpdate=e=>{i(e),t()},e.onSuccess=e=>{a(e),r()},e},o=i.fetchNext;i.fetchNext=(t={})=>{t={...e.getReloadOptions?.(),...t},e.inReverseMode()&&(t=a(t)),o(t)};let s=i.fetchPrevious;i.fetchPrevious=(t={})=>{t={...e.getReloadOptions?.(),...t},e.inReverseMode()||(t=a(t)),s(t)};let c=K.on(`success`,()=>ya(r.refreshTriggers,2));return{dataManager:i,elementManager:r,flush:()=>{c(),i.removeEventListener(),r.flushAll(),t.cancel()}}}function as(){let e={},t={},n={shared:e,named:t},r=new Set,i=!1,a=()=>{n={shared:e,named:t}},o=()=>{i||(i=!0,queueMicrotask(()=>{i=!1,r.forEach(e=>e())}))};return{set(t){let n={...e,...t};gr(e,n)||(e=n,a(),o())},setFor(e,n){let r=t[e]||{},i={...r,...n};gr(r,i)||(t={...t,[e]:i},a(),o())},reset(){e={},t={},a(),o()},subscribe(e){return r.add(e),()=>r.delete(e)},get:()=>n}}function os(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ss(e){return os(e)&&`component`in e}function cs(e,t){return`component`in e&&t(e.component)}function ls(e,t){return!os(e)||t(e)||cs(e,t)?!1:Object.values(e).every(e=>t(e)||Array.isArray(e)&&t(e[0])||ss(e)&&t(e.component))}function us(e,t){return os(e)&&!t(e)&&!cs(e,t)&&!ls(e,t)}function ds(e,t){if(us(e,t))return!0;if(!os(e)||t(e)||cs(e,t))return!1;let n=Object.values(e);return n.length>0&&n.every(e=>typeof e==`function`)}function fs(e,t){return Array.isArray(e)&&e.length===2&&t(e[0])&&os(e[1])&&!t(e[1])}function ps(e,t){if(Array.isArray(e)&&t(e[0]))return{component:e[0],props:e[1]??{}};if(ss(e)&&t(e.component))return{component:e.component,props:e.props??{}};if(t(e))return{component:e,props:{}};throw Error(`Invalid layout definition: received ${typeof e}`)}function ms(e,t,n){return!e||n&&n(e)?[]:ls(e,t)?Object.entries(e).map(([e,n])=>({...ps(n,t),name:e})):fs(e,t)?[{component:e[0],props:e[1]??{}}]:Array.isArray(e)?e.map(e=>ps(e,t)):ss(e)&&t(e.component)?[{component:e.component,props:e.props??{}}]:t(e)?[{component:e,props:{}}]:[]}function hs(e){return e.target instanceof HTMLElement&&e.target.isContentEditable||e.defaultPrevented}function gs(e){let t=e.currentTarget.tagName.toLowerCase()===`a`,n=t?e.currentTarget.target:``;return!(hs(e)||t&&e.altKey||t&&e.ctrlKey||t&&e.metaKey||t&&e.shiftKey||t&&n!==``&&n!==`_self`||t&&`button`in e&&e.button!==0)}function _s(e){let t=e.currentTarget.tagName.toLowerCase()===`button`;return!hs(e)&&(e.key===`Enter`||t&&e.key===` `)}var vs=`nprogress`,ys,bs,xs={minimum:.08,easing:`linear`,speed:200,trickle:!0,trickleSpeed:200,showSpinner:!0,barSelector:`.bar, [role="bar"]`,spinnerSelector:`.spinner, [role="spinner"]`,parent:`body`,color:`#29d`,includeCSS:!0,popover:null,template:[`<div class="bar">`,`<div class="peg"></div>`,`</div>`,`<div class="spinner">`,`<div class="spinner-icon"></div>`,`</div>`].join(``)},Ss=null,Cs=!1,ws=e=>{Object.assign(xs,e),ys=xs.popover??`popover`in HTMLElement.prototype,xs.includeCSS&&Ls(xs.color),bs=document.createElement(`div`),bs.id=vs,bs.setAttribute(`aria-hidden`,`true`),bs.innerHTML=xs.template,ys&&(bs.popover=`manual`)},Ts=e=>{let t=Es();e=Ps(e,xs.minimum,1),Ss=e===1?null:e;let n=As(!t),r=n.querySelector(xs.barSelector),i=xs.speed,a=xs.easing;n.offsetWidth,Is(t=>{let o={transition:`all ${i}ms ${a}`,transform:`translate3d(${Fs(e)}%,0,0)`};for(let e in o)r.style[e]=o[e];if(e!==1)return setTimeout(t,i);n.style.transition=`none`,n.style.opacity=`1`,n.offsetWidth,setTimeout(()=>{n.style.transition=`all ${i}ms linear`,n.style.opacity=`0`,setTimeout(()=>{Ms(),n.style.transition=``,n.style.opacity=``,t()},i)},i)})},Es=()=>typeof Ss==`number`,Ds=()=>{Ss||Ts(0);let e=function(){setTimeout(function(){Ss&&(ks(),e())},xs.trickleSpeed)};xs.trickle&&e()},Os=e=>{!e&&!Ss||(ks(.3+.5*Math.random()),Ts(1))},ks=e=>{let t=Ss;if(t===null)return Ds();if(!(t>1))return e=typeof e==`number`?e:(()=>{let e={.1:[0,.2],.04:[.2,.5],.02:[.5,.8],.005:[.8,.99]};for(let n in e)if(t>=e[n][0]&&t<e[n][1])return parseFloat(n);return 0})(),Ts(Ps(t+e,0,.994))},As=e=>{if(Ns())return document.getElementById(vs);document.documentElement.classList.add(`${vs}-busy`);let t=bs.querySelector(xs.barSelector),n=e?`-100`:Fs(Ss||0);if(t.style.transition=`all 0 linear`,t.style.transform=`translate3d(${n}%,0,0)`,xs.showSpinner||bs.querySelector(xs.spinnerSelector)?.remove(),ys)document.body.appendChild(bs),Cs||bs.showPopover();else{let e=js();e!==document.body&&e.classList.add(`${vs}-custom-parent`),e.appendChild(bs),Cs&&(bs.style.display=`none`)}return bs},js=()=>document.querySelector(xs.parent),Ms=()=>{if(document.documentElement.classList.remove(`${vs}-busy`),ys&&bs?.isConnected)try{bs.hidePopover()}catch{}ys||js().classList.remove(`${vs}-custom-parent`),bs?.remove()},Ns=()=>document.getElementById(vs)!==null;function Ps(e,t,n){return e<t?t:e>n?n:e}var Fs=e=>(-1+e)*100,Is=(()=>{let e=[],t=()=>{let n=e.shift();n&&n(t)};return n=>{e.push(n),e.length===1&&t()}})(),Ls=e=>{let t=document.createElement(`style`),n=Fi.get(`nonce`);n&&(t.nonce=n),t.textContent=`
12
+ #${vs} {
13
+ pointer-events: none;
14
+ background: none;
15
+ border: none;
16
+ margin: 0;
17
+ padding: 0;
18
+ overflow: visible;
19
+ inset: unset;
20
+ width: 100%;
21
+ height: 0;
22
+ position: fixed;
23
+ top: 0;
24
+ left: 0;
25
+ }
26
+
27
+ #${vs}::backdrop {
28
+ display: none;
29
+ }
30
+
31
+ #${vs} .bar {
32
+ background: ${e};
33
+
34
+ position: fixed;
35
+ z-index: 1031;
36
+ top: 0;
37
+ left: 0;
38
+
39
+ width: 100%;
40
+ height: 2px;
41
+ }
42
+
43
+ #${vs} .peg {
44
+ display: block;
45
+ position: absolute;
46
+ right: 0px;
47
+ width: 100px;
48
+ height: 100%;
49
+ box-shadow: 0 0 10px ${e}, 0 0 5px ${e};
50
+ opacity: 1.0;
51
+
52
+ transform: rotate(3deg) translate(0px, -4px);
53
+ }
54
+
55
+ #${vs} .spinner {
56
+ display: block;
57
+ position: fixed;
58
+ z-index: 1031;
59
+ top: 15px;
60
+ right: 15px;
61
+ }
62
+
63
+ #${vs} .spinner-icon {
64
+ width: 18px;
65
+ height: 18px;
66
+ box-sizing: border-box;
67
+
68
+ border: solid 2px transparent;
69
+ border-top-color: ${e};
70
+ border-left-color: ${e};
71
+ border-radius: 50%;
72
+
73
+ animation: ${vs}-spinner 400ms linear infinite;
74
+ }
75
+
76
+ .${vs}-custom-parent {
77
+ overflow: hidden;
78
+ position: relative;
79
+ }
80
+
81
+ .${vs}-custom-parent #${vs} .spinner,
82
+ .${vs}-custom-parent #${vs} .bar {
83
+ position: absolute;
84
+ }
85
+
86
+ @keyframes ${vs}-spinner {
87
+ 0% { transform: rotate(0deg); }
88
+ 100% { transform: rotate(360deg); }
89
+ }
90
+ `,document.head.appendChild(t)},Rs={configure:ws,isStarted:Es,done:Os,set:Ts,remove:Ms,start:Ds,status:Ss,show:()=>{if(Cs=!1,bs?.isConnected)if(ys)try{bs.showPopover()}catch{}else bs.style.display=``},hide:()=>{if(Cs=!0,bs?.isConnected)if(ys)try{bs.hidePopover()}catch{}else bs.style.display=`none`}},zs=new class{hideCount=0;start(){Rs.start()}reveal(e=!1){this.hideCount=Math.max(0,this.hideCount-1),(e||this.hideCount===0)&&Rs.show()}hide(){this.hideCount++,Rs.hide()}set(e){Rs.set(Math.max(0,Math.min(1,e)))}finish(){Rs.done()}reset(){Rs.set(0)}remove(){Rs.done(),Rs.remove()}isStarted(){return Rs.isStarted()}getStatus(){return Rs.status}};function Bs(e){document.addEventListener(`inertia:start`,t=>Vs(t,e)),document.addEventListener(`inertia:progress`,Hs)}function Vs(e,t){e.detail.visit.showProgress||zs.hide();let n=setTimeout(()=>zs.start(),t);document.addEventListener(`inertia:finish`,e=>Us(e,n),{once:!0})}function Hs(e){zs.isStarted()&&e.detail.progress?.percentage&&zs.set(Math.max(zs.getStatus(),e.detail.progress.percentage/100*.9))}function Us(e,t){clearTimeout(t),zs.isStarted()&&(e.detail.visit.completed?zs.finish():e.detail.visit.interrupted?zs.reset():e.detail.visit.cancelled&&zs.remove())}function Ws({delay:e=250,color:t=`#29d`,includeCSS:n=!0,showSpinner:r=!1,popover:i=null}={}){Bs(e),Rs.configure({showSpinner:r,includeCSS:n,color:t,popover:i})}var Gs=Symbol(`FormComponentReset`);function Ks(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement}function qs(e,t){let n=e.value,r=e.checked;switch(e.type.toLowerCase()){case`checkbox`:e.checked=t.includes(e.value);break;case`radio`:e.checked=t[0]===e.value;break;case`file`:e.value=``;break;case`button`:case`submit`:case`reset`:case`image`:break;default:e.value=t[0]!==null&&t[0]!==void 0?String(t[0]):``}return e.value!==n||e.checked!==r}function Js(e,t){let n=e.value,r=Array.from(e.selectedOptions).map(e=>e.value);if(e.multiple){let n=t.map(e=>String(e));Array.from(e.options).forEach(e=>{e.selected=n.includes(e.value)})}else e.value=t[0]===void 0?``:String(t[0]);let i=Array.from(e.selectedOptions).map(e=>e.value);return e.multiple?JSON.stringify(r.sort())!==JSON.stringify(i.sort()):e.value!==n}function Ys(e,t){if(e.disabled){if(e instanceof HTMLInputElement){let t=e.value,n=e.checked;switch(e.type.toLowerCase()){case`checkbox`:case`radio`:return e.checked=e.defaultChecked,e.checked!==n;case`file`:return e.value=``,t!==``;case`button`:case`submit`:case`reset`:case`image`:return!1;default:return e.value=e.defaultValue,e.value!==t}}else if(e instanceof HTMLSelectElement){let t=Array.from(e.selectedOptions).map(e=>e.value);Array.from(e.options).forEach(e=>{e.selected=e.defaultSelected});let n=Array.from(e.selectedOptions).map(e=>e.value);return JSON.stringify(t.sort())!==JSON.stringify(n.sort())}else if(e instanceof HTMLTextAreaElement){let t=e.value;return e.value=e.defaultValue,e.value!==t}return!1}if(e instanceof HTMLInputElement)return qs(e,t);if(e instanceof HTMLSelectElement)return Js(e,t);if(e instanceof HTMLTextAreaElement){let n=e.value;return e.value=t[0]===void 0?``:String(t[0]),e.value!==n}return!1}function Xs(e,t){let n=!1;return e instanceof RadioNodeList||e instanceof HTMLCollection?Array.from(e).forEach((e,r)=>{e instanceof Element&&Ks(e)&&(e instanceof HTMLInputElement&&[`checkbox`,`radio`].includes(e.type.toLowerCase())?Ys(e,t)&&(n=!0):Ys(e,t[r]===void 0?[t[0]??null].filter(Boolean):[t[r]])&&(n=!0))}):Ks(e)&&(n=Ys(e,t)),n}function Zs(e,t,n){if(!e)return;let r=!n||n.length===0;if(r){let r=new FormData(e),i=Array.from(e.elements).map(e=>Ks(e)?e.name:``).filter(Boolean);n=[...new Set([...t.keys(),...r.keys(),...i])]}let i=!1;n.forEach(n=>{let r=e.elements.namedItem(n);r&&Xs(r,t.getAll(n))&&(i=!0)}),i&&r&&e.dispatchEvent(new CustomEvent(`reset`,{bubbles:!0,cancelable:!0,detail:{[Gs]:!0}}))}function Qs(e,t,n){return`<script data-page="${e}" type="application/json">${JSON.stringify(t).replace(/\//g,`\\/`)}<\/script><div data-server-rendered="true" id="${e}">${n}</div>`}var K=new Mo,$s=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),ec=n(((e,t)=>{t.exports=$s()})),tc=n((e=>{var t=ec(),n=r(),i=o();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function l(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(c(e)!==e)throw Error(a(188))}function f(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return d(i),e;if(o===r)return d(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var s=!1,l=i.child;l;){if(l===n){s=!0,n=i,r=o;break}if(l===r){s=!0,r=i,n=o;break}l=l.sibling}if(!s){for(l=o.child;l;){if(l===n){s=!0,n=o,r=i;break}if(l===r){s=!0,r=o,n=i;break}l=l.sibling}if(!s)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,h=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),ee=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=ee&&e[ee]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case v:return`Fragment`;case b:return`Profiler`;case y:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case S:return e.displayName||`Context`;case x:return(e._context.displayName||`Context`)+`.Consumer`;case C:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var te=Array.isArray,N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},ne=[],I=-1;function re(e){return{current:e}}function L(e){0>I||(e.current=ne[I],ne[I]=null,I--)}function R(e,t){I++,ne[I]=e.current,e.current=t}var ie=re(null),ae=re(null),oe=re(null),z=re(null);function se(e,t){switch(R(oe,t),R(ae,e),R(ie,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}L(ie),R(ie,e)}function ce(){L(ie),L(ae),L(oe)}function le(e){e.memoizedState!==null&&R(z,e);var t=ie.current,n=Hd(t,e.type);t!==n&&(R(ae,e),R(ie,n))}function ue(e){ae.current===e&&(L(ie),L(ae)),z.current===e&&(L(z),Qf._currentValue=F)}var de,fe;function pe(e){if(de===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);de=t&&t[1]||``,fe=-1<e.stack.indexOf(`
91
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
92
+ `+de+e+fe}var me=!1;function he(e,t){if(!e||me)return``;me=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
93
+ `),l=s.split(`
94
+ `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
95
+ `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{me=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?pe(n):``}function ge(e,t){switch(e.tag){case 26:case 27:case 5:return pe(e.type);case 16:return pe(`Lazy`);case 13:return e.child!==t&&t!==null?pe(`Suspense Fallback`):pe(`Suspense`);case 19:return pe(`SuspenseList`);case 0:case 15:return he(e.type,!1);case 11:return he(e.type.render,!1);case 1:return he(e.type,!0);case 31:return pe(`Activity`);default:return``}}function _e(e){try{var t=``,n=null;do t+=ge(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
96
+ Error generating stack: `+e.message+`
97
+ `+e.stack}}var ve=Object.prototype.hasOwnProperty,ye=t.unstable_scheduleCallback,be=t.unstable_cancelCallback,xe=t.unstable_shouldYield,Se=t.unstable_requestPaint,Ce=t.unstable_now,we=t.unstable_getCurrentPriorityLevel,Te=t.unstable_ImmediatePriority,Ee=t.unstable_UserBlockingPriority,De=t.unstable_NormalPriority,Oe=t.unstable_LowPriority,ke=t.unstable_IdlePriority,Ae=t.log,je=t.unstable_setDisableYieldValue,Me=null,Ne=null;function Pe(e){if(typeof Ae==`function`&&je(e),Ne&&typeof Ne.setStrictMode==`function`)try{Ne.setStrictMode(Me,e)}catch{}}var Fe=Math.clz32?Math.clz32:Re,Ie=Math.log,Le=Math.LN2;function Re(e){return e>>>=0,e===0?32:31-(Ie(e)/Le|0)|0}var ze=256,Be=262144,Ve=4194304;function He(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ue(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=He(n))):i=He(o):i=He(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=He(n))):i=He(o)):i=He(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function We(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ge(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ke(){var e=Ve;return Ve<<=1,!(Ve&62914560)&&(Ve=4194304),e}function qe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Je(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ye(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Fe(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Xe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Xe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Fe(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ze(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Fe(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Qe(e,t){var n=t&-t;return n=n&42?1:$e(n),(n&(e.suspendedLanes|t))===0?n:0}function $e(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function et(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function tt(){var e=P.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function nt(e,t){var n=P.p;try{return P.p=e,t()}finally{P.p=n}}var rt=Math.random().toString(36).slice(2),it=`__reactFiber$`+rt,at=`__reactProps$`+rt,ot=`__reactContainer$`+rt,st=`__reactEvents$`+rt,ct=`__reactListeners$`+rt,lt=`__reactHandles$`+rt,ut=`__reactResources$`+rt,dt=`__reactMarker$`+rt;function ft(e){delete e[it],delete e[at],delete e[st],delete e[ct],delete e[lt]}function pt(e){var t=e[it];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ot]||n[it]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[it])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function mt(e){if(e=e[it]||e[ot]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ht(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function gt(e){var t=e[ut];return t||=e[ut]={hoistableStyles:new Map,hoistableScripts:new Map},t}function _t(e){e[dt]=!0}var vt=new Set,yt={};function bt(e,t){xt(e,t),xt(e+`Capture`,t)}function xt(e,t){for(yt[e]=t,e=0;e<t.length;e++)vt.add(t[e])}var St=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Ct={},wt={};function Tt(e){return ve.call(wt,e)?!0:ve.call(Ct,e)?!1:St.test(e)?wt[e]=!0:(Ct[e]=!0,!1)}function Et(e,t,n){if(Tt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Dt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Ot(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function kt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function At(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function jt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Mt(e){if(!e._valueTracker){var t=At(e)?`checked`:`value`;e._valueTracker=jt(e,t,``+e[t])}}function Nt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=At(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Pt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Ft=/[\n"\\]/g;function It(e){return e.replace(Ft,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Lt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+kt(t)):e.value!==``+kt(t)&&(e.value=``+kt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):zt(e,o,kt(n)):zt(e,o,kt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+kt(s):e.removeAttribute(`name`)}function Rt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Mt(e);return}n=n==null?``:``+kt(n),t=t==null?n:``+kt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Mt(e)}function zt(e,t,n){t===`number`&&Pt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Bt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+kt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Vt(e,t,n){if(t!=null&&(t=``+kt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+kt(n)}function Ht(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(a(92));if(te(r)){if(1<r.length)throw Error(a(93));r=r[0]}n=r}n??=``,t=n}n=kt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Mt(e)}function Ut(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Wt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Gt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Wt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Kt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(a(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&Gt(e,i,r)}else for(var o in t)t.hasOwnProperty(o)&&Gt(e,o,t[o])}function qt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Jt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Yt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Xt(e){return Yt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Zt(){}var Qt=null;function $t(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var en=null,tn=null;function nn(e){var t=mt(e);if(t&&(e=t.stateNode)){var n=e[at]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Lt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+It(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[at]||null;if(!i)throw Error(a(90));Lt(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Nt(r)}break a;case`textarea`:Vt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Bt(e,!!n.multiple,t,!1)}}}var rn=!1;function an(e,t,n){if(rn)return e(t,n);rn=!0;try{return e(t)}finally{if(rn=!1,(en!==null||tn!==null)&&(vu(),en&&(t=en,e=tn,tn=en=null,nn(t),e)))for(t=0;t<e.length;t++)nn(e[t])}}function on(e,t){var n=e.stateNode;if(n===null)return null;var r=n[at]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(a(231,t,typeof n));return n}var sn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),B=!1;if(sn)try{var cn={};Object.defineProperty(cn,"passive",{get:function(){B=!0}}),window.addEventListener(`test`,cn,cn),window.removeEventListener(`test`,cn,cn)}catch{B=!1}var ln=null,un=null,dn=null;function V(){if(dn)return dn;var e,t=un,n=t.length,r,i=`value`in ln?ln.value:ln.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return dn=i.slice(e,1<r?1-r:void 0)}function fn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function pn(){return!0}function mn(){return!1}function hn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?pn:mn,this.isPropagationStopped=mn,this}return m(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=pn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=pn)},persist:function(){},isPersistent:pn}),t}var gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_n=hn(gn),vn=m({},gn,{view:0,detail:0}),yn=hn(vn),bn,xn,Sn,Cn=m({},vn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Sn&&(Sn&&e.type===`mousemove`?(bn=e.screenX-Sn.screenX,xn=e.screenY-Sn.screenY):xn=bn=0,Sn=e),bn)},movementY:function(e){return`movementY`in e?e.movementY:xn}}),wn=hn(Cn),Tn=hn(m({},Cn,{dataTransfer:0})),En=hn(m({},vn,{relatedTarget:0})),Dn=hn(m({},gn,{animationName:0,elapsedTime:0,pseudoElement:0})),On=hn(m({},gn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),kn=hn(m({},gn,{data:0})),An={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},jn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Mn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Nn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Mn[e])?!!t[e]:!1}function Pn(){return Nn}var Fn=hn(m({},vn,{key:function(e){if(e.key){var t=An[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=fn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?jn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pn,charCode:function(e){return e.type===`keypress`?fn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?fn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),In=hn(m({},Cn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Ln=hn(m({},vn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pn})),Rn=hn(m({},gn,{propertyName:0,elapsedTime:0,pseudoElement:0})),zn=hn(m({},Cn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Bn=hn(m({},gn,{newState:0,oldState:0})),Vn=[9,13,27,32],Hn=sn&&`CompositionEvent`in window,Un=null;sn&&`documentMode`in document&&(Un=document.documentMode);var Wn=sn&&`TextEvent`in window&&!Un,Gn=sn&&(!Hn||Un&&8<Un&&11>=Un),Kn=` `,qn=!1;function Jn(e,t){switch(e){case`keyup`:return Vn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Yn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Xn=!1;function Zn(e,t){switch(e){case`compositionend`:return Yn(t);case`keypress`:return t.which===32?(qn=!0,Kn):null;case`textInput`:return e=t.data,e===Kn&&qn?null:e;default:return null}}function Qn(e,t){if(Xn)return e===`compositionend`||!Hn&&Jn(e,t)?(e=V(),dn=un=ln=null,Xn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Gn&&t.locale!==`ko`?null:t.data;default:return null}}var $n={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function er(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!$n[e.type]:t===`textarea`}function tr(e,t,n,r){en?tn?tn.push(r):tn=[r]:en=r,t=Td(t,`onChange`),0<t.length&&(n=new _n(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var nr=null,rr=null;function ir(e){vd(e,0)}function ar(e){if(Nt(ht(e)))return e}function or(e,t){if(e===`change`)return t}var sr=!1;if(sn){var cr;if(sn){var lr=`oninput`in document;if(!lr){var ur=document.createElement(`div`);ur.setAttribute(`oninput`,`return;`),lr=typeof ur.oninput==`function`}cr=lr}else cr=!1;sr=cr&&(!document.documentMode||9<document.documentMode)}function dr(){nr&&(nr.detachEvent(`onpropertychange`,fr),rr=nr=null)}function fr(e){if(e.propertyName===`value`&&ar(rr)){var t=[];tr(t,rr,e,$t(e)),an(ir,t)}}function pr(e,t,n){e===`focusin`?(dr(),nr=t,rr=n,nr.attachEvent(`onpropertychange`,fr)):e===`focusout`&&dr()}function mr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return ar(rr)}function hr(e,t){if(e===`click`)return ar(t)}function gr(e,t){if(e===`input`||e===`change`)return ar(t)}function _r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var vr=typeof Object.is==`function`?Object.is:_r;function yr(e,t){if(vr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!ve.call(t,i)||!vr(e[i],t[i]))return!1}return!0}function br(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function xr(e,t){var n=br(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=br(n)}}function Sr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Cr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Pt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Pt(e.document)}return t}function wr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Tr=sn&&`documentMode`in document&&11>=document.documentMode,Er=null,Dr=null,Or=null,kr=!1;function Ar(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;kr||Er==null||Er!==Pt(r)||(r=Er,`selectionStart`in r&&wr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Or&&yr(Or,r)||(Or=r,r=Td(Dr,`onSelect`),0<r.length&&(t=new _n(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Er)))}function jr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Mr={animationend:jr(`Animation`,`AnimationEnd`),animationiteration:jr(`Animation`,`AnimationIteration`),animationstart:jr(`Animation`,`AnimationStart`),transitionrun:jr(`Transition`,`TransitionRun`),transitionstart:jr(`Transition`,`TransitionStart`),transitioncancel:jr(`Transition`,`TransitionCancel`),transitionend:jr(`Transition`,`TransitionEnd`)},Nr={},Pr={};sn&&(Pr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Mr.animationend.animation,delete Mr.animationiteration.animation,delete Mr.animationstart.animation),`TransitionEvent`in window||delete Mr.transitionend.transition);function Fr(e){if(Nr[e])return Nr[e];if(!Mr[e])return e;var t=Mr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Pr)return Nr[e]=t[n];return e}var Ir=Fr(`animationend`),Lr=Fr(`animationiteration`),Rr=Fr(`animationstart`),zr=Fr(`transitionrun`),Br=Fr(`transitionstart`),Vr=Fr(`transitioncancel`),Hr=Fr(`transitionend`),Ur=new Map,Wr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Wr.push(`scrollEnd`);function Gr(e,t){Ur.set(e,t),bt(t,[e])}var Kr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},qr=[],Jr=0,Yr=0;function Xr(){for(var e=Jr,t=Yr=Jr=0;t<e;){var n=qr[t];qr[t++]=null;var r=qr[t];qr[t++]=null;var i=qr[t];qr[t++]=null;var a=qr[t];if(qr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ei(n,i,a)}}function Zr(e,t,n,r){qr[Jr++]=e,qr[Jr++]=t,qr[Jr++]=n,qr[Jr++]=r,Yr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Qr(e,t,n,r){return Zr(e,t,n,r),ti(e)}function $r(e,t){return Zr(e,null,null,t),ti(e)}function ei(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Fe(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ti(e){if(50<lu)throw lu=0,uu=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ni={};function ri(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ii(e,t,n,r){return new ri(e,t,n,r)}function ai(e){return e=e.prototype,!(!e||!e.isReactComponent)}function oi(e,t){var n=e.alternate;return n===null?(n=ii(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function si(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ci(e,t,n,r,i,o){var s=0;if(r=e,typeof e==`function`)ai(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,ie.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case O:return e=ii(31,n,t,i),e.elementType=O,e.lanes=o,e;case v:return li(n.children,i,o,t);case y:s=8,i|=24;break;case b:return e=ii(12,n,t,i|2),e.elementType=b,e.lanes=o,e;case w:return e=ii(13,n,t,i),e.elementType=w,e.lanes=o,e;case T:return e=ii(19,n,t,i),e.elementType=T,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case S:s=10;break a;case x:s=9;break a;case C:s=11;break a;case E:s=14;break a;case D:s=16,r=null;break a}s=29,n=Error(a(130,e===null?`null`:typeof e,``)),r=null}return t=ii(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function li(e,t,n,r){return e=ii(7,e,r,t),e.lanes=n,e}function ui(e,t,n){return e=ii(6,e,null,t),e.lanes=n,e}function di(e){var t=ii(18,null,null,0);return t.stateNode=e,t}function fi(e,t,n){return t=ii(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var pi=new WeakMap;function mi(e,t){if(typeof e==`object`&&e){var n=pi.get(e);return n===void 0?(t={value:e,source:t,stack:_e(t)},pi.set(e,t),t):n}return{value:e,source:t,stack:_e(t)}}var hi=[],gi=0,_i=null,vi=0,yi=[],bi=0,xi=null,Si=1,Ci=``;function wi(e,t){hi[gi++]=vi,hi[gi++]=_i,_i=e,vi=t}function Ti(e,t,n){yi[bi++]=Si,yi[bi++]=Ci,yi[bi++]=xi,xi=e;var r=Si;e=Ci;var i=32-Fe(r)-1;r&=~(1<<i),n+=1;var a=32-Fe(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Si=1<<32-Fe(t)+i|n<<i|r,Ci=a+e}else Si=1<<a|n<<i|r,Ci=e}function Ei(e){e.return!==null&&(wi(e,1),Ti(e,1,0))}function Di(e){for(;e===_i;)_i=hi[--gi],hi[gi]=null,vi=hi[--gi],hi[gi]=null;for(;e===xi;)xi=yi[--bi],yi[bi]=null,Ci=yi[--bi],yi[bi]=null,Si=yi[--bi],yi[bi]=null}function Oi(e,t){yi[bi++]=Si,yi[bi++]=Ci,yi[bi++]=xi,Si=t.id,Ci=t.overflow,xi=e}var ki=null,Ai=null,H=!1,ji=null,Mi=!1,Ni=Error(a(519));function Pi(e){throw Bi(mi(Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ni}function Fi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[it]=e,t[at]=r,n){case`dialog`:$(`cancel`,t),$(`close`,t);break;case`iframe`:case`object`:case`embed`:$(`load`,t);break;case`video`:case`audio`:for(n=0;n<gd.length;n++)$(gd[n],t);break;case`source`:$(`error`,t);break;case`img`:case`image`:case`link`:$(`error`,t),$(`load`,t);break;case`details`:$(`toggle`,t);break;case`input`:$(`invalid`,t),Rt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:$(`invalid`,t);break;case`textarea`:$(`invalid`,t),Ht(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||jd(t.textContent,n)?(r.popover!=null&&($(`beforetoggle`,t),$(`toggle`,t)),r.onScroll!=null&&$(`scroll`,t),r.onScrollEnd!=null&&$(`scrollend`,t),r.onClick!=null&&(t.onclick=Zt),t=!0):t=!1,t||Pi(e,!0)}function Ii(e){for(ki=e.return;ki;)switch(ki.tag){case 5:case 31:case 13:Mi=!1;return;case 27:case 3:Mi=!0;return;default:ki=ki.return}}function Li(e){if(e!==ki)return!1;if(!H)return Ii(e),H=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Ud(e.type,e.memoizedProps)),n=!n),n&&Ai&&Pi(e),Ii(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(317));Ai=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(317));Ai=uf(e)}else t===27?(t=Ai,Zd(e.type)?(e=lf,lf=null,Ai=e):Ai=t):Ai=ki?cf(e.stateNode.nextSibling):null;return!0}function Ri(){Ai=ki=null,H=!1}function zi(){var e=ji;return e!==null&&(Q===null?Q=e:Q.push.apply(Q,e),ji=null),e}function Bi(e){ji===null?ji=[e]:ji.push(e)}var Vi=re(null),Hi=null,Ui=null;function Wi(e,t,n){R(Vi,t._currentValue),t._currentValue=n}function Gi(e){e._currentValue=Vi.current,L(Vi)}function Ki(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function qi(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var o=i.dependencies;if(o!==null){var s=i.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Ki(o.return,n,e),r||(s=null);break a}o=c.next}}else if(i.tag===18){if(s=i.return,s===null)throw Error(a(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Ki(s,n,e),s=null}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}}function Ji(e,t,n,r){e=null;for(var i=t,o=!1;i!==null;){if(!o){if(i.flags&524288)o=!0;else if(i.flags&262144)break}if(i.tag===10){var s=i.alternate;if(s===null)throw Error(a(387));if(s=s.memoizedProps,s!==null){var c=i.type;vr(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===z.current){if(s=i.alternate,s===null)throw Error(a(387));s.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}i=i.return}e!==null&&qi(t,e,n,r),t.flags|=262144}function Yi(e){for(e=e.firstContext;e!==null;){if(!vr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Xi(e){Hi=e,Ui=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Zi(e){return $i(Hi,e)}function Qi(e,t){return Hi===null&&Xi(e),$i(e,t)}function $i(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ui===null){if(e===null)throw Error(a(308));Ui=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ui=Ui.next=t;return n}var ea=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ta=t.unstable_scheduleCallback,na=t.unstable_NormalPriority,ra={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ia(){return{controller:new ea,data:new Map,refCount:0}}function aa(e){e.refCount--,e.refCount===0&&ta(na,function(){e.controller.abort()})}var oa=null,sa=0,ca=0,la=null;function ua(e,t){if(oa===null){var n=oa=[];sa=0,ca=ud(),la={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return sa++,t.then(da,da),t}function da(){if(--sa===0&&oa!==null){la!==null&&(la.status=`fulfilled`);var e=oa;oa=null,ca=0,la=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function fa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var pa=N.S;N.S=function(e,t){Ql=Ce(),typeof t==`object`&&t&&typeof t.then==`function`&&ua(e,t),pa!==null&&pa(e,t)};var ma=re(null);function ha(){var e=ma.current;return e===null?Il.pooledCache:e}function ga(e,t){t===null?R(ma,ma.current):R(ma,t.pool)}function _a(){var e=ha();return e===null?null:{parent:ra._currentValue,pool:e}}var va=Error(a(460)),ya=Error(a(474)),ba=Error(a(542)),xa={then:function(){}};function Sa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ca(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Zt,Zt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Da(e),e;default:if(typeof t.status==`string`)t.then(Zt,Zt);else{if(e=Il,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Da(e),e}throw Ta=t,va}}function wa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ta=e,va):e}}var Ta=null;function Ea(){if(Ta===null)throw Error(a(459));var e=Ta;return Ta=null,e}function Da(e){if(e===va||e===ba)throw Error(a(483))}var Oa=null,ka=0;function Aa(e){var t=ka;return ka+=1,Oa===null&&(Oa=[]),Ca(Oa,e,t)}function ja(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ma(e,t){throw t.$$typeof===h?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Na(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=oi(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ui(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===v?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===D&&wa(a)===t.type)?(t=i(t,n.props),ja(t,n),t.return=e,t):(t=ci(n.type,n.key,n.props,null,e.mode,r),ja(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=fi(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=li(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ui(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case g:return n=ci(t.type,t.key,t.props,null,e.mode,n),ja(n,t),n.return=e,n;case _:return t=fi(t,e.mode,n),t.return=e,t;case D:return t=wa(t),f(e,t,n)}if(te(t)||A(t))return t=li(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Aa(t),n);if(t.$$typeof===S)return f(e,Qi(e,t),n);Ma(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case g:return n.key===i?l(e,t,n,r):null;case _:return n.key===i?u(e,t,n,r):null;case D:return n=wa(n),p(e,t,n,r)}if(te(n)||A(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Aa(n),r);if(n.$$typeof===S)return p(e,t,Qi(e,n),r);Ma(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case g:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case _:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case D:return r=wa(r),m(e,t,n,r,i)}if(te(r)||A(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Aa(r),i);if(r.$$typeof===S)return m(e,t,n,Qi(t,r),i);Ma(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),H&&wi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return H&&wi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),H&&wi(i,h),l}function y(i,s,c,l){if(c==null)throw Error(a(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),H&&wi(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return H&&wi(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),H&&wi(i,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===v&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case g:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===v){if(r.tag===7){n(e,r.sibling),c=i(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===D&&wa(l)===r.type){n(e,r.sibling),c=i(r,o.props),ja(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===v?(c=li(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ci(o.type,o.key,o.props,null,e.mode,c),ja(c,o),c.return=e,e=c)}return s(e);case _:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=i(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}t(e,r),r=r.sibling}c=fi(o,e.mode,c),c.return=e,e=c}return s(e);case D:return o=wa(o),b(e,r,o,c)}if(te(o))return h(e,r,o,c);if(A(o)){if(l=A(o),typeof l!=`function`)throw Error(a(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Aa(o),c);if(o.$$typeof===S)return b(e,r,Qi(e,o),c);Ma(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,o),c.return=e,e=c):(n(e,r),c=ui(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ka=0;var i=b(e,t,n,r);return Oa=null,i}catch(t){if(t===va||t===ba)throw t;var a=ii(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Pa=Na(!0),Fa=Na(!1),Ia=!1;function La(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ra(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function za(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ba(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Y&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ti(e),ei(e,null,n),t}return Zr(e,r,t,n),ti(e)}function Va(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}function Ha(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ua=!1;function Wa(){if(Ua){var e=la;if(e!==null)throw e}}function Ga(e,t,n,r){Ua=!1;var i=e.updateQueue;Ia=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Z&f)===f:(r&f)===f){f!==0&&f===ca&&(Ua=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Ia=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Wl|=o,e.lanes=o,e.memoizedState=d}}function Ka(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function qa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ka(n[e],t)}var Ja=re(null),U=re(0);function Ya(e,t){e=Hl,R(U,e),R(Ja,t),Hl=e|t.baseLanes}function Xa(){R(U,Hl),R(Ja,Ja.current)}function Za(){Hl=U.current,L(Ja),L(U)}var Qa=re(null),$a=null;function W(e){var t=e.alternate;R(io,io.current&1),R(Qa,e),$a===null&&(t===null||Ja.current!==null||t.memoizedState!==null)&&($a=e)}function eo(e){R(io,io.current),R(Qa,e),$a===null&&($a=e)}function to(e){e.tag===22?(R(io,io.current),R(Qa,e),$a===null&&($a=e)):no(e)}function no(){R(io,io.current),R(Qa,Qa.current)}function ro(e){L(Qa),$a===e&&($a=null),L(io)}var io=re(0);function ao(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var oo=0,G=null,so=null,co=null,lo=!1,uo=!1,fo=!1,po=0,mo=0,ho=null,go=0;function _o(){throw Error(a(321))}function vo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!vr(e[n],t[n]))return!1;return!0}function yo(e,t,n,r,i,a){return oo=a,G=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,N.H=e===null||e.memoizedState===null?Is:Ls,fo=!1,a=n(r,i),fo=!1,uo&&(a=xo(t,n,r,i)),bo(e),a}function bo(e){N.H=Fs;var t=so!==null&&so.next!==null;if(oo=0,co=so=G=null,lo=!1,mo=0,ho=null,t)throw Error(a(300));e===null||$s||(e=e.dependencies,e!==null&&Yi(e)&&($s=!0))}function xo(e,t,n,r){G=e;var i=0;do{if(uo&&(ho=null),mo=0,uo=!1,25<=i)throw Error(a(301));if(i+=1,co=so=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}N.H=Rs,o=t(n,r)}while(uo);return o}function So(){var e=N.H,t=e.useState()[0];return t=typeof t.then==`function`?ko(t):t,e=e.useState()[0],(so===null?null:so.memoizedState)!==e&&(G.flags|=1024),t}function Co(){var e=po!==0;return po=0,e}function wo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function To(e){if(lo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}lo=!1}oo=0,co=so=G=null,uo=!1,mo=po=0,ho=null}function Eo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return co===null?G.memoizedState=co=e:co=co.next=e,co}function Do(){if(so===null){var e=G.alternate;e=e===null?null:e.memoizedState}else e=so.next;var t=co===null?G.memoizedState:co.next;if(t!==null)co=t,so=e;else{if(e===null)throw G.alternate===null?Error(a(467)):Error(a(310));so=e,e={memoizedState:so.memoizedState,baseState:so.baseState,baseQueue:so.baseQueue,queue:so.queue,next:null},co===null?G.memoizedState=co=e:co=co.next=e}return co}function Oo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ko(e){var t=mo;return mo+=1,ho===null&&(ho=[]),e=Ca(ho,e,t),t=G,(co===null?t.memoizedState:co.next)===null&&(t=t.alternate,N.H=t===null||t.memoizedState===null?Is:Ls),e}function Ao(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ko(e);if(e.$$typeof===S)return Zi(e)}throw Error(a(438,String(e)))}function jo(e){var t=null,n=G.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=G.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Oo(),G.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=k;return t.index++,n}function Mo(e,t){return typeof t==`function`?t(e):t}function No(e){return Po(Do(),so,e)}function Po(e,t,n){var r=e.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=n;var i=e.baseQueue,o=r.pending;if(o!==null){if(i!==null){var s=i.next;i.next=o.next,o.next=s}t.baseQueue=i=o,r.pending=null}if(o=e.baseState,i===null)e.memoizedState=o;else{t=i.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(oo&f)===f:(Z&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ca&&(d=!0);else if((oo&p)===p){u=u.next,p===ca&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,G.lanes|=p,Wl|=p;f=u.action,fo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,G.lanes|=f,Wl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!vr(o,e.memoizedState)&&($s=!0,d&&(n=la,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Fo(e){var t=Do(),n=t.queue;if(n===null)throw Error(a(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do o=e(o,s.action),s=s.next;while(s!==i);vr(o,t.memoizedState)||($s=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Io(e,t,n){var r=G,i=Do(),o=H;if(o){if(n===void 0)throw Error(a(407));n=n()}else n=t();var s=!vr((so||i).memoizedState,n);if(s&&(i.memoizedState=n,$s=!0),i=i.queue,ss(zo.bind(null,r,i,e),[e]),i.getSnapshot!==t||s||co!==null&&co.memoizedState.tag&1){if(r.flags|=2048,ns(9,{destroy:void 0},Ro.bind(null,r,i,n,t),null),Il===null)throw Error(a(349));o||oo&127||Lo(r,t,n)}return n}function Lo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=G.updateQueue,t===null?(t=Oo(),G.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ro(e,t,n,r){t.value=n,t.getSnapshot=r,Bo(t)&&Vo(e)}function zo(e,t,n){return n(function(){Bo(t)&&Vo(e)})}function Bo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!vr(e,n)}catch{return!0}}function Vo(e){var t=$r(e,2);t!==null&&pu(t,e,2)}function Ho(e){var t=Eo();if(typeof e==`function`){var n=e;if(e=n(),fo){Pe(!0);try{n()}finally{Pe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:e},t}function Uo(e,t,n,r){return e.baseState=n,Po(e,so,typeof r==`function`?r:Mo)}function Wo(e,t,n,r,i){if(Ms(e))throw Error(a(485));if(e=t.action,e!==null){var o={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};N.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Go(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Go(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=N.T,o={};N.T=o;try{var s=n(i,r),c=N.S;c!==null&&c(o,s),Ko(e,t,s)}catch(n){Jo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),N.T=a}}else try{a=n(i,r),Ko(e,t,a)}catch(n){Jo(e,t,n)}}function Ko(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){qo(e,t,n)},function(n){return Jo(e,t,n)}):qo(e,t,n)}function qo(e,t,n){t.status=`fulfilled`,t.value=n,Yo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Go(e,n)))}function Jo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Yo(t),t=t.next;while(t!==r)}e.action=null}function Yo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Xo(e,t){return t}function Zo(e,t){if(H){var n=Il.formState;if(n!==null){a:{var r=G;if(H){if(Ai){b:{for(var i=Ai,a=Mi;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ai=cf(i.nextSibling),r=i.data===`F!`;break a}}Pi(r)}r=!1}r&&(t=n[0])}}return n=Eo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:t},n.queue=r,n=ks.bind(null,G,r),r.dispatch=n,r=Ho(!1),a=js.bind(null,G,!1,r.queue),r=Eo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Wo.bind(null,G,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Qo(e){return $o(Do(),so,e)}function $o(e,t,n){if(t=Po(e,t,Xo)[0],e=No(Mo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ko(t)}catch(e){throw e===va?ba:e}else r=t;t=Do();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(G.flags|=2048,ns(9,{destroy:void 0},es.bind(null,i,n),null)),[r,a,e]}function es(e,t){e.action=t}function ts(e){var t=Do(),n=so;if(n!==null)return $o(t,n,e);Do(),t=t.memoizedState,n=Do();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ns(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=G.updateQueue,t===null&&(t=Oo(),G.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function rs(){return Do().memoizedState}function is(e,t,n,r){var i=Eo();G.flags|=e,i.memoizedState=ns(1|t,{destroy:void 0},n,r===void 0?null:r)}function as(e,t,n,r){var i=Do();r=r===void 0?null:r;var a=i.memoizedState.inst;so!==null&&r!==null&&vo(r,so.memoizedState.deps)?i.memoizedState=ns(t,a,n,r):(G.flags|=e,i.memoizedState=ns(1|t,a,n,r))}function os(e,t){is(8390656,8,e,t)}function ss(e,t){as(2048,8,e,t)}function cs(e){G.flags|=4;var t=G.updateQueue;if(t===null)t=Oo(),G.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ls(e){var t=Do().memoizedState;return cs({ref:t,nextImpl:e}),function(){if(Y&2)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function us(e,t){return as(4,2,e,t)}function ds(e,t){return as(4,4,e,t)}function fs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ps(e,t,n){n=n==null?null:n.concat([e]),as(4,4,fs.bind(null,t,e),n)}function ms(){}function hs(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&vo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function gs(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&vo(t,r[1]))return r[0];if(r=e(),fo){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[r,t],r}function _s(e,t,n){return n===void 0||oo&1073741824&&!(Z&261930)?e.memoizedState=t:(e.memoizedState=n,e=fu(),G.lanes|=e,Wl|=e,n)}function vs(e,t,n,r){return vr(n,t)?n:Ja.current===null?!(oo&42)||oo&1073741824&&!(Z&261930)?($s=!0,e.memoizedState=n):(e=fu(),G.lanes|=e,Wl|=e,t):(e=_s(e,n,r),vr(e,t)||($s=!0),e)}function ys(e,t,n,r,i){var a=P.p;P.p=a!==0&&8>a?a:8;var o=N.T,s={};N.T=s,js(e,!1,t,n);try{var c=i(),l=N.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?As(e,t,fa(c,r),du(e)):As(e,t,r,du(e))}catch(n){As(e,t,{then:function(){},status:`rejected`,reason:n},du())}finally{P.p=a,o!==null&&s.types!==null&&(o.types=s.types),N.T=o}}function bs(){}function xs(e,t,n,r){if(e.tag!==5)throw Error(a(476));var i=Ss(e).queue;ys(e,i,t,F,n===null?bs:function(){return Cs(e),n(r)})}function Ss(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:F},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Cs(e){var t=Ss(e);t.next===null&&(t=e.alternate.memoizedState),As(e,t.next.queue,{},du())}function ws(){return Zi(Qf)}function Ts(){return Do().memoizedState}function Es(){return Do().memoizedState}function Ds(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=du();e=za(n);var r=Ba(t,e,n);r!==null&&(pu(r,t,n),Va(r,t,n)),t={cache:ia()},e.payload=t;return}t=t.return}}function Os(e,t,n){var r=du();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ms(e)?Ns(t,n):(n=Qr(e,t,n,r),n!==null&&(pu(n,e,r),Ps(n,t,r)))}function ks(e,t,n){As(e,t,n,du())}function As(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ms(e))Ns(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,vr(s,o))return Zr(e,t,i,0),Il===null&&Xr(),!1}catch{}if(n=Qr(e,t,i,r),n!==null)return pu(n,e,r),Ps(n,t,r),!0}return!1}function js(e,t,n,r){if(r={lane:2,revertLane:ud(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ms(e)){if(t)throw Error(a(479))}else t=Qr(e,n,r,2),t!==null&&pu(t,e,2)}function Ms(e){var t=e.alternate;return e===G||t!==null&&t===G}function Ns(e,t){uo=lo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ps(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}var Fs={readContext:Zi,use:Ao,useCallback:_o,useContext:_o,useEffect:_o,useImperativeHandle:_o,useLayoutEffect:_o,useInsertionEffect:_o,useMemo:_o,useReducer:_o,useRef:_o,useState:_o,useDebugValue:_o,useDeferredValue:_o,useTransition:_o,useSyncExternalStore:_o,useId:_o,useHostTransitionStatus:_o,useFormState:_o,useActionState:_o,useOptimistic:_o,useMemoCache:_o,useCacheRefresh:_o};Fs.useEffectEvent=_o;var Is={readContext:Zi,use:Ao,useCallback:function(e,t){return Eo().memoizedState=[e,t===void 0?null:t],e},useContext:Zi,useEffect:os,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),is(4194308,4,fs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return is(4194308,4,e,t)},useInsertionEffect:function(e,t){is(4,2,e,t)},useMemo:function(e,t){var n=Eo();t=t===void 0?null:t;var r=e();if(fo){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Eo();if(n!==void 0){var i=n(t);if(fo){Pe(!0);try{n(t)}finally{Pe(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Os.bind(null,G,e),[r.memoizedState,e]},useRef:function(e){var t=Eo();return e={current:e},t.memoizedState=e},useState:function(e){e=Ho(e);var t=e.queue,n=ks.bind(null,G,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ms,useDeferredValue:function(e,t){return _s(Eo(),e,t)},useTransition:function(){var e=Ho(!1);return e=ys.bind(null,G,e.queue,!0,!1),Eo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=G,i=Eo();if(H){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),Il===null)throw Error(a(349));Z&127||Lo(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,os(zo.bind(null,r,o,e),[e]),r.flags|=2048,ns(9,{destroy:void 0},Ro.bind(null,r,o,n,t),null),n},useId:function(){var e=Eo(),t=Il.identifierPrefix;if(H){var n=Ci,r=Si;n=(r&~(1<<32-Fe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=po++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=go++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:ws,useFormState:Zo,useActionState:Zo,useOptimistic:function(e){var t=Eo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=js.bind(null,G,!0,n),n.dispatch=t,[e,t]},useMemoCache:jo,useCacheRefresh:function(){return Eo().memoizedState=Ds.bind(null,G)},useEffectEvent:function(e){var t=Eo(),n={impl:e};return t.memoizedState=n,function(){if(Y&2)throw Error(a(440));return n.impl.apply(void 0,arguments)}}},Ls={readContext:Zi,use:Ao,useCallback:hs,useContext:Zi,useEffect:ss,useImperativeHandle:ps,useInsertionEffect:us,useLayoutEffect:ds,useMemo:gs,useReducer:No,useRef:rs,useState:function(){return No(Mo)},useDebugValue:ms,useDeferredValue:function(e,t){return vs(Do(),so.memoizedState,e,t)},useTransition:function(){var e=No(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:Ts,useHostTransitionStatus:ws,useFormState:Qo,useActionState:Qo,useOptimistic:function(e,t){return Uo(Do(),so,e,t)},useMemoCache:jo,useCacheRefresh:Es};Ls.useEffectEvent=ls;var Rs={readContext:Zi,use:Ao,useCallback:hs,useContext:Zi,useEffect:ss,useImperativeHandle:ps,useInsertionEffect:us,useLayoutEffect:ds,useMemo:gs,useReducer:Fo,useRef:rs,useState:function(){return Fo(Mo)},useDebugValue:ms,useDeferredValue:function(e,t){var n=Do();return so===null?_s(n,e,t):vs(n,so.memoizedState,e,t)},useTransition:function(){var e=Fo(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:Ts,useHostTransitionStatus:ws,useFormState:ts,useActionState:ts,useOptimistic:function(e,t){var n=Do();return so===null?(n.baseState=e,[e,n.queue.dispatch]):Uo(n,so,e,t)},useMemoCache:jo,useCacheRefresh:Es};Rs.useEffectEvent=ls;function zs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:m({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Bs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=du(),i=za(r);i.payload=t,n!=null&&(i.callback=n),t=Ba(e,i,r),t!==null&&(pu(t,e,r),Va(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=du(),i=za(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ba(e,i,r),t!==null&&(pu(t,e,r),Va(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=du(),r=za(n);r.tag=2,t!=null&&(r.callback=t),t=Ba(e,r,n),t!==null&&(pu(t,e,n),Va(t,e,n))}};function Vs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!yr(n,r)||!yr(i,a):!0}function Hs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Bs.enqueueReplaceState(t,t.state,null)}function Us(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=m({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ws(e){Kr(e)}function Gs(e){console.error(e)}function Ks(e){Kr(e)}function qs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Js(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Ys(e,t,n){return n=za(n),n.tag=3,n.payload={element:null},n.callback=function(){qs(e,t)},n}function Xs(e){return e=za(e),e.tag=3,e}function Zs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Js(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Js(t,n,r),typeof i!=`function`&&(tu===null?tu=new Set([this]):tu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Qs(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ji(t,n,i,!0),n=Qa.current,n!==null){switch(n.tag){case 31:case 13:return $a===null?Tu():n.alternate===null&&Ul===0&&(Ul=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===xa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Wu(e,r,i)),!1;case 22:return n.flags|=65536,r===xa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Wu(e,r,i)),!1}throw Error(a(435,n.tag))}return Wu(e,r,i),Tu(),!1}if(H)return t=Qa.current,t===null?(r!==Ni&&(t=Error(a(423),{cause:r}),Bi(mi(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=mi(r,n),i=Ys(e.stateNode,r,i),Ha(e,i),Ul!==4&&(Ul=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Ni&&(e=Error(a(422),{cause:r}),Bi(mi(e,n)))),!1;var o=Error(a(520),{cause:r});if(o=mi(o,n),Yl===null?Yl=[o]:Yl.push(o),Ul!==4&&(Ul=2),t===null)return!0;r=mi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=Ys(n.stateNode,r,e),Ha(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(tu===null||!tu.has(o))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Xs(i),Zs(i,e,n,r),Ha(n,i),!1}n=n.return}while(n!==null);return!1}var K=Error(a(461)),$s=!1;function tc(e,t,n,r){t.child=e===null?Fa(t,null,n,r):Pa(t,e.child,n,r)}function nc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Xi(t),r=yo(e,t,n,o,a,i),s=Co(),e!==null&&!$s?(wo(e,t,i),Ec(e,t,i)):(H&&s&&Ei(t),t.flags|=1,tc(e,t,r,i),t.child)}function rc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ai(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,ic(e,t,a,r,i)):(e=ci(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Dc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?yr:n,n(o,r)&&e.ref===t.ref)return Ec(e,t,i)}return t.flags|=1,e=oi(a,r),e.ref=t.ref,e.return=t,t.child=e}function ic(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(yr(a,r)&&e.ref===t.ref)if($s=!1,t.pendingProps=r=a,Dc(e,i))e.flags&131072&&($s=!0);else return t.lanes=e.lanes,Ec(e,t,i)}return fc(e,t,n,r,i)}function ac(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return sc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ga(t,a===null?null:a.cachePool),a===null?Xa():Ya(t,a),to(t);else return r=t.lanes=536870912,sc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ga(t,null),Xa(),no(t)):(ga(t,a.cachePool),Ya(t,a),no(t),t.memoizedState=null);return tc(e,t,i,n),t.child}function oc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function sc(e,t,n,r,i){var a=ha();return a=a===null?null:{parent:ra._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ga(t,null),Xa(),to(t),e!==null&&Ji(e,t,r,!0),t.childLanes=i,null}function cc(e,t){return t=xc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function lc(e,t,n){return Pa(t,e.child,null,n),e=cc(t,t.pendingProps),e.flags|=2,ro(t),t.memoizedState=null,e}function uc(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(H){if(r.mode===`hidden`)return e=cc(t,r),t.lanes=536870912,oc(null,e);if(eo(t),(e=Ai)?(e=rf(e,Mi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:xi===null?null:{id:Si,overflow:Ci},retryLane:536870912,hydrationErrors:null},n=di(e),n.return=t,t.child=n,ki=t,Ai=null)):e=null,e===null)throw Pi(t);return t.lanes=536870912,null}return cc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(eo(t),i)if(t.flags&256)t.flags&=-257,t=lc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if($s||Ji(e,t,n,!1),i=(n&e.childLanes)!==0,$s||i){if(r=Il,r!==null&&(s=Qe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,$r(e,s),pu(r,e,s),K;Tu(),t=lc(e,t,n)}else e=o.treeContext,Ai=cf(s.nextSibling),ki=t,H=!0,ji=null,Mi=!1,e!==null&&Oi(t,e),t=cc(t,r),t.flags|=4096;return t}return e=oi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function dc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(a(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function fc(e,t,n,r,i){return Xi(t),n=yo(e,t,n,r,void 0,i),r=Co(),e!==null&&!$s?(wo(e,t,i),Ec(e,t,i)):(H&&r&&Ei(t),t.flags|=1,tc(e,t,n,i),t.child)}function pc(e,t,n,r,i,a){return Xi(t),t.updateQueue=null,n=xo(t,r,n,i),bo(e),r=Co(),e!==null&&!$s?(wo(e,t,a),Ec(e,t,a)):(H&&r&&Ei(t),t.flags|=1,tc(e,t,n,a),t.child)}function mc(e,t,n,r,i){if(Xi(t),t.stateNode===null){var a=ni,o=n.contextType;typeof o==`object`&&o&&(a=Zi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Bs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},La(t),o=n.contextType,a.context=typeof o==`object`&&o?Zi(o):ni,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(zs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Bs.enqueueReplaceState(a,a.state,null),Ga(t,r,a,i),Wa(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Us(n,s);a.props=c;var l=a.context,u=n.contextType;o=ni,typeof u==`object`&&u&&(o=Zi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Hs(t,a,r,o),Ia=!1;var f=t.memoizedState;a.state=f,Ga(t,r,a,i),Wa(),l=t.memoizedState,s||f!==l||Ia?(typeof d==`function`&&(zs(t,n,d,r),l=t.memoizedState),(c=Ia||Vs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ra(e,t),o=t.memoizedProps,u=Us(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ni,typeof l==`object`&&l&&(c=Zi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Hs(t,a,r,c),Ia=!1,f=t.memoizedState,a.state=f,Ga(t,r,a,i),Wa();var p=t.memoizedState;o!==d||f!==p||Ia||e!==null&&e.dependencies!==null&&Yi(e.dependencies)?(typeof s==`function`&&(zs(t,n,s,r),p=t.memoizedState),(u=Ia||Vs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Yi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,dc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Pa(t,e.child,null,i),t.child=Pa(t,null,n,i)):tc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Ec(e,t,i),e}function hc(e,t,n,r){return Ri(),t.flags|=256,tc(e,t,n,r),t.child}var gc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _c(e){return{baseLanes:e,cachePool:_a()}}function vc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ql),e}function yc(e,t,n){var r=t.pendingProps,i=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(io.current&2)),s&&(i=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(H){if(i?W(t):no(t),(e=Ai)?(e=rf(e,Mi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:xi===null?null:{id:Si,overflow:Ci},retryLane:536870912,hydrationErrors:null},n=di(e),n.return=t,t.child=n,ki=t,Ai=null)):e=null,e===null)throw Pi(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?(no(t),i=t.mode,c=xc({mode:`hidden`,children:c},i),r=li(r,i,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=_c(n),r.childLanes=vc(e,s,n),t.memoizedState=gc,oc(null,r)):(W(t),bc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(W(t),t.flags&=-257,t=Sc(e,t,n)):t.memoizedState===null?(no(t),c=r.fallback,i=t.mode,r=xc({mode:`visible`,children:r.children},i),c=li(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Pa(t,e.child,null,n),r=t.child,r.memoizedState=_c(n),r.childLanes=vc(e,s,n),t.memoizedState=gc,t=oc(null,r)):(no(t),t.child=e.child,t.flags|=128,t=null);else if(W(t),of(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(a(419)),r.stack=``,r.digest=s,Bi({value:r,source:null,stack:null}),t=Sc(e,t,n)}else if($s||Ji(e,t,n,!1),s=(n&e.childLanes)!==0,$s||s){if(s=Il,s!==null&&(r=Qe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,$r(e,r),pu(s,e,r),K;af(c)||Tu(),t=Sc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ai=cf(c.nextSibling),ki=t,H=!0,ji=null,Mi=!1,e!==null&&Oi(t,e),t=bc(t,r.children),t.flags|=4096);return t}return i?(no(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=oi(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=li(c,i,n,null),c.flags|=2):c=oi(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,oc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=_c(n):(i=c.cachePool,i===null?i=_a():(l=ra._currentValue,i=i.parent===l?i:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:i}),r.memoizedState=c,r.childLanes=vc(e,s,n),t.memoizedState=gc,oc(e.child,r)):(W(t),n=e.child,e=n.sibling,n=oi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function bc(e,t){return t=xc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function xc(e,t){return e=ii(22,e,null,t),e.lanes=0,e}function Sc(e,t,n){return Pa(t,e.child,null,n),e=bc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Cc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ki(e.return,t,n)}function wc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Tc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=io.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,R(io,o),tc(e,t,r,n),r=H?vi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cc(e,n,t);else if(e.tag===19)Cc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ao(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),wc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ao(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}wc(t,!0,n,null,a,r);break;case`together`:wc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ec(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Wl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Ji(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,n=oi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=oi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Dc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Yi(e)))}function Oc(e,t,n){switch(t.tag){case 3:se(t,t.stateNode.containerInfo),Wi(t,ra,e.memoizedState.cache),Ri();break;case 27:case 5:le(t);break;case 4:se(t,t.stateNode.containerInfo);break;case 10:Wi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,eo(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(W(t),e=Ec(e,t,n),e===null?null:e.sibling):yc(e,t,n):(W(t),t.flags|=128,null);W(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Ji(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Tc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),R(io,io.current),r)break;return null;case 22:return t.lanes=0,ac(e,t,n,t.pendingProps);case 24:Wi(t,ra,e.memoizedState.cache)}return Ec(e,t,n)}function kc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)$s=!0;else{if(!Dc(e,n)&&!(t.flags&128))return $s=!1,Oc(e,t,n);$s=!!(e.flags&131072)}else $s=!1,H&&t.flags&1048576&&Ti(t,vi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=wa(t.elementType),t.type=e,typeof e==`function`)ai(e)?(r=Us(e,r),t.tag=1,t=mc(null,t,e,r,n)):(t.tag=0,t=fc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===C){t.tag=11,t=nc(null,t,e,r,n);break a}if(i===E){t.tag=14,t=rc(null,t,e,r,n);break a}}throw t=M(e)||e,Error(a(306,t,``))}}return t;case 0:return fc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Us(r,t.pendingProps),mc(e,t,r,i,n);case 3:a:{if(se(t,t.stateNode.containerInfo),e===null)throw Error(a(387));r=t.pendingProps;var o=t.memoizedState;i=o.element,Ra(e,t),Ga(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Wi(t,ra,r),r!==o.cache&&qi(t,[ra],n,!0),Wa(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=hc(e,t,r,n);break a}else if(r!==i){i=mi(Error(a(424)),t),Bi(i),t=hc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Ai=cf(e.firstChild),ki=t,H=!0,ji=null,Mi=!0,n=Fa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ri(),r===i){t=Ec(e,t,n);break a}tc(e,t,r,n)}t=t.child}return t;case 26:return dc(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:H||(n=t.type,e=t.pendingProps,r=Bd(oe.current).createElement(n),r[it]=t,r[at]=e,Pd(r,n,e),_t(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return le(t),e===null&&H&&(r=t.stateNode=ff(t.type,t.pendingProps,oe.current),ki=t,Mi=!0,i=Ai,Zd(t.type)?(lf=i,Ai=cf(r.firstChild)):Ai=i),tc(e,t,t.pendingProps.children,n),dc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&H&&((i=r=Ai)&&(r=tf(r,t.type,t.pendingProps,Mi),r===null?i=!1:(t.stateNode=r,ki=t,Ai=cf(r.firstChild),Mi=!1,i=!0)),i||Pi(t)),le(t),i=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Ud(i,o)?r=null:s!==null&&Ud(i,s)&&(t.flags|=32),t.memoizedState!==null&&(i=yo(e,t,So,null,null,n),Qf._currentValue=i),dc(e,t),tc(e,t,r,n),t.child;case 6:return e===null&&H&&((e=n=Ai)&&(n=nf(n,t.pendingProps,Mi),n===null?e=!1:(t.stateNode=n,ki=t,Ai=null,e=!0)),e||Pi(t)),null;case 13:return yc(e,t,n);case 4:return se(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Pa(t,null,r,n):tc(e,t,r,n),t.child;case 11:return nc(e,t,t.type,t.pendingProps,n);case 7:return tc(e,t,t.pendingProps,n),t.child;case 8:return tc(e,t,t.pendingProps.children,n),t.child;case 12:return tc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Wi(t,t.type,r.value),tc(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Xi(t),i=Zi(i),r=r(i),t.flags|=1,tc(e,t,r,n),t.child;case 14:return rc(e,t,t.type,t.pendingProps,n);case 15:return ic(e,t,t.type,t.pendingProps,n);case 19:return Tc(e,t,n);case 31:return uc(e,t,n);case 22:return ac(e,t,n,t.pendingProps);case 24:return Xi(t),r=Zi(ra),e===null?(i=ha(),i===null&&(i=Il,o=ia(),i.pooledCache=o,o.refCount++,o!==null&&(i.pooledCacheLanes|=n),i=o),t.memoizedState={parent:r,cache:i},La(t),Wi(t,ra,i)):((e.lanes&n)!==0&&(Ra(e,t),Ga(t,null,null,n),Wa()),i=e.memoizedState,o=t.memoizedState,i.parent===r?(r=o.cache,Wi(t,ra,r),r!==i.cache&&qi(t,[ra],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Wi(t,ra,r))),tc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function Ac(e){e.flags|=4}function jc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Su())e.flags|=8192;else throw Ta=xa,ya}else e.flags&=-16777217}function Mc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t))if(Su())e.flags|=8192;else throw Ta=xa,ya}function Nc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ke(),e.lanes|=t,Jl|=t)}function Pc(e,t){if(!H)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Fc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Ic(e,t,n){var r=t.pendingProps;switch(Di(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fc(t),null;case 1:return Fc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Gi(ra),ce(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Li(t)?Ac(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,zi())),Fc(t),null;case 26:var i=t.type,o=t.memoizedState;return e===null?(Ac(t),o===null?(Fc(t),jc(t,i,null,r,n)):(Fc(t),Mc(t,o))):o?o===e.memoizedState?(Fc(t),t.flags&=-16777217):(Ac(t),Fc(t),Mc(t,o)):(e=e.memoizedProps,e!==r&&Ac(t),Fc(t),jc(t,i,e,r,n)),null;case 27:if(ue(t),n=oe.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(!r){if(t.stateNode===null)throw Error(a(166));return Fc(t),null}e=ie.current,Li(t)?Fi(t,e):(e=ff(i,r,n),t.stateNode=e,Ac(t))}return Fc(t),null;case 5:if(ue(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(!r){if(t.stateNode===null)throw Error(a(166));return Fc(t),null}if(o=ie.current,Li(t))Fi(t,o);else{var s=Bd(oe.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}o[it]=t,o[at]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Ac(t)}}return Fc(t),jc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=oe.current,Li(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=ki,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[it]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Pi(t,!0)}else e=Bd(e).createTextNode(r),e[it]=t,t.stateNode=e}return Fc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Li(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[it]=t}else Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),e=!1}else n=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ro(t),t):(ro(t),null);if(t.flags&128)throw Error(a(558))}return Fc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Li(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));i[it]=t}else Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),i=!1}else i=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(ro(t),t):(ro(t),null)}return ro(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Nc(t,t.updateQueue),Fc(t),null);case 4:return ce(),e===null&&xd(t.stateNode.containerInfo),Fc(t),null;case 10:return Gi(t.type),Fc(t),null;case 19:if(L(io),r=t.memoizedState,r===null)return Fc(t),null;if(i=!!(t.flags&128),o=r.rendering,o===null)if(i)Pc(r,!1);else{if(Ul!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ao(e),o!==null){for(t.flags|=128,Pc(r,!1),e=o.updateQueue,t.updateQueue=e,Nc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)si(n,e),n=n.sibling;return R(io,io.current&1|2),H&&wi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ce()>$l&&(t.flags|=128,i=!0,Pc(r,!1),t.lanes=4194304)}else{if(!i)if(e=ao(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Nc(t,e),Pc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!H)return Fc(t),null}else 2*Ce()-r.renderingStartTime>$l&&n!==536870912&&(t.flags|=128,i=!0,Pc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Fc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ce(),e.sibling=null,n=io.current,R(io,i?n&1|2:n&1),H&&wi(t,r.treeForkCount),e);case 22:case 23:return ro(t),Za(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Fc(t),t.subtreeFlags&6&&(t.flags|=8192)):Fc(t),n=t.updateQueue,n!==null&&Nc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&L(ma),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Gi(ra),Fc(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function q(e,t){switch(Di(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gi(ra),ce(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ue(t),null;case 31:if(t.memoizedState!==null){if(ro(t),t.alternate===null)throw Error(a(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ro(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return L(io),null;case 4:return ce(),null;case 10:return Gi(t.type),null;case 22:case 23:return ro(t),Za(),e!==null&&L(ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Gi(ra),null;case 25:return null;default:return null}}function Lc(e,t){switch(Di(t),t.tag){case 3:Gi(ra),ce();break;case 26:case 27:case 5:ue(t);break;case 4:ce();break;case 31:t.memoizedState!==null&&ro(t);break;case 13:ro(t);break;case 19:L(io);break;case 10:Gi(t.type);break;case 22:case 23:ro(t),Za(),e!==null&&L(ma);break;case 24:Gi(ra)}}function Rc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Uu(t,t.return,e)}}function zc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Uu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Uu(t,t.return,e)}}function Bc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{qa(t,n)}catch(t){Uu(e,e.return,t)}}}function Vc(e,t,n){n.props=Us(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Uu(e,t,n)}}function Hc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Uu(e,t,n)}}function Uc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Uu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Uu(e,t,n)}else n.current=null}function Wc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Uu(e,e.return,t)}}function Gc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[at]=t}catch(t){Uu(e,e.return,t)}}function Kc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Kc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Zt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[it]=e,t[at]=n}catch(t){Uu(e,e.return,t)}}var Zc=!1,Qc=!1,$c=!1,el=typeof WeakSet==`function`?WeakSet:Set,tl=null;function nl(e,t){if(e=e.containerInfo,Rd=sp,e=Cr(e),wr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,tl=t;tl!==null;)if(t=tl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,tl=e;else for(;tl!==null;){switch(t=tl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,i=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Us(n.type,i);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Uu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,tl=e;break}tl=t.return}}function rl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:_l(e,n),r&4&&Rc(5,n);break;case 1:if(_l(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Uu(n,n.return,e)}else{var i=Us(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Uu(n,n.return,e)}}r&64&&Bc(n),r&512&&Hc(n,n.return);break;case 3:if(_l(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{qa(e,t)}catch(e){Uu(n,n.return,e)}}break;case 27:t===null&&r&4&&Xc(n);case 26:case 5:_l(e,n),t===null&&r&4&&Wc(n),r&512&&Hc(n,n.return);break;case 12:_l(e,n);break;case 31:_l(e,n),r&4&&cl(e,n);break;case 13:_l(e,n),r&4&&ll(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=qu.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Zc,!r){t=t!==null&&t.memoizedState!==null||Qc,i=Zc;var a=Qc;Zc=r,(Qc=t)&&!a?yl(e,n,!!(n.subtreeFlags&8772)):_l(e,n),Zc=i,Qc=a}break;case 30:break;default:_l(e,n)}}function il(e){var t=e.alternate;t!==null&&(e.alternate=null,il(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ft(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var J=null,al=!1;function ol(e,t,n){for(n=n.child;n!==null;)sl(e,t,n),n=n.sibling}function sl(e,t,n){if(Ne&&typeof Ne.onCommitFiberUnmount==`function`)try{Ne.onCommitFiberUnmount(Me,n)}catch{}switch(n.tag){case 26:Qc||Uc(n,t),ol(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Qc||Uc(n,t);var r=J,i=al;Zd(n.type)&&(J=n.stateNode,al=!1),ol(e,t,n),pf(n.stateNode),J=r,al=i;break;case 5:Qc||Uc(n,t);case 6:if(r=J,i=al,J=null,ol(e,t,n),J=r,al=i,J!==null)if(al)try{(J.nodeType===9?J.body:J.nodeName===`HTML`?J.ownerDocument.body:J).removeChild(n.stateNode)}catch(e){Uu(n,t,e)}else try{J.removeChild(n.stateNode)}catch(e){Uu(n,t,e)}break;case 18:J!==null&&(al?(e=J,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(J,n.stateNode));break;case 4:r=J,i=al,J=n.stateNode.containerInfo,al=!0,ol(e,t,n),J=r,al=i;break;case 0:case 11:case 14:case 15:zc(2,n,t),Qc||zc(4,n,t),ol(e,t,n);break;case 1:Qc||(Uc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Vc(n,t,r)),ol(e,t,n);break;case 21:ol(e,t,n);break;case 22:Qc=(r=Qc)||n.memoizedState!==null,ol(e,t,n),Qc=r;break;default:ol(e,t,n)}}function cl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Uu(t,t.return,e)}}}function ll(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Uu(t,t.return,e)}}function ul(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new el),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new el),t;default:throw Error(a(435,e.tag))}}function dl(e,t){var n=ul(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ju.bind(null,e,t);t.then(r,r)}})}function fl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(Zd(c.type)){J=c.stateNode,al=!1;break a}break;case 5:J=c.stateNode,al=!1;break a;case 3:case 4:J=c.stateNode.containerInfo,al=!0;break a}c=c.return}if(J===null)throw Error(a(160));sl(o,s,i),J=null,al=!1,o=i.alternate,o!==null&&(o.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ml(t,e),t=t.sibling}var pl=null;function ml(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:fl(t,e),hl(e),r&4&&(zc(3,e,e.return),Rc(3,e),zc(5,e,e.return));break;case 1:fl(t,e),hl(e),r&512&&(Qc||n===null||Uc(n,n.return)),r&64&&Zc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=pl;if(fl(t,e),hl(e),r&512&&(Qc||n===null||Uc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;b:switch(r){case`title`:o=i.getElementsByTagName(`title`)[0],(!o||o[dt]||o[it]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=i.createElement(r),i.head.insertBefore(o,i.querySelector(`head > title`))),Pd(o,r,n),o[it]=e,_t(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=i.createElement(r),Pd(o,r,n),i.head.appendChild(o);break;case`meta`:if(s=Vf(`meta`,`content`,i).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=i.createElement(r),Pd(o,r,n),i.head.appendChild(o);break;default:throw Error(a(468,r))}o[it]=e,_t(o),r=o}e.stateNode=r}else Hf(i,e.type,e.stateNode);else e.stateNode=If(i,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Gc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Hf(i,e.type,e.stateNode):If(i,r,e.memoizedProps))}break;case 27:fl(t,e),hl(e),r&512&&(Qc||n===null||Uc(n,n.return)),n!==null&&r&4&&Gc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(fl(t,e),hl(e),r&512&&(Qc||n===null||Uc(n,n.return)),e.flags&32){i=e.stateNode;try{Ut(i,``)}catch(t){Uu(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,Gc(e,i,n===null?i:n.memoizedProps)),r&1024&&($c=!0);break;case 6:if(fl(t,e),hl(e),r&4){if(e.stateNode===null)throw Error(a(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Uu(e,e.return,t)}}break;case 3:if(Bf=null,i=pl,pl=gf(t.containerInfo),fl(t,e),pl=i,hl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Uu(e,e.return,t)}$c&&($c=!1,gl(e));break;case 4:r=pl,pl=gf(e.stateNode.containerInfo),fl(t,e),hl(e),pl=r;break;case 12:fl(t,e),hl(e);break;case 31:fl(t,e),hl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 13:fl(t,e),hl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Zl=Ce()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Zc,d=Qc;if(Zc=u||i,Qc=d||l,fl(t,e),Qc=d,Zc=u,hl(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||Zc||Qc||vl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,i)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Uu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=i?``:l.memoizedProps}catch(e){Uu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;i?$d(m,!0):$d(l.stateNode,!1)}catch(e){Uu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,dl(e,n))));break;case 19:fl(t,e),hl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 30:break;case 21:break;default:fl(t,e),hl(e)}}function hl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Kc(r)){n=r;break}r=r.return}if(n==null)throw Error(a(160));switch(n.tag){case 27:var i=n.stateNode;Yc(e,qc(e),i);break;case 5:var o=n.stateNode;n.flags&32&&(Ut(o,``),n.flags&=-33),Yc(e,qc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Jc(e,qc(e),s);break;default:throw Error(a(161))}}catch(t){Uu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function gl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;gl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function _l(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)rl(e,t.alternate,t),t=t.sibling}function vl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:zc(4,t,t.return),vl(t);break;case 1:Uc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Vc(t,t.return,n),vl(t);break;case 27:pf(t.stateNode);case 26:case 5:Uc(t,t.return),vl(t);break;case 22:t.memoizedState===null&&vl(t);break;case 30:vl(t);break;default:vl(t)}e=e.sibling}}function yl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:yl(i,a,n),Rc(4,a);break;case 1:if(yl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Uu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ka(c[i],s)}catch(e){Uu(r,r.return,e)}}n&&o&64&&Bc(a),Hc(a,a.return);break;case 27:Xc(a);case 26:case 5:yl(i,a,n),n&&r===null&&o&4&&Wc(a),Hc(a,a.return);break;case 12:yl(i,a,n);break;case 31:yl(i,a,n),n&&o&4&&cl(i,a);break;case 13:yl(i,a,n),n&&o&4&&ll(i,a);break;case 22:a.memoizedState===null&&yl(i,a,n),Hc(a,a.return);break;case 30:break;default:yl(i,a,n)}t=t.sibling}}function bl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&aa(n))}function xl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&aa(e))}function Sl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Cl(e,t,n,r),t=t.sibling}function Cl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Sl(e,t,n,r),i&2048&&Rc(9,t);break;case 1:Sl(e,t,n,r);break;case 3:Sl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&aa(e)));break;case 12:if(i&2048){Sl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Uu(t,t.return,e)}}else Sl(e,t,n,r);break;case 31:Sl(e,t,n,r);break;case 13:Sl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Sl(e,t,n,r):(a._visibility|=2,wl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?Sl(e,t,n,r):Tl(e,t),i&2048&&bl(o,t);break;case 24:Sl(e,t,n,r),i&2048&&xl(t.alternate,t);break;default:Sl(e,t,n,r)}}function wl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:wl(a,o,s,c,i),Rc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,wl(a,o,s,c,i)):u._visibility&2?wl(a,o,s,c,i):Tl(a,o),i&&l&2048&&bl(o.alternate,o);break;case 24:wl(a,o,s,c,i),i&&l&2048&&xl(o.alternate,o);break;default:wl(a,o,s,c,i)}t=t.sibling}}function Tl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Tl(n,r),i&2048&&bl(r.alternate,r);break;case 24:Tl(n,r),i&2048&&xl(r.alternate,r);break;default:Tl(n,r)}t=t.sibling}}var El=8192;function Dl(e,t,n){if(e.subtreeFlags&El)for(e=e.child;e!==null;)Ol(e,t,n),e=e.sibling}function Ol(e,t,n){switch(e.tag){case 26:Dl(e,t,n),e.flags&El&&e.memoizedState!==null&&Gf(n,pl,e.memoizedState,e.memoizedProps);break;case 5:Dl(e,t,n);break;case 3:case 4:var r=pl;pl=gf(e.stateNode.containerInfo),Dl(e,t,n),pl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=El,El=16777216,Dl(e,t,n),El=r):Dl(e,t,n));break;default:Dl(e,t,n)}}function kl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Al(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Nl(r,e)}kl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)jl(e),e=e.sibling}function jl(e){switch(e.tag){case 0:case 11:case 15:Al(e),e.flags&2048&&zc(9,e,e.return);break;case 3:Al(e);break;case 12:Al(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ml(e)):Al(e);break;default:Al(e)}}function Ml(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Nl(r,e)}kl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:zc(8,t,t.return),Ml(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ml(t));break;default:Ml(t)}e=e.sibling}}function Nl(e,t){for(;tl!==null;){var n=tl;switch(n.tag){case 0:case 11:case 15:zc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:aa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,tl=r;else a:for(n=e;tl!==null;){r=tl;var i=r.sibling,a=r.return;if(il(r),r===n){tl=null;break a}if(i!==null){i.return=a,tl=i;break a}tl=a}}}var Pl={getCacheForType:function(e){var t=Zi(ra),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Zi(ra).controller.signal}},Fl=typeof WeakMap==`function`?WeakMap:Map,Y=0,Il=null,X=null,Z=0,Ll=0,Rl=null,zl=!1,Bl=!1,Vl=!1,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=null,Q=null,Xl=!1,Zl=0,Ql=0,$l=1/0,eu=null,tu=null,nu=0,ru=null,iu=null,au=0,ou=0,su=null,cu=null,lu=0,uu=null;function du(){return Y&2&&Z!==0?Z&-Z:N.T===null?tt():ud()}function fu(){if(ql===0)if(!(Z&536870912)||H){var e=Be;Be<<=1,!(Be&3932160)&&(Be=262144),ql=e}else ql=536870912;return e=Qa.current,e!==null&&(e.flags|=32),ql}function pu(e,t,n){(e===Il&&(Ll===2||Ll===9)||e.cancelPendingCommit!==null)&&(bu(e,0),_u(e,Z,ql,!1)),Je(e,n),(!(Y&2)||e!==Il)&&(e===Il&&(!(Y&2)&&(Gl|=n),Ul===4&&_u(e,Z,ql,!1)),nd(e))}function mu(e,t,n){if(Y&6)throw Error(a(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||We(e,t),i=r?Ou(e,t):Eu(e,t,!0),o=r;do{if(i===0){Bl&&!r&&_u(e,t,0,!1);break}if(n=e.current.alternate,o&&!gu(n)){i=Eu(e,t,!1),o=!1;continue}if(i===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;i=Yl;var l=c.current.memoizedState.isDehydrated;if(l&&(bu(c,s).flags|=256),s=Eu(c,s,!1),s!==2){if(Vl&&!l){c.errorRecoveryDisabledLanes|=o,Gl|=o,i=4;break a}o=Q,Q=i,o!==null&&(Q===null?Q=o:Q.push.apply(Q,o))}i=s}if(o=!1,i!==2)continue}}if(i===1){bu(e,0),_u(e,t,0,!0);break}a:{switch(r=e,o=i,o){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:_u(r,t,ql,!zl);break a;case 2:Q=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(i=Zl+300-Ce(),10<i)){if(_u(r,t,ql,!zl),Ue(r,0,!0)!==0)break a;au=t,r.timeoutHandle=Kd(hu.bind(null,r,n,Q,eu,Xl,t,ql,Gl,Jl,zl,o,`Throttled`,-0,0),i);break a}hu(r,n,Q,eu,Xl,t,ql,Gl,Jl,zl,o,null,-0,0)}break}while(1);nd(e)}function hu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Zt},Ol(t,a,d);var m=(a&62914560)===a?Zl-Ce():(a&4194048)===a?Ql-Ce():0;if(m=qf(d,m),m!==null){au=a,e.cancelPendingCommit=m(Fu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),_u(e,a,o,!l);return}}Fu(e,t,a,n,r,i,o,s,c)}function gu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!vr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function _u(e,t,n,r){t&=~Kl,t&=~Gl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Fe(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Xe(e,n,t)}function vu(){return Y&6?!0:(rd(0,!1),!1)}function yu(){if(X!==null){if(Ll===0)var e=X.return;else e=X,Ui=Hi=null,To(e),Oa=null,ka=0,e=X;for(;e!==null;)Lc(e.alternate,e),e=e.return;X=null}}function bu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),au=0,yu(),Il=e,X=n=oi(e.current,null),Z=t,Ll=0,Rl=null,zl=!1,Bl=We(e,t),Vl=!1,Jl=ql=Kl=Gl=Wl=Ul=0,Q=Yl=null,Xl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Fe(r),a=1<<i;t|=e[i],r&=~a}return Hl=t,Xr(),n}function xu(e,t){G=null,N.H=Fs,t===va||t===ba?(t=Ea(),Ll=3):t===ya?(t=Ea(),Ll=4):Ll=t===K?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Rl=t,X===null&&(Ul=1,qs(e,mi(t,e.current)))}function Su(){var e=Qa.current;return e===null?!0:(Z&4194048)===Z?$a===null:(Z&62914560)===Z||Z&536870912?e===$a:!1}function Cu(){var e=N.H;return N.H=Fs,e===null?Fs:e}function wu(){var e=N.A;return N.A=Pl,e}function Tu(){Ul=4,zl||(Z&4194048)!==Z&&Qa.current!==null||(Bl=!0),!(Wl&134217727)&&!(Gl&134217727)||Il===null||_u(Il,Z,ql,!1)}function Eu(e,t,n){var r=Y;Y|=2;var i=Cu(),a=wu();(Il!==e||Z!==t)&&(eu=null,bu(e,t)),t=!1;var o=Ul;a:do try{if(Ll!==0&&X!==null){var s=X,c=Rl;switch(Ll){case 8:yu(),o=6;break a;case 3:case 2:case 9:case 6:Qa.current===null&&(t=!0);var l=Ll;if(Ll=0,Rl=null,Mu(e,s,c,l),n&&Bl){o=0;break a}break;default:l=Ll,Ll=0,Rl=null,Mu(e,s,c,l)}}Du(),o=Ul;break}catch(t){xu(e,t)}while(1);return t&&e.shellSuspendCounter++,Ui=Hi=null,Y=r,N.H=i,N.A=a,X===null&&(Il=null,Z=0,Xr()),o}function Du(){for(;X!==null;)Au(X)}function Ou(e,t){var n=Y;Y|=2;var r=Cu(),i=wu();Il!==e||Z!==t?(eu=null,$l=Ce()+500,bu(e,t)):Bl=We(e,t);a:do try{if(Ll!==0&&X!==null){t=X;var o=Rl;b:switch(Ll){case 1:Ll=0,Rl=null,Mu(e,t,o,1);break;case 2:case 9:if(Sa(o)){Ll=0,Rl=null,ju(t);break}t=function(){Ll!==2&&Ll!==9||Il!==e||(Ll=7),nd(e)},o.then(t,t);break a;case 3:Ll=7;break a;case 4:Ll=5;break a;case 7:Sa(o)?(Ll=0,Rl=null,ju(t)):(Ll=0,Rl=null,Mu(e,t,o,7));break;case 5:var s=null;switch(X.tag){case 26:s=X.memoizedState;case 5:case 27:var c=X;if(s?Wf(s):c.stateNode.complete){Ll=0,Rl=null;var l=c.sibling;if(l!==null)X=l;else{var u=c.return;u===null?X=null:(X=u,Nu(u))}break b}}Ll=0,Rl=null,Mu(e,t,o,5);break;case 6:Ll=0,Rl=null,Mu(e,t,o,6);break;case 8:yu(),Ul=6;break a;default:throw Error(a(462))}}ku();break}catch(t){xu(e,t)}while(1);return Ui=Hi=null,N.H=r,N.A=i,Y=n,X===null?(Il=null,Z=0,Xr(),Ul):0}function ku(){for(;X!==null&&!xe();)Au(X)}function Au(e){var t=kc(e.alternate,e,Hl);e.memoizedProps=e.pendingProps,t===null?Nu(e):X=t}function ju(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=pc(n,t,t.pendingProps,t.type,void 0,Z);break;case 11:t=pc(n,t,t.pendingProps,t.type.render,t.ref,Z);break;case 5:To(t);default:Lc(n,t),t=X=si(t,Hl),t=kc(n,t,Hl)}e.memoizedProps=e.pendingProps,t===null?Nu(e):X=t}function Mu(e,t,n,r){Ui=Hi=null,To(t),Oa=null,ka=0;var i=t.return;try{if(Qs(e,i,t,n,Z)){Ul=1,qs(e,mi(n,e.current)),X=null;return}}catch(t){if(i!==null)throw X=i,t;Ul=1,qs(e,mi(n,e.current)),X=null;return}t.flags&32768?(H||r===1?e=!0:Bl||Z&536870912?e=!1:(zl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Qa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Pu(t,e)):Nu(t)}function Nu(e){var t=e;do{if(t.flags&32768){Pu(t,zl);return}e=t.return;var n=Ic(t.alternate,t,Hl);if(n!==null){X=n;return}if(t=t.sibling,t!==null){X=t;return}X=t=e}while(t!==null);Ul===0&&(Ul=5)}function Pu(e,t){do{var n=q(e.alternate,e);if(n!==null){n.flags&=32767,X=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){X=e;return}X=e=n}while(e!==null);Ul=6,X=null}function Fu(e,t,n,r,i,o,s,c,l){e.cancelPendingCommit=null;do Bu();while(nu!==0);if(Y&6)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(o=t.lanes|t.childLanes,o|=Yr,Ye(e,n,o,s,c,l),e===Il&&(X=Il=null,Z=0),iu=t,ru=e,au=n,ou=o,su=i,cu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Yu(De,function(){return Vu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=N.T,N.T=null,i=P.p,P.p=2,s=Y,Y|=4;try{nl(e,t,n)}finally{Y=s,P.p=i,N.T=r}}nu=1,Iu(),Lu(),Ru()}}function Iu(){if(nu===1){nu=0;var e=ru,t=iu,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Y;Y|=4;try{ml(t,e);var a=zd,o=Cr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Sr(s.ownerDocument.documentElement,s)){if(c!==null&&wr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=xr(s,h),v=xr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}sp=!!Rd,zd=Rd=null}finally{Y=i,P.p=r,N.T=n}}e.current=t,nu=2}}function Lu(){if(nu===2){nu=0;var e=ru,t=iu,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Y;Y|=4;try{rl(e,t.alternate,t)}finally{Y=i,P.p=r,N.T=n}}nu=3}}function Ru(){if(nu===4||nu===3){nu=0,Se();var e=ru,t=iu,n=au,r=cu;t.subtreeFlags&10256||t.flags&10256?nu=5:(nu=0,iu=ru=null,zu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(tu=null),et(n),t=t.stateNode,Ne&&typeof Ne.onCommitFiberRoot==`function`)try{Ne.onCommitFiberRoot(Me,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=N.T,i=P.p,P.p=2,N.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{N.T=t,P.p=i}}au&3&&Bu(),nd(e),i=e.pendingLanes,n&261930&&i&42?e===uu?lu++:(lu=0,uu=e):lu=0,rd(0,!1)}}function zu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,aa(t)))}function Bu(){return Iu(),Lu(),Ru(),Vu()}function Vu(){if(nu!==5)return!1;var e=ru,t=ou;ou=0;var n=et(au),r=N.T,i=P.p;try{P.p=32>n?32:n,N.T=null,n=su,su=null;var o=ru,s=au;if(nu=0,iu=ru=null,au=0,Y&6)throw Error(a(331));var c=Y;if(Y|=4,jl(o.current),Cl(o,o.current,s,n),Y=c,rd(0,!1),Ne&&typeof Ne.onPostCommitFiberRoot==`function`)try{Ne.onPostCommitFiberRoot(Me,o)}catch{}return!0}finally{P.p=i,N.T=r,zu(e,t)}}function Hu(e,t,n){t=mi(n,t),t=Ys(e.stateNode,t,2),e=Ba(e,t,2),e!==null&&(Je(e,2),nd(e))}function Uu(e,t,n){if(e.tag===3)Hu(e,e,n);else for(;t!==null;){if(t.tag===3){Hu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(tu===null||!tu.has(r))){e=mi(n,e),n=Xs(2),r=Ba(t,n,2),r!==null&&(Zs(n,r,t,e),Je(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Fl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Vl=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Il===e&&(Z&n)===n&&(Ul===4||Ul===3&&(Z&62914560)===Z&&300>Ce()-Zl?!(Y&2)&&bu(e,0):Kl|=n,Jl===Z&&(Jl=0)),nd(e)}function Ku(e,t){t===0&&(t=Ke()),e=$r(e,t),e!==null&&(Je(e,t),nd(e))}function qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ku(e,n)}function Ju(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),Ku(e,n)}function Yu(e,t){return ye(e,t)}var Xu=null,Zu=null,Qu=!1,$u=!1,ed=!1,td=0;function nd(e){e!==Zu&&e.next===null&&(Zu===null?Xu=Zu=e:Zu=Zu.next=e),$u=!0,Qu||(Qu=!0,ld())}function rd(e,t){if(!ed&&$u){ed=!0;do for(var n=!1,r=Xu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Fe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=Z,a=Ue(r,r===Il?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||We(r,a)||(n=!0,cd(r,a));r=r.next}while(n);ed=!1}}function id(){ad()}function ad(){$u=Qu=!1;var e=0;td!==0&&Gd()&&(e=td);for(var t=Ce(),n=null,r=Xu;r!==null;){var i=r.next,a=od(r,t);a===0?(r.next=null,n===null?Xu=i:n.next=i,i===null&&(Zu=n)):(n=r,(e!==0||a&3)&&($u=!0)),r=i}nu!==0&&nu!==5||rd(e,!1),td!==0&&(td=0)}function od(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Fe(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ge(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Il,n=Z,n=Ue(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Ll===2||Ll===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&be(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||We(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&be(r),et(n)){case 2:case 8:n=Ee;break;case 32:n=De;break;case 268435456:n=ke;break;default:n=De}return r=sd.bind(null,e),n=ye(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&be(r),e.callbackPriority=2,e.callbackNode=null,2}function sd(e,t){if(nu!==0&&nu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Bu()&&e.callbackNode!==n)return null;var r=Z;return r=Ue(e,e===Il?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(mu(e,r,t),od(e,Ce()),e.callbackNode!=null&&e.callbackNode===n?sd.bind(null,e):null)}function cd(e,t){if(Bu())return null;mu(e,t,!0)}function ld(){Yd(function(){Y&6?ye(Te,id):ad()})}function ud(){if(td===0){var e=ca;e===0&&(e=ze,ze<<=1,!(ze&261888)&&(ze=256)),td=e}return td}function dd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Xt(``+e)}function fd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function pd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=dd((i[at]||null).action),o=r.submitter;o&&(t=(t=o[at]||null)?dd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new _n(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(td!==0){var e=o?fd(i,o):new FormData(i);xs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?fd(i,o):new FormData(i),xs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var md=0;md<Wr.length;md++){var hd=Wr[md];Gr(hd.toLowerCase(),`on`+(hd[0].toUpperCase()+hd.slice(1)))}Gr(Ir,`onAnimationEnd`),Gr(Lr,`onAnimationIteration`),Gr(Rr,`onAnimationStart`),Gr(`dblclick`,`onDoubleClick`),Gr(`focusin`,`onFocus`),Gr(`focusout`,`onBlur`),Gr(zr,`onTransitionRun`),Gr(Br,`onTransitionStart`),Gr(Vr,`onTransitionCancel`),Gr(Hr,`onTransitionEnd`),xt(`onMouseEnter`,[`mouseout`,`mouseover`]),xt(`onMouseLeave`,[`mouseout`,`mouseover`]),xt(`onPointerEnter`,[`pointerout`,`pointerover`]),xt(`onPointerLeave`,[`pointerout`,`pointerover`]),bt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),bt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),bt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),bt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),bt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),bt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var gd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),_d=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(gd));function vd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Kr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Kr(e)}i.currentTarget=null,a=c}}}}function $(e,t){var n=t[st];n===void 0&&(n=t[st]=new Set);var r=e+`__bubble`;n.has(r)||(Sd(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),Sd(n,e,r,t)}var bd=`_reactListening`+Math.random().toString(36).slice(2);function xd(e){if(!e[bd]){e[bd]=!0,vt.forEach(function(t){t!==`selectionchange`&&(_d.has(t)||yd(t,!1,e),yd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bd]||(t[bd]=!0,yd(`selectionchange`,!1,t))}}function Sd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!B||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Cd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=pt(s),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){r=a=o;continue a}s=s.parentNode}}r=r.return}an(function(){var r=a,i=$t(n),o=[];a:{var s=Ur.get(e);if(s!==void 0){var l=_n,u=e;switch(e){case`keypress`:if(fn(n)===0)break a;case`keydown`:case`keyup`:l=Fn;break;case`focusin`:u=`focus`,l=En;break;case`focusout`:u=`blur`,l=En;break;case`beforeblur`:case`afterblur`:l=En;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=wn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Tn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Ln;break;case Ir:case Lr:case Rr:l=Dn;break;case Hr:l=Rn;break;case`scroll`:case`scrollend`:l=yn;break;case`wheel`:l=zn;break;case`copy`:case`cut`:case`paste`:l=On;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=In;break;case`toggle`:case`beforetoggle`:l=Bn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=on(m,p),g!=null&&d.push(wd(m,g,h))),f)break;m=m.return}0<d.length&&(s=new l(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,s&&n!==Qt&&(u=n.relatedTarget||n.fromElement)&&(pt(u)||u[ot]))break a;if((l||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?pt(u):null,u!==null&&(f=c(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=wn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=In,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?s:ht(l),h=u==null?s:ht(u),s=new d(g,m+`leave`,l,n,i),s.target=f,s.relatedTarget=h,g=null,pt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Ed,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Dd(o,s,l,d,!1),u!==null&&f!==null&&Dd(o,f,u,d,!0)}}a:{if(s=r?ht(r):window,l=s.nodeName&&s.nodeName.toLowerCase(),l===`select`||l===`input`&&s.type===`file`)var v=or;else if(er(s))if(sr)v=gr;else{v=mr;var y=pr}else l=s.nodeName,!l||l.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&qt(r.elementType)&&(v=or):v=hr;if(v&&=v(e,r)){tr(o,v,n,i);break a}y&&y(e,s,r),e===`focusout`&&r&&s.type===`number`&&r.memoizedProps.value!=null&&zt(s,`number`,s.value)}switch(y=r?ht(r):window,e){case`focusin`:(er(y)||y.contentEditable===`true`)&&(Er=y,Dr=r,Or=null);break;case`focusout`:Or=Dr=Er=null;break;case`mousedown`:kr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:kr=!1,Ar(o,n,i);break;case`selectionchange`:if(Tr)break;case`keydown`:case`keyup`:Ar(o,n,i)}var b;if(Hn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Xn?Jn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Gn&&n.locale!==`ko`&&(Xn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Xn&&(b=V()):(ln=i,un=`value`in ln?ln.value:ln.textContent,Xn=!0)),y=Td(r,x),0<y.length&&(x=new kn(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=Yn(n),b!==null&&(x.data=b)))),(b=Wn?Zn(e,n):Qn(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new kn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:y,listeners:x}),y.data=b)),pd(o,e,r,n,i)}vd(o,t)})}function wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Td(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=on(e,n),i!=null&&r.unshift(wd(e,i,a)),i=on(e,t),i!=null&&r.push(wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ed(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=on(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=on(n,a),l!=null&&o.push(wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,`
98
+ `).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,i,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Ut(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Ut(e,``+r);break;case`className`:Dt(e,`class`,r);break;case`tabIndex`:Dt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Dt(e,n,r);break;case`style`:Kt(e,r,o);break;case`data`:if(t!==`object`){Dt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Xt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,i.name,i,null),Md(e,t,`formEncType`,i.formEncType,i,null),Md(e,t,`formMethod`,i.formMethod,i,null),Md(e,t,`formTarget`,i.formTarget,i,null)):(Md(e,t,`encType`,i.encType,i,null),Md(e,t,`method`,i.method,i,null),Md(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Xt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Zt);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Xt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:$(`beforetoggle`,e),$(`toggle`,e),Et(e,`popover`,r);break;case`xlinkActuate`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Et(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Jt.get(n)||n,Et(e,n,r))}}function Nd(e,t,n,r,i,o){switch(n){case`style`:Kt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Ut(e,r):(typeof r==`number`||typeof r==`bigint`)&&Ut(e,``+r);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Zt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!yt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),o=e[at]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,i),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Et(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$(`error`,e),$(`load`,e);var r=!1,i=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:Md(e,t,o,s,n,null)}}i&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:$(`invalid`,e);var c=o=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(a(137,t));break;default:Md(e,t,r,d,n,null)}}Rt(e,o,c,l,u,s,i,!1);return;case`select`:for(i in $(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Md(e,t,i,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Bt(e,!!r,n,!0):Bt(e,!!r,t,!1);return;case`textarea`:for(s in $(`invalid`,e),o=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(a(91));break;default:Md(e,t,s,c,n,null)}Ht(e,r,i,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Md(e,t,l,r,n,null)}return;case`dialog`:$(`beforetoggle`,e),$(`toggle`,e),$(`cancel`,e),$(`close`,e);break;case`iframe`:case`object`:$(`load`,e);break;case`video`:case`audio`:for(r=0;r<gd.length;r++)$(gd[r],e);break;case`image`:$(`error`,e),$(`load`,e);break;case`details`:$(`toggle`,e);break;case`embed`:case`source`:case`link`:$(`error`,e),$(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:Md(e,t,u,r,n,null)}return;default:if(qt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Md(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(a(137,t));break;default:m!==f&&Md(e,t,p,m,r,f)}}Lt(e,s,c,l,u,d,o,i);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Md(e,t,o,null,r,l)}for(i in r)if(o=r[i],l=n[i],r.hasOwnProperty(i)&&(o!=null||l!=null))switch(i){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Md(e,t,i,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Bt(e,!!n,n?[]:``,!1):Bt(e,!!n,t,!0)):Bt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Md(e,t,c,null,r,i)}for(s in r)if(i=r[s],o=n[s],r.hasOwnProperty(s)&&(i!=null||o!=null))switch(s){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(a(91));break;default:i!==o&&Md(e,t,s,i,r,o)}Vt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Md(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Md(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Md(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(a(137,t));break;default:Md(e,t,u,p,r,m)}return;default:if(qt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e!==Wd&&(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[dt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body);n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),ft(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[dt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(a(452));return e;case`head`:if(e=t.head,!e)throw Error(a(453));return e;case`body`:if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ft(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=P.d;P.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=vu();return e||t}function yf(e){var t=mt(e);t!==null&&t.tag===5&&t.type===`form`?Cs(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=It(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),_t(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+It(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+It(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+It(n.imageSizes)+`"]`)):i+=`[href="`+It(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),_t(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+It(r)+`"][href="`+It(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),_t(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=gt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);_t(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=gt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=m({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),_t(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=gt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),_t(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=oe.current)?gf(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=gt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=gt(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(i,e,n,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=gt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Af(e){return`href="`+It(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),_t(t),e.head.appendChild(t))}function Pf(e){return`[src="`+It(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+It(n.href)+`"]`);if(r)return t.instance=r,_t(r),r;var i=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),_t(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var o=e.querySelector(jf(i));if(o)return t.state.loading|=4,t.instance=o,_t(o),o;r=Mf(n),(i=mf.get(i))&&Rf(r,i),o=(e.ownerDocument||e).createElement(`link`),_t(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(i=e.querySelector(Ff(o)))?(t.instance=i,_t(i),i):(r=n,(i=mf.get(o))&&(r=m({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),_t(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[dt]||a[it]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,_t(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),_t(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:S,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=qe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qe(0),this.hiddenUpdates=qe(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ii(3,null,null,t),e.current=a,a.stateNode=e,t=ia(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},La(a),e}function tp(e){return e?(e=ni,e):ni}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=za(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ba(e,r,t),n!==null&&(pu(n,e,t),Va(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=$r(e,67108864);t!==null&&pu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=du();t=$e(t);var n=$r(e,t);n!==null&&pu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=2,up(e,t,n,r)}finally{P.p=a,N.T=i}}function lp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=8,up(e,t,n,r)}finally{P.p=a,N.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=mt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=He(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Fe(o);s.entanglements[1]|=c,o&=~c}nd(a),!(Y&6)&&($l=Ce()+500,rd(0,!1))}}break;case 31:case 13:s=$r(a,2),s!==null&&pu(s,a,2),vu(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=$t(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=pt(e),e!==null){var t=c(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=l(t),e!==null)return e;e=null}else if(n===31){if(e=u(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(we()){case Te:return 2;case Ee:return 8;case De:case Oe:return 32;case ke:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=mt(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=pt(e.target);if(t!==null){var n=c(t);if(n!==null){if(t=n.tag,t===13){if(t=l(n),t!==null){e.blockedOn=t,nt(e.priority,function(){op(n)});return}}else if(t===31){if(t=u(n),t!==null){e.blockedOn=t,nt(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Qt=r,n.target.dispatchEvent(r),Qt=null}else return t=mt(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=mt(n);a!==null&&(e.splice(t,3),t-=3,xs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[at]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[at]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var n=t.current;np(n,du(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),vu(),t[ot]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=tt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.8`)throw Error(a(527,Lp,`19.2.8`));P.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(a(188)):(e=Object.keys(e).join(`,`),Error(a(268,e)));return e=f(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:N,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Me=zp.inject(Rp),Ne=zp}catch{}}e.createRoot=function(e,t){if(!s(e))throw Error(a(299));var n=!1,r=``,i=Ws,o=Gs,c=Ks;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(o=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,i,o,c,Pp),e[ot]=t.current,xd(e),new Fp(t)},e.hydrateRoot=function(e,t,n){if(!s(e))throw Error(a(299));var r=!1,i=``,o=Ws,c=Gs,l=Ks,u=null;return n!=null&&(!0===n.unstable_strictMode&&(r=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onUncaughtError!==void 0&&(o=n.onUncaughtError),n.onCaughtError!==void 0&&(c=n.onCaughtError),n.onRecoverableError!==void 0&&(l=n.onRecoverableError),n.formState!==void 0&&(u=n.formState)),t=ep(e,1,!0,t,n??null,r,i,u,o,c,l,Pp),t.context=tp(null),n=t.current,r=du(),r=$e(r),i=za(r),i.callback=null,Ba(n,i,r),n=r,t.current.lanes=n,Je(t,n),nd(t),e[ot]=t.current,xd(e),new Ip(t)}})),nc=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=tc()})),rc=t(o(),1),ic=nc(),ac=(0,B.createContext)(null);ac.displayName=`InertiaHeadContext`;var oc=ac,sc=as();function cc(){sc.reset()}var lc=(0,B.createContext)(null);lc.displayName=`InertiaPageContext`;var uc=lc;function dc(e){return typeof e==`function`||typeof e==`object`&&!!e&&`$$typeof`in e}function fc(e){if(typeof e!=`function`)return!1;let t=e;return t.length===1&&t.prototype===void 0}function pc(e){return typeof e==`function`&&e.length<=1&&e.prototype===void 0}var mc=!0,hc=!1,gc=async()=>{mc=!1},_c={shared:{},named:{}};function vc({children:e,initialPage:t,initialComponent:n,resolveComponent:r,titleCallback:i,onHeadUpdate:a,defaultLayout:o,serverHead:s}){let[c,l]=(0,B.useState)({component:n||null,page:{...t,flash:t.flash??{}},key:null}),u=(0,B.useRef)(c.page);u.current=c.page;let d=(0,B.useMemo)(()=>Wo(typeof window>`u`,e=>i?i(e,u.current):e,a||(()=>{}),Ho(t,s)),[]),f=(0,B.useSyncExternalStore)(sc.subscribe,sc.get,()=>_c);if(hc||=(K.init({initialPage:t,resolveComponent:r,swapComponent:async e=>gc(e),onFlash:e=>{l(t=>({...t,page:{...t.page,flash:e}}))}}),!0),(0,B.useEffect)(()=>{gc=async({component:e,page:t,preserveState:n})=>{if(mc){mc=!1;return}n||cc(),(0,rc.flushSync)(()=>l(r=>({component:e,page:t,key:n?r.key:Date.now()})))};let e=e=>{d.updateServerHead(Ho(e.detail.page,s))},t=K.on(`navigate`,e),n=K.on(`clientVisit`,e);return()=>{t(),n()}},[]),!c.component)return(0,B.createElement)(oc.Provider,{value:d},(0,B.createElement)(uc.Provider,{value:c.page},null));let p=e||(({Component:e,props:t,key:n})=>{let r=(0,B.createElement)(e,{key:n,...t}),i,a=null,s=e.layout;if(pc(s)){let e=s(t);if((0,B.isValidElement)(e))return s(r);ds(e,dc)?(i=o?.(c.page.component,c.page),a=e):i=e}else us(s,dc)?(i=o?.(c.page.component,c.page),a=s):i=s??o?.(c.page.component,c.page);let l=ms(i,dc,s&&!a?fc:void 0);return a&&(l=l.map(e=>({...e,props:{...e.props,...a}}))),l.length>0?l.reduceRight((e,n)=>(0,B.createElement)(n.component,{...t,...n.props,...f.shared,...n.name&&f.named[n.name]||{}},e),r):r});return(0,B.createElement)(oc.Provider,{value:d},(0,B.createElement)(uc.Provider,{value:c.page},p({Component:c.component,key:c.key,props:c.page.props})))}vc.displayName=`Inertia`;async function yc({id:e=`app`,resolve:t,setup:n,title:r,progress:i={},page:a,render:o,defaults:s={},nonce:c,http:l,layout:u,serverHead:d,strictMode:f=!1,withApp:p,dev:m=!1}={}){Ic.replace(s),c&&Ic.set(`nonce`,c),l&&bo.setClient(l),m&&So();let h=typeof window>`u`,g=e=>f?(0,B.createElement)(B.StrictMode,null,e):e,_=(e,n)=>Promise.resolve(t(e,n)).then(e=>e.default||e);if(h&&!a&&!o)return async(t,i)=>{let a=[],o={initialPage:t,initialComponent:await _(t.component,t),resolveComponent:_,titleCallback:r,onHeadUpdate:e=>a=e,defaultLayout:u,serverHead:d},s;n?s=n({el:null,App:vc,props:o}):(s=g((0,B.createElement)(vc,o)),p&&(s=p(s,{ssr:!0,page:t})));let c=Qs(e,t,i(s));return{head:a,body:c}};let v=a||ba(e),y=[],b=await Promise.all([_(v.component,v),K.decryptHistory().catch(()=>{})]).then(([t])=>{let i={initialPage:v,initialComponent:t,resolveComponent:_,titleCallback:r,onHeadUpdate:h?e=>y=e:void 0,defaultLayout:u,serverHead:d};if(h)return n({el:null,App:vc,props:i});let a=document.getElementById(e);if(n)return n({el:a,App:vc,props:i});let o=g((0,B.createElement)(vc,i));p&&(o=p(o,{ssr:!1,page:v})),a.hasAttribute(`data-server-rendered`)?(0,ic.hydrateRoot)(a,o):(0,ic.createRoot)(a).render(o)});if(!h&&i&&Ws(i),h&&o&&b){let t=Qs(e,v,o(b));return{head:y,body:t}}}function bc(){let e=(0,B.use)(uc);if(!e)throw Error(`usePage must be used within the Inertia component`);return e}function xc(e){let{data:t,useDataState:n,useErrorsState:r}=e,i=typeof t==`function`,a=()=>i?t():t,o=cr(a()),s=(0,B.useRef)(!1),c=(0,B.useRef)(e.precognitionEndpoint??null),[l,u]=(0,B.useState)(cr(o)),[d,f]=n?n():(0,B.useState)(cr(o)),[p,m]=r?r():(0,B.useState)({}),[h,g]=(0,B.useState)(!1),[_,v]=(0,B.useState)(null),[y,b]=(0,B.useState)(!1),[x,S]=(0,B.useState)(!1),C=(0,B.useRef)(void 0),w=(0,B.useRef)(e=>e),T=(0,B.useRef)(!1),E=(0,B.useRef)(null),[D,O]=(0,B.useState)(!1),[k,ee]=(0,B.useState)([]),[A,j]=(0,B.useState)([]),M=(0,B.useRef)(null),te=()=>M.current??Ic.get(`form.withAllErrors`),N=(0,B.useRef)(d);(0,B.useEffect)(()=>{N.current=d}),(0,B.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let P=(0,B.useCallback)(e=>{N.current=e,f(e)},[f]),F=(0,B.useCallback)((e,t)=>{P(typeof e==`string`?Wr(cr(N.current),e,t):typeof e==`function`?e(N.current):e)},[P]),ne=(0,B.useCallback)((e,t)=>{if(i)throw Error("You cannot call `defaults()` when using a function to define your form data.");T.current=!0;let n={};e===void 0?(n={...N.current},u(N.current)):u(r=>(n=typeof e==`string`?Wr(cr(r),e,t):Object.assign(cr(r),e),n)),E.current?.defaults(n)},[u]),I=(0,B.useCallback)((...e)=>{let t=cr(i?cr(a()):l);if(e.length===0)i&&u(t),P(t);else{i&&u(n=>{let r=cr(n);return e.filter(e=>Pr(t,e)).forEach(e=>{Wr(r,e,Er(t,e))}),r});let n=e.filter(e=>Pr(t,e)).reduce((e,n)=>Wr(e,n,Er(t,n)),{...N.current});P(n)}E.current?.reset(...e)},[P,l]),re=(0,B.useCallback)((e,t)=>{m(n=>{let r={...n,...typeof e==`string`?{[e]:t}:e};return E.current?.setErrors(r),r})},[m]),L=(0,B.useCallback)((...e)=>{m(t=>{let n=Object.keys(t).reduce((n,r)=>({...n,...e.length>0&&!e.includes(r)?{[r]:t[r]}:{}}),{});return E.current&&(e.length===0?E.current.setErrors({}):e.forEach(E.current.forgetError)),n})},[m]),R=(0,B.useCallback)((...e)=>{I(...e),L(...e)},[I,L]),ie=(0,B.useCallback)(()=>{L(),b(!0),S(!0),C.current=window.setTimeout(()=>{s.current&&S(!1)},Ic.get(`form.recentlySuccessfulDuration`))},[L,b,S]),ae=(0,B.useCallback)(()=>{b(!1),S(!1),clearTimeout(C.current)},[b,S]),oe=(0,B.useCallback)(()=>{g(!1),v(null)},[g,v]),z=(0,B.useCallback)(e=>{w.current=e},[]),se=(e,t)=>(t(e),e),ce=(0,B.useCallback)(e=>A.includes(e),[A]),le=(0,B.useCallback)(e=>e in p,[p]),ue=(0,B.useCallback)(e=>typeof e==`string`?k.includes(e):k.length>0,[k]),de={data:d,isDirty:!gr(d,l),errors:p,hasErrors:Object.keys(p).length>0,processing:h,progress:_,wasSuccessful:y,recentlySuccessful:x,setData:F,transform:z,setDefaults:ne,reset:I,setError:re,clearErrors:L,resetAndClearErrors:R},fe=(e,t)=>{if(typeof e==`object`&&!(`target`in e)&&(t=e,e=void 0),e===void 0)E.current.validate(t);else{let n=Ni(e),r=w.current(N.current);E.current.validate(n,Er(r,n),t)}return de};return de.withPrecognition=(...e)=>{if(c.current=No.createWayfinderCallback(...e),!E.current){let e=H(e=>{let{method:t,url:n}=c.current(),r=N.current,i=w.current(r);return e[t](n,i)},cr(l));E.current=e,e.on(`validatingChanged`,()=>{O(e.validating())}).on(`validatedChanged`,()=>{j(e.valid())}).on(`touchedChanged`,()=>{ee(e.touched())}).on(`errorsChanged`,()=>{let t=te()?e.errors():ji(e.errors());m(t),j(e.valid())})}let t=Object.assign(de,{validating:D,validator:()=>E.current,valid:ce,invalid:le,touched:ue,withoutFileValidation:()=>se(t,()=>E.current?.withoutFileValidation()),touch:(e,...n)=>(Array.isArray(e)?E.current?.touch(e):typeof e==`string`?E.current?.touch([e,...n]):E.current?.touch(e),t),withAllErrors:()=>se(t,()=>M.current=!0),setValidationTimeout:e=>se(t,()=>E.current?.setTimeout(e)),validateFiles:()=>se(t,()=>E.current?.validateFiles()),validate:fe,setErrors:e=>se(t,()=>de.setError(e)),forgetError:e=>se(t,()=>de.clearErrors(Ni(e)))});return t},c.current&&de.withPrecognition(c.current),{form:de,setDefaultsState:u,transformRef:w,precognitionEndpointRef:c,dataRef:N,isMounted:s,setProcessing:g,setProgress:v,markAsSuccessful:ie,clearErrors:L,setError:re,defaultsCalledInOnSuccessRef:T,resetBeforeSubmit:ae,finishProcessing:oe,withAllErrors:{enabled:te,enable:()=>{M.current=!0}}}}function Sc(e,t,n){let[r,i]=(0,B.useState)(()=>{let n=K.restore(t);return n===void 0?e:n});return(0,B.useEffect)(()=>{let e=n?.current;if(e&&e.length>0&&typeof r==`object`&&r){let n={...r};e.forEach(e=>delete n[e]),K.remember(n,t)}else K.remember(r,t)},[r,t]),[r,i]}function Cc(...e){let{rememberKey:t,data:n,precognitionEndpoint:r}=No.parseUseFormArguments(...e),i=cr(typeof n==`function`?n():n),a=(0,B.useRef)(null),o=(0,B.useRef)([]),s=(0,B.useRef)(null),{form:c,setDefaultsState:l,transformRef:u,precognitionEndpointRef:d,dataRef:f,isMounted:p,setProcessing:m,setProgress:h,markAsSuccessful:g,clearErrors:_,setError:v,defaultsCalledInOnSuccessRef:y,resetBeforeSubmit:b,finishProcessing:x}=xc({data:n,precognitionEndpoint:r,useDataState:t?()=>Sc(i,`${t}:data`,o):void 0,useErrorsState:t?()=>Sc({},`${t}:errors`):void 0}),S=(0,B.useCallback)((...e)=>{let{method:t,url:n,options:r}=No.parseSubmitArguments(e,d.current);y.current=!1;let i={...r,onCancelToken:e=>(a.current=e,r.onCancelToken?.(e)),onBefore:e=>(b(),r.onBefore?.(e)),onStart:e=>(m(!0),r.onStart?.(e)),onProgress:e=>(h(e||null),r.onProgress?.(e)),onSuccess:async e=>{p.current&&g();let t=r.onSuccess?await r.onSuccess(e):null;return p.current&&!y.current&&c.setData(e=>(l(cr(e)),e)),t},onError:e=>(p.current&&(_(),v(e)),r.onError?.(e)),onCancel:()=>r.onCancel?.(),onFinish:e=>(p.current&&x(),a.current=null,r.onFinish?.(e))};i.optimistic=i.optimistic??s.current??void 0,s.current=null;let o=u.current(f.current);t===`delete`?K.delete(n,{...i,data:o}):K[t](n,o,i)},[_,v,u]),C=(0,B.useCallback)(()=>{a.current&&a.current.cancel()},[]),w=(0,B.useMemo)(()=>({get:(e,t={})=>S(`get`,e,t),post:(e,t={})=>S(`post`,e,t),put:(e,t={})=>S(`put`,e,t),patch:(e,t={})=>S(`patch`,e,t),delete:(e,t={})=>S(`delete`,e,t)}),[S]);Object.assign(c,{submit:S,...w,cancel:C,dontRemember:(...e)=>(o.current=e,T),optimistic:e=>(s.current=e,T)});let T=c,E=c.withPrecognition;return T.withPrecognition=(...e)=>(E(...e),T),d.current,T}var wc=e=>{typeof B.startTransition==`function`?B.startTransition(e):setTimeout(e,0)},Tc=()=>void 0,Ec=(0,B.createContext)(void 0),Dc=(0,B.forwardRef)(({action:e=``,method:t=`get`,headers:n={},queryStringArrayFormat:r=`brackets`,errorBag:i=null,showProgress:a=!0,transform:o=e=>e,optimistic:s,options:c={},onStart:l=Tc,onProgress:u=Tc,onFinish:d=Tc,onBefore:f=Tc,onCancel:p=Tc,onSuccess:m=Tc,onError:h=Tc,onCancelToken:g=Tc,onSubmitComplete:_=Tc,disableWhileProcessing:v=!1,resetOnError:y=!1,resetOnSuccess:b=!1,setDefaultsOnSuccess:x=!1,invalidateCacheTags:S=[],validateFiles:C=!1,validationTimeout:w=1500,withAllErrors:T=null,component:E=null,instant:D=!1,children:O,...k},ee)=>{let A=()=>{let[e,t]=L();return o(t)},j=Cc({}).withPrecognition(()=>te,()=>L()[0]).setValidationTimeout(w);C&&j.validateFiles(),(T??Fi.get(`form.withAllErrors`))&&j.withAllErrors(),j.transform(A);let M=(0,B.useRef)(void 0),te=(0,B.useMemo)(()=>Ga(e)?e.method:t.toLowerCase(),[e,t]),N=(0,B.useMemo)(()=>E||(D&&Ga(e)?Ka(e):null),[E,D,e]),[P,F]=(0,B.useState)(!1),ne=(0,B.useRef)(new FormData),I=e=>new FormData(M.current,e),re=e=>zo(I(e)),L=t=>Ba(te,Ga(e)?e.url:e,re(t),r),R=e=>{e.type===`reset`&&e.detail?.[Gs]&&e.preventDefault(),wc(()=>F(e.type!==`reset`&&!gr(re(),zo(ne.current))))},ie=(...e)=>(j.clearErrors(...e),j);(0,B.useEffect)(()=>{ne.current=I(),j.setDefaults(re());let e=[`input`,`change`,`reset`];return e.forEach(e=>M.current.addEventListener(e,R)),()=>{e.forEach(e=>M.current?.removeEventListener(e,R))}},[]),(0,B.useEffect)(()=>{j.setValidationTimeout(w)},[w]),(0,B.useEffect)(()=>{C?j.validateFiles():j.withoutFileValidation()},[C]);let ae=(...e)=>{M.current&&Zs(M.current,ne.current,e),j.reset(...e)},oe=(...e)=>{ie(...e),ae(...e)},z=e=>{e&&(e===!0?ae():e.length>0&&ae(...e))},se=e=>{let[t,v]=L(e);if(e?.getAttribute(`formtarget`)===`_blank`&&te===`get`){window.open(t,`_blank`);return}let C={headers:n,queryStringArrayFormat:r,errorBag:i,showProgress:a,invalidateCacheTags:S,component:N,optimistic:s?e=>s(e,v):void 0,onCancelToken:g,onBefore:f,onStart:l,onProgress:u,onFinish:d,onCancel:p,onSuccess:async(...e)=>{let t=await m(...e);return _({reset:ae,defaults:ce}),z(b),x===!0&&ce(),t},onError(...e){h(...e),z(y)},...c};j.transform(()=>o(v)),j.submit(te,t,C),j.transform(A)},ce=()=>{ne.current=I(),F(!1)},le={errors:j.errors,hasErrors:j.hasErrors,processing:j.processing,progress:j.progress,wasSuccessful:j.wasSuccessful,recentlySuccessful:j.recentlySuccessful,isDirty:P,clearErrors:ie,resetAndClearErrors:oe,setError:j.setError,reset:ae,submit:se,defaults:ce,getData:re,getFormData:I,validator:()=>j.validator(),validating:j.validating,valid:j.valid,invalid:j.invalid,validate:(e,t)=>j.validate(...No.mergeHeadersForValidation(e,t,n)),touch:j.touch,touched:j.touched};(0,B.useImperativeHandle)(ee,()=>le,[j,P,se]);let ue=(0,B.createElement)(`form`,{...k,ref:M,action:Ga(e)?e.url:e,method:te,onSubmit:e=>{e.preventDefault(),se(e.nativeEvent.submitter)},inert:v&&j.processing},typeof O==`function`?O(le):O);return(0,B.createElement)(Ec.Provider,{value:le},ue)});Dc.displayName=`InertiaForm`;var Oc=Dc,kc=function({children:e,title:t}){let n=(0,B.use)(oc),r=(0,B.useMemo)(()=>n.createProvider(),[n]),i=typeof window>`u`;(0,B.useEffect)(()=>(r.reconnect(),r.update(d(e)),()=>{r.disconnect()}),[r,e,t]);function a(e){return typeof e.type==`string`&&[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`].indexOf(e.type)>-1}function o(e){let t=Object.keys(e.props).reduce((t,n)=>{if([`head-key`,`children`,`dangerouslySetInnerHTML`].includes(n))return t;let r=String(e.props[n]);return r===``?t+` ${n}`:t+` ${n}="${Yr(r)}"`},``);return`<${String(e.type)}${t}>`}function s(e){let{children:t}=e.props;return typeof t==`string`?t:Array.isArray(t)?t.reduce((e,t)=>e+c(t),``):``}function c(e){let t=o(e);return e.props.children&&(t+=s(e)),e.props.dangerouslySetInnerHTML&&(t+=e.props.dangerouslySetInnerHTML.__html),a(e)||(t+=`</${String(e.type)}>`),t}function l(e){return B.cloneElement(e,{"data-inertia":e.props[`head-key`]===void 0?``:e.props[`head-key`]})}function u(e){return c(l(e))}function d(e){let n=B.Children.toArray(e).filter(e=>e).map(e=>u(e));return t&&!n.find(e=>e.startsWith(`<title`))&&n.push(`<title data-inertia="">${Yr(t)}</title>`),n}return i&&r.update(d(e)),null},Ac=(e,t)=>e?e&&typeof e==`object`&&`current`in e?e.current:typeof e==`string`?document.querySelector(e):t:t,jc=(e,t,n=null)=>e?typeof e==`function`?e(t):e:n,Mc=(0,B.forwardRef)(({data:e,buffer:t=0,as:n=`div`,manual:r=!1,manualAfter:i=0,preserveUrl:a=!1,reverse:o=!1,autoScroll:s,children:c,startElement:l,endElement:u,itemsElement:d,previous:f,next:p,loading:m,params:h={},onlyNext:g=!1,onlyPrevious:_=!1,...v},y)=>{let[b,x]=(0,B.useState)(null),S=(0,B.useCallback)(e=>x(e),[]),[C,w]=(0,B.useState)(null),T=(0,B.useCallback)(e=>w(e),[]),[E,D]=(0,B.useState)(null),O=(0,B.useCallback)(e=>D(e),[]),k=bc().scrollProps?.[e],[ee,A]=(0,B.useState)(!1),[j,M]=(0,B.useState)(!1),[te,N]=(0,B.useState)(0),[P,F]=(0,B.useState)(!!k?.previousPage),[ne,I]=(0,B.useState)(!!k?.nextPage),[re,L]=(0,B.useState)(null),[R,ie]=(0,B.useState)(null),[ae,oe]=(0,B.useState)(null);(0,B.useEffect)(()=>{let e=l?Ac(l,b):b;L(e)},[l,b]),(0,B.useEffect)(()=>{let e=u?Ac(u,C):C;ie(e)},[u,C]),(0,B.useEffect)(()=>{let e=d?Ac(d,E):E;oe(e)},[d,E]);let z=(0,B.useMemo)(()=>_a(ae),[ae]),se=(0,B.useRef)({buffer:t,onlyNext:g,onlyPrevious:_,reverse:o,preserveUrl:a,params:h});se.current={buffer:t,onlyNext:g,onlyPrevious:_,reverse:o,preserveUrl:a,params:h};let[ce,le]=(0,B.useState)(null),ue=(0,B.useMemo)(()=>ce?.dataManager,[ce]),de=(0,B.useMemo)(()=>ce?.elementManager,[ce]),fe=(0,B.useCallback)(()=>{z?z.scrollTo({top:z.scrollHeight,behavior:`instant`}):window.scrollTo({top:document.body.scrollHeight,behavior:`instant`})},[z]);(0,B.useEffect)(()=>{if(!ae)return;function t(){N(n.dataManager.getRequestCount()),F(n.dataManager.hasPrevious()),I(n.dataManager.hasNext())}let n=is({getPropName:()=>e,inReverseMode:()=>se.current.reverse,shouldFetchNext:()=>!se.current.onlyPrevious,shouldFetchPrevious:()=>!se.current.onlyNext,shouldPreserveUrl:()=>se.current.preserveUrl,getReloadOptions:()=>se.current.params,getTriggerMargin:()=>se.current.buffer,getStartElement:()=>re,getEndElement:()=>R,getItemsElement:()=>ae,getScrollableParent:()=>z,onBeforePreviousRequest:()=>A(!0),onBeforeNextRequest:()=>M(!0),onCompletePreviousRequest:({completed:e})=>{A(!1),e&&t()},onCompleteNextRequest:({completed:e})=>{M(!1),e&&t()},onDataReset:t});le(n);let{dataManager:r,elementManager:i}=n;return t(),i.setupObservers(),i.processServerLoadedElements(r.getLastLoadedPage()),me&&i.enableTriggers(),()=>{n.flush(),le(null)}},[e,ae,re,R,z]);let pe=(0,B.useMemo)(()=>r||i>0&&te>=i,[r,i,te]),me=(0,B.useMemo)(()=>!pe,[pe]);(0,B.useEffect)(()=>{me?de?.enableTriggers():de?.disableTriggers()},[me,g,_,re,R]),(0,B.useEffect)(()=>{(s===void 0?o:s)&&fe()},[z]),(0,B.useImperativeHandle)(y,()=>({fetchNext:ue?.fetchNext||(()=>{}),fetchPrevious:ue?.fetchPrevious||(()=>{}),hasPrevious:ue?.hasPrevious||(()=>!1),hasNext:ue?.hasNext||(()=>!1)}),[ue]);let he=me&&!g,ge=me&&!_,_e={loadingPrevious:ee,loadingNext:j,hasPrevious:P,hasNext:ne},ve={loading:ee,fetch:ue?.fetchPrevious??(()=>{}),autoMode:he,manualMode:!he,hasMore:P,..._e},ye={loading:j,fetch:ue?.fetchNext??(()=>{}),autoMode:ge,manualMode:!ge,hasMore:ne,..._e},be={loading:ee||j,loadingPrevious:ee,loadingNext:j},xe=[];return l||xe.push((0,B.createElement)(`div`,{ref:S},jc(f,ve,ee?jc(m,ve):null))),xe.push((0,B.createElement)(n,{...v,ref:O},typeof c==`function`?c(be):c)),u||xe.push((0,B.createElement)(`div`,{ref:T},jc(p,ye,j?jc(m,ye):null))),(0,B.createElement)(B.Fragment,{},...o?[...xe].reverse():xe)});Mc.displayName=`InertiaInfiniteScroll`;var Nc=()=>void 0,Pc=(0,B.forwardRef)(({children:e,as:t=`a`,data:n={},href:r=``,method:i=`get`,preserveScroll:a=!1,preserveState:o=null,preserveUrl:s=!1,replace:c=!1,only:l=[],except:u=[],headers:d={},queryStringArrayFormat:f=`brackets`,async:p=!1,onClick:m=Nc,onCancelToken:h=Nc,onBefore:g=Nc,onStart:_=Nc,onProgress:v=Nc,onFinish:y=Nc,onCancel:b=Nc,onSuccess:x=Nc,onError:S=Nc,onPrefetching:C=Nc,onPrefetched:w=Nc,prefetch:T=!1,cacheFor:E=0,cacheTags:D=[],viewTransition:O=!1,component:k=null,instant:ee=!1,pageProps:A=null,...j},M)=>{let[te,N]=(0,B.useState)(0),P=(0,B.useRef)(void 0),F=(0,B.useMemo)(()=>Ga(r)?r.method:i.toLowerCase(),[r,i]),ne=(0,B.useMemo)(()=>k||(ee&&Ga(r)?Ka(r):null),[k,ee,r]),I=(0,B.useMemo)(()=>typeof t!=`string`||t.toLowerCase()!==`a`?t:F===`get`?t.toLowerCase():`button`,[t,F]),re=(0,B.useMemo)(()=>Ba(F,Ga(r)?r.url:r,n,f),[r,F,n,f]),L=(0,B.useMemo)(()=>re[0],[re]),R=(0,B.useMemo)(()=>re[1],[re]),ie=(0,B.useMemo)(()=>({data:R,method:F,preserveScroll:a,preserveState:o??F!==`get`,preserveUrl:s,replace:c,only:l,except:u,headers:d,async:p,component:ne,pageProps:A}),[R,F,a,o,s,c,l,u,d,p,ne,A]),ae=(0,B.useMemo)(()=>({...ie,viewTransition:O,onCancelToken:h,onBefore:g,onStart(e){N(e=>e+1),_(e)},onProgress:v,onFinish(e){N(e=>e-1),y(e)},onCancel:b,onSuccess:x,onError:S}),[ie,O,h,g,_,v,y,b,x,S]),oe=(0,B.useMemo)(()=>T===!0?[`hover`]:T===!1?[]:Array.isArray(T)?T:[T],Array.isArray(T)?T:[T]),z=(0,B.useMemo)(()=>E===0?oe.length===1&&oe[0]===`click`?0:Ic.get(`prefetch.cacheFor`):E,[E,oe]),se=(0,B.useMemo)(()=>()=>{K.prefetch(L,{...ie,onPrefetching:C,onPrefetched:w},{cacheFor:z,cacheTags:D})},[L,ie,C,w,z,D]);(0,B.useEffect)(()=>()=>{clearTimeout(P.current)},[]),(0,B.useEffect)(()=>{oe.includes(`mount`)&&setTimeout(()=>se())},oe);let ce={onClick:e=>{m(e),gs(e)&&(e.preventDefault(),K.visit(L,ae))}},le={onMouseEnter:()=>{P.current=window.setTimeout(()=>{se()},Ic.get(`prefetch.hoverDelay`))},onMouseLeave:()=>{clearTimeout(P.current)},onClick:ce.onClick},ue={onMouseDown:e=>{gs(e)&&(e.preventDefault(),se())},onKeyDown:e=>{_s(e)&&(e.preventDefault(),se())},onMouseUp:e=>{gs(e)&&(e.preventDefault(),K.visit(L,ae))},onKeyUp:e=>{_s(e)&&(e.preventDefault(),K.visit(L,ae))},onClick:e=>{m(e),gs(e)&&e.preventDefault()}},de=(0,B.useMemo)(()=>I===`button`?{type:`button`}:I===`a`||typeof I!=`string`?{href:L}:{},[I,L]);return(0,B.createElement)(I,{...j,...de,ref:M,...oe.includes(`hover`)?le:oe.includes(`click`)?ue:ce,"data-loading":te>0?``:void 0},e)});Pc.displayName=`InertiaLink`;var Fc=Pc,Ic=Fi.extend(),q=t(f(),1),Lc=`effects`;function Rc(){return p(Lc)}function zc(e,t){return t}function Bc(e){let t=document.createElement(`a`);t.href=e,t.rel=`noopener`,document.body.appendChild(t),t.click(),t.remove()}function Vc(e){return t=>window.dispatchEvent(new CustomEvent(e,{detail:t.props}))}var Hc={"reload-page":()=>window.location.reload(),redirect:e=>window.location.assign(e.props.url),download:e=>Bc(e.props.url),"locale-change":e=>u(e.props.locale),toast:Vc(d.toast),callout:Vc(d.callout),"retract-callout":Vc(d.retractCallout),"reload-component":Vc(d.reloadComponent),"open-modal":Vc(d.openModal),"close-modal":Vc(d.closeModal),"reset-form":Vc(d.resetForm),"toggle-sidebar":Vc(d.toggleSidebar)};function Uc(...e){return Object.assign({},...e)}function Wc({href:e,method:t=`get`,children:n,...r}){return(0,q.jsx)(Fc,{href:e,method:t,...r,children:n})}function Gc(e){return K.on(`navigate`,e)}var Kc={Link:Wc,visit:(e,t)=>K.visit(e,t),reload:()=>K.reload(),onNavigate:Gc};function qc(e){return e.split(/[?#]/,1)[0]??e}function Jc(e){return e===void 0?typeof window>`u`?void 0:window.location.pathname:qc(e)}function Yc(e){let[t,n]=(0,B.useState)(()=>Jc(e));return(0,B.useEffect)(()=>K.on(`navigate`,e=>n(qc(e.detail.page.url))),[]),(0,B.useMemo)(()=>({...Kc,currentUrl:t}),[t])}function Xc(){window.dispatchEvent(new CustomEvent(d.closeModal,{detail:{modal:null}}))}function Zc(){(0,B.useEffect)(()=>K.on(`navigate`,Xc),[])}var Qc={name:`lattice/navigation`,extensions:{effects:{redirect:zc(`redirect`,e=>K.visit(e.props.url)),"reload-page":zc(`reload-page`,e=>e.props.full?window.location.reload():K.reload())}}},$c=(0,B.createContext)([]);function el({children:e,renderer:t}){let n=(0,B.useContext)($c),r=(0,B.useMemo)(()=>[t,...n],[n,t]);return(0,q.jsx)($c.Provider,{value:r,children:e})}function tl({className:e,icon:t}){let n=(0,B.useContext)($c),{ids:r}=w();for(let r of n){let n=r({className:e,icon:t});if(n!=null&&n!==!1)return n}return r&&!r.includes(t)?(0,q.jsx)(nl,{className:e}):(0,q.jsx)(y,{className:e,name:t})}function nl({className:e}){return(0,q.jsxs)(`svg`,{"aria-hidden":`true`,className:x(`size-lt-icon-md text-lt-muted-fg`,e),"data-lattice-missing-icon":``,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,viewBox:`0 0 24 24`,children:[(0,q.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,q.jsx)(`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}),(0,q.jsx)(`path`,{d:`M12 17h.01`})]})}var rl=b(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lt-sm text-base font-medium transition-[color,box-shadow] disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-lt-icon-md [&_svg]:shrink-0 outline-none focus-visible:border-lt-ring focus-visible:ring-lt-ring/50 focus-visible:ring-[length:var(--lt-ring-width)] aria-invalid:ring-lt-danger/20 dark:aria-invalid:ring-lt-danger/40 aria-invalid:border-lt-danger`,{variants:{emphasis:{solid:`shadow-lt-xs disabled:bg-lt-disabled disabled:text-lt-disabled-fg disabled:shadow-none`,outline:`border border-lt-input bg-lt-bg shadow-lt-xs hover:bg-lt-accent hover:text-lt-accent-fg disabled:bg-lt-disabled disabled:text-lt-disabled-fg disabled:border-transparent disabled:shadow-none`,ghost:`hover:bg-lt-accent hover:text-lt-accent-fg disabled:text-lt-disabled-fg`,link:`underline-offset-4 hover:underline disabled:text-lt-disabled-fg disabled:no-underline`},variant:{primary:``,secondary:``,success:``,info:``,warning:``,danger:``},size:{md:`h-lt-control-md px-4 py-2 has-[>svg]:px-3`,sm:`h-lt-control-sm rounded-lt-sm px-3 has-[>svg]:px-2.5`,lg:`h-lt-control-lg rounded-lt-sm px-6 has-[>svg]:px-4`,icon:`size-lt-control-md`}},compoundVariants:[{emphasis:`solid`,variant:`primary`,class:`bg-lt-primary text-lt-primary-fg hover:bg-lt-primary-hover active:bg-lt-primary-active`},{emphasis:`solid`,variant:`secondary`,class:`bg-lt-secondary text-lt-secondary-fg hover:bg-lt-secondary-hover active:bg-lt-secondary-active`},{emphasis:`solid`,variant:`success`,class:`bg-lt-success text-lt-success-fg hover:bg-lt-success-hover active:bg-lt-success-active`},{emphasis:`solid`,variant:`info`,class:`bg-lt-info text-lt-info-fg hover:bg-lt-info-hover active:bg-lt-info-active`},{emphasis:`solid`,variant:`warning`,class:`bg-lt-warning text-lt-warning-fg hover:bg-lt-warning-hover active:bg-lt-warning-active`},{emphasis:`solid`,variant:`danger`,class:`bg-lt-danger text-lt-danger-fg hover:bg-lt-danger-hover active:bg-lt-danger-active focus-visible:ring-lt-danger/20 dark:focus-visible:ring-lt-danger/40`},{emphasis:`outline`,variant:`primary`,class:`border-lt-primary/40 text-lt-primary hover:bg-lt-primary/10 hover:text-lt-primary`},{emphasis:`outline`,variant:`secondary`,class:`border-lt-secondary text-lt-secondary-fg hover:bg-lt-secondary hover:text-lt-secondary-fg`},{emphasis:`outline`,variant:`success`,class:`border-lt-success/40 text-lt-success hover:bg-lt-success/10 hover:text-lt-success`},{emphasis:`outline`,variant:`info`,class:`border-lt-info/40 text-lt-info hover:bg-lt-info/10 hover:text-lt-info`},{emphasis:`outline`,variant:`warning`,class:`border-lt-warning/40 text-lt-warning hover:bg-lt-warning/10 hover:text-lt-warning`},{emphasis:`outline`,variant:`danger`,class:`border-lt-danger/40 text-lt-danger hover:bg-lt-danger/10 hover:text-lt-danger`},{emphasis:`ghost`,variant:`primary`,class:`text-lt-primary hover:bg-lt-primary/10 hover:text-lt-primary`},{emphasis:`ghost`,variant:`secondary`,class:`text-lt-secondary-fg hover:bg-lt-secondary hover:text-lt-secondary-fg`},{emphasis:`ghost`,variant:`success`,class:`text-lt-success hover:bg-lt-success/10 hover:text-lt-success`},{emphasis:`ghost`,variant:`info`,class:`text-lt-info hover:bg-lt-info/10 hover:text-lt-info`},{emphasis:`ghost`,variant:`warning`,class:`text-lt-warning hover:bg-lt-warning/10 hover:text-lt-warning`},{emphasis:`ghost`,variant:`danger`,class:`text-lt-danger hover:bg-lt-danger/10 hover:text-lt-danger`},{emphasis:`link`,variant:`primary`,class:`text-lt-primary`},{emphasis:`link`,variant:`secondary`,class:`text-lt-secondary-fg`},{emphasis:`link`,variant:`success`,class:`text-lt-success`},{emphasis:`link`,variant:`info`,class:`text-lt-info`},{emphasis:`link`,variant:`warning`,class:`text-lt-warning`},{emphasis:`link`,variant:`danger`,class:`text-lt-danger`}],defaultVariants:{emphasis:`solid`,size:`md`}});function il(e,t){return t||((e??`solid`)===`solid`||e===`link`?`primary`:void 0)}function J({className:e,variant:t,emphasis:n,size:r,asChild:i=!1,icon:a,children:o,...s}){let c=i?g:`button`,l=a&&!i?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(y,{name:a,"aria-hidden":`true`}),o]}):o;return(0,q.jsx)(c,{"data-slot":`button`,className:x(rl({emphasis:n,variant:il(n,t),size:r,className:e})),...s,children:l})}var al=[];al.forEach,al.slice;var ol=[`__proto__`,`constructor`,`prototype`];function sl(e){return!(typeof e!=`string`||e.length===0||e.length>128||ol.indexOf(e)>-1||e.indexOf(`..`)>-1||e.indexOf(`\\`)>-1||/[?#%\s]/.test(e)||/[\x00-\x1F\x7F]/.test(e))}function cl(e){return!(!sl(e)||e.indexOf(`/`)>-1||e.indexOf(`@`)>-1)}function ll(e){return sl(e)}var ul={lng:cl,ns:ll};function dl(e){return typeof e==`string`?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e}function fl(e){if(typeof e!=`string`||e.length===0)return e;try{let t=new URL(e);return t.username||t.password?(t.username=``,t.password=``,t.toString()):e}catch{return e.replace(/(\/\/)[^/@\s]+@/g,`$1`)}}function pl(){return typeof XMLHttpRequest==`function`||typeof XMLHttpRequest==`object`}function ml(e){return!!e&&typeof e.then==`function`}function hl(e){return ml(e)?e:Promise.resolve(e)}var gl=/\{\{(.+?)\}\}/g;function _l(e,t){let n=!1,r=e.replace(gl,(e,r)=>{let i=r.trim();if(ol.indexOf(i)>-1)return e;let a=t[i];if(a==null)return e;let o=ul[i]||cl,s=String(a).split(`+`);for(let t of s)if(!o(t))return n=!0,e;return s.join(`+`)});return n?null:r}var vl=typeof globalThis<`u`?globalThis:typeof global<`u`?global:typeof window<`u`?window:void 0,yl;typeof fetch==`function`?yl=fetch:vl&&typeof vl.fetch==`function`&&(yl=vl.fetch);var bl=pl()&&vl?vl.XMLHttpRequest:void 0,xl=typeof ActiveXObject==`function`&&vl?vl.ActiveXObject:void 0,Sl=[`__proto__`,`constructor`,`prototype`],Cl=(e,t)=>{if(t&&typeof t==`object`){let n=``;for(let e of Object.keys(t))Sl.indexOf(e)>-1||(n+=`&`+encodeURIComponent(e)+`=`+encodeURIComponent(t[e]));if(!n)return e;e=e+(e.indexOf(`?`)===-1?`?`:`&`)+n.slice(1)}return e},wl=(e,t,n,r)=>{let i=e=>{if(!e.ok)return n(e.statusText||`Error`,{status:e.status});e.text().then(t=>{n(null,{status:e.status,data:t})}).catch(n)};if(r){let a=r(e,t);if(a instanceof Promise){a.then(i).catch(n);return}}typeof fetch==`function`?fetch(e,t).then(i).catch(n):yl(e,t).then(i).catch(n)},Tl=(e,t,n,r)=>{e.queryStringParams&&(t=Cl(t,e.queryStringParams));let i={...typeof e.customHeaders==`function`?e.customHeaders():e.customHeaders};typeof window>`u`&&typeof global<`u`&&global.process!==void 0&&global.process.versions&&global.process.versions.node&&(i[`User-Agent`]=`i18next-http-backend (node/${global.process.version}; ${global.process.platform} ${global.process.arch})`),n&&(i[`Content-Type`]=`application/json`);let a=typeof e.requestOptions==`function`?e.requestOptions(n):e.requestOptions,o={method:n?`POST`:`GET`,body:n?e.stringify(n):void 0,headers:i,...e._omitFetchOptions?{}:a},s=typeof e.alternateFetch==`function`&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{wl(t,o,r,s)}catch(n){if(!a||Object.keys(a).length===0||!n.message||n.message.indexOf(`not implemented`)<0)return r(n);try{Object.keys(a).forEach(e=>{delete o[e]}),wl(t,o,r,s),e._omitFetchOptions=!0}catch(e){r(e)}}},El=(e,t,n,r)=>{n&&typeof n==`object`&&(n=Cl(``,n).slice(1)),e.queryStringParams&&(t=Cl(t,e.queryStringParams));try{let i=bl?new bl:new xl(`MSXML2.XMLHTTP.3.0`);i.open(n?`POST`:`GET`,t,1),e.crossDomain||i.setRequestHeader(`X-Requested-With`,`XMLHttpRequest`),i.withCredentials=!!e.withCredentials,n&&i.setRequestHeader(`Content-Type`,`application/x-www-form-urlencoded`),i.overrideMimeType&&i.overrideMimeType(`application/json`);let a=e.customHeaders;if(a=typeof a==`function`?a():a,a)for(let e of Object.keys(a))Sl.indexOf(e)>-1||i.setRequestHeader(e,a[e]);i.onreadystatechange=()=>{i.readyState>3&&r(i.status>=400?i.statusText:null,{status:i.status,data:i.responseText})},i.send(n)}catch(e){console&&console.log(e)}},Dl=(e,t,n,r)=>{if(typeof n==`function`&&(r=n,n=void 0),r||=(()=>{}),yl&&t.indexOf(`file:`)!==0)return Tl(e,t,n,r);if(pl()||typeof ActiveXObject==`function`)return El(e,t,n,r);r(Error(`No fetch and no xhr implementation found!`))},Ol=()=>({loadPath:`/locales/{{lng}}/{{ns}}.json`,addPath:`/locales/add/{{lng}}/{{ns}}`,parse:e=>JSON.parse(e),stringify:JSON.stringify,parsePayload:(e,t,n)=>({[t]:n||``}),parseLoadPayload:(e,t)=>void 0,request:Dl,reloadInterval:typeof window<`u`?!1:36e5,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:`cors`,credentials:`same-origin`,cache:`default`}}),kl=class{constructor(e,t={},n={}){this.services=e,this.options=t,this.allOptions=n,this.type=`backend`,this.init(e,t,n)}init(e,t={},n={}){if(this.services=e,this.options={...Ol(),...this.options||{},...t},this.allOptions=n,this.services&&this.options.reloadInterval){let e=setInterval(()=>this.reload(),this.options.reloadInterval);typeof e==`object`&&typeof e.unref==`function`&&e.unref()}}readMulti(e,t,n){this._readAny(e,e,t,t,n)}read(e,t,n){this._readAny([e],e,[t],t,n)}_readAny(e,t,n,r,i){let a=this.options.loadPath;typeof this.options.loadPath==`function`&&(a=this.options.loadPath(e,n)),a=hl(a),a.then(a=>{if(!a)return i(null,{});let o=_l(a,{lng:e.join(`+`),ns:n.join(`+`)});if(o==null){let t=e.map(dl).join(`, `),r=n.map(dl).join(`, `);return i(Error(`i18next-http-backend: unsafe lng/ns value — refusing to build request URL for languages=[`+t+`] namespaces=[`+r+`]`),!1)}this.loadUrl(o,i,t,r)})}loadUrl(e,t,n,r){let i=typeof n==`string`?[n]:n,a=typeof r==`string`?[r]:r,o=this.options.parseLoadPayload(i,a),s=dl(fl(e));this.options.request(this.options,e,o,(e,i)=>{if(i&&(i.status>=500&&i.status<600||!i.status))return t(`failed loading `+s+`; status code: `+i.status,!0);if(i&&i.status>=400&&i.status<500)return t(`failed loading `+s+`; status code: `+i.status,!1);if(!i&&e&&e.message){let n=e.message.toLowerCase();if([`failed`,`fetch`,`network`,`load`].find(e=>n.indexOf(e)>-1))return t(`failed loading `+s+`: `+dl(e.message),!0)}if(e)return t(e,!1);let a,o;try{a=typeof i.data==`string`?this.options.parse(i.data,n,r):i.data}catch{o=`failed parsing `+s+` to json`}if(o)return t(o,!1);t(null,a)})}create(e,t,n,r,i){if(!this.options.addPath)return;typeof e==`string`&&(e=[e]);let a=this.options.parsePayload(t,n,r),o=0,s=[],c=[];e.forEach(n=>{let r=this.options.addPath;typeof this.options.addPath==`function`&&(r=this.options.addPath(n,t));let l=_l(r,{lng:n,ns:t});if(l==null){o+=1,i&&o===e.length&&i(s,c);return}this.options.request(this.options,l,a,(t,n)=>{o+=1,s.push(t),c.push(n),o===e.length&&typeof i==`function`&&i(s,c)})})}reload(){let{backendConnector:e,languageUtils:t,logger:n}=this.services,r=e.language;if(r&&r.toLowerCase()===`cimode`)return;let i=[],a=e=>{t.toResolveHierarchy(e).forEach(e=>{i.indexOf(e)<0&&i.push(e)})};a(r),this.allOptions.preload&&this.allOptions.preload.forEach(e=>a(e)),i.forEach(t=>{this.allOptions.ns.forEach(r=>{e.read(t,r,`read`,null,null,(i,a)=>{i&&n.warn(`loading namespace ${r} for language ${t} failed`,i),!i&&a&&n.log(`loaded namespace ${r} for language ${t}`,a),e.loaded(`${t}|${r}`,i,a)})})})}};kl.type=`backend`;var Al=`/locales/{{lng}}/{{ns}}.json`,jl=`/locales/add/{{lng}}/{{ns}}`;async function Ml(e,t={}){if(oe(e),!e?.enabled){await I(e=>({...e,ns:t.namespaces??e.ns}));return}await Nl({saveMissing:e.saveMissing,namespaces:t.namespaces}),ne(e.preloadLocales)}async function Nl(e={}){let{namespaces:t,loadPath:n=Al,addPath:r=jl,saveMissing:i=!1,customHeaders:a}=e,o=()=>({...c(),...a?.()});te.use(kl),await I(e=>({...e,ns:t??e.ns,partialBundledLanguages:!0,saveMissing:i,backend:{loadPath:n,addPath:r,customHeaders:o,withCredentials:!0}}))}function Pl(e,t,n={}){let{enabled:r=!0}=n,i=(0,B.useRef)(t);i.current=t,(0,B.useEffect)(()=>{if(!r||typeof window>`u`)return;let t=e=>i.current(e);return window.addEventListener(e,t),()=>window.removeEventListener(e,t)},[e,r])}function Fl({href:e,method:t,...n}){return(0,q.jsx)(`a`,{href:e,...n})}function Y(){return typeof window>`u`?void 0:window.location.pathname}function Il(){return()=>void 0}var X={Link:Fl,visit:e=>window.location.assign(e),reload:()=>window.location.reload()},Z=(0,B.createContext)(X);function Ll({adapter:e,children:t}){return(0,q.jsx)(Z.Provider,{value:e,children:t})}function Rl(){let e=(0,B.useContext)(Z);return{Link:e.Link,visit:e.visit,reload:e.reload,currentUrl:e.currentUrl??Y(),onNavigate:e.onNavigate??Il}}function zl({preserveScroll:e=!0,preserveState:t=!0}){let{visit:n}=Rl();return Pl(d.localeChange,r=>{let i=r.detail?.locale;typeof i==`string`&&i!==``&&n(window.location.href,{preserveScroll:e,preserveState:t})}),null}function Bl({namespace:e=`lattice`,label:t}={}){let{t:n,locale:r,locales:i,setLocale:a}=N(e),o=i.length>0?i:[r],s=t??(e=>n(`language.${e}`,e));return{locale:r,locales:o,options:o.map(e=>({value:e,label:s(e),active:e===r})),setLocale:a}}function Vl(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function Hl(e){return a(e)&&typeof e.enabled==`boolean`&&typeof e.saveMissing==`boolean`&&Vl(e.locales)&&Vl(e.preloadLocales)&&(e.timezone===void 0||e.timezone===null||typeof e.timezone==`string`)}function Ul(e){if(!a(e))return;let t=e.lattice,n=a(t)?t.i18n:void 0;return Hl(n)?n:void 0}var Wl=e({configureI18nFromPageProps:()=>Gl,i18nConfigFromPageProps:()=>Ul});function Gl(e,t={}){return Ml(Ul(e),t)}function Kl({value:e,dateStyle:t=`medium`,timeStyle:n=`short`}){let{locale:r}=s(),{timezone:i}=ae();if(e==null||e===``)return null;let a={locale:r,timeZone:i},o=R(e,{dateStyle:t,timeStyle:n},a),c=ql(e),l=L(e,a);return(0,q.jsx)(`time`,{dateTime:c??void 0,title:l||void 0,children:o})}function ql(e){return ie(e)?.toISOString()??null}function Jl({className:e,...t}){let{t:n}=N(F);return(0,q.jsx)(y,{name:`loader-2`,role:`status`,"aria-label":n(`common.loading`,`Loading`),"aria-hidden":!1,className:x(`animate-spin`,e),...t})}function Yl(e){return e==null||e===``?void 0:e}function Q(e){return Yl(e.key)??Yl(e.id)}function Xl(e,t){let n=Yl(t);return n?`${e}-${n}`:void 0}function Zl(e,t){return Xl(e,Q(t))}var Ql=(0,B.createContext)(!1),$l=`flex h-lt-control-sm w-full items-center justify-start gap-2 rounded-lt-sm px-2.5 text-left text-sm font-normal text-lt-popover-fg no-underline decoration-transparent shadow-none transition-colors hover:bg-lt-accent/70 hover:text-lt-popover-fg focus-visible:bg-lt-accent/70 focus-visible:text-lt-popover-fg focus-visible:ring-0 focus-visible:outline-none disabled:pointer-events-none disabled:text-lt-disabled-fg [&_svg]:size-lt-icon-sm [&_svg]:text-lt-muted-fg`;function eu({children:e}){return(0,q.jsx)(Ql.Provider,{value:!0,children:e})}function tu(){return(0,B.useContext)(Ql)}function nu(e,t=Hc){if(!(typeof window>`u`))for(let n of e){let e=t[n.type];if(e===void 0){console.warn(`[lattice] No handler registered for effect type "${n.type}".`);continue}e(n)}}function ru(e){typeof window>`u`||window.dispatchEvent(new CustomEvent(d.actionError,{detail:{error:e}}))}function iu(e){return Array.isArray(e)?e.filter(au):[]}function au(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}function ou(){let e=Rc(),t=(0,B.useMemo)(()=>Uc(Hc,e),[e]);return(0,B.useCallback)(e=>nu(e,t),[t])}var su=`Embedded modals require a ModalProvider.`,cu=(0,B.createContext)(null);function lu(){return(0,B.useContext)(cu)}var uu=(0,B.createContext)(null);function du(){return(0,B.useContext)(uu)}function fu(){let e=du();if(!e)throw Error(su);return e}function pu({children:e}){let[t,n]=(0,B.useState)([]),r=(0,B.useRef)(t),i=(0,B.useRef)(0),a=(0,B.useRef)(new Map),o=(0,B.useCallback)(e=>{let t=e(r.current);return r.current=t,n(t),t},[]),s=(0,B.useCallback)(e=>{o(t=>{let n=t.findIndex(t=>t.key===e);if(n===-1||!t[n].open)return t;let r=[...t];return r[n]={...r[n],open:!1},r})},[o]),c=(0,B.useCallback)(e=>{let t=(0,B.isValidElement)(e)?null:e.id??null,n=document.activeElement instanceof HTMLElement?document.activeElement:null,r=-1;return o(a=>{if(t!==null){let n=a.findIndex(e=>e.nodeId===t&&e.open);if(n!==-1){r=a[n].key;let t=[...a];return t[n]={...t[n],content:e},t}}return r=i.current++,[...a,{key:r,content:e,nodeId:t,open:!0,opener:n}]}),{close:()=>s(r)}},[s,o]);(0,B.useEffect)(()=>{function e(e){let t=e.detail?.node;t&&c(t)}function t(e){let t=e.detail?.modal;o(e=>{if(t==null)return e.map(e=>e.open?{...e,open:!1}:e);let n=e.findIndex(e=>e.nodeId===t);if(n===-1)return e;let r=[...e];return r[n]={...r[n],open:!1},r})}return window.addEventListener(d.openModal,e),window.addEventListener(d.closeModal,t),()=>{window.removeEventListener(d.openModal,e),window.removeEventListener(d.closeModal,t)}},[c,o]);let l=(0,B.useCallback)(e=>{let t=a.current.get(e);return t||(t={onOpenChange:t=>{t||s(e)},onExited:t=>{o(n=>{let r=n.find(t=>t.key===e)?.opener??null;return r?.isConnected&&(t.preventDefault(),requestAnimationFrame(()=>r.focus())),n.filter(t=>t.key!==e)}),a.current.delete(e)}},a.current.set(e,t),t)},[s,o]),u=(0,B.useMemo)(()=>({open:c}),[c]);return(0,q.jsxs)(uu.Provider,{value:u,children:[e,t.map(e=>{let t={open:e.open,...l(e.key)};return(0,q.jsx)(cu.Provider,{value:t,children:(0,B.isValidElement)(e.content)?e.content:(0,q.jsx)(Xt,{node:e.content})},e.key)})]})}var mu=(0,B.createContext)(null);function hu(e){return e.type===`action`||e.type===`action.bulk`}function gu({children:e,render:t}){return(0,q.jsx)(mu.Provider,{value:t,children:e})}function _u(){return(0,B.useContext)(mu)}function vu({action:e,children:t,options:n}){let r=_u();if(!r)throw Error(`Action triggers require an ActionTriggerProvider.`);return(0,q.jsx)(q.Fragment,{children:r({action:e,children:t,options:n})})}var yu=(0,B.createContext)(null);function bu(e){return(0,B.useContext)(yu)?.(e)}function xu(e){let t=ou(),n=du(),r=e.action??null,i=e.effects??[],a=e.modal??null;if(a)return{kind:`modal`,onClick:()=>{if(!n)throw Error(su);n.open(a)}};if(r){if(!hu(r))throw Error(`Clickable action nodes must have type [action] or [action.bulk].`);return{kind:`action`,action:r}}return i.length>0?{kind:`effects`,onClick:()=>t(iu(i))}:e.href!=null&&e.href!==``?{kind:`navigate`,href:e.href,method:e.method??`get`}:{kind:`none`}}var Su=`X-Lattice-Ref`,Cu=new Map;function wu(e){return Cu.get(e)??e}function Tu(e,t){Cu.set(e,t)}function Eu(e){let t=wu(e);return t?{[Su]:t}:{}}var Du=()=>({});function Ou(e){Du=e}function ku(e={}){return{...Du(),...e}}function Au(e=``,t={}){return{...ku(),...Eu(e),...t}}var ju=class extends Error{response;constructor(e){super(`HTTP ${e.status}`),this.response=e}};function Mu(){let e=document.cookie.match(/XSRF-TOKEN=([^;]+)/);return e?decodeURIComponent(e[1]):``}var Nu=1e4,Pu=new Map,Fu=new Map;function Iu(e){return e===void 0||e===`GET`||e===`HEAD`?{Accept:`application/json`}:{Accept:`application/json`,"Content-Type":`application/json`,"X-Requested-With":`XMLHttpRequest`,"X-XSRF-TOKEN":Mu()}}var Lu=`/lattice/refs/refresh`;function Ru(e){Lu=e}var zu=new Map;async function Bu(e){let t=zu.get(e);if(t)return t;let n=Hu(Lu,{method:`POST`,body:JSON.stringify({ref:wu(e)})}).then(t=>(Tu(e,t.ref),t.ref)).catch(()=>null).finally(()=>{zu.delete(e)});return zu.set(e,n),n}async function Vu(e,t={}){let{ref:n=``,headers:r,throwOnError:i=!0,method:a,...o}=t,s=a?.toUpperCase(),c=()=>fetch(e,{credentials:`same-origin`,...o,method:s,headers:Au(n,{...Iu(s),...r})}),l=await c();if(n!==``&&l.status===403&&await Bu(n)!==null&&(l=await c()),i&&!l.ok)throw new ju(l);return l}async function Hu(e,t){return(await Vu(e,t)).json()}function Uu(e){return[e.source,e.audience,[...e.scopes].sort().join(` `)].join(``)}function Wu(e){Pu.delete(Uu(e))}async function Gu(e){let t=Uu(e),n=Pu.get(t);if(n&&n.expiresAt>Date.now()+Nu)return n.token;let r=Fu.get(t);if(r)return r;let i=Hu(e.tokenEndpoint,{method:`POST`,ref:e.ref,body:JSON.stringify({nodeId:e.nodeId,nodeType:e.nodeType,audience:e.audience,scopes:e.scopes})}).then(e=>(Pu.set(t,{token:e,expiresAt:Date.now()+Math.max(0,e.expiresIn)*1e3}),e)).finally(()=>{Fu.delete(t)});return Fu.set(t,i),i}function Ku(e){return e.status===401||e.status===403}async function qu(e,t,n){let{headers:r,...i}=t;return fetch(e,{...i,credentials:`omit`,headers:ku({Accept:`application/json`,...r,Authorization:`${n.tokenType} ${n.accessToken}`})})}async function Ju(e,t){let{remote:n,throwOnError:r=!0,...i}=t,a=await Gu(n),o=await qu(e,i,a);if(Ku(o)&&(Wu(n),a=await Gu(n),o=await qu(e,i,a)),r&&!o.ok)throw new ju(o);return o}async function Yu(e,t){return(await Ju(e,t)).json()}async function Xu(e,t){try{let n=await e();return t(iu((await n.json().catch(()=>({}))).effects)),n.ok}catch(e){return ru(e),!1}}var Zu=Object.defineProperty,Qu=(e,t)=>Zu(e,`name`,{value:t,configurable:!0}),$u=`Dialog`,[ed,td]=Je($u),[nd,rd]=ed($u),id=Qu(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=B.useRef(null),c=B.useRef(null),[l,u]=Et({prop:r,defaultProp:i??!1,onChange:a,caller:$u}),[d,f]=B.useState(0),[p,m]=B.useState(0);return(0,q.jsx)(nd,{scope:t,triggerRef:s,contentRef:c,contentId:pt(),titleId:pt(),descriptionId:pt(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:B.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),ad=`DialogTrigger`,od=B.forwardRef(Qu(function(e,t){let{__scopeDialog:n,...r}=e,i=rd(ad,n),a=M(t,i.triggerRef);return(0,q.jsx)(st.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Td(i.open),...r,ref:a,onClick:Ut(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),sd=`DialogPortal`,[cd,ld]=ed(sd,{forceMount:void 0}),ud=Qu(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=rd(sd,t);return(0,q.jsx)(cd,{scope:t,forceMount:n,children:B.Children.map(r,e=>(0,q.jsx)(gt,{present:n||a.open,children:(0,q.jsx)(Xe,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),dd=`DialogOverlay`,fd=B.forwardRef(Qu(function(e,t){let n=ld(dd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=rd(dd,e.__scopeDialog);return a.modal?(0,q.jsx)(gt,{present:r||a.open,children:(0,q.jsx)(md,{...i,ref:t})}):null},`DialogOverlay`)),pd=j(`DialogOverlay.RemoveScroll`),md=B.forwardRef(Qu(function(e,t){let{__scopeDialog:n,...r}=e,i=rd(dd,n),a=Vt(),o=M(t,a);return(0,q.jsx)(Ot,{as:pd,allowPinchZoom:!0,shards:[i.contentRef],children:(0,q.jsx)(st.div,{"data-state":Td(i.open),...r,ref:o,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),hd=`DialogContent`,gd=B.forwardRef(Qu(function(e,t){let n=ld(hd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=rd(hd,e.__scopeDialog);return(0,q.jsx)(gt,{present:r||a.open,children:a.modal?(0,q.jsx)(_d,{...i,ref:t}):(0,q.jsx)(vd,{...i,ref:t})})},`DialogContent`)),_d=B.forwardRef(Qu(function(e,t){let n=rd(hd,e.__scopeDialog),r=B.useRef(null),i=M(t,n.contentRef,r);return B.useEffect(()=>{let e=r.current;if(e)return zt(e)},[]),(0,q.jsx)($,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Ut(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ut(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Ut(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),vd=B.forwardRef(Qu(function(e,t){let n=rd(hd,e.__scopeDialog),r=B.useRef(!1),i=B.useRef(!1);return(0,q.jsx)($,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),$=B.forwardRef(Qu(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=rd(hd,n);return It(),(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(jt,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,q.jsx)(et,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Td(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),yd=`DialogTitle`,bd=B.forwardRef(Qu(function(e,t){let{__scopeDialog:n,...r}=e,i=rd(yd,n),{setTitleCount:a}=i;return ut(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,q.jsx)(st.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),xd=`DialogDescription`,Sd=B.forwardRef(Qu(function(e,t){let{__scopeDialog:n,...r}=e,i=rd(xd,n),{setDescriptionCount:a}=i;return ut(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,q.jsx)(st.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),Cd=`DialogClose`,wd=B.forwardRef(Qu(function(e,t){let{__scopeDialog:n,...r}=e,i=rd(Cd,n);return(0,q.jsx)(st.button,{type:`button`,...r,ref:t,onClick:Ut(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Td(e){return e?`open`:`closed`}Qu(Td,`getState`);var Ed=`fixed inset-0 z-lt-overlay bg-lt-overlay data-[state=open]:animate-lt-fade-in data-[state=closed]:animate-lt-fade-out`,Dd=b(`z-lt-modal w-full bg-lt-bg p-6 shadow-lt-lg`,{variants:{placement:{center:`relative rounded-lt border border-lt-border data-[state=open]:animate-lt-dialog-in data-[state=closed]:animate-lt-dialog-out`,start:`fixed inset-y-0 start-0 overflow-y-auto border-e border-lt-border data-[state=open]:animate-lt-sheet-in-start data-[state=closed]:animate-lt-sheet-out-start`,end:`fixed inset-y-0 end-0 overflow-y-auto border-s border-lt-border data-[state=open]:animate-lt-sheet-in-end data-[state=closed]:animate-lt-sheet-out-end`},width:{sm:`max-w-sm`,md:`max-w-md`,lg:`max-w-lg`,xl:`max-w-xl`,"2xl":`max-w-2xl`,"3xl":`max-w-3xl`,"4xl":`max-w-4xl`,"5xl":`max-w-5xl`,"6xl":`max-w-6xl`,"7xl":`max-w-7xl`,max:`max-w-[calc(100vw-2rem)]`},height:{sm:``,md:``,lg:``,xl:``,"2xl":``,"3xl":``,"4xl":``,"5xl":``,max:``}},compoundVariants:[{placement:`center`,height:`sm`,class:`max-h-[min(480px,calc(100vh-2rem))] overflow-y-auto`},{placement:`center`,height:`md`,class:`max-h-[min(600px,calc(100vh-2rem))] overflow-y-auto`},{placement:`center`,height:`lg`,class:`max-h-[min(680px,calc(100vh-2rem))] overflow-y-auto`},{placement:`center`,height:`xl`,class:`max-h-[min(820px,calc(100vh-2rem))] overflow-y-auto`},{placement:`center`,height:`2xl`,class:`max-h-[min(920px,calc(100vh-2rem))] overflow-y-auto`},{placement:`center`,height:`3xl`,class:`max-h-[min(1040px,calc(100vh-2rem))] overflow-y-auto`},{placement:`center`,height:`4xl`,class:`max-h-[min(1160px,calc(100vh-2rem))] overflow-y-auto`},{placement:`center`,height:`5xl`,class:`max-h-[min(1280px,calc(100vh-2rem))] overflow-y-auto`},{placement:`center`,height:`max`,class:`h-[calc(100vh-2rem)] max-h-[calc(100vh-2rem)] overflow-y-auto`}],defaultVariants:{placement:`center`,width:`lg`}});function Od(e){return(0,q.jsx)(id,{"data-slot":`dialog`,...e})}function kd(e){return(0,q.jsx)(wd,{"data-slot":`dialog-close`,...e})}function Ad(e){return(0,q.jsx)(od,{"data-slot":`dialog-trigger`,...e})}function jd({className:e,...t}){return(0,q.jsx)(bd,{className:x(`text-lg font-semibold leading-none tracking-tight`,e),"data-slot":`dialog-title`,...t})}function Md({className:e,...t}){return(0,q.jsx)(Sd,{className:x(`text-sm text-lt-muted-fg`,e),"data-slot":`dialog-description`,...t})}function Nd({children:e,className:t,placement:n=`center`,width:r=`lg`,height:i,...a}){let o=(0,q.jsx)(gd,{className:x(Dd({placement:n,width:r,height:i}),t),"data-slot":`dialog-content`,...a,children:e});return n===`center`?(0,q.jsx)(ud,{children:(0,q.jsx)(fd,{className:x(Ed,`overflow-y-auto`),"data-slot":`dialog-overlay`,children:(0,q.jsx)(`div`,{className:`grid min-h-full place-items-center p-4`,children:o})})}):(0,q.jsxs)(ud,{children:[(0,q.jsx)(fd,{className:Ed,"data-slot":`dialog-overlay`}),o]})}function Pd({closeLabel:e,description:t,title:n}){return(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(jd,{children:n}),t?(0,q.jsx)(Md,{children:t}):null]}),(0,q.jsx)(kd,{asChild:!0,children:(0,q.jsx)(J,{"aria-label":e,"data-test":`dialog-close`,size:`icon`,emphasis:`ghost`,children:(0,q.jsx)(y,{name:`x`,"aria-hidden":`true`,className:`size-lt-icon-md`})})})]})}function Fd({open:e,title:t,description:n,confirmLabel:r,cancelLabel:i=`Cancel`,confirmVariant:a=null,confirmEmphasis:o=null,processing:s=!1,confirmDisabled:c=!1,onConfirm:l,onCancel:u,onExited:d}){let f=e=>{s&&e.preventDefault()};return(0,q.jsx)(Od,{open:e,onOpenChange:e=>{e||u()},children:(0,q.jsxs)(Nd,{...n?{}:{"aria-describedby":void 0},width:`md`,onCloseAutoFocus:d,onEscapeKeyDown:f,onInteractOutside:f,children:[(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsx)(jd,{children:t}),n&&(0,q.jsx)(Md,{children:n})]}),(0,q.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,q.jsx)(J,{type:`button`,emphasis:`outline`,"data-test":`confirm-cancel`,disabled:s,onClick:u,children:i}),(0,q.jsxs)(J,{type:`button`,emphasis:o,variant:a,"data-test":`confirm-accept`,disabled:s||c,onClick:l,children:[s&&(0,q.jsx)(Jl,{}),r]})]})]})})}function Id(e){return e.props.label??re(`lattice`,`common.action.run`,`Run action`)}function Ld(e){let t=Id(e),n=e.props.confirmation;return{title:n?.title??t,description:n?.description??void 0,confirmLabel:n?.confirmLabel??t,cancelLabel:n?.cancelLabel??re(`lattice`,`common.cancel`,`Cancel`)}}function Rd({node:e,extraData:t,onBefore:n,onError:r,onSuccess:i}){let a=lu();if(!a)throw Error(su);let o=e.props.endpoint??``,s=e.props.ref??``,c=e.props.method??`post`,{variant:l,emphasis:u}=e.props,d=Ld(e),[f,p]=(0,B.useState)(!1),m=ou(),h=async()=>{if(!o)return;if(c===`get`){K.visit(o,{headers:Au(s)}),a.onOpenChange(!1);return}n?.(),p(!0);let e=await Xu(()=>Vu(o,{method:c,ref:s,body:t?JSON.stringify(t):void 0,throwOnError:!1}),m);p(!1),e?(a.onOpenChange(!1),i?.()):r?.()};return(0,q.jsx)(Fd,{open:a.open,onExited:a.onExited,title:d.title,description:d.description,confirmLabel:d.confirmLabel,cancelLabel:d.cancelLabel,confirmVariant:l,confirmEmphasis:u,processing:f,confirmDisabled:!o,onConfirm:()=>void h(),onCancel:()=>a.onOpenChange(!1)})}function zd({className:e,...t}){return(0,q.jsx)(`div`,{"aria-hidden":`true`,className:x(`animate-pulse rounded-lt-sm bg-lt-muted`,e),"data-slot":`skeleton`,...t})}var Bd=(0,B.createContext)({});function Vd({nodes:e,children:t}){return(0,q.jsx)(Bd.Provider,{value:e,children:t})}function Hd(e){let t=(0,B.useContext)(Bd),n=Se(e).name??``,r=Ee(),i=n&&r?r.errorKey(n):n;return i&&t[i]||n&&t[n]||e}var Ud=typeof window>`u`?B.useEffect:B.useLayoutEffect;function Wd(e,t,n,r){return Vu(e,{method:`POST`,ref:t,signal:r,body:JSON.stringify(n),throwOnError:!1}).then(e=>e.ok?e.json():null)}function Gd(e){let t=e.props.templates;return t?.length?t:void 0}function Kd(e,t){let n=Gd(e);return n?n.find(e=>e.type===t.type)?.schema??[]:e.schema??[]}function qd(e,t){return e.startsWith(`@`)?e.slice(1):t===null?e:Be(t,e)}function Jd(e,t,n,r=0,i={}){let a=Se(e);if(!a.editablePrefill||!a.name)return null;let o=_e(i);return{path:t===null?a.name:Be(t,a.name),overrideKey:n===null?a.name:Oe(n,o,r,a.name),resetOn:(a.prefillResetOn??[]).map(e=>qd(e,t)),refreshOn:(a.prefillRefreshOn??[]).map(e=>qd(e,t))}}function Yd(e,t){let n=[];function r(e,a=null,o=null,s=null,c=0,l={}){for(let u of e??[]){if(We(u)){let e=Se(u).name;e&&i(u,Be(a,e),Be(o,e),ve(t,Be(a,e)));continue}let e=Jd(u,a,s,c,l);e&&n.push(e),r(u.schema,a,o,s,c,l)}}function i(e,t,n,a){let o=Array.isArray(a)?a:[],s=He(e);o.forEach((a,o)=>{let c=Be(t,o),l=Be(n,_e(a)??o);r(Kd(e,a),c,l,n,o,a),s&&i(e,Be(c,s),Be(l,s),a[s])})}return r(e),n}function Xd(e,t){let n=new Map(e.targets.map(e=>[e.overrideKey,e]));return t.targets.filter(r=>{let i=n.get(r.overrideKey);return r.resetOn.some((n,r)=>{let a=i?.resetOn[r]??n;return!Object.is(ve(e.values,a),ve(t.values,n))})}).map(e=>e.overrideKey)}function Zd(e,t){return e.filter(e=>{let n=ve(t,e.path);return n!=null&&n!==``}).map(e=>e.overrideKey)}function Qd(e,t){let n=new Set(t.map(e=>e.overrideKey));return new Set([...e].filter(e=>n.has(e)))}function $d(e,t,n){let r=xt(),i=yt(),[a,o]=(0,B.useState)({}),s=(0,B.useMemo)(()=>Yd(n,r),[n,r]),c=(0,B.useRef)(new Set),l=(0,B.useRef)(new Set),u=(0,B.useRef)(r),d=(0,B.useRef)(s),f=(0,B.useRef)(s);f.current=s,Ud(()=>{let e=new Set(s.map(e=>e.overrideKey));l.current=new Set([...l.current].filter(t=>e.has(t)));let t=s.filter(e=>!l.current.has(e.overrideKey));for(let e of Zd(t,r))c.current.add(e);for(let e of t)l.current.add(e.overrideKey)},[s,r]);let p=(0,B.useCallback)(e=>{c.current.add(e)},[]),m=(0,B.useMemo)(()=>{let e=new Set,t=!1;return Ke(n,n=>{if(Array.isArray(n.dependsOnKeys))for(let t of n.dependsOnKeys)e.add(String(t));n.dependsOnAny&&(t=!0)}),{keys:[...e],any:t}},[n]),h=(0,B.useMemo)(()=>{let e=new Set(m.keys);for(let t of s){for(let n of t.resetOn)e.add(n);for(let n of t.refreshOn)e.add(n)}return[...e]},[m.keys,s]),g=m.any?r:JSON.stringify(h.map(e=>ve(r,e)));return(0,B.useEffect)(()=>{if(h.length===0&&!m.any)return;let n=u.current;u.current=r;for(let e of Xd({targets:d.current,values:n},{targets:f.current,values:r}))c.current.delete(e);d.current=f.current,c.current=Qd(c.current,f.current);let a=new AbortController,s=window.setTimeout(()=>{Wd(e,t,{_sub:`resolve`,...r},a.signal).then(e=>{if(!e)return;for(let[t,n]of Object.entries(e.values??{}))i(t,n);let t=new Map(f.current.map(e=>[e.path,e]));for(let[n,r]of Object.entries(e.prefill??{})){let e=t.get(n);e&&!c.current.has(e.overrideKey)&&i(n,r)}e.fields&&o(e.fields)}).catch(()=>{})},250);return()=>{window.clearTimeout(s),a.abort()}},[g,e,t,m.any,i]),{nodes:a,markUserEdit:p}}function ef(e){let t={labels:{},values:{}};return Ke(e,e=>{e.name&&(e.label&&(t.labels[e.name]=e.label),e.value!==void 0&&(t.values[e.name]=e.value))}),t}function tf(e,t){return e===t||e.startsWith(`${t}.`)}function nf(e){let t={};for(let[n,r]of Object.entries(e??{}))t[n]=Array.isArray(r)?r[0]:r;return t}function rf(e,t){let n=(0,B.useRef)(e);n.current=e;let r=(0,B.useRef)(null),i=(0,B.useCallback)(()=>{r.current!==null&&(clearTimeout(r.current),r.current=null)},[]);return(0,B.useEffect)(()=>i,[i]),(0,B.useMemo)(()=>{let e=(...e)=>{i(),r.current=setTimeout(()=>{r.current=null,n.current(...e)},t)};return e.cancel=i,e},[i,t])}function af({componentRef:e,endpoint:t,extraData:n,method:r,onBefore:i,onError:a,onSuccess:o,precognitive:s,validationDebounceMs:c=250}){let l=xt(),u=(0,B.useRef)(l);u.current=l;let d=(0,B.useRef)(n);d.current=n;let f=ou(),[p,m]=(0,B.useState)({}),[h,g]=(0,B.useState)(!1),[_,v]=(0,B.useState)(!1),y=(0,B.useCallback)(n=>Vu(t,{body:JSON.stringify({...u.current,...d.current}),method:r,ref:e,headers:n,throwOnError:!1}),[e,t,r]),b=(0,B.useCallback)(e=>{m(t=>t[e]===void 0?t:{...t,[e]:void 0})},[]),x=rf(e=>{y({Precognition:`true`,"Precognition-Validate-Only":e}).then(async t=>{if(t.status===422){let e=await t.json();m(t=>({...t,...nf(e.errors)}));return}b(e)}).catch(()=>{})},c),S=(0,B.useCallback)(e=>{s&&x(e)},[s,x]),C=(0,B.useCallback)(()=>{},[]),w=(0,B.useCallback)((e,t)=>{v(!0),y({Precognition:`true`,"Precognition-Validate-Only":e.join(`,`)}).then(async n=>{if(n.status===422){let e=await n.json();m(t=>({...t,...nf(e.errors)})),t?.onValidationError?.();return}if(!n.ok){t?.onValidationError?.();return}let r=e.filter(e=>!e.includes(`*`));m(e=>Object.fromEntries(Object.entries(e).filter(([e])=>!r.some(t=>tf(e,t))))),t?.onSuccess?.()}).catch(()=>t?.onValidationError?.()).finally(()=>v(!1))},[y]);return{clearErrors:b,errors:p,processing:h,submit:(0,B.useCallback)(()=>{g(!0),i?.(),y().then(async e=>{let t=await e.json().catch(()=>({}));if(f(iu(t.effects)),e.status===422&&t.errors){m(nf(t.errors)),a?.();return}if(!e.ok){a?.();return}m({}),o(t)}).catch(e=>{ru(e),a?.()}).finally(()=>g(!1))},[f,i,a,o,y]),touch:C,validate:S,validateFields:w,validating:_}}function of(e,t,n,r){let[i,a]=(0,B.useState)(null);return(0,B.useEffect)(()=>{if(!n){a(null);return}let i=new AbortController;return Vu(e,{body:JSON.stringify({_sub:`schema`,...r}),ref:t,method:`POST`,signal:i.signal,throwOnError:!1}).then(e=>e.ok?e.json():null).then(e=>a(e)).catch(()=>{}),()=>i.abort()},[n,e,t]),i}function sf(){return(0,q.jsxs)(`div`,{className:`space-y-4`,"data-lattice-action-form-loading":!0,children:[(0,q.jsx)(zd,{className:`h-4 w-24`}),(0,q.jsx)(zd,{className:`h-10 w-full`}),(0,q.jsx)(zd,{className:`h-10 w-full`})]})}function cf({cancelLabel:e,componentRef:t,endpoint:n,extraData:r,fieldLabels:i,formNode:a,method:o,onBefore:s,onClose:c,onError:l,onSuccess:u,precognitive:d,submitLabel:f}){let{nodes:p,markUserEdit:m}=$d(n,t,a.schema),{clearErrors:h,errors:g,processing:_,submit:v,touch:y,validate:b,validateFields:x,validating:S}=af({componentRef:t,endpoint:n,extraData:r,method:o,onBefore:s,onError:l,onSuccess:u,precognitive:d}),C=(0,B.useMemo)(()=>({action:n,clearErrors:h,componentRef:t,errors:g,fieldLabels:i,precognitive:d,processing:_,touch:y,validate:b,validateFields:x,validating:S}),[h,t,n,g,i,d,_,y,b,x,S]);return(0,q.jsx)(se,{value:C,children:(0,q.jsxs)(`form`,{className:`flex flex-col gap-6`,onSubmit:e=>{e.preventDefault(),v()},children:[(0,q.jsx)(Ae,{value:{markUserEdit:m},children:(0,q.jsx)(Vd,{nodes:p,children:(0,q.jsx)(Qe,{nodes:a.schema??[]})})}),(0,q.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,q.jsx)(J,{"data-test":`action-form-cancel`,disabled:_,onClick:c,type:`button`,emphasis:`ghost`,children:e}),a.props?.submitButton!==!1&&(0,q.jsxs)(J,{"data-test":`action-form-submit`,disabled:_,type:`submit`,children:[_&&(0,q.jsx)(Jl,{}),f]})]})]})})}function lf({formNode:e,...t}){let n=!!e.props?.precognitive,{labels:r,values:i}=(0,B.useMemo)(()=>{let{labels:t,values:n}=ef(e.schema);return{labels:t,values:{...n,...e.props?.state}}},[e]);return(0,q.jsx)(he,{initial:i,children:(0,q.jsx)(cf,{fieldLabels:r,formNode:e,precognitive:n,...t})})}function uf({description:e,formNode:t,onClose:n,onExited:r,open:i,placement:a,title:o,width:s,...c}){let{t:l}=N(`lattice`);return(0,q.jsx)(Od,{open:i,onOpenChange:e=>{e||n()},children:(0,q.jsxs)(Nd,{...e?{}:{"aria-describedby":void 0},onCloseAutoFocus:r,placement:a,width:s,children:[(0,q.jsx)(Pd,{closeLabel:l(`common.close`,`Close`),description:e,title:o}),(0,q.jsx)(`div`,{className:`mt-6`,children:t?(0,q.jsx)(lf,{formNode:t,onClose:n,...c}):(0,q.jsx)(sf,{})})]})})}function df({node:e,extraData:t,onBefore:n,onError:r,onSuccess:i}){let a=lu();if(!a)throw Error(su);let o=e.props.endpoint??``,s=e.props.ref??``,c=e.props.method??`post`,l=e.props.lazyForm===!0,u=of(o,s,l,t),d=l?u:e.props.form,f=Ld(e);return(0,q.jsx)(uf,{open:a.open,onExited:a.onExited,cancelLabel:f.cancelLabel,componentRef:s,description:f.description,endpoint:o,extraData:t,formNode:d,method:c,onBefore:n,onClose:()=>a.onOpenChange(!1),onError:r,onSuccess:()=>{a.onOpenChange(!1),i?.()},placement:e.props.modalSide??`center`,submitLabel:f.confirmLabel,title:f.title,width:e.props.modalWidth??void 0})}function ff(e,t){let n=e.props.endpoint??``,r=e.props.ref??``,i=e.props.method??`post`,a=e.props.confirmation,o=e.props.form,s=e.props.lazyForm===!0,c=!!o||s,[l,u]=(0,B.useState)(!1),d=ou(),f=du(),p=async()=>{if(!n)return;let e=t?.extraData?.();if(i===`get`){K.visit(n,{headers:Au(r)});return}t?.onBefore?.(),u(!0);let a=await Xu(()=>Vu(n,{method:i,ref:r,body:e?JSON.stringify(e):void 0,throwOnError:!1}),d);u(!1),a?t?.onSuccess?.():t?.onError?.()};return{processing:l,requestSubmit:()=>{if(c){if(!f)throw Error(su);f.open((0,q.jsx)(df,{node:e,extraData:t?.extraData?.(),onBefore:t?.onBefore,onError:t?.onError,onSuccess:t?.onSuccess}));return}if(a){if(!f)throw Error(su);f.open((0,q.jsx)(Rd,{node:e,extraData:t?.extraData?.(),onBefore:t?.onBefore,onError:t?.onError,onSuccess:t?.onSuccess}));return}p()}}}var pf=({node:e})=>{let t=e.props.endpoint??``,n=e.props.icon,r=Id(e),i=tu(),{variant:a,emphasis:o}=e.props,{processing:s,requestSubmit:c}=ff(e,bu(e)),l=e.key??Xl(`action`,e.id);return(0,q.jsxs)(J,{className:i?$l:void 0,"data-test":l,disabled:s||!t,onClick:c,type:`button`,emphasis:i?`ghost`:o,variant:i?null:a,children:[s?(0,q.jsx)(Jl,{className:i?`size-lt-icon-sm`:void 0}):n&&(0,q.jsx)(tl,{className:i?`size-lt-icon-sm`:`size-lt-icon-md`,icon:n}),r]})};function mf({children:e,className:t,"data-test":n,label:r,sideOffset:i=8}){return(0,q.jsx)(`div`,{className:t??`inline-flex`,children:(0,q.jsxs)(Dt,{children:[(0,q.jsx)(Ye,{asChild:!0,children:(0,q.jsx)(J,{"aria-label":r,className:`size-lt-control-sm text-lt-muted-fg shadow-none hover:text-lt-fg`,"data-test":n,size:`icon`,type:`button`,emphasis:`ghost`,children:(0,q.jsx)(y,{"aria-hidden":`true`,className:`size-lt-icon-md`,name:`more-horizontal`})})}),(0,q.jsx)(mt,{align:`end`,"aria-label":r,className:`min-w-44 gap-0.5 p-1.5`,sideOffset:i,children:(0,q.jsx)(eu,{children:e})})]})})}var hf={components:{action:V(pf),"action.group":V(({children:e,node:t})=>{let{t:n}=N(`lattice`),r=t.props.label??n(`common.action-group.label`,`Actions`),i=t.props.orientation;return i?(0,q.jsx)(`div`,{"aria-label":r,className:x(`inline-flex max-w-full gap-1`,i===`vertical`?`flex-col items-stretch`:`flex-row flex-wrap items-center`),"data-test":Q(t),role:`group`,children:e}):(0,q.jsx)(mf,{"data-test":Q(t),label:r,children:e})})},name:`lattice/action`},gf=Object.defineProperty,_f=(e,t)=>gf(e,`name`,{value:t,configurable:!0}),vf=`Checkbox`,[yf,bf]=Je(vf),[xf,Sf]=yf(vf);function Cf(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=Et({prop:n,defaultProp:i??!1,onChange:c,caller:vf}),[m,h]=B.useState(null),[g,_]=B.useState(null),v=B.useRef(!1),[y,b]=B.useReducer(e=>e+1,0),x=!m||!!o||!!m.closest(`form`),S={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:y,onUserInteraction:b,required:l,defaultChecked:!Mf(i)&&i,isFormControl:x,bubbleInput:g,setBubbleInput:_};return(0,q.jsx)(xf,{scope:t,...S,children:jf(d)?d(S):r})}_f(Cf,`CheckboxProvider`);var wf=`CheckboxTrigger`,Tf=B.forwardRef(_f(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=Sf(wf,e),g=M(i,u),_=B.useRef(c);return B.useEffect(()=>{let e=a?.form;if(e){let t=_f(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,q.jsx)(st.button,{type:`button`,role:`checkbox`,"aria-checked":Mf(c)?`mixed`:c,"aria-required":l,"data-state":Nf(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:Ut(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:Ut(n,e=>{p(),d(e=>Mf(e)?!0:!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),Ef=B.forwardRef(_f(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,q.jsx)(Cf,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Tf,{...d,ref:t,__scopeCheckbox:n}),e&&(0,q.jsx)(Af,{__scopeCheckbox:n})]})})},`Checkbox`)),Df=`CheckboxIndicator`,Of=B.forwardRef(_f(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Sf(Df,n);return(0,q.jsx)(gt,{present:r||Mf(a.checked)||a.checked===!0,children:(0,q.jsx)(st.span,{"data-state":Nf(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),kf=`CheckboxBubbleInput`,Af=B.forwardRef(_f(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=Sf(kf,e),g=M(r,h),_=me(i),v=B.useRef(!1),y=B.useRef(s),b=B.useRef(o);B.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==b.current;b.current=o;let i=y.current!==s;y.current=s;let c=!(r&&a.current);if(i&&n){v.current=!r;let t=new Event(`click`,{bubbles:c});e.indeterminate=Mf(s),n.call(e,!Mf(s)&&s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let x=B.useRef(!Mf(s)&&s);return(0,q.jsx)(st.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??x.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:Ut(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function jf(e){return typeof e==`function`}_f(jf,`isFunction`);function Mf(e){return e===`indeterminate`}_f(Mf,`isIndeterminate`);function Nf(e){return Mf(e)?`indeterminate`:e?`checked`:`unchecked`}_f(Nf,`getState`);function Pf({className:e,...t}){return(0,q.jsx)(Ef,{"data-slot":`checkbox`,className:x(`peer border-lt-input data-[state=checked]:bg-lt-primary data-[state=checked]:text-lt-primary-fg data-[state=checked]:border-lt-primary data-[state=indeterminate]:bg-lt-primary data-[state=indeterminate]:text-lt-primary-fg data-[state=indeterminate]:border-lt-primary focus-visible:border-lt-ring focus-visible:ring-lt-ring/50 aria-invalid:ring-lt-danger/20 dark:aria-invalid:ring-lt-danger/40 aria-invalid:border-lt-danger size-4 shrink-0 rounded-lt-xs border shadow-lt-xs transition-shadow outline-none focus-visible:ring-[length:var(--lt-ring-width)] aria-readonly:cursor-default aria-readonly:data-[state=unchecked]:bg-lt-muted disabled:cursor-not-allowed disabled:bg-lt-disabled disabled:text-lt-disabled-fg disabled:data-[state=checked]:bg-lt-disabled disabled:data-[state=checked]:text-lt-disabled-fg disabled:data-[state=checked]:border-lt-disabled`,e),...t,children:(0,q.jsx)(Of,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current transition-none`,children:(0,q.jsx)(y,{name:t.checked===`indeterminate`?`minus`:`check`,className:`size-lt-icon-sm`})})})}function Ff(e,t,n={}){let{enabled:r=!0,parse:i,serialize:a}=n,o=()=>typeof t==`function`?t():t,[s,c]=(0,B.useState)(()=>{if(!r||typeof window>`u`)return o();let t;try{t=window.localStorage.getItem(e)}catch{return o()}if(t===null)return o();try{return i?i(t):JSON.parse(t)}catch{try{window.localStorage.removeItem(e)}catch{return o()}return o()}}),l=(0,B.useRef)(s);l.current=s;let u=(0,B.useRef)({enabled:r,key:e,serialize:a});return u.current={enabled:r,key:e,serialize:a},[s,(0,B.useCallback)(e=>{let t=typeof e==`function`?e(l.current):e;l.current=t,c(t);let{enabled:n,key:r,serialize:i}=u.current;if(!(!n||typeof window>`u`))try{let e=i?i(t):JSON.stringify(t);e===null?window.localStorage.removeItem(r):window.localStorage.setItem(r,e)}catch{return}},[])]}function If(e,t,n){let[r,i]=Ff(e,t,{enabled:n,parse:e=>e===`true`,serialize:String});return[r,(0,B.useCallback)(()=>i(e=>!e),[i])]}function Lf({children:e,className:t,defaultOpen:n,onOpenChange:r,open:i,storageKey:a,tooltip:o,trigger:s,triggerProps:c,...l}){let u=(0,B.useId)(),[d,f]=If(a??``,n??!1,i===void 0&&a!==void 0),p=i??d,{className:m,onClick:h,onKeyDown:g,..._}=c??{};function v(e){i===void 0&&e!==d&&f(),r?.(e)}function b(e){h?.(e),!(e.defaultPrevented||Rf(e.target,e.currentTarget))&&v(!p)}function S(e){g?.(e),!(e.defaultPrevented||e.target!==e.currentTarget)&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),v(!p))}return(0,q.jsxs)(`div`,{"data-slot":`collapsible`,"data-state":p?`open`:`closed`,className:t,...l,children:[(0,q.jsxs)(`div`,{..._,"aria-controls":u,"aria-expanded":p,"data-slot":`collapsible-trigger`,className:x(`flex min-h-11 w-full cursor-pointer items-center justify-between gap-4 rounded-lt-sm py-2 text-left text-lt-fg transition-colors select-none hover:bg-lt-muted focus-visible:ring-[length:var(--lt-ring-width)] focus-visible:ring-lt-ring/50 focus-visible:outline-none`,m),onClick:b,onKeyDown:S,role:`button`,tabIndex:0,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[s,o?(0,q.jsx)(Pt,{content:o}):null]}),(0,q.jsx)(y,{name:`chevron-down`,className:x(`size-lt-icon-md shrink-0 text-lt-muted-fg transition-transform motion-reduce:transition-none`,!p&&`-rotate-90`)})]}),p&&e!=null?(0,q.jsx)(`div`,{id:u,"data-slot":`collapsible-content`,className:`flex flex-col gap-4 pt-2`,children:e}):null]})}function Rf(e,t){if(!(e instanceof Element))return!1;let n=e.closest(`a[href], button, input, select, textarea, [contenteditable="true"], [role="button"]`);return n!==null&&n!==t}function zf(e,t,n){let r=Object.entries(e??{});if(r.length!==0)return Object.fromEntries(r.map(([e,r])=>[`${t}-${e}`,n(r)]))}var Bf=e=>typeof e==`number`?`repeat(${e}, minmax(0, 1fr))`:e,Vf=e=>e===`full`?`1 / -1`:`span ${e} / span ${e}`;function Hf({className:e,columns:t,style:n,...r}){return(0,q.jsx)(`div`,{"data-slot":`grid`,className:x(`lt-grid grid gap-x-4 gap-y-6`,e),style:{...n,...zf(t,`--lt-grid-cols`,Bf)},...r})}function Uf({className:e,columnSpan:t,style:n,...r}){return(0,q.jsx)(`div`,{"data-slot":`grid-item`,className:e,style:{...n,...zf(t,`--lt-col-span`,Vf)},...r})}function Wf(e){let t=[];for(let n of e){let e=n.group??null,r=t.find(t=>t.label===e);if(r){r.options.push(n);continue}t.push({label:e,options:[n]})}return t.sort((e,t)=>Number(e.label!==null)-Number(t.label!==null))}function Gf(e,t){let n=t.filter(t=>e.includes(t)).length;return n===0?!1:n===t.length||`indeterminate`}function Kf({bulkToggleable:e=!1,collapsed:t=!1,collapsible:n=!1,columns:r,disabled:i=!1,idPrefix:a,onChange:o,options:s,readOnly:c=!1,testId:l,value:u}){let{t:d}=N(`lattice`),f=d(`form.checkbox-group.select-all`,`Select all`),p=Wf(s);function m(e){o(u.includes(e)?u.filter(t=>t!==e):[...u,e])}function h(e){o(Gf(u,e)===!0?u.filter(t=>!e.includes(t)):[...u,...e.filter(e=>!u.includes(e))])}function g(e,t,n){return(0,q.jsx)(Pf,{"aria-label":t,"aria-readonly":c&&!i?!0:void 0,checked:Gf(u,e),"data-test":`${l}-toggle-${n}`,disabled:i,onCheckedChange:()=>{c||h(e)}})}function _(e){return(0,q.jsx)(Hf,{className:`gap-y-3`,columns:r??{default:1},children:e.options.map(e=>{let t=`${a}-${e.value}`;return(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(Pf,{"aria-readonly":c&&!i?!0:void 0,checked:u.includes(e.value),className:`mt-0.5`,"data-test":`${l}-${e.value}`,disabled:i,id:t,onCheckedChange:()=>{c||m(e.value)}}),(0,q.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center`,children:[(0,q.jsx)(ct,{htmlFor:t,children:e.label}),(0,q.jsx)(Pt,{content:e.tooltip})]}),e.description&&(0,q.jsx)(`p`,{className:`text-sm text-lt-muted-fg`,children:e.description})]})]},e.value)})})}return(0,q.jsxs)(`div`,{className:`grid gap-4`,children:[e&&s.length>0&&(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g(s.map(e=>e.value),f,`all`),(0,q.jsx)(`span`,{className:`text-sm text-lt-muted-fg`,children:f})]}),p.map(r=>{if(r.label===null)return(0,q.jsx)(`div`,{children:_(r)},`ungrouped`);let i=(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e&&g(r.options.map(e=>e.value),r.label,r.label),(0,q.jsx)(`span`,{className:`text-sm font-medium text-lt-fg`,children:r.label})]});return n?(0,q.jsx)(Lf,{"data-test":`${l}-group-${r.label}`,defaultOpen:!t,trigger:i,children:_(r)},r.label):(0,q.jsxs)(`div`,{className:`grid gap-3`,children:[i,_(r)]},r.label)})]})}var qf=b(x(`relative inline-flex shrink-0 items-center justify-center rounded-lt-sm transition-colors`,`outline-none focus-visible:ring-[length:var(--lt-ring-width)] focus-visible:ring-lt-ring/50`,`disabled:pointer-events-none disabled:bg-lt-disabled disabled:text-lt-disabled-fg`),{variants:{emphasis:{ghost:x(`text-lt-muted-fg hover:bg-lt-accent hover:text-lt-accent-fg`,`data-[state=open]:bg-lt-accent data-[state=open]:text-lt-accent-fg`,`aria-pressed:bg-lt-accent aria-pressed:text-lt-accent-fg`),segmented:x(`-ml-px rounded-l-none border border-lt-input text-lt-muted-fg hover:bg-lt-accent hover:text-lt-accent-fg`,`data-[state=open]:z-10 data-[state=open]:border-lt-primary data-[state=open]:text-lt-fg`)},size:{xs:`size-5 [&_svg]:size-lt-icon-sm`,sm:`size-7 [&_svg]:size-lt-icon-md`,md:`size-lt-control-md [&_svg]:size-lt-icon-md`}},defaultVariants:{emphasis:`ghost`,size:`sm`}});function Jf({icon:e,label:t,active:n,size:r,emphasis:i,className:a,children:o,ref:s,...c}){return(0,q.jsxs)(`button`,{ref:s,type:`button`,"aria-label":t,"aria-pressed":n,className:x(qf({emphasis:i,size:r}),a),...c,children:[e?(0,q.jsx)(y,{name:e,"aria-hidden":`true`}):null,o]})}function Yf({disabled:e=!1,hiddenInputs:t,image:n=!1,inputProps:r,inputRef:i,items:a,onFilesAdded:o,onRemove:s,resetOnSelect:c=!1,testId:l}){let{t:u}=N(`lattice`);return(0,q.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lt-sm border border-dashed border-lt-border bg-lt-surface px-4 py-6`,"data-test":l,onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),o(e.dataTransfer.files)},children:[(0,q.jsx)(`button`,{className:`text-sm text-lt-muted-fg`,disabled:e,onClick:()=>i.current?.click(),type:`button`,children:u(`form.file-upload.dropzone`,`Drop files here or click to browse`)}),(0,q.jsx)(`ul`,{className:n?`grid grid-cols-1 gap-3 sm:grid-cols-2`:`flex flex-col gap-2`,children:a.map(t=>(0,q.jsxs)(`li`,{className:n?`flex min-w-0 items-center gap-3 rounded-lt-sm border border-lt-border bg-lt-bg p-2 text-sm`:`flex items-center justify-between gap-3 text-sm`,children:[n&&t.url?(0,q.jsx)(`img`,{alt:t.name,className:`size-16 shrink-0 rounded-lt-sm border border-lt-border object-cover`,"data-test":t.previewTestId,src:t.url}):null,(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block truncate`,"data-test":t.itemTestId,children:t.name}),t.status===`uploading`&&(0,q.jsxs)(`span`,{className:`text-xs text-lt-muted-fg`,children:[t.progress,`%`]}),t.status===`error`&&(0,q.jsx)(`span`,{className:`text-xs text-lt-danger`,children:u(`form.file-upload.failed`,`Failed`)})]}),t.removable&&(0,q.jsx)(Jf,{size:`sm`,icon:`x`,label:u(`form.file-upload.remove`,`Remove {{name}}`,{name:t.name}),"data-test":t.removeTestId,disabled:e,onClick:()=>s(t.id)})]},t.id))}),t,(0,q.jsx)(`input`,{...r,className:`sr-only`,onChange:e=>{o(e.target.files),c&&(e.target.value=``)},ref:i,type:`file`})]})}function Xf(){return(Xf=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Zf(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}function Qf(e){var t=(0,B.useRef)(e),n=(0,B.useRef)(function(e){t.current&&t.current(e)});return t.current=e,n.current}var $f=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},ep=function(e){return`touches`in e},tp=function(e){return e&&e.ownerDocument.defaultView||self},np=function(e,t,n){var r=e.getBoundingClientRect(),i=ep(t)?function(e,t){for(var n=0;n<e.length;n++)if(e[n].identifier===t)return e[n];return e[0]}(t.touches,n):t;return{left:$f((i.pageX-(r.left+tp(e).pageXOffset))/r.width),top:$f((i.pageY-(r.top+tp(e).pageYOffset))/r.height)}},rp=function(e){!ep(e)&&e.preventDefault()},ip=B.memo(function(e){var t=e.onMove,n=e.onKey,r=e.onEnd,i=Zf(e,[`onMove`,`onKey`,`onEnd`]),a=(0,B.useRef)(null),o=Qf(t),s=Qf(n),c=Qf(r),l=(0,B.useRef)(null),u=(0,B.useRef)(!1),d=(0,B.useMemo)(function(){var e=function(e){rp(e),(ep(e)?e.touches.length>0:e.buttons>0)&&a.current?o(np(a.current,e,l.current)):(n(!1),c())},t=function(){n(!1),c()};function n(n){var r=u.current,i=tp(a.current),o=n?i.addEventListener:i.removeEventListener;o(r?`touchmove`:`mousemove`,e),o(r?`touchend`:`mouseup`,t)}return[function(e){var t=e.nativeEvent,r=a.current;if(r&&(rp(t),!function(e,t){return t&&!ep(e)}(t,u.current)&&r)){if(ep(t)){u.current=!0;var i=t.changedTouches||[];i.length&&(l.current=i[0].identifier)}r.focus(),o(np(r,t,l.current)),n(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),s({left:t===39?.05:t===37?-.05:0,top:t===40?.05:t===38?-.05:0}))},function(e){var t=e.which||e.keyCode;t>=37&&t<=40&&c()},n]},[s,o,c]),f=d[0],p=d[1],m=d[2],h=d[3];return(0,B.useEffect)(function(){return h},[h]),B.createElement(`div`,Xf({},i,{onTouchStart:f,onMouseDown:f,className:`react-colorful__interactive`,ref:a,onKeyDown:p,onKeyUp:m,tabIndex:0,role:`slider`}))}),ap=function(e){return e.filter(Boolean).join(` `)},op=function(e){var t=e.color,n=e.left,r=e.top,i=r===void 0?.5:r,a=ap([`react-colorful__pointer`,e.className]);return B.createElement(`div`,{className:a,style:{top:100*i+`%`,left:100*n+`%`}},B.createElement(`div`,{className:`react-colorful__pointer-fill`,style:{backgroundColor:t}}))},sp=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n};360/(2*Math.PI);var cp=function(e){return gp(lp(e))},lp=function(e){return e[0]===`#`&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?sp(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:e.length===8?sp(parseInt(e.substring(6,8),16)/255,2):1}},up=function(e){return hp(pp(e))},dp=function(e){var t=e.s,n=e.v,r=e.a,i=(200-t)*n/100;return{h:sp(e.h),s:sp(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:sp(i/2),a:sp(r,2)}},fp=function(e){var t=dp(e);return`hsl(`+t.h+`, `+t.s+`%, `+t.l+`%)`},pp=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:sp(255*[r,s,o,o,c,r][l]),g:sp(255*[c,r,r,s,o,o][l]),b:sp(255*[o,o,c,r,r,s][l]),a:sp(i,2)}},mp=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},hp=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=i<1?mp(sp(255*i)):``;return`#`+mp(t)+mp(n)+mp(r)+a},gp=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:sp(60*(s<0?s+6:s)),s:sp(a?o/a*100:0),v:sp(a/255*100),a:i}},_p=B.memo(function(e){var t=e.hue,n=e.onChange,r=e.onChangeEnd,i=ap([`react-colorful__hue`,e.className]);return B.createElement(`div`,{className:i},B.createElement(ip,{onMove:function(e){n({h:360*e.left})},onKey:function(e){n({h:$f(t+360*e.left,0,360)})},onEnd:r,"aria-label":`Hue`,"aria-valuenow":sp(t),"aria-valuemax":`360`,"aria-valuemin":`0`},B.createElement(op,{className:`react-colorful__hue-pointer`,left:t/360,color:fp({h:t,s:100,v:100,a:1})})))}),vp=B.memo(function(e){var t=e.hsva,n=e.onChange,r=e.onChangeEnd,i={backgroundColor:fp({h:t.h,s:100,v:100,a:1})};return B.createElement(`div`,{className:`react-colorful__saturation`,style:i},B.createElement(ip,{onMove:function(e){n({s:100*e.left,v:100-100*e.top})},onKey:function(e){n({s:$f(t.s+100*e.left,0,100),v:$f(t.v-100*e.top,0,100)})},onEnd:r,"aria-label":`Color`,"aria-valuetext":`Saturation `+sp(t.s)+`%, Brightness `+sp(t.v)+`%`},B.createElement(op,{className:`react-colorful__saturation-pointer`,top:1-t.v/100,left:t.s/100,color:fp(t)})))}),yp=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},bp=function(e,t){return e.toLowerCase()===t.toLowerCase()||yp(lp(e),lp(t))};function xp(e,t,n,r){var i=Qf(n),a=Qf(r),o=(0,B.useState)(function(){return e.toHsva(t)}),s=o[0],c=o[1],l=(0,B.useRef)({color:t,hsva:s}),u=(0,B.useRef)(!1);return(0,B.useEffect)(function(){if(!e.equal(t,l.current.color)){var n=e.toHsva(t);l.current={hsva:n,color:t},c(n),u.current=!1}},[t,e]),(0,B.useEffect)(function(){var t;yp(s,l.current.hsva)||e.equal(t=e.fromHsva(s),l.current.color)||(l.current={hsva:s,color:t},i(t),u.current=!0)},[s,e,i]),[s,(0,B.useCallback)(function(e){c(function(t){return Object.assign({},t,e)})},[]),(0,B.useCallback)(function(){u.current&&(u.current=!1,a(l.current.color))},[a])]}var Sp,Cp=typeof window<`u`?B.useLayoutEffect:B.useEffect,wp=function(){return Sp||(typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0)},Tp=new WeakMap,Ep=function(e){Cp(function(){var t=e.current;if(typeof document<`u`&&t){var n=t.getRootNode?t.getRootNode():t.ownerDocument,r=n&&(`head`in n||`host`in n)?n:t.ownerDocument;if(!Tp.has(r)){var i=`head`in r?r.head:r,a=(i.ownerDocument||document).createElement(`style`);a.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`;var o=wp();o&&a.setAttribute(`nonce`,o),Tp.set(r,a),i.appendChild(a)}}},[])},Dp=function(e){var t=e.className,n=e.colorModel,r=e.color,i=r===void 0?n.defaultColor:r,a=e.onChange,o=e.onChangeEnd,s=Zf(e,[`className`,`colorModel`,`color`,`onChange`,`onChangeEnd`]),c=(0,B.useRef)(null);Ep(c);var l=xp(n,i,a,o),u=l[0],d=l[1],f=l[2],p=ap([`react-colorful`,t]);return B.createElement(`div`,Xf({},s,{ref:c,className:p}),B.createElement(vp,{hsva:u,onChange:d,onChangeEnd:f}),B.createElement(_p,{hue:u.h,onChange:d,onChangeEnd:f,className:`react-colorful__last-control`}))},Op={defaultColor:`000`,toHsva:cp,fromHsva:function(e){return up({h:e.h,s:e.s,v:e.v,a:1})},equal:bp},kp=function(e){return B.createElement(Dp,Xf({},e,{colorModel:Op}))};function Ap(e){let t=e.trim().replace(/^#/,``).toLowerCase();return/^[0-9a-f]{6}$/.test(t)?`#${t}`:/^[0-9a-f]{3}$/.test(t)?`#${t[0]}${t[0]}${t[1]}${t[1]}${t[2]}${t[2]}`:null}function jp({value:e,onChange:t,palette:n,hexLabel:r=`Hex color`,paletteLabel:i=`Color palette`}){let[a,o]=(0,B.useState)(null),s=Ap(e)??`#6b7280`;return(0,q.jsxs)(`div`,{className:`flex w-56 flex-col gap-3`,"data-slot":`color-picker`,children:[(0,q.jsx)(kp,{className:`!w-full`,color:s,onChange:t}),n.length>0&&(0,q.jsx)(`div`,{"aria-label":i,className:`flex flex-wrap gap-1.5`,role:`listbox`,children:n.map(e=>{let n=Ap(e)??e;return(0,q.jsx)(`button`,{"aria-label":n,"aria-selected":n===s,className:x(`size-6 shrink-0 rounded-full border border-lt-border`,n===s&&`ring-2 ring-lt-ring ring-offset-1`),onClick:()=>t(n),role:`option`,style:{background:e},type:`button`},e)})}),(0,q.jsx)(nn,{"aria-label":r,onBlur:()=>o(null),onChange:e=>{let n=e.target.value,r=Ap(n);o(n),r!==null&&t(r)},value:a??s})]})}function Mp({addLabel:e,options:t,onSelect:n,icon:r,testId:i=`builder-add`}){return(0,q.jsxs)(Dt,{children:[(0,q.jsx)(Ye,{asChild:!0,children:r?(0,q.jsx)(`button`,{type:`button`,"aria-label":e,title:e,"data-test":i,className:`text-lt-muted-fg hover:text-lt-fg [&_svg]:size-lt-icon-sm`,children:(0,q.jsx)(y,{name:r})}):(0,q.jsxs)(`button`,{type:`button`,"data-test":i,className:`inline-flex items-center gap-1.5 self-start rounded-lt-sm border border-lt-border px-3 py-1.5 text-sm hover:bg-lt-accent [&_svg]:size-lt-icon-sm`,children:[(0,q.jsx)(y,{name:`plus`}),e]})}),(0,q.jsx)(mt,{align:`start`,className:`min-w-[12rem]`,children:t.map(e=>(0,q.jsx)(dt,{"data-test":`${i}-${e.type}`,onClick:()=>n(e.type),children:e.label},e.type))})]})}var Np={duplicate:{key:`table.row-actions.duplicate`,fallback:`Duplicate`,icon:`copy`},remove:{key:`table.row-actions.remove`,fallback:`Remove`,icon:`trash-2`}};function Pp(e,t){return(e??Fp(t.removable)).map(e=>Ip(e,t)).filter(e=>e!==null)}function Fp(e){return e?[{type:`remove`,key:`remove`,label:null,icon:null,danger:!0}]:[]}function Ip(e,t){if(e.type===`duplicate`){let n=Np.duplicate;return{key:e.key,label:e.label??t.t(n.key,n.fallback),icon:e.icon??n.icon,danger:e.danger,onClick:()=>t.onDuplicate(t.index)}}if(e.type===`remove`){if(!t.removable)return null;let n=Np.remove;return{key:e.key,label:e.label??t.t(n.key,n.fallback),icon:e.icon??n.icon,danger:e.danger,onClick:()=>t.onRemove(t.index)}}return null}function Lp(e){return e?`text-lt-danger hover:text-lt-danger [&_svg]:size-lt-icon-sm`:`text-lt-muted-fg hover:text-lt-fg [&_svg]:size-lt-icon-sm`}function Rp({actions:e}){let{t}=N(`lattice`);if(e.length===0)return null;if(e.length===1){let t=e[0];return(0,q.jsx)(`button`,{type:`button`,"aria-label":t.label,"data-test":`row-action-${t.key}`,className:Lp(t.danger),onClick:t.onClick,children:(0,q.jsx)(y,{name:t.icon})})}return(0,q.jsxs)(Dt,{children:[(0,q.jsx)(Ye,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,"aria-label":t(`common.action-group.label`,`Actions`),"data-test":`row-actions-menu`,className:`text-lt-muted-fg hover:text-lt-fg [&_svg]:size-lt-icon-sm`,children:(0,q.jsx)(y,{name:`more-horizontal`})})}),(0,q.jsx)(mt,{align:`end`,className:`min-w-[10rem]`,children:e.map(e=>(0,q.jsx)(dt,{"data-test":`row-action-${e.key}`,danger:e.danger,icon:e.icon,onClick:e.onClick,children:e.label},e.key))})]})}function zp({path:e,rows:t,rowKey:n}){return(0,q.jsx)(q.Fragment,{children:t.map((t,r)=>(0,q.jsx)(`input`,{type:`hidden`,name:Ft(Be(e,r,n)),value:String(t[n]??``)},String(t.rowId??r)))})}function Bp({label:e,testId:t,onClick:n,children:r}){return(0,q.jsx)(`button`,{type:`button`,"aria-label":e,"data-test":t,className:`text-lt-muted-fg hover:text-lt-fg`,onClick:n,children:r})}var Vp=(0,B.memo)(function({base:e,index:t,row:n,template:r,heading:i,reorderable:a,isFirst:o,isLast:s,removable:c,rowActions:l,onField:u,onRemove:d,onMove:f,onDuplicate:p}){let{t:m}=N(`lattice`);return(0,q.jsxs)(`div`,{"data-test":`repeater-${e}-row-${t}`,className:`rounded-lt border border-lt-border bg-lt-surface p-4`,children:[(0,q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,q.jsx)(`span`,{className:`text-sm font-medium text-lt-muted-fg`,children:i}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1 [&_svg]:size-lt-icon-sm`,children:[a&&!o&&(0,q.jsx)(Bp,{label:`Move up`,testId:`repeater-${e}-up-${t}`,onClick:()=>f(t,-1),children:(0,q.jsx)(y,{name:`arrow-up`})}),a&&!s&&(0,q.jsx)(Bp,{label:`Move down`,testId:`repeater-${e}-down-${t}`,onClick:()=>f(t,1),children:(0,q.jsx)(y,{name:`arrow-down`})}),(0,q.jsx)(Rp,{actions:Pp(l,{index:t,removable:c,onRemove:d,onDuplicate:p,t:m})})]})]}),(0,q.jsx)(Te,{base:e,index:t,row:n,onChange:(e,n)=>u(t,e,n),children:(0,q.jsx)(`div`,{className:`flex flex-col gap-4`,children:r.map((e,t)=>(0,q.jsx)(Xt,{node:e},pe(e,t)))})})]})}),Hp={xs:{track:`minmax(4rem, 0.35fr)`,minPx:64,defaultPx:96},sm:{track:`minmax(6rem, 0.5fr)`,minPx:96,defaultPx:128},md:{track:`minmax(8rem, 1fr)`,minPx:128,defaultPx:176},lg:{track:`minmax(12rem, 1.5fr)`,minPx:192,defaultPx:240},xl:{track:`minmax(16rem, 2fr)`,minPx:256,defaultPx:320}},Up=1024;function Wp(e){return Hp[e].track}function Gp(e){return Hp[e.width].minPx}function Kp(e){return Hp[e.width].defaultPx}function qp(e,t){return Math.min(Up,Math.max(Gp(e),t))}function Jp({columns:e,leadingTracks:t=[],trailingTracks:n=[],overrides:r={}}){return e.some(e=>e.pin!=null)?Yp({columns:e,leadingTracks:t,trailingTracks:n,overrides:r}):[...t,...e.map(e=>{let t=r[e.key];return t===void 0?Wp(e.width):`${qp(e,t)}px`}),...n].join(` `)}function Yp({columns:e,leadingTracks:t,trailingTracks:n,overrides:r}){let i=e.map(e=>`${qp(e,r[e.key]??Kp(e))}px`),a=e.findIndex(e=>e.pin===`end`);return i.splice(a===-1?i.length:a,0,`minmax(0, 1fr)`),[...t,...i,...n].join(` `)}function Xp({columns:e,leadingTracks:t=[],trailingTracks:n=[],overrides:r={},hasExpander:i=!1,hasSelection:a=!1,hasActions:o=!1}){if(!e.some(e=>e.pin!=null))return{};let s=e=>qp(e,r[e.key]??Kp(e)),c=Zp(t),l=Zp(n),u={},d=0;e.forEach((e,t)=>{e.pin===`start`&&(u[`--lt-pin-offset-${t}`]=$p(c,d),d+=s(e))});let f=0;for(let t=e.length-1;t>=0;--t){let n=e[t];n.pin===`end`&&(u[`--lt-pin-offset-${t}`]=$p(l,f),f+=s(n))}return i&&(u[`--lt-pin-offset-expander`]=`0px`),a&&(u[`--lt-pin-offset-selection`]=i?$p(Zp(t.slice(0,1)),0):`0px`),o&&(u[`--lt-pin-offset-actions`]=`0px`),u}function Zp(e){return e.reduce((e,t)=>e+Qp(t),0)}function Qp(e){let t=e.trim().match(/^([0-9.]+)rem$/);return t?Number.parseFloat(t[1]):0}function $p(e,t){return e===0&&t===0?`0px`:e===0?`${t}px`:t===0?`${e}rem`:`calc(${e}rem + ${t}px)`}var em=[];function tm({columnGapPx:e=0,columns:t,enabled:n,hasActions:r=!1,hasExpander:i=!1,hasSelection:a=!1,leadingTracks:o=em,showIndicator:s=!1,storageKey:c,trailingTracks:l=em}){let u=(0,B.useMemo)(()=>t.map(e=>e.key),[t]),[d,f]=Ff(c??``,{},{enabled:!!c,parse:e=>rm(e,t),serialize:e=>im(e,u)}),p=(0,B.useRef)(d),m=(0,B.useRef)(null),h=(0,B.useRef)(null),g=(0,B.useCallback)(e=>Jp({columns:t,leadingTracks:o,trailingTracks:l,overrides:n?e:{}}),[t,n,o,l]),_=(0,B.useCallback)(e=>Xp({columns:t,hasActions:r,hasExpander:i,hasSelection:a,leadingTracks:o,overrides:n?e:{},trailingTracks:l}),[t,n,r,i,a,o,l]),v=(0,B.useMemo)(()=>g(d),[d,g]),y=(0,B.useMemo)(()=>_(d),[d,_]),b=(0,B.useRef)([]),x=(0,B.useCallback)((e,t)=>{let n=h.current;if(n){n.style.gridTemplateColumns=e,n.style.setProperty(`--lattice-table-columns`,e);for(let e of b.current)e in t||n.style.removeProperty(e);for(let[e,r]of Object.entries(t))n.style.setProperty(e,r);b.current=Object.keys(t)}},[]),S=(0,B.useCallback)(e=>{x(g(e),_(e))},[x,_,g]),C=(0,B.useCallback)(e=>{p.current=e,f(e),S(e)},[S,f]),w=(0,B.useCallback)((e,t,n,r)=>({...e,[t.key]:Math.min(r??1024,Math.max(Gp(t),n))}),[]),T=(0,B.useCallback)((e,t,n)=>{C(w(p.current,e,t,n))},[C,w]),E=(0,B.useCallback)(e=>{let t={...p.current};delete t[e.key],C(t)},[C]),D=(0,B.useCallback)(()=>{C({})},[C]),O=n&&Object.values(d).some(e=>typeof e==`number`),k=(0,B.useCallback)(e=>p.current[e.key]??Kp(e),[]);return{getResizeHandleProps:(0,B.useCallback)(r=>{let i=Up,a=Gp(r),c=k(r),u=r.label??r.key,d=s?`after:bg-lt-border`:`after:bg-transparent`,f=n=>nm({column:r,columnGapPx:e,columns:t,grid:h.current??n.parentElement?.parentElement,leadingTracks:o,trailingTracks:l}),g=(e,t)=>T(r,c+t,f(e)),_=(e,t)=>{let n=m.current;n?.key===r.key&&(m.current=null,n.overrides!==null&&C(n.overrides),t&&e.currentTarget.releasePointerCapture?.(e.pointerId))};return{"aria-label":`Resize ${u}`,"aria-orientation":`vertical`,"aria-valuemax":i,"aria-valuemin":a,"aria-valuenow":c,className:`absolute inset-y-0 right-0 hidden w-2 cursor-col-resize touch-none items-stretch justify-center md:flex after:my-1 after:w-px ${d} hover:after:bg-lt-border focus-visible:outline-none focus-visible:after:bg-lt-ring`,onDoubleClick:()=>E(r),onKeyDown:e=>{if(!n)return;let t=e.shiftKey?32:8;if(e.key===`ArrowLeft`&&(e.preventDefault(),g(e.currentTarget,-t)),e.key===`ArrowRight`&&(e.preventDefault(),g(e.currentTarget,t)),e.key===`Home`&&(e.preventDefault(),T(r,a)),e.key===`End`){e.preventDefault();let t=f(e.currentTarget);T(r,t,t)}(e.key===`Enter`||e.key===`Escape`)&&(e.preventDefault(),E(r))},onPointerDown:e=>{if(!n)return;let t=e.currentTarget.parentElement?.getBoundingClientRect().width??0;m.current={key:r.key,maxWidth:f(e.currentTarget),overrides:null,startWidth:t>0?t:c,startX:e.clientX},e.currentTarget.setPointerCapture?.(e.pointerId),e.preventDefault()},onPointerMove:e=>{let t=m.current;if(!n||t?.key!==r.key)return;let i=w(p.current,r,t.startWidth+e.clientX-t.startX,t.maxWidth);t.overrides=i,p.current=i,S(i)},onPointerUp:e=>{_(e,!0)},onPointerCancel:e=>{_(e,!0)},onLostPointerCapture:e=>{_(e,!1)},role:`separator`,tabIndex:0}},[e,t,k,n,o,S,C,w,E,T,s,l]),gridTemplateColumns:v,hasOverrides:O,pinOffsetVars:y,resizeRootRef:h,resetColumns:D,resetColumnWidth:E}}function nm({column:e,columnGapPx:t,columns:n,grid:r,leadingTracks:i,trailingTracks:a}){let o=r?.getBoundingClientRect().width??0;if(o<=0)return Up;let s=[...i,...a].reduce((e,t)=>e+om(t),0),c=n.reduce((t,n)=>n.key===e.key?t:t+Gp(n),0),l=n.length+i.length+a.length,u=Math.max(0,l-1)*t,d=o-s-c-u;return Math.min(Up,Math.max(Gp(e),d))}function rm(e,t){let n=JSON.parse(e)?.overrides;if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`unexpected stored column widths shape`);let r=am(n,t);if(Object.keys(r).length===0)throw Error(`stored column widths hold no usable overrides`);return r}function im(e,t){let n={},r=new Set(t);for(let[t,i]of Object.entries(e))r.has(t)&&typeof i==`number`&&Number.isFinite(i)&&(n[t]=i);return Object.keys(n).length===0?null:JSON.stringify({overrides:n})}function am(e,t){let n={};for(let r of t){let t=e[r.key];typeof t!=`number`||!Number.isFinite(t)||(n[r.key]=Math.min(Up,Math.max(Gp(r),t)))}return n}function om(e){let t=e.trim(),n=t.match(/^([0-9.]+)px$/);if(n)return Number.parseFloat(n[1]);let r=t.match(/^([0-9.]+)rem$/);return r?Number.parseFloat(r[1])*sm():0}function sm(){if(typeof window>`u`)return 16;let e=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:16}function cm(e,t){return typeof window>`u`||typeof window.matchMedia!=`function`?t:window.matchMedia(e).matches}function lm(e,t=!1){let[n,r]=(0,B.useState)(()=>cm(e,t));return(0,B.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),n=()=>r(t.matches);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),n}var um=`3rem`,dm=`3rem`,fm=[um],pm=[dm],mm=`(min-width: 768px)`;function hm(){return lm(mm,!0)}function gm(e){return e.map(e=>{let t=e.props;return{name:String(t.name),label:String(t.label??t.name),columnWidth:t.columnWidth??`md`}})}var _m=(0,B.memo)(function({base:e,index:t,row:n,template:r,span:i,isFirst:a,isLast:o,columnCount:s,flipKey:c,reorderable:l,removable:u,rowActions:d,onField:f,onMove:p,onRemove:m,onDuplicate:h,registerRow:g}){let{t:_}=N(`lattice`);return(0,q.jsxs)(`div`,{ref:e=>g?.(c,e),"data-flip-key":c,"data-test":`table-row-${e}-${t}`,className:`grid grid-cols-[var(--lattice-table-columns)] items-start gap-x-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1 [&_svg]:size-lt-icon-sm`,children:[l&&!a&&(0,q.jsx)(Bp,{label:`Move up`,testId:`table-${e}-up-${t}`,onClick:()=>p(t,-1),children:(0,q.jsx)(y,{name:`arrow-up`})}),l&&!o&&(0,q.jsx)(Bp,{label:`Move down`,testId:`table-${e}-down-${t}`,onClick:()=>p(t,1),children:(0,q.jsx)(y,{name:`arrow-down`})})]}),(0,q.jsx)(Te,{base:e,index:t,row:n,onChange:(e,n)=>f(t,e,n),children:(0,q.jsx)(Kt,{children:i?(0,q.jsx)(`div`,{"data-test":`table-row-${e}-${t}-span`,className:`flex flex-col gap-2`,style:{gridColumn:`span ${s}`},children:r.map((e,t)=>(0,q.jsx)(Xt,{node:e},pe(e,t)))}):r.map((e,t)=>(0,q.jsx)(`div`,{children:(0,q.jsx)(Xt,{node:e})},pe(e,t)))})}),(0,q.jsx)(`div`,{className:`flex items-center`,children:(0,q.jsx)(Rp,{actions:Pp(d,{index:t,removable:u,onRemove:m,onDuplicate:h,t:_})})})]})});function vm({base:e,columns:t,rows:n,reorderable:r,removable:i,rowActions:a,onField:o,onMove:s,onRemove:c,onDuplicate:l,registerRow:u,resizableColumns:d=!1,resizeIndicator:f=!1}){let{t:p}=N(`lattice`),m=hm(),h=(0,B.useMemo)(()=>t.map(e=>({key:e.name,label:e.label,width:e.columnWidth})),[t]),{getResizeHandleProps:g,gridTemplateColumns:_,hasOverrides:v,resizeRootRef:b,resetColumns:x}=tm({columns:h,enabled:d,columnGapPx:12,leadingTracks:fm,showIndicator:f,storageKey:d?`lattice:table-columns:form:${e}`:void 0,trailingTracks:pm});return m?(0,q.jsxs)(`div`,{className:`relative`,children:[v&&(0,q.jsx)(`button`,{"aria-label":p(`table.reset-column-widths`,`Reset column widths`),className:`absolute right-1 top-1 z-10 hidden rounded-lt-sm p-1 text-lt-muted-fg hover:text-lt-fg md:inline-flex`,"data-test":`table-reset-columns`,onClick:x,title:p(`table.reset-column-widths`,`Reset column widths`),type:`button`,children:(0,q.jsx)(y,{name:`rotate-ccw`,className:`size-lt-icon-sm`})}),(0,q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,q.jsxs)(`div`,{ref:b,className:`flex min-w-max flex-col gap-2`,style:{"--lattice-table-columns":_},children:[(0,q.jsxs)(`div`,{className:`grid grid-cols-[var(--lattice-table-columns)] items-center gap-x-3`,children:[(0,q.jsx)(`div`,{}),t.map((e,t)=>(0,q.jsxs)(`div`,{className:`relative min-w-0 pr-3 text-xs font-medium text-lt-muted-fg`,children:[e.label,d&&(0,q.jsx)(`div`,{...g(h[t])})]},e.name)),(0,q.jsx)(`div`,{})]}),n.map(d=>(0,q.jsx)(_m,{base:e,index:d.index,row:d.row,template:d.template,span:d.span,isFirst:d.index===0,isLast:d.index===n.length-1,columnCount:t.length,flipKey:d.key,reorderable:r,removable:i(d.index),rowActions:a,onField:o,onMove:s,onRemove:c,onDuplicate:l,registerRow:u},d.key))]})})]}):(0,q.jsx)(`div`,{className:`flex flex-col gap-3`,children:n.map(t=>(0,q.jsx)(`div`,{ref:e=>u?.(t.key,e),"data-flip-key":t.key,children:(0,q.jsx)(Vp,{base:e,index:t.index,row:t.row,template:t.template,heading:t.heading??`#${t.index+1}`,reorderable:r,isFirst:t.index===0,isLast:t.index===n.length-1,removable:i(t.index),rowActions:a,onField:o,onRemove:c,onMove:s,onDuplicate:l})},t.key))})}var ym=180;function bm(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}function xm(e){let t=(0,B.useRef)(new Map),n=(0,B.useRef)(new Map),r=(0,B.useCallback)((e,n)=>{n?t.current.set(e,n):t.current.delete(e)},[]);return Ud(()=>{let e=[],r=new Map;return t.current.forEach((e,t)=>{e.style.transition=``,e.style.transform=``,r.set(t,e.getBoundingClientRect())}),bm()||t.current.forEach((t,i)=>{let a=n.current.get(i),o=r.get(i);if(a&&o){let n=a.top-o.top;n&&(t.style.transform=`translateY(${n}px)`,e.push(requestAnimationFrame(()=>{t.style.transition=`transform ${ym}ms ease-out`,t.style.transform=``})))}}),n.current=r,()=>{for(let t of e)cancelAnimationFrame(t)}},[e]),r}function Sm(e,t){let n=Ee(),r=n?n.errorKey(e):e,i=yt(),a=De(r),o=Array.isArray(a)?a:ye(a,t),s=$t(o);Ud(()=>{s!==o&&i(r,s)},[o,s,i,r]);let c=(0,B.useCallback)(e=>{i(r,n=>e(Array.isArray(n)?n:ye(n,t)))},[i,r,t]);return{path:r,rows:s,onField:(0,B.useCallback)((e,t,n)=>c(r=>r.map((r,i)=>i===e?{...r,[t]:n}:r)),[c]),onRemove:(0,B.useCallback)(e=>c(t=>Re(t,e)),[c]),onMove:(0,B.useCallback)((e,t)=>c(n=>de(n,e,e+t)),[c]),onDuplicate:(0,B.useCallback)(e=>c(t=>Me(t,e)),[c]),append:(0,B.useCallback)(e=>c(t=>[...t,Ie(e)]),[c]),insert:(0,B.useCallback)((e,t)=>c(n=>[...n.slice(0,e),Ie(t),...n.slice(e)]),[c])}}var Cm=[],wm=({node:e})=>{let t=e.props,n=t.name,r=t.templates,{errors:i}=at(),{hidden:a,required:o}=tt(e),{path:s,rows:c,onField:l,onRemove:u,onMove:d,onDuplicate:f,append:p}=Sm(n,t.defaultItems??0),{t:m}=N(`lattice`),h=xm(c.map(e=>String(e.rowId??``)).join(`,`)),g=t.maxItems!=null&&c.length>=t.maxItems,_=t.minItems!=null&&c.length<=t.minItems,v=t.layout===`table`,y=e=>r.find(t=>t.type===e),b=r.map(e=>({type:e.type,label:e.label}));if(a)return null;let x=r[0],S=c.map((e,t)=>{let n=y(e.type),r=!!n&&!!x&&n.type===x.type;return{key:String(e.rowId??t),index:t,row:e,template:n?.schema??Cm,span:!r,heading:n?.label??`Unknown block: ${String(e.type)}`}});return(0,q.jsx)(it,{error:i[s],helperText:t.helperText??void 0,tooltip:t.tooltip??void 0,labelAction:Ht(t.labelAction),label:t.label??``,id:s,required:o,children:e=>(0,q.jsxs)(`div`,{...e,className:`flex flex-col gap-3`,role:`group`,children:[(0,q.jsx)(zp,{path:s,rows:c,rowKey:be}),(0,q.jsx)(zp,{path:s,rows:c,rowKey:`type`}),v?(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(vm,{base:s,columns:gm(x?.schema??[]),rows:S,reorderable:t.reorderable??!1,removable:()=>!_,rowActions:t.rowActions,onField:l,onMove:d,onRemove:u,onDuplicate:f,registerRow:h,resizableColumns:t.resizableColumns===!0,resizeIndicator:t.resizeIndicator===!0})}):c.map((e,r)=>{let i=y(e.type),a=String(e.rowId??r);return(0,q.jsx)(`div`,{ref:e=>h(a,e),"data-flip-key":a,children:i?(0,q.jsx)(Vp,{base:s,index:r,row:e,template:i.schema??Cm,heading:i.label,reorderable:t.reorderable??!1,isFirst:r===0,isLast:r===c.length-1,removable:!_,rowActions:t.rowActions,onField:l,onRemove:u,onMove:d,onDuplicate:f}):(0,q.jsxs)(`div`,{"data-test":`repeater-${n}-row-${r}`,className:`flex items-center justify-between rounded-lt border border-dashed border-lt-border p-4 text-sm text-lt-muted-fg`,children:[(0,q.jsxs)(`span`,{children:[`Unknown block: `,String(e.type)]}),(0,q.jsx)(Rp,{actions:Pp(t.rowActions,{index:r,removable:!_,onRemove:u,onDuplicate:f,t:m})})]})},a)}),!g&&(0,q.jsx)(Mp,{addLabel:t.addLabel??`Add`,options:b,onSelect:e=>p({type:e})})]})})};function Tm(e,t){if(!t)return e;let n=e.replace(/[^A-Za-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``);return n?`${t}-${n}`:t}function Em(e){let{errors:t,fieldIdPrefix:n}=at(),r=Ee(),i=tt(e),a=Se(e),o=a.name??``,s=De(o),c=r?r.getValue(o):s,l=c===void 0?a.value:c,u=typeof l==`string`||typeof l==`number`?String(l):``,d=Tm(r?r.scopedName(o):o,n),f=r?r.errorKey(o):o,{commit:p,change:m,blur:h}=ge(),g=e=>p(o,e),_=e=>m(o,e),v=()=>h(o);return{...i,localName:o,name:d,testId:Yl(o),rawValue:l,value:u,error:t[f],commit:g,change:_,blur:v}}function Dm(e,t){let n=Ee(),r=De(e),i=n?n.getValue(e):r,a=yt();(0,B.useEffect)(()=>{i==null&&t!==void 0&&(n?n.setValue(e,t):a(e,t))},[e,t,i,a,n])}var Om=({node:e})=>{let t=Em(e),n=wt(t.rawValue);return Dm(t.localName,wt(e.props.value)),t.hidden?null:(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,q.jsx)(Pf,{"aria-readonly":t.readOnly&&!t.disabled?!0:void 0,autoFocus:e.props.autoFocus??void 0,checked:n,"data-test":t.testId,disabled:t.disabled,id:t.name,name:t.name,onCheckedChange:e=>{t.readOnly||t.commit(e===!0)},tabIndex:e.props.tabIndex??void 0}),(0,q.jsx)(ct,{htmlFor:t.name,children:e.props.label})]}),e.props.helperText&&(0,q.jsx)(`p`,{className:`mt-1 pl-7 text-sm text-lt-muted-fg`,children:e.props.helperText})]})};function km(e){return Array.isArray(e)?e.map(String):e==null||e===``?[]:[String(e)]}var Am=({node:e})=>{let t=Hd(e),{localName:n,name:r,testId:i,rawValue:a,error:o,hidden:s,required:c,readOnly:l,disabled:u,commit:d}=Em(e),f=(0,B.useMemo)(()=>t.props.options??[],[t.props]),p=km(a);return Dm(n,km(e.props.value)),s?null:(0,q.jsx)(it,{error:o,helperText:e.props.helperText??void 0,tooltip:e.props.tooltip??void 0,labelAction:Ht(e.props.labelAction),label:e.props.label??``,id:r,required:c,children:({id:t,...n})=>(0,q.jsxs)(q.Fragment,{children:[p.map(e=>(0,q.jsx)(`input`,{name:`${t}[]`,type:`hidden`,value:e},e)),(0,q.jsx)(`div`,{...n,id:t,role:`group`,children:(0,q.jsx)(Kf,{bulkToggleable:e.props.bulkToggleable,collapsed:e.props.collapsed,collapsible:e.props.collapsible,columns:e.props.columns??void 0,disabled:u,idPrefix:t,onChange:d,options:f,readOnly:l,testId:i??`checkbox-group`,value:p})})]})})},jm=new Set([`ArrowUp`,`ArrowLeft`]),Mm=new Set([`ArrowDown`,`ArrowRight`]);function Nm({ariaLabel:e,autoFocus:t=!1,className:n,disabled:r=!1,name:a,onSelect:o,optionSchema:s,options:c,tabIndex:l,value:u,...d}){let f=(0,B.useRef)(null),p=c.some(e=>e.value===u);(0,B.useEffect)(()=>{if(!t)return;let e=f.current;(e?.querySelector(`button[aria-checked="true"]`)??e?.querySelector(`button`))?.focus()},[t]);let m=e=>{if(r||c.length===0)return;let t=Mm.has(e.key)?1:jm.has(e.key)?-1:0;if(t===0)return;e.preventDefault();let n=c[(c.findIndex(e=>e.value===u)+t+c.length)%c.length];n&&(o(n.value),f.current?.querySelector(`[data-test="${a}-${n.value}"]`)?.focus())};return(0,q.jsx)(`div`,{...d,"aria-label":e,className:x(`grid w-full gap-2`,n),onKeyDown:m,ref:f,role:`radiogroup`,children:c.map((e,t)=>{let n=u===e.value,c=n||!p&&t===0;return(0,q.jsx)(`button`,{"aria-checked":n,className:x(`rounded-lt border p-4 text-left transition-colors`,n?`border-lt-primary bg-lt-accent text-lt-accent-fg`:`border-lt-border hover:border-lt-input`,r&&`cursor-not-allowed opacity-60`),"data-test":`${a}-${e.value}`,disabled:r,onClick:()=>o(e.value),role:`radio`,tabIndex:c?l??0:-1,type:`button`,children:(0,q.jsx)(Qe,{nodes:i(s,{...e.data,label:e.label,value:e.value})})},e.value)})})}function Pm(e){return x(`whitespace-nowrap rounded-lt-sm px-3 py-1.5 text-sm font-medium transition-colors`,e?`bg-lt-bg text-lt-fg shadow-lt-xs`:`text-lt-muted-fg hover:bg-lt-bg/60 hover:text-lt-fg`)}function Fm({"aria-label":e,autoFocus:t=!1,className:n,defaultValue:r,disabled:i=!1,name:a,onValueChange:o,options:s,tabIndex:c,value:l,...u}){let d=(0,B.useRef)(null),[f,p]=(0,B.useState)(r??s[0]?.value??``),m=l??f;if((0,B.useEffect)(()=>{if(!t)return;let e=d.current;(e?.querySelector(`button[aria-checked="true"]`)??e?.querySelector(`button`))?.focus()},[t]),s.length===0)return null;function h(e){l===void 0&&p(e),o?.(e)}return(0,q.jsx)(`div`,{...u,"aria-label":e,className:x(`inline-flex w-fit max-w-full gap-1 overflow-x-auto rounded-lt bg-lt-muted p-1`,n),ref:d,role:`radiogroup`,children:s.map(e=>{let t=m===e.value;return(0,q.jsx)(`button`,{"aria-checked":t,"data-test":a?`${a}-${e.value}`:void 0,className:x(Pm(t),i&&`cursor-not-allowed opacity-60`),disabled:i,onClick:()=>h(e.value),role:`radio`,tabIndex:c,type:`button`,children:e.label},e.value)})})}var Im=({node:e})=>{let t=Hd(e),{localName:n,name:r,testId:i,value:a,error:o,hidden:s,required:c,readOnly:l,disabled:u,commit:d}=Em(e),f=(0,B.useMemo)(()=>t.props.options??[],[t.props]),p=t.props.optionSchema,m=f[0]?.value??``,h=a||m;return Dm(n,h||void 0),s||f.length===0?null:(0,q.jsx)(it,{error:o,helperText:e.props.helperText??void 0,tooltip:e.props.tooltip??void 0,labelAction:Ht(e.props.labelAction),label:e.props.label??``,id:r,required:c,children:t=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`input`,{name:r,type:`hidden`,value:h}),p?.length?(0,q.jsx)(Nm,{...t,ariaLabel:e.props.label??void 0,autoFocus:e.props.autoFocus??void 0,disabled:l||u,name:i??`choice`,onSelect:d,optionSchema:p,options:f,tabIndex:e.props.tabIndex??void 0,value:h}):(0,q.jsx)(Fm,{...t,"aria-label":e.props.label??void 0,autoFocus:e.props.autoFocus??void 0,disabled:l||u,name:i??`segment`,onValueChange:d,options:f,tabIndex:e.props.tabIndex??void 0,value:h})]})})};function Lm({node:e,label:t,children:n}){let r=Em(e);return r.hidden?null:(0,q.jsx)(it,{error:r.error,helperText:Se(e).helperText??void 0,tooltip:Se(e).tooltip??void 0,labelAction:Ht(Se(e).labelAction),label:t,id:r.name,required:r.required,children:e=>n(r,e)})}var Rm=({node:e})=>{let t=e.props;return(0,q.jsx)(Lm,{node:e,label:t.label??``,children:({name:e,value:n,readOnly:r,disabled:i,commit:a},o)=>{let s=Ap(n);return(0,q.jsxs)(Zt,{children:[(0,q.jsx)(`input`,{name:e,type:`hidden`,value:s??``}),(0,q.jsx)(Pe,{asChild:!0,children:(0,q.jsx)(`button`,{...o,"aria-readonly":r&&!i?!0:void 0,className:x(tn(),`flex items-center gap-2 text-left`),"data-test":`color-picker-${e}`,disabled:i,onClick:r?e=>e.preventDefault():void 0,type:`button`,children:s?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`size-4 shrink-0 rounded-full border border-lt-border`,style:{background:s}}),(0,q.jsx)(`span`,{className:`tabular-nums`,children:s})]}):(0,q.jsx)(`span`,{className:`text-lt-muted-fg`,children:t.placeholder??``})})}),(0,q.jsx)(Jt,{className:`p-3`,children:(0,q.jsx)(jp,{onChange:e=>a(e),palette:t.palette,value:s??`#6b7280`})})]})}})},zm=(0,B.lazy)(async()=>{let{DatePickerField:e}=await dn(async()=>{let{DatePickerField:e}=await import(`./date-picker-view-tr6cuOIN.js`);return{DatePickerField:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url);return{default:e}});function Bm(e){return(0,q.jsx)(B.Suspense,{fallback:null,children:(0,q.jsx)(zm,{...e})})}var Vm=({node:e})=>{let t=e.props;return(0,q.jsx)(Lm,{node:e,label:t.label??``,children:({name:e,testId:n,value:r,readOnly:i,disabled:a,change:o,blur:s},c)=>(0,q.jsx)(Bm,{controlProps:c,autoFocus:t.autoFocus??!1,disabled:a,label:t.label??t.name,max:t.max||void 0,min:t.min||void 0,mode:`date`,name:e,onBlur:s,onChange:o,readOnly:i,tabIndex:t.tabIndex??void 0,testId:n??t.name,value:r})})},Hm=({node:e})=>{let t=e.props,{timezone:n}=ae();return(0,q.jsx)(Lm,{node:e,label:t.label??``,children:({name:e,testId:r,value:i,readOnly:a,disabled:o,change:s,blur:c},l)=>(0,q.jsx)(Bm,{controlProps:l,autoFocus:t.autoFocus??!1,disabled:o,label:t.label??t.name,max:t.max,min:t.min,mode:`date-time`,name:e,onBlur:c,onChange:s,readOnly:a,step:t.step,tabIndex:t.tabIndex??void 0,testId:r??t.name,timezone:n,value:i})})};function Um({url:e,method:t,body:n,headers:r,onProgress:i}){return new Promise((a,o)=>{let s=new XMLHttpRequest;s.open(t,e,!0),Object.entries(r).forEach(([e,t])=>s.setRequestHeader(e,String(t))),s.upload.onprogress=e=>{e.lengthComputable&&i?.(Math.round(e.loaded/e.total*100))},s.onload=()=>{try{a(new Response(s.responseText||null,{status:s.status||500}))}catch{o(Error(`Upload to ${e} returned an unusable response`))}},s.onerror=()=>o(Error(`Upload to ${e} failed`)),s.send(n)})}function Wm(e,{ref:t,target:n,filename:r,contentType:i,values:a}){return Vu(e,{method:`POST`,ref:t,body:JSON.stringify({...a,_sub:`upload`,_target:n,filename:r,contentType:i}),throwOnError:!1})}function Gm(e,t){return Array.isArray(t)?Array.isArray(e)&&e.length===t.length&&e.every((e,n)=>e===t[n]):e===t}var Km=({node:e})=>{let t=e.props,{hidden:n,required:r,readOnly:i,disabled:a}=tt(e),{action:o,componentRef:s,errors:c}=at(),l=t.name,u=Ee(),d=u?u.scopedName(l):l,f=u?u.errorKey(l):l,p=f,m=xt(),h=yt(),g=(0,B.useId)(),_=(0,B.useRef)(null),v=(0,B.useRef)(new Set),y=i||a,b=t.signed,x=t.multiple,S=x?`${d}[]`:d,C=(0,B.useMemo)(()=>(t.files??[]).map(e=>({id:crypto.randomUUID(),name:e.name,size:e.size,status:`ready`,progress:100,key:e.key,url:e.url,token:e.token,existing:!0})),[t.files]),[w,T]=(0,B.useState)(C),[E,D]=(0,B.useState)([]);(0,B.useEffect)(()=>{if(!b)return;let e=w.filter(e=>!e.existing&&e.key&&e.status===`ready`).map(e=>e.key),t=x?e:e[0]??``;if(u){Gm(u.getValue(l),t)||u.setValue(l,t);return}h(l,t)},[w,x,l,u,h,b]),(0,B.useEffect)(()=>{!b||u||h(`${l}__removed`,E)},[l,E,u,h,b]),(0,B.useEffect)(()=>()=>{v.current.forEach(e=>URL.revokeObjectURL(e)),v.current.clear()},[]);let O=(0,B.useMemo)(()=>w.filter(e=>e.file&&!e.existing).map(e=>e.file),[w]);(0,B.useEffect)(()=>{if(b||!_.current)return;let e=new DataTransfer;O.forEach(t=>e.items.add(t)),_.current.files=e.files},[O,b]);function k(e){if(!t.image)return;let n=URL.createObjectURL(e);return v.current.add(n),n}function ee(e){!e.url||!v.current.has(e.url)||(URL.revokeObjectURL(e.url),v.current.delete(e.url))}async function A(e,t){let n=()=>{T(t=>t.map(t=>t.id===e.id?{...t,status:`error`}:t))},r=await Wm(o,{ref:s,target:p,filename:t.name,contentType:t.type,values:m});if(!r.ok){n();return}let i=await r.json();try{let n=await Um({url:i.url,method:i.method.toUpperCase(),body:t,headers:i.headers,onProgress:t=>T(n=>n.map(n=>n.id===e.id?{...n,progress:t}:n))});T(t=>t.map(t=>t.id===e.id?{...t,status:n.ok?`ready`:`error`,key:i.key,progress:100}:t))}catch{n()}}function j(e){if(!e||y)return;let t=Array.from(e),n=t.map(e=>({id:crypto.randomUUID(),name:e.name,size:e.size,status:b?`uploading`:`ready`,progress:0,file:e,url:k(e),existing:!1}));if(!x&&(w.forEach(ee),!u)){let e=w.filter(e=>e.existing&&e.token).map(e=>e.token);e.length>0&&D(t=>[...t,...e])}T(e=>x?[...e,...n]:n),b&&n.forEach((e,n)=>void A(e,t[n]))}function M(e){let t=w.find(t=>t.id===e);t&&ee(t),t?.existing&&t.token&&!u&&D(e=>[...e,t.token]),T(t=>t.filter(t=>t.id!==e))}if(n)return null;let te=w.filter(e=>b&&!e.existing&&e.key&&e.status===`ready`);return(0,q.jsx)(it,{error:c[f],helperText:t.helperText??void 0,tooltip:t.tooltip??void 0,labelAction:Ht(t.labelAction),label:t.label??``,id:g,required:r,children:e=>(0,q.jsx)(Yf,{disabled:y,hiddenInputs:(0,q.jsxs)(q.Fragment,{children:[te.map(e=>(0,q.jsx)(`input`,{"data-test":Yl(`${l}-uploaded`),name:S,type:`hidden`,value:e.key},e.id)),!u&&E.map(e=>(0,q.jsx)(`input`,{name:`${l}__removed[]`,type:`hidden`,value:e},e))]}),image:t.image,inputProps:{...e,accept:t.accept??void 0,"aria-label":t.label??l,"data-test":Yl(`${l}-input`),multiple:x,name:b?void 0:S},inputRef:_,items:w.map(e=>({id:e.id,itemTestId:Yl(`${l}-item`),name:e.name,previewTestId:Yl(`${l}-preview`),progress:e.progress,removable:!e.existing||!u,removeTestId:Yl(e.existing?`${l}-remove-existing`:`${l}-remove`),status:e.status,url:e.url})),onFilesAdded:j,onRemove:M,resetOnSelect:!!b,testId:Yl(l)})})},qm={start:`justify-start`,center:`justify-center`,end:`justify-end`,between:`justify-between`,around:`justify-around`,evenly:`justify-evenly`};function Jm({label:e,summaryLabel:t,variant:n,emphasis:r}){let{componentId:i,errors:a,fieldLabels:o,processing:s}=at(),c=Object.entries(a).filter(([,e])=>!!e).map(([e,t])=>({label:o[e]??e,message:t})),l=c.length>0;return(0,q.jsxs)(`span`,{className:`group relative inline-flex flex-col`,children:[(0,q.jsxs)(J,{"data-lattice-form":i,"data-test":`form-submit`,disabled:s||l,emphasis:r,type:`submit`,variant:n,children:[s&&(0,q.jsx)(Jl,{}),e]}),l&&(0,q.jsxs)(`div`,{className:`pointer-events-none absolute bottom-full left-1/2 z-lt-popover mb-2 w-max max-w-xs -translate-x-1/2 rounded-lt border border-lt-border bg-lt-surface p-3 text-left text-sm opacity-0 shadow-lt-md transition-opacity group-hover:opacity-100`,role:`tooltip`,children:[(0,q.jsx)(`p`,{className:`mb-1 font-medium text-lt-fg`,children:t}),(0,q.jsx)(`ul`,{className:`space-y-1`,children:c.map(e=>(0,q.jsxs)(`li`,{className:`text-lt-muted-fg`,children:[(0,q.jsx)(`span`,{className:`font-medium text-lt-fg`,children:e.label}),` — `,e.message]},e.label))})]})]})}function Ym({componentId:e,reset:t}){let n=le();return Pl(d.resetForm,r=>{let i=r.detail;(!i?.form||i.form===e)&&(t(),n())}),null}function Xm({action:e,children:t,componentRef:n,nodes:r,shouldRenderSubmitButton:i,submitButtons:a,submitEmphasis:o,submitJustify:s,submitLabel:c,submitVariant:l,summaryLabel:u}){let{nodes:d,markUserEdit:f}=$d(e,n,r),p=(0,B.useMemo)(()=>({markUserEdit:f}),[f]);return(0,q.jsx)(Ae,{value:p,children:(0,q.jsx)(Vd,{nodes:d,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[t,i&&(0,q.jsx)(`div`,{className:`flex gap-3 ${qm[s??`end`]}`,children:a?.length?a.map((e,t)=>e.props.buttonType===`submit`?(0,q.jsx)(Jm,{emphasis:e.props.emphasis??o,label:e.props.label??c,summaryLabel:u,variant:e.props.variant??l},pe(e,t)):(0,q.jsx)(Xt,{node:e},pe(e,t))):(0,q.jsx)(Jm,{emphasis:o,label:c,summaryLabel:u,variant:l})})]})})})}function Zm(e){return!e||Array.isArray(e)&&e.length===0?!1:Array.isArray(e)?e:void 0}var Qm=({children:e,node:t})=>{let n=(0,B.useMemo)(()=>({...ef(t.schema).values,...t.props.state}),[t.schema,t.props.state]),r=t.props.async?$m:eh;return(0,q.jsx)(he,{initial:n,children:(0,q.jsx)(r,{node:t,children:e})})};function $m({children:e,node:t}){let{t:n}=N(`lattice`),r=t.props,i=r.action??`#`,a=r.ref??``,o=r.method??`post`,s=r.precognitive,c=r.resetOnError??!1,l=r.resetOnSuccess??[],u=(0,B.useMemo)(()=>ef(t.schema).labels,[t.schema]),d=r.submitButtons??void 0,f=r.submitLabel??n(`form.submit`,`Submit`),p=le(),m=e=>{let t=Zm(e);t!==!1&&p(t)},{clearErrors:h,errors:g,processing:_,submit:v,touch:y,validate:b,validateFields:x,validating:S}=af({componentRef:a,endpoint:i,method:o,onError:()=>m(c),onSuccess:()=>m(l),precognitive:s,validationDebounceMs:r.validationTimeout??void 0}),C=(0,B.useMemo)(()=>({action:i,clearErrors:h,componentId:t.id,componentRef:a,errors:g,fieldLabels:u,precognitive:s,processing:_,touch:y,validate:b,validateFields:x,validating:S}),[i,h,a,g,u,t.id,s,_,y,b,x,S]);return(0,q.jsx)(`form`,{"data-slot":`form`,"data-test":t.id,className:`flex w-full flex-col gap-6`,onSubmit:e=>{e.preventDefault(),v()},children:(0,q.jsxs)(se,{value:C,children:[(0,q.jsx)(Ym,{componentId:t.id,reset:()=>{}}),r.status&&(0,q.jsx)(`div`,{className:`text-center text-sm font-medium text-lt-success`,children:r.status}),(0,q.jsx)(Xm,{action:i,componentRef:a,nodes:t.schema,shouldRenderSubmitButton:r.submitButton,submitButtons:d,submitEmphasis:r.submitEmphasis??void 0,submitJustify:r.submitJustify??void 0,submitLabel:f,submitVariant:r.submitVariant??void 0,summaryLabel:r.validationSummaryLabel,children:e})]})})}function eh({children:e,node:t}){let{t:n}=N(`lattice`),r=t.props,i=r.action??`#`,a=r.errorBag,o=r.ref??``,s=r.method??`post`,c=r.precognitive,l=r.resetOnError??!1,u=r.resetOnSuccess??[],d=(0,B.useMemo)(()=>ef(t.schema).labels,[t.schema]),f=r.submitButton,p=r.submitButtons??void 0,m=r.submitJustify??void 0,h=r.submitLabel??n(`form.submit`,`Submit`),g=r.submitVariant??void 0,_=r.submitEmphasis??void 0,v=r.validationSummaryLabel,y=r.validationTimeout??void 0,b=le(),x=e=>{let t=Zm(e);t!==!1&&b(t)},S=(0,B.useRef)(null),C=(0,B.useRef)(`idle`),[w,T]=(0,B.useState)(0);return(0,B.useEffect)(()=>{w>0&&C.current===`renewing`&&S.current?.submit()},[w]),(0,q.jsx)(Oc,{ref:S,action:i,"data-slot":`form`,"data-test":t.id,errorBag:a,method:s,options:{preserveScroll:!0},resetOnError:l,resetOnSuccess:u,validationTimeout:c?y:void 0,headers:Au(o),className:`flex w-full flex-col gap-6`,onStart:()=>{C.current=C.current===`renewing`?`retried`:`idle`},onSuccess:()=>x(u),onError:()=>x(l),onHttpException:e=>{if(e.status===403&&o!==``&&C.current!==`retried`)return C.current=`renewing`,Bu(o).finally(()=>T(e=>e+1)),!1},children:({clearErrors:n,errors:a,processing:s,reset:l,touch:u,validate:y,validating:b})=>(0,q.jsxs)(se,{value:{action:i,clearErrors:e=>n(e),componentId:t.id,componentRef:o,errors:a,fieldLabels:d,precognitive:c,processing:s,touch:e=>u(...e),validate:e=>y(e),validateFields:(e,t)=>y({only:e,...t}),validating:b},children:[(0,q.jsx)(Ym,{componentId:t.id,reset:l}),r.status&&(0,q.jsx)(`div`,{className:`text-center text-sm font-medium text-lt-success`,children:r.status}),(0,q.jsx)(Xm,{action:i,componentRef:o,nodes:t.schema,shouldRenderSubmitButton:f,submitButtons:p,submitEmphasis:_,submitJustify:m,submitLabel:h,submitVariant:g,summaryLabel:v,children:e})]})})}var th=({node:e})=>{let t=Ee(),n=e.props.name,r=t?t.getValue(n):e.props.value;return(0,q.jsx)(`input`,{defaultValue:typeof r==`string`?r:``,name:t?t.scopedName(n):n,type:`hidden`})};function nh({affix:e,side:t,squared:n=!1}){return(0,q.jsx)(`span`,{"data-slot":`affix-${t}`,className:x(`inline-flex h-lt-control-md shrink-0 items-center border border-lt-input bg-lt-muted px-3 text-base whitespace-nowrap text-lt-muted-fg`,`group-has-[:focus-visible]:border-lt-ring`,t===`start`?`rounded-l-lt-sm border-r-0`:`rounded-r-lt-sm border-l-0`,n&&`rounded-r-none border-r-0`),children:e.icon?(0,q.jsx)(tl,{className:`size-lt-icon-md`,icon:e.icon}):e.text})}function rh({prefix:e,suffix:t,start:n,end:r,children:i}){return!e&&!t&&!n&&!r?i(``):(0,q.jsxs)(`div`,{className:`group flex w-full rounded-lt-sm transition-[color,box-shadow] has-[:focus-visible]:ring-[length:var(--lt-ring-width)] has-[:focus-visible]:ring-lt-ring/50`,"data-slot":`affix-group`,children:[n,e?(0,q.jsx)(nh,{affix:e,side:`start`}):null,(0,q.jsx)(`div`,{className:`min-w-0 flex-1`,children:i(x(`focus-visible:ring-0`,(e||n)&&`rounded-l-none`,(t||r)&&`rounded-r-none`))}),t?(0,q.jsx)(nh,{affix:t,side:`end`,squared:!!r}):null,r]})}var ih=250;function ah({contentClassName:e,creatable:t=!1,emptyLabel:n,loading:r=!1,multiple:i=!1,onCommit:a,onCreate:o,onSearch:s,onSelect:c,open:l,onOpenChange:u,options:d,renderOption:f,searchLabel:p,searchPlaceholder:m,selected:h,showSearch:g=!0,testId:_,trigger:v,triggerClassName:b,triggerProps:S}){let{t:C}=N(`lattice`),[w,T]=(0,B.useState)(``),E=(0,B.useRef)(null),[D,O]=(0,B.useState)(!1);(0,B.useLayoutEffect)(()=>{O(!!E.current?.closest(`[role="dialog"]`))},[]);function k(e){let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);for(let e of t){let t=d.find(t=>t.label.toLowerCase()===e.toLowerCase());t?(a??c)(t.value):o?.(e)}i?T(``):M()}let ee=d.some(e=>e.label.toLowerCase()===w.trim().toLowerCase()),A=rf(e=>s?.(e),ih);(0,B.useEffect)(()=>{if(!(!s||!l))return A(w),()=>A.cancel()},[w,s,l,A]);let j=s?d:d.filter(e=>e.label.toLowerCase().includes(w.toLowerCase()));function M(){T(``),u(!1)}function te(e){c(e),i||M()}return(0,q.jsxs)(Zt,{modal:D,open:l,onOpenChange:e=>e?u(!0):M(),children:[(0,q.jsx)(Pe,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,className:b,ref:E,...S,children:v})}),(0,q.jsxs)(Jt,{align:`start`,className:x(`w-[var(--radix-popover-trigger-width)] overflow-hidden p-0`,e),children:[g&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-lt-border px-3 py-2`,children:[(0,q.jsx)(`input`,{"aria-label":p??C(`form.search-options`,`Search options`),"data-slot":`combobox-search`,"data-test":_?`${_}-search`:void 0,className:`w-full bg-transparent text-sm outline-none placeholder:text-lt-muted-fg`,onChange:e=>{let n=e.target.value;if(t&&n.includes(`,`)){k(n);return}T(n)},onKeyDown:e=>{t&&e.key===`Enter`&&w.trim()!==``&&(e.preventDefault(),k(w))},placeholder:m,value:w}),r&&(0,q.jsx)(y,{name:`loader-2`,"aria-hidden":`true`,className:`size-lt-icon-md shrink-0 animate-spin text-lt-muted-fg`})]}),(0,q.jsxs)(`div`,{className:`max-h-60 overflow-y-auto p-1`,role:`listbox`,children:[t&&w.trim()!==``&&!ee&&(0,q.jsxs)(`button`,{className:`flex w-full items-center gap-2 rounded-lt-sm px-3 py-1.5 text-left text-sm transition-colors hover:bg-lt-accent hover:text-lt-accent-fg`,"data-test":_?`${_}-create`:void 0,onClick:()=>k(w),type:`button`,children:[(0,q.jsx)(y,{name:`plus`,"aria-hidden":`true`,className:`size-lt-icon-md shrink-0`}),C(`form.create-option`,`Create "{{label}}"`,{label:w.trim()})]}),j.length===0&&!(t&&w.trim()!==``&&!ee)?(0,q.jsx)(`p`,{className:`px-3 py-2 text-sm text-lt-muted-fg`,children:n}):j.map(e=>{let t=h.includes(e.value);return(0,q.jsxs)(`button`,{"aria-label":f?e.label:void 0,"aria-selected":t,className:x(`flex w-full items-center justify-between gap-2 rounded-lt-sm px-3 py-1.5 text-left text-sm transition-colors hover:bg-lt-accent hover:text-lt-accent-fg`,t&&`bg-lt-accent/60`),"data-slot":`combobox-option`,"data-test":_?`${_}-option-${e.value}`:void 0,"data-value":e.value,onClick:()=>te(e.value),role:`option`,type:`button`,children:[f?(0,q.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:f(e)}):e.label,t&&(0,q.jsx)(y,{name:`check`,"aria-hidden":`true`,className:`size-lt-icon-md shrink-0`})]},e.value)})]})]})]})}function oh({creatable:e=!1,emptyLabel:t,loading:n=!1,locked:r=!1,multiple:i=!1,onCreate:a,onOpenChange:o,onRemove:s,onSearch:c,onSelect:l,options:u,placeholder:d,renderOption:f,searchPlaceholder:p,selectedItems:m,showSearch:h=!1,testId:g,triggerClassName:_,triggerProps:v}){let{t:b}=N(`lattice`),[S,C]=(0,B.useState)(!1);return(0,q.jsxs)(`div`,{children:[i&&m.length>0&&(0,q.jsx)(`div`,{className:`mb-1.5 flex flex-wrap gap-1`,children:m.map(e=>(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-lt-sm bg-lt-muted px-2 py-0.5 text-xs`,children:[e.color&&(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 shrink-0 rounded-full`,style:{background:an(e.color)}}),e.label,!r&&(0,q.jsx)(`button`,{"aria-label":b(`form.remove-option`,`Remove {{label}}`,{label:e.label}),"data-test":g?`${g}-remove-${e.value}`:void 0,className:`text-lt-muted-fg hover:text-lt-fg [&_svg]:size-lt-icon-xs`,onClick:()=>s?.(e.value),type:`button`,children:(0,q.jsx)(y,{name:`x`})})]},e.value))}),(0,q.jsx)(ah,{creatable:e,emptyLabel:t,loading:n,multiple:i,onCommit:e=>a?.(e),onCreate:e=>a?.(e),onSearch:c,onSelect:l,open:S&&!r,onOpenChange:e=>{C(e),o?.(e)},options:u,renderOption:f,searchPlaceholder:p,showSearch:h,selected:m.map(e=>e.value),testId:g,trigger:(0,q.jsxs)(q.Fragment,{children:[!i&&m.length>0?(0,q.jsx)(`span`,{children:m[0]?.label}):(0,q.jsx)(`span`,{className:`text-lt-muted-fg`,children:d}),(0,q.jsx)(y,{name:`chevrons-up-down`,className:`size-lt-icon-md shrink-0 text-lt-muted-fg`})]}),triggerClassName:_?x(_,`text-left aria-readonly:cursor-default disabled:cursor-not-allowed disabled:opacity-60`):x(tn(),`flex items-center justify-between gap-2 text-left`),triggerProps:v})]})}function sh(e,t){let n=e??t;return Array.isArray(n)?n.map(String):n==null||n===``?[]:[String(n)]}function ch({node:e,controlProps:t,triggerClassName:n}){let r=e.props,{action:a,componentRef:o,searchOptions:s}=at(),{hidden:c,readOnly:l,disabled:u}=tt(e),{change:d,blur:f}=ge(),p=Hd(e),m=r.name,h=Ee(),g=h?h.errorKey(m):m,_=r.placeholder||`Select…`,v=r.multiple,y=r.searchable,b=r.creatable,x=(0,B.useMemo)(()=>p.props.options,[p.props]),S=p.props.optionSchema,C=De(m),w=xt(),T=(0,B.useRef)(w);T.current=w;let E=h?h.getValue(m):C,D=(0,B.useMemo)(()=>sh(E,r.value),[E,r.value]),O=(0,B.useRef)(D);O.current=D;let[k,ee]=(0,B.useState)(null),[A,j]=(0,B.useState)(!1),M=(0,B.useRef)(null),te=(0,B.useMemo)(()=>{let e=new Map;for(let t of[...x,...k??[]])e.set(t.value,t);return e},[x,k]),N=e=>te.get(e)?.label??e,P=e=>sn(te.get(e)?.data?.color),F=l||u,ne=(0,B.useCallback)(e=>{if(M.current?.abort(),e.trim()===``){ee(null),j(!1);return}let t=new AbortController;if(M.current=t,j(!0),s){s(g,e,T.current,t.signal).then(e=>{ee(e),j(!1)}).catch(()=>{});return}Wd(a,o,{...T.current,_sub:`search`,_target:g,_q:e},t.signal).then(e=>{ee(e?.options??[]),j(!1)}).catch(()=>{})},[a,o,g,s]);function I(e){d(m,v?e:e[0]??``)}function re(e){if(v){let t=O.current.includes(e)?O.current.filter(t=>t!==e):[...O.current,e];O.current=t,I(t);return}O.current=[e],I([e])}function L(e){I(D.filter(t=>t!==e))}function R(e){if(!v){O.current=[e],I([e]);return}if(!O.current.includes(e)){let t=[...O.current,e];O.current=t,I(t)}}if(c)return null;let ie=y?k??x:x,ae=S?.length?e=>(0,q.jsx)(Qe,{nodes:i(S,{...e.data,label:e.label,value:e.value})}):void 0;return(0,q.jsxs)(q.Fragment,{children:[v?D.map(e=>(0,q.jsx)(`input`,{name:`${t.id}[]`,type:`hidden`,value:e},e)):(0,q.jsx)(`input`,{name:t.id,type:`hidden`,value:D[0]??``}),(0,q.jsx)(oh,{creatable:b,emptyLabel:r.emptyLabel??void 0,loading:A,locked:F,multiple:v,onCreate:R,onOpenChange:e=>{e||f(m)},onRemove:L,onSearch:y?ne:void 0,onSelect:re,options:ie,placeholder:_,renderOption:ae,searchPlaceholder:r.searchPlaceholder??void 0,selectedItems:D.map(e=>({color:P(e),label:N(e),value:e})),showSearch:!!(y||b),testId:`select-${m}`,triggerClassName:n,triggerProps:{...t,"aria-haspopup":`listbox`,"aria-readonly":l&&!u?!0:void 0,autoFocus:r.autoFocus??void 0,"data-test":`select-${m}`,disabled:u,tabIndex:r.tabIndex??void 0}})]})}function lh(e){let{fieldIdPrefix:t}=at(),n=Ee();return Tm(n?n.scopedName(e):e,t)}function uh(e,t){return t?e.schema?.find(e=>e.type===`field.select`&&e.props.name===t)??null:null}function dh({node:e,side:t,last:n=!0}){let{errors:r}=at(),i=Ee(),a=e.props.name,o=lh(a),s=r[i?i.errorKey(a):a];return(0,q.jsx)(ch,{node:e,controlProps:{id:o,"aria-invalid":s?!0:void 0,"aria-label":e.props.label??a},triggerClassName:x(`flex h-lt-control-md shrink-0 items-center gap-1.5 border border-lt-input bg-lt-muted px-3 text-base whitespace-nowrap outline-none group-has-[:focus-visible]:border-lt-ring`,t===`start`&&`rounded-l-lt-sm rounded-r-none border-r-0`,t===`end`&&(n?`rounded-l-none rounded-r-lt-sm border-l-0`:`rounded-none border-l-0`),s&&`border-lt-danger`)})}var fh=({node:e})=>{let t=e.props,n=uh(e,t.prefixFieldName),r=uh(e,t.suffixFieldName);return(0,q.jsx)(Lm,{node:e,label:t.label??``,children:({name:e,testId:i,value:a,readOnly:o,disabled:s,commit:c},l)=>{let u=e=>c(e.target.value);return t.slider?(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`input`,{...l,"aria-label":t.label??``,className:`h-2 w-full cursor-pointer appearance-none rounded-lt-sm bg-lt-muted accent-lt-primary disabled:cursor-not-allowed disabled:accent-lt-disabled`,"data-test":i,disabled:s||o,max:t.max??void 0,min:t.min??void 0,name:e,onChange:u,step:t.step??void 0,tabIndex:t.tabIndex??void 0,type:`range`,value:a}),(0,q.jsx)(`output`,{className:`w-10 shrink-0 text-right text-sm tabular-nums text-lt-fg`,children:a})]}):(0,q.jsx)(rh,{prefix:n?null:t.prefix,suffix:r?null:t.suffix,start:n?(0,q.jsx)(dh,{node:n,side:`start`}):void 0,end:r?(0,q.jsx)(dh,{node:r,side:`end`}):void 0,children:n=>(0,q.jsx)(nn,{...l,autoFocus:t.autoFocus??!1,className:n,"data-test":i,disabled:s,max:t.max??void 0,min:t.min??void 0,name:e,onChange:u,placeholder:t.placeholder??``,readOnly:o,step:t.step??void 0,tabIndex:t.tabIndex??void 0,type:`number`,value:a})})}})},ph=Object.defineProperty,mh=Object.defineProperties,hh=Object.getOwnPropertyDescriptors,gh=Object.getOwnPropertySymbols,_h=Object.prototype.hasOwnProperty,vh=Object.prototype.propertyIsEnumerable,yh=(e,t,n)=>t in e?ph(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bh=(e,t)=>{for(var n in t||={})_h.call(t,n)&&yh(e,n,t[n]);if(gh)for(var n of gh(t))vh.call(t,n)&&yh(e,n,t[n]);return e},xh=(e,t)=>mh(e,hh(t)),Sh=(e,t)=>{var n={};for(var r in e)_h.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gh)for(var r of gh(e))t.indexOf(r)<0&&vh.call(e,r)&&(n[r]=e[r]);return n};function Ch(e){return[setTimeout(e,0),setTimeout(e,10),setTimeout(e,50)]}function wh(e){let t=B.useRef();return B.useEffect(()=>{t.current=e}),t.current}var Th=18,Eh=40,Dh=`${Eh}px`,Oh=[`[data-lastpass-icon-root]`,`com-1password-button`,`[data-dashlanecreated]`,`[style$="2147483647 !important;"]`].join(`,`);function kh({containerRef:e,inputRef:t,pushPasswordManagerStrategy:n,isFocused:r}){let[i,a]=B.useState(!1),[o,s]=B.useState(!1),[c,l]=B.useState(!1),u=B.useMemo(()=>n!==`none`&&(n===`increase-width`||n===`experimental-no-flickering`)&&i&&o,[i,o,n]),d=B.useCallback(()=>{let r=e.current,i=t.current;if(!r||!i||c||n===`none`)return;let o=r,s=o.getBoundingClientRect().left+o.offsetWidth,u=o.getBoundingClientRect().top+o.offsetHeight/2,d=s-Th,f=u;document.querySelectorAll(Oh).length===0&&document.elementFromPoint(d,f)===r||(a(!0),l(!0))},[e,t,c,n]);return B.useEffect(()=>{let t=e.current;if(!t||n===`none`)return;function r(){let e=window.innerWidth-t.getBoundingClientRect().right;s(e>=Eh)}r();let i=setInterval(r,1e3);return()=>{clearInterval(i)}},[e,n]),B.useEffect(()=>{let e=r||document.activeElement===t.current;if(n===`none`||!e)return;let i=setTimeout(d,0),a=setTimeout(d,2e3),o=setTimeout(d,5e3),s=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(i),clearTimeout(a),clearTimeout(o),clearTimeout(s)}},[t,r,n,d]),{hasPWMBadge:i,willPushPWMBadge:u,PWM_BADGE_SPACE_WIDTH:Dh}}var Ah=B.createContext({}),jh=B.forwardRef((e,t)=>{var n=e,{value:r,onChange:i,maxLength:a,textAlign:o=`left`,pattern:s,placeholder:c,inputMode:l=`numeric`,onComplete:u,pushPasswordManagerStrategy:d=`increase-width`,pasteTransformer:f,containerClassName:p,noScriptCSSFallback:m=Nh,render:h,children:g}=n,_=Sh(n,[`value`,`onChange`,`maxLength`,`textAlign`,`pattern`,`placeholder`,`inputMode`,`onComplete`,`pushPasswordManagerStrategy`,`pasteTransformer`,`containerClassName`,`noScriptCSSFallback`,`render`,`children`]),v;let[y,b]=B.useState(typeof _.defaultValue==`string`?_.defaultValue:``),x=r??y,S=wh(x),C=B.useCallback(e=>{i?.(e),b(e)},[i]),w=B.useMemo(()=>s?typeof s==`string`?new RegExp(s):s:null,[s]),T=B.useRef(null),E=B.useRef(null),D=B.useRef({value:x,onChange:C,isIOS:typeof window<`u`&&((v=window==null?void 0:window.CSS)?.supports)?.call(v,`-webkit-touch-callout`,`none`)}),O=B.useRef({prev:[T.current?.selectionStart,T.current?.selectionEnd,T.current?.selectionDirection]});B.useImperativeHandle(t,()=>T.current,[]),B.useEffect(()=>{let e=T.current,t=E.current;if(!e||!t)return;D.current.value!==e.value&&D.current.onChange(e.value),O.current.prev=[e.selectionStart,e.selectionEnd,e.selectionDirection];function n(){if(document.activeElement!==e){te(null),P(null);return}let t=e.selectionStart,n=e.selectionEnd,r=e.selectionDirection,i=e.maxLength,a=e.value,o=O.current.prev,s=-1,c=-1,l;if(a.length!==0&&t!==null&&n!==null){let e=t===n,r=t===a.length&&a.length<i;if(e&&!r){let e=t;if(e===0)s=0,c=1,l=`forward`;else if(e===i)s=e-1,c=e,l=`backward`;else if(i>1&&a.length>1){let t=0;if(o[0]!==null&&o[1]!==null){l=e<o[1]?`backward`:`forward`;let n=o[0]===o[1]&&o[0]<i;l===`backward`&&!n&&(t=-1)}s=t+e,c=t+e+1}}s!==-1&&c!==-1&&s!==c&&T.current.setSelectionRange(s,c,l)}let u=s===-1?t:s,d=c===-1?n:c,f=l??r;te(u),P(d),O.current.prev=[u,d,f]}if(document.addEventListener(`selectionchange`,n,{capture:!0}),n(),document.activeElement===e&&j(!0),!document.getElementById(`input-otp-style`)){let e=document.createElement(`style`);if(e.id=`input-otp-style`,document.head.appendChild(e),e.sheet){let t=`background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;`;Mh(e.sheet,`[data-input-otp]::selection { background: transparent !important; color: transparent !important; }`),Mh(e.sheet,`[data-input-otp]:autofill { ${t} }`),Mh(e.sheet,`[data-input-otp]:-webkit-autofill { ${t} }`),Mh(e.sheet,`@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }`),Mh(e.sheet,`[data-input-otp] + * { pointer-events: all !important; }`)}}let r=()=>{t&&t.style.setProperty(`--root-height`,`${e.clientHeight}px`)};r();let i=new ResizeObserver(r);return i.observe(e),()=>{document.removeEventListener(`selectionchange`,n,{capture:!0}),i.disconnect()}},[]);let[k,ee]=B.useState(!1),[A,j]=B.useState(!1),[M,te]=B.useState(null),[N,P]=B.useState(null);B.useEffect(()=>{Ch(()=>{var e;(e=T.current)==null||e.dispatchEvent(new Event(`input`));let t=T.current?.selectionStart,n=T.current?.selectionEnd,r=T.current?.selectionDirection;t!==null&&n!==null&&(te(t),P(n),O.current.prev=[t,n,r])})},[x,A]),B.useEffect(()=>{S!==void 0&&x!==S&&S.length<a&&x.length===a&&u?.(x)},[a,u,S,x]);let F=kh({containerRef:E,inputRef:T,pushPasswordManagerStrategy:d,isFocused:A}),ne=B.useCallback(e=>{let t=e.currentTarget.value.slice(0,a);if(t.length>0&&w&&!w.test(t)){e.preventDefault();return}typeof S==`string`&&t.length<S.length&&document.dispatchEvent(new Event(`selectionchange`)),C(t)},[a,C,S,w]),I=B.useCallback(()=>{var e;if(T.current){let t=Math.min(T.current.value.length,a-1),n=T.current.value.length;(e=T.current)==null||e.setSelectionRange(t,n),te(t),P(n)}j(!0)},[a]),re=B.useCallback(e=>{let t=T.current;if(!f&&(!D.current.isIOS||!e.clipboardData||!t))return;let n=e.clipboardData.getData(`text/plain`),r=f?f(n):n;e.preventDefault();let i=T.current?.selectionStart,o=T.current?.selectionEnd,s=(i===o?x.slice(0,i)+r+x.slice(i):x.slice(0,i)+r+x.slice(o)).slice(0,a);if(s.length>0&&w&&!w.test(s))return;t.value=s,C(s);let c=Math.min(s.length,a-1),l=s.length;t.setSelectionRange(c,l),te(c),P(l)},[a,C,w,x]),L=B.useMemo(()=>({position:`relative`,cursor:_.disabled?`default`:`text`,userSelect:`none`,WebkitUserSelect:`none`,pointerEvents:`none`}),[_.disabled]),R=B.useMemo(()=>({position:`absolute`,inset:0,width:F.willPushPWMBadge?`calc(100% + ${F.PWM_BADGE_SPACE_WIDTH})`:`100%`,clipPath:F.willPushPWMBadge?`inset(0 ${F.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:`100%`,display:`flex`,textAlign:o,opacity:`1`,color:`transparent`,pointerEvents:`all`,background:`transparent`,caretColor:`transparent`,border:`0 solid transparent`,outline:`0 solid transparent`,boxShadow:`none`,lineHeight:`1`,letterSpacing:`-.5em`,fontSize:`var(--root-height)`,fontFamily:`monospace`,fontVariantNumeric:`tabular-nums`}),[F.PWM_BADGE_SPACE_WIDTH,F.willPushPWMBadge,o]),ie=B.useMemo(()=>B.createElement(`input`,xh(bh({autoComplete:_.autoComplete||`one-time-code`},_),{"data-input-otp":!0,"data-input-otp-placeholder-shown":x.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":N,inputMode:l,pattern:w?.source,"aria-placeholder":c,style:R,maxLength:a,value:x,ref:T,onPaste:e=>{var t;re(e),(t=_.onPaste)==null||t.call(_,e)},onChange:ne,onMouseOver:e=>{var t;ee(!0),(t=_.onMouseOver)==null||t.call(_,e)},onMouseLeave:e=>{var t;ee(!1),(t=_.onMouseLeave)==null||t.call(_,e)},onFocus:e=>{var t;I(),(t=_.onFocus)==null||t.call(_,e)},onBlur:e=>{var t;j(!1),(t=_.onBlur)==null||t.call(_,e)}})),[ne,I,re,l,R,a,N,M,_,w?.source,x]),ae=B.useMemo(()=>({slots:Array.from({length:a}).map((e,t)=>{let n=A&&M!==null&&N!==null&&(M===N&&t===M||t>=M&&t<N),r=x[t]===void 0?null:x[t];return{char:r,placeholderChar:x[0]===void 0?c?.[t]??null:null,isActive:n,hasFakeCaret:n&&r===null}}),isFocused:A,isHovering:!_.disabled&&k}),[A,k,a,N,M,_.disabled,x]),oe=B.useMemo(()=>h?h(ae):B.createElement(Ah.Provider,{value:ae},g),[g,ae,h]);return B.createElement(B.Fragment,null,m!==null&&B.createElement(`noscript`,null,B.createElement(`style`,null,m)),B.createElement(`div`,{ref:E,"data-input-otp-container":!0,style:L,className:p},oe,B.createElement(`div`,{style:{position:`absolute`,inset:0,pointerEvents:`none`}},ie)))});jh.displayName=`Input`;function Mh(e,t){try{e.insertRule(t)}catch{console.error(`input-otp could not insert CSS rule:`,t)}}var Nh=`
99
+ [data-input-otp] {
100
+ --nojs-bg: white !important;
101
+ --nojs-fg: black !important;
102
+
103
+ background-color: var(--nojs-bg) !important;
104
+ color: var(--nojs-fg) !important;
105
+ caret-color: var(--nojs-fg) !important;
106
+ letter-spacing: .25em !important;
107
+ text-align: center !important;
108
+ border: 1px solid var(--nojs-fg) !important;
109
+ border-radius: 4px !important;
110
+ width: 100% !important;
111
+ }
112
+ @media (prefers-color-scheme: dark) {
113
+ [data-input-otp] {
114
+ --nojs-bg: black !important;
115
+ --nojs-fg: white !important;
116
+ }
117
+ }`,Ph=`^\\d+$`;function Fh({char:e,hasFakeCaret:t,isActive:n}){return(0,q.jsxs)(`div`,{className:x(`relative flex h-lt-control-md w-10 items-center justify-center border-y border-r border-lt-input text-base shadow-lt-xs transition-all first:rounded-l-lt-sm first:border-l last:rounded-r-lt-sm`,n&&`z-10 border-lt-ring ring-lt-ring/50 ring-[length:var(--lt-ring-width)]`),children:[e,t?(0,q.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,q.jsx)(`div`,{className:`bg-lt-fg h-5 w-px animate-pulse`})}):null]})}function Ih({length:e,containerClassName:t,pattern:n=Ph,...r}){return(0,q.jsx)(jh,{maxLength:e,pattern:n,containerClassName:x(`flex items-center gap-2 has-[:disabled]:opacity-50`,t),render:({slots:e})=>(0,q.jsx)(`div`,{className:`flex items-center`,children:e.map((e,t)=>(0,q.jsx)(Fh,{...e},t))}),...r})}var Lh=({node:e})=>{let t=e.props;return(0,q.jsx)(Lm,{node:e,label:t.label??``,children:({name:e,testId:n,value:r,readOnly:i,disabled:a,commit:o},s)=>(0,q.jsx)(Ih,{...s,autoFocus:t.autoFocus??!1,"data-test":n,disabled:a||i,length:t.length,name:e,onChange:e=>o(e),value:r})})};function Rh({className:e,ref:t,...n}){let[r,i]=(0,B.useState)(!1);return(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(nn,{type:r?`text`:`password`,className:x(`pr-10`,e),ref:t,...n}),(0,q.jsx)(`button`,{type:`button`,"data-test":typeof n.name==`string`?`${n.name}-visibility`:`password-visibility`,onClick:()=>i(e=>!e),className:`absolute inset-y-0 right-0 flex items-center rounded-r-lt-sm px-3 text-lt-muted-fg hover:text-lt-fg focus-visible:ring-[length:var(--lt-ring-width)] focus-visible:ring-lt-ring/50 focus-visible:outline-none`,"aria-label":r?`Hide password`:`Show password`,tabIndex:-1,children:r?(0,q.jsx)(y,{name:`eye-off`,className:`size-lt-icon-md`}):(0,q.jsx)(y,{name:`eye`,className:`size-lt-icon-md`})})]})}var zh=({node:e})=>{let t=e.props,{errors:n}=at(),r=Em(e),{commit:i}=ge(),a=Ee(),o=t.confirmation,s=o?.name??`${r.localName}_confirmation`,c=a?a.scopedName(s):s,l=a?a.errorKey(s):s,u=(t.passwordRules??``)||void 0;return r.hidden?null:(0,q.jsxs)(`div`,{className:`grid gap-6`,children:[(0,q.jsx)(it,{error:r.error,helperText:t.helperText??void 0,tooltip:t.tooltip??void 0,label:t.label??``,labelAction:Ht(t.labelAction),id:r.name,required:r.required,children:e=>(0,q.jsx)(rh,{prefix:t.prefix,suffix:t.suffix,children:n=>(0,q.jsx)(Rh,{...e,autoComplete:t.autoComplete??``,autoFocus:t.autoFocus??!1,className:n,"data-test":r.testId,disabled:r.disabled,name:r.name,onChange:e=>{r.commit(e.target.value)},placeholder:t.placeholder??``,passwordrules:u,readOnly:r.readOnly,tabIndex:t.tabIndex??void 0,value:r.value})})}),o&&(0,q.jsx)(it,{error:n[l],label:o.label??`Confirm password`,id:c,required:r.required,children:e=>(0,q.jsx)(Rh,{...e,autoComplete:`new-password`,"data-test":Yl(s),disabled:r.disabled,name:c,onChange:e=>{i(s,e.target.value)},placeholder:o.placeholder??o.label??`Confirm password`,passwordrules:u,readOnly:r.readOnly,tabIndex:t.tabIndex??void 0})})]})},Bh=[],Vh=({node:e})=>{let t=e.props,n=t.name,{errors:r}=at(),{hidden:i,required:a}=tt(e),{path:o,rows:s,onField:c,onRemove:l,onMove:u,onDuplicate:d,append:f}=Sm(n,t.defaultItems??1),p=e.schema??Bh,m=xm(s.map(e=>String(e.rowId??``)).join(`,`)),h=t.maxItems!=null&&s.length>=t.maxItems,g=t.minItems!=null&&s.length<=t.minItems,_=t.layout===`table`,v=t.layout===`grid`,b=t.itemLabels,x=e=>{let n=b?.[e];return typeof n==`string`&&n!==``?n:t.itemLabel?`${t.itemLabel} ${e+1}`:`#${e+1}`};if(i)return null;let S=s.map((e,t)=>({key:String(e.rowId??t),index:t,row:e,template:p,span:!1,heading:x(t)}));return(0,q.jsx)(it,{error:r[o],helperText:t.helperText??void 0,tooltip:t.tooltip??void 0,labelAction:Ht(t.labelAction),label:t.label??``,id:o,required:a,children:e=>(0,q.jsxs)(`div`,{...e,className:`flex flex-col gap-3`,role:`group`,children:[(0,q.jsx)(zp,{path:o,rows:s,rowKey:be}),_?(0,q.jsx)(vm,{base:o,columns:gm(p),rows:S,reorderable:t.reorderable??!1,removable:()=>!g,rowActions:t.rowActions,onField:c,onMove:u,onRemove:l,onDuplicate:d,registerRow:m,resizableColumns:t.resizableColumns===!0,resizeIndicator:t.resizeIndicator===!0}):(0,q.jsx)(`div`,{className:v?`grid gap-3`:`flex flex-col gap-3`,"data-test":v?`repeater-${n}-grid`:void 0,style:v?{gridTemplateColumns:`repeat(${t.gridColumns??2}, minmax(0, 1fr))`}:void 0,children:s.map((e,n)=>{let r=String(e.rowId??n);return(0,q.jsx)(`div`,{ref:e=>m(r,e),"data-flip-key":r,children:(0,q.jsx)(Vp,{base:o,index:n,row:e,template:p,heading:x(n),reorderable:t.reorderable??!1,isFirst:n===0,isLast:n===s.length-1,removable:!g,rowActions:t.rowActions,onField:c,onRemove:l,onMove:u,onDuplicate:d})},r)})}),!h&&(0,q.jsxs)(`button`,{type:`button`,"data-test":`repeater-${n}-add`,className:`inline-flex items-center gap-1.5 self-start rounded-lt-sm border border-lt-border px-3 py-1.5 text-sm hover:bg-lt-accent [&_svg]:size-lt-icon-sm`,onClick:()=>f({}),children:[(0,q.jsx)(y,{name:`plus`}),t.addLabel??`Add`]})]})})},Hh=({node:e})=>{let t=e.props,{errors:n}=at(),{hidden:r,required:i}=tt(e),a=Ee(),o=lh(t.name),s=a?a.errorKey(t.name):t.name;return r?null:(0,q.jsx)(it,{error:n[s],helperText:t.helperText??void 0,tooltip:t.tooltip??void 0,labelAction:Ht(t.labelAction),label:t.label??``,id:o,required:i,children:t=>(0,q.jsx)(ch,{controlProps:t,node:e})})};function Uh({className:e,...t}){return(0,q.jsx)(`textarea`,{"data-slot":`textarea`,"aria-readonly":t.readOnly&&!t.disabled?!0:void 0,className:x(`border-lt-input placeholder:text-lt-muted-fg flex field-sizing-content min-h-16 w-full rounded-lt-sm border bg-transparent px-3 py-2 text-base shadow-lt-xs transition-[color,box-shadow] outline-none aria-readonly:cursor-default aria-readonly:bg-lt-muted disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-lt-disabled disabled:text-lt-disabled-fg`,en,`aria-invalid:ring-lt-danger/20 dark:aria-invalid:ring-lt-danger/40 aria-invalid:border-lt-danger`,e),...t})}var Wh=({node:e})=>{let t=e.props;return(0,q.jsx)(Lm,{node:e,label:t.label??``,children:({name:e,testId:n,value:r,readOnly:i,disabled:a,commit:o},s)=>(0,q.jsx)(Uh,{...s,autoFocus:t.autoFocus??!1,"data-test":n,disabled:a,name:e,onChange:e=>o(e.target.value),placeholder:t.placeholder??``,readOnly:i,rows:t.rows??void 0,tabIndex:t.tabIndex??void 0,value:r})})};async function Gh(e){if(!navigator?.clipboard)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function Kh({value:e,label:t,testId:n,className:r,iconOnly:i=!1,children:a}){let{t:o}=N(F),[s,c]=(0,B.useState)(!1);(0,B.useEffect)(()=>{if(!s)return;let e=window.setTimeout(()=>c(!1),1500);return()=>window.clearTimeout(e)},[s]);async function l(){await Gh(e)&&c(!0)}let u=s?o(`common.copied-value`,`Copied {{label}}`,{label:t}):o(`common.copy-value`,`Copy {{label}}`,{label:t});return i?(0,q.jsx)(Jf,{icon:s?`check`:`copy`,label:u,"data-test":n,className:r,onClick:()=>void l()}):(0,q.jsx)(J,{type:`button`,size:`sm`,emphasis:`outline`,icon:s?`check`:`copy`,"data-test":n,className:r,"aria-label":u,onClick:()=>void l(),children:s?o(`common.copied`,`Copied`):a??o(`common.copy`,`Copy`)})}function qh({value:e,label:t,testId:n,children:r}){return(0,q.jsxs)(`div`,{className:`inline-flex items-center gap-2`,children:[r??e,(0,q.jsx)(Kh,{value:e,label:t,testId:n})]})}var Jh=({node:e})=>{let t=e.props,n=uh(e,t.prefixFieldName),r=uh(e,t.suffixFieldName);return(0,q.jsx)(Lm,{node:e,label:t.label??``,children:({name:e,testId:i,value:a,readOnly:o,disabled:s,commit:c},l)=>(0,q.jsx)(rh,{prefix:n?null:t.prefix,suffix:r?null:t.suffix,start:n?(0,q.jsx)(dh,{node:n,side:`start`}):void 0,end:r||t.copyable?(0,q.jsxs)(q.Fragment,{children:[r?(0,q.jsx)(dh,{node:r,side:`end`,last:!t.copyable}):null,t.copyable?(0,q.jsx)(Kh,{className:`h-lt-control-md gap-1.5 rounded-l-none rounded-r-lt-sm border-l-0 border-lt-input px-3 group-has-[:focus-visible]:border-lt-ring`,label:t.label??e,testId:`${i}-copy`,value:a}):null]}):null,children:n=>(0,q.jsx)(nn,{...l,autoComplete:t.autoComplete??``,autoFocus:t.autoFocus??!1,className:n,"data-test":i,disabled:s,name:e,onChange:e=>c(e.target.value),placeholder:t.placeholder??``,readOnly:o,tabIndex:t.tabIndex??void 0,type:t.type??`text`,value:a})})})},Yh=/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/;function Xh(e){if(typeof e!=`string`)return null;let t=Yh.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=Number(t[2]),i=t[3]?Number(t[3]):0;return n>23||r>59||i>59?null:{hour:n,minute:r,second:i}}function Zh(e,t){let n=[ig(e.hour),ig(e.minute)];return t&&n.push(ig(e.second)),n.join(`:`)}function Qh(e){return e!=null&&e<60}function $h(e,t={}){let{min:n,max:r,current:i}=t,a=tg(n),o=tg(r),s=e==null||e<60?1:e%60==0?e/60:1;return{hours:rg(0,23,1).map(e=>({value:e,label:ig(e),disabled:a!=null&&e<a.hour||o!=null&&e>o.hour})),minutes:ng(rg(0,59,s),i?.minute).map(e=>({value:e,label:ig(e),disabled:eg(e,i,a,o)})),seconds:Qh(e)?rg(0,59,1).map(e=>({value:e,label:ig(e),disabled:!1})):null}}function eg(e,t,n,r){return t?n!=null&&t.hour===n.hour&&e<n.minute||r!=null&&t.hour===r.hour&&e>r.minute:!1}function tg(e){let t=Xh(e);return t?{hour:t.hour,minute:t.minute}:null}function ng(e,t){return t==null||e.includes(t)?e:[...e,t].sort((e,t)=>e-t)}function rg(e,t,n){let r=[];for(let i=e;i<=t;i+=n)r.push(i);return r}function ig(e){return String(e).padStart(2,`0`)}function ag({value:e,onChange:t,step:n,min:r,max:i,disabled:a=!1,readOnly:o=!1,labels:s,testId:c}){let l=(0,B.useRef)(null),u=$h(n,{min:r,max:i,current:e}),d=e??{hour:0,minute:0,second:0},f=!a&&!o,p=[{key:`hour`,label:s?.hour??`Hour`,options:u.hours,selected:d.hour},{key:`minute`,label:s?.minute??`Minute`,options:u.minutes,selected:d.minute},...u.seconds?[{key:`second`,label:s?.second??`Second`,options:u.seconds,selected:d.second}]:[]];function m(e){let t=l.current?.querySelectorAll(`[role="listbox"]`)?.[e];t&&(t.querySelector(`[data-active="true"]`)??t.querySelector(`[role="option"]`))?.focus()}return(0,q.jsx)(`div`,{ref:l,className:`flex gap-1`,"data-test":c,children:p.map((n,r)=>(0,q.jsx)(og,{label:n.label,options:n.options,selected:e?n.selected:null,disabled:!f,onSelect:e=>f&&t({...d,[n.key]:e}),onHorizontal:e=>m(r+e)},n.key))})}function og({label:e,options:t,selected:n,disabled:r,onSelect:i,onHorizontal:a}){let o=(0,B.useRef)(null),s=t.filter(e=>!e.disabled).map(e=>e.value),c=n??s[0]??t[0]?.value??0;(0,B.useEffect)(()=>{(o.current?.querySelector(`[data-active="true"]`))?.scrollIntoView?.({block:`nearest`})},[n]);function l(e){e!=null&&(o.current?.querySelector(`[data-value="${e}"]`)?.focus(),i(e))}function u(e){if(r)return;let t=s.indexOf(c);switch(e.key){case`ArrowDown`:e.preventDefault(),l(s[Math.min(t+1,s.length-1)]);break;case`ArrowUp`:e.preventDefault(),l(s[Math.max(t-1,0)]);break;case`Home`:e.preventDefault(),l(s[0]);break;case`End`:e.preventDefault(),l(s[s.length-1]);break;case`ArrowRight`:e.preventDefault(),a(1);break;case`ArrowLeft`:e.preventDefault(),a(-1)}}return(0,q.jsx)(`div`,{ref:o,role:`listbox`,"aria-label":e,"aria-orientation":`vertical`,tabIndex:-1,className:`flex max-h-40 w-14 flex-col overflow-y-auto`,onKeyDown:u,children:t.map(t=>{let a=n===t.value;return(0,q.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":a,"aria-label":`${e} ${t.label}`,"data-value":t.value,"data-active":c===t.value,disabled:r||t.disabled,tabIndex:c===t.value?0:-1,onClick:()=>i(t.value),className:x(`shrink-0 rounded-lt-sm px-2 py-1 text-sm text-lt-fg hover:bg-lt-muted`,a&&`bg-lt-primary text-lt-primary-fg`,(r||t.disabled)&&`cursor-not-allowed opacity-40`),children:t.label},t.value)})})}var sg=({node:e})=>{let t=e.props,n=Qh(t.step),r=t.label??t.name;return(0,q.jsx)(Lm,{node:e,label:t.label??``,children:({name:e,testId:i,value:a,readOnly:o,disabled:s,commit:c,blur:l},u)=>(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(nn,{...u,"aria-label":r,autoFocus:t.autoFocus??!1,"data-test":i,disabled:s,name:e,onBlur:()=>{let e=Xh(a);e&&c(Zh(e,n)),l()},onChange:e=>c(e.target.value),readOnly:o,tabIndex:t.tabIndex??void 0,type:`text`,value:a}),(0,q.jsxs)(Zt,{children:[(0,q.jsx)(Pe,{asChild:!0,children:(0,q.jsx)(J,{"aria-label":`Open ${r} time picker`,disabled:s||o,size:`icon`,type:`button`,variant:`secondary`,children:(0,q.jsx)(y,{name:`clock`,className:`size-lt-icon-md`,"aria-hidden":`true`})})}),(0,q.jsx)(Jt,{className:`p-2`,children:(0,q.jsx)(ag,{value:Xh(a),onChange:e=>c(Zh(e,n)),step:t.step,min:t.min,max:t.max,disabled:s,readOnly:o,testId:`${i}-picker`})})]})]})})};function cg({checked:e,className:t,onCheckedChange:n,...r}){return(0,q.jsx)(`button`,{...r,"aria-checked":e,className:x(`inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border border-transparent bg-lt-muted p-0.5 shadow-lt-xs transition-colors outline-none focus-visible:border-lt-ring focus-visible:ring-[length:var(--lt-ring-width)] focus-visible:ring-lt-ring/50 aria-readonly:cursor-default disabled:cursor-not-allowed disabled:bg-lt-disabled data-[state=checked]:bg-lt-primary disabled:data-[state=checked]:bg-lt-disabled`,t),"data-state":e?`checked`:`unchecked`,onClick:()=>n?.(!e),role:`switch`,type:`button`,children:(0,q.jsx)(`span`,{className:`size-5 rounded-full bg-lt-bg shadow-lt-sm transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`,"data-state":e?`checked`:`unchecked`})})}var lg=({node:e})=>{let t=e.props;return Dm(t.name,wt(t.value)),(0,q.jsx)(Lm,{node:e,label:t.label??``,children:({name:e,testId:n,rawValue:r,readOnly:i,disabled:a,commit:o},s)=>{let c=wt(r);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`input`,{disabled:i||a,name:e,type:`hidden`,value:c?`1`:`0`}),(0,q.jsx)(cg,{...s,"aria-label":t.label??t.name,"aria-readonly":i&&!a?!0:void 0,autoFocus:t.autoFocus??!1,checked:c,"data-test":n,disabled:a,name:e,onCheckedChange:e=>{i||o(e)},tabIndex:t.tabIndex??void 0})]})}})};function ug(e){let t=[],n=e=>{let r=Se(e).name;if(r&&t.push(r),!(r&&We(e)))for(let t of e.schema??[])n(t)};for(let t of e.schema??[])n(t);return t}function dg(e){let t=[],n=e=>{let r=Se(e).name;if(r&&t.push(r,`${r}.*`),r&&We(e)){for(let n of ug(e))t.push(`${r}.*.${n}`);return}for(let t of e.schema??[])n(t)};for(let t of e.schema??[])n(t);return t}function fg(e,t){let n=Object.keys(t).filter(e=>!!t[e]),r=new Set;return e.forEach((e,t)=>{n.some(t=>e.some(e=>tf(t,e)))&&r.add(t)}),r}function pg(e,t){let n=fg(e,t);return n.size>0?Math.min(...n):null}var mg={center:`justify-center`,end:`justify-end`,start:`justify-start`,stretch:`justify-stretch`},hg=(0,B.createContext)({activeName:``});function gg(e){let t=(e.schema??[]).filter(e=>e.type===`wizard-step`);return{items:t.map(e=>e.props),nodes:t}}var _g=({children:e,node:t})=>{let{t:n}=N(`lattice`),{errors:r,processing:i,touch:a,validateFields:o,validating:s}=at(),{items:c,nodes:l}=(0,B.useMemo)(()=>gg(t),[t]),u=(0,B.useMemo)(()=>l.map(e=>ug(e)),[l]),d=t.props.orientation===`vertical`,[f,p]=(0,B.useState)(0),[m,h]=(0,B.useState)(()=>new Set([0])),[g,_]=(0,B.useState)(()=>new Set),v=(0,B.useMemo)(()=>fg(u,r),[u,r]),b=f===c.length-1,S=e=>{p(e),h(t=>new Set(t).add(e))},C=()=>{_(e=>new Set(e).add(f)),b||S(f+1)},w=()=>{let e=l[f],t=e?dg(e):[];if(t.length===0){C();return}a(t),o(t,{onSuccess:C})},T=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if(T.current&&!i){let e=pg(u,r);e!==null&&e!==f&&S(e)}T.current=i},[i,r,u,f]);let E=(0,B.useMemo)(()=>({activeName:c[f]?.name??``}),[c,f]);return(0,q.jsx)(hg.Provider,{value:E,children:(0,q.jsxs)(`div`,{className:x(`gap-6`,d?`flex`:`grid`),"data-slot":`wizard`,children:[(0,q.jsx)(`ol`,{"aria-label":n(`form.wizard.steps`,`Steps`),className:x(`gap-1`,d?`flex w-56 shrink-0 flex-col`:`flex flex-wrap`,!d&&mg[t.props.align??`start`]),children:c.map((e,t)=>{let n=t===f,r=g.has(t),i=v.has(t);return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{"aria-current":n?`step`:void 0,className:x(`flex w-full items-center gap-2 rounded-lt px-3 py-2 text-left text-sm`,n?`bg-lt-muted font-medium text-lt-fg`:`text-lt-muted-fg`,!m.has(t)&&`cursor-not-allowed opacity-60`),"data-error":i||void 0,"data-test":`wizard-rail-${e.name}`,disabled:!m.has(t),id:`wizard-step-${e.name}-trigger`,onClick:()=>S(t),type:`button`,children:[(0,q.jsx)(`span`,{className:x(`flex size-5 shrink-0 items-center justify-center rounded-full border text-xs`,i?`border-lt-danger text-lt-danger`:r?`border-lt-primary bg-lt-primary text-lt-primary-fg`:`border-lt-border`),children:r&&!i?(0,q.jsx)(y,{className:`size-lt-icon-sm`,name:`check`}):t+1}),(0,q.jsxs)(`span`,{className:`min-w-0`,children:[(0,q.jsx)(`span`,{className:`block truncate`,children:e.label}),d&&e.description&&(0,q.jsx)(`span`,{className:`block truncate text-xs text-lt-muted-fg`,children:e.description})]})]})},e.name)})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-6`,children:[e,(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsx)(J,{"data-test":`wizard-back`,disabled:f===0||i,onClick:()=>S(f-1),type:`button`,emphasis:`outline`,children:n(`form.wizard.back`,`Back`)}),b?(0,q.jsxs)(J,{"data-test":`wizard-finish`,disabled:i,type:`submit`,children:[i&&(0,q.jsx)(Jl,{}),n(`form.wizard.finish`,`Finish`)]}):(0,q.jsxs)(J,{"data-test":`wizard-next`,disabled:i||s,onClick:w,type:`button`,children:[s&&(0,q.jsx)(Jl,{}),n(`form.wizard.next`,`Next`)]})]})]})]})})},vg=({children:e,node:t})=>{let{activeName:n}=(0,B.useContext)(hg),r=t.props.name,i=n===r,[a,o]=(0,B.useState)(i);return(0,B.useEffect)(()=>{i&&o(!0)},[i]),(0,q.jsx)(`section`,{"aria-labelledby":`wizard-step-${r}-trigger`,className:x(`space-y-8`,!i&&`hidden`),hidden:!i,id:`wizard-step-${r}-panel`,children:a?e:null})},yg=(0,B.lazy)(()=>dn(()=>import(`./pattern-input-view-CjbnNynq.js`),__vite__mapDeps([9,1,2,5,6,7,10,4,11,12,3,13,14,15,8,16]),import.meta.url)),bg=({children:e,node:t})=>(0,q.jsx)(B.Suspense,{fallback:null,children:(0,q.jsx)(yg,{node:t,children:e})}),xg=(0,B.lazy)(()=>dn(()=>import(`./rich-editor-view-4ZhBfx6i.js`),__vite__mapDeps([17,1,2,5,13,6,7,10,4,11,12,3,14,15,16]),import.meta.url)),Sg={components:{form:V(Qm),"field.builder":V(wm),"field.checkbox":V(Om),"field.checkbox-group":V(Am),"field.choice":V(Im),"field.color-picker":V(Rm),"field.date-input":V(Vm),"field.date-time-input":V(Hm),"field.file-upload":V(Km),"field.hidden-input":V(th),"field.number-input":V(fh),"field.otp":V(Lh),"field.password-input":V(zh),"field.pattern-input":V(bg),"field.repeater":V(Vh),"field.rich-editor":V(({children:e,node:t})=>(0,q.jsx)(B.Suspense,{fallback:null,children:(0,q.jsx)(xg,{node:t,children:e})})),"field.select":V(Hh),"field.textarea":V(Wh),"field.text-input":V(Jh),"field.time-input":V(sg),"field.toggle":V(lg),wizard:V(_g),"wizard-step":V(vg)},name:`lattice/form`},Cg={lg:320,md:64,sm:40,xl:384,xs:32,"2xl":448,"3xl":512,"4xl":576},wg={components:{fragment:V(({node:e})=>{let t=e.props.endpoint??``,n=e.props.lazy===!0,r=e.props.ref??``,i=Cg[e.props.size],[a,o]=(0,B.useState)(()=>e.schema??[]),[s,c]=(0,B.useState)(!n),[l,u]=(0,B.useState)(n&&t!==``),f=(0,B.useCallback)(async()=>{if(t){u(!0);try{let e=await Hu(t,{ref:r});o(Gt(e.schema)),c(!0)}finally{u(!1)}}},[t,r]);return(0,B.useEffect)(()=>{!n||s||f()},[s,n,f]),(0,B.useEffect)(()=>{function t(t){t.detail?.component===e.id&&f()}return window.addEventListener(d.reloadComponent,t),()=>window.removeEventListener(d.reloadComponent,t)},[f,e.id]),(0,B.useEffect)(()=>{function e(){s&&f()}return window.addEventListener(d.localeChange,e),()=>window.removeEventListener(d.localeChange,e)},[s,f]),(0,q.jsx)(`div`,{"data-lattice-fragment":e.id,style:l&&a.length===0?{minHeight:i}:void 0,children:l&&a.length===0?(0,q.jsx)(zd,{className:`w-full`,style:{height:i}}):(0,q.jsx)(Qe,{nodes:a})})})},name:`lattice/fragments`},Tg=(0,B.createContext)(null);function Eg({outlet:e,children:t}){return(0,q.jsx)(Tg.Provider,{value:e,children:t})}function Dg(){return(0,B.useContext)(Tg)}var Og={components:{outlet:V(()=>(0,q.jsx)(q.Fragment,{children:Dg()}))},name:`lattice/layout`};function kg(e,t=1){return Hu(`${e}?page=${t}`)}function Ag(e,t){return Hu(`${e}/${t}/read`,{method:`PATCH`})}function jg(e){return Hu(`${e}/read-all`,{method:`POST`})}function Mg(e,t){return Hu(`${e}/${t}`,{method:`DELETE`})}function Ng(e){return Hu(e,{method:`DELETE`})}function Pg(e,t){return e.some(e=>e.id===t.id)?e:[t,...e]}function Fg(e,t){return e.map(e=>e.id===t?{...e,isRead:!0}:e)}function Ig(e,t){return e.filter(e=>e.id!==t)}function Lg({endpoint:e,pollingInterval:t}){let[n,r]=(0,B.useState)([]),[i,a]=(0,B.useState)(0),[o,s]=(0,B.useState)(`loading`),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(!1),f=(0,B.useRef)(1),p=(0,B.useRef)(c);p.current=c;let m=(0,B.useRef)(!1),h=(0,B.useCallback)(async()=>{try{let t=await kg(e,1);f.current=1,r(t.notifications),a(t.unreadCount),l(t.hasMore),s(`idle`)}catch{s(`error`)}},[e]);return(0,B.useEffect)(()=>{h()},[h]),(0,B.useEffect)(()=>{if(!t||t<=0)return;let e=setInterval(()=>void h(),t*1e3);return()=>clearInterval(e)},[h,t]),{notifications:n,unreadCount:i,status:o,hasMore:c,open:u,setOpen:d,loadMore:(0,B.useCallback)(()=>{if(m.current||!p.current)return;m.current=!0;let t=f.current+1;kg(e,t).then(e=>{f.current=t,r(t=>[...t,...e.notifications]),l(e.hasMore)}).catch(()=>void h()).finally(()=>{m.current=!1})},[e,h]),markRead:(0,B.useCallback)(t=>{r(e=>Fg(e,t)),a(e=>Math.max(0,e-1)),Ag(e,t).then(e=>a(e.unreadCount)).catch(()=>void h())},[e,h]),markAllRead:(0,B.useCallback)(()=>{r(e=>e.map(e=>({...e,isRead:!0}))),a(0),jg(e).then(e=>a(e.unreadCount)).catch(()=>void h())},[e,h]),dismiss:(0,B.useCallback)(t=>{r(e=>Ig(e,t)),Mg(e,t).then(e=>a(e.unreadCount)).catch(()=>void h())},[e,h]),clearAll:(0,B.useCallback)(()=>{r([]),a(0),Ng(e).then(e=>a(e.unreadCount)).catch(()=>void h())},[e,h]),receive:(0,B.useCallback)(e=>{r(t=>{let n=Pg(t,e);return n!==t&&a(e=>e+1),n})},[])}}function Rg(e){let t=e,n=new Set;return{publish(e){t=e,n.forEach(e=>e())},subscribe(e){return n.add(e),()=>n.delete(e)},getSnapshot:()=>t}}var zg=(0,B.createContext)(null),Bg=zg.Provider;function Vg(){let e=(0,B.useContext)(zg);if(!e)throw Error(`useLiveNotifications must be used within a NotificationsBridgeProvider.`);return(0,B.useSyncExternalStore)(e.subscribe,e.getSnapshot)}function Hg(){let{t:e}=N(`lattice`);return(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-lt-muted-fg`,children:[(0,q.jsx)(y,{name:`bell`,className:`size-lt-icon-lg`}),(0,q.jsx)(`p`,{className:`text-sm`,children:e(`notifications.empty`,`No notifications yet`)})]})}function Ug(e){return typeof e==`object`&&!!e&&typeof e.key==`string`}function Wg(e,t){return t.split(`.`).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e)}function Gg(e,t){return Ug(e)?Kg(e,{},t):e}function Kg(e,t,n){let r={};for(let[n,i]of Object.entries(e.payload)){let e=Wg(t,i);r[n]=e===void 0?``:e}return n(e.key,e.key,{...e.replacements,...r})}var qg={primary:`text-lt-primary`,secondary:`text-lt-muted-fg`,success:`text-lt-success`,info:`text-lt-info`,warning:`text-lt-warning`,danger:`text-lt-danger`};function Jg({notification:e,onMarkRead:t,onDismiss:n}){let{t:r}=N(`lattice`),i=Gg(e.title,r),a=Gg(e.body,r),o=(0,q.jsxs)(q.Fragment,{children:[i?(0,q.jsx)(`p`,{className:`truncate text-sm font-medium text-lt-fg`,children:i}):null,a?(0,q.jsx)(`p`,{className:`text-sm text-lt-muted-fg`,children:a}):null]});return(0,q.jsxs)(`li`,{className:x(`flex gap-3 px-3 py-3`,!e.isRead&&`bg-lt-muted/40`),"data-test":`notification`,children:[e.icon?(0,q.jsx)(tl,{icon:e.icon,className:x(`mt-0.5 size-lt-icon-md`,e.variant?qg[e.variant]:void 0)}):null,(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[e.href?(0,q.jsx)(Fc,{href:e.href,className:`block`,"data-test":`notification-link`,onClick:()=>t(e.id),children:o}):o,e.actions.length>0?(0,q.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:e.actions.map((e,t)=>(0,q.jsx)(Xt,{node:e},e.key??e.id??`action-${t}`))}):null]}),(0,q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1`,children:[e.isRead?null:(0,q.jsx)(`button`,{type:`button`,className:`text-xs text-lt-muted-fg hover:text-lt-fg`,onClick:()=>t(e.id),children:r(`notifications.mark-read`,`Mark read`)}),(0,q.jsx)(`button`,{type:`button`,"aria-label":r(`notifications.dismiss`,`Dismiss`),className:`text-xs text-lt-muted-fg hover:text-lt-fg`,onClick:()=>n(e.id),children:r(`notifications.dismiss`,`Dismiss`)})]})]})}function Yg({notifications:e,status:t,hasMore:n,onMarkRead:r,onDismiss:i,onLoadMore:a}){let{t:o}=N(`lattice`);return t===`loading`&&e.length===0?(0,q.jsxs)(`div`,{className:`space-y-2 p-3`,children:[(0,q.jsx)(zd,{className:`h-12 w-full`}),(0,q.jsx)(zd,{className:`h-12 w-full`}),(0,q.jsx)(zd,{className:`h-12 w-full`})]}):e.length===0?(0,q.jsx)(Hg,{}):(0,q.jsxs)(`div`,{className:`max-h-96 overflow-y-auto`,children:[(0,q.jsx)(`ul`,{className:`divide-y divide-lt-border`,children:e.map(e=>(0,q.jsx)(Jg,{notification:e,onMarkRead:r,onDismiss:i},e.id))}),n?(0,q.jsx)(`button`,{type:`button`,className:`w-full py-2 text-sm text-lt-muted-fg hover:text-lt-fg`,onClick:a,children:o(`notifications.load-more`,`Load more`)}):null]})}function Xg({onClosed:e}){let t=lu();if(!t)throw Error(su);let n=Vg(),{t:r}=N(`lattice`),i=r(`notifications.label`,`Notifications`),a=r(`notifications.heading`,`Notifications`);return(0,q.jsx)(Od,{open:t.open,onOpenChange:t.onOpenChange,children:(0,q.jsxs)(Nd,{"aria-describedby":void 0,className:`p-0`,onCloseAutoFocus:n=>{t.onExited(n),e()},placement:`end`,width:`sm`,children:[(0,q.jsx)(jd,{className:`sr-only`,children:i}),(0,q.jsxs)(`div`,{className:`w-full`,"data-test":`notifications-panel`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-lt-border px-3 py-2`,children:[(0,q.jsx)(`span`,{className:`text-sm font-medium`,children:a}),n.unreadCount>0?(0,q.jsx)(`button`,{type:`button`,className:`text-xs text-lt-muted-fg hover:text-lt-fg`,onClick:n.markAllRead,children:r(`notifications.mark-all-read`,`Mark all read`)}):null]}),(0,q.jsx)(Yg,{notifications:n.notifications,status:n.status,hasMore:n.hasMore,onMarkRead:n.markRead,onDismiss:n.dismiss,onLoadMore:n.loadMore})]})]})})}var Zg=(0,B.lazy)(()=>dn(()=>import(`./notifications-echo-BLO9_g1w.js`).then(e=>({default:e.NotificationsEcho})),__vite__mapDeps([18,19,1,2]),import.meta.url)),Qg=class extends B.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(){console.warn(`[lattice] The notifications bell declares a realtime channel but Echo is unavailable. Install @laravel/echo-react and call configureEcho().`)}render(){return this.state.failed?null:this.props.children}},$g={name:`lattice/notifications`,components:{notifications:V(({node:e})=>{let{t}=N(`lattice`),n=Lg({endpoint:e.props.endpoint,pollingInterval:e.props.pollingInterval}),r=fu(),i=(0,B.useRef)(null),[a]=(0,B.useState)(()=>Rg(n));(0,B.useEffect)(()=>{a.publish(n)},[a,n]);let o=t(`notifications.label`,`Notifications`),s=(0,B.useCallback)(()=>{i.current||=r.open((0,q.jsx)(Bg,{value:a,children:(0,q.jsx)(Xg,{onClosed:()=>{i.current=null}})}))},[a,r]),c=(0,q.jsxs)(`span`,{className:`relative inline-flex items-center justify-center rounded-lt-sm p-2 hover:bg-lt-muted`,children:[(0,q.jsx)(y,{name:`bell`,className:`size-lt-icon-md`}),n.unreadCount>0?(0,q.jsx)(`span`,{"data-test":`notifications-badge`,className:`absolute -right-0.5 -top-0.5 inline-flex min-w-4 items-center justify-center rounded-lt-full bg-lt-danger px-1 py-0 text-[10px] font-medium text-lt-danger-fg`,children:n.unreadCount}):null]}),l=(0,q.jsxs)(`div`,{className:`w-80`,"data-test":`notifications-panel`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-lt-border px-3 py-2`,children:[(0,q.jsx)(`span`,{className:`text-sm font-medium`,children:t(`notifications.heading`,`Notifications`)}),n.unreadCount>0?(0,q.jsx)(`button`,{type:`button`,className:`text-xs text-lt-muted-fg hover:text-lt-fg`,onClick:n.markAllRead,children:t(`notifications.mark-all-read`,`Mark all read`)}):null]}),(0,q.jsx)(Yg,{notifications:n.notifications,status:n.status,hasMore:n.hasMore,onMarkRead:n.markRead,onDismiss:n.dismiss,onLoadMore:n.loadMore})]});return(0,q.jsxs)(q.Fragment,{children:[e.props.channel?(0,q.jsx)(Qg,{children:(0,q.jsx)(B.Suspense,{fallback:null,children:(0,q.jsx)(Zg,{channel:e.props.channel,onReceive:e=>n.receive(e)})})}):null,e.props.slideOut?(0,q.jsx)(`button`,{type:`button`,"aria-label":o,"data-test":`notifications-trigger`,onClick:s,children:c}):(0,q.jsxs)(Zt,{open:n.open,onOpenChange:n.setOpen,children:[(0,q.jsx)(Pe,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,"aria-label":o,"data-test":`notifications-trigger`,children:c})}),(0,q.jsx)(Jt,{align:`end`,className:`p-0`,children:l})]})]})})}};function e_(e){return e==null?``:String(e)}function t_({props:e}){let{t}=N(`lattice`),[n,r]=(0,B.useState)([]),[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{if(!e.remote||!e.dataEndpoint){r([]),c(!1);return}let t=!1;return o(null),c(!0),Yu(e.dataEndpoint,{remote:e.remote}).then(e=>{t||r(e.data??[])}).catch(e=>{t||o(e instanceof Error?e.message:String(e))}).finally(()=>{t||c(!1)}),()=>{t=!0}},[e.dataEndpoint,e.remote]),a?(0,q.jsx)(`div`,{className:`rounded-lt border border-lt-danger/40 p-3 text-sm`,children:a}):s||!e.remote?(0,q.jsx)(`div`,{className:`rounded-lt border border-lt-border p-3 text-sm`,children:t(`common.remote.data-list.loading`,`Loading...`)}):(0,q.jsxs)(`div`,{className:`rounded-lt border border-lt-border bg-lt-bg`,children:[(0,q.jsx)(`div`,{className:`border-b border-lt-border px-3 py-2 text-sm font-medium`,children:t(`common.remote.data-list.title`,`Remote data`)}),(0,q.jsxs)(`div`,{className:`divide-y divide-lt-border`,children:[n.map((t,n)=>(0,q.jsx)(`div`,{className:`px-3 py-2`,children:(0,q.jsx)(Qe,{nodes:i(e.schema,t)})},e_(t.id)||n)),n.length===0?(0,q.jsx)(`div`,{className:`px-3 py-2 text-sm text-lt-muted-fg`,children:e.emptyLabel??t(`common.remote.data-list.empty`,`No data`)}):null]})]})}var n_={components:{"remote.data-list":V(({node:e})=>(0,q.jsx)(t_,{props:{...e.props,schema:e.schema}}))},name:`lattice/remote`};function r_(e){return e==null||e===``}function i_(e){return r_(e)?!0:Array.isArray(e)?e.every(i_):typeof e==`object`&&e?Object.values(e).every(i_):!1}function a_(e){return!i_(e)}function o_(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function s_(e){return o_(e)?e:{}}function c_(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.field==`string`&&typeof e.operator==`string`&&typeof e.value==`string`):[]}function l_(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&`key`in e&&`props`in e&&typeof e.key==`string`&&typeof e.props==`object`&&e.props!==null&&typeof e.props.label==`string`):[]}function u_(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)):[]}var d_={mode:`none`,currentPage:null,lastPage:null,perPage:null,total:null,from:null,to:null,hasMore:!1,nextPage:null};function f_(e){return typeof e!=`object`||!e||Array.isArray(e)?d_:e}function p_(e){if(typeof e!=`object`||!e||Array.isArray(e))return{filters:[],sorts:[],page:1,perPage:25,tableFilters:{},tableFilterIndicators:[],search:``,mode:null};let t=e;return{filters:c_(t.filters),sorts:Array.isArray(t.sorts)?t.sorts:[],page:typeof t.page==`number`?t.page:1,perPage:typeof t.perPage==`number`?t.perPage:25,tableFilters:__(t.tableFilters),tableFilterIndicators:v_(t.tableFilterIndicators),search:typeof t.search==`string`?t.search:``,mode:h_(t.mode)}}var m_=new Set([`none`,`simple`,`table`,`infinite`]);function h_(e){return typeof e==`string`&&m_.has(e)?e:null}function g_(e){return Array.isArray(e)?e.filter(e=>typeof e==`number`||e===`infinite`):[]}function __(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`object`&&e[1]!==null&&!Array.isArray(e[1])))}function v_(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.filter==`string`&&typeof e.label==`string`&&typeof e.value==`string`):[]}function y_(e,t){let n=e.id??e.uuid??e.key??t;return String(n)}function b_(e){return Array.isArray(e.actions)?e.actions:[]}function x_(e){let t=e.detail;return typeof t==`object`&&t&&!Array.isArray(t)?t:null}function S_(e){let t=e.rowClick;return typeof t==`object`&&t&&!Array.isArray(t)?t:null}function C_(e,t){let n=e.popovers;if(typeof n!=`object`||!n||Array.isArray(n))return null;let r=n[t];return typeof r==`object`&&r&&!Array.isArray(r)?r:null}function w_(e,t){let n=e.links;if(typeof n!=`object`||!n||Array.isArray(n))return;let r=n;if(!(t in r))return;let i=r[t];return typeof i==`string`?i:null}function T_(e,t){return e.sorts.find(e=>e.key===t.key)}function E_(e,t){let n=new URL(e,window.location.origin);return t.filters.length>0&&n.searchParams.set(`filter`,F_(t)),t.sorts.length>0&&n.searchParams.set(`sort`,I_(t)),t.search!==``&&n.searchParams.set(`q`,t.search),D_(n,t.tableFilters),n.searchParams.set(`page`,String(t.page)),n.searchParams.set(`per_page`,String(t.perPage)),t.mode!=null&&n.searchParams.set(`mode`,t.mode),`${n.pathname}${n.search}`}function D_(e,t){for(let[n,r]of Object.entries(O_(t)))j_(e,`tf[${n}]`,r)}function O_(e){let t={};for(let[n,r]of Object.entries(e)){let e=k_(r);e!==void 0&&(t[n]=e)}return t}function k_(e){if(r_(e)||Array.isArray(e)||typeof e!=`object`)return;let t=Object.entries(e).map(([e,t])=>[e,A_(t)]).filter(e=>e[1]!==void 0);return t.length>0?Object.fromEntries(t):void 0}function A_(e){if(!r_(e)){if(Array.isArray(e)){let t=e.map(A_).filter(e=>e!==void 0);return t.length>0?t:void 0}if(typeof e==`object`){if(e===null)return;let t=Object.entries(e).map(([e,t])=>[e,A_(t)]).filter(e=>e[1]!==void 0);return t.length>0?Object.fromEntries(t):void 0}return String(e)}}function j_(e,t,n){if(Array.isArray(n)){for(let r of n)j_(e,`${t}[]`,r);return}if(typeof n==`object`&&n){for(let[r,i]of Object.entries(n))j_(e,`${t}[${r}]`,i);return}e.searchParams.append(t,String(n))}async function M_(e,t,n,r,i){if(!e)return[];let a=new URL(e,window.location.origin);a.searchParams.set(`_sub`,`search`),a.searchParams.set(`_target`,n),a.searchParams.set(`_q`,r);let o=await Vu(`${a.pathname}${a.search}`,{ref:t,signal:i,throwOnError:!1});return o.ok?(await o.json()).options??[]:[]}function N_(e){let t={};e.filters.length>0&&(t.filter=F_(e)),e.sorts.length>0&&(t.sort=I_(e));let n=O_(e.tableFilters);return Object.keys(n).length>0&&(t.tf=n),e.search!==``&&(t.q=e.search),t}function P_(e,t){let n=N_(e);return e.page>1&&(n.page=e.page),e.perPage!==t&&(n.per_page=e.perPage),n}function F_(e){return e.filters.map(e=>`${e.field}:${e.operator}:${encodeURIComponent(e.value)}`).join(`,`)}function I_(e){return e.sorts.map(e=>e.direction===`desc`?`-${e.key}`:e.key).join(`,`)}var L_={contains:`contains`,starts_with:`starts with`,ends_with:`ends with`,eq:`equals`,neq:`not equals`,gt:`>`,gte:`≥`,lt:`<`,lte:`≤`,in:`in`,not_in:`not in`,before:`before`,after:`after`,empty:`is empty`,filled:`is not empty`},R_=new Set([`empty`,`filled`]);function z_(e){return re(`lattice`,`table.operators.${e}`,L_[e]??e)}function B_(e){return e===`desc`?`descending`:`ascending`}function V_(e,t){if(!t.props.sortable)return e;let n=e.find(e=>e.key===t.key),r=e.filter(e=>e.key!==t.key);return n?n.direction===`asc`?[...r,{key:t.key,direction:`desc`}]:r:[...e,{key:t.key,direction:`asc`}]}function H_(e,t){if(t<=5)return Array.from({length:t},(e,t)=>t+1);let n=Math.max(1,Math.min(e-2,t-4));return Array.from({length:5},(e,t)=>n+t)}function U_(e,t){let n=[],r=[],i=[];for(let a of e){let e=t(a);e===`start`?n.push(a):e===`end`?i.push(a):r.push(a)}return[...n,...r,...i]}function W_(e,t){return e.map(e=>({key:e.key,label:e.props.label,pin:t?.(e)??void 0,width:G_(e)}))}function G_(e){return e.props.width??`md`}var K_=[`filter`,`sort`,`q`,`page`,`per_page`,`tf`],q_=[`q`,`tf`];function J_(e,t){if(typeof window>`u`)return;let n=new URL(window.location.href);for(let e of Array.from(n.searchParams.keys()))Y_(e,t)&&n.searchParams.delete(e);for(let[r,i]of Object.entries(e))j_(n,t.key===null?r:`${t.key}[${r}]`,i);n.search!==window.location.search&&window.history.replaceState(window.history.state,``,`${n.pathname}${n.search}${n.hash}`)}function Y_(e,t){return t.key===null?t.ownedKeys.some(t=>e===t||e.startsWith(`${t}[`)):e===t.key||e.startsWith(`${t.key}[`)}var X_=new Map;function Z_(e,t){let n=e.key??``,r=X_.get(n)??new Set;return r.add(t),X_.set(n,r),()=>{r.delete(t),r.size===0&&X_.delete(n)}}function Q_(e){let t=(0,B.useMemo)(()=>l_(e.props?.columns),[e.props?.columns]),n=typeof e.props?.endpoint==`string`?e.props.endpoint:null,r=typeof e.props?.ref==`string`?e.props.ref:``,i=e.props?.lazy===!0,a=(0,B.useMemo)(()=>p_(e.props?.query),[e.props?.query]),o=(0,B.useMemo)(()=>u_(e.props?.data),[e.props?.data]),s=(0,B.useMemo)(()=>f_(e.props?.pagination),[e.props?.pagination]),[c,l]=(0,B.useState)(o),[u,f]=(0,B.useState)(s),[p,m]=(0,B.useState)(a),[h,g]=(0,B.useState)(i),[_,v]=(0,B.useState)(!i),y=(0,B.useRef)(null),b=u.currentPage??p.page,x=(u.mode??`table`)===`infinite`,S=(0,B.useCallback)(async(e,t=!1)=>{if(n){g(!0);try{let i=await Hu(E_(n,e),{ref:r}),a=p_(i.query),o=u_(i.data);l(e=>t?[...e,...o]:o),f(f_(i.pagination)),m(a),v(!0)}finally{g(!1)}}},[n,r]);function C(e){S({...p,page:1,sorts:V_(p.sorts,e)})}function w(e){let t={...p,page:1,sorts:e};m(t),S(t)}function T(e){S({...p,page:1,sorts:p.sorts.filter(t=>t.key!==e.key)})}function E(e){let t={...p,filters:e,page:1};m(t),S(t)}function D(e){E([...p.filters,e])}function O(e,t){E(p.filters.map((n,r)=>r===e?t:n))}function k(e){E(p.filters.filter((t,n)=>n!==e))}function ee(e,t){E([...p.filters.filter(t=>t.field!==e),...t])}function A(e,t){let n={...p.tableFilters};i_(t)||!o_(t)?delete n[e]:n[e]=t;let r={...p,tableFilters:n,tableFilterIndicators:p.tableFilterIndicators.filter(t=>t.filter!==e),page:1};m(r),S(r)}function j(){let e={...p,filters:[],tableFilters:{},tableFilterIndicators:[],search:``,page:1};m(e),S(e)}function M(e){let t={...p,search:e,page:1};m(t),S(t)}let te=(0,B.useCallback)((e,t,i)=>M_(n,r,e,t,i),[n,r]);function N(e){S({...p,page:e})}function P(e){let t=s.mode??`table`,n={...p,perPage:e===`infinite`?p.perPage:e,mode:e===`infinite`?`infinite`:t===`infinite`?`table`:null,page:1};m(n),S(n)}let F=(0,B.useCallback)(()=>{h||!u.hasMore||S({...p,page:u.nextPage??b+1},!0)},[b,S,u.hasMore,u.nextPage,h,p]);(0,B.useEffect)(()=>{l(o),f(s),m(a),g(i),v(!i)},[o,s,a,i]),(0,B.useEffect)(()=>{!i||_||S(p)},[_,i,S,p]),Pl(d.reloadComponent,t=>{t.detail?.component===e.id&&S(p)});let ne=e.props?.syncQuery===!0,I=e.props?.queryKey??null;return(0,B.useEffect)(()=>{if(ne)return Z_({key:I,ownedKeys:K_},r)},[r,I,ne]),(0,B.useEffect)(()=>{ne&&J_(P_(p,e.props?.defaultPerPage??25),{key:I,ownedKeys:K_})},[e.props?.defaultPerPage,p,I,ne]),(0,B.useEffect)(()=>{if(!x||!u.hasMore||h||!y.current||typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&F()},{rootMargin:`240px`});return e.observe(y.current),()=>e.disconnect()},[x,F,u.hasMore,h]),{columns:t,rows:c,pagination:u,query:p,filters:p.filters,tableFilters:p.tableFilters,search:p.search,addFilter:D,updateFilter:O,removeFilter:k,replaceColumnFilters:ee,setTableFilter:A,resetFilters:j,setSearch:M,searchFilterOptions:te,processing:h,hasLoaded:_,infiniteLoaderRef:y,sort:C,setSorts:w,clearSort:T,goToPage:N,setPerPage:P,loadMore:F}}function $_(e){let[t,n]=(0,B.useState)(()=>new Set),[r,i]=(0,B.useState)(!1),a=e.join(` `);(0,B.useEffect)(()=>{n(new Set),i(!1)},[a]);let o=(0,B.useCallback)(e=>{i(!1),n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),s=(0,B.useCallback)(()=>{i(!1),n(t=>t.size===e.length?new Set:new Set(e))},[e]),c=(0,B.useCallback)(()=>i(!0),[]),l=(0,B.useCallback)(()=>{i(!1),n(new Set)},[]),u=e.filter(e=>t.has(e)),d=e.length>0&&u.length===e.length;return{selectedKeys:u,allMatching:r,allVisibleSelected:d,allSelected:r||d,active:r||u.length>0,isSelected:e=>r||t.has(e),toggle:o,toggleAll:s,selectAllMatching:c,clear:l}}function ev({columns:e,storageKey:t}){let n=(0,B.useMemo)(()=>e.map(e=>e.key),[e]),r=(0,B.useMemo)(()=>new Map(e.map(e=>[e.key,e])),[e]),[i,a]=Ff(t??``,{},{enabled:!!t,parse:e=>rv(e,n),serialize:e=>iv(e,n)}),o=(0,B.useCallback)(e=>e.props.pinned??null,[]),s=(0,B.useCallback)(e=>{let t=i[e.key];return t===void 0?o(e):t===!1?null:t},[i,o]),c=(0,B.useCallback)((e,t)=>{a(n=>{let i=r.get(e),a=i?o(i):null,s={...n};return t===a?delete s[e]:s[e]=t!==null&&t,s})},[r,o,a]),l=(0,B.useCallback)(()=>a({}),[a]);return{hasPinOverrides:Object.keys(i).length>0,pinFor:s,resetPins:l,setColumnPin:c}}function tv(e){return e===`start`||e===`end`||e===!1}function nv(e,t){let n=new Set(t),r={};for(let[t,i]of Object.entries(e))n.has(t)&&tv(i)&&(r[t]=i);return r}function rv(e,t){let n=JSON.parse(e)?.overrides;if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`unexpected stored column pins shape`);return nv(n,t)}function iv(e,t){let n=nv(e,t);return Object.keys(n).length===0?null:JSON.stringify({overrides:n})}function av({columns:e,storageKey:t}){let n=(0,B.useMemo)(()=>e.filter(e=>e.props.toggleable),[e]),r=(0,B.useMemo)(()=>n.map(e=>e.key),[n]),[i,a]=Ff(t??``,{},{enabled:!!t,parse:e=>sv(e,r),serialize:e=>cv(e,r)}),o=(0,B.useCallback)(e=>e.props.toggleable?i[e.key]??!e.props.hiddenByDefault:!0,[i]),s=(0,B.useMemo)(()=>e.filter(e=>o(e)),[e,o]),c=(0,B.useCallback)((e,t)=>{a(n=>({...n,[e]:t}))},[a]),l=(0,B.useCallback)(()=>a({}),[a]),u=n.length>0;return{hasHidden:n.some(e=>!o(e)),hasToggleableColumns:u,isVisible:o,resetVisibility:l,setColumnVisible:c,toggleableColumns:n,visibleColumns:s}}function ov(e,t){let n=new Set(t),r={};for(let[t,i]of Object.entries(e))n.has(t)&&typeof i==`boolean`&&(r[t]=i);return r}function sv(e,t){let n=JSON.parse(e)?.overrides;if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`unexpected stored column visibility shape`);return ov(n,t)}function cv(e,t){let n=ov(e,t);return Object.keys(n).length===0?null:JSON.stringify({overrides:n})}function lv(){let[e,t]=(0,B.useState)(()=>new Set);return{isExpanded:(0,B.useCallback)(t=>e.has(t),[e]),toggle:(0,B.useCallback)(e=>{t(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[])}}var uv={start:`text-start`,center:`text-center`,end:`text-end`},dv={start:`justify-start`,center:`justify-center`,end:`justify-end`},fv={start:`justify-items-start`,center:`justify-items-center`,end:`justify-items-end`},pv=`2.5rem`,mv=`3rem`,hv=`10rem`;function gv({actions:e=!1,expander:t=!1,selection:n=!1}){return{leadingTracks:[...t?[pv]:[],...n?[mv]:[]],trailingTracks:e?[hv]:[]}}function _v(e){if(e===`end`)return`md:border-e md:border-lt-border`;if(e===`start`)return`md:border-s md:border-lt-border`}function vv(e,{pinIndex:t,pinned:n}){if(!n||e===`filler`)return;let r=`var(--lt-pin-offset-${e===`column`?t:e})`;return n===`start`?{insetInlineStart:r}:{insetInlineEnd:r}}function yv(e,{pinBoundary:t,pinned:n}){if(e!==`filler`)return x(n&&`md:sticky z-[1]`,_v(t))}function bv(e){return e?`bg-[var(--lt-table-pinned-muted-bg)]`:`bg-lt-muted/50`}function xv(e,t,n){if(e)return x(`bg-[var(--lt-table-pinned-bg)]`,t&&`group-odd/row:bg-[var(--lt-table-pinned-stripe-bg)]`,n&&`group-hover/row:bg-[var(--lt-table-pinned-hover-bg)]`)}function Sv({children:e,className:t,...n}){return(0,q.jsx)(`div`,{"data-slot":`table`,...n,className:x(`relative min-w-0`,t),children:(0,q.jsx)(`div`,{"data-slot":`table-scroll`,className:`rounded-lt-sm border border-lt-border`,children:e})})}function Cv({className:e,end:t,start:n,...r}){return(0,q.jsxs)(`div`,{"data-slot":`table-toolbar`,...r,className:x(`flex items-center gap-2 border-b border-lt-border px-4 py-2`,e),children:[n,(0,q.jsx)(`div`,{className:`ms-auto flex items-center gap-1`,children:t})]})}function wv({className:e,clearButtonProps:t,clearLabel:n,onClear:r,onValueChange:i,placeholder:a,value:o,...s}){return(0,q.jsxs)(`div`,{className:`relative w-full max-w-xs`,children:[(0,q.jsx)(y,{name:`search`,"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 top-1/2 size-lt-icon-sm -translate-y-1/2 text-lt-muted-fg`}),(0,q.jsx)(nn,{type:`search`,"aria-label":a,...s,value:o,placeholder:a,onChange:e=>i(e.target.value),className:x(`px-8`,`[&::-webkit-search-cancel-button]:hidden`,e)}),o!==``&&(0,q.jsx)(Jf,{size:`xs`,icon:`x`,label:n,...t,className:x(`absolute right-1.5 top-1/2 -translate-y-1/2`,t?.className),onClick:r})]})}function Tv({children:e,className:t,...n}){return(0,q.jsx)(`div`,{...n,className:x(`border-b border-lt-border px-4 py-3`,t),children:(0,q.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:e})})}function Ev({className:e,...t}){return(0,q.jsx)(`span`,{...t,className:x(`inline-flex items-center gap-1.5 rounded-lt-sm bg-lt-muted px-2 py-1`,e)})}function Dv({className:e,...t}){return(0,q.jsx)(`div`,{...t,className:x(`flex flex-wrap items-center gap-4 border-b border-lt-border px-4 py-2.5 text-sm`,e)})}function Ov({action:e,children:t,className:n,summary:r,...i}){return(0,q.jsxs)(`div`,{...i,className:x(`flex flex-wrap items-center gap-3 border-b border-lt-border bg-lt-muted/50 p-4 text-sm`,n),children:[(0,q.jsx)(`span`,{className:`font-medium`,children:r}),e,(0,q.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:t})]})}function kv({children:e,className:t,columns:n,pinned:r=!1,style:i,...a}){return(0,q.jsx)(`div`,{"data-slot":`table-grid-scroll`,className:`relative overflow-x-auto`,children:(0,q.jsx)(`div`,{role:`table`,...a,className:x(r?`min-w-max`:`min-w-full`,`text-base`,t),style:{"--lattice-table-columns":n,...i},children:e})})}function Av(e){return(0,q.jsx)(`div`,{"data-slot":`table-header`,role:`rowgroup`,...e})}function jv({className:e,...t}){return(0,q.jsx)(`div`,{role:`row`,...t,className:x(`hidden min-w-full md:grid md:grid-cols-[var(--lattice-table-columns)]`,e)})}var Mv={column:`relative min-w-0 px-lt-cell-x py-lt-cell-y pr-5 align-middle font-semibold text-lt-fg`,expander:`px-2 py-lt-cell-y`,selection:`flex items-center px-lt-cell-x py-lt-cell-y`,actions:`flex items-center justify-end gap-2 px-lt-cell-x py-2 align-middle font-semibold text-lt-fg`,filler:``};function Nv(e){if(e===`asc`)return`ascending`;if(e===`desc`)return`descending`}function Pv({align:e=`start`,bottomBordered:t=!1,className:n,kind:r=`column`,pinBoundary:i,pinIndex:a,pinned:o,sortDirection:s,style:c,...l}){let u={pinBoundary:i,pinIndex:a,pinned:o};return(0,q.jsx)(`div`,{"aria-hidden":r===`filler`||r===`expander`?`true`:void 0,"aria-sort":r===`column`?Nv(s):void 0,role:r===`filler`?void 0:`columnheader`,...l,className:x(Mv[r],bv(r!==`filler`&&o!=null),yv(r,u),t&&`border-b border-lt-border`,r===`column`&&uv[e],n),"data-pin-boundary":i,"data-pinned":r===`filler`?void 0:o,style:{...vv(r,u),...c}})}function Fv({direction:e}){return e===`asc`?(0,q.jsx)(y,{name:`arrow-up`,"aria-hidden":`true`,className:`size-lt-icon-sm shrink-0`}):e===`desc`?(0,q.jsx)(y,{name:`arrow-down`,"aria-hidden":`true`,className:`size-lt-icon-sm shrink-0`}):(0,q.jsx)(y,{name:`chevrons-up-down`,"aria-hidden":`true`,className:`size-lt-icon-sm shrink-0 opacity-50`})}function Iv({align:e=`start`,children:t,className:n,direction:r,...i}){return(0,q.jsxs)(`button`,{type:`button`,...i,className:x(`flex w-full items-center gap-1.5 font-semibold`,dv[e],n),children:[(0,q.jsx)(`span`,{className:x(`min-w-0 flex-1 truncate`,uv[e]),children:t}),(0,q.jsx)(Fv,{direction:r})]})}function Lv({align:e=`start`,className:t,...n}){return(0,q.jsx)(`span`,{...n,className:x(`block truncate`,uv[e],t)})}var Rv={column:`min-w-0 border-t border-b border-lt-border px-2 py-2`,expander:`border-t border-b border-lt-border px-2 py-2`,selection:`border-t border-b border-lt-border px-lt-cell-x py-2`,actions:`border-t border-b border-lt-border px-lt-cell-x py-2`,filler:`border-t border-b border-lt-border`};function zv({className:e,kind:t=`column`,pinBoundary:n,pinIndex:r,pinned:i,style:a,...o}){let s={pinBoundary:n,pinIndex:r,pinned:i};return(0,q.jsx)(`div`,{"aria-hidden":t===`filler`?`true`:void 0,role:t===`filler`?void 0:`cell`,...o,className:x(Rv[t],bv(t!==`filler`&&i!=null),yv(t,s),e),"data-pin-boundary":n,"data-pinned":t===`filler`?void 0:i,style:{...vv(t,s),...a}})}function Bv(e){return(0,q.jsx)(`div`,{role:`rowgroup`,...e})}var Vv=(0,B.createContext)({clickable:!1,striped:!1});function Hv({children:e,className:t,clickable:n=!1,striped:r=!1,...i}){return(0,q.jsx)(Vv.Provider,{value:{clickable:n,striped:r},children:(0,q.jsx)(`div`,{"data-slot":`table-row`,role:`row`,...i,className:x(`group/row grid grid-cols-1 border-b border-lt-border last:border-b-0 md:grid-cols-[var(--lattice-table-columns)]`,r&&`odd:bg-lt-muted/30`,n&&`cursor-pointer hover:bg-lt-muted/50`,t),children:e})})}var Uv={column:`grid min-w-0 content-center gap-1 overflow-hidden px-lt-cell-x py-lt-cell-y`,expander:`flex items-center px-2 py-lt-cell-y`,selection:`flex items-center px-lt-cell-x py-lt-cell-y`,actions:`items-center justify-start gap-2 px-lt-cell-x py-lt-cell-y md:justify-end`,filler:``};function Wv({align:e=`start`,children:t,className:n,kind:r=`column`,label:i,pinBoundary:a,pinIndex:o,pinned:s,style:c,...l}){let{clickable:u,striped:d}=(0,B.useContext)(Vv),f={pinBoundary:a,pinIndex:o,pinned:s};return r===`filler`?(0,q.jsx)(`div`,{"aria-hidden":`true`,...l,className:n,style:c}):(0,q.jsx)(`div`,{role:`cell`,...l,"data-slot":r===`column`?`table-cell`:void 0,className:x(Uv[r],r===`actions`&&(B.Children.count(t)>0?`flex`:`hidden md:flex`),r===`column`&&uv[e],r===`column`&&fv[e],xv(s!=null,d,u),yv(r,f),n),"data-pin-boundary":a,"data-pinned":s,style:{...vv(r,f),...c},children:r===`column`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs font-medium text-lt-muted-fg md:hidden`,children:i}),(0,q.jsx)(`div`,{"data-slot":`table-cell-content`,className:`min-w-0 max-w-full overflow-hidden truncate`,children:t})]}):t})}function Gv({className:e,expanded:t,...n}){return(0,q.jsx)(`button`,{type:`button`,"aria-expanded":t,...n,className:x(`inline-flex size-6 items-center justify-center rounded-lt-sm text-lt-muted-fg hover:bg-lt-muted hover:text-lt-fg`,e),children:(0,q.jsx)(y,{name:`chevron-down`,"aria-hidden":`true`,className:x(`size-lt-icon-md transition-transform`,!t&&`-rotate-90`)})})}function Kv({className:e,...t}){return(0,q.jsx)(`div`,{role:`region`,"data-slot":`table-row-detail`,...t,className:x(`border-b border-lt-border bg-lt-muted/20 px-lt-cell-x py-lt-cell-y`,e)})}function qv({children:e,className:t,...n}){return(0,q.jsx)(`div`,{"data-slot":`table-empty`,role:`row`,...n,className:x(`p-8 text-center text-lt-muted-fg`,t),children:(0,q.jsx)(`div`,{role:`cell`,children:e})})}function Jv({children:e,className:t,...n}){return(0,q.jsx)(`div`,{role:`row`,...n,className:x(`p-4 text-lt-muted-fg`,t),children:(0,q.jsx)(`div`,{role:`cell`,children:e})})}function Yv({className:e,...t}){return(0,q.jsx)(`div`,{"data-slot":`table-pagination`,...t,className:x(`flex items-center justify-between gap-3 border-t border-lt-border p-4 text-sm`,e)})}function Xv({disabled:e=!1,hasNextPage:t,labels:n,onPageChange:r,page:i,pages:a}){return(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(J,{emphasis:`outline`,"data-test":`pagination-previous`,disabled:e||i<=1,onClick:()=>r(i-1),children:n.previous}),a?.map(t=>(0,q.jsx)(J,{emphasis:`outline`,size:`icon`,"data-test":`pagination-page-${t}`,disabled:e||t===i,"aria-current":t===i?`page`:void 0,"aria-label":n.page(t),onClick:()=>r(t),children:t},t)),(0,q.jsx)(J,{emphasis:`outline`,"data-test":`pagination-next`,disabled:e||!t,onClick:()=>r(i+1),children:n.next})]})}function Zv(e){return Array.isArray(e)?e.flatMap(e=>{if(e.type!==`action`&&e.type!==`action.bulk`)return[];let t=e;return t.props.endpoint?[t]:[]}):[]}function Qv({actions:e,selectedKeys:t,allMatching:n,total:r,query:i,canSelectAllMatching:a,onSelectAllMatching:o,onCompleted:s}){let{t:c}=N(`lattice`),l=()=>n?{allMatching:!0,...i}:{selected:t},u=n?r??t.length:t.length;return(0,q.jsx)(Ov,{summary:n?c(`table.bulk.all-selected`,`All {{count}} selected`,{count:u}):c(`table.bulk.selected`,`{{count}} selected`,{count:u}),action:a&&(0,q.jsx)(`button`,{type:`button`,"data-test":`bulk-select-all-matching`,className:`font-medium text-lt-primary underline underline-offset-2`,onClick:o,children:c(`table.bulk.select-all-matching`,`Select all {{total}} matching`,{total:r})}),children:e.map((e,t)=>(0,q.jsx)(vu,{action:e,options:{extraData:l,onSuccess:s},children:({onClick:t,processing:n})=>(0,q.jsxs)(J,{type:`button`,"data-test":Xl(`bulk-action`,e.id),variant:e.props.variant,emphasis:e.props.emphasis,disabled:n,onClick:t,children:[n&&(0,q.jsx)(Jl,{}),e.props.label]})},e.key??e.id??t))})}function $v({className:e,density:t,children:n,ref:r,...i}){return(0,q.jsxs)(`span`,{className:x(`relative inline-flex w-full min-w-0`,e),children:[(0,q.jsx)(`select`,{ref:r,"data-slot":`native-select`,className:x(tn({density:t}),`cursor-pointer appearance-none pr-8`),...i,children:n}),(0,q.jsx)(y,{name:`chevron-down`,"aria-hidden":`true`,className:`pointer-events-none absolute right-2.5 top-1/2 size-lt-icon-md -translate-y-1/2 text-lt-muted-fg`})]})}function ey(e){return e===!0||e===1||e===`1`||e===`true`}function ty({filter:e,value:t,processing:n,bare:r=!1,onChange:i,onSearch:a}){let{t:o}=N(`lattice`),s=e.schema??[];return s.length===0?(0,q.jsx)(iy,{filter:e,value:t,processing:n,onChange:i}):(0,q.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,q.jsx)(ny,{filter:e,schema:s,value:t,processing:n,bare:r,onChange:i,onSearch:a})}),a_(t)&&(0,q.jsx)(Jf,{size:`md`,icon:`x`,label:o(`table.filter.clear`,`Clear {{label}} filter`,{label:e.props.label}),disabled:n,onClick:()=>i(void 0)})]})}function ny({filter:e,schema:t,value:n,processing:r,bare:i,onChange:a,onSearch:o}){let s=(0,B.useMemo)(()=>s_(n),[n]),c=(0,B.useMemo)(()=>({action:`#`,clearErrors:()=>{},componentId:`table-filter-${e.key}`,componentRef:``,errors:{},fieldIdPrefix:`table-filter-${e.key}`,fieldLabels:{},precognitive:!1,processing:r,searchOptions:(e,t,n,r)=>o?o(e,t,r):Promise.resolve([]),touch:()=>{},validate:()=>{},validateFields:()=>{},validating:!1}),[e.key,o,r]),l=(0,q.jsx)(`div`,{"aria-disabled":r,className:x(`grid gap-3`,r&&`pointer-events-none opacity-60`),children:(0,q.jsx)(Qe,{nodes:t})});return(0,q.jsx)(se,{value:c,children:(0,q.jsx)(Ae,{value:{markUserEdit:()=>{}},children:(0,q.jsx)(Vd,{nodes:{},children:(0,q.jsx)(he,{initial:s,children:(0,q.jsx)(ry,{onChange:a,children:i?(0,q.jsx)(Kt,{children:l}):l})})})})})}function ry({children:e,onChange:t}){let n=xt(),r=yt(),i=(0,B.useRef)(n);i.current=n;let a=(0,B.useCallback)((e,n)=>{let a=typeof n==`function`?n(ve(i.current,e)):n,o=Ce(i.current,e,a);i.current=o,r(e,a),t(o)},[t,r]),o=(0,B.useMemo)(()=>({blur:()=>{},change:a,commit:a}),[a]);return(0,q.jsx)(Fe,{value:o,children:e})}function iy({filter:e,value:t,processing:n,onChange:r}){let i=ey(s_(t).value);return(0,q.jsxs)(`label`,{className:`flex h-lt-control-md cursor-pointer items-center gap-2 text-sm`,children:[(0,q.jsx)(Pf,{"aria-label":e.props.label,"data-test":`table-filter-${e.key}`,checked:i,disabled:n,onCheckedChange:e=>r(e===!0?{value:`1`}:void 0)}),(0,q.jsx)(`span`,{children:e.props.label})]})}function ay({type:e,label:t,value:n,processing:r,withSearchIcon:i=!1,grouped:a=!1,ariaLabel:o,testId:s,onCommit:c,onClear:l}){let{t:u}=N(`lattice`),[d,f]=(0,B.useState)(n),p=o??u(`table.filter.filter-by`,`Filter {{label}}`,{label:t}),m=a?`rounded-r-none`:``;return(0,B.useEffect)(()=>{f(n)},[n]),e===`boolean`?(0,q.jsxs)($v,{density:`compact`,"aria-label":p,"data-test":s,className:m,disabled:r,value:n,onChange:e=>c(e.target.value),children:[(0,q.jsx)(`option`,{value:``,children:u(`table.filter.all`,`All`)}),(0,q.jsx)(`option`,{value:`true`,children:u(`table.filter.true`,`True`)}),(0,q.jsx)(`option`,{value:`false`,children:u(`table.filter.false`,`False`)})]}):e===`date`?(0,q.jsx)(nn,{type:`date`,density:`compact`,"aria-label":p,"data-test":s,className:m,disabled:r,value:d,onChange:e=>{f(e.target.value),c(e.target.value)}}):(0,q.jsxs)(`div`,{className:`relative flex w-full min-w-0 items-center`,children:[i&&(0,q.jsx)(y,{name:`search`,"aria-hidden":`true`,className:`pointer-events-none absolute left-2 size-lt-icon-md text-lt-muted-fg`}),(0,q.jsx)(nn,{type:e===`number`?`number`:`text`,density:`compact`,"aria-label":p,"data-test":s,className:x(m,i&&`pl-8`,l&&`pr-8`),disabled:r,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&c(d)},onBlur:()=>{d!==n&&c(d)}}),l&&d!==``&&(0,q.jsx)(Jf,{size:`xs`,icon:`x`,label:u(`table.filter.clear`,`Clear {{label}} filter`,{label:t}),"data-test":s?`${s}-clear`:void 0,className:`absolute right-1 size-6`,disabled:r,onClick:l})]})}function oy({column:e,clauses:t,processing:n,onAdd:r,onUpdate:i,onRemove:a,onReplace:o,onSearch:s}){let{t:c}=N(`lattice`),{filter:l,label:u}=e.props,d=u??e.key;if(!l)return null;if(l.control===`filter.select`)return(0,q.jsx)(cy,{column:e,clauses:t,processing:n,onReplace:o,onSearch:s});let f=l.type??`text`,p=l.operators??[],m=l.defaultOperator??p[0]??`eq`,h=t.find(e=>e.clause.operator===m)??t[0];function g(t){if(t===``){h&&a(h.index);return}h?i(h.index,{...h.clause,value:t}):r({field:e.key,operator:m,value:t})}return(0,q.jsxs)(`div`,{className:`flex min-w-0 max-w-80 items-stretch`,children:[(0,q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,q.jsx)(ay,{type:f,label:d,value:h?.clause.value??``,processing:n,withSearchIcon:f===`text`||f===`number`,grouped:!0,testId:`filter-${e.key}-value`,onCommit:g,onClear:h?()=>a(h.index):void 0})}),(0,q.jsxs)(Zt,{children:[(0,q.jsx)(Pe,{asChild:!0,children:(0,q.jsx)(Jf,{emphasis:`segmented`,size:`md`,icon:`filter`,label:c(`table.filter.column-filters`,`{{label}} filters`,{label:d}),"data-test":`filter-${e.key}`,disabled:n,children:t.length>0&&(0,q.jsx)(`span`,{className:`absolute -right-1.5 -top-1.5 inline-flex size-4 items-center justify-center rounded-full bg-lt-primary text-xs font-medium text-lt-primary-fg`,children:t.length})})}),(0,q.jsx)(Jt,{align:`start`,className:`w-80 p-4`,children:(0,q.jsx)(fy,{column:e,clauses:t,operators:p,defaultOperator:m,processing:n,onAdd:r,onUpdate:i,onRemove:a})})]})]})}function sy(e){return Array.isArray(e)?e.join(`,`):typeof e==`string`?e:``}function cy({column:e,clauses:t,processing:n,onReplace:r,onSearch:i}){let{filter:a,label:o}=e.props,s=o??e.key;if(!a)return null;let c=a.multiple,l=a.defaultOperator,u=a.clauseOptions??[],d=uy(t.map(e=>e.clause),u),f=t.find(e=>e.clause.operator===l)??t[0],p=d?d.value:c?f?.clause.value?f.clause.value.split(`,`):[]:f?.clause.value??``,m={key:e.key,type:`filter.select`,props:{label:s,options:a.options,multiple:c,searchable:a.searchable,placeholder:null},schema:[{type:`field.select`,key:e.key,props:{name:`value`,label:s,options:a.options,multiple:c,searchable:a.searchable,placeholder:null}}]};function h(t){let n=sy(s_(t).value);if(n===``){r(e.key,[]);return}let i=u.find(e=>e.value===n);if(i){r(e.key,ly(e.key,i));return}r(e.key,[{field:e.key,operator:l,value:n}])}return(0,q.jsx)(ty,{filter:m,value:{value:p},processing:n,bare:!0,onChange:h,onSearch:i?(e,t,n)=>i(t,n):void 0})}function ly(e,t){return t.clauses.map(t=>({field:e,operator:t.operator,value:t.value}))}function uy(e,t){return t.find(t=>dy(e,ly(``,t)))}function dy(e,t){return e.length===t.length&&t.every(t=>e.some(e=>e.operator===t.operator&&e.value===t.value))}function fy({column:e,clauses:t,operators:n,defaultOperator:r,processing:i,onAdd:a,onUpdate:o,onRemove:s}){let{t:c}=N(`lattice`),l=e.props.filter?.type??`text`,[u,d]=(0,B.useState)(r),[f,p]=(0,B.useState)(t.length===0);return(0,q.jsxs)(`div`,{className:`grid gap-3`,children:[t.map(t=>(0,q.jsx)(py,{column:e,type:l,operators:n,clause:t.clause,processing:i,onOperator:e=>o(t.index,{...t.clause,operator:e}),onValue:e=>e===``?s(t.index):o(t.index,{...t.clause,value:e}),onRemove:()=>s(t.index)},t.index)),f&&(0,q.jsx)(py,{column:e,type:l,operators:n,clause:{field:e.key,operator:u,value:``},processing:i,onOperator:t=>{if(R_.has(t)){a({field:e.key,operator:t,value:``}),d(r),p(!1);return}d(t)},onValue:t=>{t!==``&&(a({field:e.key,operator:u,value:t}),d(r),p(!1))},onRemove:()=>p(!1)}),(0,q.jsx)(`div`,{className:`border-t border-lt-border pt-3`,children:(0,q.jsx)(J,{variant:`secondary`,icon:`plus`,"data-test":`filter-${e.key}-add`,className:`w-full`,disabled:i,onClick:()=>p(!0),children:c(`table.filter.add`,`Add filter`)})})]})}function py({column:e,type:t,operators:n,clause:r,processing:i,onOperator:a,onValue:o,onRemove:s}){let{t:c}=N(`lattice`),l=e.props.label??e.key,u=R_.has(r.operator);return(0,q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n.length>1?(0,q.jsx)($v,{density:`compact`,"aria-label":c(`table.filter.operator`,`{{label}} operator`,{label:l}),"data-test":`filter-${e.key}-operator`,className:`flex-1`,disabled:i,value:r.operator,onChange:e=>a(e.target.value),children:n.map(e=>(0,q.jsx)(`option`,{value:e,children:z_(e)},e))}):(0,q.jsx)(`span`,{className:`flex-1 text-sm font-medium`,children:z_(r.operator)}),(0,q.jsx)(J,{emphasis:`outline`,size:`icon`,icon:`trash-2`,"aria-label":c(`table.filter.remove`,`Remove {{label}} filter`,{label:l}),"data-test":`filter-${e.key}-remove`,disabled:i,onClick:s})]}),!u&&(0,q.jsx)(ay,{type:t,label:l,ariaLabel:c(`table.filter.value`,`{{label}} filter value`,{label:l}),value:r.value,processing:i,onCommit:o,onClear:()=>o(``)})]})}function my({bottomBordered:e,column:t,pinBoundary:n,pinIndex:r,pinned:i,processing:a,resizeHandleProps:o,sort:s,query:c}){let l=T_(c,t),{t:u}=N(`lattice`),{align:d,label:f,sortable:p}=t.props;return(0,q.jsxs)(Pv,{align:d,bottomBordered:e,pinBoundary:n,pinIndex:r,pinned:i,sortDirection:l?.direction,children:[p?(0,q.jsx)(Iv,{align:d,"aria-label":u(`table.sort.column`,`Sort {{label}}`,{label:f}),"data-test":`sort-${t.key}`,direction:l?.direction,disabled:a,onClick:()=>s(t),children:f}):(0,q.jsx)(Lv,{align:d,children:f}),o&&(0,q.jsx)(`div`,{...o})]})}function hy({columns:e,hasHidden:t,hasPinOverrides:n=!1,isVisible:r,onReset:i,onSetPin:a,onToggle:o,pinFor:s,pinningEnabled:c=!1,processing:l,visibleColumnCount:u}){let{t:d}=N(`lattice`),f=d(`table.columns.label`,`Columns`),p=d(`table.columns.pin-left`,`Pin left`),m=d(`table.columns.pin-right`,`Pin right`),h=d(`table.columns.unpin`,`Unpin`);return(0,q.jsxs)(Zt,{children:[(0,q.jsx)(Pe,{asChild:!0,children:(0,q.jsx)(Jf,{size:`sm`,icon:`columns-3`,label:f,"data-test":`table-columns-menu`,disabled:l})}),(0,q.jsx)(Jt,{align:`end`,className:`w-72 p-4`,children:(0,q.jsxs)(`div`,{className:`grid gap-3`,children:[e.map(e=>{let t=e.props.toggleable===!0,n=r(e),i=t&&n&&u<=1,l=c?s?.(e)??null:null;return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-base text-lt-fg`,children:[t?(0,q.jsxs)(`label`,{className:`flex flex-1 items-center gap-2`,children:[(0,q.jsx)(Pf,{"data-test":`table-column-toggle-${e.key}`,checked:n,disabled:i,onCheckedChange:t=>o(e.key,t===!0)}),(0,q.jsx)(`span`,{children:e.props.label??e.key})]}):(0,q.jsx)(`span`,{className:`flex-1`,children:e.props.label??e.key}),c&&(0,q.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,q.jsx)(Jf,{icon:`arrow-left-to-line`,label:l===`start`?h:p,active:l===`start`,"data-test":`table-column-pin-left-${e.key}`,size:`xs`,onClick:()=>a?.(e.key,l===`start`?null:`start`)}),(0,q.jsx)(Jf,{icon:`arrow-right-to-line`,label:l===`end`?h:m,active:l===`end`,"data-test":`table-column-pin-right-${e.key}`,size:`xs`,onClick:()=>a?.(e.key,l===`end`?null:`end`)})]})]},e.key)}),(t||n)&&(0,q.jsx)(`button`,{type:`button`,"data-test":`table-columns-reset`,className:`mt-1 justify-self-start text-sm text-lt-muted-fg hover:text-lt-fg`,onClick:i,children:d(`table.columns.reset`,`Reset`)})]})})]})}function gy({clauses:e,columnsByKey:t,indicators:n,processing:r,onRemoveClause:i,onChange:a,onReset:o}){let{t:s}=N(`lattice`);return e.length===0&&n.length===0?null:(0,q.jsxs)(Tv,{children:[e.map((e,n)=>{let a=t.get(e.field)?.props.label??e.field,o=R_.has(e.operator);return(0,q.jsx)(_y,{label:`${a} ${z_(e.operator)}`,value:o?``:e.value,removeTestId:`filter-chip-${e.field}-remove`,removeLabel:s(`table.filter.remove`,`Remove {{label}} filter`,{label:a}),processing:r,onRemove:()=>i(n)},`${e.field}-${e.operator}-${n}`)}),n.map(e=>(0,q.jsx)(_y,{label:e.label,value:e.value,removeTestId:`table-filter-chip-${e.filter}-remove`,removeLabel:s(`table.filter.remove`,`Remove {{label}} filter`,{label:e.label}),processing:r,onRemove:()=>a(e.filter,void 0)},`${e.filter}:${e.label}:${e.value}`)),(0,q.jsx)(`button`,{type:`button`,"data-test":`table-filters-reset`,className:`text-lt-muted-fg underline-offset-2 hover:underline disabled:text-lt-disabled-fg`,disabled:r,onClick:o,children:s(`table.filter.reset-all`,`Reset all`)})]})}function _y({label:e,value:t,removeTestId:n,removeLabel:r,processing:i,onRemove:a}){return(0,q.jsxs)(Ev,{children:[(0,q.jsx)(`span`,{children:t===``?(0,q.jsx)(`span`,{className:`font-semibold`,children:e}):(0,q.jsxs)(q.Fragment,{children:[`${e}: `,(0,q.jsx)(`span`,{className:`font-semibold`,children:t})]})}),(0,q.jsx)(Jf,{size:`xs`,icon:`x`,label:r,"data-test":n,disabled:i,onClick:a})]})}function vy({filters:e,values:t,processing:n,onChange:r,onSearch:i}){let{t:a}=N(`lattice`),o=e.filter(e=>a_(t[e.key])),s=a(`table.filter.filters`,`Filters`);return(0,q.jsxs)(Zt,{children:[(0,q.jsx)(Pe,{asChild:!0,children:(0,q.jsx)(Jf,{size:`sm`,icon:`filter`,label:s,"data-test":`table-filters-menu`,disabled:n,children:o.length>0&&(0,q.jsx)(`span`,{className:`absolute -right-1 -top-1 inline-flex size-3.5 items-center justify-center rounded-full bg-lt-primary text-[10px] font-medium leading-none text-lt-primary-fg`,children:o.length})})}),(0,q.jsx)(Jt,{align:`end`,className:`w-80 p-4`,children:(0,q.jsx)(`div`,{className:`grid gap-3`,children:e.map(e=>(0,q.jsx)(`div`,{className:`grid gap-1`,children:(0,q.jsx)(ty,{filter:e,value:t[e.key],processing:n,onChange:t=>r(e.key,t),onSearch:i?(t,n,r)=>i(`filter:${e.key}.${t}`,n,r):void 0})},e.key))})})]})}function yy({pagination:e,currentPage:t,processing:n,mode:r,hasNextPage:i,visiblePages:a,infiniteLoaderRef:o,perPageOptions:s,perPageValue:c,onPerPage:l,onPage:u,onLoadMore:d}){let{t:f}=N(`lattice`);return(0,q.jsxs)(Yv,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,q.jsx)(`span`,{children:e.total==null?f(`table.pagination.page`,`Page {{page}}`,{page:t}):f(`table.pagination.showing`,`Showing {{from}}-{{to}} of {{total}}`,{from:e.from??0,to:e.to??0,total:e.total})}),s.length>0&&r!==`none`&&(0,q.jsx)($v,{"aria-label":f(`table.pagination.per-page`,`Rows per page`),className:`w-fit`,"data-test":`pagination-per-page`,disabled:n,value:String(c),onChange:e=>l(e.target.value===`infinite`?`infinite`:Number(e.target.value)),children:s.map(e=>(0,q.jsx)(`option`,{value:String(e),children:e===`infinite`?f(`table.pagination.infinite`,`Infinite`):e},String(e)))})]}),r===`infinite`?(0,q.jsx)(`div`,{ref:o,className:`flex items-center gap-2`,children:e.hasMore?(0,q.jsx)(J,{emphasis:`outline`,"data-test":`pagination-load-more`,disabled:n,onClick:d,children:n?f(`table.pagination.loading`,`Loading...`):f(`table.pagination.load-more`,`Load more`)}):(0,q.jsx)(`span`,{className:`text-lt-muted-fg`,children:f(`table.pagination.all-loaded`,`All rows loaded`)})}):r===`simple`||r===`table`?(0,q.jsx)(Xv,{disabled:n,hasNextPage:i,labels:{next:f(`table.pagination.next`,`Next`),page:e=>f(`table.pagination.page`,`Page {{page}}`,{page:e}),previous:f(`table.pagination.previous`,`Previous`)},onPageChange:u,page:t,pages:r===`table`?a:void 0}):null]})}function by({columnsByKey:e,query:t,processing:n,onClear:r}){let{t:i}=N(`lattice`);return(0,q.jsx)(Dv,{children:t.sorts.map((t,a)=>{let o=e.get(t.key)?.props.label??t.key,s=t.direction===`desc`?`arrow-down`:`arrow-up`;return(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:`${a+1}. ${o}`}),(0,q.jsx)(y,{name:s,role:`img`,"aria-hidden":!1,"aria-label":B_(t.direction),className:`size-lt-icon-sm text-lt-muted-fg`}),(0,q.jsx)(Jf,{size:`xs`,icon:`x`,label:i(`table.sort.clear`,`Clear {{label}} sort`,{label:o}),"data-test":`clear-${t.key}-sort`,disabled:n,onClick:()=>r(t)})]},t.key)})})}var xy=300;function Sy({value:e,onSearch:t}){let{t:n}=N(`lattice`),[r,i]=(0,B.useState)(e),a=(0,B.useRef)(e);(0,B.useEffect)(()=>{e!==a.current&&(a.current=e,i(e))},[e]);function o(e){a.current=e,t(e)}let s=rf(o,xy);function c(e){i(e),s(e)}function l(){s.cancel(),i(``),o(``)}return(0,q.jsx)(wv,{clearButtonProps:{"data-test":`table-search-clear`},clearLabel:n(`table.search.clear`,`Clear search`),"data-test":`table-search`,onClear:l,onValueChange:c,placeholder:n(`table.search.placeholder`,`Search`),value:r})}var Cy=`a, button, input, label, select, textarea, [role=menuitem], [role=checkbox]`;function wy(e){return e instanceof Element&&e.closest(Cy)!=null}function Ty(e){return e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)}var Ey={clickable:!1,href:null,processing:!1};function Dy(e,t){return{clickable:!0,href:null,processing:t,onClick:n=>{t||wy(n.target)||e()},onKeyDown:n=>{t||!Ty(n)||(n.preventDefault(),e())}}}function Oy({children:e,click:t}){let n=xu(t?.props??{}),{visit:r}=Rl();if(n.kind===`action`)return(0,q.jsx)(vu,{action:n.action,children:({onClick:t,processing:n})=>e(Dy(t,n))});if(n.kind===`modal`||n.kind===`effects`)return e(Dy(n.onClick,!1));if(n.kind===`navigate`){let{href:t}=n,i=()=>{window.open(t,`_blank`)};return e({...Dy(()=>r(t),!1),href:t,onClick:e=>{if(!wy(e.target)){if(e.metaKey||e.ctrlKey){i();return}r(t)}},onAuxClick:e=>{e.button!==1||wy(e.target)||i()}})}return e(Ey)}var ky=`table.columns`;function Ay(){return p(ky)}function jy(e){return e}function My({color:e,className:t,style:n,...r}){let i=rn(sn(e??void 0)??on(`gray`));return(0,q.jsx)(`span`,{"data-slot":`badge`,className:x(`lt-badge`,i.className,t),style:{...i.style,...n},...r})}function Ny(e,t,n){if(e==null)return``;let r=t?.props?.date;if(r)return R(e,r,n);let i=(t?.props)?.options?.find(t=>t.value===String(e))?.label;return i===void 0?typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e):i}function Py(e,t,n){let r=e.props.link;if(!r)return null;let i=w_(t,e.key);if(i!==void 0)return i;let a=r.href??String(n??``);if(a===``)return null;let o=!1,s=a.replace(/\{([^}]+)\}/g,(e,r)=>{let i=r===`value`?n:t[r];return i==null||i===``?(o=!0,``):encodeURIComponent(String(i))});return o?null:s}var Fy=({column:e,props:t,value:n})=>{let r=Ny(n,e);return r===``?null:(0,q.jsx)(My,{color:t.colors?.[String(n)],children:r})},Iy=({value:e})=>{let{t}=N(`lattice`),n=ey(e);return(0,q.jsx)(`span`,{"aria-label":n?t(`common.yes`,`Yes`):t(`common.no`,`No`),role:`img`,children:(0,q.jsx)(y,{name:n?`check`:`x`,className:x(`size-lt-icon-md`,n?`text-lt-success`:`text-lt-muted-fg`)})})},Ly=({props:e,value:t})=>{let n=e.icons?.[String(t)]??e.icon??void 0;if(!n)return null;let r=sn(e.colors?.[String(t)]),i=r?rn(r):void 0;return(0,q.jsx)(`span`,{"aria-label":String(t),className:x(`lt-cell-icon`,i?.className),style:i?.style,children:(0,q.jsx)(tl,{className:`size-lt-icon-md`,icon:n})})};function Ry({src:e,alt:t,defaultOpen:n=!1,onOpenChange:r,open:i,previewable:a,previewSrc:o,width:s,height:c,className:l,style:u,testId:d,...f}){let{t:p}=N(F),[m,h]=(0,B.useState)(n),g=i??m,_=e=>{h(e),r?.(e)},v=(0,q.jsx)(`img`,{...f,alt:t,src:e,width:s,height:c,className:l,style:s?{...u,width:s,height:c}:u});if(!a)return v;let y=p(`common.image.open-preview`,`View image`);return(0,q.jsxs)(Od,{open:g,onOpenChange:_,children:[(0,q.jsx)(Ad,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,"data-test":d,className:`cursor-zoom-in`,"aria-label":y,children:v})}),(0,q.jsxs)(Nd,{"aria-describedby":void 0,className:`max-h-[90vh] w-auto max-w-[90vw] border-none bg-transparent p-0 shadow-none`,children:[(0,q.jsx)(jd,{className:`sr-only`,children:t||y}),(0,q.jsx)(`img`,{alt:t,src:o??e,"data-slot":`image-lightbox`,className:`max-h-[90vh] max-w-[90vw] rounded-lt object-contain`}),(0,q.jsx)(kd,{asChild:!0,children:(0,q.jsx)(J,{icon:`x`,"aria-label":p(`common.close`,`Close`),"data-test":`lightbox-close`,size:`icon`,emphasis:`ghost`,className:`absolute top-2 right-2 bg-lt-bg/80 hover:bg-lt-bg`})})]})]})}var zy=({column:e,props:t,value:n})=>{let r=typeof n==`string`?n:``;if(r===``)return null;let i=t.size??32;return(0,q.jsx)(Ry,{alt:e.props.label??``,className:x(`object-cover`,t.circular?`rounded-full`:`rounded-lt-sm`),height:i,previewable:t.previewable,src:r,testId:`preview-${e.key}`,width:i})};function By(e){let t=typeof e==`number`?e:Number(e);return e!=null&&e!==``&&!Number.isNaN(t)?t:null}function Vy(e,t,n){let r=By(e);if(r===null)return String(e??``);let i={notation:t.notation,minimumFractionDigits:t.minimumFractionDigits??void 0,maximumFractionDigits:t.maximumFractionDigits??void 0};return t.currency?(i.style=`currency`,i.currency=t.currency):t.unit&&(i.style=`unit`,i.unit=t.unit),new Intl.NumberFormat(n,i).format(r)}function Hy({children:e,column:t,copyable:n,value:r}){return n?(0,q.jsx)(qh,{value:r,label:t.props.label??t.key,testId:`copy-${t.key}`,children:e}):e}function Uy({column:e,copyable:t,format:n,value:r}){let{locale:i}=s();return By(r)===null?(0,q.jsx)(`span`,{children:Ny(r,e)}):(0,q.jsx)(Hy,{column:e,copyable:t,value:String(r),children:(0,q.jsx)(`span`,{className:`tabular-nums`,children:Vy(r,n,i)})})}var Wy=({column:e,props:t,row:n,value:r})=>{let i=t.currencyField?n[t.currencyField]:void 0,a=t.currency??(typeof i==`string`?i:null);return(0,q.jsx)(Uy,{column:e,copyable:t.copyable,value:r,format:{kind:`number`,notation:`standard`,minimumFractionDigits:t.minimumFractionDigits,maximumFractionDigits:t.maximumFractionDigits,currency:a,unit:null}})},Gy=({column:e,props:t,value:n})=>(0,q.jsx)(Uy,{column:e,copyable:t.copyable,value:n,format:{kind:`number`,notation:t.compact?`compact`:`standard`,minimumFractionDigits:t.minimumFractionDigits,maximumFractionDigits:t.maximumFractionDigits,currency:null,unit:t.unit}}),Ky=({column:e,row:t})=>(0,q.jsx)(`div`,{className:`grid gap-1`,children:(0,q.jsx)(Qe,{nodes:i(e.schema,t)})}),qy=e=>e.props.multiple?(0,q.jsx)(Yy,{...e}):e.props.badge?(0,q.jsx)(Xy,{...e}):(0,q.jsx)(Zy,{...e});function Jy({label:e,color:t}){return e===``?null:(0,q.jsx)(My,{color:t,children:e})}function Yy({column:e,props:t,value:n}){let r=Array.isArray(n)?n:[];return r.length===0?null:t.badge?(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:r.map((t,n)=>{let r=t;return(0,q.jsx)(Jy,{label:Ny(r.value,e),color:r.color},n)})}):(0,q.jsx)(`span`,{children:r.map(t=>Ny(t,e)).join(`, `)})}function Xy({column:e,props:t,row:n,value:r}){let i=t.badge.colorKey;return(0,q.jsx)(Jy,{label:Ny(r,e),color:String(n[i]??``)})}function Zy({column:e,props:t,row:n,value:r}){let i=e.props.date,a=C_(n,e.key),o=a?null:Py(e,n,r),s=Ny(r,e),c=a?(0,q.jsxs)(Zt,{children:[(0,q.jsx)(Pe,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,className:`cursor-pointer underline underline-offset-2`,children:s})}),(0,q.jsx)(Jt,{className:`p-3`,children:(0,q.jsx)(Qe,{nodes:[a]})})]}):o?(0,q.jsx)(`a`,{className:`underline underline-offset-2`,href:o,rel:t.link?.external?`noreferrer`:void 0,target:t.link?.external?`_blank`:void 0,children:s}):s;return i&&!o&&!a&&!t.copyable&&r!=null?(0,q.jsx)(Kl,{value:r,dateStyle:i.dateStyle,timeStyle:i.timeStyle}):(0,q.jsx)(Hy,{column:e,copyable:t.copyable,value:s,children:c})}var Qy={"column.badge":jy(Fy),"column.boolean":jy(Iy),"column.icon":jy(Ly),"column.image":jy(zy),"column.money":jy(Wy),"column.number":jy(Gy),"column.stack":jy(Ky),"column.text":jy(qy)};function $y({column:e,row:t}){let n=Ay()[e.type]??Qy[e.type]??Qy[`column.text`];return(0,q.jsx)(n,{column:e,props:e.props,row:t,value:t[e.key]})}function eb(e,t,n,r){if(e===`start`&&t===n)return`end`;if(e===`end`&&t===r)return`start`}var tb={components:{table:V(({node:e})=>{let{t}=N(`lattice`),{columns:n,rows:r,pagination:i,query:a,filters:o,tableFilters:s,search:c,addFilter:l,updateFilter:u,removeFilter:d,replaceColumnFilters:f,setTableFilter:p,resetFilters:m,setSearch:h,searchFilterOptions:g,processing:_,hasLoaded:v,infiniteLoaderRef:b,sort:x,clearSort:S,goToPage:C,setPerPage:w,loadMore:T}=Q_(e),E=(0,B.useMemo)(()=>Zv(e.props?.bulkActions),[e.props?.bulkActions]),D=E.length>0,O=(0,B.useMemo)(()=>r.map((e,t)=>({row:e,actions:b_(e),click:S_(e),detail:x_(e),key:y_(e,t)})),[r]),k=$_(O.map(e=>e.key)),{isExpanded:ee,toggle:A}=lv(),j=O.some(e=>e.detail!=null),M=(0,B.useMemo)(()=>new Map(n.map(e=>[e.key,e])),[n]),te=Q(e),{hasToggleableColumns:P,hasHidden:F,isVisible:ne,resetVisibility:I,setColumnVisible:re,toggleableColumns:L,visibleColumns:R}=av({columns:n,storageKey:te?`lattice:table-column-visibility:${te}`:void 0}),ie=e.props?.pinnableColumns===!0,ae=Q(e),{hasPinOverrides:oe,pinFor:z,resetPins:se,setColumnPin:ce}=ev({columns:n,storageKey:ie&&ae?`lattice:table-pins:${ae}`:void 0}),le=(0,B.useMemo)(()=>U_(R,z),[R,z]),ue=le.some(e=>z(e)!=null),de=le.findIndex(e=>z(e)===`end`),fe=(0,B.useMemo)(()=>{if(!ie)return L;let e=new Map(R.map(e=>[e.key,e]));for(let t of L)e.has(t.key)||e.set(t.key,t);return[...e.values()]},[ie,L,R]),pe=()=>{I(),se()},me=i.currentPage??a.page,he=i.lastPage??me,ge=i.mode??`table`,_e=(0,B.useMemo)(()=>g_(e.props?.perPageOptions),[e.props?.perPageOptions]),ve=H_(me,he),ye=i.hasMore??me<he,be=O.some(e=>e.actions.length>0),xe=e.props?.striped===!0,Se=R.some(e=>e.props.filter!=null),Ce=o.map((e,t)=>({clause:e,index:t})),we=(0,B.useMemo)(()=>Array.isArray(e.props?.filters)?e.props.filters:[],[e.props?.filters]),Te=we.length>0,Ee=be,De=ue?le.reduce((e,t,n)=>z(t)===`start`?n:e,-1):-1,Oe=ue?De===-1?D?`selection`:j?`expander`:null:`column`:null,ke=ue?de===-1?Ee?`actions`:null:`column`:null,Ae=Oe===`expander`?`end`:void 0,je=Oe===`selection`?`end`:void 0,Me=ke===`actions`?`start`:void 0,Ne=(0,B.useMemo)(()=>Array.isArray(e.props?.toolbar)?e.props.toolbar:[],[e.props?.toolbar]),Pe=(0,B.useMemo)(()=>W_(le,z),[le,z]),Fe=(0,B.useMemo)(()=>gv({actions:Ee,expander:j,selection:D}),[Ee,D,j]),Ie=e.props?.resizableColumns===!0,Le=Q(e),{getResizeHandleProps:Re,gridTemplateColumns:ze,hasOverrides:Be,pinOffsetVars:Ve,resizeRootRef:He,resetColumns:Ue}=tm({columns:Pe,enabled:Ie,hasActions:Ee,hasExpander:j,hasSelection:D,leadingTracks:Fe.leadingTracks,showIndicator:e.props?.resizeIndicator===!0,storageKey:Ie&&Le?`lattice:table-columns:${Le}`:void 0,trailingTracks:Fe.trailingTracks}),We=e.props?.searchable===!0||Ne.length>0||Te||P||Be||ie,Ge=ue?{start:`start`,end:`end`}:null;return(0,q.jsxs)(Sv,{"data-test":e.id,children:[We&&(0,q.jsx)(Cv,{start:e.props?.searchable&&(0,q.jsx)(Sy,{value:c,onSearch:h}),end:(0,q.jsxs)(q.Fragment,{children:[Te&&(0,q.jsx)(vy,{filters:we,values:s,processing:_,onChange:p,onSearch:g}),(P||ie)&&(0,q.jsx)(hy,{columns:fe,isVisible:ne,visibleColumnCount:R.length,hasHidden:F,hasPinOverrides:oe,onToggle:re,onReset:pe,onSetPin:ce,pinFor:z,pinningEnabled:ie,processing:_}),Be&&(0,q.jsx)(`button`,{"aria-label":t(`table.reset-column-widths`,`Reset column widths`),className:`hidden rounded-lt-sm p-1 text-lt-muted-fg hover:text-lt-fg md:inline-flex`,"data-test":`table-reset-columns`,onClick:Ue,title:t(`table.reset-column-widths`,`Reset column widths`),type:`button`,children:(0,q.jsx)(y,{name:`rotate-ccw`,className:`size-lt-icon-sm`})}),Ne.map((e,t)=>(0,q.jsx)(Xt,{node:e},e.key??e.id??t))]})}),(0,q.jsx)(gy,{clauses:o,columnsByKey:M,indicators:a.tableFilterIndicators,processing:_,onRemoveClause:d,onChange:p,onReset:m}),D&&k.active&&(0,q.jsx)(Qv,{actions:E,selectedKeys:k.selectedKeys,allMatching:k.allMatching,total:i.total??void 0,query:N_(a),canSelectAllMatching:k.allVisibleSelected&&!k.allMatching&&i.total!=null&&i.total>k.selectedKeys.length,onSelectAllMatching:k.selectAllMatching,onCompleted:k.clear}),a.sorts.length>0&&(0,q.jsx)(by,{columnsByKey:M,query:a,processing:_,onClear:S}),(0,q.jsxs)(kv,{ref:He,columns:ze,pinned:ue,style:Ve,children:[(0,q.jsxs)(Av,{children:[(0,q.jsxs)(jv,{children:[j&&(0,q.jsx)(Pv,{kind:`expander`,bottomBordered:!Se,pinBoundary:Ae,pinned:Ge?.start}),D&&(0,q.jsx)(Pv,{kind:`selection`,bottomBordered:!Se,pinBoundary:je,pinned:Ge?.start,children:(0,q.jsx)(Pf,{"aria-label":t(`table.select-all-rows`,`Select all rows`),"data-test":`select-all`,checked:k.allSelected,onCheckedChange:()=>k.toggleAll()})}),le.map((e,t)=>{let n=ue?z(e):null;return(0,q.jsxs)(B.Fragment,{children:[ue&&t===de&&(0,q.jsx)(Pv,{kind:`filler`,bottomBordered:!Se}),(0,q.jsx)(my,{column:e,processing:_,pinBoundary:eb(n,t,De,de),pinIndex:t,pinned:n??void 0,resizeHandleProps:Ie?Re(Pe[t]):void 0,sort:x,query:a,bottomBordered:!Se})]},e.key)}),ue&&de===-1&&(0,q.jsx)(Pv,{kind:`filler`,bottomBordered:!Se}),Ee&&(0,q.jsx)(Pv,{kind:`actions`,bottomBordered:!Se,pinBoundary:Me,pinned:Ge?.end,children:(0,q.jsx)(`span`,{className:`sr-only`,children:e.props?.actionsLabel??t(`table.actions`,`Actions`)})})]}),Se&&(0,q.jsxs)(jv,{children:[j&&(0,q.jsx)(zv,{kind:`expander`,pinBoundary:Ae,pinned:Ge?.start}),D&&(0,q.jsx)(zv,{kind:`selection`,pinBoundary:je,pinned:Ge?.start}),le.map((e,t)=>{let n=ue?z(e):null;return(0,q.jsxs)(B.Fragment,{children:[ue&&t===de&&(0,q.jsx)(zv,{kind:`filler`}),(0,q.jsx)(zv,{pinBoundary:eb(n,t,De,de),pinIndex:t,pinned:n??void 0,children:e.props.filter!=null&&(0,q.jsx)(oy,{column:e,clauses:Ce.filter(t=>t.clause.field===e.key),processing:_,onAdd:l,onUpdate:u,onRemove:d,onReplace:f,onSearch:(t,n)=>g(`column:${e.key}`,t,n)})})]},e.key)}),ue&&de===-1&&(0,q.jsx)(zv,{kind:`filler`}),Ee&&(0,q.jsx)(zv,{kind:`actions`,pinBoundary:Me,pinned:Ge?.end})]})]}),(0,q.jsx)(Bv,{children:v?O.length===0?(0,q.jsx)(qv,{children:e.props?.emptyLabel??t(`table.empty`,`No results`)}):O.map(({row:n,actions:r,click:i,detail:a,key:o})=>{let s=a!=null&&ee(o),c=`${Q(e)??`table`}-row-detail-${o}`;return(0,q.jsxs)(B.Fragment,{children:[(0,q.jsx)(Oy,{click:i,children:({clickable:e,href:i,processing:l,onAuxClick:u,onClick:d,onKeyDown:f})=>(0,q.jsxs)(Hv,{"aria-busy":l||void 0,clickable:e,"data-row-link":i??void 0,striped:xe,tabIndex:e?0:void 0,onAuxClick:u,onClick:d,onKeyDown:f,children:[j&&(0,q.jsx)(Wv,{kind:`expander`,pinBoundary:Ae,pinned:Ge?.start,children:a&&(0,q.jsx)(Gv,{"data-test":`row-expand-${o}`,expanded:s,"aria-controls":c,"aria-label":t(`table.row-detail.toggle`,`Toggle detail`),onClick:()=>A(o)})}),D&&(0,q.jsx)(Wv,{kind:`selection`,pinBoundary:je,pinned:Ge?.start,children:(0,q.jsx)(Pf,{"aria-label":t(`table.select-row`,`Select row {{key}}`,{key:o}),"data-test":`select-row-${o}`,checked:k.isSelected(o),onCheckedChange:()=>k.toggle(o)})}),le.map((e,t)=>{let r=ue?z(e):null;return(0,q.jsxs)(B.Fragment,{children:[ue&&t===de&&(0,q.jsx)(Wv,{kind:`filler`}),(0,q.jsx)(Wv,{align:e.props.align,label:e.props.label,pinBoundary:eb(r,t,De,de),pinIndex:t,pinned:r??void 0,children:(0,q.jsx)($y,{column:e,row:n})})]},e.key)}),ue&&de===-1&&(0,q.jsx)(Wv,{kind:`filler`}),Ee&&(0,q.jsx)(Wv,{kind:`actions`,pinBoundary:Me,pinned:Ge?.end,children:r.map((e,t)=>(0,q.jsx)(Xt,{node:e},e.key??e.id??t))})]})}),s&&a&&(0,q.jsx)(Kv,{id:c,children:(0,q.jsx)(Qe,{nodes:[a]})})]},o)}):(0,q.jsx)(Jv,{children:t(`table.loading`,`Loading rows...`)})})]}),v&&(0,q.jsx)(yy,{pagination:i,currentPage:me,processing:_,mode:ge,hasNextPage:ye,visiblePages:ve,infiniteLoaderRef:b,perPageOptions:_e,perPageValue:ge===`infinite`?`infinite`:a.perPage,onPerPage:w,onPage:C,onLoadMore:T})]})}),"table.row-click":V(()=>null)},name:`lattice/table`},nb=`--lt-sticky-offset`,rb=`--lt-sticky-own-top`;function ib(e){let t=(0,B.useRef)(null);return Ud(()=>{let n=t.current,r=n?.parentElement;if(!e||!n||!r||typeof ResizeObserver>`u`)return;let i=ab(r.parentElement);n.style.setProperty(rb,i);let a=()=>{r.style.setProperty(nb,`calc(${i} + ${n.offsetHeight}px)`)};a();let o=new ResizeObserver(a);return o.observe(n),()=>{o.disconnect(),r.style.removeProperty(nb),n.style.removeProperty(rb)}},[e]),t}function ab(e){return e&&getComputedStyle(e).getPropertyValue(`--lt-sticky-offset`).trim()||`0px`}var ob={center:`justify-items-center text-center`,end:`justify-items-end text-end`,start:`justify-items-start text-start`,stretch:`justify-items-stretch`},sb={center:`items-center text-center`,end:`items-end text-end`,start:`items-start text-start`,stretch:`items-stretch justify-stretch`},cb={none:`gap-0`,xs:`gap-1`,sm:`gap-2`,md:`gap-4`,lg:`gap-6`,xl:`gap-8`},lb={full:`w-full`,auto:`w-auto`,sm:`mx-auto w-full max-w-md`,md:`mx-auto w-full max-w-2xl`,lg:`mx-auto w-full max-w-4xl`,xl:`mx-auto w-full max-w-6xl`,fill:`min-w-0 flex-1`},ub={full:`h-full`,screen:`min-h-screen`},db={start:`mr-auto`,end:`ml-auto`},fb=`sticky top-[var(--lt-sticky-own-top,var(--lt-sticky-offset))] z-lt-sticky -my-4 bg-lt-bg py-4`;function pb({align:e=`stretch`,className:t,direction:n=`vertical`,float:r,gap:i=`md`,height:a,justify:o,sticky:s=!1,width:c=`full`,...l}){let u=n===`horizontal`||o!==void 0,d=ib(s);return(0,q.jsx)(`div`,{"data-slot":`stack`,"data-sticky":s||void 0,ref:d,className:x(u?x(`flex`,n===`horizontal`?`flex-wrap`:`flex-col`):`grid content-start`,u?sb[e]:ob[e],cb[i],lb[c],o?qm[o]:null,a?ub[a]:null,r?db[r]:null,s&&fb,t),...l})}var mb=(0,B.createContext)(null);function hb({children:e,className:t,defaultOpen:n=null,gap:r,items:i,...a}){let[o,s]=(0,B.useState)(n),[c,l]=(0,B.useState)(n);n!==c&&(l(n),s(n));let u=(0,B.useMemo)(()=>({items:i,openItem:o,setOpenItem:s}),[i,o]);return(0,q.jsx)(`div`,{"data-slot":`accordion`,className:x(`flex flex-col`,r?cb[r]:null,t),...a,children:(0,q.jsx)(mb.Provider,{value:u,children:e})})}function gb(e){let t=(0,B.useContext)(mb);return t===null||e===void 0||!t.items.includes(e)?null:{open:t.openItem===e,setOpen:n=>t.setOpenItem(n?e:null)}}var _b={xs:`size-6 text-[0.5rem]`,sm:`size-8 text-xs`,md:`size-10 text-sm`,lg:`size-12 text-base`,xl:`size-16 text-lg`,"2xl":`size-20 text-xl`,"3xl":`size-24 text-2xl`,"4xl":`size-32 text-3xl`};function vb({className:e,name:t,shape:n=`circle`,size:r=`md`,src:i,...a}){let o=t??void 0;return(0,q.jsx)(`span`,{"data-slot":`avatar`,role:i?void 0:`img`,"aria-label":i?void 0:o,className:x(`inline-flex shrink-0 items-center justify-center overflow-hidden bg-lt-muted font-medium text-lt-muted-fg select-none`,n===`rounded`?`rounded-lt`:`rounded-full`,_b[r],e),...a,children:i?(0,q.jsx)(`img`,{src:i,alt:o??``,className:`size-full object-cover`}):t?yb(t):(0,q.jsx)(bb,{})})}function yb(e){return e.trim().split(/\s+/).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join(``)}function bb(){return(0,q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:`size-[60%]`,children:[(0,q.jsx)(`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`}),(0,q.jsx)(`circle`,{cx:`12`,cy:`7`,r:`4`})]})}function xb({"aria-label":e=`Breadcrumb`,className:t,items:n,separator:r=`/`,...i}){let{Link:a}=Rl();return n.length===0?null:(0,q.jsx)(`nav`,{...i,"aria-label":e,className:x(`min-w-0 flex-1`,t),children:(0,q.jsx)(`ol`,{className:`flex items-center gap-2 text-sm text-lt-muted-fg`,children:n.map((e,t)=>{let i=t===n.length-1;return(0,q.jsxs)(B.Fragment,{children:[(0,q.jsx)(`li`,{className:`min-w-0`,children:i||!e.href?(0,q.jsx)(`span`,{"aria-current":i?`page`:void 0,className:x(`block truncate`,i&&`text-lt-fg`),children:e.label}):(0,q.jsx)(a,{className:`block truncate hover:text-lt-fg`,href:e.href,children:e.label})}),i?null:(0,q.jsx)(`li`,{"aria-hidden":`true`,children:r})]},e.href??t)})})})}var Sb={primary:{accent:`border-l-lt-primary`,icon:(0,q.jsx)(y,{name:`info`,className:`size-lt-icon-lg shrink-0 text-lt-primary`})},secondary:{accent:`border-l-lt-secondary`,icon:(0,q.jsx)(y,{name:`info`,className:`size-lt-icon-lg shrink-0 text-lt-muted-fg`})},success:{accent:`border-l-lt-success`,icon:(0,q.jsx)(y,{name:`circle-check`,className:`size-lt-icon-lg shrink-0 text-lt-success`})},info:{accent:`border-l-lt-info`,icon:(0,q.jsx)(y,{name:`info`,className:`size-lt-icon-lg shrink-0 text-lt-info`})},warning:{accent:`border-l-lt-warning`,icon:(0,q.jsx)(y,{name:`circle-alert`,className:`size-lt-icon-lg shrink-0 text-lt-warning`})},danger:{accent:`border-l-lt-danger`,icon:(0,q.jsx)(y,{name:`circle-x`,className:`size-lt-icon-lg shrink-0 text-lt-danger`})}};function Cb({variant:e,message:t,title:n,action:r,dismissible:i=!0,dismissLabel:a=`Dismiss`,onDismiss:o,className:s,...c}){return(0,q.jsxs)(`div`,{role:`status`,"data-test":`callout-${e}`,className:x(`flex items-start gap-3 rounded-lt border border-l-4 border-lt-border bg-lt-popover p-4 text-lt-popover-fg`,Sb[e].accent,s),...c,children:[Sb[e].icon,(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[n?(0,q.jsx)(`p`,{className:`text-sm font-medium text-lt-fg`,children:n}):null,(0,q.jsx)(`p`,{className:`text-sm text-lt-fg`,children:t}),r?(0,q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r}):null]}),i?(0,q.jsx)(`button`,{type:`button`,"aria-label":a,"data-test":`callout-dismiss`,className:`shrink-0 rounded-lt-sm p-1 text-lt-muted-fg transition-colors hover:bg-lt-muted hover:text-lt-fg`,onClick:o,children:(0,q.jsx)(y,{name:`x`,className:`size-lt-icon-md`})}):null]})}function wb({"aria-label":e,className:t,content:n,defaultOpen:r,onOpenChange:i,open:a,trigger:o,triggerProps:s}){let{t:c}=N(F);if(!Tb(n))return null;let l=Tb(o);return(0,q.jsxs)(Zt,{defaultOpen:r,onOpenChange:i,open:a,children:[(0,q.jsx)(Pe,{...s,type:`button`,"aria-label":e??(l?void 0:c(`common.more-info`,`More information`)),className:l?`inline-flex items-center rounded-lt-sm outline-none focus-visible:ring-lt-ring/50 focus-visible:ring-[length:var(--lt-ring-width)]`:`ml-1 inline-flex rounded-lt-sm text-lt-muted-fg outline-none hover:text-lt-fg focus-visible:text-lt-fg focus-visible:ring-lt-ring/50 focus-visible:ring-[length:var(--lt-ring-width)]`,children:l?o:(0,q.jsx)(y,{name:`info`,className:`size-lt-icon-sm`})}),(0,q.jsx)(Jt,{align:`start`,className:x(`max-w-xs p-3 text-sm [&_a]:underline`,t),children:n})]})}function Tb(e){return e!=null&&e!==!1&&e!==``}function Eb({children:e,className:t,description:n,headerActions:r,title:i,tooltip:a,...o}){let s=jb(i),c=jb(n),l=jb(r),u=s||c||l;return(0,q.jsxs)(`article`,{...o,"data-slot":`card`,className:x(`flex flex-col gap-6 rounded-lt border border-lt-border bg-lt-surface py-lt-gutter text-lt-surface-fg shadow-lt-sm`,t),children:[u?(0,q.jsxs)(Db,{children:[s||l?(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center`,children:[s?(0,q.jsx)(Ob,{children:i}):null,s?(0,q.jsx)(wb,{content:a}):null]}),l?(0,q.jsx)(`div`,{className:`flex items-center gap-2`,children:r}):null]}):null,c?(0,q.jsxs)(`div`,{className:`flex items-center`,children:[(0,q.jsx)(kb,{children:n}),s?null:(0,q.jsx)(wb,{content:a})]}):null]}):null,jb(e)?(0,q.jsx)(Ab,{className:`flex flex-col gap-6`,children:e}):null]})}function Db({className:e,...t}){return(0,q.jsx)(`div`,{"data-slot":`card-header`,className:x(`flex flex-col gap-1.5 px-lt-gutter`,e),...t})}function Ob({className:e,...t}){return(0,q.jsx)(`div`,{"data-slot":`card-title`,className:x(`font-semibold leading-none`,e),...t})}function kb({className:e,...t}){return(0,q.jsx)(`div`,{"data-slot":`card-description`,className:x(`text-sm text-lt-muted-fg`,e),...t})}function Ab({className:e,...t}){return(0,q.jsx)(`div`,{"data-slot":`card-content`,className:x(`px-lt-gutter`,e),...t})}function jb(e){return e!=null&&e!==!1&&e!==``}var Mb=(0,B.lazy)(()=>dn(()=>import(`./chart-view-CPIF_gTM.js`),__vite__mapDeps([20,1,2,21,3,5,7,22,15]),import.meta.url));function Nb({categoryFormat:e=null,categoryKey:t=null,className:n,data:r,description:i=null,grid:a=!0,height:o=320,legend:s=!0,series:c,title:l=null,tooltip:u=!0,valueFormat:d=null,xAxis:f=!0,yAxis:p=!0,...m}){let h=l!==null||i!==null;return(0,q.jsxs)(`div`,{...m,className:x(`flex flex-col gap-3 rounded-lt border border-lt-border bg-lt-surface p-4 text-lt-surface-fg shadow-lt-sm`,n),children:[h&&(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[l!==null&&(0,q.jsx)(`div`,{className:`text-sm font-semibold leading-tight`,children:l}),i!==null&&(0,q.jsx)(`div`,{className:`text-xs leading-5 text-lt-muted-fg`,children:i})]}),(0,q.jsx)(`div`,{className:`min-h-0 w-full`,children:(0,q.jsx)(B.Suspense,{fallback:(0,q.jsx)(`div`,{style:{height:o}}),children:(0,q.jsx)(Mb,{categoryFormat:e,categoryKey:t,data:r,grid:a,height:o,legend:s,series:c,tooltip:u,valueFormat:d,xAxis:f,yAxis:p})})})]})}var Pb=(0,B.lazy)(()=>dn(()=>import(`./code-block-view-4IbUdTmO.js`),__vite__mapDeps([23,1,2,5,14]),import.meta.url));function Fb({"aria-label":e,children:t,className:n,copyable:r=!1,language:i=`text`,lineNumbers:a=!1,maxHeight:o=null,role:s=e?`region`:void 0,wrap:c=!1,...l}){let u=(0,q.jsx)(`pre`,{className:x(`max-w-full overflow-auto p-3 font-lt-mono text-xs`,c&&`whitespace-pre-wrap wrap-anywhere`),style:{maxHeight:o??void 0},children:a?(0,q.jsx)(`code`,{className:`grid grid-cols-[auto_1fr]`,children:t.split(`
118
+ `).map((e,t)=>(0,q.jsxs)(B.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`mr-3 border-r border-lt-border pr-3 text-right text-lt-muted-fg select-none`,children:t+1}),(0,q.jsx)(`span`,{children:e||`​`})]},t))}):t});return(0,q.jsxs)(`div`,{"data-slot":`code-block`,"aria-label":e,role:s,...l,className:x(`relative max-w-full overflow-hidden rounded-lt-sm bg-lt-muted text-lt-fg`,n),children:[r?(0,q.jsx)(Kh,{value:t,label:e??`code`,iconOnly:!0,className:`absolute top-3 right-6 z-10 bg-lt-bg/80 hover:bg-lt-bg`}):null,(0,q.jsx)(B.Suspense,{fallback:u,children:(0,q.jsx)(Pb,{language:i,lineNumbers:a,maxHeight:o,wrap:c,children:t})})]})}var Ib=(0,B.createContext)(`description-list`);function Lb({children:e,value:t}){return(0,q.jsx)(Ib.Provider,{value:t,children:e})}function Rb(){return(0,B.useContext)(Ib)}function zb({bleed:e=!1,children:t,className:n,divided:r=!1,emptyLabel:i,semantic:a=`description-list`,...o}){let s=a===`description-list`,c=x(`w-full`,r&&`divide-y divide-lt-border`,e&&`-mx-lt-gutter w-auto`,n),l=t??(i?(0,q.jsx)(`p`,{className:`px-lt-gutter py-3 text-sm text-lt-muted-fg`,children:i}):null);return(0,q.jsx)(Lb,{value:a,children:s?(0,q.jsx)(`dl`,{...o,className:c,"data-slot":`description-list`,children:l}):(0,q.jsx)(`div`,{...o,className:c,"data-slot":`description-list`,role:`list`,children:l})})}function Bb({align:e=`start`,children:t,className:n,contentClassName:r,placement:i=`bottom`,trigger:a,...o}){let[s,c]=(0,B.useState)(!1),{onNavigate:l}=Rl();return(0,B.useEffect)(()=>l(()=>c(!1)),[l]),(0,q.jsxs)(Zt,{open:s,onOpenChange:c,children:[(0,q.jsx)(Pe,{asChild:!0,children:(0,q.jsx)(`button`,{...o,className:x(`w-full`,n),type:`button`,children:a})}),(0,q.jsx)(Jt,{align:e,className:x(`min-w-56 p-1`,r),role:`menu`,side:i,children:(0,q.jsx)(qt,{collapsed:!1,children:t})})]})}function Vb({"aria-label":e,children:t,className:n,defaultOpen:r=!1,offset:i=16,onOpenChange:a,open:o,placement:s=`bottom-end`,role:c,style:l,trigger:u,triggerProps:d,...f}){let[p,m]=(0,B.useState)(r),h=o??p,{className:g,onClick:_,...v}=d??{},y=Hb(s,Math.max(0,i));if(u==null)return(0,q.jsx)(`div`,{"aria-label":e,className:x(`fixed z-lt-popover max-w-[calc(100vw-2rem)] rounded-lt border border-lt-border bg-lt-popover p-1 text-lt-popover-fg shadow-lt-md`,n),role:e?c??`group`:c,...f,style:{...y,...l},children:t});let b=s===`bottom-start`||s===`bottom-end`,S=s===`top-start`||s===`bottom-start`;function C(e){if(_?.(e),e.defaultPrevented)return;let t=!h;o===void 0&&m(t),a?.(t)}return(0,q.jsx)(`div`,{"aria-label":e,className:x(`fixed z-lt-popover max-w-[calc(100vw-2rem)]`,n),role:e?c??`group`:c,...f,style:{...y,...l},children:(0,q.jsxs)(`div`,{className:x(`flex w-fit gap-2`,b?`flex-col-reverse`:`flex-col`),children:[(0,q.jsx)(`button`,{...v,"aria-expanded":h,className:x(`inline-flex items-center gap-2 rounded-lt border border-lt-border bg-lt-popover px-3 py-1.5 text-sm font-medium text-lt-popover-fg shadow-lt-md hover:bg-lt-muted`,S?`self-start`:`self-end`,g),onClick:C,type:`button`,children:u}),(0,q.jsx)(`div`,{className:h?`block`:`hidden`,children:t})]})})}function Hb(e,t){return e===`top-start`?{left:t,top:t}:e===`top-end`?{right:t,top:t}:e===`bottom-start`?{bottom:t,left:t}:{bottom:t,right:t}}function Ub({children:e,className:t,copyable:n=!1,copyLabel:r,copyValue:i,level:a=1,tooltip:o,...s}){let c=Math.min(Math.max(a,1),6),l=Wb(c),u=(0,q.jsxs)(l,{"data-slot":`heading`,className:x(`font-semibold tracking-normal text-balance text-lt-fg`,c===1&&`text-2xl font-bold leading-tight`,c===2&&`text-xl`,c>2&&`text-base`,t),...s,children:[e,(0,q.jsx)(Pt,{content:o})]}),d=i??(typeof e==`string`?e:void 0);return!n||d===void 0?u:(0,q.jsx)(qh,{value:d,label:r??d,children:u})}function Wb(e){switch(e){case 1:return`h1`;case 2:return`h2`;case 3:return`h3`;case 4:return`h4`;case 5:return`h5`;default:return`h6`}}function Gb({alt:e,circular:t=!1,className:n,height:r,previewable:i=!1,size:a,width:o,...s}){return(0,q.jsx)(Ry,{...s,alt:e??``,className:x(`object-cover`,t?`rounded-full`:`rounded-lt-sm`,n),height:a??r,previewable:i,width:a??o})}function Kb({children:e,listClassName:t,...n}){return(0,q.jsx)(`nav`,{...n,children:(0,q.jsx)(`ul`,{className:x(`flex flex-col gap-1`,t),children:e})})}var qb=`flex items-center gap-2 rounded-lt-sm px-3 py-2 text-base font-medium text-lt-fg transition-colors hover:bg-lt-muted`;function Jb(e){return typeof e==`string`?e:void 0}function Yb({active:e=!1,children:t,className:n,defaultOpen:r=!1,disabled:i=!1,href:a,icon:o,label:s,method:c,onClick:l,onOpenChange:u,open:d,prefix:f,suffix:p,...m}){let h=Ne(),{Link:g}=Rl(),_=o!=null,v=Jb(s),y=_?o:(0,q.jsxs)(q.Fragment,{children:[f,h?(0,q.jsx)(`span`,{className:`pointer-events-none absolute top-1/2 left-full z-lt-popover ml-2 hidden -translate-y-1/2 rounded-lt-sm border border-lt-border bg-lt-popover px-2 py-1 text-sm whitespace-nowrap text-lt-popover-fg shadow-lt-md group-hover:block`,role:`tooltip`,children:s}):(0,q.jsx)(`span`,{children:s}),p?(0,q.jsx)(`span`,{className:`ml-auto flex shrink-0 items-center`,children:p}):null]}),b=x(qb,`w-full`,h&&`group relative justify-center`,_&&`justify-center`),S=h||_?v:void 0;return t?h?(0,q.jsx)(`li`,{className:n,children:(0,q.jsx)(Bb,{...m,"aria-label":v,className:x(qb,`justify-center`),contentClassName:`min-w-48`,placement:`right`,title:v,trigger:o??f??(0,q.jsx)(`span`,{children:s}),children:(0,q.jsxs)(`ul`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`li`,{className:`px-3 py-1.5 text-xs font-semibold tracking-wide text-lt-muted-fg uppercase`,children:s}),t]})})}):(0,q.jsx)(Xb,{...m,className:n,content:y,defaultOpen:r,onOpenChange:u,open:d,children:t}):a===void 0?l?(0,q.jsx)(`li`,{className:n,children:(0,q.jsx)(`button`,{...m,"aria-label":S,className:b,disabled:i,onClick:l,type:`button`,children:y})}):h?null:(0,q.jsx)(`li`,{className:n,children:(0,q.jsx)(`span`,{...m,className:`flex items-center gap-2 px-3 py-2 text-xs font-semibold tracking-wide text-lt-muted-fg uppercase`,children:y})}):(0,q.jsx)(`li`,{className:n,children:(0,q.jsx)(g,{...m,"aria-current":e?`page`:void 0,"aria-label":S,className:x(b,e&&`bg-lt-muted font-medium`),href:a,method:c,children:y})})}function Xb({children:e,className:t,content:n,defaultOpen:r,onOpenChange:i,open:a,...o}){let[s,c]=(0,B.useState)(r),l=a??s;function u(){a===void 0&&c(!l),i?.(!l)}return(0,q.jsxs)(`li`,{className:t,children:[(0,q.jsxs)(`button`,{...o,"aria-expanded":l,className:x(qb,`w-full`),onClick:u,type:`button`,children:[n,(0,q.jsx)(y,{name:`chevron-right`,className:x(`ml-auto size-lt-icon-md shrink-0 transition-transform`,l&&`rotate-90`)})]}),l?(0,q.jsx)(`ul`,{className:`mt-1 flex flex-col gap-1 pl-3`,children:e}):null]})}var Zb={xs:`h-1`,sm:`h-1.5`,md:`h-2.5`,lg:`h-3`,xl:`h-4`,"2xl":`h-5`,"3xl":`h-6`,"4xl":`h-8`},Qb={xs:24,sm:32,md:40,lg:48,xl:64,"2xl":80,"3xl":96,"4xl":128},$b={xs:`text-[0.5rem]`,sm:`text-[0.625rem]`,md:`text-xs`,lg:`text-sm`,xl:`text-base`,"2xl":`text-lg`,"3xl":`text-xl`,"4xl":`text-2xl`};function ex({"aria-label":e,className:t,color:n,locale:r,max:i=100,shape:a=`bar`,showValue:o=!1,size:c=`md`,value:l,...u}){let{locale:d}=s(),f=an(sn(n)??on(`primary`)),p=i>0?Math.min(Math.max(l,0),i):0,m=i>0?p/i:0,h=new Intl.NumberFormat(r??d,{maximumFractionDigits:0,style:`percent`}).format(m),g={"aria-label":e,"aria-valuemax":i,"aria-valuemin":0,"aria-valuenow":p,"aria-valuetext":h,role:`progressbar`};if(a===`circle`){let e=Qb[c],n=Math.max(3,e/10),r=(e-n)/2,i=2*Math.PI*r;return(0,q.jsxs)(`div`,{...u,...g,className:x(`relative inline-flex`,t),"data-lattice-progress":`circle`,children:[(0,q.jsxs)(`svg`,{className:`-rotate-90`,height:e,width:e,children:[(0,q.jsx)(`circle`,{className:`text-lt-muted`,cx:e/2,cy:e/2,fill:`none`,r,stroke:`currentColor`,strokeWidth:n}),(0,q.jsx)(`circle`,{cx:e/2,cy:e/2,fill:`none`,r,stroke:`currentColor`,strokeDasharray:i,strokeDashoffset:i*(1-m),strokeLinecap:`round`,strokeWidth:n,style:{color:f}})]}),o?(0,q.jsx)(`span`,{className:x(`absolute inset-0 flex items-center justify-center font-medium text-lt-fg tabular-nums`,$b[c]),children:h}):null]})}return(0,q.jsxs)(`div`,{...u,className:x(`flex w-full items-center gap-2`,t),"data-lattice-progress":`bar`,children:[(0,q.jsx)(`div`,{...g,className:x(`w-full overflow-hidden rounded-full bg-lt-muted`,Zb[c]),children:(0,q.jsx)(`div`,{className:`h-full rounded-full`,style:{background:f,width:`${m*100}%`}})}),o?(0,q.jsx)(`span`,{className:`shrink-0 text-lt-muted-fg text-sm tabular-nums`,children:h}):null]})}function tx({children:e,className:t,collapsed:n,collapsible:r=!1,collapseLabel:i=`Collapse section`,defaultCollapsed:a=!1,description:o,expandLabel:s=`Expand section`,headerActions:c,onCollapsedChange:l,storageKey:u,title:d,toggleProps:f,tooltip:p,...m}){let[h,g]=If(u??``,a,r&&n===void 0&&u!==void 0),_=r&&(n??h),v=nx(d),b=nx(o),S=nx(c),C=v||b||S||r,{className:w,onClick:T,...E}=f??{};function D(e){if(T?.(e),e.defaultPrevented)return;let t=!_;n===void 0&&g(),l?.(t)}return(0,q.jsxs)(`section`,{...m,"data-slot":`section`,className:x(`flex flex-col gap-6 rounded-lt border border-lt-border bg-lt-surface py-lt-gutter text-lt-surface-fg shadow-lt-sm`,t),children:[C?(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-lt-gutter`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[r?(0,q.jsx)(`button`,{...E,"aria-expanded":!_,"aria-label":_?s:i,className:x(`mt-0.5 inline-flex shrink-0 items-center rounded-lt-sm p-0.5 text-lt-muted-fg transition-colors hover:bg-lt-muted hover:text-lt-fg`,w),onClick:D,type:`button`,children:(0,q.jsx)(y,{name:`chevron-down`,className:x(`size-lt-icon-md transition-transform`,_&&`-rotate-90`)})}):null,(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[v?(0,q.jsxs)(`div`,{className:`flex items-center`,children:[(0,q.jsx)(`div`,{className:`font-semibold leading-none`,children:d}),(0,q.jsx)(Pt,{content:p})]}):null,b?(0,q.jsxs)(`div`,{className:`flex items-center`,children:[(0,q.jsx)(`div`,{className:`text-sm text-lt-muted-fg`,children:o}),v?null:(0,q.jsx)(Pt,{content:p})]}):null]})]}),S?(0,q.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:c}):null]}):null,nx(e)?(0,q.jsx)(`div`,{className:`flex flex-col gap-6 px-lt-gutter`,hidden:_,children:e}):null]})}function nx(e){return e!=null&&e!==!1&&e!==``}function rx({bleed:e=!1,className:t,orientation:n=`horizontal`,...r}){let i=n===`horizontal`;return(0,q.jsx)(`div`,{...r,role:`separator`,"aria-orientation":n,"data-bleed":e?``:void 0,"data-slot":`separator`,className:x(`shrink-0 bg-lt-border`,i?`h-px w-full`:`h-full w-px self-stretch`,e&&(i?`-mx-lt-gutter w-auto`:`-my-lt-gutter h-auto`),t)})}var ix=`(min-width: 768px)`;function ax({backdropProps:e,children:t,className:n,collapsed:r=!1,defaultOpen:i=!1,onOpenChange:a,open:o,...s}){let c=lm(ix,!0),[l,u]=(0,B.useState)(i),d=o??l,f=r&&c;function p(){o===void 0&&u(!1),a?.(!1)}return Pl(`keydown`,e=>{e.key===`Escape`&&p()},{enabled:d}),(0,q.jsxs)(qt,{collapsed:f,children:[d?(0,q.jsx)(`div`,{...e,"aria-hidden":`true`,className:x(`fixed inset-0 z-lt-overlay bg-lt-overlay md:hidden`,e?.className),onClick:p}):null,(0,q.jsx)(`aside`,{...s,className:x(`fixed inset-y-0 left-0 z-lt-modal flex h-svh w-72 max-w-[80vw] shrink-0 flex-col gap-4 border-r border-lt-border bg-lt-bg p-4 transition-transform`,`md:sticky md:top-0 md:z-auto md:max-w-none md:translate-x-0 md:transition-[width]`,d?`translate-x-0`:`-translate-x-full`,f?`md:w-16 md:overflow-visible`:`md:w-64 md:overflow-x-hidden md:overflow-y-auto`,n),"data-collapsed":f?`true`:`false`,children:t})]})}function ox({className:e,...t}){return(0,q.jsx)(`div`,{...t,className:x(`mt-auto flex flex-col gap-4`,e)})}var sx=(0,B.createContext)(null),cx=`sticky top-[calc(var(--lt-sticky-offset)+--spacing(6))]`,lx=3;function ux(){return(0,B.useContext)(sx)??{activeValue:``,hasTablist:!0}}function dx({"aria-label":e=`Tabs`,alignment:t=`stretch`,children:n,className:r,defaultValue:i,items:a,onValueChange:o,orientation:s=`horizontal`,sticky:c=!1,value:l,...u}){let d=px(n),f=a??d.map(({props:e})=>e),p=f[0]?.value??``,[m,h]=(0,B.useState)(()=>i||p),g=l??m,_=(0,B.useRef)(null),v=s===`vertical`,y=!v&&t===`stretch`,b=!lm(`(min-width: 768px)`,!0)&&(v||f.length>lx),S=(0,B.useMemo)(()=>({activeValue:g,hasTablist:!b}),[g,b]);function C(e){f.some(t=>t.value===e)&&(l===void 0&&h(e),o?.(e))}function w(e){let t=v?`ArrowDown`:`ArrowRight`,n=v?`ArrowUp`:`ArrowLeft`;if(e.key!==t&&e.key!==n&&e.key!==`Home`&&e.key!==`End`)return;let r=Array.from(_.current?.querySelectorAll(`[role="tab"]`)??[]);if(r.length===0)return;e.preventDefault();let i=r.indexOf(document.activeElement),a;if(e.key===`Home`)a=0;else if(e.key===`End`)a=r.length-1;else{let n=e.key===t?1:-1;a=((i<0?0:i)+n+r.length)%r.length}r[a]?.focus()}return(0,q.jsx)(sx.Provider,{value:S,children:(0,q.jsxs)(`div`,{...u,className:x(`min-w-0 gap-6`,v&&!b?x(`flex`,t===`end`&&`flex-row-reverse`):`grid`,r),children:[b?(0,q.jsx)($v,{"aria-label":e,"data-test":`tabs-select`,onChange:e=>C(e.target.value),value:g,children:f.map(e=>(0,q.jsx)(`option`,{value:e.value,children:e.selectLabel??mx(e.label,e.value)},e.value))}):(0,q.jsx)(`div`,{"aria-label":e,"aria-orientation":s,className:x(`gap-1`,v?`flex w-44 shrink-0 flex-col self-start`:`rounded-lt bg-lt-muted p-1`,v&&c&&cx,y&&`flex w-full`,!v&&!y&&x(`inline-flex w-fit max-w-full overflow-x-auto`,{"justify-self-center":t===`center`,"justify-self-end":t===`end`})),ref:_,role:`tablist`,children:f.map(e=>{let t=g===e.value;return(0,q.jsx)(`button`,{"aria-controls":`${e.value}-panel`,"aria-selected":t,"data-test":`tab-${e.value}`,className:x(v?hx(t):Pm(t),y&&`flex-1`),id:`${e.value}-tab`,onClick:()=>C(e.value),onKeyDown:w,role:`tab`,tabIndex:t?0:-1,type:`button`,children:e.label},e.value)})}),(0,q.jsx)(`div`,{className:x(`min-w-0`,v&&!b&&`flex-1`),children:n})]})})}function fx({"aria-label":e,children:t,className:n,label:r,selectLabel:i,value:a,...o}){let{activeValue:s,hasTablist:c}=ux(),l=s===a,[u,d]=(0,B.useState)(l);return(0,B.useEffect)(()=>{l&&d(!0)},[l]),(0,q.jsx)(`section`,{...o,"aria-label":c?void 0:e??i??mx(r,a),"aria-labelledby":c?`${a}-tab`:void 0,className:x(`space-y-8`,!l&&`hidden`,n),hidden:!l,id:`${a}-panel`,role:`tabpanel`,tabIndex:0,children:u?t:null})}function px(e){let t=[];return B.Children.forEach(e,e=>{if((0,B.isValidElement)(e)){if(e.type===fx){t.push(e);return}e.type===B.Fragment&&t.push(...px(e.props.children))}}),t}function mx(e,t){return typeof e==`string`||typeof e==`number`||typeof e==`bigint`?String(e):(0,B.isValidElement)(e)?mx(e.props.children,t):Array.isArray(e)&&e.map(e=>mx(e,``)).join(``)||t}function hx(e){return x(`relative rounded-lt-sm px-3 py-2.5 text-left text-sm font-medium transition-colors`,e?`bg-lt-muted text-lt-fg before:absolute before:inset-y-2 before:left-0 before:w-1 before:rounded-full before:bg-lt-primary`:`text-lt-muted-fg hover:bg-lt-muted/60 hover:text-lt-fg`)}var gx={center:`text-center`,start:`text-start`},_x={xs:`text-xs leading-5`,sm:`text-sm leading-6`,md:`text-base leading-7`,lg:`text-lg leading-8`,xl:`text-xl leading-8`,"2xl":`text-2xl leading-9`,"3xl":`text-3xl leading-10`,"4xl":`text-4xl leading-none`};function vx({align:e=`start`,children:t,className:n,color:r,copyable:i=!1,copyLabel:a,copyValue:o,size:s=`md`,style:c,...l}){let u=an(sn(r)??on(`muted`)),d=(0,q.jsx)(`p`,{"data-slot":`text`,className:x(`m-0`,gx[e],_x[s],n),style:{color:u,...c},...l,children:t}),f=o??(typeof t==`string`?t:void 0);return!i||f===void 0?d:(0,q.jsx)(qh,{value:f,label:a??f,children:d})}function yx({className:e,sticky:t=!1,...n}){return(0,q.jsx)(`header`,{...n,className:x(`flex h-(--lt-topbar-h) w-full items-center gap-2 border-b border-lt-border bg-lt-bg px-4 text-lt-fg`,t&&`sticky top-0 z-lt-sticky`,e),"data-lattice-topbar":``,"data-sticky":t||void 0})}function bx(){let{locale:e}=s(),{timezone:t}=ae();return(0,B.useMemo)(()=>({locale:e,timezone:t}),[e,t])}function xx(e){return e.kind===`date`}function Sx(e,t,n){return t===null?String(e??``):xx(t)?R(e,t,{locale:n.locale,timeZone:n.timezone}):Vy(e,t,n.locale)}var Cx=({children:e,node:t})=>{let n=(t.schema??[]).map(Q).filter(e=>e!==void 0);return(0,q.jsx)(hb,{className:t.props.class??void 0,"data-test":Q(t),defaultOpen:t.props.defaultOpen,gap:t.props.gap??void 0,items:n,children:e})},wx=({node:e})=>(0,q.jsx)(vb,{className:e.props.class??void 0,"data-test":Q(e),name:e.props.name,shape:e.props.shape,size:e.props.size,src:e.props.src}),Tx=({node:e})=>(0,q.jsx)(My,{className:e.props.class??void 0,color:e.props.color,"data-test":Q(e),children:e.props.label}),Ex=({node:e})=>{let{t}=N(F);return(0,q.jsx)(xb,{"aria-label":t(`common.breadcrumb`,`Breadcrumb`),className:e.props.class??void 0,"data-test":Q(e),items:e.props.items.map(e=>({href:e.href,label:e.title}))})},Dx=({node:e})=>{let{label:t,icon:n,class:r}=e.props,i=e.props.variant??null,a=e.props.emphasis??`solid`,o=Q(e),s=xu(e.props),{Link:c}=Rl(),l=n?`icon`:`md`,u=n?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(tl,{className:`size-lt-icon-md`,icon:n}),t?(0,q.jsx)(`span`,{className:`sr-only`,children:t}):null]}):t,d=({onClick:e,processing:t})=>(0,q.jsx)(J,{className:r??void 0,"data-test":o,disabled:t,emphasis:a,onClick:e,size:l,variant:i,children:u});return s.kind===`navigate`?(0,q.jsx)(J,{asChild:!0,className:r??void 0,"data-test":o,emphasis:a,variant:i,size:l,children:(0,q.jsx)(c,{href:s.href,method:s.method??void 0,children:u})}):s.kind===`action`?(0,q.jsx)(vu,{action:s.action,children:d}):s.kind===`effects`||s.kind===`modal`?d({onClick:s.onClick,processing:!1}):(0,q.jsx)(J,{className:r??void 0,"data-test":o,emphasis:a,size:l,type:e.props.buttonType,variant:i,children:u})},Ox=[`primary`,`secondary`,`success`,`info`,`warning`,`danger`];function kx(e){return Ox.some(t=>t===e)}function Ax(e){let t=typeof e==`string`||Ug(e)?e:null;return t===``?null:t}function jx(e,t,n){let r=e=>{let r=t(e.detail);r!==null&&n(r)};return window.addEventListener(e,r),()=>window.removeEventListener(e,r)}function Mx(e){if(typeof e!=`object`||!e)return null;let t=e,n=Ax(t.message);return n===null?null:{action:t.action??null,dismissible:t.dismissible!==!1,duration:typeof t.duration==`number`?t.duration:null,message:n,persistent:t.persistent===!0,variant:kx(t.variant)?t.variant:`success`}}function Nx(e){return jx(d.toast,Mx,e)}function Px(e){if(typeof e!=`object`||!e)return null;let t=e,n=Ax(t.message);return n===null?null:{action:t.action??null,dismissible:t.dismissible!==!1,message:n,title:typeof t.title==`string`||Ug(t.title)?t.title:null,unique:typeof t.unique==`string`?t.unique:null,variant:kx(t.variant)?t.variant:`info`}}function Fx(e){return jx(d.callout,Px,e)}function Ix(e){return jx(d.retractCallout,e=>{let t=e?.unique;return typeof t==`string`?t:null},e)}var Lx=0,Rx=({node:e})=>{let{t}=N(F),{onNavigate:n}=Rl(),[r,i]=(0,B.useState)([]);(0,B.useEffect)(()=>Fx(e=>{i(t=>[...e.unique?t.filter(t=>t.unique!==e.unique):t,{...e,id:Lx++}])}),[]),(0,B.useEffect)(()=>n(()=>{i(e=>e.filter(e=>!e.unique))}),[n]),(0,B.useEffect)(()=>Ix(e=>{i(t=>t.filter(t=>t.unique!==e))}),[]);function a(e){i(t=>t.filter(t=>t.id!==e))}return r.length===0?null:(0,q.jsx)(`div`,{className:`flex w-full flex-col gap-2`,"data-test":Q(e),children:r.map(e=>(0,q.jsx)(Cb,{action:e.action?(0,q.jsx)(Xt,{node:e.action}):void 0,dismissLabel:t(`common.dismiss`,`Dismiss`),dismissible:e.dismissible,message:Gg(e.message,t),onDismiss:()=>a(e.id),title:e.title?Gg(e.title,t):void 0,variant:e.variant},e.id))})},zx=({children:e,node:t})=>{let n=Gt(t.props.headerActions),r=t.props.tooltip;return(0,q.jsx)(Eb,{className:t.props.class??void 0,"data-test":Q(t),description:t.props.description,headerActions:n.length>0?(0,q.jsx)(Qe,{nodes:n}):null,title:t.props.title,tooltip:r?(0,q.jsx)(`div`,{dangerouslySetInnerHTML:{__html:r}}):null,children:e})},Bx=({node:e})=>(0,q.jsx)(Nb,{categoryFormat:e.props.categoryFormat,categoryKey:e.props.categoryKey,className:e.props.class??void 0,data:e.props.data,"data-test":Q(e),description:e.props.description,grid:e.props.grid,height:e.props.height,legend:e.props.legend,series:e.props.series,title:e.props.title,tooltip:e.props.tooltip,valueFormat:e.props.valueFormat,xAxis:e.props.xAxis,yAxis:e.props.yAxis}),Vx=({node:e})=>(0,q.jsx)(Fb,{className:e.props.class??void 0,copyable:e.props.copyable,"data-test":Q(e),language:e.props.language,lineNumbers:e.props.lineNumbers,maxHeight:e.props.maxHeight,wrap:e.props.wrap,children:e.props.code}),Hx=({children:e,node:t})=>{let n=t.props.rememberState!==!1,r=Gt(t.props.trigger),i=Q(t),a=gb(i);return(0,q.jsx)(Lf,{...a?{onOpenChange:a.setOpen,open:a.open}:n?{storageKey:`lattice:collapsible:${i??`default`}`}:{},className:t.props.class??void 0,"data-test":i,defaultOpen:t.props.collapsed===!1,tooltip:t.props.tooltip,trigger:(0,q.jsx)(Qe,{nodes:r}),triggerProps:{"data-test":Xl(`collapsible-toggle`,i)??`collapsible-toggle-default`},children:e})},Ux=({children:e,node:t})=>(0,q.jsx)(zb,{bleed:t.props.bleed,className:t.props.class??void 0,"data-test":Q(t),divided:t.props.divided,emptyLabel:t.props.emptyLabel,semantic:t.props.semantic,children:e}),Wx=({children:e,node:t})=>{let n=Q(t)??`dropdown`;return(0,q.jsx)(Bb,{className:x(`w-auto`,t.props.class),"data-test":n,placement:t.props.placement,trigger:(0,q.jsx)(`span`,{className:`flex min-w-0 items-center rounded-lt-sm px-2 py-1.5 text-sm hover:bg-lt-muted`,children:(0,q.jsx)(Qe,{nodes:Gt(t.props.trigger)})}),children:(0,q.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e})})},Gx=({children:e,node:t})=>{let n=Gt(t.props.trigger),r=Q(t);return(0,q.jsx)(Vb,{"aria-label":t.props.label??void 0,className:t.props.class??void 0,"data-test":r,offset:t.props.offset??16,placement:t.props.placement??`bottom-end`,trigger:n.length>0?(0,q.jsx)(Qe,{nodes:n}):void 0,triggerProps:{"data-test":r?`${r}-trigger`:void 0},children:e})},Kx=({node:e})=>(0,q.jsx)(Hf,{className:e.props.class??void 0,columns:e.props.columns??void 0,"data-test":Q(e),children:(e.schema??[]).map((e,t)=>(0,q.jsx)(Uf,{columnSpan:e.props?.columnSpan,children:(0,q.jsx)(Xt,{node:e})},pe(e,t)))}),qx=({node:e})=>(0,q.jsx)(Ub,{className:e.props.class??void 0,copyable:e.props.copyable,copyLabel:e.props.text,copyValue:e.props.text,"data-test":Q(e),level:e.props.level,tooltip:e.props.tooltip,children:e.props.text}),Jx={xs:`size-lt-icon-xs`,sm:`size-lt-icon-sm`,md:`size-lt-icon-md`,lg:`size-lt-icon-lg`,xl:`size-lt-icon-xl`,"2xl":`size-lt-icon-2xl`,"3xl":`size-lt-icon-3xl`,"4xl":`size-lt-icon-4xl`},Yx=({node:e})=>{let{name:t,size:n,color:r,class:i}=e.props,a=sn(r);return(0,q.jsx)(`span`,{className:`contents`,"data-test":Q(e),style:a?{color:an(a)}:void 0,children:(0,q.jsx)(tl,{icon:t,className:x(Jx[n],i)})})},Xx=({node:e})=>(0,q.jsx)(Gb,{alt:e.props.alt,circular:e.props.circular,className:e.props.class??void 0,"data-test":Q(e),previewable:e.props.previewable,previewSrc:e.props.previewSrc,size:e.props.size,src:e.props.src,testId:Q(e)});function Zx({className:e=``,children:t,unstyled:n=!1,...r}){let{Link:i}=Rl();return(0,q.jsx)(i,{className:x(n?void 0:`text-lt-fg underline decoration-lt-border underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-lt-border`,e),...r,children:t})}var Qx=`text-lt-fg underline decoration-lt-border underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-lt-border`;function $x({affix:e,className:t}){return e.icon?(0,q.jsx)(tl,{className:x(`size-lt-icon-md shrink-0`,t),icon:e.icon}):(0,q.jsx)(`span`,{className:x(`shrink-0 text-sm text-lt-muted-fg`,t),children:e.text})}function eS({icon:e,isMenuItem:t,label:n,prefix:r,suffix:i}){return e?(0,q.jsx)(tl,{className:`size-lt-icon-md shrink-0`,icon:e}):t?(0,q.jsxs)(q.Fragment,{children:[r?(0,q.jsx)($x,{affix:r}):null,(0,q.jsx)(`span`,{children:n}),i?(0,q.jsx)($x,{affix:i,className:`ml-auto`}):null]}):r||i?(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 align-baseline`,children:[r?(0,q.jsx)($x,{affix:r}):null,(0,q.jsx)(`span`,{children:n}),i?(0,q.jsx)($x,{affix:i}):null]}):n}function tS(e,t,n){if(!(!t?.text&&!n?.text))return[t?.text,e,n?.text].filter(e=>!!e).join(` `)}var nS=({node:e})=>{let t=tu(),{class:n,icon:r,label:i,prefix:a,suffix:o,unstyled:s}=e.props,c=i??``,l=xu(e.props),u=t?$l:void 0,d=Q(e),f=(0,q.jsx)(eS,{icon:r,isMenuItem:t,label:c,prefix:a,suffix:o}),p=r?c:tS(c,a,o),m=({onClick:e,processing:t})=>(0,q.jsx)(`button`,{"aria-label":p,className:x(s?void 0:Qx,u,n),"data-test":d,disabled:t,onClick:e,type:`button`,children:f});return l.kind===`action`?(0,q.jsx)(vu,{action:l.action,children:m}):l.kind===`effects`||l.kind===`modal`?m({onClick:l.onClick,processing:!1}):(0,q.jsx)(Zx,{"aria-label":p,className:x(u,n),unstyled:s??!1,"data-test":d,href:l.kind===`navigate`?l.href:`#`,method:l.kind===`navigate`?l.method:`get`,tabIndex:e.props.tabIndex??void 0,children:f})},rS=({children:e,node:t})=>(0,q.jsx)(Kb,{className:t.props?.class??void 0,"data-test":Q(t),children:e});function iS({affix:e,className:t}){return e.icon?(0,q.jsx)(tl,{className:x(`size-lt-icon-md shrink-0`,t),icon:e.icon}):(0,q.jsx)(`span`,{className:x(`shrink-0 text-sm text-lt-muted-fg`,t),children:e.text})}function aS(e,t){return(e??[]).some(e=>e.props?.href===t||aS(e.schema,t))}var oS=({children:e,node:t})=>{let{icon:n,label:r,prefix:i,suffix:a}=t.props,o=r??``,{currentUrl:s}=Rl(),c=xu(t.props),l=Zl(`menu`,t),u={className:t.props.class??void 0,"data-test":l,icon:n?(0,q.jsx)(tl,{className:`size-lt-icon-md shrink-0`,icon:n}):void 0,label:o,prefix:i?(0,q.jsx)(iS,{affix:i}):void 0,suffix:a?(0,q.jsx)(iS,{affix:a}):void 0};return c.kind===`action`?(0,q.jsx)(vu,{action:c.action,children:({onClick:e,processing:t})=>(0,q.jsx)(Yb,{...u,disabled:t,onClick:e})}):c.kind===`effects`||c.kind===`modal`?(0,q.jsx)(Yb,{...u,onClick:c.onClick}):c.kind===`navigate`?(0,q.jsx)(Yb,{...u,active:s===c.href,href:c.href,method:c.method}):(0,q.jsx)(Yb,{...u,defaultOpen:aS(t.schema,s),children:e})},sS=({children:e,node:t})=>{let{t:n}=N(F),r=lu();if(!r)return null;let i=t.props.title??n(`common.dialog`,`Dialog`),a=t.props.description,o=t.props.closeLabel;return(0,q.jsx)(Od,{open:r.open,onOpenChange:r.onOpenChange,children:(0,q.jsxs)(Nd,{...a?{}:{"aria-describedby":void 0},className:t.props.class??void 0,"data-test":Q(t),onCloseAutoFocus:r.onExited,placement:t.props.side??`center`,width:t.props.width,height:t.props.height??void 0,children:[(0,q.jsx)(Pd,{closeLabel:o,description:a,title:i}),(0,q.jsx)(`div`,{className:`mt-6 space-y-6`,children:e})]})})},cS=({children:e,node:t})=>{let n=Gt(t.props.trigger),r=Q(t);return(0,q.jsxs)(Zt,{children:[(0,q.jsx)(Pe,{"aria-label":t.props.label??void 0,"data-test":r?`${r}-trigger`:void 0,type:`button`,children:(0,q.jsx)(Qe,{nodes:n})}),(0,q.jsx)(Jt,{align:t.props.align,className:t.props.class??void 0,side:t.props.side,children:e})]})},lS=({node:e})=>(0,q.jsx)(ex,{className:e.props.class??void 0,color:e.props.color,"data-test":Q(e),max:e.props.max,shape:e.props.shape,showValue:e.props.showValue,size:e.props.size,value:e.props.value}),uS=({node:e})=>(0,q.jsx)(`span`,{className:e.props.class??void 0,"data-test":Q(e),style:{display:`contents`},dangerouslySetInnerHTML:{__html:e.props.html}}),dS=({children:e,node:t})=>{let n=t.props.collapsible===!0,r=Gt(t.props.headerActions),i=Q(t),a=t.props.rememberState!==!1,o=gb(i);return(0,q.jsx)(tx,{...n&&o?{collapsed:!o.open,onCollapsedChange:e=>o.setOpen(!e)}:n&&a?{storageKey:`lattice:section:${i??`default`}`}:{},className:t.props.class??void 0,collapsible:n,"data-test":i,defaultCollapsed:t.props.collapsed===!0,description:t.props.description,headerActions:r.length>0?(0,q.jsx)(Qe,{nodes:r}):null,title:t.props.title,toggleProps:{"data-test":Xl(`section-toggle`,i)??`section-toggle-default`},tooltip:t.props.tooltip,children:e})},fS=({node:e})=>{let{emits:t,name:n,options:r}=e.props;function i(e){t&&window.dispatchEvent(new CustomEvent(t,{detail:{name:n,value:e}}))}return(0,q.jsx)(Fm,{"aria-label":e.props.label??void 0,className:e.props.class??void 0,"data-test":Q(e),defaultValue:e.props.value||void 0,name:n,onValueChange:i,options:r})},pS=({node:e})=>(0,q.jsx)(rx,{bleed:e.props.bleed,className:e.props.class??void 0,"data-test":Q(e),orientation:e.props.orientation});function mS(e,t){let n=e.detail?.target;return n==null||n===t}var hS=({children:e,node:t})=>{let n=t.props.collapsible,r=t.props.rememberState,i=Q(t),a=`lattice:sidebar:${i??`default`}`,{onNavigate:o}=Rl(),[s,c]=If(a,!1,n&&r),[l,u]=(0,B.useState)(!1);return Pl(d.toggleSidebar,e=>{mS(e,i)&&(window.matchMedia?.(`(min-width: 768px)`).matches??!0?n&&c():u(e=>!e))}),(0,B.useEffect)(()=>o(()=>u(!1)),[o]),(0,q.jsx)(ax,{backdropProps:{"data-test":`sidebar-backdrop`},className:t.props.class??void 0,collapsed:n&&s,"data-test":`sidebar`,onOpenChange:u,open:l,children:e})},gS=({children:e,node:t})=>(0,q.jsx)(ox,{className:t.props?.class??void 0,"data-test":Q(t),children:e}),_S=({children:e,node:t})=>(0,q.jsx)(pb,{align:t.props.align??void 0,className:t.props.class??void 0,"data-test":Q(t),direction:t.props.direction??void 0,float:t.props.float??void 0,gap:t.props.gap??void 0,height:t.props.height??void 0,justify:t.props.justify??void 0,sticky:t.props.sticky,width:t.props.width??void 0,children:e}),vS=({children:e,node:t})=>{let{t:n}=N(F),r=(0,B.useMemo)(()=>bS(t),[t]),i=r[0]?.value??``,a=t.props.queryKey,{visit:o}=Rl(),s=t.props.activeValue,c=t.props.defaultValue??i,[l,u]=(0,B.useState)(()=>s||(xS(a,r)??c)||i),d=(0,B.useCallback)(e=>{let t=r.find(t=>t.value===e);if(t){if(t.confirm?.required){o(CS(a,e),{preserveScroll:!0});return}u(e),SS(a,e)}},[a,r,o]);return(0,q.jsx)(dx,{"aria-label":n(`common.tabs`,`Tabs`),alignment:t.props.alignment,className:t.props.class??void 0,"data-test":Q(t),items:r.map(e=>({label:e.label,value:e.value})),onValueChange:d,orientation:t.props.orientation,sticky:t.props.sticky,value:l,children:e})},yS=({children:e,node:t})=>(0,q.jsx)(fx,{label:t.props.label,value:t.props.value,children:e});function bS(e){return(e.schema??[]).filter(e=>e.type===`tab`).map(e=>e.props).filter(e=>e.value!==``)}function xS(e,t){if(typeof window>`u`)return null;let n=new URLSearchParams(window.location.search).get(e);return!n||!t.some(e=>e.value===n)?null:n}function SS(e,t){if(typeof window>`u`)return;let n=new URL(window.location.href);n.searchParams.set(e,t),window.history.replaceState(window.history.state,``,`${n.pathname}${n.search}${n.hash}`)}function CS(e,t){if(typeof window>`u`)return``;let n=new URL(window.location.href);return n.searchParams.set(e,t),`${n.pathname}${n.search}${n.hash}`}var wS=({node:e})=>(0,q.jsx)(vx,{align:e.props.align??void 0,className:e.props.class??void 0,color:e.props.color,copyable:e.props.copyable,copyLabel:e.props.text,copyValue:e.props.text,"data-test":Q(e),size:e.props.size,children:e.props.text}),TS=({node:e})=>{let t=e.props.content,n=Gt(e.props.trigger),r=Q(e);return(0,q.jsx)(wb,{className:e.props.class??void 0,content:t?(0,q.jsx)(`div`,{dangerouslySetInnerHTML:{__html:t}}):null,trigger:n.length>0?(0,q.jsx)(Qe,{nodes:n}):null,triggerProps:{"data-test":r?`${r}-trigger`:void 0}})},ES=({children:e,node:t})=>(0,q.jsx)(yx,{className:t.props.class??void 0,"data-test":Q(t),sticky:t.props.sticky,children:e}),DS=`flex flex-wrap items-center justify-between gap-x-4 gap-y-1 px-lt-gutter py-3`,OS=`text-sm text-lt-muted-fg`,kS=`min-w-0 text-lt-fg`;function AS({children:e,description:t,disclosure:n,identity:r,label:i}){let a=Rb(),o=`${r??`entry`}-panel`,[s,c]=If(`lattice:entry:${r??`default`}`,!1,!1),l=(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,q.jsx)(`span`,{children:i}),t&&(0,q.jsx)(`span`,{className:`text-xs text-lt-muted-fg`,children:t})]});return n?(0,q.jsxs)(`div`,{"data-test":r,role:`listitem`,children:[(0,q.jsxs)(`button`,{"aria-controls":o,"aria-expanded":s,className:x(DS,`w-full cursor-pointer text-left transition-colors hover:bg-lt-muted`),onClick:c,type:`button`,children:[(0,q.jsx)(`span`,{className:OS,children:l}),(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:kS,children:e}),(0,q.jsx)(y,{name:`chevron-down`,className:x(`size-lt-icon-md shrink-0 text-lt-muted-fg transition-transform`,!s&&`-rotate-90`)})]})]}),s&&(0,q.jsx)(`div`,{className:`px-lt-gutter pt-2 pb-4`,id:o,children:n})]}):a===`list`?(0,q.jsxs)(`div`,{className:DS,"data-test":r,role:`listitem`,children:[(0,q.jsx)(`span`,{className:OS,children:l}),(0,q.jsx)(`span`,{className:kS,children:e})]}):(0,q.jsxs)(`div`,{className:DS,"data-test":r,children:[(0,q.jsx)(`dt`,{className:OS,children:l}),(0,q.jsx)(`dd`,{className:kS,children:e})]})}function jS(e,t){return(t.schema??[]).length>0?e:void 0}var MS={components:{accordion:V(Cx),avatar:V(wx),badge:V(Tx),breadcrumbs:V(Ex),button:V(Dx),callouts:V(Rx),card:V(zx),chart:V(Bx),"code-block":V(Vx),collapsible:V(Hx),"description-list":V(Ux),dropdown:V(Wx),"entry.badge":V(({children:e,node:t})=>{let{value:n,color:r,label:i,description:a}=t.props,o=n==null||n===``?null:String(n);return(0,q.jsx)(AS,{description:a,disclosure:jS(e,t),identity:Q(t),label:i,children:o===null?(0,q.jsx)(`span`,{className:`text-lt-muted-fg`,children:`—`}):(0,q.jsx)(My,{color:r,children:o})})}),"entry.boolean":V(({children:e,node:t})=>{let{value:n,trueIcon:r,falseIcon:i,label:a,description:o}=t.props,{t:s}=N(`lattice`),c=ey(n);return(0,q.jsx)(AS,{description:o,disclosure:jS(e,t),identity:Q(t),label:a,children:(0,q.jsx)(`span`,{"aria-label":c?s(`common.yes`,`Yes`):s(`common.no`,`No`),role:`img`,children:(0,q.jsx)(y,{name:c?r:i,className:x(`size-lt-icon-md`,c?`text-lt-success`:`text-lt-muted-fg`)})})})}),"entry.component":V(({children:e,node:t})=>(0,q.jsx)(AS,{description:t.props.description,disclosure:jS(e,t),identity:Q(t),label:t.props.label,children:(0,q.jsx)(Qe,{nodes:Gt(t.props.value)})})),"entry.date":V(({children:e,node:t})=>{let{value:n,format:r,label:i,description:a}=t.props,o=bx();return(0,q.jsx)(AS,{description:a,disclosure:jS(e,t),identity:Q(t),label:i,children:(0,q.jsx)(`span`,{children:n==null?`—`:Sx(n,r,o)})})}),"entry.text":V(({children:e,node:t})=>{let{value:n,placeholder:r,copyable:i,label:a,description:o}=t.props,s=n==null||n===``?null:String(n);return(0,q.jsx)(AS,{description:o,disclosure:jS(e,t),identity:Q(t),label:a,children:s===null?(0,q.jsx)(`span`,{className:`text-lt-muted-fg`,children:r??`—`}):i?(0,q.jsx)(qh,{label:s,value:s,children:(0,q.jsx)(`span`,{children:s})}):(0,q.jsx)(`span`,{children:s})})}),"floating-panel":V(Gx),grid:V(Kx),heading:V(qx),icon:V(Yx),image:V(Xx),link:V(nS),menu:V(rS),"menu-item":V(oS),modal:V(sS),popover:V(cS),progress:V(lS),"raw-block":V(uS),section:V(dS),"segmented-control":V(fS),separator:V(pS),sidebar:V(hS),"sidebar.footer":V(gS),stack:V(_S),tab:V(yS),tabs:V(vS),text:V(wS),tooltip:V(TS),topbar:V(ES)},i18n:{namespace:F},name:`lattice/ui`},NS=Object.defineProperty,PS=(e,t)=>NS(e,`name`,{value:t,configurable:!0});function FS(e){let t=e+`CollectionProvider`,[n,r]=Je(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=PS(e=>{let{scope:t,children:n}=e,r=B.useRef(null),a=B.useRef(new Map).current;return(0,q.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=j(s),l=B.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=a(s,n),o=M(t,i.collectionRef);return(0,q.jsx)(c,{ref:o,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=j(u),p=B.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=B.useRef(null),s=M(t,o),c=a(u,n);return B.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,q.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return B.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return PS(m,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},m,r]}PS(FS,`createCollection`);var IS=new WeakMap,LS=class e extends Map{static{PS(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],IS.set(this,!0)}set(e,t){return IS.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=BS(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=RS(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=RS(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return RS(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function RS(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=zS(e,t);return n===-1?void 0:e[n]}PS(RS,`at`);function zS(e,t){let n=e.length,r=BS(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}PS(zS,`toSafeIndex`);function BS(e){return e!==e||e===0?0:Math.trunc(e)}PS(BS,`toSafeInteger`);function VS(e){let t=e+`CollectionProvider`,[n,r]=Je(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new LS,setItemMap:PS(()=>void 0,`setItemMap`)}),o=PS(({state:e,...t})=>e?(0,q.jsx)(c,{...t,state:e}):(0,q.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=PS(e=>{let t=h();return(0,q.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=PS(e=>{let{scope:t,children:n,state:r}=e,a=B.useRef(null),[o,s]=B.useState(null),c=M(a,s),[l,u]=r;return B.useEffect(()=>{if(!o)return;let e=GS(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,q.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=j(l),d=B.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=a(l,n),o=M(t,i.collectionRef);return(0,q.jsx)(u,{ref:o,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=j(f),m=B.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=B.useRef(null),[s,c]=B.useState(null),l=M(t,o,c),{setItemMap:u}=a(f,n),d=B.useRef(i);HS(d.current,i)||(d.current=i);let m=d.current;return B.useEffect(()=>{let e=m;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(WS):(t.set(s,{...e,element:s}),t.toSorted(WS)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new LS(e)))}},[s,m,u]),(0,q.jsx)(p,{"data-radix-collection-item":``,ref:l,children:r})});m.displayName=f;function h(){return B.useState(new LS)}PS(h,`useInitCollection`);function g(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return PS(g,`useCollection`),[{Provider:o,Slot:d,ItemSlot:m},{createCollectionScope:r,useCollection:g,useInitCollection:h}]}PS(VS,`createCollection`);function HS(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}PS(HS,`shallowEqual`);function US(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}PS(US,`isElementPreceding`);function WS(e,t){return!e[1].element||!t[1].element?0:US(e[1].element,t[1].element)?-1:1}PS(WS,`sortByDocumentPosition`);function GS(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}PS(GS,`getChildListObserver`);var KS=Object.defineProperty,qS=(e,t)=>KS(e,`name`,{value:t,configurable:!0}),JS=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),YS=B.forwardRef(qS(function(e,t){return(0,q.jsx)(st.span,{...e,ref:t,style:{...JS,...e.style}})},`VisuallyHidden`)),XS=Object.defineProperty,ZS=(e,t)=>XS(e,`name`,{value:t,configurable:!0}),QS=`ToastProvider`,[$S,eC,tC]=FS(`Toast`),[nC,rC]=Je(`Toast`,[tC]),[iC,aC]=nC(QS),oC=ZS(e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,announcerContainer:o,children:s}=e,[c,l]=B.useState(null),[u,d]=B.useState(0),f=B.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${QS}\`. Expected non-empty \`string\`.`),(0,q.jsx)($S.Provider,{scope:t,children:(0,q.jsx)(iC,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:u,viewport:c,onViewportChange:l,onToastAdd:B.useCallback(()=>d(e=>e+1),[]),onToastRemove:B.useCallback(()=>d(e=>e-1),[]),isClosePausedRef:f,announcerContainer:o,children:s})})},`ToastProvider`),sC=`ToastViewport`,cC=[`F8`],lC=`toast.viewportPause`,uC=`toast.viewportResume`,dC=B.forwardRef(ZS(function(e,t){let{__scopeToast:n,hotkey:r=cC,label:i=`Notifications ({hotkey})`,...a}=e,o=aC(sC,n),s=eC(n),c=B.useRef(null),l=B.useRef(null),u=B.useRef(null),d=B.useRef(null),f=M(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;B.useEffect(()=>{let e=ZS(e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()},`handleKeyDown`);return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),B.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=ZS(()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(lC);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},`handlePause`),r=ZS(()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(uC);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},`handleResume`),i=ZS(t=>{e.contains(t.relatedTarget)||r()},`handleFocusOutResume`),a=ZS(()=>{e.contains(document.activeElement)||r()},`handlePointerLeaveResume`);return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=B.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...NC(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return B.useEffect(()=>{let e=d.current;if(e){let t=ZS(t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);PC(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}},`handleKeyDown`);return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,q.jsxs)(Lt,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,q.jsx)(pC,{ref:l,onFocusFromOutsideViewport:()=>{PC(h({tabbingDirection:`forwards`}))}}),(0,q.jsx)($S.Slot,{scope:n,children:(0,q.jsx)(st.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,q.jsx)(pC,{ref:u,onFocusFromOutsideViewport:()=>{PC(h({tabbingDirection:`backwards`}))}})]})},`ToastViewport`)),fC=`ToastFocusProxy`,pC=B.forwardRef(ZS(function(e,t){let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=aC(fC,n);return(0,q.jsx)(YS,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})},`ToastFocusProxy`)),mC=`Toast`,hC=`toast.swipeStart`,gC=`toast.swipeMove`,_C=`toast.swipeCancel`,vC=`toast.swipeEnd`,yC=B.forwardRef(ZS(function(e,t){let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=Et({prop:r,defaultProp:i??!0,onChange:a,caller:mC});return(0,q.jsx)(gt,{present:n||s,children:(0,q.jsx)(SC,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:rt(e.onPause),onResume:rt(e.onResume),onSwipeStart:Ut(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:Ut(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:Ut(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:Ut(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})},`Toast`)),[bC,xC]=nC(mC,{onClose(){}}),SC=B.forwardRef(ZS(function(e,t){let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=aC(mC,n),g=eC(n),[_,v]=B.useState(null),y=M(t,v),b=B.useRef(null),x=B.useRef(null),S=i||h.duration,C=B.useRef(0),w=B.useRef(S),T=B.useRef(0),{onToastAdd:E,onToastRemove:D}=h,O=rt(()=>{_?.contains(document.activeElement)&&h.viewport?.focus(),o()}),k=B.useCallback(e=>{!e||e===1/0||(window.clearTimeout(T.current),C.current=new Date().getTime(),T.current=window.setTimeout(O,e))},[O]);B.useEffect(()=>{let e=h.viewport;if(e){let t=ZS(()=>{k(w.current),l?.()},`handleResume`),n=ZS(()=>{let e=new Date().getTime()-C.current;w.current-=e,window.clearTimeout(T.current),c?.()},`handlePause`);return e.addEventListener(lC,n),e.addEventListener(uC,t),()=>{e.removeEventListener(lC,n),e.removeEventListener(uC,t)}}},[h.viewport,S,c,l,k]),B.useEffect(()=>{a&&!h.isClosePausedRef.current&&k(S)},[a,S,h.isClosePausedRef,k]),B.useEffect(()=>()=>{window.clearTimeout(T.current)},[]),B.useEffect(()=>(E(),()=>D()),[E,D]);let ee=B.useMemo(()=>_?OC(_):null,[_]);return h.viewport?(0,q.jsxs)(q.Fragment,{children:[ee&&(0,q.jsx)(CC,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:ee}),(0,q.jsx)(bC,{scope:n,onClose:O,children:rc.createPortal((0,q.jsx)($S.ItemSlot,{scope:n,children:(0,q.jsx)(Ct,{asChild:!0,onEscapeKeyDown:Ut(s,e=>{g().some(t=>t.ref.current?.contains(e.target))||O()}),children:(0,q.jsx)(st.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:y,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:Ut(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||O())}),onPointerDown:Ut(e.onPointerDown,e=>{e.button===0&&(b.current={x:e.clientX,y:e.clientY})}),onPointerMove:Ut(e.onPointerMove,e=>{if(!b.current)return;let t=e.clientX-b.current.x,n=e.clientY-b.current.y,r=!!x.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(x.current=l,kC(gC,d,f,{discrete:!1})):AC(l,h.swipeDirection,c)?(x.current=l,kC(hC,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(b.current=null)}),onPointerUp:Ut(e.onPointerUp,e=>{let t=x.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),x.current=null,b.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};AC(t,h.swipeDirection,h.swipeThreshold)?kC(vC,p,r,{discrete:!0}):kC(_C,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null},`ToastImpl`)),CC=ZS(e=>{let{__scopeToast:t,children:n,...r}=e,i=aC(mC,t),[a,o]=B.useState(!1),[s,c]=B.useState(!1);return jC(()=>o(!0)),B.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,q.jsx)(Xe,{asChild:!0,container:i.announcerContainer||void 0,children:(0,q.jsx)(YS,{...r,children:a&&(0,q.jsxs)(q.Fragment,{children:[i.label,` `,n]})})})},`ToastAnnounce`),wC=B.forwardRef(ZS(function(e,t){let{__scopeToast:n,...r}=e;return(0,q.jsx)(st.div,{...r,ref:t})},`ToastTitle`)),TC=`ToastClose`,EC=B.forwardRef(ZS(function(e,t){let{__scopeToast:n,...r}=e,i=xC(TC,n);return(0,q.jsx)(DC,{asChild:!0,children:(0,q.jsx)(st.button,{type:`button`,...r,ref:t,onClick:Ut(e.onClick,i.onClose)})})},`ToastClose`)),DC=B.forwardRef(ZS(function(e,t){let{__scopeToast:n,altText:r,...i}=e;return(0,q.jsx)(st.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})},`ToastAnnounceExclude`));function OC(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),MC(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n)if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...OC(e))}}),t}ZS(OC,`getAnnounceTextContent`);function kC(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Nt(i,a):i.dispatchEvent(a)}ZS(kC,`handleAndDispatchCustomEvent`);var AC=ZS((e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n},`isDeltaInDirection`);function jC(e=()=>{}){let t=rt(e);ut(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}ZS(jC,`useNextFrame`);function MC(e){return e.nodeType===e.ELEMENT_NODE}ZS(MC,`isHTMLElement`);function NC(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:ZS(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}ZS(NC,`getTabbableCandidates`);function PC(e){let t=document.activeElement;return e.some(e=>e===t||(e.focus(),document.activeElement!==t))}ZS(PC,`focusFirst`);var FC=oC,IC=dC,LC=yC,RC=wC,zC=EC,BC=`flex min-w-0 flex-1 flex-col gap-2`,VC=`text-sm text-lt-fg`,HC=`flex flex-wrap gap-2`,UC=`shrink-0 rounded-lt-sm p-1 text-lt-muted-fg transition-colors hover:bg-lt-muted hover:text-lt-fg`;function WC(e,t){return x(`flex items-start gap-3 rounded-lt border border-l-4 border-lt-border bg-lt-popover p-4 text-lt-popover-fg shadow-lt-lg`,Sb[e].accent,t)}function GC({variant:e,message:t,action:n,dismissible:r=!0,dismissLabel:i=`Dismiss`,persistent:a=!1,duration:o,className:s,...c}){return(0,q.jsxs)(LC,{className:x(WC(e),`data-[state=open]:animate-lt-toast-in data-[state=closed]:animate-lt-toast-out`,`data-[swipe=move]:translate-y-[var(--radix-toast-swipe-move-y)] data-[swipe=cancel]:translate-y-0 data-[swipe=cancel]:transition-transform`,s),"data-test":`toast-${e}`,duration:a?1/0:o,...c,children:[Sb[e].icon,(0,q.jsxs)(`div`,{className:BC,children:[(0,q.jsx)(RC,{className:VC,children:t}),n?(0,q.jsx)(`div`,{className:HC,children:n}):null]}),r?(0,q.jsx)(zC,{"aria-label":i,className:UC,"data-test":`toast-dismiss`,children:(0,q.jsx)(y,{name:`x`,className:`size-lt-icon-md`})}):null]})}var KC=0;function qC({duration:e=4e3}){let{t}=N(F),[n,r]=(0,B.useState)([]);function i(e){r(t=>t.filter(t=>t.id!==e))}return(0,B.useEffect)(()=>Nx(e=>{r(t=>[...t,{...e,id:KC++}])}),[]),(0,q.jsxs)(FC,{duration:e,swipeDirection:`down`,children:[n.map(n=>(0,q.jsx)(GC,{action:n.action?(0,q.jsx)(Xt,{node:n.action}):void 0,dismissLabel:t(`common.dismiss`,`Dismiss`),dismissible:n.dismissible,duration:n.duration??e,message:Gg(n.message,t),onOpenChange:e=>{e||i(n.id)},persistent:n.persistent,variant:n.variant},n.id)),(0,q.jsx)(IC,{className:`fixed inset-x-0 bottom-0 z-lt-toast mx-auto flex w-full max-w-sm flex-col gap-2 p-4 outline-none`})]})}var JC=xn(MS,wg,hf,Sg,Og,tb,$g,n_,Qc),YC=[`light`,`dark`,`system`],{subscribe:XC,notify:ZC}=l(),QC=`system`,$C=`system`;function ew(e){tw(e)&&($C=e)}function tw(e){return YC.some(t=>t===e)}var nw=()=>typeof window>`u`?!1:window.matchMedia(`(prefers-color-scheme: dark)`).matches,rw=(e,t,n=365)=>{if(typeof document>`u`)return;let r=n*24*60*60;document.cookie=`${e}=${t};path=/;max-age=${r};SameSite=Lax`},iw=()=>{if(typeof window>`u`)return`system`;let e=localStorage.getItem(`appearance`);return tw(e)?e:`system`},aw=e=>e===`dark`||e===`system`&&nw(),ow=()=>nw()?`dark`:`light`,sw=e=>{if(typeof document>`u`)return;let t=aw(e);document.documentElement.classList.toggle(`dark`,t),document.documentElement.style.colorScheme=t?`dark`:`light`},cw=()=>typeof window>`u`?null:window.matchMedia(`(prefers-color-scheme: dark)`),lw=()=>{sw(QC),ZC()};function uw(e){QC=e,localStorage.setItem(`appearance`,e),rw(`appearance`,e),sw(e),ZC()}function dw(){typeof window>`u`||(localStorage.getItem(`appearance`)||(localStorage.setItem(`appearance`,`system`),rw(`appearance`,`system`)),QC=iw(),sw(QC),cw()?.addEventListener(`change`,lw))}function fw(){let e=(0,B.useSyncExternalStore)(XC,()=>QC,()=>$C),t=(0,B.useSyncExternalStore)(XC,ow,()=>`light`);return{appearance:e,resolvedAppearance:e===`system`?t:e,updateAppearance:uw}}function pw({children:e}){let t=bc().props.lattice.layout;return t?(0,q.jsx)(Eg,{outlet:e,children:(0,q.jsx)(Qe,{nodes:t.schema})}):(0,q.jsx)(q.Fragment,{children:e})}var mw=(0,B.lazy)(()=>dn(()=>import(`./subscriptions-B37pUVGa.js`),__vite__mapDeps([24,1,2,5,10,4,11,19]),import.meta.url)),hw=class extends B.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(){console.warn(`[lattice] Real-time listeners are declared but Echo is unavailable. Install @laravel/echo-react and call configureEcho().`)}render(){return this.state.failed?null:this.props.children}};function gw({listeners:e}){return e.length===0?null:(0,q.jsx)(hw,{children:(0,q.jsx)(B.Suspense,{fallback:null,children:(0,q.jsx)(mw,{listeners:e})})})}var _w={full:`max-w-none`,xl:`max-w-6xl`,lg:`max-w-4xl`,md:`max-w-2xl`,sm:`max-w-md`};function vw({lattice:e}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(kc,{title:e.title??void 0}),(0,q.jsx)(gw,{listeners:e.listeners}),(0,q.jsx)(`div`,{"data-test":`lattice-page-container`,"data-page-width":e.width,className:x(`mx-auto w-full px-4 py-6 sm:px-6 lg:px-8`,_w[e.width]),children:(0,q.jsx)(Qe,{nodes:e.schema})})]})}var yw=`lattice/page`;function bw(e){return t=>{if(t===`lattice/page`)return{default:vw};let n=e[`./Pages/${t}.tsx`]??e[`./pages/${t}.tsx`];if(n)return n();throw Error(`Page not found: ${t}`)}}function xw({defaultLayout:e}={}){return(t,n)=>t===`lattice/page`?n.props.lattice?.layout?pw:null:e?.(t,n)??null}function Sw(e,t){return{...t,headers:Au(``,t.headers)}}var Cw=!1;function ww(){Cw||(Cw=!0,bo.onRequest(e=>{let t=e.headers?.[Su];return e.headers&&typeof t==`string`&&t!==``&&(e.headers[Su]=wu(t)),e}))}function Tw({action:e,children:t,options:n}){let{processing:r,requestSubmit:i}=ff(e,n);return t({onClick:i,processing:r})}function Ew({children:e}){return(0,q.jsx)(gu,{render:e=>(0,q.jsx)(Tw,{action:e.action,options:e.options,children:e.children}),children:e})}function Dw(){let e=ou();(0,B.useEffect)(()=>K.on(`flash`,t=>{let n=iu(t.detail?.flash?.latticeEffects);n.length>0&&e(n)}),[e])}function Ow({onAppearanceChange:e}){return Pl(d.appearanceChange,t=>{let n=t.detail?.value;tw(n)&&e?.(n)},{enabled:!!e}),null}var kw={href:``};function Aw({children:e,initialUrl:t,registry:n,sprite:r=kw,toaster:i=!0}){Dw(),Zc();let a=Yc(t);return(0,q.jsx)(h,{registry:n,children:(0,q.jsx)(Ll,{adapter:a,children:(0,q.jsx)(Ew,{children:(0,q.jsx)(D,{sprite:r,children:(0,q.jsxs)(pu,{children:[e,(0,q.jsx)(Ow,{onAppearanceChange:uw}),i?(0,q.jsx)(qC,{}):null]})})})})})}function jw(e,t){let n=new Set([...e.namespaces??[`lattice`,`lattice-ui`],...t.map(e=>e.namespace)]);return{...e,namespaces:[...n]}}function Mw({ready:e,children:t}){let[n,r]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{let t=!0,n=()=>{t&&r(!0)};return e.then(n,n),()=>{t=!1}},[e]),n?t:null}function Nw({registry:e,plugins:t,sprite:n,pages:r={},defaultLayout:i,strictMode:o=!0,i18n:s,boot:l,wrap:u,...d}={}){let f=e??JC,p=t&&t.length>0?Sn(f,...t):f;m(p),Ou(c),ww();let h=s!==!1,g=t?.flatMap(e=>e.i18n?[e.i18n]:[])??[],_=h?jw(s??{},g):{},v=d.defaults?.visitOptions,y=h?{...d.defaults,visitOptions:(e,t)=>Sw(e,v?.(e,t)??t)}:d.defaults,b=yc({...d,defaults:y,strictMode:o,resolve:bw(r),layout:xw({defaultLayout:i}),withApp:(e,{ssr:t,page:r})=>{let i=[],o=r.props.lattice,s=!1;if(a(o)&&ew(o.appearance),!t){s=document.getElementById(d.id??`app`)?.hasAttribute(`data-server-rendered`)===!0,a(o)&&a(o.urls)&&typeof o.urls.refreshRef==`string`&&Ru(o.urls.refreshRef),h&&Ul(r.props)!==void 0&&i.push(dn(()=>Promise.resolve().then(()=>Wl).then(e=>e.configureI18nFromPageProps(r.props,_)),void 0,import.meta.url));let e=l?.({page:r});e&&i.push(e)}let c=(0,q.jsxs)(q.Fragment,{children:[e,h?(0,q.jsx)(zl,{}):null]}),f=(0,q.jsx)(Aw,{initialUrl:r.url,registry:p,sprite:n,children:u?u(c):c});return i.length===0?f:s?(P(Promise.all(i)),f):(0,q.jsx)(Mw,{ready:Promise.all(i),children:f})}});return dw(),b}m(JC);function Pw({registry:e=JC,...t}){return(0,q.jsx)(Aw,{...t,registry:e})}function Fw(e){if(typeof e!=`object`||!e)return{};let{data:t}=e;return typeof t==`object`&&t&&!Array.isArray(t)?t:{}}async function Iw(e,t,n){let r=e.props.endpoint,i={data:{},ok:!0,status:0};return r&&(i.ok=await Xu(async()=>{let n=await Vu(r,{body:JSON.stringify(t),method:e.props.method??`post`,ref:e.props.ref??``,throwOnError:!1});return i.status=n.status,i.data=Fw(await n.clone().json().catch(()=>({}))),n},n)),i}function Lw(){let e=ou();return(0,B.useCallback)((t,n)=>Iw(t,n,e),[e])}var Rw=`form.rich-editor`;function zw(e,t){let n=[];for(let r of e){let e=t[r.type];e&&n.push({type:r.type,props:r.props,definition:e,group:e.group??r.type})}return n}var Bw={blockquote:!1,bold:!1,bulletList:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,italic:!1,link:!1,listItem:!1,orderedList:!1,strike:!1,underline:!1};function Vw(e){return e.reduce((e,t)=>({...e,...t.definition.starterKit?.(t.props)}),{...Bw})}function Hw(e){return e.flatMap(e=>e.definition.extensions?.(e.props)??[])}function Uw(e){return e.flatMap(e=>(e.definition.commands?.(e.props)??[]).map(t=>({...t,group:e.group})))}function Ww(e){let t=[],n=null;for(let r of e){let e=r.definition.toolbar?.(r.props)??[];e.length!==0&&(n!==null&&n!==r.group&&t.push(`separator`),t.push(...e),n=r.group)}return t}function Gw({active:e=!1,icon:t,label:n,testId:r,...i}){return(0,q.jsx)(Jf,{size:`sm`,icon:t,label:n,title:n,active:e,"data-test":r,...i,onMouseDown:e=>{e.preventDefault(),i.onMouseDown?.(e)}})}var Kw=class e extends ot{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):ot.near(r)}content(){return Rt.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new qw(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Yw(e)||!Xw(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!Ge.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};Kw.prototype.visible=!1,Kw.findFrom=Kw.findGapCursorFrom,ot.jsonID(`gapcursor`,Kw);var qw=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Kw.valid(t)?new Kw(t):ot.near(t)}};function Jw(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Yw(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||Jw(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Xw(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||Jw(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Zw(){return new ke({props:{decorations:nT,createSelectionBetween(e,t,n){return t.pos==n.pos&&Kw.valid(n)?new Kw(n):null},handleClick:eT,handleKeyDown:Qw,handleDOMEvents:{beforeinput:tT}}})}var Qw=xe({ArrowLeft:$w(`horiz`,-1),ArrowRight:$w(`horiz`,1),ArrowUp:$w(`vert`,-1),ArrowDown:$w(`vert`,1)});function $w(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof kt){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=Kw.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new Kw(c))),!0):!1}}function eT(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Kw.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Ge.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Kw(r))),!0)}function tT(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof Kw))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=Mt.empty;for(let e=r.length-1;e>=0;e--)i=Mt.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new Rt(i,0,0));return a.setSelection(kt.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function nT(e){if(!(e.selection instanceof Kw))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,Ve.create(e.doc,[Ue.widget(e.selection.head,t,{key:`gapcursor`})])}var rT=(e,t)=>{let n=t.view.domAtPos(e).node,r=n.nodeType===Node.ELEMENT_NODE?n:n.parentElement;return r?r.offsetParent!==null:!1},iT=(e,t,n)=>{for(let r=e.depth;r>0;--r){let i=e.node(r),a=t(i),o=rT(e.start(r),n);if(a&&o)return{pos:r>0?e.before(r):0,start:e.start(r),depth:r,node:i}}},aT=(e,t)=>{let{state:n,view:r,extensionManager:i}=e,{schema:a,selection:o}=n,{empty:s,$anchor:c}=o,l=!!i.extensions.find(e=>e.name===`gapCursor`);if(!s||c.parent.type!==a.nodes.detailsSummary||!l||t===`right`&&c.parentOffset!==c.parent.nodeSize-2)return!1;let u=Yt(e=>e.type===a.nodes.details)(o);if(!u)return!1;let d=qe(u.node,e=>e.type===a.nodes.detailsContent);if(!d.length||rT(u.start+d[0].pos+1,e))return!1;let f=n.doc.resolve(u.pos+u.node.nodeSize),p=Kw.findFrom(f,1,!1);if(!p)return!1;let{tr:m}=n,h=new Kw(p);return m.setSelection(h),m.scrollIntoView(),r.dispatch(m),!0},oT=St.create({name:`details`,content:`detailsSummary detailsContent`,group:`block`,defining:!0,isolating:!0,allowGapCursor:!1,addOptions(){return{persist:!1,openClassName:`is-open`,HTMLAttributes:{},renderToggleButton:({element:e,isOpen:t})=>{e.setAttribute(`aria-label`,t?`Collapse details content`:`Expand details content`)}}},addAttributes(){return this.options.persist?{open:{default:!1,parseHTML:e=>e.hasAttribute(`open`),renderHTML:({open:e})=>e?{open:``}:{}}}:[]},parseHTML(){return[{tag:`details`}]},renderHTML({HTMLAttributes:e}){return[`details`,Le(this.options.HTMLAttributes,e),0]},...Tt({nodeName:`details`,content:`block`}),addNodeView(){return({editor:e,getPos:t,node:n,HTMLAttributes:r})=>{let i=document.createElement(`div`),a=Le(this.options.HTMLAttributes,r,{"data-type":this.name});Object.entries(a).forEach(([e,t])=>i.setAttribute(e,t));let o=document.createElement(`button`);o.type=`button`;let s=e=>{this.options.renderToggleButton({element:o,...e})};i.append(o);let c=document.createElement(`div`);i.append(c);let l=e=>{let{setToValue:t,node:r=n}=e||{};if(t!==void 0)if(t){if(i.classList.contains(this.options.openClassName))return;i.classList.add(this.options.openClassName)}else{if(!i.classList.contains(this.options.openClassName))return;i.classList.remove(this.options.openClassName)}else i.classList.toggle(this.options.openClassName);let a=i.classList.contains(this.options.openClassName);s({isOpen:a,node:r});let o=new Event(`toggleDetailsContent`);c.querySelector(`:scope > div[data-type="detailsContent"]`)?.dispatchEvent(o)};return s({isOpen:!!n.attrs.open,node:n}),n.attrs.open&&setTimeout(()=>l()),o.addEventListener(`click`,()=>{if(l(),!this.options.persist){e.commands.focus(void 0,{scrollIntoView:!1});return}if(e.isEditable&&typeof t==`function`){let{from:n,to:r}=e.state.selection;e.chain().command(({tr:e})=>{let n=t();if(typeof n!=`number`)return!1;let r=e.doc.nodeAt(n);return r?.type===this.type&&(e.setNodeMarkup(n,void 0,{open:!r.attrs.open}),!0)}).setTextSelection({from:n,to:r}).focus(void 0,{scrollIntoView:!1}).run()}}),{dom:i,contentDOM:c,ignoreMutation(e){if(e.type===`selection`)return!1;let t=e.target,n=i.contains(t);return o.contains(t)||!n||i===t},update:e=>e.type===this.type&&(e.attrs.open===void 0?s({isOpen:i.classList.contains(this.options.openClassName),node:e}):l({setToValue:e.attrs.open,node:e}),!0)}}},addCommands(){return{setDetails:()=>({state:e,chain:t})=>{let{schema:n,selection:r}=e,{$from:i,$to:a}=r,o=i.blockRange(a);if(!o)return!1;let s=e.doc.slice(o.start,o.end);if(!n.nodes.detailsContent.contentMatch.matchFragment(s.content))return!1;let c=s.toJSON()?.content||[];return t().insertContentAt({from:o.start,to:o.end},{type:this.name,content:[{type:`detailsSummary`},{type:`detailsContent`,content:c}]}).setTextSelection(o.start+2).run()},unsetDetails:()=>({state:e,chain:t})=>{let{selection:n,schema:r}=e,i=Yt(e=>e.type===this.type)(n);if(!i)return!1;let a=qe(i.node,e=>e.type===r.nodes.detailsSummary),o=qe(i.node,e=>e.type===r.nodes.detailsContent);if(!a.length||!o.length)return!1;let s=a[0],c=o[0],l=i.pos,u=e.doc.resolve(l),d={from:l,to:l+i.node.nodeSize},f=c.node.content.toJSON()||[],p=[u.parent.type.contentMatch.defaultType?.create(null,s.node.content).toJSON(),...f];return t().insertContentAt(d,p).setTextSelection(l+1).run()}}},addKeyboardShortcuts(){return{Backspace:()=>{let{schema:e,selection:t}=this.editor.state,{empty:n,$anchor:r}=t;return!n||r.parent.type!==e.nodes.detailsSummary?!1:r.parentOffset===0?this.editor.commands.unsetDetails():this.editor.commands.command(({tr:e})=>{let t=r.pos-1,n=r.pos;return e.delete(t,n),!0})},Enter:({editor:e})=>{let{state:t,view:n}=e,{schema:r,selection:i}=t,{$head:a}=i;if(a.parent.type!==r.nodes.detailsSummary)return!1;let o=rT(a.after()+1,e),s=o?t.doc.nodeAt(a.after()):a.node(-2);if(!s)return!1;let c=o?0:a.indexAfter(-1),l=ft(s.contentMatchAt(c));if(!l||!s.canReplaceWith(c,c,l))return!1;let u=l.createAndFill();if(!u)return!1;let d=o?a.after()+1:a.after(-1),f=t.tr.replaceWith(d,d,u),p=f.doc.resolve(d),m=ot.near(p,1);return f.setSelection(m),f.scrollIntoView(),n.dispatch(f),!0},ArrowRight:({editor:e})=>aT(e,`right`),ArrowDown:({editor:e})=>aT(e,`down`)}},addProseMirrorPlugins(){return[new ke({key:new z(`detailsSelection`),appendTransaction:(e,t,n)=>{let{editor:r,type:i}=this;if(r.view.composing||!e.some(e=>e.selectionSet)||!t.selection.empty||!n.selection.empty||!we(n,i.name))return;let{$from:a}=n.selection;if(rT(a.pos,r))return;let o=iT(a,e=>e.type===i,r);if(!o)return;let s=qe(o.node,e=>e.type===n.schema.nodes.detailsSummary);if(!s.length)return;let c=s[0],l=(t.selection.from<n.selection.from?`forward`:`backward`)==`forward`?o.start+c.pos:o.pos+c.pos+c.node.nodeSize,u=kt.create(n.doc,l);return n.tr.setSelection(u)}})]}}),sT=St.create({name:`detailsContent`,content:`block+`,defining:!0,selectable:!1,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({HTMLAttributes:e}){return[`div`,Le(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`),n=Le(this.options.HTMLAttributes,e,{"data-type":this.name,hidden:`hidden`});return Object.entries(n).forEach(([e,n])=>t.setAttribute(e,n)),t.addEventListener(`toggleDetailsContent`,()=>{t.toggleAttribute(`hidden`)}),{dom:t,contentDOM:t,ignoreMutation(e){return e.type===`selection`?!1:!t.contains(e.target)||t===e.target},update:e=>e.type===this.type}}},addKeyboardShortcuts(){return{Enter:({editor:e})=>{let{state:t,view:n}=e,{selection:r}=t,{$from:i,empty:a}=r,o=Yt(e=>e.type===this.type)(r);if(!a||!o||!o.node.childCount)return!1;let s=i.index(o.depth),{childCount:c}=o.node;if(c!==s+1)return!1;let l=o.node.type.contentMatch.defaultType?.createAndFill();if(!l)return!1;let u=t.doc.resolve(o.pos+1),d=c-1,f=o.node.child(d),p=u.posAtIndex(d,o.depth);if(!f.eq(l))return!1;let m=i.node(-3);if(!m)return!1;let h=i.indexAfter(-3),g=ft(m.contentMatchAt(h));if(!g||!m.canReplaceWith(h,h,g))return!1;let _=g.createAndFill();if(!_)return!1;let{tr:v}=t,y=i.after(-2);v.replaceWith(y,y,_);let b=v.doc.resolve(y),x=ot.near(b,1);v.setSelection(x);let S=p,C=p+f.nodeSize;return v.delete(S,C),v.scrollIntoView(),n.dispatch(v),!0}}},...Tt({nodeName:`detailsContent`})}),cT=St.create({name:`detailsSummary`,content:`text*`,defining:!0,selectable:!1,isolating:!0,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`summary`}]},renderHTML({HTMLAttributes:e}){return[`summary`,Le(this.options.HTMLAttributes,e),0]},...Tt({nodeName:`detailsSummary`,content:`inline`})}),lT=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,uT=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,dT=$e.create({name:`highlight`,addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute(`data-color`)||bt(e,`background-color`)||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:`mark`}]},renderHTML({HTMLAttributes:e}){return[`mark`,Le(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark(`highlight`,t.parseInline(e.tokens||[])),markdownTokenizer:{name:`highlight`,level:`inline`,start:e=>e.indexOf(`==`),tokenize(e,t,n){let r=/^(==)([^=]+)(==)/.exec(e);if(r){let e=r[2].trim(),t=n.inlineTokens(e);return{type:`highlight`,raw:r[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Qt({find:lT,type:this.type})]},addPasteRules(){return[ue({find:uT,type:this.type})]}}),fT,pT;if(typeof WeakMap<`u`){let e=new WeakMap;fT=t=>e.get(t),pT=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;fT=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},pT=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var mT=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return fT(e)||pT(e,hT(e))}};function hT(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=gT(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new mT(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&_T(s,o,e),s}function gT(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function _T(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=vT(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function vT(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function yT(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var bT=new z(`selectingCells`);function xT(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function ST(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function CT(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function wT(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=xT(t.$head)||TT(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function TT(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function ET(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function DT(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function OT(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function kT(e,t,n){let r=e.node(-1),i=mT.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function AT(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function jT(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function MT(e,t,n){let r=yT(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var NT=class e extends ot{constructor(e,t=e){let n=e.node(-1),r=mT.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new Bt(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(ET(r)&&ET(i)&&OT(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return kt.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=mT.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=AT(e,0,l)),u>0&&(e=AT(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(Mt.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new Rt(Mt.from(o),1,1)}replace(e,t=Rt.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?Rt.empty:t)}let i=ot.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new Rt(Mt.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=mT.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=mT.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=mT.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=mT.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new PT(this.$anchorCell.pos,this.$headCell.pos)}};NT.prototype.visible=!1,ot.jsonID(`cell`,NT);var PT=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&OT(t,n)?new NT(t,n):ot.near(n,1)}};function FT(e){if(!(e.selection instanceof NT))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(Ue.node(n,n+e.nodeSize,{class:`selectedCell`}))}),Ve.create(e.doc,t)}function IT({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function LT({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function RT(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof Ge&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=NT.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=NT.rowSelection(e,e)}else if(!n){let e=mT.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=NT.create(i,t+1,n)}}else r instanceof kt&&IT(r)?a=kt.create(i,r.from):r instanceof kt&&LT(r)&&(a=kt.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var zT=new z(`fix-tables`);function BT(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?BT(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function VT(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=HT(e,t,r,n))};return t?t.doc!=e.doc&&BT(t.doc,e.doc,0,r):e.doc.descendants(r),n}function HT(e,t,n,r){let i=mT.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,AT(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=yT(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(zT,{fixTables:!0})}function UT(e){let t=e.selection,n=wT(e),r=n.node(-1),i=n.start(-1),a=mT.get(r);return{...t instanceof NT?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function WT(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;MT(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,jT(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?yT(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function GT(e,t){if(!CT(e))return!1;if(t){let n=UT(e);t(WT(e.tr,n,n.left))}return!0}function KT(e,t){if(!CT(e))return!1;if(t){let n=UT(e);t(WT(e.tr,n,n.right))}return!0}function qT(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,AT(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function JT(e,t){if(!CT(e))return!1;if(t){let n=UT(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;qT(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=mT.get(e)}t(r)}return!0}function YT(e,t,n){let r=yT(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function XT(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;YT(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?yT(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,yT(r.type.schema).row.create(null,o)),e}function ZT(e,t){if(!CT(e))return!1;if(t){let n=UT(e);t(XT(e.tr,n,n.top))}return!0}function QT(e,t){if(!CT(e))return!1;if(t){let n=UT(e);t(XT(e.tr,n,n.bottom))}return!0}function $T(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function eE(e,t){if(!CT(e))return!1;if(t){let n=UT(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;$T(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=mT.get(n.table)}t(r)}return!0}function tE(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function nE({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function rE(e,t){let n=e.selection;if(!(n instanceof NT)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=UT(e),{map:i}=r;if(nE(i,r))return!1;if(t){let n=e.tr,a={},o=Mt.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!(a[l]||!u))if(a[l]=!0,s==null)s=l,c=u;else{tE(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...jT(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=tE(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new NT(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function iE(e,t){let n=yT(e.schema);return aE(({node:e})=>n[e.type.spec.tableRole])(e,t)}function aE(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof NT){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=ST(r.$from),!i)return!1;a=xT(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=UT(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)(r!=l.left||t!=l.top)&&u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof NT&&u.setSelection(new NT(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function oE(e,t){return function(n,r){if(!CT(n))return!1;let i=wT(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof NT?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function sE(e){return function(t,n){if(!CT(t))return!1;if(n){let r=yT(t.schema),i=UT(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function cE(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function lE(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?sE(e):function(t,n){if(!CT(t))return!1;if(n){let r=yT(t.schema),i=UT(t),a=t.tr,o=cE(`row`,i,r),s=cE(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}lE(`row`,{useDeprecatedLogic:!0}),lE(`column`,{useDeprecatedLogic:!0});var uE=lE(`cell`,{useDeprecatedLogic:!0});function dE(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function fE(e){return function(t,n){if(!CT(t))return!1;let r=dE(wT(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(kt.between(e,DT(e))).scrollIntoView())}return!0}}function pE(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function mE(e,t){let n=e.selection;if(!(n instanceof NT))return!1;if(t){let r=e.tr,i=yT(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new Rt(i,0,0))}),r.docChanged&&t(r)}return!0}function hE(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=_E(yT(o).row,new Rt(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?_E(yT(o).row,new Rt(t,n,r)).content:t);else return null;return gE(o,s)}function gE(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(Mt.empty),n[i]<r){let a=yT(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(Mt.from(o))}return{height:t.length,width:r,rows:t}}function _E(e,t){let n=e.createAndFill();return new _t(n).replace(0,n.content.size,t).doc}function vE({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(AT(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(Mt.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(Mt.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function yE(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=yT(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,Mt.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function bE(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function xE(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,AT(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(AT(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function SE(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=mT.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=mT.get(a),f=d.mapping.maps.length}yE(d,o,a,n,l,u,f)&&p(),bE(d,o,a,n,c,l,s,f)&&p(),bE(d,o,a,n,c,l,u,f)&&p(),xE(d,o,a,n,s,u,c,f)&&p(),xE(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new Rt(i.rows[e-s],0,0))}p(),d.setSelection(new NT(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var CE=xe({ArrowLeft:TE(`horiz`,-1),ArrowRight:TE(`horiz`,1),ArrowUp:TE(`vert`,-1),ArrowDown:TE(`vert`,1),"Shift-ArrowLeft":EE(`horiz`,-1),"Shift-ArrowRight":EE(`horiz`,1),"Shift-ArrowUp":EE(`vert`,-1),"Shift-ArrowDown":EE(`vert`,1),Backspace:mE,"Mod-Backspace":mE,Delete:mE,"Mod-Delete":mE});function wE(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function TE(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof NT)return wE(n,r,ot.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=AE(i,e,t);if(o==null)return!1;if(e==`horiz`)return wE(n,r,ot.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=kT(i,e,t),s;return s=a?ot.near(a,1):t<0?ot.near(n.doc.resolve(i.before(-1)),-1):ot.near(n.doc.resolve(i.after(-1)),1),wE(n,r,s)}}}function EE(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof NT)o=a;else{let r=AE(i,e,t);if(r==null)return!1;o=new NT(n.doc.resolve(r))}let s=kT(o.$headCell,e,t);return s?wE(n,r,new NT(o.$anchorCell,s)):!1}}function DE(e,t){let n=e.state.doc,r=xT(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new NT(r))),!0):!1}function OE(e,t,n){if(!CT(e.state))return!1;let r=hE(n),i=e.state.selection;if(i instanceof NT){r||={width:1,height:1,rows:[Mt.from(_E(yT(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=mT.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=vE(r,o.right-o.left,o.bottom-o.top),SE(e.state,e.dispatch,a,o,r),!0}if(r){let t=wT(e.state),n=t.start(-1);return SE(e.state,e.dispatch,n,mT.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function kE(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=jE(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof NT)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=xT(e.state.selection.$anchor))!=null&&ME(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=ME(e,n),i=bT.getState(e.state)==null;if(!r||!OT(t,r))if(i)r=t;else return;let a=new NT(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(bT,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),bT.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(bT,-1))}function o(r){let o=r,s=bT.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(jE(e,o.target)!=n&&(c=ME(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function AE(e,t,n){if(!(e.state.selection instanceof kt))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function jE(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function ME(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&xT(e.state.doc.resolve(r))||xT(e.state.doc.resolve(i))}var NE=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),PE(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type&&(this.node=e,PE(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function PE(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var FE=new z(`tableColumnResizing`);function IE({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=NE,lastColumnResizable:i=!0}={}){let a=new ke({key:FE,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=yT(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new LE(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=FE.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{RE(t,n,e,i)},mouseleave:e=>{zE(e)},mousedown:(e,r)=>{BE(e,r,t,n)}},decorations:e=>{let t=FE.getState(e);if(t&&t.activeHandle>-1)return YE(e,t.activeHandle)},nodeViews:{}}});return a}var LE=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(FE);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return ET(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function RE(e,t,n,r){if(!e.editable)return;let i=FE.getState(e.state);if(i&&!i.dragging){let a=HE(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=UE(e,t,`left`,n):i-t.clientX<=n&&(o=UE(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=mT.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}GE(e,o)}}}function zE(e){if(!e.editable)return;let t=FE.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&GE(e,-1)}function BE(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=FE.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=VE(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(FE,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=FE.getState(e.state);r?.dragging&&(KE(e,r.activeHandle,WE(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(FE,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=FE.getState(e.state);if(i&&i.dragging){let a=WE(i.dragging,t,n);qE(e,i.activeHandle,a,r)}}return qE(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function VE(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function HE(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function UE(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=xT(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=mT.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function WE(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function GE(e,t){e.dispatch(e.state.tr.setMeta(FE,{setHandle:t}))}function KE(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=mT.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():JE(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function qE(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=mT.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&PE(a,c.firstChild,c,r,s,n)}function JE(e){return Array(e).fill(0)}function YE(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return Ve.empty;let a=mT.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,FE.getState(e)?.dragging&&n.push(Ue.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(Ue.widget(s,c))}}return Ve.create(e.doc,n)}function XE({allowTableNodeSelection:e=!1}={}){return new ke({key:bT,state:{init(){return null},apply(e,t){let n=e.getMeta(bT);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:FT,handleDOMEvents:{mousedown:kE},createSelectionBetween(e){return bT.getState(e.state)==null?null:e.state.selection},handleTripleClick:DE,handleKeyDown:CE,handlePaste:OE},appendTransaction(t,n,r){return RT(r,VT(r,n),e)}})}function ZE(e){return e===`left`||e===`right`||e===`center`?e:null}function QE(e){let t=(e.style.textAlign||``).trim().toLowerCase(),n=(e.getAttribute(`align`)||``).trim().toLowerCase();return ZE(t||n)}function $E(e){return ZE(e?.align)}function eD(){return{default:null,parseHTML:e=>QE(e),renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}function tD(e){let t=e.parentElement,n=e.closest(`table`);if(!t||!n)return null;let r=Array.from(t.children).indexOf(e),i=n.querySelectorAll(`colgroup > col`)[r]?.getAttribute(`width`);return i?[parseInt(i,10)]:null}function nD(e){let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):tD(e)}var rD=/[ \t\r\n\f]+/g;function iD(e){return e.children.length>0?!1:(e.textContent??``).replace(rD,``)===``}function aD(e){let t=e.createAndFill();if(!t)throw Error(`[tiptap error]: "${e.name}" has no default content to backfill.`);return t.content}var oD=St.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:nD},align:eD()}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`,getAttrs:e=>iD(e)?{}:!1,getContent:(e,t)=>aD(t.nodes[this.name])},{tag:`td`}]},renderHTML({HTMLAttributes:e}){return[`td`,Le(this.options.HTMLAttributes,e),0]}}),sD=St.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:nD},align:eD()}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`,getAttrs:e=>iD(e)?{}:!1,getContent:(e,t)=>aD(t.nodes[this.name])},{tag:`th`}]},renderHTML({HTMLAttributes:e}){return[`th`,Le(this.options.HTMLAttributes,e),0]}}),cD=St.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,Le(this.options.HTMLAttributes,e),0]}});function lD(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function uD(e,t,n,r,i,a){var o;let s=0,c=!0,l=t.firstChild,u=e.firstChild;if(u!==null)for(let e=0,n=0;e<u.childCount;e+=1){let{colspan:o,colwidth:d}=u.child(e).attrs;for(let e=0;e<o;e+=1,n+=1){let o=i===n?a:d&&d[e],u=o?`${o}px`:``;if(s+=o||r,o||(c=!1),l){if(l.style.width!==u){let[e,t]=lD(r,o);l.style.setProperty(e,t)}l=l.nextSibling}else{let e=document.createElement(`col`),[n,i]=lD(r,o);e.style.setProperty(n,i),t.appendChild(e)}}}for(;l;){let e=l.nextSibling;(o=l.parentNode)==null||o.removeChild(l),l=e}let d=e.attrs.style&&typeof e.attrs.style==`string`&&/\bwidth\s*:/i.test(e.attrs.style);c&&!d?(n.style.width=`${s}px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=`${s}px`)}var dD=class{constructor(e,t,n,r={}){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`));for(let[e,t]of Object.entries(r))t!=null&&(e===`style`?this.table.style.cssText=String(t):this.table.setAttribute(e,String(t)));e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),uD(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type===this.node.type&&(this.node=e,uD(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!!(n&&!r&&(e.type===`attributes`||e.type===`childList`||e.type===`characterData`))}};function fD(e,t,n,r){let i=0,a=!0,o=[],s=e.firstChild;if(!s)return{};for(let e=0,c=0;e<s.childCount;e+=1){let{colspan:l,colwidth:u}=s.child(e).attrs;for(let e=0;e<l;e+=1,c+=1){let s=n===c?r:u&&u[e];i+=s||t,s||(a=!1);let[l,d]=lD(t,s);o.push([`col`,{style:`${l}: ${d}`}])}}let c=a?`${i}px`:``,l=a?``:`${i}px`;return{colgroup:[`colgroup`,{},...o],tableWidth:c,tableMinWidth:l}}function pD(e,t){return t?e.createChecked(null,t):e.createAndFill()}function mD(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function hD(e,t,n,r,i){let a=mD(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=pD(a.cell,i);if(e&&s.push(e),r){let e=pD(a.header_cell,i);e&&o.push(e)}}let c=[];for(let e=0;e<t;e+=1)c.push(a.row.createChecked(null,r&&e===0?o:s));return a.table.createChecked(null,c)}function gD(e){return e instanceof NT}var _D=({editor:e})=>{let{selection:t}=e.state;if(!gD(t))return!1;let n=0;return Ze(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(n+=1)}),n===t.ranges.length&&(e.commands.deleteTable(),!0)};function vD(e,t){let n=e.mapping.map(t);if(Ze(e.selection.$from,e=>e.type.name===`table`)?.pos===n)return;let r=e.doc.nodeAt(n);if(!r)return;let i=n+r.nodeSize-1;e.setSelection(kt.near(e.doc.resolve(i),-1))}function yD(e){let t=``,n=0;for(;n<e.length;){if(e[n]===`\\`&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}if(e[n]!=="`"){t+=e[n++];continue}let r=0;for(;n+r<e.length&&e[n+r]==="`";)r+=1;let i=n+r,a=!1;for(;i<e.length;){if(e[i]!=="`"){i+=1;continue}let o=0;for(;i+o<e.length&&e[i+o]==="`";)o+=1;if(o===r){let o=e.slice(n+r,i);t+=e.slice(n,n+r)+o.replace(/(?<!\\)\|/g,`\\|`)+e.slice(i,i+r),n=i+r,a=!0;break}i+=o}a||(t+=e.slice(n,n+r),n+=r)}return t}function bD(e){return e.split(`
119
+ `).map(e=>!e.includes(`|`)||!e.includes("`")?e:yD(e)).join(`
120
+ `)}function xD(e){return(e||``).replace(/\s+/g,` `).trim()}function SD(e,t,n={}){let r=n.cellLineSeparator??``;if(!e||!e.content||e.content.length===0)return``;let i=[];e.content.forEach(e=>{let n=[];e.content&&e.content.forEach(e=>{let i=``;i=e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>t.renderChildren(e)).join(r):e.content?t.renderChildren(e.content):``;let a=xD(i.split(r).join(`
121
+ `).replace(/[ \t]*\r?\n[ \t]*/g,`<br>`)),o=e.type===`tableHeader`,s=$E(e.attrs);n.push({text:a,isHeader:o,align:s})}),i.push(n)});let a=i.reduce((e,t)=>Math.max(e,t.length),0);if(a===0)return``;let o=Array.from({length:a}).fill(0);i.forEach(e=>{for(let t=0;t<a;t+=1){let n=(e[t]?.text||``).length;n>o[t]&&(o[t]=n),o[t]<3&&(o[t]=3)}});let s=(e,t)=>e+` `.repeat(Math.max(0,t-e.length)),c=i[0],l=c.some(e=>e.isHeader),u=Array.from({length:a}).fill(null);i.forEach(e=>{for(let t=0;t<a;t+=1)!u[t]&&e[t]?.align&&(u[t]=e[t].align)});let d=`
122
+ `,f=Array.from({length:a}).map((e,t)=>l&&c[t]&&c[t].text||``);return d+=`| ${f.map((e,t)=>s(e,o[t])).join(` | `)} |
123
+ `,d+=`| ${o.map((e,t)=>{let n=Math.max(3,e),r=u[t];return r===`left`?`:${`-`.repeat(n)}`:r===`right`?`${`-`.repeat(n)}:`:r===`center`?`:${`-`.repeat(n)}:`:`-`.repeat(n)}).join(` | `)} |
124
+ `,(l?i.slice(1):i).forEach(e=>{d+=`| ${Array.from({length:a}).fill(0).map((t,n)=>s(e[n]&&e[n].text||``,o[n])).join(` | `)} |
125
+ `}),d}var CD=SD,wD=St.create({name:`table`,addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:dD,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:`tableRow+`,tableRole:`table`,isolating:!0,group:`block`,parseHTML(){return[{tag:`table`}]},renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=fD(e,this.options.cellMinWidth),a=t.style;function o(){return a||(r?`width: ${r}`:`min-width: ${i}`)}let s=[`table`,Le(this.options.HTMLAttributes,t,{style:o()}),n,[`tbody`,0]];return this.options.renderWrapper?[`div`,{class:`tableWrapper`},s]:s},parseMarkdown:(e,t)=>{let n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){let i=[];e.header.forEach((e,n)=>{let a=ZE(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableHeader`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}return e.rows&&e.rows.forEach(e=>{let i=[];e.forEach((e,n)=>{let a=ZE(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableCell`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}),t.createNode(`table`,void 0,n)},renderMarkdown:(e,t)=>CD(e,t),markdownTokenizer:{name:`table`,level:`block`,start:e=>{let t=e.split(`
126
+ `);if(t.length<2)return-1;let n=t[1];return!/^[ \t|:]*-[ \t|:-]*$/.test(n)||!n.includes(`|`)?-1:t[0].includes(`|`)?0:-1},tokenize(e,t,n){let r=e.indexOf(`
127
+
128
+ `),i=r>=0?e.slice(0,r):e,a=i.split(`
129
+ `);if(a.length<2)return;let o=a[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(o)||!o.includes(`|`))return;let s=bD(i);if(s===i)return;let c=n.blockTokens(s)[0];if(c?.type!==`table`||!c.raw)return;let l=c.raw.split(`
130
+ `).length,u=e.split(`
131
+ `).slice(0,l).join(`
132
+ `);return{...c,raw:u}}},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{let o=hD(a.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(kt.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>GT(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>KT(e,t),deleteColumn:()=>({state:e,dispatch:t})=>{let n=Ze(e.selection.$from,e=>e.type.name===`table`);return JT(e,t&&(e=>{n&&vD(e,n.pos),t(e)}))},addRowBefore:()=>({state:e,dispatch:t})=>ZT(e,t),addRowAfter:()=>({state:e,dispatch:t})=>QT(e,t),deleteRow:()=>({state:e,dispatch:t})=>{let n=Ze(e.selection.$from,e=>e.type.name===`table`);return eE(e,t&&(e=>{n&&vD(e,n.pos),t(e)}))},deleteTable:()=>({state:e,dispatch:t})=>pE(e,t),mergeCells:()=>({state:e,dispatch:t})=>rE(e,t),splitCell:()=>({state:e,dispatch:t})=>iE(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>lE(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>lE(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>uE(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>rE(e,t)?!0:iE(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>oE(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>fE(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>fE(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&VT(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=NT.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:_D,"Mod-Backspace":_D,Delete:_D,"Mod-Delete":_D}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[IE({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],XE({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){let e=this.options.resizable&&this.editor.isEditable,t=this.options.View;return e||!t?null:({node:e,view:n,HTMLAttributes:r})=>{let i=Le(this.options.HTMLAttributes,r);return new t(e,this.options.cellMinWidth,n,i)}},extendNodeSchema(e){let t={name:e.name,options:e.options,storage:e.storage};return{tableRole:nt(fe(e,`tableRole`,t))}}}),TD=At.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1&&e.push(wD.configure(this.options.table)),this.options.tableCell!==!1&&e.push(oD.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(sD.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push(cD.configure(this.options.tableRow)),e}}),ED=At.create({name:`textAlign`,addOptions(){return{types:[],alignments:[`left`,`center`,`right`,`justify`],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{let t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,`textAlign`)).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign(`left`),"Mod-Shift-e":()=>this.editor.commands.setTextAlign(`center`),"Mod-Shift-r":()=>this.editor.commands.setTextAlign(`right`),"Mod-Shift-j":()=>this.editor.commands.setTextAlign(`justify`)}}}),DD=[1,2,3,4,5,6],OD=[`left`,`center`,`right`,`justify`],kD={left:{icon:`align-left`,key:`align-left`,label:`Align left`},center:{icon:`align-center`,key:`align-center`,label:`Align center`},right:{icon:`align-right`,key:`align-right`,label:`Align right`},justify:{icon:`align-justify`,key:`justify`,label:`Justify`}},AD=[`😀`,`😅`,`😂`,`🥳`,`😎`,`🤔`,`👍`,`🙏`,`🔥`,`🎉`,`🚀`,`💡`,`✅`,`❌`,`⭐`,`❤️`];function jD(e){let t=(e??DD).filter(e=>e>=1&&e<=6);return t.length>0?t:DD}function MD({editor:e,levels:t}){let{t:n}=N(`lattice`),r=n(`form.editor.heading`,`Heading`);return(0,q.jsxs)(Dt,{children:[(0,q.jsx)(Ye,{asChild:!0,children:(0,q.jsx)(Gw,{active:e.isActive(`heading`),icon:`heading`,label:r,testId:`editor-heading`})}),(0,q.jsx)(mt,{className:`min-w-32`,children:t.map(t=>(0,q.jsx)(dt,{className:x(e.isActive(`heading`,{level:t})&&`bg-lt-accent text-lt-accent-fg`),"data-test":`editor-heading-${t}`,onClick:()=>e.chain().focus().toggleHeading({level:t}).run(),children:n(`form.editor.heading-${t}`,`Heading ${t}`)},t))})]})}function ND({editor:e}){let{t}=N(`lattice`),[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(``),o=()=>{i?e.chain().focus().extendMarkRange(`link`).setLink({href:i}).run():e.chain().focus().extendMarkRange(`link`).unsetLink().run(),r(!1)};return(0,q.jsxs)(Zt,{onOpenChange:t=>{t&&a(e.getAttributes(`link`).href??``),r(t)},open:n,children:[(0,q.jsx)(Pe,{asChild:!0,children:(0,q.jsx)(Gw,{active:e.isActive(`link`),icon:`link`,label:t(`form.editor.link`,`Link`),testId:`editor-link`})}),(0,q.jsxs)(Jt,{className:`flex w-72 items-center gap-1 p-2`,children:[(0,q.jsx)(`input`,{"aria-label":t(`form.editor.link-url`,`Link URL`),className:`h-7 min-w-0 flex-1 rounded-lt-sm border border-lt-input bg-transparent px-2 text-sm outline-none focus:border-lt-ring`,"data-test":`editor-link-url`,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),o())},placeholder:`https://`,type:`url`,value:i}),(0,q.jsx)(Gw,{icon:`check`,label:t(`form.editor.link-apply`,`Apply link`),onClick:o,testId:`editor-link-apply`}),e.isActive(`link`)&&(0,q.jsx)(Gw,{icon:`trash-2`,label:t(`form.editor.link-remove`,`Remove link`),onClick:()=>{e.chain().focus().extendMarkRange(`link`).unsetLink().run(),r(!1)},testId:`editor-link-remove`})]})]})}function PD({editor:e,emojis:t}){let{t:n}=N(`lattice`),[r,i]=(0,B.useState)(!1);return(0,q.jsxs)(Zt,{onOpenChange:i,open:r,children:[(0,q.jsx)(Pe,{asChild:!0,children:(0,q.jsx)(Gw,{icon:`smile`,label:n(`form.editor.insert-emoji`,`Insert emoji`),testId:`editor-emoji`})}),(0,q.jsx)(Jt,{className:`grid grid-cols-8 gap-0.5 p-1`,children:t.map(t=>(0,q.jsx)(`button`,{className:`inline-flex size-7 items-center justify-center rounded-lt-sm text-base hover:bg-lt-accent`,onClick:()=>{e.chain().focus().insertContent(t).run(),i(!1)},onMouseDown:e=>e.preventDefault(),type:`button`,children:t},t))})]})}function FD(e,t,n,r){return{icon:t,key:e,label:n,isActive:e=>e.isActive(r),run:e=>e.chain().focus().toggleMark(r).run()}}var ID={bold:{group:`marks`,starterKit:()=>({bold:{}}),toolbar:()=>[FD(`bold`,`bold`,`Bold`,`bold`)]},italic:{group:`marks`,starterKit:()=>({italic:{}}),toolbar:()=>[FD(`italic`,`italic`,`Italic`,`italic`)]},strike:{group:`marks`,starterKit:()=>({strike:{}}),toolbar:()=>[FD(`strikethrough`,`strikethrough`,`Strikethrough`,`strike`)]},underline:{group:`marks`,starterKit:()=>({underline:{}}),toolbar:()=>[FD(`underline`,`underline`,`Underline`,`underline`)]},highlight:{group:`marks`,extensions:()=>[dT],toolbar:()=>[FD(`highlight`,`highlighter`,`Highlight`,`highlight`)]},code:{group:`marks`,starterKit:()=>({code:{}}),toolbar:()=>[FD(`code`,`code-xml`,`Code`,`code`)]},heading:{starterKit:e=>({heading:{levels:jD(e.levels)}}),toolbar:e=>{let t=jD(e.levels);return[{key:`heading`,component:({editor:e})=>(0,q.jsx)(MD,{editor:e,levels:t})}]},commands:e=>jD(e.levels).map(e=>({key:`heading-${e}`,icon:`heading-${e}`,label:`Heading ${e}`,keywords:[`h${e}`,`title`],run:t=>t.chain().focus().setHeading({level:e}).run()}))},"bullet-list":{group:`blocks`,starterKit:()=>({bulletList:{},listItem:{}}),toolbar:()=>[{icon:`list`,key:`bullet-list`,label:`Bullet list`,isActive:e=>e.isActive(`bulletList`),run:e=>e.chain().focus().toggleBulletList().run()}],commands:()=>[{icon:`list`,key:`bullet-list`,label:`Bullet list`,keywords:[`ul`,`unordered`],run:e=>e.chain().focus().toggleBulletList().run()}]},"ordered-list":{group:`blocks`,starterKit:()=>({orderedList:{},listItem:{}}),toolbar:()=>[{icon:`list-ordered`,key:`ordered-list`,label:`Ordered list`,isActive:e=>e.isActive(`orderedList`),run:e=>e.chain().focus().toggleOrderedList().run()}],commands:()=>[{icon:`list-ordered`,key:`ordered-list`,label:`Ordered list`,keywords:[`ol`,`numbered`],run:e=>e.chain().focus().toggleOrderedList().run()}]},blockquote:{group:`blocks`,starterKit:()=>({blockquote:{}}),toolbar:()=>[{icon:`quote`,key:`blockquote`,label:`Blockquote`,isActive:e=>e.isActive(`blockquote`),run:e=>e.chain().focus().toggleBlockquote().run()}],commands:()=>[{icon:`quote`,key:`blockquote`,label:`Blockquote`,keywords:[`quote`,`cite`],run:e=>e.chain().focus().toggleBlockquote().run()}]},"code-block":{group:`blocks`,starterKit:()=>({codeBlock:{}}),toolbar:()=>[{icon:`code`,key:`code-block`,label:`Code block`,isActive:e=>e.isActive(`codeBlock`),run:e=>e.chain().focus().toggleCodeBlock().run()}],commands:()=>[{icon:`code`,key:`code-block`,label:`Code block`,keywords:[`codeblock`,`pre`,`fence`],run:e=>e.chain().focus().toggleCodeBlock().run()}]},"horizontal-rule":{group:`blocks`,starterKit:()=>({horizontalRule:{}}),toolbar:()=>[{icon:`minus`,key:`horizontal-rule`,label:`Horizontal rule`,isActive:()=>!1,run:e=>e.chain().focus().setHorizontalRule().run()}],commands:()=>[{icon:`minus`,key:`horizontal-rule`,label:`Horizontal rule`,keywords:[`hr`,`divider`,`rule`],run:e=>e.chain().focus().setHorizontalRule().run()}]},"text-align":{extensions:e=>[ED.configure({alignments:e.alignments??OD,types:[`heading`,`paragraph`]})],toolbar:e=>(e.alignments??OD).filter(e=>e in kD).map(e=>({...kD[e],isActive:t=>t.isActive({textAlign:e}),run:t=>t.chain().focus().setTextAlign(e).run()}))},link:{starterKit:e=>({link:{openOnClick:e.openOnClick??!1,...e.protocols?{protocols:e.protocols}:{}}}),toolbar:()=>[{key:`link`,component:({editor:e})=>(0,q.jsx)(ND,{editor:e})}]},table:{group:`insert`,extensions:()=>[TD.configure({table:{resizable:!1}})],toolbar:e=>[{icon:`table`,key:`insert-table`,label:`Insert table`,isActive:e=>e.isActive(`table`),run:t=>t.chain().focus().insertTable({rows:e.rows??3,cols:e.cols??3,withHeaderRow:e.withHeaderRow??!0}).run()},{icon:`columns-3`,key:`add-column`,label:`Add column`,isActive:()=>!1,isDisabled:e=>!e.can().addColumnAfter(),run:e=>e.chain().focus().addColumnAfter().run()},{icon:`rows-3`,key:`add-row`,label:`Add row`,isActive:()=>!1,isDisabled:e=>!e.can().addRowAfter(),run:e=>e.chain().focus().addRowAfter().run()},{icon:`trash-2`,key:`delete-table`,label:`Delete table`,isActive:()=>!1,isDisabled:e=>!e.can().deleteTable(),run:e=>e.chain().focus().deleteTable().run()}],commands:e=>[{icon:`table`,key:`insert-table`,label:`Insert table`,keywords:[`table`,`grid`],isAvailable:e=>e.can().insertTable(),run:t=>t.chain().focus().insertTable({rows:e.rows??3,cols:e.cols??3,withHeaderRow:e.withHeaderRow??!0}).run()}]},details:{group:`insert`,extensions:()=>[oT,cT,sT],toolbar:()=>[{icon:`chevron-right`,key:`details`,label:`Details`,isActive:e=>e.isActive(`details`),run:e=>{if(e.isActive(`details`)){e.chain().focus().unsetDetails().run();return}e.chain().focus().setDetails().run()}}],commands:()=>[{icon:`chevron-right`,key:`details`,label:`Details`,keywords:[`toggle`,`collapse`,`accordion`],isAvailable:e=>e.can().setDetails(),run:e=>e.chain().focus().setDetails().run()}]},"slash-menu":{},emoji:{toolbar:e=>{let t=e.emojis??AD;return[{key:`insert-emoji`,component:({editor:e})=>(0,q.jsx)(PD,{editor:e,emojis:t})}]}}};function LD(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var RD=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&je(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(_(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(A(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(C(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(ee(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(v(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(T(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(E(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(k(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=ze(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof Ge){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof NT){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():LD(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&S(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},zD=e=>new ke({key:typeof e.pluginKey==`string`?new z(e.pluginKey):e.pluginKey,view:t=>new RD({view:t,...e})});At.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[zD({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var BD=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return ce(e,{textSerializers:vt(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(_(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(A(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(C(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(ee(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(v(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(T(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(E(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(k(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){if(!this.view?.dom?.parentNode)return;let{selection:e}=this.editor.state,t=ze(this.view,e.from,e.to);S({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},VD=e=>new ke({key:typeof e.pluginKey==`string`?new z(e.pluginKey):e.pluginKey,view:t=>new BD({view:t,...e})});At.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[VD({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function HD(e,t){return e??new z(t)}var UD=typeof window<`u`?B.useLayoutEffect:B.useEffect,WD=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),GD=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),KD=new Set([`children`,`className`,`style`]),qD=new Set([`tabIndex`]),JD=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),YD={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function XD(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function ZD(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function QD(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||JD.has(e)}function $D(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function eO(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:YD[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function tO(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function nO(e){return qD.has(e)}function rO(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function iO(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function aO(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||GD.has(e)?String(t):`${t}px`}function oO(e,t){WD.has(t)||e.style.removeProperty($D(t))}function sO(e,t,n){WD.has(t)||e.style.setProperty($D(t),aO(t,n))}function cO(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(KD.has(r)||!QD(r)||XD(r,t[r])||XD(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=ZD(r);if(a==null||a===!1){nO(r)&&iO(e,r),e.removeAttribute(o);return}if(a===!0){nO(r)&&rO(e,r,!0),e.setAttribute(o,``);return}if(nO(r)){rO(e,r,a);return}e.setAttribute(o,String(a))})}function lO(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function uO(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){oO(e,t);return}sO(e,t,a)}})}function dO(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!XD(t,n))return;let{eventName:i,options:a}=eO(t),o=t=>{n(tO(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function fO(e,t){let n=(0,B.useRef)({}),r=(0,B.useRef)([]);UD(()=>{let i=n.current;return lO(e,i.className,t.className),uO(e,i.style,t.style),cO(e,i,t),r.current=dO(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}B.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,B.useRef)(document.createElement(`div`)),f=(0,B.useRef)(HD(e,`bubbleMenu`)).current;fO(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=ht(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,B.useRef)(h);g.current=h;let[_,v]=(0,B.useState)(!1),y=(0,B.useRef)(!0);return(0,B.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=zD({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,B.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,rc.createPortal)(c,d.current)});var pO=B.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,B.useRef)(document.createElement(`div`)),d=(0,B.useRef)(HD(e,`floatingMenu`)).current;fO(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=ht(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,B.useRef)(m);h.current=m;let[g,_]=(0,B.useState)(!1),v=(0,B.useRef)(!0);return(0,B.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=VD({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,B.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,rc.createPortal)(s,u.current)});function mO(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=lt(t),l=RegExp(`\\s${c}$`),u=a?`^`:``,d=r?``:c,f=RegExp(s?`${u}${c}.*?(?=\\s${d}|$)`:`${u}(?:^)?${c}[^\\s${d}]*`,`gm`),p=o.nodeBefore?.isText&&o.nodeBefore.text;if(!p)return null;let m=o.pos-p.length,h=Array.from(p.matchAll(f)).pop();if(!h||h.input===void 0||h.index===void 0)return null;let g=h.input.slice(Math.max(0,h.index-1),h.index),_=RegExp(`^[${i?.join(``)}\0]?$`).test(g);if(i!==null&&!_)return null;let v=m+h.index,y=v+h[0].length;return s&&l.test(p.slice(y-1,y+1))&&(h[0]+=` `,y+=1),v<o.pos&&y>=o.pos?{range:{from:v,to:y},query:h[0].slice(t.length),text:h[0]}:null}function hO(e){return e.docChanged?e.steps.some(e=>{let t=e.slice;if(!t?.content)return!1;let n=t.content.textBetween(0,t.content.size,`
133
+ `);return/\s/.test(n)}):!1}function gO(e){return()=>{let t=e.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=e.view.coordsAtPos(t);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}}}function _O(e,t,n,r){return n?()=>{let n=r.getState(e.state)?.decorationId;return t.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect()||null}:gO(e)}function vO({match:e,dismissedRange:t,state:n,transaction:r,editor:i,shouldResetDismissed:a,effectiveAllowSpaces:o}){return a?.({editor:i,state:n,range:t,match:e,transaction:r,allowSpaces:o})?!1:o?e.range.from===t.from:e.range.from===t.from&&!hO(r)}function yO({view:e,pluginKeyRef:t}){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)}function bO({pluginKey:e,decorationTag:t,decorationClass:n,decorationContent:r,decorationEmptyClass:i,renderer:a,dispatchExit:o}){return{handleKeyDown(t,n){var r;let i=e.getState(t.state);if(!i.active)return!1;if(n.key===`Escape`||n.key===`Esc`){var s;return a==null||(s=a.onKeyDown)==null||s.call(a,{view:t,event:n,range:i.range}),o(t),!0}return(a==null||(r=a.onKeyDown)==null?void 0:r.call(a,{view:t,event:n,range:i.range}))||!1},decorations(a){let{active:o,range:s,decorationId:c,query:l}=e.getState(a);if(!o)return null;let u=!l?.length,d=[n];return u&&d.push(i),Ve.create(a.doc,[Ue.inline(s.from,s.to,{nodeName:t,class:d.join(` `),"data-decoration-id":c||void 0,"data-decoration-content":r})])}}}function xO({editor:e,char:t,effectiveAllowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,findSuggestionMatch:o,allow:s,shouldShow:c,shouldKeepDismissed:l,pluginKey:u}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(d,f,p,m){let{isEditable:h}=e,{composing:g}=e.view,{selection:_}=d,{empty:v,from:y}=_,b={...f},x=d.getMeta(u);if(x&&x.exit)return b.active=!1,b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null,b.dismissedRange=f.active?{...f.range}:f.dismissedRange,b;if(b.composing=g,d.docChanged&&b.dismissedRange!==null&&(b.dismissedRange={from:d.mapping.map(b.dismissedRange.from),to:d.mapping.map(b.dismissedRange.to)}),h&&(v||e.view.composing)){(y<f.range.from||y>f.range.to)&&!g&&!f.composing&&(b.active=!1);let u=o({char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:_.$from}),p=`id_${Math.floor(Math.random()*4294967295)}`;u&&s({editor:e,state:m,range:u.range,isActive:f.active})&&(!c||c({editor:e,range:u.range,query:u.query,text:u.text,transaction:d}))?(b.dismissedRange!==null&&!l({match:u,dismissedRange:b.dismissedRange,state:m,transaction:d})&&(b.dismissedRange=null),b.dismissedRange===null?(b.active=!0,b.decorationId=f.decorationId||p,b.range=u.range,b.query=u.query,b.text=u.text):b.active=!1):(u||(b.dismissedRange=null),b.active=!1)}else b.active=!1;return b.active||(b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null),b}}}function SO({editor:e,items:t}){let n=null,r=null,i=null,a=()=>{r!==null&&(clearTimeout(r),r=null),i?.(),i=null},o=e=>new Promise(t=>{i=t,r=setTimeout(()=>{r=null;let e=i;i=null,e?.()},e)}),s=()=>{n?.abort(),a(),n=null};return{abort:s,fetch:async(r,i)=>{s(),n=new AbortController;let a=n;if(i>0&&await o(i),n!==a||a.signal.aborted)return{status:`aborted`};try{let i=await t({editor:e,query:r,signal:a.signal});return n!==a||a.signal.aborted?{status:`aborted`}:{status:`resolved`,items:i}}catch{return n!==a||a.signal.aborted?{status:`aborted`}:{status:`error`}}}}}function CO({placement:e,offset:t,flip:n,floatingUi:r}){var i;let a=[C({mainAxis:t.mainAxis??4,crossAxis:t.crossAxis??0})];return n&&a.push(_()),r!=null&&(i=r.middleware)!=null&&i.length&&a.push(...r.middleware),{placement:e,strategy:r?.strategy??`absolute`,middleware:a}}function wO(e){if(e instanceof HTMLElement)return e;if(typeof e==`string`)try{let t=document.querySelector(e);if(t)return t}catch{return document.body}return document.body}function TO({getReferenceRect:e,contextElement:t,config:n,container:r,dismissOnOutsideClick:i,dismiss:a}){return(o,s={})=>{let c={getBoundingClientRect:()=>e()??new DOMRect,contextElement:t},l=!1,u=!o.isConnected;u&&wO(r).appendChild(o),s.onPosition||(o.style.visibility=`hidden`,o.style.width=`max-content`);let d=O(c,o,()=>{S(c,o,{placement:n.placement,strategy:n.strategy,middleware:n.middleware}).then(({x:e,y:t,placement:n,strategy:r})=>{if(s.onPosition){s.onPosition({x:e,y:t,placement:n,strategy:r});return}Object.assign(o.style,{position:r,left:`${e}px`,top:`${t}px`}),l||(l=!0,o.style.visibility=``)})},s.autoUpdate),f;return i&&(f=e=>{let n=e.target;!(n instanceof Node)||o.contains(n)||t.contains(n)||a()},document.addEventListener(`pointerdown`,f,!0)),()=>{d(),f&&document.removeEventListener(`pointerdown`,f,!0),u&&o.remove()}}}function EO({editor:e,pluginKey:t,items:n,renderer:r,minQueryLength:i,debounce:a,initialItems:o,placement:s,offset:c,container:l,flip:u,floatingUi:d,dismissOnOutsideClick:f,command:p,clientRectFor:m,dispatchExit:h}){let g,_=SO({editor:e,items:n}),v=CO({placement:s,offset:c,flip:u,floatingUi:d});function y(e,t){switch(e){case`started`:var n;r==null||(n=r.onStart)==null||n.call(r,t);break;case`updated`:var i;r==null||(i=r.onUpdate)==null||i.call(r,t);break;case`stopped`:var a;r==null||(a=r.onExit)==null||a.call(r,t)}}return{update:async(n,d)=>{let b=t.getState(d),x=t.getState(n.state);if(!b||!x)return;let S=null,C=b.query!==x.query,w=b.text!==x.text,T=b.range.from!==x.range.from||b.range.to!==x.range.to,E=C||w||T;if(!b.active&&x.active)S=`started`;else if(b.active&&!x.active)S=`stopped`;else if(x.active&&E)S=`updated`;else return;let D=S===`stopped`?b:x,O=n.dom.querySelector(`[data-decoration-id="${D.decorationId}"]`),k=m(n,O),ee=i===0||(D.query?D.query.length>=i:!1),A=(S===`started`||S===`updated`)&&ee;if(g={editor:e,range:D.range,query:D.query||``,text:D.text||``,items:o??[],command:t=>p({editor:e,range:D.range,props:t}),decorationNode:O,clientRect:k,loading:A,placement:s,offset:{mainAxis:c.mainAxis??4,crossAxis:c.crossAxis??0},container:l,flip:u,floatingUi:v,mount:TO({getReferenceRect:k,contextElement:n.dom,config:v,container:l,dismissOnOutsideClick:f,dismiss:()=>h(e.view)})},S===`started`){var j;r==null||(j=r.onBeforeStart)==null||j.call(r,g)}if(S===`updated`){var M;r==null||(M=r.onBeforeUpdate)==null||M.call(r,g)}if(S===`started`&&y(S,g),S===`started`||S===`updated`)if(!A)_.abort(),g={...g,items:o??[],loading:!1};else{g={...g,items:o??[],loading:!0},S=`updated`,y(S,g);let e=await _.fetch(D.query||``,a);if(e.status===`aborted`)return;if(!t.getState(n.state)?.active){_.abort();return}g=e.status===`resolved`?{...g,items:e.items,loading:!1}:{...g,loading:!1}}if(S===`stopped`){_.abort(),y(S,g),g=void 0;return}S===`updated`&&y(S,g)},destroy:()=>{var e;_.abort(),g&&(r==null||(e=r.onExit)==null||e.call(r,g))}}}var DO=new z(`suggestion`);function OO({pluginKey:e=DO,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],minQueryLength:p=0,debounce:m=0,initialItems:h,placement:g=`bottom-start`,offset:_={},container:v,flip:y=!0,floatingUi:b,dismissOnOutsideClick:x=!0,render:S=()=>({}),allow:C=()=>!0,findSuggestionMatch:w=mO,shouldShow:T,shouldResetDismissed:E}){let D=S?.(),O=r&&!i,k=(n,r)=>_O(t,n,r,e);function ee(e){return vO({...e,editor:t,shouldResetDismissed:E,effectiveAllowSpaces:O})}let A=t=>yO({view:t,pluginKeyRef:e});return new ke({key:e,view:()=>EO({editor:t,pluginKey:e,items:f,renderer:D,minQueryLength:p,debounce:m,initialItems:h,placement:g,offset:_,container:v,flip:y,floatingUi:b,dismissOnOutsideClick:x,command:d,clientRectFor:k,dispatchExit:A}),state:xO({editor:t,char:n,effectiveAllowSpaces:O,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,findSuggestionMatch:w,allow:C,shouldShow:T,shouldKeepDismissed:ee,pluginKey:e}),props:bO({pluginKey:e,decorationTag:s,decorationClass:c,decorationContent:l,decorationEmptyClass:u,renderer:D,dispatchExit:A})})}function kO(e,t=DO){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)}function AO(e,t){return`${e}-option-${t}`}function jO({activeIndex:e,id:t,items:n,onHighlight:r,onSelect:i,translate:a}){let{t:o}=N(`lattice`),s=(0,B.useRef)(null),c=a??((e,t)=>o(`form.editor.${e}`,t));return(0,B.useEffect)(()=>{s.current?.querySelector(`[aria-selected="true"]`)?.scrollIntoView({block:`nearest`})},[e,n]),(0,q.jsx)(`div`,{"aria-label":o(`form.editor.block-menu`,`Insert block`),className:x(Wt,`max-h-72 w-56 overflow-y-auto p-1`),"data-test":`editor-block-menu`,id:t,ref:s,role:`listbox`,children:n.length===0?(0,q.jsx)(`div`,{className:`px-2 py-1.5 text-sm text-lt-muted-fg`,children:o(`form.editor.block-menu-empty`,`No results`)}):n.map((a,o)=>(0,q.jsxs)(B.Fragment,{children:[o>0&&n[o-1].group!==a.group&&(0,q.jsx)(`div`,{className:`mx-1 my-1 h-px bg-lt-border`}),(0,q.jsxs)(`button`,{"aria-selected":o===e,className:x(`flex w-full items-center gap-2 rounded-lt-sm px-2 py-1.5 text-left text-sm`,o===e&&`bg-lt-accent text-lt-accent-fg`),"data-test":`editor-block-${a.key}`,id:AO(t,a.key),onClick:()=>i(a),onMouseDown:e=>e.preventDefault(),onMouseMove:()=>r(o),role:`option`,type:`button`,children:[(0,q.jsx)(y,{className:`shrink-0 text-lt-muted-fg`,name:a.icon}),c(a.key,a.label)]})]},a.key))})}var MO=new z(`latticeSlashMenu`);function NO(e){return At.create({name:`latticeSlashMenu`,addProseMirrorPlugins(){return[OO({editor:this.editor,pluginKey:MO,char:e.char??`/`,allow:({editor:e})=>!e.isActive(`codeBlock`),items:()=>e.commands(),command:({editor:e,range:t,props:n})=>{e.chain().focus().deleteRange(t).run(),n.run(e)},render:()=>({onStart:t=>e.handle.current?.onStart(t),onUpdate:t=>e.handle.current?.onUpdate(t),onKeyDown:t=>e.handle.current?.onKeyDown(t)??!1,onExit:()=>e.handle.current?.onExit()})})]}})}function PO(e,t,n,r){let i=t.trim().toLowerCase();return e.filter(e=>e.isAvailable&&!e.isAvailable(n)?!1:i===``||[r(e.key,e.label),e.label,e.key,...e.keywords??[]].some(e=>e.toLowerCase().includes(i)))}var FO={placement:`left`,offset:4,flip:!1};function IO({editor:e,handleRef:t,translate:n,plusButton:r=!0}){let{t:i}=N(`lattice`),a=(0,B.useId)(),o=(0,B.useMemo)(()=>n??((e,t)=>i(`form.editor.${e}`,t)),[i,n]),[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(0),[d]=(0,B.useState)(()=>{let e=document.createElement(`div`);return e.className=`z-lt-popover`,e}),f=(0,B.useRef)(null),p=(0,B.useMemo)(()=>s?PO(s.items,s.query,e,o):[],[s,e,o]),m=(0,B.useRef)(p),h=(0,B.useRef)(l),g=(0,B.useRef)(s);return(0,B.useEffect)(()=>{m.current=p,h.current=l,g.current=s}),(0,B.useEffect)(()=>(t.current={onStart:e=>{c({items:e.items,query:e.query,command:e.command}),u(0),f.current=e.mount(d)},onUpdate:e=>{e.query!==g.current?.query&&u(0),c({items:e.items,query:e.query,command:e.command})},onKeyDown:({view:e,event:t})=>{if(t.key===`Escape`)return kO(e,MO),!0;let n=m.current;if(n.length===0)return!1;if(t.key===`ArrowDown`)return u(e=>Math.min(n.length-1,e+1)),!0;if(t.key===`ArrowUp`)return u(e=>Math.max(0,e-1)),!0;if(t.key===`Enter`){let e=n[h.current];return e&&g.current?.command(e),!0}return!1},onExit:()=>{f.current?.(),f.current=null,c(null)}},()=>{t.current=null,f.current?.(),f.current=null}),[d,t]),(0,B.useEffect)(()=>{let t=e.view.dom;if(!s){t.removeAttribute(`aria-controls`),t.removeAttribute(`aria-activedescendant`);return}t.setAttribute(`aria-controls`,a);let n=p[l];n?t.setAttribute(`aria-activedescendant`,AO(a,n.key)):t.removeAttribute(`aria-activedescendant`)},[s,p,l,e,a]),(0,q.jsxs)(q.Fragment,{children:[(0,rc.createPortal)(s&&(0,q.jsx)(jO,{activeIndex:l,id:a,items:p,onHighlight:u,onSelect:e=>s.command(e),translate:o}),d),r&&(0,q.jsx)(pO,{editor:e,options:FO,children:(0,q.jsx)(Gw,{icon:`plus`,label:i(`form.editor.add-block`,`Add block`),onClick:()=>e.chain().focus().insertContent(`/`).run(),testId:`editor-add-block`})})]})}function LO(e){if(Array.isArray(e))return e}function RO(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function zO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function BO(e,t){if(e){if(typeof e==`string`)return zO(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zO(e,t):void 0}}function VO(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
134
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function HO(e,t){return LO(e)||RO(e,t)||BO(e,t)||VO()}var UO=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bind=void 0;function t(e,t){var n=t.type,r=t.listener,i=t.options;return e.addEventListener(n,r,i),function(){e.removeEventListener(n,r,i)}}e.bind=t})),WO=n((e=>{var t=e&&e.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.bindAll=void 0;var n=UO();function r(e){if(e!==void 0)return typeof e==`boolean`?{capture:e}:e}function i(e,n){return n==null?e:t(t({},e),{options:t(t({},r(n)),r(e.options))})}function a(e,t,r){var a=t.map(function(t){var a=i(t,r);return(0,n.bind)(e,a)});return function(){a.forEach(function(e){return e()})}}e.bindAll=a})),GO=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bindAll=e.bind=void 0;var t=UO();Object.defineProperty(e,"bind",{enumerable:!0,get:function(){return t.bind}});var n=WO();Object.defineProperty(e,"bindAll",{enumerable:!0,get:function(){return n.bindAll}})}))(),KO=`data-pdnd-honey-pot`;function qO(e){return e instanceof Element&&e.hasAttribute(`data-pdnd-honey-pot`)}function JO(e){var t=HO(document.elementsFromPoint(e.x,e.y),2),n=t[0],r=t[1];return n?qO(n)?r??null:n:null}function YO(e){"@babel/helpers - typeof";return YO=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},YO(e)}function XO(e,t){if(YO(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(YO(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ZO(e){var t=XO(e,`string`);return YO(t)==`symbol`?t:t+``}function QO(e,t,n){return(t=ZO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $O=2147483647,ek={inset:`unset`,border:`none`,padding:0,margin:0,overflow:`visible`,color:`inherit`,background:`transparent`,width:`auto`,height:`auto`};function tk(e){var t=null;return function(){if(!t){var n=[...arguments];t={result:e.apply(this,n)}}return t.result}}var nk=tk(function(){return typeof HTMLElement<`u`&&typeof HTMLElement.prototype.showPopover==`function`});function rk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ik(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?rk(Object(n),!0).forEach(function(t){QO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rk(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ak=2,ok=ak/2;function sk(e){return{x:Math.floor(e.x),y:Math.floor(e.y)}}function ck(e){return{x:e.x-ok,y:e.y-ok}}function lk(e){return{x:Math.max(e.x,0),y:Math.max(e.y,0)}}function uk(e){return{x:Math.min(e.x,window.innerWidth-ak),y:Math.min(e.y,window.innerHeight-ak)}}function dk(e){var t=e.client,n=uk(lk(ck(sk(t))));return DOMRect.fromRect({x:n.x,y:n.y,width:ak,height:ak})}function fk(e){var t=e.clientRect;return{left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`}}function pk(e){var t=e.client,n=e.clientRect;return t.x>=n.x&&t.x<=n.x+n.width&&t.y>=n.y&&t.y<=n.y+n.height}function mk(e){var t=e.initial,n=document.createElement(`div`);n.setAttribute(KO,`true`),nk()&&n.setAttribute(`popover`,`manual`);var r=dk({client:t});Object.assign(n.style,ik(ik({position:`fixed`},nk()?ek:{zIndex:$O}),{},{backgroundColor:`transparent`,padding:0,margin:0,boxSizing:`border-box`,pointerEvents:`auto`},fk({clientRect:r}))),document.body.appendChild(n),nk()&&n.showPopover();var i=(0,GO.bind)(window,{type:`pointermove`,listener:function(e){r=dk({client:{x:e.clientX,y:e.clientY}}),Object.assign(n.style,fk({clientRect:r}))},options:{capture:!0}});return function(e){var t=e.current;if(i(),pk({client:t,clientRect:r})){n.remove();return}function a(){o(),n.remove()}var o=(0,GO.bindAll)(window,[{type:`pointerdown`,listener:a},{type:`pointermove`,listener:a},{type:`focusin`,listener:a},{type:`focusout`,listener:a},{type:`dragstart`,listener:a},{type:`dragenter`,listener:a},{type:`dragover`,listener:a}],{capture:!0})}}function hk(){var e=null;function t(){return e=null,(0,GO.bind)(window,{type:`pointermove`,listener:function(t){e={x:t.clientX,y:t.clientY}},options:{capture:!0}})}function n(){var t=null;return function(n){var r=n.eventName,i=n.payload;if(r===`onDragStart`){var a=i.location.initial.input;t=mk({initial:e??{x:a.clientX,y:a.clientY}})}if(r===`onDrop`){var o,s=i.location.current.input;(o=t)==null||o({current:{x:s.clientX,y:s.clientY}}),t=null,e=null}}}return{bindEvents:t,getOnPostDispatch:n}}function gk(e){if(Array.isArray(e))return zO(e)}function _k(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function vk(){throw TypeError(`Invalid attempt to spread non-iterable instance.
135
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yk(e){return gk(e)||_k(e)||BO(e)||vk()}var bk=tk(function(){return navigator.userAgent.includes(`Firefox`)}),xk=tk(function(){var e=navigator.userAgent;return e.includes(`AppleWebKit`)&&!e.includes(`Chrome`)}),Sk={isLeavingWindow:Symbol(`leaving`),isEnteringWindow:Symbol(`entering`)};function Ck(e){var t=e.dragLeave;return xk()?t.hasOwnProperty(Sk.isLeavingWindow):!1}(function(){if(typeof window>`u`||!xk())return;function e(){return{enterCount:0,isOverWindow:!1}}var t=e();function n(){t=e()}(0,GO.bindAll)(window,[{type:`dragstart`,listener:function(){t.enterCount=0,t.isOverWindow=!0}},{type:`drop`,listener:n},{type:`dragend`,listener:n},{type:`dragenter`,listener:function(e){!t.isOverWindow&&t.enterCount===0&&(e[Sk.isEnteringWindow]=!0),t.isOverWindow=!0,t.enterCount++}},{type:`dragleave`,listener:function(e){t.enterCount--,t.isOverWindow&&t.enterCount===0&&(e[Sk.isLeavingWindow]=!0,t.isOverWindow=!1)}}],{capture:!0})})();function wk(e){return`nodeName`in e}function Tk(e){return wk(e)&&e.ownerDocument!==document}function Ek(e){var t=e.dragLeave,n=t.type,r=t.relatedTarget;return n===`dragleave`?xk()?Ck({dragLeave:t}):r==null?!0:bk()?Tk(r):r instanceof HTMLIFrameElement:!1}function Dk(e){var t=e.onDragEnd;return[{type:`pointermove`,listener:function(){var e=0;return function(){if(e<20){e++;return}t()}}()},{type:`pointerdown`,listener:t}]}function Ok(e){return{altKey:e.altKey,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY}}var kk=function(e){var t=[],n=null,r=function(){t=[...arguments],!n&&(n=requestAnimationFrame(function(){n=null,e.apply(void 0,t)}))};return r.cancel=function(){n&&=(cancelAnimationFrame(n),null)},r}(function(e){return e()}),Ak=function(){var e=null;function t(t){e={frameId:requestAnimationFrame(function(){e=null,t()}),fn:t}}function n(){e&&=(cancelAnimationFrame(e.frameId),e.fn(),null)}return{schedule:t,flush:n}}();function jk(e){var t=e.source,n=e.initial,r=e.dispatchEvent,i={dropTargets:[]};function a(e){r(e),i={dropTargets:e.payload.location.current.dropTargets}}return{start:function(e){var r=e.nativeSetDragImage,o={current:n,previous:i,initial:n};a({eventName:`onGenerateDragPreview`,payload:{source:t,location:o,nativeSetDragImage:r}}),Ak.schedule(function(){a({eventName:`onDragStart`,payload:{source:t,location:o}})})},dragUpdate:function(e){var r=e.current;Ak.flush(),kk.cancel(),a({eventName:`onDropTargetChange`,payload:{source:t,location:{initial:n,previous:i,current:r}}})},drag:function(e){var r=e.current;kk(function(){Ak.flush(),a({eventName:`onDrag`,payload:{source:t,location:{initial:n,previous:i,current:r}}})})},drop:function(e){var r=e.current,o=e.updatedSourcePayload;Ak.flush(),kk.cancel(),a({eventName:`onDrop`,payload:{source:o??t,location:{current:r,previous:i,initial:n}}})}}}var Mk={isActive:!1};function Nk(){return!Mk.isActive}function Pk(e){return e.dataTransfer?e.dataTransfer.setDragImage.bind(e.dataTransfer):null}function Fk(e){var t=e.current,n=e.next;if(t.length!==n.length)return!0;for(var r=0;r<t.length;r++)if(t[r].element!==n[r].element)return!0;return!1}function Ik(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=e.dispatchEvent;if(!Nk())return;var a=Rk({event:t,dragType:n,getDropTargetsOver:r});Mk.isActive=!0;var o={current:a};Lk({event:t,current:a.dropTargets});var s=jk({source:n.payload,dispatchEvent:i,initial:a});function c(e){var t=Fk({current:o.current.dropTargets,next:e.dropTargets});o.current=e,t&&s.dragUpdate({current:o.current})}function l(e){var t=Ok(e),i=r({target:qO(e.target)?JO({x:t.clientX,y:t.clientY}):e.target,input:t,source:n.payload,current:o.current.dropTargets});i.length&&(e.preventDefault(),Lk({event:e,current:i})),c({dropTargets:i,input:t})}function u(){o.current.dropTargets.length&&c({dropTargets:[],input:o.current.input}),s.drop({current:o.current,updatedSourcePayload:null}),d()}function d(){Mk.isActive=!1,f()}var f=(0,GO.bindAll)(window,[{type:`dragover`,listener:function(e){l(e),s.drag({current:o.current})}},{type:`dragenter`,listener:l},{type:`dragleave`,listener:function(e){Ek({dragLeave:e})&&(c({input:o.current.input,dropTargets:[]}),n.startedFrom===`external`&&u())}},{type:`drop`,listener:function(e){if(o.current={dropTargets:o.current.dropTargets,input:Ok(e)},!o.current.dropTargets.length){u();return}e.preventDefault(),Lk({event:e,current:o.current.dropTargets}),s.drop({current:o.current,updatedSourcePayload:n.type===`external`?n.getDropPayload(e):null}),d()}},{type:`dragend`,listener:function(e){o.current={dropTargets:o.current.dropTargets,input:Ok(e)},u()}}].concat(yk(Dk({onDragEnd:u}))),{capture:!0});s.start({nativeSetDragImage:Pk(t)})}function Lk(e){var t=e.event,n=e.current[0]?.dropEffect;n!=null&&t.dataTransfer&&(t.dataTransfer.dropEffect=n)}function Rk(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=Ok(t);return n.startedFrom===`external`?{input:i,dropTargets:[]}:{input:i,dropTargets:r({input:i,source:n.payload,target:t.target,current:[]})}}var zk={canStart:Nk,start:Ik},Bk=new Map;function Vk(e){var t=e.typeKey,n=e.mount,r=Bk.get(t);if(r)return r.usageCount++,r;var i={typeKey:t,unmount:n(),usageCount:1};return Bk.set(t,i),i}function Hk(e){var t=Vk(e);return function(){t.usageCount--,!(t.usageCount>0)&&(t.unmount(),Bk.delete(e.typeKey))}}function Uk(){var e=[...arguments];return function(){e.forEach(function(e){return e()})}}function Wk(e,t){var n=t.attribute,r=t.value;return e.setAttribute(n,r),function(){return e.removeAttribute(n)}}function Gk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Kk(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Gk(Object(n),!0).forEach(function(t){QO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gk(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qk(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=Jk(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
136
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function Jk(e,t){if(e){if(typeof e==`string`)return Yk(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yk(e,t):void 0}}function Yk(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Xk(e){return e.slice(0).reverse()}function Zk(e){var t=e.typeKey,n=e.defaultDropEffect,r=new WeakMap,i=`data-drop-target-for-${t}`,a=`[${i}]`;function o(e){return r.set(e.element,e),function(){return r.delete(e.element)}}function s(e){return tk(Uk(Wk(e.element,{attribute:i,value:`true`}),o(e)))}function c(e){var t=e.source,i=e.target,o=e.input,s=e.result,l=s===void 0?[]:s;if(i==null)return l;if(!(i instanceof Element))return i instanceof Node?c({source:t,target:i.parentElement,input:o,result:l}):l;var u=i.closest(a);if(u==null)return l;var d=r.get(u);if(d==null)return l;var f={input:o,source:t,element:d.element};if(d.canDrop&&!d.canDrop(f))return c({source:t,target:d.element.parentElement,input:o,result:l});var p=d.getData?.call(d,f)??{},m=d.getDropEffect?.call(d,f)??n,h={data:p,element:d.element,dropEffect:m,isActiveDueToStickiness:!1};return c({source:t,target:d.element.parentElement,input:o,result:[].concat(yk(l),[h])})}function l(e){var t=e.eventName,n=e.payload,i=qk(n.location.current.dropTargets),a;try{for(i.s();!(a=i.n()).done;){var o,s=a.value,c=r.get(s.element),l=Kk(Kk({},n),{},{self:s});c==null||(o=c[t])==null||o.call(c,l)}}catch(e){i.e(e)}finally{i.f()}}var u={onGenerateDragPreview:l,onDrag:l,onDragStart:l,onDrop:l,onDropTargetChange:function(e){var t=e.payload,n=new Set(t.location.current.dropTargets.map(function(e){return e.element})),i=new Set,a=qk(t.location.previous.dropTargets),o;try{for(a.s();!(o=a.n()).done;){var s,c=o.value;i.add(c.element);var l=r.get(c.element),u=n.has(c.element),d=Kk(Kk({},t),{},{self:c});if(l==null||(s=l.onDropTargetChange)==null||s.call(l,d),!u){var f;l==null||(f=l.onDragLeave)==null||f.call(l,d)}}}catch(e){a.e(e)}finally{a.f()}var p=qk(t.location.current.dropTargets),m;try{for(p.s();!(m=p.n()).done;){var h,g,_=m.value;if(!i.has(_.element)){var v=Kk(Kk({},t),{},{self:_}),y=r.get(_.element);y==null||(h=y.onDropTargetChange)==null||h.call(y,v),y==null||(g=y.onDragEnter)==null||g.call(y,v)}}}catch(e){p.e(e)}finally{p.f()}}};function d(e){u[e.eventName](e)}function f(e){var t=e.source,n=e.target,i=e.input,a=e.current,o=c({source:t,target:n,input:i});if(o.length>=a.length)return o;for(var s=Xk(a),l=Xk(o),u=[],d=0;d<s.length;d++){var f,p=s[d],m=l[d];if(m!=null){u.push(m);continue}var h=u[d-1],g=s[d-1];if(h?.element!==g?.element)break;var _=r.get(p.element);if(!_)break;var v={input:i,source:t,element:_.element};if(_.canDrop&&!_.canDrop(v)||!((f=_.getIsSticky)!=null&&f.call(_,v)))break;u.push(Kk(Kk({},p),{},{isActiveDueToStickiness:!0}))}return Xk(u)}return{dropTargetForConsumers:s,getIsOver:f,dispatchEvent:d}}function Qk(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=$k(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
137
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function $k(e,t){if(e){if(typeof e==`string`)return eA(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?eA(e,t):void 0}}function eA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function nA(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?tA(Object(n),!0).forEach(function(t){QO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tA(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function rA(){var e=new Set,t=null;function n(e){t&&(!e.canMonitor||e.canMonitor(t.canMonitorArgs))&&t.active.add(e)}function r(r){var i=nA({},r);e.add(i),n(i);function a(){e.delete(i),t&&t.active.delete(i)}return tk(a)}function i(r){var i=r.eventName,a=r.payload;if(i===`onGenerateDragPreview`){t={canMonitorArgs:{initial:a.location.initial,source:a.source},active:new Set};var o=Qk(e),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;n(c)}}catch(e){o.e(e)}finally{o.f()}}if(t){for(var l=Array.from(t.active),u=0,d=l;u<d.length;u++){var f=d[u];if(t.active.has(f)){var p;(p=f[i])==null||p.call(f,a)}}i===`onDrop`&&(t.active.clear(),t=null)}}return{dispatchEvent:i,monitorForConsumers:r}}function iA(e){var t=e.typeKey,n=e.mount,r=e.dispatchEventToSource,i=e.onPostDispatch,a=e.defaultDropEffect,o=rA(),s=Zk({typeKey:t,defaultDropEffect:a});function c(e){r?.(e),s.dispatchEvent(e),o.dispatchEvent(e),i?.(e)}function l(e){var t=e.event,n=e.dragType;zk.start({event:t,dragType:n,getDropTargetsOver:s.getIsOver,dispatchEvent:c})}function u(){function e(){return n({canStart:zk.canStart,start:l})}return Hk({typeKey:t,mount:e})}return{registerUsage:u,dropTarget:s.dropTargetForConsumers,monitor:o.monitorForConsumers}}var aA=tk(function(){return navigator.userAgent.toLocaleLowerCase().includes(`android`)}),oA=`pdnd:android-fallback`,sA=`text/plain`,cA=`application/vnd.pdnd`,lA=new WeakMap;function uA(e){return lA.set(e.element,e),function(){lA.delete(e.element)}}var dA=hk(),fA=iA({typeKey:`element`,defaultDropEffect:`move`,mount:function(e){return Uk(dA.bindEvents(),(0,GO.bind)(document,{type:`dragstart`,listener:function(t){if(e.canStart(t)&&!t.defaultPrevented&&t.dataTransfer){var n=t.target;if(n instanceof HTMLElement){var r=lA.get(n);if(r){var i=Ok(t),a={element:r.element,dragHandle:r.dragHandle??null,input:i};if(r.canDrag&&!r.canDrag(a)){t.preventDefault();return}if(r.dragHandle){var o=JO({x:i.clientX,y:i.clientY});if(!r.dragHandle.contains(o)){t.preventDefault();return}}var s=r.getInitialDataForExternal?.call(r,a)??null;if(s)for(var c=0,l=Object.entries(s);c<l.length;c++){var u=HO(l[c],2),d=u[0],f=u[1];t.dataTransfer.setData(d,f??``)}aA()&&!t.dataTransfer.types.includes(`text/plain`)&&!t.dataTransfer.types.includes(`text/uri-list`)&&t.dataTransfer.setData(sA,oA),t.dataTransfer.setData(cA,``);var p={type:`element`,payload:{element:r.element,dragHandle:r.dragHandle??null,data:r.getInitialData?.call(r,a)??{}},startedFrom:`internal`};e.start({event:t,dragType:p})}}}}}))},dispatchEventToSource:function(e){var t,n,r=e.eventName,i=e.payload;(t=lA.get(i.source.element))==null||(n=t[r])==null||n.call(t,i)},onPostDispatch:dA.getOnPostDispatch()}),pA=fA.dropTarget,mA=fA.monitor;function hA(e){return tk(Uk(fA.registerUsage(),uA(e),Wk(e.element,{attribute:`draggable`,value:`true`})))}function gA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _A(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?gA(Object(n),!0).forEach(function(t){QO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gA(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function vA(){return{x:0,y:0}}function yA(e){var t=e.render,n=e.nativeSetDragImage,r=e.getOffset,i=r===void 0?vA:r,a=document.createElement(`div`);nk()&&a.setAttribute(`popover`,`manual`),Object.assign(a.style,_A(_A({position:`fixed`},nk()?ek:{zIndex:$O}),{},{top:0,left:0,pointerEvents:`none`})),document.body.append(a),nk()&&a.showPopover();var o=t({container:a});queueMicrotask(function(){var e=i({container:a});if(xk()){var t=a.getBoundingClientRect();if(t.width===0)return;a.style.left=`-${t.width-1e-4}px`}n?.(a,e.x,e.y)});function s(){c(),o?.(),document.body.removeChild(a)}var c=mA({onDragStart:s,onDrop:s})}function bA(e){var t=e.element,n=e.input;return function(e){var r=e.container,i=t.getBoundingClientRect(),a=r.getBoundingClientRect();return{x:Math.min(n.clientX-i.x,a.width),y:Math.min(n.clientY-i.y,a.height)}}}function xA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function SA(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?xA(Object(n),!0).forEach(function(t){QO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xA(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var CA={top:function(e,t){return Math.abs(t.y-e.top)},right:function(e,t){return Math.abs(e.right-t.x)},bottom:function(e,t){return Math.abs(e.bottom-t.y)},left:function(e,t){return Math.abs(t.x-e.left)}},wA=Symbol(`closestEdge`);function TA(e,t){var n=t.element,r=t.input,i=t.allowedEdges,a={x:r.clientX,y:r.clientY},o=n.getBoundingClientRect(),s=i.map(function(e){return{edge:e,value:CA[e](o,a)}}).sort(function(e,t){return e.value-t.value})[0]?.edge??null;return SA(SA({},e),{},QO({},wA,s))}function EA(e){return e[wA]??null}function DA(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function OA(e,t){if(e==null)return{};var n,r,i=DA(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function kA(e,t){var n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(function(n){return Object.is(e[n],t[n])})}function AA(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:kA,t=null;return function(n){return t&&e(t.value,n)||(t={value:n}),t.value}}var jA=[`block`];function MA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function NA(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?MA(Object(n),!0).forEach(function(t){QO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):MA(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var PA=Symbol(`tree-item-instruction`);function FA(e){return{x:(e.right+e.left)/2,y:(e.bottom+e.top)/2}}function IA(e){var t=e.client,n=e.borderBox,r=n.height/4;return t.y<=n.top+r?`reorder-above`:t.y>=n.bottom-r?`reorder-below`:`make-child`}function LA(e){var t=e.element,n=e.input,r=e.currentLevel,i=e.indentPerLevel,a=e.mode,o={x:n.clientX,y:n.clientY},s=t.getBoundingClientRect();if(a===`standard`)return{type:IA({borderBox:s,client:o}),indentPerLevel:i,currentLevel:r};var c=FA(s);if(a===`expanded`){var l=IA({borderBox:s,client:o});return{type:l===`reorder-above`?l:`make-child`,indentPerLevel:i,currentLevel:r}}var u=i*r;if(o.x<s.left+u){if(o.y<c.y)return{type:`reorder-above`,indentPerLevel:i,currentLevel:r};var d=(o.x-s.left)/i;return{type:`reparent`,desiredLevel:Math.max(Math.floor(d),0),indentPerLevel:i,currentLevel:r}}return{type:IA({borderBox:s,client:o}),indentPerLevel:i,currentLevel:r}}function RA(e,t){return e.type===t.type?e.type===`instruction-blocked`&&t.type===`instruction-blocked`?RA(e.desired,t.desired):kA(e,t):!1}var zA=AA(RA);function BA(e){var t=e.desired,n=e.block;return n!=null&&n.includes(t.type)&&t.type!==`instruction-blocked`?{type:`instruction-blocked`,desired:t}:t}function VA(e,t){var n=t.block,r=zA(BA({desired:LA(OA(t,jA)),block:n}));return NA(NA({},e),{},QO({},PA,r))}function HA(e){return e[PA]??null}function UA(e){var t=e.startIndex,n=e.closestEdgeOfTarget,r=e.indexOfTarget,i=e.axis;if(t===-1||r===-1||t===r)return t;if(n==null)return r;var a=i===`vertical`&&n===`bottom`||i===`horizontal`&&n===`right`;return t<r?a?r:r-1:a?r+1:r}var WA=1e3,GA=null,KA=`1px`,qA={width:KA,height:KA,padding:`0`,position:`absolute`,border:`0`,clip:`rect(${KA}, ${KA}, ${KA}, ${KA})`,overflow:`hidden`,whiteSpace:`nowrap`,marginTop:`-${KA}`,pointerEvents:`none`};function JA(){var e=document.createElement(`div`);return e.setAttribute(`role`,`status`),Object.assign(e.style,qA),document.body.append(e),e}function YA(){return GA===null&&(GA=JA()),GA}var XA=null;function ZA(){XA!==null&&clearTimeout(XA),XA=null}function QA(e){YA(),ZA(),XA=setTimeout(function(){XA=null;var t=YA();t.textContent=e},WA)}var $A=new Map,ej=new Set;function tj(e){nj(e);var t=$A.get(e);if(t)return t;var n={timeOfEngagementStart:Date.now()};return $A.set(e,n),n}function nj(e){ej.add(e)}function rj(e){ej.clear(),e(),$A.forEach(function(e,t){ej.has(t)||$A.delete(t)}),ej.clear()}function ij(){$A.clear()}var aj=new Map;function oj(e){var t=aj.get(e);if(t)return t;var n=sj(e);return aj.set(e,n),n}function sj(e){var t={type:`idle`},n=[];function r(e){if(t.type===`running`){var i=e-t.timeLastFrameFinished,a=t.latestArgs,o=JO({x:a.location.current.input.clientX,y:a.location.current.input.clientY});rj(function(){n.forEach(function(e){return e({underUsersPointer:o,latestArgs:a,timeSinceLastFrame:i})})}),t.timeLastFrameFinished=e,t.frameId=requestAnimationFrame(r)}}function i(){t.type!==`idle`&&(cancelAnimationFrame(t.frameId),ij(),t={type:`idle`})}function a(e){t.type===`idle`&&(t={type:`initializing`,latestArgs:e,frameId:requestAnimationFrame(function(e){t.type===`initializing`&&(t={type:`running`,timeLastFrameFinished:e,latestArgs:t.latestArgs,frameId:requestAnimationFrame(r)})})})}function o(e){if(t.type===`idle`){a(e);return}t.latestArgs=e}return e({onDragStart:a,onDropTargetChange:o,onDrag:o,onDrop:i}),{onFrame:function(e){n.push(e)}}}var cj=`data-auto-scrollable`,lj=`[${cj}="true"]`;function uj(e){return e.setAttribute(cj,`true`),function(){return e.removeAttribute(cj)}}function dj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fj(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?dj(Object(n),!0).forEach(function(t){QO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var pj={startHitboxAtPercentageRemainingOfElement:{top:.25,right:.25,bottom:.25,left:.25},maxScrollAtPercentageRemainingOfHitbox:{top:.5,right:.5,bottom:.5,left:.5},timeDampeningDurationMs:400,maxMainAxisHitboxSize:180},mj={standard:900,fast:1500};function hj(e){return fj(fj({},pj),{},{maxPixelScrollPerSecond:mj[e?.maxScrollSpeed??`standard`]})}var gj={top:function(e){return e.scrollTop>0},right:function(e){return Math.ceil(e.scrollLeft)+e.clientWidth<e.scrollWidth},bottom:function(e){return Math.ceil(e.scrollTop)+e.clientHeight<e.scrollHeight},left:function(e){return e.scrollLeft>0}},_j=[`top`,`right`,`bottom`,`left`],vj={top:`vertical`,right:`horizontal`,bottom:`vertical`,left:`horizontal`},yj={start:`top`,end:`bottom`,point:`y`,size:`height`},bj={start:`left`,end:`right`,point:`x`,size:`width`},xj={vertical:{mainAxis:yj,crossAxis:bj},horizontal:{mainAxis:bj,crossAxis:yj}},Sj={top:`start`,right:`end`,bottom:`end`,left:`start`};function Cj(e){var t=e.edge,n=e.axis;return function(e){var r=e.clientRect,i=e.config,a=xj[n],o=a.mainAxis,s=a.crossAxis,c=Sj[t],l=Math.min(i.startHitboxAtPercentageRemainingOfElement[t]*r[o.size],i.maxMainAxisHitboxSize);return DOMRect.fromRect(QO(QO(QO(QO({},o.point,c===`start`?r[o.point]:r[o.point]+r[o.size]-l),s.point,r[s.point]),o.size,l),s.size,r[s.size]))}}var wj={top:Cj({axis:`vertical`,edge:`top`}),right:Cj({axis:`horizontal`,edge:`right`}),bottom:Cj({axis:`vertical`,edge:`bottom`}),left:Cj({axis:`horizontal`,edge:`left`})};function Tj(e){var t=e.startOfRange,n=e.endOfRange,r=e.value;if(!(t<n)||r<t)return 0;if(r>n)return 1;var i=n-t;return(r-t)/i}function Ej(e){var t=e.timeSinceLastFrame,n=e.config,r=n.maxPixelScrollPerSecond/1e3,i=Math.ceil(r*t),a=n.maxPixelScrollPerSecond/60;return Math.min(i,a)}function Dj(e){var t=e.client,n=e.axis,r=e.edge,i=e.hitbox,a=e.config,o=xj[n].mainAxis,s=Sj[r],c=i[o.size]*a.maxScrollAtPercentageRemainingOfHitbox[r];return s===`end`?Tj({startOfRange:i[o.start],endOfRange:i[o.end]-c,value:t[o.point]}):1-Tj({startOfRange:i[o.start]+c,endOfRange:i[o.end],value:t[o.point]})}function Oj(e){var t=e.client,n=e.timeSinceLastFrame,r=e.engagement,i=e.axis,a=e.hitbox,o=e.edge,s=e.isDistanceDampeningEnabled,c=e.config,l=Ej({timeSinceLastFrame:n,config:c}),u=(s?Dj({client:t,edge:o,hitbox:a,axis:i,config:c}):1)*Tj({startOfRange:r.timeOfEngagementStart,endOfRange:r.timeOfEngagementStart+c.timeDampeningDurationMs,value:Date.now()}),d=Math.max(l*u,1);return Sj[o]===`end`?d:-1*d}function kj(e,t){return t===`all`||e===t}function Aj(e){var t=e.client,n=e.clientRect;return t.x>=n.x&&t.x<=n.x+n.width&&t.y>=n.y&&t.y<=n.y+n.height}function jj(e){return e.getBoundingClientRect()}function Mj(e){var t=e.element,n=e.input,r=e.timeSinceLastFrame,i=e.engagement,a=e.config,o=e.allowedAxis,s=e.getRect,c=s===void 0?jj:s,l={x:n.clientX,y:n.clientY},u=c(t),d=_j.reduce(function(e,n){var r=wj[n]({clientRect:u,config:a}),i=vj[n];return!kj(i,o)||!Aj({client:l,clientRect:r})||!gj[n](t)||e.set(n,{edge:n,hitbox:r}),e},new Map);return{left:function(){var e=`horizontal`,t=d.get(`left`);if(t)return Oj({client:l,edge:t.edge,hitbox:t.hitbox,axis:e,timeSinceLastFrame:r,engagement:i,isDistanceDampeningEnabled:!0,config:a});var n=d.get(`right`);return n?Oj({client:l,edge:n.edge,hitbox:n.hitbox,axis:e,timeSinceLastFrame:r,engagement:i,isDistanceDampeningEnabled:!0,config:a}):0}(),top:function(){var e=`vertical`,t=d.get(`bottom`);if(t)return Oj({client:l,edge:t.edge,hitbox:t.hitbox,axis:e,timeSinceLastFrame:r,engagement:i,isDistanceDampeningEnabled:!0,config:a});var n=d.get(`top`);return n?Oj({client:l,edge:n.edge,hitbox:n.hitbox,axis:e,timeSinceLastFrame:r,engagement:i,isDistanceDampeningEnabled:!0,config:a}):0}()}}function Nj(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=Pj(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
138
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function Pj(e,t){if(e){if(typeof e==`string`)return Fj(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fj(e,t):void 0}}function Fj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ij(e){return!!(e.top||e.left)}function Lj(e){var t=e.target,n=e.input,r=e.source,i=e.findEntry,a=e.timeSinceLastFrame,o=e.available,s=o===void 0?{top:!0,left:!0}:o;if(!Ij(s)||!t)return s;var c=t.closest(lj);if(!c)return s;var l=i(c);if(!l)return s;function u(){return Lj({target:c?.parentElement??null,findEntry:i,source:r,timeSinceLastFrame:a,input:n,available:s})}var d={input:n,source:r,element:c};if(l.canScroll&&!l.canScroll(d))return u();var f=tj(c),p=hj(l.getConfiguration?.call(l,d)),m=Mj({element:c,engagement:f,input:n,timeSinceLastFrame:a,allowedAxis:l.getAllowedAxis?.call(l,d)??`all`,config:p}),h={top:0,left:0};return s.top&&m.top!==0&&(h.top=m.top,s.top=!1),s.left&&m.left!==0&&(h.left=m.left,s.left=!1),(h.top!==0||h.left!==0)&&c.scrollBy(h),u()}function Rj(e){var t=e.input,n=e.timeSinceLastFrame,r=e.available,i=e.source,a=e.entries,o=document.documentElement,s={input:t,source:i,element:o},c=Nj(a),l;try{for(c.s();!(l=c.n()).done;){var u=l.value;if(!(u.canScroll&&!u.canScroll(s))){var d=Mj({element:o,engagement:tj(o),input:t,config:hj(u.getConfiguration?.call(u,s)),allowedAxis:u.getAllowedAxis?.call(u,s)??`all`,getRect:function(e){return DOMRect.fromRect({y:0,x:0,width:e.clientWidth,height:e.clientHeight})},timeSinceLastFrame:n}),f={top:r.top?d.top:0,left:r.left?d.left:0};(f.top!==0||f.left!==0)&&o.scrollBy(f);break}}}catch(e){c.e(e)}finally{c.f()}}function zj(e){var t=e.input,n=e.findEntry,r=e.timeSinceLastFrame,i=e.source,a=e.getWindowScrollEntries,o=e.underUsersPointer,s=Lj({target:o,timeSinceLastFrame:r,input:t,source:i,findEntry:n});Ij(s)&&Rj({input:t,source:i,entries:a(),timeSinceLastFrame:r,available:s})}function Bj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vj(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Bj(Object(n),!0).forEach(function(t){QO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hj(e){var t=e.monitor,n=new Map,r=new Set;function i(e){return n.set(e.element,e),tk(Uk(uj(e.element),function(){return n.delete(e.element)}))}function a(){var e=Vj({},arguments.length>0&&arguments[0]!==void 0?arguments[0]:{});r.add(e);function t(){r.delete(e)}return tk(t)}function o(e){return n.get(e)??null}function s(){return Array.from(r)}function c(e){var t=e.latestArgs,n=e.underUsersPointer,r=e.timeSinceLastFrame;zj({input:t.location.current.input,source:t.source,findEntry:o,underUsersPointer:n,timeSinceLastFrame:r,getWindowScrollEntries:s})}return oj(t).onFrame(c),{autoScroll:i,autoScrollWindow:a}}var Uj=Hj({monitor:mA}),Wj=Uj.autoScroll;Uj.autoScrollWindow;function Gj(e,t){let n=n=>{let r=n.target,i=e.ownerDocument.activeElement;(r instanceof Element&&t(r)||i!==null&&e.contains(i)&&t(i))&&n.preventDefault()};return e.addEventListener(`dragstart`,n,!0),()=>e.removeEventListener(`dragstart`,n,!0)}export{Ay as $,dn as $n,Mu as $t,Pw as A,Uc as An,zp as At,uw as B,Er as Bn,Gd as Bt,Uw as C,J as Cn,Uh as Ct,zw as D,Qc as Dn,Lm as Dt,Ww as E,Kc as En,Um as Et,yw as F,Ir as Fn,mf as Ft,vx as G,fr as Gn,Nd as Gt,JC as H,Sr as Hn,Rd as Ht,Sw as I,Pr as In,ff as It,Fb as J,xn as Jn,jd as Jt,Gb as K,cr as Kn,Md as Kt,gw as L,Nr as Ln,rf as Lt,Ow as M,Gr as Mn,Jf as Mt,xw as N,Br as Nn,Ff as Nt,Lw as O,Hc as On,Fm as Ot,bw as P,Lr as Pn,Pf as Pt,jy as Q,yn as Qn,Ru as Qt,pw as R,Ar as Rn,ef as Rt,Rw as S,Nl as Sn,Gh as St,Hw as T,el as Tn,Wm as Tt,Sx as U,br as Un,Fd as Ut,fw as V,Cr as Vn,Vd as Vt,bx as W,gr as Wn,Od as Wt,Ry as X,Sn as Xn,Vu as Xt,By as Y,V as Yn,Xu as Yt,My as Z,mn as Zn,Hu as Zt,MO as _,zl as _n,Eg as _t,VA as a,fu as an,$_ as at,Zw as b,Rl as bn,Xh as bt,EA as c,nu as cn,Z_ as ct,hA as d,Q as dn,M_ as dt,Au as en,Sy as et,pA as f,Jl as fn,P_ as ft,PO as g,Bl as gn,Og as gt,IO as h,Ul as hn,Kg as ht,UA as i,lu as in,Zv as it,Nw as j,K as jn,Mp as jt,Iw as k,zc as kn,Sm as kt,bA as l,iu as ln,J_ as lt,Uk as m,Gl as mn,Ug as mt,Wj as n,Eu as nn,vy as nt,HA as o,ou as on,Q_ as ot,mA as p,Kl as pn,a_ as pt,Ub as q,En as qn,Pd as qt,QA as r,su as rn,$v as rt,TA as s,ru as sn,q_ as st,Gj as t,Su as tn,gy as tt,yA as u,au as un,D_ as ut,NO as v,Ll as vn,Dg as vt,Vw as w,tl as wn,ah as wt,Gw as x,Ml as xn,Kh as xt,ID as y,X as yn,ag as yt,dw as z,Or as zn,Kd as zt};