import{X as M,m as p,M as D,ai as j,aj as b,ak as T,al as C,O as I,_ as $,i as z,Z as G,L as H,h as U,am as Z,H as W,an as A,y as E,x as L,o as h,ao as N,ap as S,q as J,aq as K,ar as Q,as as ee,at as te,au as re,j as ae,p as ne,b as oe,a as ie}from"./CioMtalE.js";import{d as se}from"./8I6xAQmg.js";function ge(e){return e.endsWith("capture")&&e!=="gotpointercapture"&&e!=="lostpointercapture"}const ue=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Ee(e){return ue.includes(e)}const le={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function me(e){return e=e.toLowerCase(),le[e]??e}const ce=["touchstart","touchmove"];function de(e){return ce.includes(e)}const fe=["textarea","script","style","title"];function we(e){return fe.includes(e)}function be(e,t){if(t){const r=document.body;e.autofocus=!0,M(()=>{document.activeElement===r&&e.focus()})}}function Te(e){p&&D(e)!==null&&j(e)}let V=!1;function _e(){V||(V=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const r of e.target.elements)(t=r.__on_r)==null||t.call(r)})},{capture:!0}))}function q(e){var t=C,r=I;b(null),T(null);try{return e()}finally{b(t),T(r)}}function Le(e,t,r,n=r){e.addEventListener(t,()=>q(r));const o=e.__on_r;o?e.__on_r=()=>{o(),n(!0)}:e.__on_r=()=>n(!0),_e()}const x=new Set,R=new Set;function B(e,t,r,n={}){function o(a){if(n.capture||m.call(t,a),!a.cancelBubble)return q(()=>r==null?void 0:r.call(this,a))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?M(()=>{t.addEventListener(e,o,n)}):t.addEventListener(e,o,n),o}function ke(e,t,r,n={}){var o=B(t,e,r,n);return()=>{e.removeEventListener(t,o,n)}}function Se(e,t,r,n,o){var a={capture:n,passive:o},l=B(e,t,r,a);(t===document.body||t===window||t===document)&&G(()=>{t.removeEventListener(e,l,a)})}function Ae(e){for(var t=0;t<e.length;t++)x.add(e[t]);for(var r of R)r(e)}function m(e){var P;var t=this,r=t.ownerDocument,n=e.type,o=((P=e.composedPath)==null?void 0:P.call(e))||[],a=o[0]||e.target,l=0,v=e.__root;if(v){var f=o.indexOf(v);if(f!==-1&&(t===document||t===window)){e.__root=t;return}var y=o.indexOf(t);if(y===-1)return;f<=y&&(l=f)}if(a=o[l]||e.target,a!==t){$(e,"currentTarget",{configurable:!0,get(){return a||r}});var k=C,c=I;b(null),T(null);try{for(var i,s=[];a!==null;){var d=a.assignedSlot||a.parentNode||a.host||null;try{var _=a["__"+n];if(_!=null&&(!a.disabled||e.target===a))if(z(_)){var[Y,...X]=_;Y.apply(a,[e,...X])}else _.call(a,e)}catch(w){i?s.push(w):i=w}if(e.cancelBubble||d===t||d===null)break;a=d}if(i){for(let w of s)queueMicrotask(()=>{throw w});throw i}}finally{e.__root=t,delete e.currentTarget,b(k),T(c)}}}let u;function he(){u=void 0}function Ne(e){let t=null,r=p;var n;if(p){for(t=h,u===void 0&&(u=D(document.head));u!==null&&(u.nodeType!==8||u.data!==W);)u=A(u);u===null?E(!1):u=L(A(u))}p||(n=document.head.appendChild(H()));try{U(()=>e(n),Z)}finally{r&&(E(!0),u=h,L(t))}}function Re(e,t){var r=t==null?"":typeof t=="object"?t+"":t;r!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=r,e.nodeValue=r+"")}function pe(e,t){return F(e,t)}function Oe(e,t){N(),t.intro=t.intro??!1;const r=t.target,n=p,o=h;try{for(var a=D(r);a&&(a.nodeType!==8||a.data!==W);)a=A(a);if(!a)throw S;E(!0),L(a),J();const l=F(e,{...t,anchor:a});if(h===null||h.nodeType!==8||h.data!==K)throw Q(),S;return E(!1),l}catch(l){if(l===S)return t.recover===!1&&ee(),N(),j(r),E(!1),pe(e,t);throw l}finally{E(n),L(o),he()}}const g=new Map;function F(e,{target:t,anchor:r,props:n={},events:o,context:a,intro:l=!0}){N();var v=new Set,f=c=>{for(var i=0;i<c.length;i++){var s=c[i];if(!v.has(s)){v.add(s);var d=de(s);t.addEventListener(s,m,{passive:d});var _=g.get(s);_===void 0?(document.addEventListener(s,m,{passive:d}),g.set(s,1)):g.set(s,_+1)}}};f(te(x)),R.add(f);var y=void 0,k=re(()=>{var c=r??t.appendChild(H());return ae(()=>{if(a){ne({});var i=oe;i.c=a}o&&(n.$$events=o),p&&se(c,null),y=e(c,n)||{},p&&(I.nodes_end=h),a&&ie()}),()=>{var d;for(var i of v){t.removeEventListener(i,m);var s=g.get(i);--s===0?(document.removeEventListener(i,m),g.delete(i)):g.set(i,s)}R.delete(f),c!==r&&((d=c.parentNode)==null||d.removeChild(c))}});return O.set(y,k),y}let O=new WeakMap;function De(e,t){const r=O.get(e);return r?(O.delete(e),r(t)):Promise.resolve()}export{be as a,_e as b,B as c,Ae as d,Ee as e,Ne as f,Se as g,Oe as h,ge as i,we as j,Le as l,pe as m,me as n,ke as o,Te as r,Re as s,De as u};
