vde-open 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/cli.js +10 -15
- package/dist/daemon.js +2 -2
- package/dist/{main-DwpMMOjm.js → main-BI-4X6_3.js} +32 -166
- package/dist/{search-index-B7DqaWh6.js → search-index-NiN4l6Hg.js} +1 -11
- package/dist/web/assets/{index-DIyamSNh.js → index-DOobMckY.js} +51 -51
- package/dist/web/assets/index-HOxygmIG.css +2 -0
- package/dist/web/index.html +2 -2
- package/dist/workers/search-worker.js +1 -1
- package/package.json +1 -1
- package/skills/vde-open/SKILL.md +1 -1
- package/dist/web/assets/index-Cnw68UWf.css +0 -2
|
@@ -60,87 +60,87 @@ Error generating stack: `+e.message+`
|
|
|
60
60
|
|
|
61
61
|
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Dt,c=!wn.jitless,l=c&&Ot.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?ea([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function ra(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!qt(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Qt(e,r,Tn())))}),t)}var ia=W(`$ZodUnion`,(e,t)=>{ei.init(e,t),mn(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),mn(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),mn(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),mn(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>mt(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>ra(t,r,e,i)):ra(o,r,e,i)}});function aa(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var oa=W(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,ia.init(e,t);let n=e._zod.parse;mn(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||gt(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=_t(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=ft(()=>aa(t));e._zod.parse=(i,a)=>{let o=i.value;if(!Dt(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),sa=W(`$ZodIntersection`,(e,t)=>{ei.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>la(e,t,n)):la(e,i,a)}});function ca(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(kt(e)&&kt(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=ca(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=ca(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function la(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=ca(t.value,n.value);if(!c.valid){if(qt(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var ua=W(`$ZodRecord`,(e,t)=>{ei.init(e,t);let n=wn.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!kt(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Qt(e,i,Tn())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Yt(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Yt(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Ar.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Qt(e,i,Tn())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Yt(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Yt(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),da=W(`$ZodEnum`,(e,t)=>{ei.init(e,t);let n=ct(t.entries),r=new Set(n);e._zod.values=r,mn(e,`pattern`,e=>{let t=ct(e.def.entries).filter(e=>jt.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Mt(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),fa=W(`$ZodLiteral`,(e,t)=>{ei.init(e,t);let n=new Set(t.values);e._zod.values=n,mn(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Mt(e):e?Mt(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),pa=W(`$ZodTransform`,(e,t)=>{ei.init(e,t),e._zod.optin=`optional`,wn.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Cn(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Sn;return n.value=i,n}});function ma(e,t){return e.value=t.issues.length?void 0:t.value,e}var ha=W(`$ZodOptional`,(e,t)=>{ei.init(e,t),mn(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,mn(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),mn(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${mt(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>ma(e,t)):ma(e,r)}return t.innerType._zod.run(e,n)}}),ga=W(`$ZodExactOptional`,(e,t)=>{ha.init(e,t),mn(e,`values`,e=>e.def.innerType._zod.values),mn(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),_a=W(`$ZodNullable`,(e,t)=>{ei.init(e,t),mn(e,`optin`,e=>e.def.innerType._zod.optin),mn(e,`optout`,e=>e.def.innerType._zod.optout),mn(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${mt(t.source)}|null)$`):void 0}),mn(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),va=W(`$ZodDefault`,(e,t)=>{ei.init(e,t),e._zod.optin=`defaulted`,mn(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>ya(e,t)):ya(r,t)}});function ya(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ba=W(`$ZodPrefault`,(e,t)=>{ei.init(e,t),e._zod.optin=`defaulted`,mn(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),xa=W(`$ZodNonOptional`,(e,t)=>{ei.init(e,t),mn(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Sa(t,e)):Sa(i,e)}});function Sa(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Ca(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Qt(e,r,Tn()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var wa=W(`$ZodCatch`,(e,t)=>{ei.init(e,t),mn(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),mn(e,`optout`,e=>e.def.innerType._zod.optout),mn(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Ca(e,r,t,n)):Ca(e,r,t,n)}}),Ta=W(`$ZodPipe`,(e,t)=>{ei.init(e,t),mn(e,`values`,e=>e.def.in._zod.values),mn(e,`optin`,e=>e.def.in._zod.optin),mn(e,`optout`,e=>e.def.out._zod.optout),mn(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Ea(e,t.in,n)):Ea(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ea(e,t.out,n)):Ea(r,t.out,n)}});function Ea(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Da=W(`$ZodReadonly`,(e,t)=>{ei.init(e,t),mn(e,`propValues`,e=>e.def.innerType._zod.propValues),mn(e,`values`,e=>e.def.innerType._zod.values),mn(e,`optin`,e=>e.def.innerType?._zod?.optin),mn(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Oa):Oa(r)}});function Oa(e){return e.memo||(e.value=Object.freeze(e.value)),e}var ka=W(`$ZodCustom`,(e,t)=>{Pr.init(e,t),ei.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Aa(t,n,r,e));Aa(i,n,r,e)}});function Aa(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(rn(e))}}var ja=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Ma=`~memo`,Na=[];function Pa(e){return typeof e==`object`&&!!e}function Fa(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Ia=new WeakMap,La=0,Ra=1,za=2;function Ba(e,t,n){let r=Ia.get(e);if(r!==void 0)return r?za:La;if(t.has(e))return za;t.add(e);let i=La,a=e=>{if(i!==za&&e?._zod){let r=Ba(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=La;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Ra:o.value?._zod?Ba(o.value,t,n):La;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=_t(c);s(e?o(e,!0):Ra),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Ba(r,t,!1):Ra);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Va(e,i)}function Va(e,t){return t!==Ra&&Ia.set(e,t===za),t}function Ha(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Ua,Wa=[],Ga={alloc(e,t,n){let r=Ua;if(!r)return n;Ua=void 0;let i={value:n,issues:null};return r.set(t.value,i),Wa.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&qa(n,e.value))throw new ja;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Ba(e,new Set,!1);if(i===La)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===za||r?n=!0:r=!0}let l=s.value;if(!Pa(l))return t(s,c);let u=c[Ma];u||(u={buckets:new WeakMap,backEdges:void 0},c[Ma]=u);let d;i===c?d=a:(d=Ha(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Fa(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Ua=d;let p=Wa.length,m=t(s,c);Ua=void 0;let h=Wa.length>p?Wa.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Fa(e.issues):Na),e)):(h&&(h.issues=m.issues.length?Fa(m.issues):Na),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Ka(){return Ga}function qa(e,t){let n=e[Ma]?.backEdges;return n!==void 0&&Pa(t)&&n.has(t)}var Ja=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(nn(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Pt(e.values[0])}`:`Invalid option: expected one of ${lt(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${lt(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Ya(){return{localeError:Ja()}}var Xa,Za=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Qa(){return new Za}(Xa=globalThis).__zod_globalRegistry??(Xa.__zod_globalRegistry=Qa());var $a=globalThis.__zod_globalRegistry;function eo(e){return e.checks&&=[...e.checks],e}function to(e,t){return new e(eo({type:`string`,...U(t)}))}function no(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...U(t)})}function ro(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...U(t)})}function io(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...U(t)})}function ao(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...U(t)})}function oo(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...U(t)})}function so(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...U(t)})}function co(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...U(t)})}function lo(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...U(t)})}function uo(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...U(t)})}function fo(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...U(t)})}function po(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...U(t)})}function mo(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...U(t)})}function ho(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...U(t)})}function go(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...U(t)})}function _o(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...U(t)})}function vo(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...U(t)})}function yo(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...U(t)})}function bo(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...U(t)})}function xo(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...U(t)})}function So(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...U(t)})}function Co(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...U(t)})}function wo(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...U(t)})}function To(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...U(t)})}function Eo(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...U(t)})}function Do(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...U(t)})}function Oo(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...U(t)})}function ko(e,t){return new e(eo({type:`number`,checks:[],...U(t)}))}function Ao(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...U(t)})}function jo(e,t){return new e({type:`boolean`,...U(t)})}function Mo(e){return new e({type:`unknown`})}function No(e,t){return new e({type:`never`,...U(t)})}function Po(e,t){return new Lr({check:`less_than`,...U(t),value:e,inclusive:!1})}function Fo(e,t){return new Lr({check:`less_than`,...U(t),value:e,inclusive:!0})}function Io(e,t){return new Rr({check:`greater_than`,...U(t),value:e,inclusive:!1})}function Lo(e,t){return new Rr({check:`greater_than`,...U(t),value:e,inclusive:!0})}function Ro(e,t){return new zr({check:`multiple_of`,...U(t),value:e})}function zo(e,t){return new Vr({check:`max_length`,...U(t),maximum:e})}function Bo(e,t){return new Hr({check:`min_length`,...U(t),minimum:e})}function Vo(e,t){return new Ur({check:`length_equals`,...U(t),length:e})}function Ho(e,t){return new Gr({check:`string_format`,format:`regex`,...U(t),pattern:e})}function Uo(e){return new Kr({check:`string_format`,format:`lowercase`,...U(e)})}function Wo(e){return new qr({check:`string_format`,format:`uppercase`,...U(e)})}function Go(e,t){return new Jr({check:`string_format`,format:`includes`,...U(t),includes:e})}function Ko(e,t){return new Yr({check:`string_format`,format:`starts_with`,...U(t),prefix:e})}function qo(e,t){return new Xr({check:`string_format`,format:`ends_with`,...U(t),suffix:e})}function Jo(e){return new Zr({check:`overwrite`,tx:e})}function Yo(e){return Jo(t=>t.normalize(e))}function Xo(){return Jo(e=>e.trim())}function Zo(){return Jo(e=>e.toLowerCase())}function Qo(){return Jo(e=>e.toUpperCase())}function $o(){return Jo(e=>Tt(e))}function es(e,t,n){return new e({type:`array`,element:t,...U(n)})}function ts(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...U(n)})}function ns(e,t){let n=rs(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(rn(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(rn(r))}},e(t.value,t)),t);return n}function rs(e,t){let n=new Pr({check:`custom`,...U(t)});return n._zod.check=e,n}function is(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&>(e,t,n[t]);return e}function as(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??$a,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function os(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function ss(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,ss(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&is(o.schema,c),t.io===`input`&&_s(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function cs(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function ls(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${cs(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+cs(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
62
62
|
|
|
63
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function us(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;us(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var ds=new Set([`type`,`properties`,`required`,`additionalProperties`]),fs=[`oneOf`,`anyOf`];function ps(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function ms(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!ds.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??ps(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}gt(n,r,e.length===1?e[0]:ms(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=ps(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function hs(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of ds)if(t in e)return;let n=t.filter(e=>fs.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=ms(t);else{let e=n[0],i=fs.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>ms([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,is(e,r))}function gs(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):is(i,s),is(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())us(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])hs(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}is(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,gt(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ys(t,`input`,e.processors),output:ys(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function _s(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return _s(r.element,n);if(r.type===`set`)return _s(r.valueType,n);if(r.type===`lazy`)return _s(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return _s(r.innerType,n);if(r.type===`intersection`)return _s(r.left,n)||_s(r.right,n);if(r.type===`record`||r.type===`map`)return _s(r.keyType,n)||_s(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:_s(r.in,n)||_s(r.out,n);if(r.type===`object`){for(let e in r.shape)if(_s(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(_s(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(_s(e,n))return!0;return!!(r.rest&&_s(r.rest,n))}return!1}var vs=(e,t={})=>n=>{let r=as({...n,processors:t});return ss(e,r),ls(r,e),gs(r,e)},ys=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=as({...i??{},target:a,io:t,processors:n});return ss(e,o),ls(o,e),gs(o,e)},bs=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},xs=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Ss=(e,t)=>{bs(e,`minimum`,t),xs(e,`maximum`,t)},Cs=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},ws=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Ts=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Es=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Ds=(e,t)=>bs(e,`minimum`,t.minimum),Os=(e,t)=>xs(e,`maximum`,t.maximum),ks=e=>(t,n)=>{Es(t,n.format);let[r,i]=e[n.format];bs(t,`minimum`,r),xs(t,`maximum`,i)},As={greater_than:(e,t)=>bs(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>xs(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Cs(e,t.value),number_format:ks(It),bigint_format:ks(Lt),min_length:Ds,max_length:Os,length_equals:(e,t)=>Ss(e,t.length),min_size:Ds,max_size:Os,size_equals:(e,t)=>Ss(e,t.size),string_format:(e,t)=>{Es(e,t.format),t.pattern&&ws(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Ts(e,t.mime)};function js(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)As[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&bs(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&bs(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&xs(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&xs(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Cs(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Ts(t,i.mime);for(let e of i.patterns??[])ws(t,e);return t}var Ms={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ns=new Map([[Ii,vr],[Ri,yr]]),Ps=e=>Ns.get(e)??e,Fs=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=js(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ms[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Ps);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Is=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=js(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):os(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Ls=(e,t,n,r)=>{n.type=`boolean`},Rs=(e,t,n,r)=>{n.not={}},zs=(e,t,n,r)=>{let i=e._zod.def,a=ct(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Bs=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(os(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(os(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Vs=(e,t,n,r)=>{os(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Hs=(e,t,n,r)=>{os(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Us=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=js(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=ss(a.element,t,{...r,path:[...r.path,`items`]})};function Ws(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Ws(t.out):t.type===`catch`?Ws(t.innerType):e._zod.optin}var Gs=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&os(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)gt(i.properties,e,ss(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Ws(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=ss(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ks=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>ss(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},qs=(e,t,n,r)=>{let i=e._zod.def,a=ss(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=ss(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Js(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Js(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Js(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?Ar:kr).source),p):p}var Ys=new WeakMap;function Xs(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Ys.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Js(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Zs=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=js(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=ss(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)gt(i.patternProperties,Ps(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=ss(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Ys.get(t);n||(n=[],Ys.set(t,n),t.deferred.push(()=>Xs(t))),n.push(e)}i.additionalProperties=ss(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Ws(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Qs=(e,t,n,r)=>{let i=e._zod.def,a=ss(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},$s=(e,t,n,r)=>{let i=e._zod.def;ss(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ec=Symbol();function tc(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(os(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),ec):JSON.parse(o)}var nc=(e,t,n,r)=>{let i=e._zod.def;ss(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=tc(i.defaultValue,e,t,n,r);o!==ec&&(n.default=o)},rc=(e,t,n,r)=>{let i=e._zod.def;ss(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=tc(i.defaultValue,e,t,n,r);o!==ec&&(n._prefault=o)},ic=(e,t,n,r)=>{let i=e._zod.def;ss(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{os(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},ac=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;ss(o,t,r);let s=t.seen.get(e);s.ref=o},oc=(e,t,n,r)=>{let i=e._zod.def;ss(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},sc=(e,t,n,r)=>{let i=e._zod.def;ss(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},cc=new WeakSet([Object.prototype,Error.prototype]);function lc(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var uc=W(`ZodError`,(e,t)=>{Mn.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);cc.has(n)||(cc.add(n),lc(n,`format`,e=>t=>Fn(e,t)),lc(n,`flatten`,e=>t=>Pn(e,t)),lc(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ut,2)}),lc(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ut,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),dc=Ln(uc),fc=Rn(uc),pc=zn(uc),mc=Vn(uc),hc=qn(uc),gc=Jn(uc),_c=Yn(uc),vc=Xn(uc),yc=Zn(uc),bc=Qn(uc),xc=$n(uc),Sc=er(uc);function Cc(){wn.localeError||Tn(Ya())}function wc(){wn.memoizer||Tn({memoizer:Ka()})}var Tc=W(`ZodType`,(e,t)=>(Cc(),ei.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Ct(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Nt(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Gl(e,t))},superRefine(e,t){return this.check(Kl(e,t))},overwrite(e){return this.check(Jo(e))},optional(){return Dl(this)},exactOptional(){return kl(this)},nullable(){return jl(this)},nullish(){return Dl(jl(this))},nonoptional(e){return Ll(this,e)},array(){return ul(this)},or(e){return pl([this,e])},and(e){return _l(this,e)},transform(e){return Vl(this,Tl(e))},default(e){return Nl(this,e)},prefault(e){return Fl(this,e)},catch(e){return zl(this,e)},pipe(e){return Vl(this,e)},readonly(){return Ul(this)},describe(e){let t=this.clone();return $a.add(t,{description:e}),t},meta(...e){if(e.length===0)return $a.get(this);let t=this.clone();return $a.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return sn(this,`~standard`,{...ri(this),jsonSchema:{input:ys(this,`input`),output:ys(this,`output`)}})},set"~standard"(e){on(this,`~standard`,e)},parse:function e(t,n){return dc(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await fc(this,t,n,{callee:e})},safeParse(e,t){return pc(this,e,t)},async safeParseAsync(e,t){return mc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){on(this,`spa`,e)},validate(e,t){return Wn(this,e,t)},validateAsync(e,t){return Kn(this,e,t)},encode:function e(t,n){return hc(this,t,n,{callee:e})},decode:function e(t,n){return gc(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await _c(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await vc(this,t,n,{callee:e})},safeEncode(e,t){return yc(this,e,t)},safeDecode(e,t){return bc(this,e,t)},async safeEncodeAsync(e,t){return xc(this,e,t)},async safeDecodeAsync(e,t){return Sc(this,e,t)},toJSONSchema(e){return vs(this,{})(e)},get description(){return $a.get(this)?.description},get _def(){return this._zod.def}}),Ec=W(`_ZodString`,(e,t)=>{ii.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fs(e,t,n,r)},cn({format:e=>js(e).format??null,minLength:e=>js(e).minimum??null,maxLength:e=>js(e).maximum??null},{regex(...e){return this.check(Ho(...e))},includes(...e){return this.check(Go(...e))},startsWith(...e){return this.check(Ko(...e))},endsWith(...e){return this.check(qo(...e))},min(...e){return this.check(Bo(...e))},max(...e){return this.check(zo(...e))},length(...e){return this.check(Vo(...e))},nonempty(...e){return this.check(Bo(1,...e))},lowercase(e){return this.check(Uo(e))},uppercase(e){return this.check(Wo(e))},trim(){return this.check(Xo())},normalize(...e){return this.check(Yo(...e))},toLowerCase(){return this.check(Zo())},toUpperCase(){return this.check(Qo())},slugify(){return this.check($o())}})),Dc=W(`ZodString`,(e,t)=>{ii.init(e,t),Ec.init(e,t)},{email(e){return this.check(no(Nc,e))},url(e){return this.check(co(Lc,e))},jwt(e){return this.check(wo(Qc,e))},emoji(e){return this.check(lo(Rc,e))},guid(e){return this.check(ro(Pc,e))},uuid(e){return this.check(io(Fc,e))},uuidv4(e){return this.check(ao(Fc,e))},uuidv6(e){return this.check(oo(Fc,e))},uuidv7(e){return this.check(so(Fc,e))},nanoid(e){return this.check(uo(zc,e))},cuid(e){return this.check(fo(Bc,e))},cuid2(e){return this.check(po(Vc,e))},ulid(e){return this.check(mo(Hc,e))},base64(e){return this.check(xo(Yc,e))},base64url(e){return this.check(So(Xc,e))},xid(e){return this.check(ho(Uc,e))},ksuid(e){return this.check(go(Wc,e))},ipv4(e){return this.check(_o(Gc,e))},ipv6(e){return this.check(vo(Kc,e))},cidrv4(e){return this.check(yo(qc,e))},cidrv6(e){return this.check(bo(Jc,e))},e164(e){return this.check(Co(Zc,e))},datetime(e){return this.check(To(kc,e))},date(e){return this.check(Eo(Ac,e))},time(e){return this.check(Do(jc,e))},duration(e){return this.check(Oo(Mc,e))}});function G(e){return to(Dc,e)}var Oc=W(`ZodStringFormat`,(e,t)=>{ai.init(e,t),Ec.init(e,t)}),kc=W(`ZodISODateTime`,(e,t)=>{wi.init(e,t),Oc.init(e,t)}),Ac=W(`ZodISODate`,(e,t)=>{Ti.init(e,t),Oc.init(e,t)}),jc=W(`ZodISOTime`,(e,t)=>{Ei.init(e,t),Oc.init(e,t)}),Mc=W(`ZodISODuration`,(e,t)=>{Di.init(e,t),Oc.init(e,t)}),Nc=W(`ZodEmail`,(e,t)=>{ci.init(e,t),Oc.init(e,t)}),Pc=W(`ZodGUID`,(e,t)=>{oi.init(e,t),Oc.init(e,t)}),Fc=W(`ZodUUID`,(e,t)=>{si.init(e,t),Oc.init(e,t)});function Ic(e){return io(Fc,e)}var Lc=W(`ZodURL`,(e,t)=>{gi.init(e,t),Oc.init(e,t)}),Rc=W(`ZodEmoji`,(e,t)=>{_i.init(e,t),Oc.init(e,t)}),zc=W(`ZodNanoID`,(e,t)=>{vi.init(e,t),Oc.init(e,t)}),Bc=W(`ZodCUID`,(e,t)=>{yi.init(e,t),Oc.init(e,t)}),Vc=W(`ZodCUID2`,(e,t)=>{bi.init(e,t),Oc.init(e,t)}),Hc=W(`ZodULID`,(e,t)=>{xi.init(e,t),Oc.init(e,t)}),Uc=W(`ZodXID`,(e,t)=>{Si.init(e,t),Oc.init(e,t)}),Wc=W(`ZodKSUID`,(e,t)=>{Ci.init(e,t),Oc.init(e,t)}),Gc=W(`ZodIPv4`,(e,t)=>{Oi.init(e,t),Oc.init(e,t)}),Kc=W(`ZodIPv6`,(e,t)=>{ji.init(e,t),Oc.init(e,t)}),qc=W(`ZodCIDRv4`,(e,t)=>{Mi.init(e,t),Oc.init(e,t)}),Jc=W(`ZodCIDRv6`,(e,t)=>{Pi.init(e,t),Oc.init(e,t)}),Yc=W(`ZodBase64`,(e,t)=>{Li.init(e,t),Oc.init(e,t)}),Xc=W(`ZodBase64URL`,(e,t)=>{Bi.init(e,t),Oc.init(e,t)}),Zc=W(`ZodE164`,(e,t)=>{Vi.init(e,t),Oc.init(e,t)}),Qc=W(`ZodJWT`,(e,t)=>{Ui.init(e,t),Oc.init(e,t)}),$c=W(`ZodNumber`,(e,t)=>{Wi.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Is(e,t,n,r),e.isFinite=!0},cn({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=js(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=js(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=js(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>js(e).format??null},{gt(e,t){return this.check(Io(e,t))},gte(e,t){return this.check(Lo(e,t))},min(e,t){return this.check(Lo(e,t))},lt(e,t){return this.check(Po(e,t))},lte(e,t){return this.check(Fo(e,t))},max(e,t){return this.check(Fo(e,t))},int(e){return this.check(nl(e))},safe(e){return this.check(nl(e))},positive(e){return this.check(Io(0,e))},nonnegative(e){return this.check(Lo(0,e))},negative(e){return this.check(Po(0,e))},nonpositive(e){return this.check(Fo(0,e))},multipleOf(e,t){return this.check(Ro(e,t))},step(e,t){return this.check(Ro(e,t))},finite(){return this}}));function el(e){return ko($c,e)}var tl=W(`ZodNumberFormat`,(e,t)=>{Gi.init(e,t),$c.init(e,t)});function nl(e){return Ao(tl,e)}var rl=W(`ZodBoolean`,(e,t)=>{Ki.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ls(e,t,n,r)});function il(e){return jo(rl,e)}var al=W(`ZodUnknown`,(e,t)=>{qi.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ol(){return Mo(al)}var sl=W(`ZodNever`,(e,t)=>{Ji.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rs(e,t,n,r)});function cl(e){return No(sl,e)}var ll=W(`ZodArray`,(e,t)=>{wc(),Xi.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Us(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Bo(e,t))},nonempty(e){return this.check(Bo(1,e))},max(e,t){return this.check(zo(e,t))},length(e,t){return this.check(Vo(e,t))},unwrap(){return this.element}});function ul(e,t){return es(ll,e,t)}var dl=W(`ZodObject`,(e,t)=>{wc(),na.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gs(e,t,n,r),hn(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return xl(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Ct(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Ct(this._zod.def,{catchall:ol()}))},loose(){return this.clone(Ct(this._zod.def,{catchall:ol()}))},strict(){return this.clone(Ct(this._zod.def,{catchall:cl()}))},strip(){return this.clone(Ct(this._zod.def,{catchall:void 0}))},extend(e){return Vt(this,e)},safeExtend(e){return Ut(this,e)},merge(e){return Wt(this,e)},pick(e){return Rt(this,e)},omit(e){return Bt(this,e)},partial(...e){return Gt(El,this,e[0])},exactPartial(...e){return Gt(Ol,this,e[0],`exactPartial`)},required(...e){return Kt(Il,this,e[0])}});function K(e,t){return new dl({type:`object`,shape:e,catchall:cl(),...U(t)})}var fl=W(`ZodUnion`,(e,t)=>{ia.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ks(e,t,n,r),e.options=t.options});function pl(e,t){return new fl({type:`union`,options:e,...U(t)})}var ml=W(`ZodDiscriminatedUnion`,(e,t)=>{fl.init(e,t),oa.init(e,t)});function hl(e,t,n){return new ml({type:`union`,options:t,discriminator:e,...U(n)})}var gl=W(`ZodIntersection`,(e,t)=>{sa.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qs(e,t,n,r)});function _l(e,t){return new gl({type:`intersection`,left:e,right:t})}var vl=W(`ZodRecord`,(e,t)=>{wc(),ua.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zs(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function yl(e,t,n){return!t||!t._zod?new vl({type:`record`,keyType:G(),valueType:e,...U(t)}):new vl({type:`record`,keyType:e,valueType:t,...U(n)})}var bl=W(`ZodEnum`,(e,t)=>{da.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zs(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new bl({...t,checks:[],...U(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new bl({...t,checks:[],...U(r),entries:i})}});function xl(e,t){return new bl({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...U(t)})}var Sl=W(`ZodLiteral`,(e,t)=>{fa.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bs(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Cl(e,t){return new Sl({type:`literal`,values:Array.isArray(e)?e:[e],...U(t)})}var wl=W(`ZodTransform`,(e,t)=>{wc(),pa.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hs(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Cn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(rn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(rn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Tl(e){return new wl({type:`transform`,transform:e})}var El=W(`ZodOptional`,(e,t)=>{ha.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dl(e){return new El({type:`optional`,innerType:e})}var Ol=W(`ZodExactOptional`,(e,t)=>{ga.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kl(e){return new Ol({type:`optional`,innerType:e})}var Al=W(`ZodNullable`,(e,t)=>{_a.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jl(e){return new Al({type:`nullable`,innerType:e})}var Ml=W(`ZodDefault`,(e,t)=>{va.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Nl(e,t){return new Ml({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():At(t)}})}var Pl=W(`ZodPrefault`,(e,t)=>{ba.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fl(e,t){return new Pl({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():At(t)}})}var Il=W(`ZodNonOptional`,(e,t)=>{xa.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$s(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ll(e,t){return new Il({type:`nonoptional`,innerType:e,...U(t)})}var Rl=W(`ZodCatch`,(e,t)=>{wa.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ic(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function zl(e,t){return new Rl({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:_n(t)})}var Bl=W(`ZodPipe`,(e,t)=>{Ta.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ac(e,t,n,r),e.in=t.in,e.out=t.out});function Vl(e,t){return new Bl({type:`pipe`,in:e,out:t})}var Hl=W(`ZodReadonly`,(e,t)=>{Da.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ul(e){return new Hl({type:`readonly`,innerType:e})}var Wl=W(`ZodCustom`,(e,t)=>{ka.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vs(e,t,n,r)});function Gl(e,t={}){return ts(Wl,e,t)}function Kl(e,t){return ns(e,t)}var ql=1024,Jl=1024*ql,Yl=1024*Jl,Xl={openDocuments:2e3,documentBytes:10*Jl,openSourceBytes:128*Jl,metadataStateBytes:32*Jl,blobStoreBytes:1*Yl,titleLength:160,keyLength:128,ipcFrameBytes:64*Jl,ipcPreAuthFrameBytes:4*ql,listLimitDefault:100,listLimitMax:500,readMaxBytesDefault:16*ql,readMaxBytesMin:256,readMaxBytesMax:1*Jl,cursorTtlMs:3e5,retainedRevisions:2,revisionGraceMs:3e5,parseTimeoutMs:2e3,printRenderTimeoutMs:1e4,pdfExportTimeoutMs:6e4,watchDebounceMs:200,bootstrapTicketTtlMs:6e4,sessionIdleMs:432e5,sseHeartbeatMs:15e3,ssePendingEvents:256,sseStallMs:6e4,assetBytes:20*Jl,documentAssetBytes:100*Jl,documentAssets:500,cssReferenceDepth:8,renderGrantsPerSession:64,searchLimitDefault:5,searchLimitMax:50,searchQueryCodePoints:512,searchTerms:32,searchExcerptCodePoints:240,searchHitsPerDocument:2,searchIndexWaitMs:2e3,questionnaireBytes:64*ql,answerBytes:64*ql,questionFields:32,answerStringLength:4e3,feedbackWaitDefaultSeconds:120,feedbackWaitMaxSeconds:3600,bridgeInboundFrameBytes:128*ql,bridgeOutboundFrameBytes:256*ql,bridgeMessagesPerSecond:20,renderMissingPerGrant:32},Zl=G().regex(/^doc_[0-9a-f-]{36}$/),Ql=G().regex(/^rev_[0-9a-f]{64}$/),$l=G().regex(/^[0-9a-f]{64}$/),eu=xl([`markdown`,`html`]),tu=xl([`file`,`stdin`,`generated`]),nu=xl([`ready`,`missing`,`unreadable`,`updating`,`error`]),ru=xl([`ready`,`indexing`,`excluded`]),iu=xl([`static`,`interactive`]),au=xl([`image`,`svg`,`style`,`font`,`script`,`data`]);K({logicalPath:G().min(1),mime:G().min(1),role:au,sha256:$l,byteLength:el().int().nonnegative()});var ou=hl(`kind`,[K({id:G(),kind:Cl(`main`)}),K({id:G(),kind:Cl(`linked`),name:G(),branch:G().nullable()})]),su=xl([`invalid-git-file`,`invalid-git-dir`,`link-mismatch`,`unreadable`,`limit-exceeded`,`blocked-path`]),cu=hl(`state`,[K({state:Cl(`resolved`),id:G(),nameSegments:ul(G()),checkout:ou.nullable(),pathInCheckout:ul(G())}),K({state:Cl(`unresolved`),id:G(),nameSegments:ul(G()),pathInCheckout:ul(G()),reason:su}),K({state:Cl(`pending`)})]).nullable(),lu=K({documentId:Zl,key:G().nullable(),format:eu,sourceKind:tu,title:G(),displayPath:G().nullable(),pathSegments:ul(G()),canonicalPath:G().nullable(),repository:cu,revision:Ql.nullable(),sourceState:nu,searchState:ru,openedAt:G(),updatedAt:G(),order:el().int().nonnegative(),pendingRequestIds:ul(G()),htmlMode:iu.nullable(),interactiveAllowed:il()}),uu=K({startByte:el().int().nonnegative(),endByteExclusive:el().int().nonnegative(),lineStart:el().int().positive(),lineEnd:el().int().positive()}),du=G().min(1).max(Xl.titleLength),fu=G().min(1).max(Xl.keyLength);K({cwd:G().min(1),paths:ul(G().min(1)),stdin:K({content:G()}).optional(),format:xl([`auto`,`markdown`,`html`]).default(`auto`),title:du.optional(),key:fu.optional(),recursive:il().default(!1),watch:il().default(!1),htmlMode:iu.optional(),assetsRoot:G().min(1).optional(),assets:ul(G().min(1)).max(Xl.documentAssets).default([])});var pu=K({watchId:G().regex(/^watch_[0-9a-f-]{36}$/),kind:xl([`directory`,`glob`]),root:G(),pattern:G().nullable(),recursive:il(),suppressedPaths:ul(G()),createdAt:G(),assetsRoot:G().nullable()});K({documents:ul(lu),watchRules:ul(pu),created:el().int().nonnegative(),updated:el().int().nonnegative(),unchanged:el().int().nonnegative()}),K({limit:el().int().min(1).max(Xl.listLimitMax).default(Xl.listLimitDefault),cursor:G().min(1).optional()}),K({documents:ul(lu),totalDocuments:el().int().nonnegative(),nextCursor:G().nullable()}),K({documentId:Zl,revision:Ql.optional(),lines:K({start:el().int().positive(),end:el().int().positive()}).optional(),maxBytes:el().int().min(Xl.readMaxBytesMin).max(Xl.readMaxBytesMax).default(Xl.readMaxBytesDefault),cursor:G().min(1).optional(),outline:il().default(!1),section:G().regex(/^sec_\d{4,}$/).optional()});var mu=K({sectionId:G().regex(/^sec_\d{4,}$/),level:el().int().min(1).max(6),title:G(),headingPath:ul(G()),anchor:G()});K({documentId:Zl,revision:Ql,mode:xl([`source`,`section`,`outline`]),content:G().optional(),outline:ul(mu).optional(),sectionId:G().optional(),sourceRange:uu.nullable(),extraction:xl([`source`,`markdown`,`static-html`]),truncated:il(),nextCursor:G().nullable()}),K({cwd:G().min(1),targets:ul(G().min(1)),all:il().default(!1)}),K({closed:ul(Zl),alreadyClosed:ul(Zl)}),K({state:xl([`running`,`stopped`]),daemonId:G().nullable(),pid:el().int().nullable(),version:G().nullable(),protocolVersion:el().int().nullable(),startedAt:G().nullable(),stateRoot:G(),openDocuments:el().int().nonnegative().nullable(),catalogVersion:el().int().nonnegative().nullable(),uiUrl:G().nullable()}),K({order:ul(Zl),expectedCatalogVersion:el().int().nonnegative()}),K({documents:ul(lu),changed:ul(Zl)}),K({watchRules:ul(pu)}),K({type:xl([`hello`,`catalog-changed`,`document-changed`,`document-status`,`focus-requested`,`daemon-stopping`,`resync-required`,`feedback-changed`,`render-diagnostics`]),daemonId:G(),sequence:el().int().nonnegative(),catalogVersion:el().int().nonnegative(),documentId:Zl.optional(),revision:Ql.nullable().optional(),requestId:G().optional(),status:xl([`pending`,`submitted`,`cancelled`]).optional(),draftVersion:el().int().nonnegative().optional(),acknowledged:il().optional()}),K({version:G(),daemonId:G(),catalogVersion:el().int().nonnegative(),activeDocumentId:Zl.nullable(),openDocuments:el().int().nonnegative(),previewOrigin:G()}),K({bootstrapUrl:G(),uiUrl:G()}),K({token:G(),idleTimeoutSeconds:el().int().positive()}),K({documentId:Zl,revision:Ql.optional(),mode:iu.default(`static`)});var hu=K({linkId:G().regex(/^lnk_\d{4,}$/),href:G(),text:G(),kind:xl([`external`,`document`,`other`])}),gu=K({code:G(),target:G().nullable(),count:el().int().positive()});K({grant:G(),documentId:Zl,revision:Ql,format:eu,mode:iu,documentUrl:G().nullable(),filesBaseUrl:G(),documentLogicalPath:G(),assets:ul(K({logicalPath:G(),role:au})),links:ul(hu),diagnostics:ul(gu),headingTargets:ul(K({sectionId:G().regex(/^sec_\d{4,}$/),anchor:G()})),bridge:K({instanceId:G(),requestId:G()}).nullable()}),K({missing:ul(G())}),K({documentId:Zl,mode:iu,confirmed:il().default(!1)}),K({documentId:Zl,revision:Ql,linkId:G().regex(/^lnk_\d{4,}$/),confirmation:G().min(1).max(64).optional()}),K({status:xl([`focused`,`opened`]),documentId:Zl});var _u=xl([`text`,`exact`,`path`]);K({query:G().min(1),mode:_u.default(`text`),limit:el().int().min(1).max(Xl.searchLimitMax).default(Xl.searchLimitDefault),documents:ul(Zl).max(Xl.openDocuments).default([]),maxBytes:el().int().min(Xl.readMaxBytesMin).max(Xl.readMaxBytesMax).default(Xl.readMaxBytesDefault),cursor:G().min(1).optional()});var vu=K({documentId:Zl,revision:Ql,title:G(),displayPath:G().nullable(),sectionId:G(),headingPath:ul(G()),excerpt:G(),matchKind:xl([`path-exact`,`phrase`,`text`,`prefix`,`fuzzy`]),score:el(),sourceRange:uu.nullable(),extraction:xl([`markdown`,`static-html`])});K({query:G(),mode:_u,catalogVersion:el().int().nonnegative(),registeredDocuments:el().int().nonnegative(),searchedDocuments:el().int().nonnegative(),indexedAt:G(),incomplete:il(),failedDocuments:ul(K({documentId:Zl,code:G()})),indexingDocuments:ul(Zl),hits:ul(vu),truncated:il(),nextCursor:G().nullable()});var yu=yl(G(),ol()),bu=K({code:G().min(1),message:G(),details:yu.optional()}),xu=K({code:G().min(1),message:G(),retryable:il(),details:yu}),Su=K({command:G().min(1),catalogVersion:el().int().nonnegative().optional()});hl(`ok`,[K({schemaVersion:Cl(1),ok:Cl(!0),data:ol(),warnings:ul(bu),meta:Su}),K({schemaVersion:Cl(1),ok:Cl(!1),error:xu,warnings:ul(bu)})]);var q={success:0,usage:2,notFound:3,conflict:4,forbidden:5,timeout:6,limit:7,daemon:8,internal:9,interrupted:130};q.usage,q.usage,q.usage,q.usage,q.usage,q.usage,q.usage,q.notFound,q.notFound,q.notFound,q.notFound,q.notFound,q.notFound,q.notFound,q.notFound,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.forbidden,q.forbidden,q.forbidden,q.forbidden,q.forbidden,q.limit,q.limit,q.timeout,q.interrupted,q.daemon,q.daemon,q.daemon,q.daemon,q.daemon,q.daemon,q.daemon,q.internal,q.internal,q.internal,q.internal,q.internal,q.internal,q.internal;var Cu=G().regex(/^req_[0-9a-f-]{36}$/),wu=G().regex(/^sub_[0-9a-f-]{36}$/),Tu=/^[A-Za-z][A-Za-z0-9_]{0,63}$/,Eu=new Set([`__proto__`,`constructor`,`prototype`,...Object.getOwnPropertyNames(Object.prototype)]),Du=G().regex(Tu).refine(e=>!Eu.has(e),{message:`This field name cannot be used.`}),Ou=G().min(1).max(160),ku=G().max(2e3),Au=ul(G().max(160)).min(1).max(32).refine(e=>new Set(e).size===e.length,{message:`The choices contain duplicates.`}),ju=el().int().min(0).max(Xl.answerStringLength),Mu=el().refine(Number.isFinite,{message:`The number must be finite.`}),Nu=hl(`type`,[K({type:Cl(`string`),title:Ou,description:ku.optional(),minLength:ju.optional(),maxLength:ju.optional(),enum:Au.optional()}),K({type:Cl(`boolean`),title:Ou,description:ku.optional()}),K({type:xl([`number`,`integer`]),title:Ou,description:ku.optional(),minimum:Mu.optional(),maximum:Mu.optional()}),K({type:Cl(`array`),title:Ou,description:ku.optional(),minItems:el().int().min(0).max(32).optional(),maxItems:el().int().min(0).max(32),uniqueItems:Cl(!0),items:K({type:Cl(`string`),enum:Au})})]),Pu=K({schemaVersion:Cl(1),title:Ou,instructions:G().max(4e3).optional(),fieldOrder:ul(Du).min(1).max(Xl.questionFields),answerSchema:K({type:Cl(`object`),properties:yl(Du,Nu).refine(e=>{let t=Object.keys(e).length;return t>=1&&t<=Xl.questionFields},{message:`There must be 1 to ${String(Xl.questionFields)} fields.`}),required:ul(Du).max(Xl.questionFields),additionalProperties:Cl(!1)})}).superRefine((e,t)=>{let n=Object.keys(e.answerSchema.properties),r=e.fieldOrder;new Set(r).size!==r.length&&t.addIssue({code:`custom`,path:[`fieldOrder`],message:`There are duplicates.`}),(r.length!==n.length||!n.every(e=>r.includes(e)))&&t.addIssue({code:`custom`,path:[`fieldOrder`],message:`The fields in fieldOrder and properties do not match.`});let{required:i}=e.answerSchema;new Set(i).size!==i.length&&t.addIssue({code:`custom`,path:[`answerSchema`,`required`],message:`There are duplicates.`});for(let e of i)n.includes(e)||t.addIssue({code:`custom`,path:[`answerSchema`,`required`],message:`The field ${e} does not exist.`});for(let[n,r]of Object.entries(e.answerSchema.properties)){let e=[`answerSchema`,`properties`,n];(r.type===`string`&&r.minLength!==void 0&&r.maxLength!==void 0&&r.minLength>r.maxLength||(r.type===`number`||r.type===`integer`)&&r.minimum!==void 0&&r.maximum!==void 0&&r.minimum>r.maximum||r.type===`array`&&r.minItems!==void 0&&r.minItems>r.maxItems)&&t.addIssue({code:`custom`,path:e,message:`The lower bound is greater than the upper bound.`}),r.type===`array`&&r.minItems!==void 0&&r.minItems>r.items.enum.length&&t.addIssue({code:`custom`,path:e,message:`minItems is greater than the number of choices.`})}}),Fu=yl(Du,pl([G(),il(),el(),ul(G())]));function Iu(e){let t=0;for(let n of e)t+=1;return t}function Lu(e){let t=0;for(let n of e){let e=n.codePointAt(0);t+=e<128?1:e<2048?2:e<65536?3:4}return t}function Ru(e){return Lu(at(e))}function zu(e,t,n){if(typeof t!=`object`||!t||Array.isArray(t))return[{field:``,code:`not-object`}];let r;try{r=Ru(t)}catch{return[{field:``,code:`type`}]}if(r>Xl.answerBytes)return[{field:``,code:`too-large`}];let i=[],{properties:a,required:o}=e.answerSchema;for(let e of Object.keys(t))Object.hasOwn(a,e)||i.push({field:e,code:`unknown-field`});for(let[e,r]of Object.entries(a)){if(!Object.hasOwn(t,e)){n.complete&&o.includes(e)&&i.push({field:e,code:`required`});continue}let a=t[e],s=t=>i.push({field:e,code:t});switch(r.type){case`string`:{if(typeof a!=`string`){s(`type`);break}r.enum!==void 0&&!r.enum.includes(a)&&s(`enum`);let e=Iu(a);e>(r.maxLength??Xl.answerStringLength)?s(`too-long`):n.complete&&r.minLength!==void 0&&e<r.minLength&&s(`too-short`);break}case`boolean`:typeof a!=`boolean`&&s(`type`);break;case`number`:case`integer`:if(typeof a!=`number`||!Number.isFinite(a)||r.type===`integer`&&!Number.isInteger(a)){s(`type`);break}(r.minimum!==void 0&&a<r.minimum||r.maximum!==void 0&&a>r.maximum)&&s(`out-of-range`);break;case`array`:if(!Array.isArray(a)||!a.every(e=>typeof e==`string`)){s(`type`);break}a.every(e=>r.items.enum.includes(e))||s(`enum`),new Set(a).size!==a.length&&s(`duplicate`),a.length>r.maxItems?s(`too-many`):n.complete&&r.minItems!==void 0&&a.length<r.minItems&&s(`too-few`)}}return i}var Bu=xl([`pending`,`submitted`,`cancelled`]),Vu=xl([`document_closed`,`agent_cancelled`,`user_cancelled`]),Hu=K({submissionId:wu,answers:Fu,submittedAt:G(),revision:Ql,confirmedAgainstOlderRevision:il(),currentRevisionAtSubmit:Ql.nullable()}),Uu=K({cancelledAt:G(),reason:Vu}),Wu=K({requestId:Cu,documentId:Zl,revision:Ql,title:G(),status:Bu,createdAt:G(),submission:Hu.nullable(),cancellation:Uu.nullable(),acknowledgedAt:G().nullable()});Wu.extend({questionnaire:Pu,renderMode:iu,draftVersion:el().int().nonnegative(),draftAnswers:Fu,currentRevision:Ql.nullable(),documentOpen:il()}),K({cwd:G().min(1),questionnaire:G(),documentId:Zl.optional(),revision:Ql.optional(),view:G().min(1).optional(),htmlMode:iu.optional(),assetsRoot:G().min(1).optional(),assets:ul(G().min(1)).max(Xl.documentAssets).default([]),operationId:Ic().optional()}).superRefine((e,t)=>{e.documentId!==void 0&&e.view!==void 0&&t.addIssue({code:`custom`,message:`--document and --view cannot be used together.`}),e.revision!==void 0&&e.documentId===void 0&&t.addIssue({code:`custom`,message:`--revision requires --document.`}),(e.htmlMode!==void 0||e.assetsRoot!==void 0||e.assets.length>0)&&e.view===void 0&&t.addIssue({code:`custom`,message:`--html-mode, --assets-root and --asset apply only to a document newly opened with --view.`})}),K({request:Wu,replayed:il()}),K({status:Bu.optional()}),K({requests:ul(Wu)}),K({requestId:Cu}),K({requestId:Cu,timeoutMs:el().int().min(1).max(Xl.feedbackWaitMaxSeconds*1e3)}),K({requestId:Cu,submissionId:wu}),K({requestId:Cu,confirmed:il()}),K({expectedDraftVersion:el().int().nonnegative(),answers:ol()}),K({submissionId:wu,expectedDraftVersion:el().int().nonnegative(),revision:Ql,currentRevision:Ql.nullable(),confirmOlderRevision:il().default(!1)}),K({confirmed:Cl(!0)});var Gu=/[\\/:*?"<>|\p{Cc}]/gu,Ku=200;function qu(e){let t=e.codePointAt(0)??0;return t<128?1:t<2048?2:t<65536?3:4}function Ju(e){let{displayPath:t,title:n}=e,r=n;if(t!==null){let e=t.slice(Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`))+1),n=e.lastIndexOf(`.`);r=n>0?e.slice(0,n):e}let i=``,a=0;for(let e of r.replace(Gu,`_`).trim()){if(a+=qu(e),a>Ku)break;i+=e}return i=i.replace(/^[.\s]+|[.\s]+$/g,``),`${i===``?`document`:i}.pdf`}var J=typeof document<`u`?D.useLayoutEffect:()=>{};function Yu(){return typeof window<`u`}function Xu(e){return $u(e)?(e.nodeName||``).toLowerCase():`#document`}function Zu(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qu(e){return(($u(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function $u(e){return Yu()?e instanceof Node||e instanceof Zu(e).Node:!1}function Y(e){return Yu()?e instanceof Element||e instanceof Zu(e).Element:!1}function X(e){return Yu()?e instanceof HTMLElement||e instanceof Zu(e).HTMLElement:!1}function ed(e){return!Yu()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Zu(e).ShadowRoot}function td(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=fd(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function nd(e){return/^(table|td|th)$/.test(Xu(e))}function rd(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var id=/transform|translate|scale|rotate|perspective|filter/,ad=/paint|layout|strict|content/,od=e=>!!e&&e!==`none`,sd;function cd(e){let t=Y(e)?fd(e):e;return od(t.transform)||od(t.translate)||od(t.scale)||od(t.rotate)||od(t.perspective)||!ud()&&(od(t.backdropFilter)||od(t.filter))||id.test(t.willChange||``)||ad.test(t.contain||``)}function ld(e){let t=md(e);for(;X(t)&&!dd(t);){if(cd(t))return t;if(rd(t))return null;t=md(t)}return null}function ud(){return sd??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),sd}function dd(e){return/^(html|body|#document)$/.test(Xu(e))}function fd(e){return Zu(e).getComputedStyle(e)}function pd(e){return Y(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function md(e){if(Xu(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ed(e)&&e.host||Qu(e);return ed(t)?t.host:t}function hd(e){let t=md(e);return dd(t)?(e.ownerDocument||e).body:X(t)&&td(t)?t:hd(t)}function gd(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=hd(e),i=r===e.ownerDocument?.body,a=Zu(r);if(i){let e=_d(a);return t.concat(a,a.visualViewport||[],td(r)?r:[],e&&n?gd(e):[])}return t.concat(r,gd(r,[],n))}function _d(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vd(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function yd(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:bd,platform:xd,maxTouchPoints:Sd}=yd(),Cd=bd.toLowerCase(),wd=xd.toLowerCase(),Td=/^i(os$|p)/.test(wd)||wd===`macintel`&&Sd>1,Ed=`android`,Dd=wd===Ed||Cd.includes(Ed),Od=!Td&&wd.startsWith(`mac`);wd.startsWith(`win`),!Dd&&/^(linux|chrome os)/.test(wd);var kd=Od||Td,Ad=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!Ad&&Cd.includes(`firefox`),!Ad&&Cd.includes(`chrom`);var jd=kd,Md=/jsdom|happydom/.test(Cd);function Nd(e){return e?.ownerDocument||document}var Pd={};function Fd(e,t){let n=D.useRef(Pd);return n.current===Pd&&(n.current=e(t)),n}function Id(){}var Ld=Object.freeze([]),Rd=Object.freeze({});function zd(e){D.useEffect(e,Ld)}var Bd=0,Vd=class e{static create(){return new e}currentId=Bd;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Bd,t()},e)}isStarted(){return this.currentId!==Bd}clear=()=>{this.currentId!==Bd&&(clearTimeout(this.currentId),this.currentId=Bd)};disposeEffect=()=>this.clear};function Hd(){let e=Fd(Vd.create).current;return zd(e.disposeEffect),e}var Ud=null;globalThis.requestAnimationFrame;var Wd=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||this.callbacks[t]!==null&&(this.callbacks[t]=null,--this.callbacksCount)}},Gd=class e{static create(){return new e}static request(e){return Wd.request(e)}static cancel(e){return Wd.cancel(e)}currentId=Ud;request(e){this.cancel(),this.currentId=Wd.request(()=>{this.currentId=Ud,e()})}cancel=()=>{this.currentId!==Ud&&(Wd.cancel(this.currentId),this.currentId=Ud)};disposeEffect=()=>this.cancel};function Kd(){let e=Fd(Gd.create).current;return zd(e.disposeEffect),e}var qd={},Jd={},Yd=``;function Xd(e,t){return td(e)?e:t}function Zd(e,t,n){return/hidden|clip/.test(e.getComputedStyle(Xd(t,n)).overflowY)}function Qd(e){if(typeof document>`u`)return!1;let t=Nd(e);return Zu(t).innerWidth-t.documentElement.clientWidth>0}function $d(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Nd(e),n=t.documentElement,r=t.body,i=Xd(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function ef(e){let t=Nd(e),n=t.documentElement,r=t.body,i=Xd(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function tf(e){let t=Nd(e),n=t.documentElement,r=t.body,i=Zu(n),a=0,o=0,s=!1,c=Gd.create();if(Ad&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,qd={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Yd=n.style.scrollBehavior,Jd={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=Xd(n,r);if(s=$d(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,qd),Object.assign(r.style,Jd),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=Yd)}function d(){u(),c.request(l)}l();let f=vd(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var nf=new class{lockCount=0;restore=null;timeoutLock=Vd.create();timeoutUnlock=Vd.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Nd(e),n=t.documentElement,r=t.body,i=Zu(n);if(Zd(i,n,r)){let t=new i.MutationObserver(()=>{Zd(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=Td||!Qd(e);this.restore=a?ef(e):tf(e)}};function rf(e=!0,t=null){J(()=>{if(e)return nf.acquire(t)},[e,t])}function af(e){e.preventDefault(),e.stopPropagation()}function of(e){return`nativeEvent`in e}function sf(e){return e.pointerType===``&&e.isTrusted?!0:Dd&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function cf(e){return Md?!1:!Dd&&e.width===0&&e.height===0||Dd&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function lf(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function uf(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function df(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function ff(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&ed(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function pf(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var mf=`data-base-ui-focusable`,hf=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,gf=`data-starting-style`,_f=`data-ending-style`,vf={[gf]:``},yf={[_f]:``},bf={transitionStatus(e){return e===`starting`?vf:e===`ending`?yf:null}},xf=`data-open`,Sf=`data-closed`,Cf=`data-anchor-hidden`,wf=`data-popup-open`,Tf=`data-pressed`,Ef={[wf]:``},Df={[wf]:``,[Tf]:``},Of={[xf]:``},kf={[Sf]:``},Af={[Cf]:``},jf={open(e){return e?Ef:null}},Mf={open(e){return e?Df:null}},Nf={open(e){return e?Of:kf},anchorHidden(e){return e?Af:null}},Pf={...Nf,...bf},Ff=`data-trigger-disabled`;function If(e,t){if(!Y(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(Ff);for(let[,e]of t.entries())if(ff(e,n))return!e.hasAttribute(Ff);return!1}function Lf(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Rf(e){return e.matches(`html,body`)}function zf(e){return X(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function Bf(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${hf}`)!=null}function Vf(e){return e?e.getAttribute(`role`)===`combobox`&&zf(e):!1}function Hf(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Uf(e,t){return t!=null&&!lf(t)?0:typeof e==`function`?e():e}function Wf(e,t,n){let r=Uf(e,n);return typeof r==`number`?r:r?.[t]}function Gf(e){return typeof e==`function`?e():e}function Kf(e,t){return t||e===`click`||e===`mousedown`}function qf(e){return e?.includes(`mouse`)&&e!==`mousedown`}var Jf=`none`,Yf=`trigger-press`,Xf=`trigger-hover`,Zf=`outside-press`,Qf=`close-press`,$f=`focus-out`,ep=`escape-key`,tp=`imperative-action`;function np(e,t,n,r){let i=!1,a=!1,o=r??Rd;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function rp(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function ip(e,t,n,r){let i=Fd(op).current;return sp(i,e,t,n,r)&&lp(i,[e,t,n,r]),i.callback}function ap(e){let t=Fd(op).current;return cp(t,e)&&lp(t,e),t.callback}function op(){return{callback:null,cleanup:null,refs:[]}}function sp(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function cp(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function lp(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null}}}}}}function up(e){let t=Fd(dp,e).current;return t.next=e,J(t.effect),t}function dp(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var fp={...D},pp=fp.useInsertionEffect,mp=pp&&pp!==fp.useLayoutEffect?pp:e=>e();function hp(e){let t=Fd(gp).current;return t.next=e,mp(t.effect),t.trampoline}function gp(){let e={next:void 0,callback:_p,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function _p(){}var vp={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},yp={...vp,position:`fixed`,top:0,left:0},bp={...vp,position:`absolute`},xp=D.forwardRef(function(e,t){let[n,r]=D.useState();J(()=>{jd&&Ad&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,H.jsx)(`span`,{...e,ref:t,style:yp,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),Sp=Math.min,Cp=Math.max,wp=Math.round,Tp=Math.floor,Ep=e=>({x:e,y:e}),Dp={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Op(e,t,n){return Cp(e,Sp(t,n))}function kp(e,t){return typeof e==`function`?e(t):e}function Ap(e){return e.split(`-`)[0]}function jp(e){return e.split(`-`)[1]}function Mp(e){return e===`x`?`y`:`x`}function Np(e){return e===`y`?`height`:`width`}function Pp(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Fp(e){return Mp(Pp(e))}function Ip(e,t,n){n===void 0&&(n=!1);let r=jp(e),i=Fp(e),a=Np(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Gp(o)),[o,Gp(o)]}function Lp(e){let t=Gp(e);return[Rp(e),t,Rp(t)]}function Rp(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var zp=[`left`,`right`],Bp=[`right`,`left`],Vp=[`top`,`bottom`],Hp=[`bottom`,`top`];function Up(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Bp:zp:t?zp:Bp;case`left`:case`right`:return t?Vp:Hp;default:return[]}}function Wp(e,t,n,r){let i=jp(e),a=Up(Ap(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Rp)))),a}function Gp(e){let t=Ap(e);return Dp[t]+e.slice(t.length)}function Kp(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function qp(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Kp(e)}function Jp(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Yp(e,t){return t<0||t>=e.length}function Xp(e,t){return Qp(e.current,{disabledIndices:t})}function Zp(e,t){return Qp(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Qp(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&$p(e,a,r));return a}function $p(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!tm(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function em(e){return e.visibility===`hidden`||e.visibility===`collapse`}function tm(e,t=e?fd(e):null){return!e||!e.isConnected||!t||em(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var nm=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function rm(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return ed(n)?n.host:null}function im(e){for(let t of Array.from(e.children))if(Xu(t)===`summary`)return t;return null}function am(e,t){let n=im(t);return!!n&&(e===n||ff(n,e))}function om(e){let t=e?Xu(e):``;return e!=null&&e.matches(nm)&&(t!==`summary`||e.parentElement!=null&&Xu(e.parentElement)===`details`&&im(e.parentElement)===e)&&(t!==`details`||im(e)==null)&&(t!==`input`||e.type!==`hidden`)}function sm(e){if(!om(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=rm(t)){let n=t!==e,r=Xu(t)===`slot`;if(t.hasAttribute(`inert`)||n&&Xu(t)===`details`&&!t.open&&!am(e,t)||t.hasAttribute(`hidden`)||!r&&!cm(t,n))return!1}return!0}function cm(e,t){let n=fd(e);return t?n.display!==`none`:tm(e,n)}function lm(e){let t=e.tabIndex;if(t<0){let t=Xu(e);if(t===`details`||t===`audio`||t===`video`||X(e)&&e.isContentEditable)return 0}return t}function um(e){if(Xu(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function dm(e,t){let n=um(e);if(!n)return!0;let r=t.find(e=>{let t=um(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=um(e);return t?.name===n.name&&t.form===n.form})===n}function fm(e){if(X(e)&&Xu(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return X(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function pm(e,t){fm(e).forEach(e=>{om(e)&&t.push(e),pm(e,t)})}function mm(e,t,n){fm(e).forEach(e=>{X(e)&&e.matches(t)&&n.push(e),mm(e,t,n)})}function hm(e){return sm(e)&&lm(e)>=0}function gm(e){let t=[];return pm(e,t),t.filter(sm)}function _m(e){let t=gm(e);return t.filter(e=>lm(e)>=0&&dm(e,t))}function vm(e,t){let n=_m(e),r=n.length;if(r===0)return;let i=df(Nd(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function ym(e){return vm(Nd(e).body,1)||e}function bm(e){return vm(Nd(e).body,-1)||e}function xm(e,t){if(!e)return null;let n=_m(Nd(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function Sm(e){return xm(e,1)}function Cm(e){return xm(e,-1)}function wm(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!ff(n,r)}function Tm(e){_m(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Em(e){let t=[];mm(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function Dm(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...Dm(e,t.id,n)])}function Om(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function km(e){return`data-base-ui-${e}`}var Am=0;function jm(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(Am);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),Id;let o=requestAnimationFrame(a);return Am=o,()=>{Am===o&&(cancelAnimationFrame(o),Am=0)}}var Mm={inert:new WeakMap,"aria-hidden":new WeakMap},Nm=`data-base-ui-inert`,Pm={inert:new WeakSet,"aria-hidden":new WeakSet},Fm=new WeakMap,Im=0;function Lm(e){return Pm[e]}function Rm(e){return e?ed(e)?e.host:Rm(e.parentNode):null}var zm=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Rm(t);return e.contains(n)?n:null}).filter(e=>e!=null),Bm=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},Vm=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{Xu(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function Hm(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=zm(t,e),l=i?Vm(t,Bm(c),new Set(c)):[],u=[],d=[];if(a){let e=Mm[a],n=Lm(a);s=n,o=e;let r=zm(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);Vm(t,Bm(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(Fm.get(e)||0)+1;Fm.set(e,t),d.push(e),t===1&&e.setAttribute(Nm,``)}),Im+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(Fm.get(e)||0)-1;Fm.set(e,t),t||e.removeAttribute(Nm)}),--Im,Im||(Mm.inert=new WeakMap,Mm[`aria-hidden`]=new WeakMap,Pm.inert=new WeakSet,Pm[`aria-hidden`]=new WeakSet,Fm=new WeakMap)}}function Um(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=Nd(e[0]).body;return Hm(e,a,n,r,{mark:i})}var Wm=0;function Gm(e,t=`mui`){let[n,r]=D.useState(e),i=e||n;return D.useEffect(()=>{n??(Wm+=1,r(`${t}-${Wm}`))},[n,t]),i}var Km=fp.useId;function qm(e,t){if(Km!==void 0){let n=Km();return e??(t?`${t}-${n}`:n)}return Gm(e,t)}function Jm(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var Ym=Jm(`https://base-ui.com/production-error`,`Base UI`),Xm=19;function Zm(e){return Xm>=e}function Qm(e){if(!D.isValidElement(e))return null;let t=e,n=t.props;return(Zm(19)?n?.ref:t.ref)??null}function $m(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function eh(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function th(e,t){return typeof e==`function`?e(t):e}function nh(e,t){return typeof e==`function`?e(t):e}var rh={};function ih(e,t,n,r,i){if(!n&&!r&&!i&&!e)return oh(t);let a=oh(e);return t&&(a=sh(a,t)),n&&(a=sh(a,n)),r&&(a=sh(a,r)),i&&(a=sh(a,i)),a}function ah(e){if(e.length===0)return rh;if(e.length===1)return oh(e[0]);let t=oh(e[0]);for(let n=1;n<e.length;n+=1)t=sh(t,e[n]);return t}function oh(e){return dh(e)?{...fh(e,rh)}:ch(e)}function sh(e,t){return dh(t)?fh(t,e):lh(e,t)}function ch(e){let t={...e};for(let e in t){let n=t[e];uh(e,n)&&(t[e]=mh(n))}return t}function lh(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=$m(e.style,r);break;case`className`:e[n]=gh(e.className,r);break;default:e[n]=uh(n,r)?ph(e[n],r):r}}return e}function uh(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function dh(e){return typeof e==`function`}function fh(e,t){return dh(e)?e(t):e??rh}function ph(e,t){return t?e?(...n)=>{let r=n[0];if(_h(r)){let i=r;hh(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:mh(t):e}function mh(e){return e&&((...t)=>{let n=t[0];return _h(n)&&hh(n),e(...t)})}function hh(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function gh(e,t){return t?e?t+` `+e:t:e}function _h(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function vh(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=Sh(r));let i=yh(t,n,r);if(n.enabled===!1)return null;let a=n.state??Rd;return Ch(e,r,i,a)}function yh(e,t,n){let{className:r,style:i}=e,{state:a=Rd,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?th(r,a):void 0,d=l?nh(i,a):void 0,f=l?eh(a,c):Rd,p=l&&s?bh(s):void 0,m=l?$m(f,p)??{}:Rd;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?ap([m.ref,Qm(n),...o]):ip(m.ref,Qm(n),o):ip(null,null)),l?(u!==void 0&&(m.className=gh(m.className,u)),d!==void 0&&(m.style=$m(m.style,d)),m):Rd}function bh(e){return Array.isArray(e)?ah(e):ih(void 0,e)}var xh=Symbol.for(`react.lazy`);function Sh(e){if(e?.$$typeof!==xh)return e;let t=D.Children.toArray(e)[0];return D.isValidElement(t)?t:e}function Ch(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=ih(n,t.props);return e.ref=n.ref,D.cloneElement(t,e)}if(e&&typeof e==`string`)return wh(e,n);throw Error(Ym(8))}function wh(e,t){return e===`button`?(0,D.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,D.createElement)(`img`,{alt:``,...t,key:t.key}):D.createElement(e,t)}var Th={style:{transition:`none`}},Eh=`data-base-ui-click-trigger`,Dh={fallbackAxisSide:`end`},Oh={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},kh=c(m(),1),Ah=D.createContext(null),jh=()=>D.useContext(Ah),Mh=km(`portal`);function Nh(e={}){let{ref:t,container:n,componentProps:r=Rd,elementProps:i}=e,a=qm(),o=jh()?.portalNode,[s,c]=D.useState(null),[l,u]=D.useState(null),d=hp(e=>{e!==null&&u(e)}),f=D.useRef(null);J(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&($u(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=vh(`div`,r,{ref:[t,d],props:[{id:a,[Mh]:``},i]}),m=s&&p?kh.createPortal(p,s):null;return{node:l,nodeId:D.isValidElement(p)?p.props.id:void 0,subtree:m}}var Ph=D.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=Nh({container:o,ref:t,componentProps:e,elementProps:c}),f=D.useRef(null),p=D.useRef(null),m=D.useRef(null),h=D.useRef(null),[g,_]=D.useState(null),v=D.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;D.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&wm(e)&&(e.type===`focusin`?v.current&&=(Em(l),!1):(Tm(l),v.current=!0))}return rp(vd(l,`focusin`,e,!0),vd(l,`focusout`,e,!0))},[l,y]),J(()=>{l&&b===!0&&v.current&&(Em(l),v.current=!1)},[b,l]);let S=D.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,H.jsxs)(D.Fragment,{children:[d,(0,H.jsxs)(Ah.Provider,{value:S,children:[x&&l&&(0,H.jsx)(xp,{"data-type":`outside`,ref:f,onFocus:e=>{wm(e,l)?m.current?.focus():bm(g?g.domReference:null)?.focus()}}),x&&l&&(0,H.jsx)(`span`,{role:s,"aria-owns":u,style:Oh}),l&&kh.createPortal(a,l),x&&l&&(0,H.jsx)(xp,{"data-type":`outside`,ref:p,onFocus:e=>{wm(e,l)?h.current?.focus():(ym(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,np(`focus-out`,e.nativeEvent)))}})]})]})});function Fh(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var Ih=class{nodesRef={current:[]};events=Fh();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},Lh=D.createContext(null),Rh=D.createContext(null),zh=()=>D.useContext(Lh)?.id||null,Bh=e=>{let t=D.useContext(Rh);return e??t};function Vh(e){let t=qm(),n=Bh(e),r=zh();return J(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function Hh(e){let{children:t,id:n}=e,r=zh();return(0,H.jsx)(Lh.Provider,{value:D.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Uh(e){let{children:t,externalTree:n}=e,r=Fd(()=>n??new Ih).current;return(0,H.jsx)(Rh.Provider,{value:r,children:t})}function Wh(e){return e==null?e:`current`in e?e.current:e}function Gh(e,t){let n=Zu(pf(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var Kh=20,qh=[];function Jh(){qh=qh.filter(e=>e.deref()?.isConnected)}function Yh(e){Jh(),e&&Xu(e)!==`body`&&(qh.push(new WeakRef(e)),qh.length>Kh&&(qh=qh.slice(-20)))}function Xh(){return Jh(),qh[qh.length-1]?.deref()}function Zh(e){return e?hm(e)?e:_m(e)[0]||e:null}function Qh(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=gm(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return hm(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function $h(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,x=hp(()=>b.current.floatingContext?.nodeId),S=i===!1,C=Vf(_)&&S,w=up(i),T=up(a),E=up(l),O=up(g),k=Bh(p),A=jh(),j=D.useRef(!1),M=D.useRef(!1),N=D.useRef(!1),P=D.useRef(null),F=D.useRef(``),I=D.useRef(``),L=D.useRef(null),R=D.useRef(null),z=ip(L,f,A?.beforeInsideRef),ee=ip(R,A?.afterInsideRef),te=Hd(),ne=Hd(),re=Kd(),ie=A!=null,B=Hf(v),ae=hp((e=B)=>e?_m(e):[]),oe=hp(()=>m?.().filter(e=>e!=null)??[]);D.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&ff(B,df(Nd(B)))&&ae().length===0&&!C&&af(e)}return vd(Nd(B),`keydown`,e)},[r,B,s,C,ae]),D.useEffect(()=>{if(r||!g)return;let e=Nd(B);function t(){N.current=!1}function n(e){let t=pf(e),n=oe(),r=ff(v,t)||ff(_,t)||ff(A?.portalNode,t)||n.some(e=>e===t||ff(e,t));N.current=!r,I.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(M.current=!0,ne.start(0,()=>{M.current=!1}))}function i(){I.current=`keyboard`}return rp(vd(e,`pointerdown`,n,!0),vd(e,`pointerup`,t,!0),vd(e,`pointercancel`,t,!0),vd(e,`keydown`,i,!0),t)},[r,v,_,B,g,A,ne,oe]),D.useEffect(()=>{if(r||!c)return;let e=Nd(B);function t(){M.current=!0,ne.start(0,()=>{M.current=!1})}function n(e){let t=pf(e);hm(t)&&(P.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=pf(t);s&&n==null&&i!=null&&ff(v,i)&&Yh(i),queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=oe(),f=n?.hasAttribute(km(`focus-guard`))&&[L.current,R.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,Wh(d),Wh(u)].includes(n),p=!(ff(_,n)||ff(v,n)||ff(n,v)||ff(A?.portalNode,n)||l.some(e=>e===n||ff(e,n))||c.hasMatchingElement(e=>ff(e,n))||f||k&&(Dm(k.nodesRef.current,a).find(e=>ff(e.context?.elements.floating,n)||ff(e.context?.elements.domReference,n))||Om(k.nodesRef.current,a).find(e=>[e.context?.elements.floating,Hf(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&B&&Qh(B),o&&r!==_&&!tm(i)&&df(e)===e.body){if(X(B)&&(B.focus(),o===`popup`)){re.request(()=>{B.focus()});return}let e=ae(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||B;X(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!s)&&n&&p&&!M.current&&(C||n!==Xh())&&(j.current=!0,h.setOpen(!1,np($f,t)))})}function a(){N.current||(b.current.insideReactTree=!0,te.start(0,()=>{b.current.insideReactTree=!1}))}let l=X(_)?_:null;if(v||l)return rp(l&&vd(l,`focusout`,i),l&&vd(l,`pointerdown`,t),v&&vd(v,`focusin`,n),v&&vd(v,`focusout`,i),v&&A&&vd(v,`focusout`,a,!0))},[r,_,v,B,s,k,A,h,c,o,ae,C,x,b,te,ne,re,u,d,oe]),D.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${km(`portal`)}]`)||[]),t=(k?Om(k.nodesRef.current,x()):[]).find(e=>Vf(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Um([v,...e,L.current,R.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...oe(),t,Wh(d),Wh(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=Um([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,A,C,k,x,u,d,oe]),J(()=>{if(!g||r||!X(B))return;F.current=``,I.current=``;let e=Nd(B),t=df(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(E.current||``):n;if(r===void 0||r===!1||ff(B,t))return;let i=null,a=()=>(i??=ae(B),i[0]||B),o;o=r===!0||r===null?a():Wh(r),o||=a();let s=ff(B,df(e));jm(o,{preventScroll:o===B,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=df(e);return!(t!==o&&ff(B,t))}})})},[r,g,B,ae,w,E,O]),J(()=>{if(r||!B)return;let e=Nd(B),t=df(e),n=E.current==null;Yh(t);function i(e){if(e.open||(F.current=Gh(e.nativeEvent,I.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(j.current=!0),e.reason===`outside-press`){if(e.nested)j.current=!1;else if(sf(e.nativeEvent)||cf(e.nativeEvent))j.current=!1;else{let e=!1;Nd(B).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&Xu(t)!==`body`?t:null,s=n?o||a:a||o;return s||=Xh()||null,typeof i==`boolean`?s:Wh(i)||s||null}return()=>{y.off(`openchange`,i);let t=df(e),n=oe(),r=ff(v,t)||n.some(e=>e===t||ff(e,t))||k&&Dm(k.nodesRef.current,x(),!1).some(e=>ff(e.context?.elements.floating,t)),o=T.current,s=F.current,c=a(s);queueMicrotask(()=>{let n=Zh(c),i=typeof o!=`boolean`;if(o&&!j.current&&X(n)&&(i||n===t||t===e.body||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}j.current=!1})}},[r,v,B,T,E,y,k,_,x,oe]),J(()=>{if(!Ad||g||!v)return;let e=df(Nd(v));X(e)&&zf(e)&&ff(v,e)&&e.blur()},[g,v]),J(()=>{if(!r&&A)return A.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{A.setFocusManagerState(null)}},[r,A,s,g,h,c,_]),J(()=>{if(!r&&B)return Qh(B),()=>{queueMicrotask(Jh)}},[r,B]);let se=!r&&(!s||!C)&&(ie||s);return(0,H.jsxs)(D.Fragment,{children:[se&&(0,H.jsx)(xp,{"data-type":`inside`,ref:z,onFocus:e=>{if(s){let e=ae();jm(e[e.length-1])}else A?.portalNode&&(j.current=!1,wm(e,A.portalNode)?ym(_)?.focus():Wh(d??A.beforeOutsideRef)?.focus())}}),n,se&&(0,H.jsx)(xp,{"data-type":`inside`,ref:ee,onFocus:e=>{s?jm(ae()[0]):A?.portalNode&&(c&&(j.current=!0),wm(e,A.portalNode)?bm(_)?.focus():Wh(u??A.afterOutsideRef)?.focus())}})]})}function eg(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=Yf}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=D.useRef(void 0),f=Kd(),p=Hd(),m=D.useMemo(()=>{function e(e,t,n,r){let i=np(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=lf(e.pointerType,!0)&&cf(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||lf(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=pf(o);if(zf(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}lf(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return D.useMemo(()=>n?{reference:m}:Rd,[n,m])}function tg(){return!1}function ng(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function rg(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=tg,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f,events:p}=l.context,m=Bh(c),h=hp(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,v=hp(()=>a),{escapeKey:y,outsidePress:b}=ng(s),x=D.useRef(!1),S=D.useRef(!1),C=D.useRef(!1),w=D.useRef(!1),T=D.useRef(!1),E=D.useRef(``),O=D.useRef(null),k=Hd(),A=Hd(),j=hp(()=>{A.clear(),f.current.insideReactTree=!1}),M=hp(e=>{let t=f.current.floatingContext?.nodeId;return(m?Dm(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),N=hp(e=>Lf(e,l.select(`floatingElement`))||Lf(e,l.select(`domReferenceElement`))),P=hp(e=>{o()&&l.setOpen(!1,np(Yf,e.nativeEvent))}),F=hp(e=>{if(!u||!n||!r||e.key!==`Escape`||T.current||!y&&M(`__escapeKeyBubbles`))return;let t=np(ep,of(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!y&&!t.isPropagationAllowed&&e.stopPropagation()}),I=hp(()=>{f.current.insideReactTree=!0,A.start(0,j)}),L=hp(e=>{if(!u||!n||e.button!==0)return;let t=pf(e.nativeEvent);ff(l.select(`floatingElement`),t)&&(x.current||(x.current=!0,S.current=!1))}),R=hp(e=>{u&&n&&(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&x.current&&(S.current=!0)});D.useEffect(()=>{function e(e){e.open||(w.current=!1)}return p.on(`openchange`,e),()=>{p.off(`openchange`,e)}},[p]),D.useEffect(()=>{if(!u||!n)return u||(w.current=!1),j;f.current.__escapeKeyBubbles=y,f.current.__outsidePressBubbles=b;let e=new Vd,t=new Vd,i=Nd(d);function a(){e.clear(),T.current=!0}function o(){e.start(Ad?5:0,()=>{T.current=!1})}function s(){C.current=!0,t.start(0,()=>{C.current=!1})}function c(){x.current=!1,S.current=!1}function p(){let e=E.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function h(e){let t=p();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function D(e){let t=f.current.floatingContext?.nodeId,n=m&&Dm(m.nodesRef.current,t).some(t=>Lf(e,t.context?.elements.floating));return N(e)||n}function A(e){if(h(e)){e.type!==`click`&&!N(e)&&(t.clear(),C.current=!1),j();return}if(f.current.insideReactTree){j();return}let n=pf(e),r=`[${km(`inert`)}]`,i=Y(n)?n.getRootNode():null,a=Array.from((ed(i)?i:Nd(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>ff(e,n))))return;let s=Y(n)?n:null;for(;s&&!dd(s);){let e=md(s);if(dd(e)||!Y(e))break;s=e}if(!(a.length&&Y(n)&&!Rf(n)&&!ff(n,l.select(`floatingElement`))&&a.every(e=>!ff(s,e)))){if(X(n)&&!(`touches`in e)){let t=dd(n),r=fd(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!D(e)){if(p()===`intentional`){if(e.detail!==0&&!sf(e)&&!w.current)return;if(C.current){t.clear(),C.current=!1;return}}(typeof g!=`function`||g(e))&&(M(`__outsidePressBubbles`)||(l.setOpen(!1,np(Zf,e)),j()))}}}function P(e){p()===`sloppy`&&e.pointerType!==`touch`&&l.select(`open`)&&n&&!N(e)&&A(e)}function I(e){if(p()!==`sloppy`||!l.select(`open`)||!n||N(e))return;let t=e.touches[0];t&&(O.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},k.start(1e3,()=>{O.current&&(O.current.dismissOnTouchEnd=!1,O.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=pf(e);if(!n)return;let r=vd(n,e.type,()=>{t(e),r()})}function R(e){E.current=`touch`,L(e,I)}function z(e){k.clear(),e.type===`pointerdown`&&(e.button===0&&(w.current=!0),E.current=e.pointerType),(e.type!==`mousedown`||!O.current||O.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?P(e):A(e)})}function ee(e){if(e.type===`pointercancel`&&(w.current=!1),!x.current)return;let n=S.current;if(c(),p()===`intentional`){if(e.type===`pointercancel`){n&&s();return}if(!D(e)){if(n){s();return}(typeof g!=`function`||g(e))&&(t.clear(),C.current=!0,j())}}}function te(e){if(p()!==`sloppy`||!O.current||N(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-O.current.startX),r=Math.abs(t.clientY-O.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(O.current.dismissOnTouchEnd=!0),i>10&&(A(e),k.clear(),O.current=null)}function ne(e){L(e,te)}function re(e){p()===`sloppy`&&O.current&&!N(e)&&(O.current.dismissOnTouchEnd&&A(e),k.clear(),O.current=null)}function ie(e){L(e,re)}let B=rp(r&&rp(vd(i,`keydown`,F),vd(i,`compositionstart`,a),vd(i,`compositionend`,o)),_&&rp(vd(i,`click`,z,!0),vd(i,`pointerdown`,z,!0),vd(i,`pointerup`,ee,!0),vd(i,`pointercancel`,ee,!0),vd(i,`mousedown`,z,!0),vd(i,`mouseup`,ee,!0),vd(i,`touchstart`,R,{capture:!0,passive:!0}),vd(i,`touchmove`,ne,{capture:!0,passive:!0}),vd(i,`touchend`,ie,{capture:!0,passive:!0})));return()=>{B(),e.clear(),t.clear(),c(),C.current=!1,j()}},[f,d,r,_,g,u,n,y,b,F,j,v,M,N,m,l,k]);let z=D.useMemo(()=>({onKeyDown:F,onPointerDown:P,onClick:P}),[F,P]),ee=D.useMemo(()=>({onKeyDown:F,onPointerDown:R,onMouseDown:R,onClickCapture:I,onMouseDownCapture(e){I(),L(e)},onPointerDownCapture(e){I(),L(e)},onMouseUpCapture:I,onTouchEndCapture:I,onTouchMoveCapture:I}),[F,I,L,R]);return D.useMemo(()=>n?{reference:z,floating:ee,trigger:z}:{},[n,z,ee])}function ig(e,t,n){let{reference:r,floating:i}=e,a=Pp(t),o=Fp(t),s=Np(o),c=Ap(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=jp(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ag(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=kp(t,e),p=qp(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Jp(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Jp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var og=50,sg=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ag},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ig(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<og&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ig(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},cg=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=kp(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Ap(r),_=Pp(o),v=Ap(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Gp(o)]:Lp(o)),x=p!==`none`;!d&&x&&b.push(...Wp(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ip(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Pp(t)||T.every(e=>Pp(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Pp(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},lg=new Set([`left`,`top`]);async function ug(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ap(n),s=jp(n),c=Pp(n)===`y`,l=lg.has(o)?-1:1,u=a&&c?-1:1,d=kp(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var dg=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await ug(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},fg=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=kp(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Pp(i),p=Mp(f),m=u[p],h=u[f],g=(e,t)=>Op(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},pg=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=kp(e,t),u={x:n,y:r},d=Pp(i),f=Mp(d),p=u[f],m=u[d],h=kp(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=lg.has(Ap(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},mg=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=kp(e,t),c=await i.detectOverflow(t,s),l=Ap(n),u=jp(n),d=Pp(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Sp(p-c[m],g),y=Sp(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Cp(c.left,c.right):S=p-2*Cp(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function hg(e){let t=fd(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=X(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=wp(n)!==a||wp(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function gg(e){return Y(e)?e:e.contextElement}function _g(e){let t=gg(e);if(!X(t))return Ep(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=hg(t),o=(a?wp(n.width):n.width)/r,s=(a?wp(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var vg=Ep(0);function yg(e){let t=Zu(e);return!ud()||!t.visualViewport?vg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function bg(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Zu(e)}function xg(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=gg(e),o=Ep(1);t&&(r?Y(r)&&(o=_g(r)):o=_g(e));let s=bg(a,n,r)?yg(a):Ep(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Zu(a),t=Y(r)?Zu(r):r,n=e,i=_d(n);for(;i&&t!==n;){let e=_g(i),t=i.getBoundingClientRect(),r=fd(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Zu(i),i=_d(n)}}return Jp({width:u,height:d,x:c,y:l})}function Sg(e,t){let n=pd(e).scrollLeft;return t?t.left+n:xg(Qu(e)).left+n}function Cg(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Sg(e,n),y:n.top+t.scrollTop}}function wg(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Qu(r),s=t?rd(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Ep(1),u=Ep(0),d=X(r);if((d||!a)&&((Xu(r)!==`body`||td(o))&&(c=pd(r)),d)){let e=xg(r);l=_g(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Cg(o,c):Ep(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Tg(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Eg(e){let t=pd(e),n=e.ownerDocument.body,r=Cp(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Cp(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Sg(e),o=-t.scrollTop;return fd(n).direction===`rtl`&&(a+=Cp(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Dg=25;function Og(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Zu(e),a=Qu(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!ud()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Sg(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Dg&&(s-=o)}return{width:s,height:c,x:l,y:u}}function kg(e,t){let n=xg(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=_g(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ag(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Og(e,n,t);else if(t===`document`)r=Eg(Qu(e));else if(Y(t))r=kg(t,n);else{let n=yg(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Jp(r)}function jg(e,t){let n=t.get(e);if(n)return n;let r=gd(e,[],!1).filter(e=>Y(e)&&Xu(e)!==`body`),i=null,a=fd(e).position===`fixed`,o=a?md(e):e;for(;Y(o)&&!dd(o);){let e=fd(o),t=cd(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=md(o)}return t.set(e,r),r}function Mg(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?rd(t)?[]:jg(t,this._c):[].concat(n),r],o=Ag(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ag(t,a[e],i);s=Cp(n.top,s),c=Sp(n.right,c),l=Sp(n.bottom,l),u=Cp(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Ng(e){let{width:t,height:n}=hg(e);return{width:t,height:n}}function Pg(e,t,n){let r=X(t),i=Qu(t),a=n===`fixed`,o=xg(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Ep(0);if((r||!a)&&((Xu(t)!==`body`||td(i))&&(s=pd(t)),r)){let e=xg(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Sg(i));let l=i&&!r&&!a?Cg(i,s):Ep(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Fg(e){return fd(e).position===`static`}function Ig(e,t){if(!X(e)||fd(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Qu(e)===n&&(n=n.ownerDocument.body),n}function Lg(e,t){let n=Zu(e);if(rd(e))return n;if(!X(e)){let t=md(e);for(;t&&!dd(t);){if(Y(t)&&!Fg(t))return t;t=md(t)}return n}let r=Ig(e,t);for(;r&&nd(r)&&Fg(r);)r=Ig(r,t);return r&&dd(r)&&Fg(r)&&!cd(r)?n:r||ld(e)||n}var Rg=async function(e){let t=this.getOffsetParent||Lg,n=this.getDimensions,r=await n(e.floating);return{reference:Pg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function zg(e){return fd(e).direction===`rtl`}var Bg={convertOffsetParentRelativeRectToViewportRelativeRect:wg,getDocumentElement:Qu,getClippingRect:Mg,getOffsetParent:Lg,getElementRects:Rg,getClientRects:Tg,getDimensions:Ng,getScale:_g,isElement:Y,isRTL:zg};function Vg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Hg(e,t,n){let r=null,i,a=Qu(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Tp(d),h=Tp(a.clientWidth-(u+f)),g=Tp(a.clientHeight-(d+p)),_=Tp(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Cp(0,Sp(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Vg(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Zu(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Ug(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=gg(e),u=i||a?[...l?gd(l):[],...t?gd(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Hg(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?xg(e):null;c&&g();function g(){let t=xg(e);h&&!Vg(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Wg=dg,Gg=fg,Kg=cg,qg=mg,Jg=pg,Yg=(e,t,n)=>{let r=new Map,i=n??{},a={...Bg,...i.platform,_c:r};return sg(e,t,{...i,platform:a})},Xg=typeof document<`u`?D.useLayoutEffect:function(){};function Zg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Zg(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Zg(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Qg(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $g(e,t){let n=Qg(e);return Math.round(t*n)/n}function e_(e){let t=D.useRef(e);return Xg(()=>{t.current=e}),t}function t_(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=D.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=D.useState(r);Zg(f,r)||p(r);let[m,h]=D.useState(null),[g,_]=D.useState(null),v=D.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=D.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=D.useRef(null),C=D.useRef(null),w=D.useRef(u),T=c!=null,E=e_(c),O=e_(i),k=e_(l),A=D.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Yg(S.current,C.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Zg(w.current,t)&&(w.current=t,kh.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Xg(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=D.useRef(!1);Xg(()=>(j.current=!0,()=>{j.current=!1}),[]),Xg(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,A);A()}},[b,x,A,E,T]);let M=D.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),N=D.useMemo(()=>({reference:b,floating:x}),[b,x]),P=D.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=$g(N.floating,u.x),r=$g(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Qg(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return D.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var n_=(e,t)=>{let n=Wg(e);return{name:n.name,fn:n.fn,options:[e,t]}},r_=(e,t)=>{let n=Gg(e);return{name:n.name,fn:n.fn,options:[e,t]}},i_=(e,t)=>({fn:Jg(e).fn,options:[e,t]}),a_=(e,t)=>{let n=Kg(e);return{name:n.name,fn:n.fn,options:[e,t]}},o_=(e,t)=>{let n=qg(e);return{name:n.name,fn:n.fn,options:[e,t]}},s_=o((e=>{var t=u();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),c_=o(((e,t)=>{t.exports=s_()})),l_=o((e=>{var t=u(),n=c_();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),u_=o(((e,t)=>{t.exports=l_()})),d_=[],f_=void 0;function p_(){return f_}function m_(e){d_.push(e)}function h_(e){let t=(t,n)=>{let r=Fd(__).current,i;try{f_=r;for(let e of d_)e.before(r);i=e(t,n);for(let e of d_)e.after(r);r.didInitialize=!0}finally{f_=void 0}return i};return t.displayName=e.displayName||e.name,t}function g_(e){return D.forwardRef(h_(e))}function __(){return{didInitialize:!1}}var v_=c_(),y_=u_(),b_=Zm(19)?C_:w_;function x_(e,t,n,r,i){return b_(e,t,n,r,i)}function S_(e,t,n,r,i){let a=D.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,v_.useSyncExternalStore)(e.subscribe,a,a)}m_({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,v_.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function C_(e,t,n,r,i){let a=p_();if(!a)return S_(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function w_(e,t,n,r,i){return(0,y_.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var T_=class{static create(e){return new this(e)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return x_(this,e,t,n,r)}},E_=class extends T_{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){D.useDebugValue(e);let n=this;J(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;J(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;J(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){D.useDebugValue(e);let n=this,r=t!==void 0;J(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return D.useDebugValue(e),x_(this,this.selectors[e],t,n,r)}useContextCallback(e,t){D.useDebugValue(e);let n=hp(t??Id);this.context[e]=n}useStateSetter(e){let t=D.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},D_={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},O_=class extends E_{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Fh(),nested:n,triggerElements:i},D_),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&uf(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function k_(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=D.useRef(null);r===void 0&&f.current===null&&(f.current=new O_({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),J(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};Y(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function A_(e,t=!1,n=!1,r=!1){let[i,a]=D.useState(e&&t?`idle`:void 0),[o,s]=D.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),J(()=>{if(!e&&o&&i!==`ending`&&n){let e=Gd.request(()=>{a(`ending`)});return()=>{Gd.cancel(e)}}},[e,o,i,n]),J(()=>{if(!e||t)return;let n=Gd.request(()=>{a(void 0)});return()=>{Gd.cancel(n)}},[t,e]),J(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=Gd.request(()=>{a(`idle`)});return()=>{Gd.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var j_=null;function M_(e){if(!j_){let e=[];j_=e,queueMicrotask(()=>{j_=null,kh.flushSync(()=>{for(let t of e)t()})})}j_.push(e)}function N_(e,t=!1,n=!1){let r=Kd();return hp((i,a=null)=>{r.cancel();let o=Wh(e);if(o==null)return;let s=o,c=()=>{if(!n){kh.flushSync(i);return}M_(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if(s.getAnimations().some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=gf;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function P_(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=hp(a),s=N_(r,n,i);D.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}var F_={tabIndex:-1,[mf]:``};function I_(e){return t=>t!==`touch`||e.current}function L_(e,t=!1){let n=qm(),r=zh()!=null,i=Fd(()=>e(n,r)).current;return k_({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function R_({handle:e,store:t}){return J(()=>e.attachStore(t),[e,t]),null}function z_(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function B_(e,t){let n=D.useRef(null);return hp(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),z_(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),z_(t))})}function V_(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s}}function H_(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function U_(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=B_(e,n),o=hp(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e);return}if(a==null&&i){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=hp(e=>{a(e),e&&o(e)});return J(()=>(s(t.current),()=>s(null)),[s,t,n,e]),J(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function W_(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=D.useRef(null),i=e.useState(`open`);J(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=np(Jf);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function G_(e,t,n,r){let{mounted:i,setMounted:a,transitionStatus:o}=A_(e,!1,!1,r),s=t.useState(`preventUnmountingOnClose`),c=!e&&s;t.useSyncedValues({mounted:i,transitionStatus:o,preventUnmountingOnClose:c});let l=hp(()=>{a(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return P_({enabled:i&&!e&&!c,open:e,ref:t.context.popupRef,onComplete(){e||l()}}),{forceUnmount:l,transitionStatus:o}}function K_(e,t){e.useSyncedValues(t),J(()=>()=>{e.update({activeTriggerProps:Rd,inactiveTriggerProps:Rd,popupProps:Rd})},[e])}function q_(e,t){J(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),J(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var J_=class{constructor(){this.idMap=new Map}add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};function Y_(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new O_({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Rd,inactiveTriggerProps:Rd,popupProps:Rd}}var X_=e=>e.triggerIdProp??e.activeTriggerId,Z_=e=>e.openProp??e.open,Q_=e=>(e.popupElement?.id??e.floatingId)||void 0;function $_(e,t){return t!==void 0&&Z_(e)&&X_(e)===t}function ev(e,t){return $_(e,t)?!0:t!==void 0&&Z_(e)&&X_(e)==null&&e.triggerCount===1}var tv={open:Z_,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:X_,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Q_,isTriggerActive:(e,t)=>t!==void 0&&X_(e)===t,isOpenedByTrigger:(e,t)=>$_(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&X_(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>ev(e,t)?Q_(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function nv(e){let t=D.useCallback(t=>e===void 0?Id:e.subscribeStore(t),[e]),n=D.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,v_.useSyncExternalStore)(t,n,()=>e?.serverStore)}function rv(e){return iv(e,e.rootContext)}function iv(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=D.useState(null),[d,f]=D.useState(void 0),[p,m]=D.useState(void 0),h=D.useRef(null),g=Bh(r),_=D.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=t_({...e,elements:{..._,...l&&{reference:l}}}),y=Y(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=D.useCallback(e=>{let t=Y(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=D.useCallback(e=>{(Y(e)||e===null)&&(h.current=e,f(e)),(Y(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!Y(e))&&v.refs.setReference(e)},[v.refs,f]),C=D.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=D.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=D.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=D.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return J(()=>{o&&(h.current=o)},[o]),J(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),D.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var av=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Vd,this.restTimeout=new Vd,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},ov=new WeakMap;function sv(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&ov.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),ov.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function cv(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=ov.get(n);a&&a!==e&&sv(a),sv(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,ov.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function lv(e){let t=e.context.dataRef.current,n=Fd(()=>t.hoverInteractionState??av.create()).current;return t.hoverInteractionState||=n,zd(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function uv(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=Bh(),d=zh(),f=lv(a),p=Hd(),m=hp(()=>Kf(l.current.openEvent?.type,f.interactedInside)),h=hp(()=>qf(l.current.openEvent?.type)),g=hp(()=>{sv(f)});J(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),D.useEffect(()=>g,[g]),J(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&Y(c)&&s){let e=c,t=s,n=Nd(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return cv(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),D.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&Dm(u.nodesRef.current,d).length>0)}function t(e){let t=Wf(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,np(Xf,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=pf(e);if(!Bf(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(If(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&Y(o)&&Dm(u.nodesRef.current,r,!1).some(e=>ff(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}g(),h()&&!m()&&t(n)}}function v(t){u&&d&&!e()&&p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,np(Xf,t)),u.events.emit(`floating.closed`,t)})}let y=s;return rp(y&&vd(y,`mouseenter`,c),y&&vd(y,`mouseleave`,_),y&&vd(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var dv={current:null};function fv(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=dv,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,h=`rootStore`in e?e.rootStore:e,{dataRef:g,events:_}=h.context,v=Bh(l),y=lv(h),b=D.useRef(!1),x=up(i),S=up(r),C=up(o),w=up(n),T=up(p),E=up(f),O=hp(()=>Kf(g.current.openEvent?.type,y.interactedInside)),k=hp(()=>T.current?.()!==!1),A=hp((e,t,n)=>{let r=h.context.triggerElements;if(r.hasElement(t))return!e||!ff(e,t);if(!Y(n))return!1;let i=n;return r.hasMatchingElement(e=>ff(e,i))&&(!e||!ff(e,i))}),j=hp(()=>{y.handler&&=(Nd(h.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),M=hp(()=>{sv(y)});return u&&(y.handleCloseOptions=i?.__options),D.useEffect(()=>j,[j]),D.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===Xf,j(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return _.on(`openchange`,e),()=>{_.off(`openchange`,e)}},[n,_,y,j]),D.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Wf(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{h.setOpen(!1,np(Xf,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),h.setOpen(!1,np(Xf,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?h.select(`domReferenceElement`):null);if(!Y(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!lf(y.pointerType))return;let t=Gf(C.current),n=Wf(S.current,`open`,y.pointerType),r=pf(e),i=e.currentTarget??null,o=h.select(`domReferenceElement`),s=i;if(Y(r)&&!h.context.triggerElements.hasElement(r)){for(let e of h.context.triggerElements.elements())if(ff(e,r)){s=e;break}}Y(i)&&Y(o)&&!h.context.triggerElements.hasElement(i)&&ff(i,o)&&(s=o);let c=s!=null&&A(o,s,r),l=h.select(`open`),u=E.current?.()??h.select(`transitionStatus`)===`ending`,d=!l&&u&&b.current,f=!c&&Y(s)&&Y(o)&&ff(o,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,g=!l||c;if(m){k()&&h.setOpen(!0,np(Xf,e,s));return}p||(n?y.openChangeTimeout.start(n,()=>{g&&k()&&h.setOpen(!0,np(Xf,e,s))}):g&&k()&&h.setOpen(!0,np(Xf,e,s)))}function i(t){if(O()){M();return}j();let n=Nd(h.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=g.current.floatingContext??d?.();if(!If(t.relatedTarget,h.context.triggerElements)){if(x.current&&r){h.select(`open`)||y.openChangeTimeout.clear();let i=c.current;y.handler=x.current({...r,tree:v,x:t.clientX,y:t.clientY,onClose(){M(),j(),w.current&&!O()&&i===h.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,y.handler),y.handler(t);return}(y.pointerType!==`touch`||!ff(h.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){ff(t,e.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}let l=m?vd(t,`mouseout`,o):void 0;return s?rp(vd(t,`mousemove`,r,{once:!0}),vd(t,`mouseenter`,r),vd(t,`mouseleave`,i),l):rp(vd(t,`mouseenter`,r),vd(t,`mouseleave`,i),l)},[j,M,g,S,h,n,x,y,u,A,O,a,s,C,c,v,w,d,E,k,m]),D.useMemo(()=>{if(!n)return;function e(e){y.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=h.select(`domReferenceElement`),i=h.select(`open`),o=A(r,n,e.target);if(a&&!lf(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=h.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;cv(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=Gf(C.current);if(i&&!o||s===0||!o&&y.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;y.restTimeout.clear();function c(){if(y.restTimeoutPending=!1,O())return;let e=h.select(`open`);!y.blockMouseMove&&(!e||o)&&k()&&h.setOpen(!0,np(Xf,t,n))}y.pointerType===`touch`?kh.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,O,A,a,h,C,k])}var pv=.1,mv=pv*pv,hv=.5;function gv(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function _v(e,t,n,r,i,a,o,s,c,l){let u=!1;return gv(e,t,n,r,i,a)&&(u=!u),gv(e,t,i,a,o,s)&&(u=!u),gv(e,t,o,s,c,l)&&(u=!u),gv(e,t,c,l,n,r)&&(u=!u),u}function vv(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function yv(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function bv(e={}){let{blockPointerEvents:t=!1}=e,n=new Vd,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*mv;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=pf(r),g=r.type===`mouseleave`,_=ff(u,h),v=ff(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&Y(r.relatedTarget)&&ff(u,r.relatedTarget))return;function y(){return!!(s&&Dm(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=yv(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=yv(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=yv(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=yv(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!vv(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?hv/2:hv*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+hv+1,o=C||T?S.bottom-hv:S.top,s=C?T?S.bottom-hv:S.top:S.bottom-hv;M=_v(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?hv/2:hv*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-hv,o=C||T?S.top+hv:S.bottom,s=C?T?S.top+hv:S.bottom:S.top+hv;M=_v(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?hv/2:hv*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+hv+1,o=w||E?S.right-hv:S.left,s=w?E?S.right-hv:S.left:S.right-hv;M=_v(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?hv/2:hv*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-hv,o=w||E?S.left+hv:S.right,s=w?E?S.left+hv:S.right:S.left+hv;M=_v(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function xv({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=D.useState(0),[u,d]=D.useState(0),f=c===0,p=rg(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=pf(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||ff(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return rf(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),J(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),K_(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var Sv=D.createContext(void 0);function Cv(e){let t=D.useContext(Sv);if(!e&&t===void 0)throw Error(Ym(27));return t}var wv={...tv,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},Tv=class extends E_{constructor(e,t,n){let r=new J_,i=Ev(e,r,t,n);super(i,Dv(r),wv)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(V_(this.state,e,t.trigger)))}};function Ev(e,t,n,r=!1){return{...Y_(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function Dv(e){return{popupRef:D.createRef(),backdropRef:D.createRef(),internalBackdropRef:D.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Ov(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=Cv(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=L_((e,t)=>new Tv({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);q_(b,x),W_(b);let{forceUnmount:w}=G_(x,b);D.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,np(tp))}),[w,b]);let T=x||S;return(0,H.jsxs)(Sv.Provider,{value:b,children:[u&&(0,H.jsx)(R_,{handle:u,store:b}),T&&(0,H.jsx)(xv,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}function kv(e){return Ov(`alert-dialog`,e)}var Av=D.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=Cv(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return vh(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Pf,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),jv=D.createContext(void 0);function Mv(e=!1){let t=D.useContext(jv);if(t===void 0&&!e)throw Error(Ym(16));return t}function Nv(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:D.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function Pv(e,t,{detail:n=0}={}){e.dispatchEvent(new(Zu(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Fv(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=D.useRef(null),s=Mv(!0),c=a??s!==void 0,{props:l}=Nv({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=D.useCallback(()=>{let e=o.current;Iv(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return J(u,[u]),{getButtonProps:D.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return ih({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(hh(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=Iv(r),s=!i&&Lv(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),Pv(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),Pv(r,e)))},onKeyUp(e){if(!t){if(hh(e),a?.(e),e.target===e.currentTarget&&i&&c&&Iv(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),Pv(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:hp(e=>{o.current=e,u()})}}function Iv(e){return X(e)&&e.tagName===`BUTTON`}function Lv(e){return X(e)&&e.tagName===`A`&&!!e.href}var Rv=D.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=Cv(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=Fv({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,np(Qf,e.nativeEvent))}return vh(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})});function zv(e){return qm(e,`base-ui`)}var Bv=D.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Cv(),c=zv(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),vh(`p`,e,{ref:t,props:[{id:c},o]})}),Vv=D.createContext(void 0);function Hv(){let e=D.useContext(Vv);if(e===void 0)throw Error(Ym(26));return e}var Uv=`ArrowUp`,Wv=`ArrowDown`,Gv=`ArrowLeft`,Kv=`ArrowRight`,qv=new Set([Uv,Wv,Gv,Kv,`Home`,`End`]),Jv=`Shift`,Yv=[Jv,`Control`,`Alt`,`Meta`];function Xv(e){return X(e)&&e.tagName===`INPUT`}function Zv(e){return!!(Xv(e)&&e.selectionStart!=null||X(e)&&e.tagName===`TEXTAREA`)}function Qv(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=$v(e,t,`left`),a=ey(e),o=ey(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=$v(e,t,`top`),r=ey(e),i=ey(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function $v(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function ey(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var ty=`--nested-dialogs`,ny=`data-nested-dialog-open`,ry={...Nf,...bf,nestedDialogOpen(e){return e?{[ny]:``}:null}},iy=D.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=Cv(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);Hv(),P_({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?I_(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=vh(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...F_,hidden:!m,onKeyDown(e){qv.has(e.key)&&e.stopPropagation()},style:{[ty]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:ry});return(0,H.jsx)($h,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})});function ay(e){return Zm(19)?e:e?`true`:void 0}var oy=D.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,H.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),sy=D.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Cv(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,H.jsx)(Vv.Provider,{value:n,children:(0,H.jsxs)(Ph,{ref:t,...r,children:[a&&o===!0&&(0,H.jsx)(oy,{ref:i.context.internalBackdropRef,inert:ay(!s)}),e.children]})}):null}),cy=D.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Cv(),c=zv(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),vh(`h2`,e,{ref:t,props:[{id:c},o]})});function ly(e){let t=D.useRef(``),n=D.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:D.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function uy(e,t){let n=D.useRef(e),r=hp(t);J(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function dy(e,t){let{onClick:n,onPointerDown:r}=ly(hp((n,r)=>{(typeof e==`function`?e():e)||t(r||(Td?`touch`:``))}));return D.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}var fy=48,py=(e,t=0)=>{let n=new Int32Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r)-fy-t;return n},my=e=>{let t=new Int32Array(e.length+1);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t},hy=e=>{let t=new Int32Array(e.length),n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r)-fy;n+=i>>>1^-(i&1),t[r]=n}return t},gy=384,_y=[],vy=my(py(`E0500002005282000000002000150000020021820000011200000003022202000300004200120000200420001200021200301200010400162000010000220021010:2192001200220012000220012000200200200400010200040000000000400200108200110100000022010313000162002000020020012020080213000228200000000082000000000120002000120020020040101020300130001001010`)),yy=my(py(`:11111111211111119311546544411119731869:671397415686432441111111111161114151214313433415:78311132233313187211117221449443411141111151152226611131111112212518142224214215421421542142424242516171151615616347111111111197911327451111111111111111111113134714133513411111311111111111111111111112444411111342312715245411117:3`)),by=`@containerabcdefghinlmoprstunderlineviawzccentlignnimatespectuto-colsrowsaglorightnessckdrop-sisbcontrastfiltergrayscalehue-rotateinvertopacityslurrightnessaturateepia-coniclinearpositionradialsizeockurrderttom-belrstxyespacing-xyaretoursorlnt-umnsendspantartainentrasteividerop-shadowurationcorationlay-xyasendillexontromlter-featuresstretchapr-xyayscaleidow-colsrowsue-rotatedentlinesetvert-beringsxyeshadoweiadingftnest-clamp-imageabein-lrstxyskx--b-coniclpositionrsizet-x-y-fromto-fromto-inearfromto-fromto-adialfromto-fromtofromtofromtofromtoblockhinlinew-screenesblockhinlinewbjectpacityrutlinederigin-offsetbelrstxyesrspective-originaceholderioghtng-offsettateundedw-xyz-belrstlreseslr-endspantartaturatecepiahizekewpace-taleroll-xyz-barmpbelrstxyesbelrstxyes-thumbrackadowrink-xyxyartrokeabextora-shadowpckingnsformitionlate-xyz-offsetill-changeoom`,xy=(()=>{let e=vy.length-1,t=new Int32Array(e);for(let n=e-1;n>=0;n--){let e=1,r=n+1;for(let i=vy[n];i<vy[n+1];i++)e+=t[r],r+=t[r];t[n]=e}let n=new Int32Array(vy[e]),r=0;for(let i=0;i<e;i++){let e=i+1;for(let a=vy[i];a<vy[i+1];a++)n[r++]=e,e+=t[e]}return n})(),Sy=py(`02000000000000900<=0?000B000F00F00ŏI0J0LNPRTVX0000]_a00000000000000000000000rst0000000zŏ00000000000
ŏ0000000ŏ00000000000000000000000000000000000000000000000000000000000000Ë000000000000000000000Þ000000000000000000ð0000000ø0ùúûüýþÿĀāĂ㥹Ć000000000000000000000000000000000000000000ħ0ĨĪ00000000000000000000ļĽ00000Ŭ000000`,1),Cy=my(py(`123333359346463635126536711576`)),wy=py(`93203242332583253248325D>E?F@03263243255B:032523853:0325B:8GA032542H<C=12727B:0328432553;D>E?3257D>032585:0325B:;0328B:032`),Ty=py(`012113445661666666789111:5;;;;;;;;444;;;:62999<1161=62>>?61:21@ABCD4446996:64E:::;:?::64:F114GHHIHHHHIHH1HH1HH1HHHHHH::EEJ4444::EE4444441691;644444114244444:;K6666555555555555555999666664444444444444444444444226?6:66644L9M?D:111::::6DE199`),Ey=hy(`020200202020020020020020020020200200200200200200200002020202001003040106000200200200200200200200200200200200200200200200200200200200200200200200200200200200020020020020020020002020200202002002002002002002002002002020002002020020200220200200200200200200200200200200020020020000200020002000200200200020020020002000200200200020020202002020202000200200020022000200200020020002002000200220002002000200W0Z00020020002002020002002000200g0j0002002000200200020020002002000200200020020002000200002000002002002002002000200020000200002002002002002002002020020020200200200200200200200200202020020020020020020020020002002002020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020002002002002002002000200200200200200200200200200020202020002000200020002002002002000020200200`),Dy=(()=>{let e=new Int32Array(319).fill(-1),t=hy(`02422242:222222242224222242442222222422222244442242226224222426222422442462222422622222222626222462242622422622422424242422222222422222222242422222222222222222622442224222222222222224424442262222222222222222222226224222424242422224422422422222`),n=hy(`02222222222222222222202222222222222222222222221422222222222222222222222222222222222Y\\222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221422222222222222222222222222222222222222Ŀł222222222222222222`);for(let r=0;r<t.length;r++)e[t[r]]=n[r];return e})(),Oy=`container |break-after- all auto avoid avoid-page column left page right|break-before- all auto avoid avoid-page column left page right|break-inside-a uto void void-column void-page|box-decoration- clone slice|box- border content| contents flow-root hidden table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group| not-sr-only sr-only|float- end left none right start|clear- both end left none right start|isolat e ion-auto|overflow- auto clip hidden scroll visible|overflow-x- auto clip hidden scroll visible|overflow-y- auto clip hidden scroll visible|overscroll- auto contain none|overscroll-x- auto contain none|overscroll-y- auto contain none| absolute fixed relative static sticky| collapse invisible visible|justify- around baseline between center center-safe end end-safe evenly normal start stretch|justify-items- center center-safe end end-safe normal start stretch|justify-self- auto center center-safe end end-safe start stretch|items- baseline baseline-last center center-safe end end-safe start stretch|self- auto baseline baseline-last center center-safe end end-safe start stretch|place-content- around baseline between center center-safe end end-safe evenly start stretch|place-items- baseline center center-safe end end-safe start stretch|place-self- auto center center-safe end end-safe start stretch| antialiased subpixel-antialiased| italic not-italic|normal-nums |ordinal |slashed-zero | lining-nums oldstyle-nums| proportional-nums tabular-nums| diagonal-fractions stacked-fractions| no-underline overline| capitalize lowercase normal-case uppercase|truncate |whitespace- break-spaces normal nowrap pre pre-line pre-wrap|break- all keep normal words|wrap- anywhere break-word normal|hyphens- auto manual none|mix-blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay plus-darker plus-lighter saturation screen soft-light|table- auto fixed|caption- bottom top|backface- hidden visible|appearance- auto none|scheme- dark light light-dark normal only-dark only-light|field-sizing- content fixed|pointer-events- auto none|resize -none -x -y|snap- align-none center end start|snap- always normal|snap- both none x y|snap- mandatory proximity|touch- auto manipulation none|touch-pan- left right x|touch-pan- down up y|touch-pinch-zoom |select- all auto none text|forced-color-adjust- auto none| normal size| baseline bottom middle sub super text-bottom text-top top| bounce none ping pulse spin| auto square video| auto fr max min px|none | auto full px| fixed local scroll|clip- border content padding text|origin- border content padding| bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| no-repeat repeat repeat-round repeat-space repeat-x repeat-y| auto contain cover| gradient-to-b gradient-to-bl gradient-to-br gradient-to-l gradient-to-r gradient-to-t gradient-to-tl gradient-to-tr none|blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay saturation screen soft-light|to- b bl br l r t tl tr| auto dvh fit full lh lvh max min px screen svh| dashed dotted double hidden none solid| collapse separate|px |auto |full | content none strict| inline-size size|layout |paint |style | around baseline between center center-safe end end-safe evenly normal start stretch| alias all-scroll auto cell col-resize context-menu copy crosshair default e-resize ew-resize grab grabbing help move n-resize ne-resize nesw-resize no-drop none not-allowed ns-resize nw-resize nwse-resize pointer progress row-resize s-resize se-resize sw-resize text vertical-text w-resize wait zoom-in zoom-out| dashed dotted double solid wavy| auto from-font|reverse |initial | in in-out initial linear out| col col-reverse row row-reverse| nowrap wrap wrap-reverse| auto initial none| black bold extrabold extralight light medium normal semibold thin| condensed expanded extra-condensed extra-expanded normal semi-condensed semi-expanded ultra-condensed ultra-expanded|flow- col col-dense dense row row-dense| none subgrid| auto dvh dvw fit full lh lvh lvw max min px screen svh svw| block flex grid table| auto dvw fit full lvw max min px screen svw| loose none normal px relaxed snug tight|through |item | inside outside| decimal disc none| auto px| clip-border clip-content clip-fill clip-padding clip-stroke clip-view no-clip| add exclude intersect subtract| alpha luminance match|origin- border content fill padding stroke view|type- alpha luminance| circle ellipse| closest-corner closest-side farthest-corner farthest-side|at- bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| dvh fit full lh lvh max min none px screen svh| auto dvh dvw fit full lh lvh lvw max min none px screen svh svw| dvw fit full lvw max min none px screen svw| auto dvh dvw fit full lvh lvw max min none prose px svh svw| auto dvh dvw fit full lvh lvw max min none px screen svh svw| contain cover fill none scale-down| first last none| distant dramatic midrange near none normal|inset | full none|3d | auto smooth|gutter- auto both stable| auto none thin| inner none| auto dvh dvw fit full lvh lvw max min px svh svw|base | center end justify left right start| clip ellipsis| balance nowrap pretty wrap| normal tight tighter wide wider widest| cpu gpu none| 3d flat| all colors none opacity shadow transform| discrete normal| full px| auto dvh dvw fit full lvh lvw max min px screen svh svw| auto contents scroll transform`.split(`|`).map(e=>{let t=e.split(` `),n=t.shift();for(let e=0;e<t.length;e++)t[e]=n+t[e];return t}),ky=hy(`0000000000000000000000000000000000000000000000000000000000000262242:6@200000006:240B428:4422400002046044222426220026642642462026224222824220022400000000\\00N222422242222222224062242222222422226264222422222222222222442804222422222222222222222222220<4<0204260002444020204224422`),Ay=hy(`ɠ222222222222222222222222222222222222222222222222222222222222˕4222226>ʶ22ʷʺʷ2ʸʷ42ʴ2ʓ22>621422ɶ222ɹɼɷɺɷɺ22ɱ42222ɨ2ɧ26622ɘɓ244ƸƵ222]d24242ǖǓƚÄȫ2263ȨȥȨ2222222ǣ222222222222222222ǂƽ2ƾƵ2222222422222ƜƑ22222222222222222222144Ŧţ22Ţş222222222222222222222ĸ2ı68ĦģĦɡŰ4Ġ«®ĝ822ĔđĔ2ē2222622`),jy=hy(`02222222222222222222222222222222222222222222222222222222222222222202022222222222EH2200IL021042222Y\\222IL0cf2e10j2222U00X202[^2y0000120|{~22
:22|22222222222G000qOVI00000}2>40000B00000I¨©000¬00000000000000021M®00°000000000000000000000222HGHa1º222¿2À2222ÉÌ000°2±`),My=new Int32Array(995),Ny=new Int32Array(995),Py=new Int32Array(995),Fy=``,Iy=new Int32Array(1038);{let e=new Map,t=0,n=0;for(let r=0;r<ky.length;r++)for(let i of Oy[jy[r]]){let a=e.get(i);a===void 0&&(a=t++,e.set(i,a),Iy[a*2]=Fy.length,Iy[a*2+1]=i.length,Fy+=i),My[n]=ky[r],Ny[n]=Ay[r],Py[n]=a,n++}}var Ly=hy(`0b2N:222@R>F@286¦2@H2D266226FB22B2>BD\\6N22222Z222D222p`),Ry=my(py(`1::24444432:442:44:44>222222:44:4421322511111311111114`)),zy=hy(`24A;33N=C@H4A;33N=C@<27;83:;8393NQ:3NQʰ222ˉºŴŽ2R2=18cƴÅŇ=cĞÛC1ƈǝȈ:ħ25=11D3A@4=<1;1DEr25;11B3?<6;:371BCn9@7=<8192>2E121@9@EHE@9>2T25511<398454131<=V25511<398454131<=ƧNž2Đå242L222290000f22500ɛ000ǘ222`),By=py(`ij`),Vy=py(``),Hy=py(`1`),Uy={GROUP_COUNT:gy,customValidatorNames:_y,edgeStart:vy,labelStart:yy,labelText:by,edgeTarget:xy,nodeGroup:Sy,nodeVlist:Dy,vlistPat:Cy,vlistOps:wy,vlistRef:Ty,vlistGroup:Ey,litAnchor:My,litGroup:Ny,litPool:Py,poolOffsets:Iy,poolText:Fy,adjGid:Ly,adjStart:Ry,adjTgt:zy,patGid:By,patTgt:Vy,postfixLookupGroups:Hy,orderSensitiveModifiers:`* ** after backdrop before details-content file first-letter first-line marker placeholder selection`},Wy=`line`in Error(),Gy=-1,Ky=-1,qy=(e,t,n)=>{let r=2166136261;for(let i=t;i<n;i++)r=Math.imul(r^e.charCodeAt(i),16777619);return r},Jy=(e,t,n)=>{let r=n-t,i=Math.imul(r,2654435761)^e.charCodeAt(t);if(r>3){let a=r>>2,o=r>>1;i=Math.imul(i^e.charCodeAt(t+1)<<8^e.charCodeAt(t+2)<<16^e.charCodeAt(t+a),2246822507),i=Math.imul(i^e.charCodeAt(t+o)<<8^e.charCodeAt(t+o+a)<<16^e.charCodeAt(n-3),3266489909),i^=e.charCodeAt(n-2)<<8^e.charCodeAt(n-1)<<16;for(let r=t+3,a=n-4;r<t+8&&r<a;r++,a--)i=Math.imul(i^e.charCodeAt(r)^e.charCodeAt(a)<<8,16777619)}return i^i>>>15|0},Yy=(e,t,n={})=>{let{GROUP_COUNT:r,edgeStart:i,labelStart:a,labelText:o,edgeTarget:s,nodeGroup:c,nodeVlist:l,vlistPat:u,vlistOps:d,vlistRef:f,vlistGroup:p,litAnchor:m,litGroup:h,litPool:g,poolOffsets:_,poolText:v,adjGid:y,adjStart:b,adjTgt:x,patGid:S,patTgt:C,postfixLookupGroups:w,customValidatorNames:T,orderSensitiveModifiers:E}=e,D=new Int32Array(r).fill(-1);for(let e=0;e<y.length;e++)D[y[e]]=e;let O=0;for(let e=0;e+1<b.length;e++){let t=b[e+1]-b[e];t>O&&(O=t)}let k=32;for(;k<2*(1+O+S.length);)k<<=1;let A=new Int32Array(f.length+1);for(let e=0;e<f.length;e++)A[e+1]=A[e]+u[f[e]+1]-u[f[e]];let j=new Uint8Array(r);for(let e=0;e<w.length;e++)j[w[e]]=1;let M=i.length-1,N=new Uint8Array(M),P=0,F=!0;for(let e=0;e<m.length;e++){N[m[e]]=1;let t=_[g[e]*2+1];t>P&&(P=t);let n=v.charCodeAt(_[g[e]*2]);(n===91||n===40)&&(F=!1)}let I=1;for(;I<m.length*2;)I<<=1;let L=new Int32Array(I).fill(-1);for(let e=0;e<m.length;e++){let t=_[g[e]*2],n=(qy(v,t,t+_[g[e]*2+1])^Math.imul(m[e],2654435761)|0)&I-1;for(;L[n]!==-1;)n=n+1&I-1;L[n]=e}let R=(e,t,n,r)=>{let i=(qy(t,n,r)^Math.imul(e,2654435761)|0)&I-1,a=r-n;for(;;){let r=L[i];if(r===-1)return-1;if(m[r]===e&&_[g[r]*2+1]===a){let e=_[g[r]*2],i=!0;for(let r=0;r<a;r++)if(v.charCodeAt(e+r)!==t.charCodeAt(n+r)){i=!1;break}if(i)return h[r]}i=i+1&I-1}},z=n.cacheSize??8192,ee=n.prefix??e.prefix??``,te=ee===``?``:ee+`:`,ne=te.length,re=(T??[]).map(e=>{let n=t&&t[e];if(!n)throw Error(`cn: missing validator `+e);return n}),ie=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,B=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ae=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,oe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,se=0,ce=-1,le=-1,V=-1,ue=-1,de=e=>e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95,fe=e=>/\s/.test(String.fromCharCode(e)),pe=(e,t,n)=>{if(se=0,ce=-1,n-t<3)return;let r=e.charCodeAt(t),i=e.charCodeAt(n-1);if(r===91&&i===93)se=1;else if(r===40&&i===41)se=2;else return;V=t+1,ue=n-1;let a=t+1;if(de(e.charCodeAt(a))){for(a++;a<n-1;){let t=e.charCodeAt(a);if(!de(t)&&t!==45)break;a++}a<n-2&&e.charCodeAt(a)===58&&(ce=t+1,le=a,V=a+1)}},me=(e,t,n,r)=>{if(n-t!==r.length)return!1;for(let n=0;n<r.length;n++)if(e.charCodeAt(t+n)!==r.charCodeAt(n))return!1;return!0},he=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ge=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_e=e=>!!e&&!Number.isNaN(Number(e)),ve=(e,t,n)=>{if(n-t<11||!me(e,t,t+10,`@container`))return!1;if(e.charCodeAt(t+10)===47)return n-t>=12;let r=e.charCodeAt(t+11);return r===115&&n-t>=17&&me(e,t+10,t+16,`-size/`)||r===110&&n-t>=19&&me(e,t+10,t+18,`-normal/`)},ye=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],be=`length|number|number weight|family-name|position percentage|length size bg-size|image url|shadow|length|family-name|position percentage|length size bg-size|image url|shadow|number weight`.split(`|`).map(e=>e.split(` `)),xe=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],Se=(e,t,n,r)=>{if(e>=10){if(e>=25)return re[e-25](t.slice(n,r));let i=e-10;if(se!==ye[i])return!1;if(ce>=0){for(let e of be[i])if(me(t,ce,le,e))return!0;return!1}switch(xe[i]){case 0:return!1;case 1:return!0;case 2:{let e=t.slice(V,ue);return ie.test(e)&&!B.test(e)}case 3:return _e(t.slice(V,ue));case 4:return oe.test(t.slice(V,ue));default:return ae.test(t.slice(V,ue))}}switch(e){case 0:return!0;case 1:return se===0;case 2:return se===1;case 3:return se===2;case 4:return he.test(t.slice(n,r));case 5:return _e(t.slice(n,r));case 6:{let e=t.slice(n,r);return!!e&&Number.isInteger(Number(e))}case 7:return r>n&&t.charCodeAt(r-1)===37&&_e(t.slice(n,r-1));case 8:return ge.test(t.slice(n,r));default:return ve(t,n,r)}},Ce=new Set(typeof E==`string`?E.split(` `):E),we=(e,t,n,r,i,a)=>{let o=qy(t,n,r)^(i?2654435769:0)|0,s=e.get(o);if(s!==void 0)outer:for(let e=0;e<s.length;e++){let a=s[e];if(a.imp===i&&a.k.length===r-n){for(let e=0;e<a.k.length;e++)if(a.k.charCodeAt(e)!==t.charCodeAt(n+e))continue outer;return a.id}}else e.set(o,s=[]);let c=t.slice(n,r),l=a(c);return s.push({k:c,imp:i,id:l}),l},Te=new Map,Ee=new Map,De=2,Oe=4096,ke=(e,t)=>{let n=[],r=0,i=0,a=0;for(let t=0;t<e.length;t++){let o=e.charCodeAt(t);r===0&&i===0&&o===58?(n.push(e.slice(a,t)),a=t+1):o===91?r++:o===93?r--:o===40?i++:o===41&&i--}n.push(e.slice(a));let o=n[0];if(n.length>1){let e=[],t=[];for(let r of n)r.charCodeAt(0)===91||Ce.has(r)?(t.length&&(e.push(...t.sort()),t=[]),e.push(r)):t.push(r);t.length&&e.push(...t.sort()),o=e.join(`:`)}let s=t?o+` !`:o,c=Ee.get(s);return c===void 0&&Ee.set(s,c=De++),c},Ae=new Map,je=r,Me=r+4096,Ne=()=>je++,Pe=2097152,Fe=8192,Ie=new Int32Array(Fe),Le=Array(Fe).fill(null),Re=new Int32Array(Fe),ze=new Int32Array(Fe),Be=new Uint8Array(Fe),Ve=0,He=(e,t,n,r,i,a,o,s)=>{let c=e;if(Le[e]!==null){if(Le[e|1]===null)c=e|1;else if(!(Ve++&3))c=e|Ve>>2&1;else return}Le[c]=t.slice(n,r),Ie[c]=i,Re[c]=a,ze[c]=o,Be[c]=s},Ue=()=>Le.fill(null),We=256,Ge=[new Int32Array(We),new Int32Array(We),new Int32Array(We),new Int32Array(We)],[Ke,qe,Je,Ye]=Ge,Xe=new Uint8Array(We),Ze=new Uint8Array(We),Qe=()=>{We*=2,Ge=Ge.map(e=>{let t=new Int32Array(We);return t.set(e),t}),[Ke,qe,Je,Ye]=Ge;let e=new Uint8Array(We);e.set(Xe),Xe=e,Ze=new Uint8Array(We)},$e=64,et=new Int32Array($e),tt=new Int32Array($e),H=new Int32Array(r),nt=2048,rt=21,it=new Float64Array(nt),at=new Int32Array(nt),ot=0,st=(e,t)=>{if(e===0&&t<r)return H[t]===ot?1:(H[t]=ot,0);let n=e*2097152+t+1,i=Math.imul(n,2654435761)>>>rt;for(;at[i]===ot;){if(it[i]===n)return 1;i=i+1&nt-1}return it[i]=n,at[i]=ot,0},ct=(e,t,n,r,i)=>{if(n-t>=2&&e.charCodeAt(t)===91&&e.charCodeAt(n-1)===93){let r=-1;for(let i=t+1;i<n-1;i++)if(e.charCodeAt(i)===58){r=i;break}return r===-1||r===t+1?Gy:we(Ae,e,t+1,r,0,Ne)}if(r>=0&&c[r]>=0)return c[r];for(let t=i-1;t>=0;t--){let r=tt[t];if(r>n)continue;let i=et[t],a=n-r;if(N[i]===1&&a>0&&a<=P){let t=e.charCodeAt(r);if(F===!1||t!==91&&t!==40){let t=R(i,e,r,n);if(t>=0)return t}}let o=l[i];if(o<0)continue;let s=f[o],c=u[s],m=u[s+1];if(c===m)continue;pe(e,r,n);let h=A[o]-c;for(let t=c;t<m;t++)if(Se(d[t],e,r,n))return p[h+t]}return Gy},lt=e=>{let t=e.length,n=0,c=0,u=!1;(De>Oe||Te.size>Oe)&&(Te=new Map,Ee=new Map,De=2,Ue()),je>Me&&(Ae=new Map,je=r,Ue());let d=0;for(;d<t;){let f=e.charCodeAt(d);if(f===32||f>=9&&f<=13||f>=160&&fe(f)){f!==32&&(u=!0),d++;continue}let p=d,m=0;for(;d<t;){if(f=e.charCodeAt(d),f<=32){if(f===32)break;if(f>=9&&f<=13){u=!0;break}}else if(f>=160&&fe(f)){u=!0;break}m=Math.imul(m^f,16777619),d++}let h=d,g=h-p;n===We&&Qe();let _=n++;Ke[_]=p,qe[_]=h,c+=g,m^=Math.imul(g,2654435761);let v=m^m>>>15|0,y=v&8190;{let t=-1;if(Ie[y]===v&&Le[y]!==null&&Le[y].length===g?t=y:Ie[y|1]===v&&Le[y|1]!==null&&Le[y|1].length===g&&(t=y|1),t>=0){let n=Le[t],r=!0;for(let t=0;t<g;t++)if(n.charCodeAt(t)!==e.charCodeAt(p+t)){r=!1;break}if(r){Je[_]=Re[t],Ye[_]=ze[t],Xe[_]=Be[t];continue}}}let b=p;if(ne!==0){if(h-p<=ne||!e.startsWith(te,p)){Je[_]=Gy,He(y,e,p,h,v,Gy,0,0);continue}b=p+ne}let x=0,S=0,C=-1,w=-1;for(let t=b;t<h;t++){let n=e.charCodeAt(t);if(x===0&&S===0){if(n===58){C=t;continue}if(n===47){w=t;continue}}n===91?x++:n===93?x--:n===40?S++:n===41&&S--}let T=C>=b?C+1:b,E=T,D=h,O=!1,k=0;D>E&&e.charCodeAt(D-1)===33?(O=!0,D--):D>E&&e.charCodeAt(E)===33&&(O=!0,E++,k=1);let A=-1;w>T&&(A=w+k,A>=D&&(A=-1));let M=E;D-E>1&&e.charCodeAt(E)===45&&(M=E+1);let P=0,F=0,I=0,L=-1,R=0;(l[0]>=0||N[0]===1)&&(et[0]=0,tt[0]=M,R=1);let z=Ky,ee=0;for(let t=M;t<D;t++)if(t===A&&(z=F<I?Ky:P,ee=R),P!==Ky){let n=e.charCodeAt(t),r=-1;if(F<I)o.charCodeAt(F)===n?(F++,F===I&&(r=P=L)):P=Ky;else{let e=i[P],t=i[P+1],c=Ky;for(let i=e;i<t;i++){let e=a[i];if(o.charCodeAt(e)===n){a[i+1]-e===1?r=c=s[i]:(F=e+1,I=a[i+1],L=s[i],c=P);break}}P=c}if(r>=0&&(l[r]>=0||N[r]===1)&&t+1<D&&e.charCodeAt(t+1)===45){if(R===$e){$e*=2;let e=new Int32Array($e);e.set(et),et=e;let t=new Int32Array($e);t.set(tt),tt=t}et[R]=r,tt[R]=t+2,R++}}A===D&&(z=F<I?Ky:P,ee=R);let re=F<I?Ky:P,ie,B=!1;if(A>=0){if(B=!0,ie=ct(e,E,A,z,ee),ie!==Gy&&ie<r&&j[ie]){let t=ct(e,E,D,re,R);t!==Gy&&t!==ie&&(ie=t,B=!1)}else ie===Gy&&(ie=ct(e,E,D,re,R),B=!1)}else ie=ct(e,E,D,re,R);let ae=0,oe=0;ie===Gy?Je[_]=Gy:(oe=+!!B,ae=b>=C?+!!O:we(Te,e,b,C,+!!O,e=>ke(e,O)),Je[_]=ie,Xe[_]=oe,Ye[_]=ae),He(y,e,p,h,v,ie,ae,oe)}if(n===0)return``;if(n===1)return Ke[0]===0&&qe[0]===t?e:e.slice(Ke[0],qe[0]);if(n*k>nt){for(;n*k>nt;)nt<<=1,rt--;it=new Float64Array(nt),at=new Int32Array(nt)}if(De>=Pe||je>=Pe)throw Error(`cn: too many distinct classes in one merge`);ot=ot+1|0,ot===0&&(H.fill(0),at.fill(0),ot=1);let f=!1;for(let e=n-1;e>=0;e--){let t=Je[e];if(t===Gy){Ze[e]=1;continue}let n=Ye[e];if(st(n,t)===1){Ze[e]=0,f=!0;continue}if(Ze[e]=1,t<r){let r=D[t];if(r>=0)for(let e=b[r];e<b[r+1];e++)st(n,x[e]);if(Xe[e]&1)for(let e=0;e<S.length;e++)S[e]===t&&st(n,C[e])}}if(!f&&!u&&t===c+n-1)return e;let p=``,m=0;for(;m<n;){if(!Ze[m]){m++;continue}let t=Ke[m],r=qe[m],i=m+1;for(;i<n&&Ze[i]&&Ke[i]===r+1&&e.charCodeAt(r)===32;)r=qe[i],i++;p.length>0&&(p+=` `),p+=e.slice(t,r),m=i}return p},ut=16384,dt=new Int32Array(ut*2),ft=0,pt=1,mt=Object.create(null),ht=Object.create(null),gt=new Map,_t=new Map,vt=0,yt=0,bt=()=>{ft^=ut,pt=pt+1|0,yt=0},xt=e=>{let t=mt[e];if(t!==void 0)return t;let n=Jy(e,0,e.length),r=(n&16383)+ft,i=dt[r]===(n^pt)||dt[r^ut]===(n^pt-1);return i&&(t=ht[e],t!==void 0)?(mt[e]=t,t):(t=lt(e),i?(mt[e]=t,++vt>z&&(vt=0,ht=mt,mt=Object.create(null),bt())):(dt[r]=n^pt,++yt>ut&&bt()),t)},St=e=>{let t=gt.get(e);if(t!==void 0)return t;let n=Jy(e,0,e.length),r=(n&16383)+ft,i=dt[r]===(n^pt)||dt[r^ut]===(n^pt-1);return i&&(t=_t.get(e),t!==void 0)?(gt.set(e,t),t):(t=lt(e),i?(gt.set(e,t),++vt>z&&(vt=0,_t=gt,gt=new Map,bt())):(dt[r]=n^pt,++yt>ut&&bt()),t)},Ct=e=>{let t=Jy(e,0,e.length),n=(t&16383)+ft;return dt[n]===(t^pt)||dt[n^ut]===(t^pt-1)||(dt[n]=t^pt,++yt>ut&&bt(),!1)},wt=z===0?lt:Wy?e=>{let t=gt.get(e);return t===void 0?St(e):t}:xt;return{merge:function(){return arguments.length===1&&typeof arguments[0]==`string`?wt(arguments[0]):wt(Qy.apply(null,arguments))},mergeString:wt,seenBefore:z===0?()=>!1:Ct,mergeUncached:lt}},Xy=(e,t)=>{if(!e)return``;if(typeof e==`string`)return e;let n=``;if(typeof e.length==`number`&&(!t||Array.isArray(e))){let r=e;for(let e=0;e<r.length;e++){let i=r[e];if(!i)continue;let a=typeof i==`string`?i:Xy(i,t);a&&(n&&(n+=` `),n+=a)}return n}if(t){if(typeof e==`number`)return``+e;if(typeof e==`object`)for(let t in e)e[t]&&(n&&(n+=` `),n+=t)}return n},Zy=(e,t)=>{let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(!i)continue;let a=typeof i==`string`?i:Xy(i,t);a&&(n&&(n+=` `),n+=a)}return n},Qy=function(){return Zy(arguments,!1)},$y=256,eb=16,tb=1024,nb=4096,rb=(e,t)=>{let n=t===void 0?()=>!0:t.seenBefore,r=t===void 0?e:t.mergeUncached,i=new Map,a=new Map,o=0,s=null,c=null,l=[],u=[],d=0,f=(t,n,r)=>{c===null&&(c=Array(nb).fill(``),l=Array(nb).fill(``),u=Array(nb).fill(``));let i=Jy(t,0,t.length)&4094;if(c[i]===t&&l[i]===n)return u[i];if(c[i|1]===t&&l[i|1]===n)return u[i|1];let a=e(r?n+` `+t:t),o=c[i]===``?i:i|(c[i|1]===``?1:d++&1);return c[o]=t,l[o]=n,u[o]=a,a},p=(e,t,n,r)=>{let i=0;if(t){if(t!==e.a0)return!1;i=1}if(n){if(n!==(i===0?e.a0:e.a1))return!1;i++}if(r){if(r!==(i===0?e.a0:i===1?e.a1:e.a2))return!1;i++}return i===e.t},m=(e,t)=>{let n=e.a,r=0;for(let e=0;e<t.length;e++){let i=t[e];if(i){if(i!==n[r])return!1;r++}}return r===e.t},h=(t,c)=>{let l=t.length,u=s===null?null:s.n;if(!c){if(u!==null&&m(u,t))return s=u,u.r;if(s!==null&&s!==u&&m(s,t))return s.r}let d=``,p=-1,h=0,g=!1;for(let e=0;e<l;e++){let n=t[e];if(n){if(typeof n!=`string`){if(n=t[e]=Xy(n,!0),!n)continue;g=!0}p<0&&(d=n,p=e),h++}}if(h===0)return``;if(h===1)return e(d);if(g){if(u!==null&&m(u,t))return s=u,u.r;if(s!==null&&s!==u&&m(s,t))return s.r}let _=i.get(d);_===void 0&&(_=a.get(d),_!==void 0&&i.set(d,_));let v=null;if(_!==void 0){if(_.skip>0){_.skip--,s=null;let e=d;for(let n=p+1;n<l;n++){let r=t[n];r&&(e+=` `+r)}return f(e,``,!1)}let e=_.e;outer:for(let n=0;n<e.length;n++){let r=e[n];if(r.t!==h)continue;let i=r.a,a=1;for(let e=p+1;e<l;e++){let n=t[e];if(n&&n!==i[a++])continue outer}v=r;break}v!==null&&(_.miss=0)}if(v===null){let s=d,c=[d];for(let e=p+1;e<l;e++){let n=t[e];n&&(s+=` `+n,c.push(n))}if(!n(s))return r(s);v={r:e(s),t:c.length,a0:c[0],a1:c[1],a2:c[2]??``,a:c,n:null},_===void 0?i.set(d,_={e:[],miss:0,skip:0,at:0}):++_.miss>eb&&(_.miss=eb,_.skip=tb,_.e.length=0,_.at=0);let u=_.e;u.length<$y?u.push(v):(u[_.at]=v,_.at=_.at+1&255),++o>1e3&&(o=0,a=i,i=new Map)}return s!==null&&s!==v&&(s.n=v),s=v,v.r},g=t=>Array.isArray(t)?h(t.slice(),!1):e(Xy(t,!0));return function(t,n,r){let a=arguments.length;if((a|1)==3){let e=s;if(e!==null){let i=e.n;if(i!==null&&p(i,t,n,r))return s=i,i.r;if(e!==i&&p(e,t,n,r))return e.r}if(a===2&&typeof n==`string`&&n!==``){let e=i.get(t);if(e!==void 0&&e.skip>0)return e.skip--,s=null,f(n,t,!0)}return h([t,n,r],!0)}if(a===1)return typeof t==`string`?e(t):g(t);let o=s;if(o!==null){let e=o.n;if(e!==null){let t=e.a,n=0,r=!0;for(let e=0;e<a;e++){let i=arguments[e];if(i){if(i!==t[n]){r=!1;break}n++}}if(r&&n===e.t)return s=e,e.r}if(o!==e){let e=o.a,t=0,n=!0;for(let r=0;r<a;r++){let i=arguments[r];if(i){if(i!==e[t]){n=!1;break}t++}}if(n&&t===o.t)return o.r}}let c=[];for(let e=0;e<a;e++)c.push(arguments[e]);return h(c,!0)}},ib=Yy(Uy),ab=rb(ib.mergeString,ib);ib.merge;var ob=D.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=Fv({disabled:i,focusableWhenDisabled:a,native:o});return vh(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})});function sb(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=sb(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function cb(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=sb(e))&&(r&&(r+=` `),r+=t);return r}var lb=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,ub=cb,db=(e,t)=>n=>{if(t?.variants==null)return ub(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=lb(t)||lb(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return ub(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},fb=db(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function pb({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,H.jsx)(ob,{"data-slot":`button`,className:ab(fb({variant:t,size:n,className:e})),...r})}function mb({...e}){return(0,H.jsx)(kv,{"data-slot":`alert-dialog`,...e})}function hb({...e}){return(0,H.jsx)(sy,{"data-slot":`alert-dialog-portal`,...e})}function gb({className:e,...t}){return(0,H.jsx)(Av,{"data-slot":`alert-dialog-overlay`,className:ab(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function _b({className:e,size:t=`default`,...n}){return(0,H.jsxs)(hb,{children:[(0,H.jsx)(gb,{}),(0,H.jsx)(iy,{"data-slot":`alert-dialog-content`,"data-size":t,className:ab(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function vb({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:ab(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function yb({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:ab(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function bb({className:e,...t}){return(0,H.jsx)(cy,{"data-slot":`alert-dialog-title`,className:ab(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function xb({className:e,...t}){return(0,H.jsx)(Bv,{"data-slot":`alert-dialog-description`,className:ab(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Sb({className:e,...t}){return(0,H.jsx)(pb,{"data-slot":`alert-dialog-action`,className:ab(e),...t})}function Cb({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,H.jsx)(Rv,{"data-slot":`alert-dialog-cancel`,className:ab(e),render:(0,H.jsx)(pb,{variant:t,size:n}),...r})}var wb=D.createContext(void 0);function Tb(e){let t=D.useContext(wb);if(t===void 0&&!e)throw Error(Ym(47));return t}var Eb={...tv,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},Db=class extends E_{constructor(e,t,n){let r=new J_;super(Ob(e,r,t,n),kb(r),Eb)}setOpen=(e,t)=>{let n=t.reason===Xf,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=H_(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=V_(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),kh.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function Ob(e,t,n,r=!1){let i={...Y_(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function kb(e){return{popupRef:D.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:D.createRef(),beforeContentFocusGuardRef:D.createRef(),stickIfOpenTimeout:new Vd,triggerElements:e}}var Ab=h_(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Mb(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),q_(u,d),W_(u);let{forceUnmount:m}=G_(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o}),D.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),D.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,np(tp))}),[m,u]);let h=d||f;return(0,H.jsxs)(wb.Provider,{value:u,children:[s&&(0,H.jsx)(R_,{handle:s,store:u}),h&&(0,H.jsx)(Nb,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function jb(e){return Tb(!0)?(0,H.jsx)(Ab,{props:e}):(0,H.jsx)(Uh,{children:(0,H.jsx)(Ab,{props:e})})}function Mb(e,t){let n=L_((e,n)=>new Db(t,e,n));return D.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function Nb({store:e,modal:t}){let n=rg(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return K_(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}function Pb(e,t){let n=D.useRef(null);function r(t){kh.flushSync(()=>{e.setOpen(!1,np($f,t.nativeEvent,t.currentTarget))}),Cm(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&wm(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{kh.flushSync(()=>{e.setOpen(!1,np($f,n.nativeEvent,n.currentTarget))});let i=Sm(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&ff(r,i);){let e=i;if(i=ym(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}var Fb=g_(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=Tb(!0),h=nv(s)??m;if(!h)throw Error(Ym(74));let g=zv(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=D.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=U_(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`openChangeReason`),T=h.useState(`stickIfOpen`),E=h.useState(`openMethod`),O=h.useState(`focusManagerModal`),k=fv(v,{enabled:!a&&l&&(E!==`touch`||w!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:bv(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),A=eg(v,{stickIfOpen:T}),j=dy(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),M=h.useState(`triggerProps`,C),{getButtonProps:N,buttonRef:P}=Fv({disabled:a,native:o}),F={open(e){return e&&w===`trigger-press`?Mf.open(e):jf.open(e)}},{preFocusGuardRef:I,handlePreFocusGuardFocus:L,handleFocusTargetFocus:R}=Pb(h,x),z=vh(`button`,e,{state:{disabled:a,open:y},ref:[P,t,S,x],props:[A.reference,k,M,j,{[Eh]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,N],stateAttributesMapping:F}),ee=(0,H.jsx)(D.Fragment,{children:z},g);return C&&!O?(0,H.jsxs)(D.Fragment,{children:[(0,H.jsx)(xp,{ref:I,onFocus:L}),ee,(0,H.jsx)(xp,{ref:h.context.triggerFocusTargetRef,onFocus:R})]}):ee}),Ib=D.createContext(void 0);function Lb(){let e=D.useContext(Ib);if(e===void 0)throw Error(Ym(45));return e}var Rb=D.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Tb().useState(`mounted`)||n?(0,H.jsx)(Ib.Provider,{value:n,children:(0,H.jsx)(Ph,{ref:t,...r})}):null}),zb=D.createContext(void 0);function Bb(){let e=D.useContext(zb);if(!e)throw Error(Ym(46));return e}var Vb=D.createContext(void 0);function Hb(){return D.useContext(Vb)?.direction??`ltr`}var Ub=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=kp(e,t)||{};if(l==null)return{};let f=qp(u),p={x:n,y:r},m=Fp(i),h=Np(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=Op(k,j,A),N=!c.arrow&&jp(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),Wb=(e,t)=>{let{name:n,fn:r}=Ub(e);return{name:n,fn:r,options:[e,t]}},Gb={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},Kb={sideX:`left`,sideY:`top`},qb=`--available-width`,Jb=`--available-height`,Yb=`--anchor-width`,Xb=`--anchor-height`,Zb=`--transform-origin`,Qb=qb,$b=Jb;function ex(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function tx(e,t,n){let{rects:r,placement:i}=e;return{side:ex(t,Ap(i),n),align:jp(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function nx(e){return rx(e,rv)}function rx(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=D.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,O=_.fallbackAxisSide||`end`,k=v?.crossAxis??!1,A=v?.rootBoundary,j=typeof n==`function`?n:void 0,M=hp(j),N=j?M:n,P=up(n),F=up(g),I=Hb()===`rtl`,L=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":I?`left`:`right`,"inline-start":I?`right`:`left`}[i],R=o===`center`?L:`${L}-${o}`,z=l;typeof z==`number`?z={top:z,right:z,bottom:z,left:z}:z&&={top:z.top||0,right:z.right||0,bottom:z.bottom||0,left:z.left||0};let ee=+(i===`bottom`),te=+(i===`top`),ne=+(i===`right`),re=+(i===`left`),ie={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:z},B=D.useRef(null),ae=up(a),oe=up(s),se=typeof a==`function`?0:a,ce=typeof s==`function`?0:s,le=[];p&&le.push(p),le.push(n_(e=>{let t=tx(e,i,I),n=typeof ae.current==`function`?ae.current(t):ae.current,r=typeof oe.current==`function`?oe.current(t):oe.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[se,ce,I,i]));let V=E===`none`&&T!==`shift`,ue=!V&&(u||k||T===`shift`),de=T===`none`?null:a_({...ie,padding:{top:z.top+1+ee,right:z.right+1+re,bottom:z.bottom+1+te,left:z.left+1+ne},mainAxis:!k&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:O}),fe=V?null:r_({...ie,rootBoundary:A,mainAxis:E!==`none`,crossAxis:ue,limiter:u||k?void 0:i_(e=>{if(!B.current)return{};let{width:t,height:n}=B.current.getBoundingClientRect(),r=Pp(Ap(e.placement)),i=r===`y`?t:n,a=r===`y`?z.left+z.right:z.top+z.bottom;return{offset:i/2+a/2}})},[ie,u,k,A,z,E]);T===`shift`||E===`shift`||o===`center`?le.push(fe,de):le.push(de,fe),le.push(o_({...ie,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!F.current)return;let i=e.style;i.setProperty(Qb,`${t}px`),i.setProperty($b,`${n}px`);let a=Zu(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(Yb,`${u}px`),i.setProperty(Xb,`${d}px`)}}),Wb(e=>({element:B.current||Nd(e.elements.floating).createElement(`div`),padding:B.current?d:0,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=Ap(r),u=jp(r),d=Pp(l)===`y`,f=B.current,p=typeof a==`function`?a(tx(e,i,I)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return ue&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(Zb,d?`${m} ${h}`:`${h} ${m}`),{}}},Gb,b),J(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let pe=D.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:me,elements:he,x:ge,y:_e,middlewareData:ve,update:ye,placement:be,context:xe,isPositioned:Se,floatingStyles:Ce}=t({rootContext:h,open:m?g:void 0,placement:R,middleware:le,strategy:r,whileElementsMounted:m?void 0:(...e)=>Ug(...e,pe),nodeId:y,externalTree:S}),{sideX:we,sideY:Te}=ve.adaptiveOrigin||Kb,Ee=Se?r:`fixed`,De=D.useMemo(()=>{let e;return e=Se?b?{position:Ee,[we]:ge,[Te]:_e}:{...Ce,position:Ee}:{position:Ee,top:0,left:0},e[Qb]=`100vw`,e[$b]=`100vh`,Se||(e.opacity=0),e},[b,Ee,we,ge,Te,_e,Ce,Se]),Oe=D.useRef(null);J(()=>{if(!g)return;let e=P.current,t=typeof e==`function`?e():e,n=(ix(t)?t.current:t)||null;n!==Oe.current&&(me.setPositionReference(n),Oe.current=n)},[g,me,N,P]),D.useEffect(()=>{if(!g)return;let e=P.current;typeof e!=`function`&&ix(e)&&e.current!==Oe.current&&(me.setPositionReference(e.current),Oe.current=e.current)},[g,me,N,P]),D.useEffect(()=>{if(m&&g&&he.reference&&he.floating)return Ug(he.reference,he.floating,ye,pe)},[m,g,he,ye,pe]);let ke=Ap(be),Ae=ex(i,ke,I),je=jp(be)||`center`,Me=!!ve.hide?.referenceHidden;J(()=>{x&&g&&Se&&ke!==L&&w(ke)},[x,g,Se,ke,L]);let Ne=D.useMemo(()=>({position:`absolute`,top:ve.arrow?.y,left:ve.arrow?.x}),[ve.arrow]),Pe=ve.arrow?.centerOffset!==0;return D.useMemo(()=>({positionerStyles:De,arrowStyles:Ne,arrowRef:B,arrowUncentered:Pe,side:Ae,align:je,physicalSide:ke,anchorHidden:Me,refs:me,context:xe,isPositioned:Se,update:ye}),[De,Ne,B,Pe,Ae,je,ke,Me,me,xe,Se,ye])}function ix(e){return e!=null&&`current`in e}function ax(e){return e===`starting`?Th:Rd}function ox(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),vh(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},ax(r),i],stateAttributesMapping:Nf})}var sx=20;function cx(e,t,n,r){let[i,a]=D.useState(!1);J(()=>{if(!e||!t||n==null){a(!1);return}let r=Nd(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-sx)},[e,t,n]),rf(e&&(!t||i),r)}var lx=D.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=Dh,..._}=e,v=Tb(),y=Lb(),b=Vh(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),O=v.useState(`openMethod`),k=v.useState(`positionerElement`),A=v.useState(`instantType`),j=v.useState(`transitionStatus`),M=v.useState(`adaptiveOrigin`),N=D.useRef(null),P=N_(k),F=nx({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:M}),I=x.useState(`domReferenceElement`);J(()=>{let e=I,t=N.current;if(e&&(N.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return P(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,P,v]);let L=E===!0&&w!==`trigger-hover`;cx(C&&L,O===`touch`,k,T);let R=v.useStateSetter(`positionerElement`),z=ox(e,{open:C,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:A},{styles:F.positionerStyles,transitionStatus:j,props:_,refs:[t,R],hidden:!S,inert:!C});return(0,H.jsxs)(zb.Provider,{value:F,children:[S&&L&&(0,H.jsx)(oy,{inert:ay(!C),cutout:T}),(0,H.jsx)(Hh,{id:b,children:z})]})}),ux=D.createContext(void 0);function dx(e){let t=D.useContext(ux);if(t===void 0&&!e)throw Error(Ym(69));return t}var fx=D.createContext(void 0);function px(){let[e,t]=D.useState(0),n=hp(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:D.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function mx(){let e=D.useContext(fx);J(()=>e?.register(),[e])}var hx=D.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=Tb(),l=Bb(),u=dx(!0)!=null,{context:d,hasClosePart:f}=px(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);P_({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),uv(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?I_(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=vh(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...F_,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&qv.has(e.key)&&e.stopPropagation()}},ax(g),s],stateAttributesMapping:Pf});return(0,H.jsx)($h,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:X(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,H.jsx)(fx.Provider,{value:d,children:M})})}),gx=D.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Tb(),s=zv(a.id);return o.useSyncedValueWithCleanup(`titleElementId`,s),vh(`h2`,e,{ref:t,props:[{id:s},a]})}),_x=D.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,{buttonRef:c,getButtonProps:l}=Fv({disabled:a,focusableWhenDisabled:!1,native:o}),u=Tb();return mx(),vh(`button`,e,{ref:[t,c],props:[{onClick(e){u.setOpen(!1,np(Qf,e.nativeEvent))}},s,l]})});function vx({trigger:e,title:t,children:n,enabled:r=!0}){let[i,a]=(0,D.useState)(!1);return!r&&i&&a(!1),(0,H.jsxs)(jb,{open:r&&i,onOpenChange:e=>a(r&&e),children:[(0,H.jsx)(Fb,{render:e,"aria-haspopup":r?`dialog`:!1,"aria-expanded":r?i:void 0}),(0,H.jsx)(Rb,{children:(0,H.jsx)(lx,{sideOffset:6,align:`end`,className:`z-50`,children:(0,H.jsxs)(hx,{className:`max-h-(--available-height) w-96 max-w-[calc(100vw-1rem)] overflow-y-auto rounded-lg border bg-popover p-4 text-sm text-popover-foreground shadow-lg outline-none`,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,H.jsx)(gx,{className:`font-medium`,children:t}),(0,H.jsx)(_x,{render:(0,H.jsx)(pb,{variant:`ghost`,size:`icon-xs`,"aria-label":`Close details`}),children:(0,H.jsx)(ze,{"aria-hidden":`true`})})]}),(0,H.jsx)(`div`,{className:`flex flex-col gap-3 break-words`,children:n})]})})})]})}function yx({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=D.useRef(e!==void 0),[a,o]=D.useState(t);return[i&&e!==void 0?e:a,D.useCallback(e=>{i||o(e)},[])]}function bx(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var xx=`data-valid`,Sx=`data-invalid`,Cx={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},wx={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Tx={valid(e){return e===null?null:e?{[xx]:``}:{[Sx]:``}}},Ex=`data-checked`,Dx=`data-unchecked`;function Ox(e){return{checked(t){return e.indeterminate?{}:t?{[Ex]:``}:{[Dx]:``}},...Tx}}var kx={invalid:void 0,name:void 0,validityData:{state:Cx,errors:[],error:``,value:``,initialValue:null},setValidityData:Id,disabled:void 0,setTouched:Id,setDirty:Id,setFilled:Id,setFocused:Id,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:wx,registerFieldControl:Id,validation:{getValidationProps:(e,t=Rd)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:Id,getInputControl:()=>null,commit:async()=>{},change:Id}},Ax=D.createContext(kx);function jx(e=!0){let t=D.useContext(Ax);if(t.setValidityData===Id&&!e)throw Error(Ym(28));return t}function Mx(e,t,n,r,i=!0,a){let{registerFieldControl:o}=jx(),s=Fd(()=>Symbol());J(()=>{let c=s.current;if(!i){o(c,void 0);return}o(c,{controlRef:e,getValue:r,id:t,name:a,value:n})},[e,i,r,t,a,o,s,n]),J(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}var Nx=D.createContext({disabled:!1});function Px(){return D.useContext(Nx)}var Fx=D.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:Id,validationMode:`onSubmit`,submitCountRef:{current:0}});function Ix(){return D.useContext(Fx)}var Lx=D.createContext({controlId:void 0,registerControlId:Id,resetControlId:Id,labelId:void 0,setLabelId:Id,messageIds:[],setMessageIds:Id,getDescriptionProps:e=>e});function Rx(){return D.useContext(Lx)}function zx(e,t,n,r=!0,i){let[a,o]=D.useState(),s=zv(i?`${i}-label`:void 0),c=e??t??a;return J(()=>{let i=e||t||!r?void 0:Bx(n.current,s);a!==i&&o(i)}),c}function Bx(e,t){let n=Vx(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Vx(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function Hx(e={}){let{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:i,resetControlId:a}=Rx(),o=zv(),s=Fd(()=>Symbol()),c=D.useRef(!1),l=D.useRef(!1),u=hp(()=>{c.current&&i!==Id&&(c.current=!1,i(s.current,void 0))});return J(()=>{if(!n||i===Id){u();return}let e;if(t!==void 0)l.current=!0,e=t;else if(l.current)e=o;else{a();return}if(e===void 0){u();return}c.current=!0,i(s.current,e)},[t,n,i,a,o,s,u]),J(()=>u,[u]),(n?r:void 0)??t??o}var Ux=D.createContext(void 0);function Wx(){return D.useContext(Ux)}var Gx=D.createContext(void 0);function Kx(){let e=D.useContext(Gx);if(e===void 0)throw Error(Ym(14));return e}var qx=`data-parent`,Jx=D.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":a,disabled:o=!1,form:s,id:c,indeterminate:l=!1,inputRef:u,name:d,onCheckedChange:f,parent:p=!1,readOnly:m=!1,render:h,required:g=!1,uncheckedValue:_,value:v,nativeButton:y=!1,style:b,...x}=e,{clearErrors:S}=Ix(),{disabled:C,name:w,setDirty:T,setFilled:E,setFocused:O,setTouched:k,state:A,validationMode:j,validityData:M,validation:N}=jx(),P=Px(),{labelId:F,registerControlId:I,getDescriptionProps:L}=Rx(),R=Wx(),z=R?.allValues===void 0?void 0:R.parent,ee=z!==void 0,te=C||P.disabled||R?.disabled||o,ne=w??d,re=v??ne,ie=zv(),B=R?.registerControlId!==I,ae=Hx({id:c||void 0,enabled:B}),oe=y?ae:ie,se={};ee&&(p?se=z.getParentProps():re!==void 0&&(se=z.getChildProps(re)));let{checked:ce=n,indeterminate:le=l,onCheckedChange:V,...ue}=se,de=R?.value,fe=D.useRef(null),{getButtonProps:pe,buttonRef:me}=Fv({disabled:te,native:y}),he=R?.validation??N,[ge,_e]=yx({controlled:re!==void 0&&de!==void 0&&!p?de.includes(re):ce,default:i,name:`Checkbox`,state:`checked`}),ve=ee?!!ce:ge,ye=ee&&le||l;Mx(fe,ie,ge,void 0,!R&&!te,d);let be=z?.registerChildId,xe=D.useRef(null),Se=he.registerInput,Ce=R?re:void 0,we=D.useCallback(e=>Se(e,{controlRef:fe,value:Ce}),[Se,Ce]),Te=ip(u,xe,p?void 0:we),Ee=zx(a,F,xe,!y,ae);J(()=>{xe.current&&(xe.current.indeterminate=ye),R||E(ge)},[ge,ye,R,E]),uy(ge,()=>{R||(S(ne),T(ge!==M.initialValue),he.change(ge))});let De=ih({checked:ge,disabled:te,form:s,name:p?void 0:ne,id:y?void 0:ae,required:g,ref:Te,style:ne?bp:yp,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(m){e.preventDefault();return}let t=e.currentTarget.checked,n=np(Jf,e.nativeEvent);if(f?.(t,n),!n.isCanceled&&(V?.(t,n),!n.isCanceled&&(_e(t),re!==void 0&&R!==void 0&&!p&&!ee))){let e=t?[...R.value,re]:R.value.filter(e=>e!==re);R.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){fe.current?.focus()}},v===void 0?Rd:{value:(R?ge&&v:v)||``},L,e=>he.getValidationProps(te,e));D.useEffect(()=>{if(!z||re===void 0)return;let e=z.disabledStatesRef.current;return e.set(re,te),()=>{e.delete(re)}},[z,te,re]);let Oe=D.useMemo(()=>({...A,checked:ve,disabled:te,readOnly:m,required:g,indeterminate:ye}),[A,ve,te,m,g,ye]),ke=Ox(Oe),Ae=vh(`span`,e,{state:Oe,ref:[me,fe,t],props:[{id:oe,role:`checkbox`,"aria-checked":ye?`mixed`:ve,"aria-readonly":m||void 0,"aria-required":g||void 0,"aria-labelledby":Ee,[qx]:p?``:void 0,onFocus(){te||O(!0)},onBlur(){let e=xe.current;e&&(k(!0),O(!1),j===`onBlur`&&he.commit(R?de:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=xe.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),Zu(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||bx(t)?.click()})},onClick(e){if(m||te)return;e.preventDefault();let t=xe.current;t&&Pv(t,e)}},x,ue,pe,L,e=>he.getValidationProps(te,e)],stateAttributesMapping:ke}),je=Ae.props.id;return J(()=>{if(be&&!p&&re!==void 0&&je!==void 0)return be(re,je)},[be,p,re,je]),(0,H.jsxs)(Gx.Provider,{value:Oe,children:[Ae,!ge&&!R&&ne&&!p&&_!==void 0&&(0,H.jsx)(`input`,{type:`hidden`,form:s,name:ne,value:_,disabled:te}),(0,H.jsx)(`input`,{...De,suppressHydrationWarning:!0})]})}),Yx=D.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Kx(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=A_(c),f=D.useRef(null),p={...s,transitionStatus:u};P_({batch:!0,enabled:!c,open:c,ref:f,onComplete(){c||d(!1)}});let m={...Ox(s),...bf},h=a||l,g=vh(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null});function Xx({className:e,...t}){return(0,H.jsx)(Jx,{"data-slot":`checkbox`,className:ab(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary`,e),...t,children:(0,H.jsx)(Yx,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,H.jsx)(N,{})})})}var Zx=D.createContext(void 0);function Qx(e=!1){let t=D.useContext(Zx);if(!t&&!e)throw Error(Ym(86));return t}Object.keys(Cx);function $x(e,t){return e.matches(`:disabled`)?!1:!t||e.form===t||e.form===null&&!e.hasAttribute(`form`)}var eS=D.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:b,validationMode:x,validation:S}=jx(),{clearErrors:C,elementRef:w,submitCountRef:T}=Ix(),E=h||s,O=m??a,k={...p,disabled:E},{labelId:A}=Rx(),j=Hx({id:i}),[M]=yx({controlled:o,default:l,name:`FieldControl`,state:`value`}),N=o!==void 0,P=N?M:void 0,F=P==null?void 0:String(P),I=hp(()=>S.inputRef.current?.value);Mx(S.inputRef,j,F,I,!E,a),J(()=>{let e=F??S.inputRef.current?.value;e!==void 0&&b(e!==``)},[F,S.inputRef,b]),uy(F,()=>{F!==void 0&&(C(O),_(F!==(v.initialValue??``)),S.change(F))});let L=D.useRef(null),R=Hd();return J(()=>{u&&L.current===df(Nd(L.current))&&y(!0)},[u,y]),vh(`input`,e,{ref:[t,L],state:k,props:[{id:j,disabled:E,name:O,ref:S.inputRef,"aria-labelledby":A,autoFocus:u,...N?{value:P}:{defaultValue:l},onChange(e){let t=e.currentTarget.value,n=np(Jf,e.nativeEvent);c?.(t,n),!N&&(_(t!==(v.initialValue??``)),b(t!==``),!e.nativeEvent.defaultPrevented&&!n.isCanceled&&(C(O),S.change(t)))},onFocus(){y(!0)},onBlur(e){if(g(!0),y(!1),x===`onBlur`){let t=e.currentTarget.value;S.commit(t),N&&queueMicrotask(()=>{let e=S.inputRef.current?.value;e!==void 0&&e!==t&&e!==(v.initialValue??``)&&S.commit(e)})}},onKeyDown(e){if(e.currentTarget.tagName===`INPUT`&&e.key===`Enter`){g(!0);let t=e.currentTarget.value,n=e.currentTarget.form;if(n&&n===w.current&&!e.defaultPrevented){let t=e.currentTarget,n=T.current;R.start(0,()=>{T.current===n&&S.commit(t.value)})}else S.commit(t)}}},f,e=>S.getValidationProps(E,e)],stateAttributesMapping:Tx})}),tS=D.forwardRef(function(e,t){return(0,H.jsx)(eS,{ref:t,...e})});function nS({className:e,type:t,...n}){return(0,H.jsx)(tS,{type:t,"data-slot":`input`,className:ab(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function rS({className:e,...t}){return(0,H.jsx)(`label`,{"data-slot":`label`,className:ab(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var iS=`data-checked`,aS=`data-unchecked`,oS={checked(e){return e?{[iS]:``}:{[aS]:``}},...bf,...Tx},sS=`data-composite-item-active`,cS=D.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function lS(){return D.useContext(cS)}function uS(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=lS(),u=D.useRef(-1),[d,f]=D.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=D.useRef(null),h=D.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return J(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}function dS(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Mv(),{ref:i,index:a}=uS(e),o=n===a,s=D.useRef(null),c=ip(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function fS(e){let{render:t,className:n,style:r,state:i=Rd,props:a=Ld,refs:o=Ld,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=dS({metadata:s});return vh(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}var pS=D.createContext(void 0);function mS(){return D.useContext(pS)}function hS(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var gS=D.createContext(void 0);function _S(){let e=D.useContext(gS);if(e===void 0)throw Error(Ym(52));return e}var vS=D.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,readOnly:a=!1,required:o=!1,"aria-labelledby":s,value:c,inputRef:l,nativeButton:u=!1,id:d,style:f,...p}=e,m=mS(),{disabled:h,readOnly:g,required:_,form:v,checkedValue:y,touched:b=!1,validation:x,name:S,setCheckedValue:C=Id,setTouched:w=Id,registerInputRef:T=Id}=m??{},{setTouched:E,setFilled:O,state:k,disabled:A}=jx(),j=Px(),{labelId:M,getDescriptionProps:N}=Rx(),P=A||j.disabled||h||i,F=g||a,I=_||o,L=v,R=m?y===c:c===``,z=D.useRef(null),ee=D.useRef(null),te=x?.registerInput,ne=ip(l,ee,T,D.useCallback(e=>te?.(e,{controlRef:z,value:void 0}),[te]));J(()=>{ee.current?.checked&&O(!0)},[O]),J(()=>{if(ee.current){if(P&&R){T(null);return}T(ee.current)}},[R,P,T]);let re=zv(),ie=Hx({id:d}),B=u?void 0:ie,ae={role:`radio`,"aria-checked":R,"aria-labelledby":zx(s,M,ee,!u,B),[sS]:R?``:void 0,id:u?ie:re,onKeyDown(e){e.key===`Enter`&&e.preventDefault()},onClick(e){if(e.defaultPrevented||P||F)return;e.preventDefault();let t=ee.current;t&&Pv(t,e)},onFocus(e){e.defaultPrevented||P||F||!b||(ee.current?.click(),w(!1))}},{getButtonProps:oe,buttonRef:se}=Fv({disabled:P,native:u,composite:!1}),ce={type:`radio`,ref:ne,form:L,id:B,name:S,tabIndex:-1,style:S?bp:yp,"aria-hidden":!0,...c===void 0?Rd:{value:hS(c)},disabled:P,checked:R,required:I,readOnly:F,onChange(e){if(e.nativeEvent.defaultPrevented||P||F||c===void 0)return;let t=np(Jf,e.nativeEvent);C(c,t),!t.isCanceled&&E(!0)},onClick(e){e.stopPropagation()},onFocus(){z.current?.focus()}},le=D.useMemo(()=>({...k,required:I,disabled:P,readOnly:F,checked:R}),[k,P,F,R,I]),V=le,ue=m!==void 0,de=[t,z,se],fe=[ae,p,oe,N,x?e=>x.getValidationProps(P,e):Rd],pe=vh(`span`,e,{enabled:!ue,state:le,ref:de,props:fe,stateAttributesMapping:oS});return(0,H.jsxs)(gS.Provider,{value:V,children:[ue?(0,H.jsx)(fS,{tag:`span`,render:n,className:r,style:f,state:le,refs:de,props:fe,stateAttributesMapping:oS}):pe,(0,H.jsx)(`input`,{...ce,suppressHydrationWarning:!0})]})}),yS=D.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=_S(),c=s.checked,{mounted:l,transitionStatus:u,setMounted:d}=A_(c),f={...s,transitionStatus:u},p=D.useRef(null),m=a||l,h=vh(`span`,e,{ref:[t,p],state:f,props:o,stateAttributesMapping:oS});return P_({batch:!0,enabled:!c,open:c,ref:p,onComplete(){c||d(!1)}}),m?h:null});function bS(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=hp(i),[,o]=D.useState(!1),s=Fd(SS).current,c=Fd(xS).current,l=D.useRef(0),u=D.useRef(!0),d=D.useRef(null),f=D.useRef(null),p=hp(()=>{u.current||(u.current=!0,o(e=>!e))}),m=hp((e,t)=>{c.set(e,t),p()}),h=hp(e=>{c.delete(e),p()}),g=hp(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!TS(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&ES(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=wS(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=hp(()=>{let[e,t]=CS(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});J(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),J(()=>{u.current&&v()}),J(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=hp(e=>(s.add(e),()=>{s.delete(e)})),b=D.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,H.jsx)(cS.Provider,{value:b,children:t})}function xS(){return new Map}function SS(){return new Set}function CS(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>ES(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function wS(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function TS(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function ES(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function DS(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function OS(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=Ld}=e,[p,m]=D.useState(0),h=r!=null,g=D.useRef(null),_=ip(g,c),v=D.useRef([]),y=D.useRef(!1),b=D.useRef(null),x=o??p,S=hp((e,t=!1)=>{if(b.current=v.current[e]??null,(s??m)(e),t){let t=v.current[e];Qv(g.current,t,a,n)}}),C=hp(e=>{if(e.size===0)return;if(y.current){let e=v.current,t=e.indexOf(b.current);if(t===-1){let t=e[x];!t||$p(e,x,d)?S(kS(e,d)):b.current=t}else t!==x&&S(t);return}y.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)S(i);else if($p(t,x,d)){let e=Qp(t,{disabledIndices:d});Yp(t,e)||S(e)}Qv(g.current,r,a,n)});J(()=>{if(d==null||o!=null||!y.current)return;let e=v.current;if($p(e,x,d)){let t=Qp(e,{disabledIndices:d});Yp(e,t)||S(t)}},[d,o,x,v,S]);let w=hp((e,t,n)=>i?i(e,t,n,v):n),T=hp(e=>{let o=e.key===`Home`||e.key===`End`;if(!qv.has(e.key)||!l&&o||AS(e,f)||!g.current)return;let s=a===`rtl`,c=s?Gv:Kv,p=s?Kv:Gv,m=n===`vertical`?Wv:c,_=n===`vertical`?Uv:p,y=pf(e.nativeEvent);if(y!=null&&Zv(y)&&!DS(y)){let t=y.selectionStart,n=y.selectionEnd,r=y.value;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==m&&t>0)return}let b=x,C=Xp(v,d),T=Zp(v,d);r!=null&&(b=r({disabledIndices:d,elementsRef:v,event:e,highlightedIndex:x,loopFocus:t,maxIndex:T,minIndex:C,onLoop:w,orientation:n,rtl:s}));let E=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,D=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?b=C:e.key===`End`&&(b=T)),b===x&&(E||D)&&(t&&b===T&&E?(b=C,i&&(b=i(e,x,b,v))):t&&b===C&&D?(b=T,i&&(b=i(e,x,b,v))):b=Qp(v.current,{startingIndex:b,decrement:D,disabledIndices:d})),b!==x&&!Yp(v.current,b)&&(u&&e.stopPropagation(),(h||o||E||D)&&e.preventDefault(),S(b,!0),queueMicrotask(()=>{v.current[b]?.focus()}))});return{props:{ref:_,onFocus(e){let t=g.current,n=pf(e.nativeEvent);t&&n!=null&&Zv(n)&&n.setSelectionRange(0,n.value.length)},onKeyDown:T},highlightedIndex:x,onHighlightedIndexChange:S,elementsRef:v,onMapChange:C,relayKeyboardEvent:T}}function kS(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!$p(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function AS(e,t){for(let n of Yv)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function jS(e){let{render:t,className:n,style:r,refs:i=Ld,props:a=Ld,state:o=Rd,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:v,modifierKeys:y,highlightItemOnHover:b=!1,tag:x=`div`,...S}=e,{props:C,highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:E,onMapChange:O,relayKeyboardEvent:k}=OS({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:Hb(),disabledIndices:v,modifierKeys:y}),A=vh(x,e,{state:o,ref:i,props:[C,...a,S],stateAttributesMapping:s}),j=D.useMemo(()=>({highlightedIndex:w,onHighlightedIndexChange:T,highlightItemOnHover:b,relayKeyboardEvent:k}),[w,T,b,k]);return(0,H.jsx)(jv.Provider,{value:j,children:(0,H.jsx)(bS,{elementsRef:E,onMapChange:e=>{h?.(e),O(e)},children:A})})}var MS=[Jv],NS=D.forwardRef(function(e,t){let{render:n,className:r,disabled:i,readOnly:a,required:o,onValueChange:s,value:c,defaultValue:l,form:u,name:d,inputRef:f,id:p,style:m,...h}=e,{setTouched:g,setFocused:_,validationMode:v,name:y,disabled:b,state:x,validation:S,setDirty:C,setFilled:w,validityData:T}=jx(),{labelId:E}=Rx(),{clearErrors:O,elementRef:k}=Ix(),A=Qx(!0),j=b||i,M=y??d,N=zv(p),[P,F]=yx({controlled:c,default:l,name:`RadioGroup`,state:`value`}),[I,L]=D.useState(!1),R=hp((e,t)=>{s?.(e,t),!t.isCanceled&&F(e)}),z=S.getInputControl,ee=D.useMemo(()=>({get current(){return z()}}),[z]),te=D.useRef(null),ne=D.useRef(null);function re(e){let t;return f&&(typeof f==`function`?t=f(e):f.current=e),te.current=e,t}let ie=hp(e=>{if(!e||e.disabled)return;ne.current||=e;let t=te.current,n=e.checked||t==null||t.disabled?re(e):void 0;return()=>{ne.current===e&&(ne.current=null),te.current===e?n?(n(),te.current=null):re(null):n?.()}}),B=hp(()=>{let e=k.current;if(!e)return P??null;for(let t of S.registeredInputs.keys())if(t.checked&&$x(t,e))return P??null;return null});Mx(ee,N,P??null,B,!j,d),uy(P,()=>{O(M),C(P!==T.initialValue),w(P!=null),S.change(P);let e=ne.current;P==null&&e&&!e.disabled&&re(e)});let ae=E??A?.legendId,oe={...x,disabled:j??!1,required:o??!1,readOnly:a??!1},se=D.useMemo(()=>({checkedValue:P,disabled:j,form:u,validation:S,name:M,readOnly:a,registerInputRef:ie,required:o,setCheckedValue:R,setTouched:L,touched:I}),[P,j,u,S,M,a,ie,o,R,L,I]),ce={id:p,role:`radiogroup`,"aria-required":o||void 0,"aria-disabled":j||void 0,"aria-readonly":a||void 0,"aria-labelledby":ae,onFocus(){_(!0)},onBlur(e){ff(e.currentTarget,e.relatedTarget)||(g(!0),_(!1),v===`onBlur`&&S.commit(P))},onKeyDownCapture(e){e.key.startsWith(`Arrow`)&&(L(!0),_(!0))}};return(0,H.jsx)(pS.Provider,{value:se,children:(0,H.jsx)(jS,{render:n,className:r,style:m,state:oe,props:[ce,h,e=>S.getValidationProps(j??!1,e)],refs:[t],stateAttributesMapping:Tx,enableHomeAndEndKeys:!1,modifierKeys:MS})})});function PS({className:e,...t}){return(0,H.jsx)(NS,{"data-slot":`radio-group`,className:ab(`grid w-full gap-2`,e),...t})}function FS({className:e,...t}){return(0,H.jsx)(vS,{"data-slot":`radio-group-item`,className:ab(`group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary`,e),...t,children:(0,H.jsx)(yS,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:(0,H.jsx)(`span`,{className:`absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground`})})})}function IS({className:e,...t}){return(0,H.jsx)(`textarea`,{"data-slot":`textarea`,className:ab(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function LS(e){let t=new TextDecoder(`utf-8`),n=``,r=``,i=[],a=null,o=()=>{i.length>0&&e({event:r===``?`message`:r,data:i.join(`
|
|
64
|
-
`),id:a}),r=``,i=[]},s=e=>{if(e===``){o();return}if(e.startsWith(`:`))return;let t=e.indexOf(`:`),n=t===-1?e:e.slice(0,t),s=t===-1?``:e.slice(t+1);s.startsWith(` `)&&(s=s.slice(1)),n===`event`?r=s:n===`data`?i.push(s):n===`id`&&(a=s)};return{push(e){for(n+=t.decode(e,{stream:!0});;){let e=/\r\n|\n|\r/.exec(n);if(!e||e[0]===`\r`&&e.index===n.length-1)break;s(n.slice(0,e.index)),n=n.slice(e.index+e[0].length)}}}}var RS=`/_/api/v1`,zS=`vde-open.session`,BS=1048576,VS=1e4,HS=class extends Error{code;status;details;constructor(e,t,n,r){super(t),this.name=`ApiError`,this.code=e,this.status=n,this.details=r}};async function US(e){let t=await e.json();if(!e.ok||!t.ok)throw new HS(t.error?.code??`E_INTERNAL`,t.error?.message??`The operation failed.`,e.status,t.error?.details??{});return t}async function WS(){let e=/^#bootstrap=([A-Za-z0-9_-]+)$/.exec(window.location.hash);if(e){window.history.replaceState(null,``,window.location.pathname+window.location.search);try{let{data:t}=await US(await fetch(`${RS}/sessions/bootstrap`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({ticket:e[1]})}));return window.sessionStorage.setItem(zS,t.token),t.token}catch{}}return window.sessionStorage.getItem(zS)}function GS(){window.sessionStorage.removeItem(zS)}function KS(e,t){let n=async(n,r={})=>{let i=await fetch(`${RS}${n}`,{...r,headers:{Authorization:`Bearer ${e}`,...r.body===void 0?{}:{"Content-Type":`application/json`}}});return i.status===401&&t(),US(i)};return{async status(){return(await n(`/status`)).data},async documents(){let e=[],t=null,r=0;do{let i=t===null?`?limit=500`:`?limit=500&cursor=${encodeURIComponent(t)}`,a=await n(`/documents${i}`);e.push(...a.data.documents),t=a.data.nextCursor,r=a.meta?.catalogVersion??r}while(t!==null);return{documents:e,catalogVersion:r}},async content(e,t){let r=``,i=null;do{let a=i===null?`?revision=${t}&maxBytes=${String(BS)}`:`?maxBytes=${String(BS)}&cursor=${encodeURIComponent(i)}`,o=await n(`/documents/${e}/content${a}`);r+=o.data.content??``,i=o.data.nextCursor}while(i!==null);return r},async outline(e,t){let r=[],i=null;do{let a=i===null?`?revision=${t}&maxBytes=${String(BS)}`:`?maxBytes=${String(BS)}&cursor=${encodeURIComponent(i)}`,o=await n(`/documents/${e}/outline${a}`);r.push(...o.data.outline??[]),i=o.data.nextCursor}while(i!==null);return r},async close(e){await n(`/documents/${e}`,{method:`DELETE`})},async reorder(e,t){return(await n(`/documents/order`,{method:`PUT`,body:JSON.stringify({order:e,expectedCatalogVersion:t})})).meta?.catalogVersion??t},async focus(e){await n(`/documents/${e}/focus`,{method:`POST`})},async refresh(e){await n(`/documents/${e}/refresh`,{method:`POST`})},async exportPdf(n,r){let i=await fetch(`${RS}/documents/${n}/pdf`,{method:`POST`,headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`},body:JSON.stringify({revision:r})});return i.status===401&&t(),i.ok||await US(i),i.blob()},async renderGrant(e,t,r={}){let{data:i}=await n(`/documents/${e}/render-grants`,{method:`POST`,body:JSON.stringify({revision:t,mode:r.mode??`static`})});return i},async search(e,t){let r=new URLSearchParams({query:e,limit:String(t)});return(await n(`/search?${r.toString()}`)).data},async feedbackRenderGrant(e){let{data:t}=await n(`/feedback/${e}/render-grants`,{method:`POST`,body:JSON.stringify({})});return t},async bridgeReady(e){return(await n(`/render-grants/bridge/ready`,{method:`POST`,body:JSON.stringify({grant:e})})).data},async bridgeDraft(e,t,r){return(await n(`/render-grants/bridge/draft`,{method:`PUT`,body:JSON.stringify({grant:e,expectedDraftVersion:t,answers:r})})).data},async renderMissing(e){let{data:t}=await n(`/render-grants/missing`,{method:`POST`,body:JSON.stringify({grant:e})});return t.missing},async setHtmlMode(e,t){let{data:r}=await n(`/documents/${e}/html-mode`,{method:`POST`,body:JSON.stringify({mode:t,confirmed:!0})});return r},async releaseGrants(e){await n(`/render-grants/release`,{method:`POST`,body:JSON.stringify({grants:e})})},async openLink(e,t,r,i){let{data:a}=await n(`/documents/${e}/links/${r}/open`,{method:`POST`,body:JSON.stringify({revision:t,confirmation:i})});return a},async feedback(e){return(await n(`/feedback/${e}`)).data},async saveDraft(e,t,r){return(await n(`/feedback/${e}/draft`,{method:`PUT`,body:JSON.stringify({expectedDraftVersion:t,answers:r})})).data},async submitFeedback(e,t){return(await n(`/feedback/${e}/submit`,{method:`POST`,body:JSON.stringify(t)})).data},async cancelFeedback(e){await n(`/feedback/${e}/cancel`,{method:`POST`,body:JSON.stringify({confirmed:!0})})},events({onEvent:n,onConnect:r}){let i=new AbortController,a=0;return(async()=>{for(;!i.signal.aborted;){try{let o=await fetch(`${RS}/events`,{headers:{Authorization:`Bearer ${e}`},cache:`no-store`,signal:i.signal});if(o.status===401){t();return}if(!o.ok||!o.body)throw Error(`events unavailable`);a=0,r();let s=LS(e=>{try{n(JSON.parse(e.data))}catch{}}),c=o.body.getReader();for(;;){let{done:e,value:t}=await c.read();if(e)break;s.push(t)}}catch{if(i.signal.aborted)return}a+=1;let o=Math.min(VS,250*2**a)*(.5+Math.random()/2);await new Promise(e=>setTimeout(e,o))}})(),{close:()=>i.abort()}}}}function qS(e,t,n){let r={};for(let[n,i]of Object.entries(e))n!==t&&(r[n]=i);return n!==void 0&&(r[t]=n),r}function JS(e,t){if(t){if(e.type===`string`&&e.enum===void 0&&(e.minLength??0)===0)return``;if(e.type===`array`&&(e.minItems??0)===0)return[]}}var YS=e=>e===``?`(empty)`:e;function XS(e,t){return t===void 0?`Not answered`:e.type===`boolean`?t===!0?`Yes`:`No`:Array.isArray(t)?t.length===0?`(none selected)`:t.join(`, `):t===``?`(empty)`:String(t)}function ZS(e,t){let{properties:n,required:r}=e.answerSchema;return e.fieldOrder.flatMap(e=>{let i=n[e];return i?[{name:e,title:i.title,value:XS(i,t[e]),required:r.includes(e)}]:[]})}var QS={"not-object":`The answers are not in the right shape`,"too-large":`The answers are too large`,"unknown-field":`Not a field of this question`,required:`An answer is required`,type:`Wrong value type`,enum:`Not one of the options`,"too-long":`Too long`,"too-short":`Too short`,"out-of-range":`Out of range`,duplicate:`The same option is selected more than once`,"too-many":`Too many selected`,"too-few":`Too few selected`};function $S(e,t){return t.map(t=>{let n=e.answerSchema.properties[t.field]?.title??`Whole answer`;return{name:t.field,text:`${n}: ${QS[t.code]}`}})}var eC=6,tC=200,nC=300,rC=()=>`sub_${crypto.randomUUID()}`;function iC(e){let{name:t,field:n,required:r,value:i,disabled:a,onChange:o}=e,s=JS(n,r);if(s===void 0)return(0,H.jsx)(aC,{...e});let c=Array.isArray(s)?Array.isArray(i)&&i.length===0:i===``;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(aC,{...e}),(0,H.jsxs)(rS,{className:`text-xs font-normal text-muted-foreground`,children:[(0,H.jsx)(Xx,{checked:c,disabled:a,onCheckedChange:e=>o(e?s:void 0),"data-testid":`feedback-${t}-empty`}),n.type===`array`?`Answer with none selected`:`Answer with an empty value`]})]})}function aC({name:e,field:t,value:n,disabled:r,onChange:i}){let a=`feedback-${e}`;switch(t.type){case`boolean`:return(0,H.jsxs)(rS,{htmlFor:a,className:`font-normal`,children:[(0,H.jsx)(Xx,{id:a,checked:n===!0,disabled:r,onCheckedChange:e=>i(e)}),`Yes`]});case`number`:case`integer`:return(0,H.jsx)(nS,{id:a,type:`number`,inputMode:t.type===`integer`?`numeric`:`decimal`,step:t.type===`integer`?1:`any`,min:t.minimum,max:t.maximum,disabled:r,value:typeof n==`number`?String(n):``,onChange:e=>{let t=e.target.value,n=Number(t);i(t===``||!Number.isFinite(n)?void 0:n)}});case`array`:{let e=Array.isArray(n)?n:[];return(0,H.jsx)(`div`,{className:`flex flex-col gap-2`,role:`group`,"aria-labelledby":`${a}-label`,children:t.items.enum.map(t=>(0,H.jsxs)(rS,{className:`font-normal`,children:[(0,H.jsx)(Xx,{checked:e.includes(t),disabled:r,onCheckedChange:n=>{let r=n?[...e,t]:e.filter(e=>e!==t);i(r.length===0?void 0:r)}}),YS(t)]},t))})}case`string`:{if(t.enum!==void 0&&t.enum.length<=eC)return(0,H.jsx)(PS,{"aria-labelledby":`${a}-label`,value:typeof n==`string`?n:null,disabled:r,onValueChange:e=>i(typeof e==`string`?e:void 0),children:t.enum.map(e=>(0,H.jsxs)(rS,{className:`font-normal`,children:[(0,H.jsx)(FS,{value:e}),YS(e)]},e))});if(t.enum!==void 0){let e=t.enum,o=typeof n==`string`?e.indexOf(n):-1;return(0,H.jsxs)(`select`,{id:a,className:`h-9 rounded-md border bg-transparent px-2 text-sm`,disabled:r,value:o===-1?`none`:String(o),onChange:t=>{let n=Number(t.target.value);i(t.target.value===`none`?void 0:e[n])},children:[(0,H.jsx)(`option`,{value:`none`,children:`Select an option`}),e.map((e,t)=>(0,H.jsx)(`option`,{value:String(t),children:YS(e)},e))]})}let e=t.maxLength===void 0||t.maxLength>tC,o={id:a,disabled:r,maxLength:t.maxLength,value:typeof n==`string`?n:``,onChange:e=>i(e.target.value===``?void 0:e.target.value)};return e?(0,H.jsx)(IS,{rows:4,...o}):(0,H.jsx)(nS,{...o})}}}function oC({api:e,request:t,reload:n}){let{requestId:r,questionnaire:i}=t,a=t.status===`pending`,[o,s]=(0,D.useState)({version:t.draftVersion,answers:t.draftAnswers}),[c,l]=(0,D.useState)(t.draftAnswers),[u,d]=(0,D.useState)(!1),[f,p]=(0,D.useState)(`idle`),[m,h]=(0,D.useState)(null),[g,_]=(0,D.useState)(null),[v,y]=(0,D.useState)(rC),[b,x]=(0,D.useState)(!1),S=(0,D.useRef)(0);t.draftVersion>o.version&&!u&&f===`idle`&&(s({version:t.draftVersion,answers:t.draftAnswers}),l(t.draftAnswers));let C=a&&t.currentRevision!==t.revision,w=C&&g===t.currentRevision,T=a?c:t.submission?.answers??t.draftAnswers,E=zu(i,T,{complete:!0}),O=ZS(i,T),k=(e,t)=>{if(!(e instanceof HS)){h(t);return}switch(e.code){case`E_DRAFT_CONFLICT`:d(!1),l(o.answers),h(`The draft answer was updated in another window. Showing the latest content. Enter your answers again if needed.`),y(rC()),n();return;case`E_NEWER_REVISION`:_(null),y(rC()),h(`The document revision changed. Confirm again that this answer is for the revision shown.`),n();return;case`E_REQUEST_NOT_PENDING`:case`E_SUBMISSION_CONFLICT`:y(rC()),h(e.message),n();return;default:h(e.message)}};(0,D.useEffect)(()=>{if(!u||f!==`idle`||!a)return;let t=setTimeout(()=>{let t=S.current,n=c;p(`saving`),e.saveDraft(r,o.version,n).then(e=>{s({version:e.draftVersion,answers:n}),S.current===t&&d(!1),p(`idle`)},e=>{p(`idle`),k(e,`Could not save the draft answer.`)})},nC);return()=>clearTimeout(t)});let A=(e,t)=>{S.current+=1,l(n=>qS(n,e,t)),d(!0),h(null)},j=()=>{p(`submitting`),h(null),e.submitFeedback(r,{submissionId:v,expectedDraftVersion:o.version,revision:t.revision,currentRevision:C?g:t.currentRevision,confirmOlderRevision:w}).then(()=>{p(`idle`),n()},e=>{p(`idle`),k(e,`Could not confirm whether the submission succeeded. Submit again.`)})},M=()=>{x(!1),e.cancelFeedback(r).then(n,e=>k(e,`Could not cancel.`))},N=t.status===`cancelled`?`Cancelled`:t.status===`submitted`?t.acknowledgedAt===null?`Submitted. Waiting for the agent to retrieve it`:`The agent retrieved the answers`:f===`submitting`?`Submitting…`:f===`saving`?`Saving draft answer…`:u?`Unsaved changes`:o.version>0?`Draft answer saved`:`Not answered`,P=!a||f!==`idle`||u||E.length>0||C&&!w;return(0,H.jsxs)(`aside`,{"aria-label":`Answer the question`,className:`flex max-h-[50svh] w-full shrink-0 flex-col border-t bg-background min-[900px]:max-h-none min-[900px]:w-96 min-[900px]:border-t-0 min-[900px]:border-l`,"data-testid":`feedback-panel`,children:[(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Question from the agent`}),(0,H.jsx)(`h2`,{className:`mt-1 text-base font-semibold break-words`,children:i.title}),i.instructions&&(0,H.jsx)(`p`,{className:`mt-2 text-sm whitespace-pre-wrap text-muted-foreground`,children:i.instructions}),C&&(0,H.jsxs)(`div`,{role:`alert`,className:`mt-3 rounded-md border border-warning/50 p-3 text-sm`,children:[(0,H.jsx)(`p`,{children:`A newer revision is available. This answer is for the older revision shown.`}),g!==null&&!w&&(0,H.jsx)(`p`,{className:`mt-1`,children:`The document was updated again after you confirmed. Confirm again.`}),(0,H.jsxs)(rS,{className:`mt-2 font-normal`,children:[(0,H.jsx)(Xx,{checked:w,onCheckedChange:e=>_(e?t.currentRevision:null)}),`I confirm that this answer is for the older revision`]})]}),(0,H.jsx)(`div`,{className:`mt-4 flex flex-col gap-5`,children:i.fieldOrder.map(e=>{let t=i.answerSchema.properties[e];if(!t)return null;let n=i.answerSchema.required.includes(e);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,"data-field":e,children:[(0,H.jsxs)(`p`,{id:`feedback-${e}-label`,className:`text-sm font-medium`,children:[(0,H.jsx)(`label`,{htmlFor:`feedback-${e}`,children:t.title}),n&&(0,H.jsx)(`span`,{className:`ml-1 text-xs text-destructive`,children:`(required)`})]}),t.description&&(0,H.jsx)(`p`,{className:`text-xs whitespace-pre-wrap text-muted-foreground`,children:t.description}),(0,H.jsx)(iC,{name:e,field:t,required:n,value:T[e],disabled:!a||f===`submitting`,onChange:t=>A(e,t)})]},e)})})]}),(0,H.jsxs)(`div`,{className:`border-t px-4 py-3`,"data-testid":`feedback-footer`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Submitting to`}),(0,H.jsx)(`p`,{className:`text-sm font-medium break-words`,children:i.title}),(0,H.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Target revision `,(0,H.jsx)(`code`,{className:`font-mono`,children:t.revision.slice(4,16)})]}),(0,H.jsx)(`dl`,{className:`mt-2 max-h-40 overflow-y-auto text-xs`,"aria-label":`Answer summary`,children:O.map(e=>(0,H.jsxs)(`div`,{className:`flex gap-2 py-0.5`,children:[(0,H.jsx)(`dt`,{className:`w-24 shrink-0 truncate text-muted-foreground`,children:e.title}),(0,H.jsx)(`dd`,{className:`min-w-0 break-words`,children:e.value})]},e.name))}),a&&E.length>0&&(0,H.jsx)(`ul`,{className:`mt-2 text-xs text-muted-foreground`,"aria-label":`Required before submitting`,children:$S(i,E).map(e=>(0,H.jsx)(`li`,{children:e.text},`${e.name}:${e.text}`))}),(0,H.jsxs)(`div`,{className:`mt-2 flex min-h-6 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,H.jsx)(`p`,{role:`status`,className:`text-xs`,"data-testid":`feedback-status`,children:N}),m&&(0,H.jsx)(vx,{title:`Answer needs attention`,trigger:(0,H.jsxs)(pb,{variant:`ghost`,size:`xs`,className:`text-destructive`,children:[(0,H.jsx)(L,{"aria-hidden":`true`}),`Details`]}),children:(0,H.jsx)(`p`,{children:m})}),m&&(0,H.jsx)(`span`,{role:`alert`,className:`sr-only`,children:m})]}),a&&(0,H.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,H.jsx)(pb,{type:`button`,className:`flex-1`,disabled:P,onClick:j,children:`Send answers to the agent`}),(0,H.jsx)(pb,{type:`button`,variant:`outline`,onClick:()=>x(!0),children:`Cancel`})]})]}),(0,H.jsx)(mb,{open:b,onOpenChange:x,children:(0,H.jsxs)(_b,{children:[(0,H.jsxs)(vb,{children:[(0,H.jsx)(bb,{children:`Cancel this question?`}),(0,H.jsx)(xb,{children:`After cancelling, this question can no longer be answered. The agent is told that it was cancelled.`})]}),(0,H.jsxs)(yb,{children:[(0,H.jsx)(Cb,{children:`Back`}),(0,H.jsx)(Sb,{onClick:M,children:`Cancel question`})]})]})})]})}function sC(e){return e.replace(/^\uFEFF/,``).replace(/\r\n?/g,`
|
|
65
|
-
`)}function
|
|
66
|
-
`){l(),o.push({type:`break`}),s+=2;continue}if(d&&/[!-/:-@\[-`{-~]/.test(d)){c+=d,s+=2;continue}}if(u==="`"){let t=
|
|
63
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function us(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;us(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var ds=new Set([`type`,`properties`,`required`,`additionalProperties`]),fs=[`oneOf`,`anyOf`];function ps(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function ms(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!ds.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??ps(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}gt(n,r,e.length===1?e[0]:ms(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=ps(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function hs(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of ds)if(t in e)return;let n=t.filter(e=>fs.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=ms(t);else{let e=n[0],i=fs.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>ms([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,is(e,r))}function gs(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):is(i,s),is(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())us(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])hs(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}is(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,gt(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ys(t,`input`,e.processors),output:ys(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function _s(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return _s(r.element,n);if(r.type===`set`)return _s(r.valueType,n);if(r.type===`lazy`)return _s(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return _s(r.innerType,n);if(r.type===`intersection`)return _s(r.left,n)||_s(r.right,n);if(r.type===`record`||r.type===`map`)return _s(r.keyType,n)||_s(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:_s(r.in,n)||_s(r.out,n);if(r.type===`object`){for(let e in r.shape)if(_s(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(_s(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(_s(e,n))return!0;return!!(r.rest&&_s(r.rest,n))}return!1}var vs=(e,t={})=>n=>{let r=as({...n,processors:t});return ss(e,r),ls(r,e),gs(r,e)},ys=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=as({...i??{},target:a,io:t,processors:n});return ss(e,o),ls(o,e),gs(o,e)},bs=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},xs=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Ss=(e,t)=>{bs(e,`minimum`,t),xs(e,`maximum`,t)},Cs=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},ws=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Ts=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Es=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Ds=(e,t)=>bs(e,`minimum`,t.minimum),Os=(e,t)=>xs(e,`maximum`,t.maximum),ks=e=>(t,n)=>{Es(t,n.format);let[r,i]=e[n.format];bs(t,`minimum`,r),xs(t,`maximum`,i)},As={greater_than:(e,t)=>bs(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>xs(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Cs(e,t.value),number_format:ks(It),bigint_format:ks(Lt),min_length:Ds,max_length:Os,length_equals:(e,t)=>Ss(e,t.length),min_size:Ds,max_size:Os,size_equals:(e,t)=>Ss(e,t.size),string_format:(e,t)=>{Es(e,t.format),t.pattern&&ws(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Ts(e,t.mime)};function js(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)As[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&bs(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&bs(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&xs(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&xs(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Cs(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Ts(t,i.mime);for(let e of i.patterns??[])ws(t,e);return t}var Ms={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ns=new Map([[Ii,vr],[Ri,yr]]),Ps=e=>Ns.get(e)??e,Fs=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=js(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ms[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Ps);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Is=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=js(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):os(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Ls=(e,t,n,r)=>{n.type=`boolean`},Rs=(e,t,n,r)=>{n.not={}},zs=(e,t,n,r)=>{let i=e._zod.def,a=ct(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Bs=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(os(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(os(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Vs=(e,t,n,r)=>{os(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Hs=(e,t,n,r)=>{os(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Us=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=js(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=ss(a.element,t,{...r,path:[...r.path,`items`]})};function Ws(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Ws(t.out):t.type===`catch`?Ws(t.innerType):e._zod.optin}var Gs=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&os(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)gt(i.properties,e,ss(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Ws(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=ss(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ks=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>ss(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},qs=(e,t,n,r)=>{let i=e._zod.def,a=ss(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=ss(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Js(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Js(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Js(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?Ar:kr).source),p):p}var Ys=new WeakMap;function Xs(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Ys.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Js(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Zs=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=js(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=ss(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)gt(i.patternProperties,Ps(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=ss(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Ys.get(t);n||(n=[],Ys.set(t,n),t.deferred.push(()=>Xs(t))),n.push(e)}i.additionalProperties=ss(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Ws(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Qs=(e,t,n,r)=>{let i=e._zod.def,a=ss(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},$s=(e,t,n,r)=>{let i=e._zod.def;ss(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ec=Symbol();function tc(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(os(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),ec):JSON.parse(o)}var nc=(e,t,n,r)=>{let i=e._zod.def;ss(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=tc(i.defaultValue,e,t,n,r);o!==ec&&(n.default=o)},rc=(e,t,n,r)=>{let i=e._zod.def;ss(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=tc(i.defaultValue,e,t,n,r);o!==ec&&(n._prefault=o)},ic=(e,t,n,r)=>{let i=e._zod.def;ss(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{os(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},ac=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;ss(o,t,r);let s=t.seen.get(e);s.ref=o},oc=(e,t,n,r)=>{let i=e._zod.def;ss(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},sc=(e,t,n,r)=>{let i=e._zod.def;ss(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},cc=new WeakSet([Object.prototype,Error.prototype]);function lc(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var uc=W(`ZodError`,(e,t)=>{Mn.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);cc.has(n)||(cc.add(n),lc(n,`format`,e=>t=>Fn(e,t)),lc(n,`flatten`,e=>t=>Pn(e,t)),lc(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ut,2)}),lc(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ut,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),dc=Ln(uc),fc=Rn(uc),pc=zn(uc),mc=Vn(uc),hc=qn(uc),gc=Jn(uc),_c=Yn(uc),vc=Xn(uc),yc=Zn(uc),bc=Qn(uc),xc=$n(uc),Sc=er(uc);function Cc(){wn.localeError||Tn(Ya())}function wc(){wn.memoizer||Tn({memoizer:Ka()})}var Tc=W(`ZodType`,(e,t)=>(Cc(),ei.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Ct(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Nt(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Gl(e,t))},superRefine(e,t){return this.check(Kl(e,t))},overwrite(e){return this.check(Jo(e))},optional(){return Dl(this)},exactOptional(){return kl(this)},nullable(){return jl(this)},nullish(){return Dl(jl(this))},nonoptional(e){return Ll(this,e)},array(){return ul(this)},or(e){return pl([this,e])},and(e){return _l(this,e)},transform(e){return Vl(this,Tl(e))},default(e){return Nl(this,e)},prefault(e){return Fl(this,e)},catch(e){return zl(this,e)},pipe(e){return Vl(this,e)},readonly(){return Ul(this)},describe(e){let t=this.clone();return $a.add(t,{description:e}),t},meta(...e){if(e.length===0)return $a.get(this);let t=this.clone();return $a.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return sn(this,`~standard`,{...ri(this),jsonSchema:{input:ys(this,`input`),output:ys(this,`output`)}})},set"~standard"(e){on(this,`~standard`,e)},parse:function e(t,n){return dc(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await fc(this,t,n,{callee:e})},safeParse(e,t){return pc(this,e,t)},async safeParseAsync(e,t){return mc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){on(this,`spa`,e)},validate(e,t){return Wn(this,e,t)},validateAsync(e,t){return Kn(this,e,t)},encode:function e(t,n){return hc(this,t,n,{callee:e})},decode:function e(t,n){return gc(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await _c(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await vc(this,t,n,{callee:e})},safeEncode(e,t){return yc(this,e,t)},safeDecode(e,t){return bc(this,e,t)},async safeEncodeAsync(e,t){return xc(this,e,t)},async safeDecodeAsync(e,t){return Sc(this,e,t)},toJSONSchema(e){return vs(this,{})(e)},get description(){return $a.get(this)?.description},get _def(){return this._zod.def}}),Ec=W(`_ZodString`,(e,t)=>{ii.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fs(e,t,n,r)},cn({format:e=>js(e).format??null,minLength:e=>js(e).minimum??null,maxLength:e=>js(e).maximum??null},{regex(...e){return this.check(Ho(...e))},includes(...e){return this.check(Go(...e))},startsWith(...e){return this.check(Ko(...e))},endsWith(...e){return this.check(qo(...e))},min(...e){return this.check(Bo(...e))},max(...e){return this.check(zo(...e))},length(...e){return this.check(Vo(...e))},nonempty(...e){return this.check(Bo(1,...e))},lowercase(e){return this.check(Uo(e))},uppercase(e){return this.check(Wo(e))},trim(){return this.check(Xo())},normalize(...e){return this.check(Yo(...e))},toLowerCase(){return this.check(Zo())},toUpperCase(){return this.check(Qo())},slugify(){return this.check($o())}})),Dc=W(`ZodString`,(e,t)=>{ii.init(e,t),Ec.init(e,t)},{email(e){return this.check(no(Nc,e))},url(e){return this.check(co(Lc,e))},jwt(e){return this.check(wo(Qc,e))},emoji(e){return this.check(lo(Rc,e))},guid(e){return this.check(ro(Pc,e))},uuid(e){return this.check(io(Fc,e))},uuidv4(e){return this.check(ao(Fc,e))},uuidv6(e){return this.check(oo(Fc,e))},uuidv7(e){return this.check(so(Fc,e))},nanoid(e){return this.check(uo(zc,e))},cuid(e){return this.check(fo(Bc,e))},cuid2(e){return this.check(po(Vc,e))},ulid(e){return this.check(mo(Hc,e))},base64(e){return this.check(xo(Yc,e))},base64url(e){return this.check(So(Xc,e))},xid(e){return this.check(ho(Uc,e))},ksuid(e){return this.check(go(Wc,e))},ipv4(e){return this.check(_o(Gc,e))},ipv6(e){return this.check(vo(Kc,e))},cidrv4(e){return this.check(yo(qc,e))},cidrv6(e){return this.check(bo(Jc,e))},e164(e){return this.check(Co(Zc,e))},datetime(e){return this.check(To(kc,e))},date(e){return this.check(Eo(Ac,e))},time(e){return this.check(Do(jc,e))},duration(e){return this.check(Oo(Mc,e))}});function G(e){return to(Dc,e)}var Oc=W(`ZodStringFormat`,(e,t)=>{ai.init(e,t),Ec.init(e,t)}),kc=W(`ZodISODateTime`,(e,t)=>{wi.init(e,t),Oc.init(e,t)}),Ac=W(`ZodISODate`,(e,t)=>{Ti.init(e,t),Oc.init(e,t)}),jc=W(`ZodISOTime`,(e,t)=>{Ei.init(e,t),Oc.init(e,t)}),Mc=W(`ZodISODuration`,(e,t)=>{Di.init(e,t),Oc.init(e,t)}),Nc=W(`ZodEmail`,(e,t)=>{ci.init(e,t),Oc.init(e,t)}),Pc=W(`ZodGUID`,(e,t)=>{oi.init(e,t),Oc.init(e,t)}),Fc=W(`ZodUUID`,(e,t)=>{si.init(e,t),Oc.init(e,t)});function Ic(e){return io(Fc,e)}var Lc=W(`ZodURL`,(e,t)=>{gi.init(e,t),Oc.init(e,t)}),Rc=W(`ZodEmoji`,(e,t)=>{_i.init(e,t),Oc.init(e,t)}),zc=W(`ZodNanoID`,(e,t)=>{vi.init(e,t),Oc.init(e,t)}),Bc=W(`ZodCUID`,(e,t)=>{yi.init(e,t),Oc.init(e,t)}),Vc=W(`ZodCUID2`,(e,t)=>{bi.init(e,t),Oc.init(e,t)}),Hc=W(`ZodULID`,(e,t)=>{xi.init(e,t),Oc.init(e,t)}),Uc=W(`ZodXID`,(e,t)=>{Si.init(e,t),Oc.init(e,t)}),Wc=W(`ZodKSUID`,(e,t)=>{Ci.init(e,t),Oc.init(e,t)}),Gc=W(`ZodIPv4`,(e,t)=>{Oi.init(e,t),Oc.init(e,t)}),Kc=W(`ZodIPv6`,(e,t)=>{ji.init(e,t),Oc.init(e,t)}),qc=W(`ZodCIDRv4`,(e,t)=>{Mi.init(e,t),Oc.init(e,t)}),Jc=W(`ZodCIDRv6`,(e,t)=>{Pi.init(e,t),Oc.init(e,t)}),Yc=W(`ZodBase64`,(e,t)=>{Li.init(e,t),Oc.init(e,t)}),Xc=W(`ZodBase64URL`,(e,t)=>{Bi.init(e,t),Oc.init(e,t)}),Zc=W(`ZodE164`,(e,t)=>{Vi.init(e,t),Oc.init(e,t)}),Qc=W(`ZodJWT`,(e,t)=>{Ui.init(e,t),Oc.init(e,t)}),$c=W(`ZodNumber`,(e,t)=>{Wi.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Is(e,t,n,r),e.isFinite=!0},cn({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=js(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=js(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=js(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>js(e).format??null},{gt(e,t){return this.check(Io(e,t))},gte(e,t){return this.check(Lo(e,t))},min(e,t){return this.check(Lo(e,t))},lt(e,t){return this.check(Po(e,t))},lte(e,t){return this.check(Fo(e,t))},max(e,t){return this.check(Fo(e,t))},int(e){return this.check(nl(e))},safe(e){return this.check(nl(e))},positive(e){return this.check(Io(0,e))},nonnegative(e){return this.check(Lo(0,e))},negative(e){return this.check(Po(0,e))},nonpositive(e){return this.check(Fo(0,e))},multipleOf(e,t){return this.check(Ro(e,t))},step(e,t){return this.check(Ro(e,t))},finite(){return this}}));function el(e){return ko($c,e)}var tl=W(`ZodNumberFormat`,(e,t)=>{Gi.init(e,t),$c.init(e,t)});function nl(e){return Ao(tl,e)}var rl=W(`ZodBoolean`,(e,t)=>{Ki.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ls(e,t,n,r)});function il(e){return jo(rl,e)}var al=W(`ZodUnknown`,(e,t)=>{qi.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ol(){return Mo(al)}var sl=W(`ZodNever`,(e,t)=>{Ji.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rs(e,t,n,r)});function cl(e){return No(sl,e)}var ll=W(`ZodArray`,(e,t)=>{wc(),Xi.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Us(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Bo(e,t))},nonempty(e){return this.check(Bo(1,e))},max(e,t){return this.check(zo(e,t))},length(e,t){return this.check(Vo(e,t))},unwrap(){return this.element}});function ul(e,t){return es(ll,e,t)}var dl=W(`ZodObject`,(e,t)=>{wc(),na.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gs(e,t,n,r),hn(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return xl(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Ct(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Ct(this._zod.def,{catchall:ol()}))},loose(){return this.clone(Ct(this._zod.def,{catchall:ol()}))},strict(){return this.clone(Ct(this._zod.def,{catchall:cl()}))},strip(){return this.clone(Ct(this._zod.def,{catchall:void 0}))},extend(e){return Vt(this,e)},safeExtend(e){return Ut(this,e)},merge(e){return Wt(this,e)},pick(e){return Rt(this,e)},omit(e){return Bt(this,e)},partial(...e){return Gt(El,this,e[0])},exactPartial(...e){return Gt(Ol,this,e[0],`exactPartial`)},required(...e){return Kt(Il,this,e[0])}});function K(e,t){return new dl({type:`object`,shape:e,catchall:cl(),...U(t)})}var fl=W(`ZodUnion`,(e,t)=>{ia.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ks(e,t,n,r),e.options=t.options});function pl(e,t){return new fl({type:`union`,options:e,...U(t)})}var ml=W(`ZodDiscriminatedUnion`,(e,t)=>{fl.init(e,t),oa.init(e,t)});function hl(e,t,n){return new ml({type:`union`,options:t,discriminator:e,...U(n)})}var gl=W(`ZodIntersection`,(e,t)=>{sa.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qs(e,t,n,r)});function _l(e,t){return new gl({type:`intersection`,left:e,right:t})}var vl=W(`ZodRecord`,(e,t)=>{wc(),ua.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zs(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function yl(e,t,n){return!t||!t._zod?new vl({type:`record`,keyType:G(),valueType:e,...U(t)}):new vl({type:`record`,keyType:e,valueType:t,...U(n)})}var bl=W(`ZodEnum`,(e,t)=>{da.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zs(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new bl({...t,checks:[],...U(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new bl({...t,checks:[],...U(r),entries:i})}});function xl(e,t){return new bl({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...U(t)})}var Sl=W(`ZodLiteral`,(e,t)=>{fa.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bs(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Cl(e,t){return new Sl({type:`literal`,values:Array.isArray(e)?e:[e],...U(t)})}var wl=W(`ZodTransform`,(e,t)=>{wc(),pa.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hs(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Cn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(rn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(rn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Tl(e){return new wl({type:`transform`,transform:e})}var El=W(`ZodOptional`,(e,t)=>{ha.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dl(e){return new El({type:`optional`,innerType:e})}var Ol=W(`ZodExactOptional`,(e,t)=>{ga.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kl(e){return new Ol({type:`optional`,innerType:e})}var Al=W(`ZodNullable`,(e,t)=>{_a.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jl(e){return new Al({type:`nullable`,innerType:e})}var Ml=W(`ZodDefault`,(e,t)=>{va.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Nl(e,t){return new Ml({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():At(t)}})}var Pl=W(`ZodPrefault`,(e,t)=>{ba.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fl(e,t){return new Pl({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():At(t)}})}var Il=W(`ZodNonOptional`,(e,t)=>{xa.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$s(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ll(e,t){return new Il({type:`nonoptional`,innerType:e,...U(t)})}var Rl=W(`ZodCatch`,(e,t)=>{wa.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ic(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function zl(e,t){return new Rl({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:_n(t)})}var Bl=W(`ZodPipe`,(e,t)=>{Ta.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ac(e,t,n,r),e.in=t.in,e.out=t.out});function Vl(e,t){return new Bl({type:`pipe`,in:e,out:t})}var Hl=W(`ZodReadonly`,(e,t)=>{Da.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ul(e){return new Hl({type:`readonly`,innerType:e})}var Wl=W(`ZodCustom`,(e,t)=>{ka.init(e,t),Tc.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vs(e,t,n,r)});function Gl(e,t={}){return ts(Wl,e,t)}function Kl(e,t){return ns(e,t)}var ql=1024,Jl=1024*ql,Yl=1024*Jl,Xl={openDocuments:2e3,documentBytes:10*Jl,openSourceBytes:128*Jl,metadataStateBytes:32*Jl,blobStoreBytes:1*Yl,titleLength:160,keyLength:128,ipcFrameBytes:64*Jl,ipcPreAuthFrameBytes:4*ql,listLimitDefault:100,listLimitMax:500,readMaxBytesDefault:16*ql,readMaxBytesMin:256,readMaxBytesMax:1*Jl,cursorTtlMs:3e5,retainedRevisions:2,revisionGraceMs:3e5,parseTimeoutMs:2e3,printRenderTimeoutMs:1e4,pdfExportTimeoutMs:6e4,watchDebounceMs:200,sseHeartbeatMs:15e3,ssePendingEvents:256,sseStallMs:6e4,assetBytes:20*Jl,documentAssetBytes:100*Jl,documentAssets:500,cssReferenceDepth:8,renderGrants:64,searchLimitDefault:5,searchLimitMax:50,searchQueryCodePoints:512,searchTerms:32,searchExcerptCodePoints:240,searchHitsPerDocument:2,searchIndexWaitMs:2e3,questionnaireBytes:64*ql,answerBytes:64*ql,questionFields:32,answerStringLength:4e3,feedbackWaitDefaultSeconds:120,feedbackWaitMaxSeconds:3600,bridgeInboundFrameBytes:128*ql,bridgeOutboundFrameBytes:256*ql,bridgeMessagesPerSecond:20,renderMissingPerGrant:32},Zl=G().regex(/^doc_[0-9a-f-]{36}$/),Ql=G().regex(/^rev_[0-9a-f]{64}$/),$l=G().regex(/^[0-9a-f]{64}$/),eu=xl([`markdown`,`html`]),tu=xl([`file`,`stdin`,`generated`]),nu=xl([`ready`,`missing`,`unreadable`,`updating`,`error`]),ru=xl([`ready`,`indexing`,`excluded`]),iu=xl([`static`,`interactive`]),au=xl([`image`,`svg`,`style`,`font`,`script`,`data`]);K({logicalPath:G().min(1),mime:G().min(1),role:au,sha256:$l,byteLength:el().int().nonnegative()});var ou=hl(`kind`,[K({id:G(),kind:Cl(`main`)}),K({id:G(),kind:Cl(`linked`),name:G(),branch:G().nullable()})]),su=xl([`invalid-git-file`,`invalid-git-dir`,`link-mismatch`,`unreadable`,`limit-exceeded`,`blocked-path`]),cu=hl(`state`,[K({state:Cl(`resolved`),id:G(),nameSegments:ul(G()),checkout:ou.nullable(),pathInCheckout:ul(G())}),K({state:Cl(`unresolved`),id:G(),nameSegments:ul(G()),pathInCheckout:ul(G()),reason:su}),K({state:Cl(`pending`)})]).nullable(),lu=K({documentId:Zl,key:G().nullable(),format:eu,sourceKind:tu,title:G(),displayPath:G().nullable(),pathSegments:ul(G()),canonicalPath:G().nullable(),repository:cu,revision:Ql.nullable(),sourceState:nu,searchState:ru,openedAt:G(),updatedAt:G(),order:el().int().nonnegative(),pendingRequestIds:ul(G()),htmlMode:iu.nullable(),interactiveAllowed:il()}),uu=K({startByte:el().int().nonnegative(),endByteExclusive:el().int().nonnegative(),lineStart:el().int().positive(),lineEnd:el().int().positive()}),du=G().min(1).max(Xl.titleLength),fu=G().min(1).max(Xl.keyLength);K({cwd:G().min(1),paths:ul(G().min(1)),stdin:K({content:G()}).optional(),format:xl([`auto`,`markdown`,`html`]).default(`auto`),title:du.optional(),key:fu.optional(),recursive:il().default(!1),watch:il().default(!1),htmlMode:iu.optional(),assetsRoot:G().min(1).optional(),assets:ul(G().min(1)).max(Xl.documentAssets).default([])});var pu=K({watchId:G().regex(/^watch_[0-9a-f-]{36}$/),kind:xl([`directory`,`glob`]),root:G(),pattern:G().nullable(),recursive:il(),suppressedPaths:ul(G()),createdAt:G(),assetsRoot:G().nullable()});K({documents:ul(lu),watchRules:ul(pu),created:el().int().nonnegative(),updated:el().int().nonnegative(),unchanged:el().int().nonnegative()}),K({limit:el().int().min(1).max(Xl.listLimitMax).default(Xl.listLimitDefault),cursor:G().min(1).optional()}),K({documents:ul(lu),totalDocuments:el().int().nonnegative(),nextCursor:G().nullable()}),K({documentId:Zl,revision:Ql.optional(),lines:K({start:el().int().positive(),end:el().int().positive()}).optional(),maxBytes:el().int().min(Xl.readMaxBytesMin).max(Xl.readMaxBytesMax).default(Xl.readMaxBytesDefault),cursor:G().min(1).optional(),outline:il().default(!1),section:G().regex(/^sec_\d{4,}$/).optional()});var mu=K({sectionId:G().regex(/^sec_\d{4,}$/),level:el().int().min(1).max(6),title:G(),headingPath:ul(G()),anchor:G()});K({documentId:Zl,revision:Ql,mode:xl([`source`,`section`,`outline`]),content:G().optional(),outline:ul(mu).optional(),sectionId:G().optional(),sourceRange:uu.nullable(),extraction:xl([`source`,`markdown`,`static-html`]),truncated:il(),nextCursor:G().nullable()}),K({cwd:G().min(1),targets:ul(G().min(1)),all:il().default(!1)}),K({closed:ul(Zl),alreadyClosed:ul(Zl)}),K({state:xl([`running`,`stopped`]),daemonId:G().nullable(),pid:el().int().nullable(),version:G().nullable(),protocolVersion:el().int().nullable(),startedAt:G().nullable(),stateRoot:G(),openDocuments:el().int().nonnegative().nullable(),catalogVersion:el().int().nonnegative().nullable(),uiUrl:G().nullable()}),K({order:ul(Zl),expectedCatalogVersion:el().int().nonnegative()}),K({documents:ul(lu),changed:ul(Zl)}),K({watchRules:ul(pu)}),K({type:xl([`hello`,`catalog-changed`,`document-changed`,`document-status`,`focus-requested`,`daemon-stopping`,`resync-required`,`feedback-changed`,`render-diagnostics`]),daemonId:G(),sequence:el().int().nonnegative(),catalogVersion:el().int().nonnegative(),documentId:Zl.optional(),revision:Ql.nullable().optional(),requestId:G().optional(),status:xl([`pending`,`submitted`,`cancelled`]).optional(),draftVersion:el().int().nonnegative().optional(),acknowledged:il().optional()}),K({version:G(),daemonId:G(),catalogVersion:el().int().nonnegative(),activeDocumentId:Zl.nullable(),openDocuments:el().int().nonnegative(),previewOrigin:G()}),K({documentId:Zl,revision:Ql.optional(),mode:iu.default(`static`)});var hu=K({linkId:G().regex(/^lnk_\d{4,}$/),href:G(),text:G(),kind:xl([`external`,`document`,`other`])}),gu=K({code:G(),target:G().nullable(),count:el().int().positive()});K({grant:G(),documentId:Zl,revision:Ql,format:eu,mode:iu,documentUrl:G().nullable(),filesBaseUrl:G(),documentLogicalPath:G(),assets:ul(K({logicalPath:G(),role:au})),links:ul(hu),diagnostics:ul(gu),headingTargets:ul(K({sectionId:G().regex(/^sec_\d{4,}$/),anchor:G()})),bridge:K({instanceId:G(),requestId:G()}).nullable()}),K({missing:ul(G())}),K({documentId:Zl,mode:iu,confirmed:il().default(!1)}),K({documentId:Zl,revision:Ql,linkId:G().regex(/^lnk_\d{4,}$/),confirmation:G().min(1).max(64).optional()}),K({status:xl([`focused`,`opened`]),documentId:Zl});var _u=xl([`text`,`exact`,`path`]);K({query:G().min(1),mode:_u.default(`text`),limit:el().int().min(1).max(Xl.searchLimitMax).default(Xl.searchLimitDefault),documents:ul(Zl).max(Xl.openDocuments).default([]),maxBytes:el().int().min(Xl.readMaxBytesMin).max(Xl.readMaxBytesMax).default(Xl.readMaxBytesDefault),cursor:G().min(1).optional()});var vu=K({documentId:Zl,revision:Ql,title:G(),displayPath:G().nullable(),sectionId:G(),headingPath:ul(G()),excerpt:G(),matchKind:xl([`path-exact`,`phrase`,`text`,`prefix`,`fuzzy`]),score:el(),sourceRange:uu.nullable(),extraction:xl([`markdown`,`static-html`])});K({query:G(),mode:_u,catalogVersion:el().int().nonnegative(),registeredDocuments:el().int().nonnegative(),searchedDocuments:el().int().nonnegative(),indexedAt:G(),incomplete:il(),failedDocuments:ul(K({documentId:Zl,code:G()})),indexingDocuments:ul(Zl),hits:ul(vu),truncated:il(),nextCursor:G().nullable()});var yu=yl(G(),ol()),bu=K({code:G().min(1),message:G(),details:yu.optional()}),xu=K({code:G().min(1),message:G(),retryable:il(),details:yu}),Su=K({command:G().min(1),catalogVersion:el().int().nonnegative().optional()});hl(`ok`,[K({schemaVersion:Cl(1),ok:Cl(!0),data:ol(),warnings:ul(bu),meta:Su}),K({schemaVersion:Cl(1),ok:Cl(!1),error:xu,warnings:ul(bu)})]);var q={success:0,usage:2,notFound:3,conflict:4,forbidden:5,timeout:6,limit:7,daemon:8,internal:9,interrupted:130};q.usage,q.usage,q.usage,q.usage,q.usage,q.usage,q.usage,q.notFound,q.notFound,q.notFound,q.notFound,q.notFound,q.notFound,q.notFound,q.notFound,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.conflict,q.forbidden,q.forbidden,q.forbidden,q.forbidden,q.forbidden,q.limit,q.limit,q.timeout,q.interrupted,q.daemon,q.daemon,q.daemon,q.daemon,q.daemon,q.daemon,q.daemon,q.internal,q.internal,q.internal,q.internal,q.internal,q.internal,q.internal;var Cu=G().regex(/^req_[0-9a-f-]{36}$/),wu=G().regex(/^sub_[0-9a-f-]{36}$/),Tu=/^[A-Za-z][A-Za-z0-9_]{0,63}$/,Eu=new Set([`__proto__`,`constructor`,`prototype`,...Object.getOwnPropertyNames(Object.prototype)]),Du=G().regex(Tu).refine(e=>!Eu.has(e),{message:`This field name cannot be used.`}),Ou=G().min(1).max(160),ku=G().max(2e3),Au=ul(G().max(160)).min(1).max(32).refine(e=>new Set(e).size===e.length,{message:`The choices contain duplicates.`}),ju=el().int().min(0).max(Xl.answerStringLength),Mu=el().refine(Number.isFinite,{message:`The number must be finite.`}),Nu=hl(`type`,[K({type:Cl(`string`),title:Ou,description:ku.optional(),minLength:ju.optional(),maxLength:ju.optional(),enum:Au.optional()}),K({type:Cl(`boolean`),title:Ou,description:ku.optional()}),K({type:xl([`number`,`integer`]),title:Ou,description:ku.optional(),minimum:Mu.optional(),maximum:Mu.optional()}),K({type:Cl(`array`),title:Ou,description:ku.optional(),minItems:el().int().min(0).max(32).optional(),maxItems:el().int().min(0).max(32),uniqueItems:Cl(!0),items:K({type:Cl(`string`),enum:Au})})]),Pu=K({schemaVersion:Cl(1),title:Ou,instructions:G().max(4e3).optional(),fieldOrder:ul(Du).min(1).max(Xl.questionFields),answerSchema:K({type:Cl(`object`),properties:yl(Du,Nu).refine(e=>{let t=Object.keys(e).length;return t>=1&&t<=Xl.questionFields},{message:`There must be 1 to ${String(Xl.questionFields)} fields.`}),required:ul(Du).max(Xl.questionFields),additionalProperties:Cl(!1)})}).superRefine((e,t)=>{let n=Object.keys(e.answerSchema.properties),r=e.fieldOrder;new Set(r).size!==r.length&&t.addIssue({code:`custom`,path:[`fieldOrder`],message:`There are duplicates.`}),(r.length!==n.length||!n.every(e=>r.includes(e)))&&t.addIssue({code:`custom`,path:[`fieldOrder`],message:`The fields in fieldOrder and properties do not match.`});let{required:i}=e.answerSchema;new Set(i).size!==i.length&&t.addIssue({code:`custom`,path:[`answerSchema`,`required`],message:`There are duplicates.`});for(let e of i)n.includes(e)||t.addIssue({code:`custom`,path:[`answerSchema`,`required`],message:`The field ${e} does not exist.`});for(let[n,r]of Object.entries(e.answerSchema.properties)){let e=[`answerSchema`,`properties`,n];(r.type===`string`&&r.minLength!==void 0&&r.maxLength!==void 0&&r.minLength>r.maxLength||(r.type===`number`||r.type===`integer`)&&r.minimum!==void 0&&r.maximum!==void 0&&r.minimum>r.maximum||r.type===`array`&&r.minItems!==void 0&&r.minItems>r.maxItems)&&t.addIssue({code:`custom`,path:e,message:`The lower bound is greater than the upper bound.`}),r.type===`array`&&r.minItems!==void 0&&r.minItems>r.items.enum.length&&t.addIssue({code:`custom`,path:e,message:`minItems is greater than the number of choices.`})}}),Fu=yl(Du,pl([G(),il(),el(),ul(G())]));function Iu(e){let t=0;for(let n of e)t+=1;return t}function Lu(e){let t=0;for(let n of e){let e=n.codePointAt(0);t+=e<128?1:e<2048?2:e<65536?3:4}return t}function Ru(e){return Lu(at(e))}function zu(e,t,n){if(typeof t!=`object`||!t||Array.isArray(t))return[{field:``,code:`not-object`}];let r;try{r=Ru(t)}catch{return[{field:``,code:`type`}]}if(r>Xl.answerBytes)return[{field:``,code:`too-large`}];let i=[],{properties:a,required:o}=e.answerSchema;for(let e of Object.keys(t))Object.hasOwn(a,e)||i.push({field:e,code:`unknown-field`});for(let[e,r]of Object.entries(a)){if(!Object.hasOwn(t,e)){n.complete&&o.includes(e)&&i.push({field:e,code:`required`});continue}let a=t[e],s=t=>i.push({field:e,code:t});switch(r.type){case`string`:{if(typeof a!=`string`){s(`type`);break}r.enum!==void 0&&!r.enum.includes(a)&&s(`enum`);let e=Iu(a);e>(r.maxLength??Xl.answerStringLength)?s(`too-long`):n.complete&&r.minLength!==void 0&&e<r.minLength&&s(`too-short`);break}case`boolean`:typeof a!=`boolean`&&s(`type`);break;case`number`:case`integer`:if(typeof a!=`number`||!Number.isFinite(a)||r.type===`integer`&&!Number.isInteger(a)){s(`type`);break}(r.minimum!==void 0&&a<r.minimum||r.maximum!==void 0&&a>r.maximum)&&s(`out-of-range`);break;case`array`:if(!Array.isArray(a)||!a.every(e=>typeof e==`string`)){s(`type`);break}a.every(e=>r.items.enum.includes(e))||s(`enum`),new Set(a).size!==a.length&&s(`duplicate`),a.length>r.maxItems?s(`too-many`):n.complete&&r.minItems!==void 0&&a.length<r.minItems&&s(`too-few`)}}return i}var Bu=xl([`pending`,`submitted`,`cancelled`]),Vu=xl([`document_closed`,`agent_cancelled`,`user_cancelled`]),Hu=K({submissionId:wu,answers:Fu,submittedAt:G(),revision:Ql,confirmedAgainstOlderRevision:il(),currentRevisionAtSubmit:Ql.nullable()}),Uu=K({cancelledAt:G(),reason:Vu}),Wu=K({requestId:Cu,documentId:Zl,revision:Ql,title:G(),status:Bu,createdAt:G(),submission:Hu.nullable(),cancellation:Uu.nullable(),acknowledgedAt:G().nullable()});Wu.extend({questionnaire:Pu,renderMode:iu,draftVersion:el().int().nonnegative(),draftAnswers:Fu,currentRevision:Ql.nullable(),documentOpen:il()}),K({cwd:G().min(1),questionnaire:G(),documentId:Zl.optional(),revision:Ql.optional(),view:G().min(1).optional(),htmlMode:iu.optional(),assetsRoot:G().min(1).optional(),assets:ul(G().min(1)).max(Xl.documentAssets).default([]),operationId:Ic().optional()}).superRefine((e,t)=>{e.documentId!==void 0&&e.view!==void 0&&t.addIssue({code:`custom`,message:`--document and --view cannot be used together.`}),e.revision!==void 0&&e.documentId===void 0&&t.addIssue({code:`custom`,message:`--revision requires --document.`}),(e.htmlMode!==void 0||e.assetsRoot!==void 0||e.assets.length>0)&&e.view===void 0&&t.addIssue({code:`custom`,message:`--html-mode, --assets-root and --asset apply only to a document newly opened with --view.`})}),K({request:Wu,replayed:il()}),K({status:Bu.optional()}),K({requests:ul(Wu)}),K({requestId:Cu}),K({requestId:Cu,timeoutMs:el().int().min(1).max(Xl.feedbackWaitMaxSeconds*1e3)}),K({requestId:Cu,submissionId:wu}),K({requestId:Cu,confirmed:il()}),K({expectedDraftVersion:el().int().nonnegative(),answers:ol()}),K({submissionId:wu,expectedDraftVersion:el().int().nonnegative(),revision:Ql,currentRevision:Ql.nullable(),confirmOlderRevision:il().default(!1)}),K({confirmed:Cl(!0)});var Gu=/[\\/:*?"<>|\p{Cc}]/gu,Ku=200;function qu(e){let t=e.codePointAt(0)??0;return t<128?1:t<2048?2:t<65536?3:4}function Ju(e){let{displayPath:t,title:n}=e,r=n;if(t!==null){let e=t.slice(Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`))+1),n=e.lastIndexOf(`.`);r=n>0?e.slice(0,n):e}let i=``,a=0;for(let e of r.replace(Gu,`_`).trim()){if(a+=qu(e),a>Ku)break;i+=e}return i=i.replace(/^[.\s]+|[.\s]+$/g,``),`${i===``?`document`:i}.pdf`}var J=typeof document<`u`?D.useLayoutEffect:()=>{};function Yu(){return typeof window<`u`}function Xu(e){return $u(e)?(e.nodeName||``).toLowerCase():`#document`}function Zu(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qu(e){return(($u(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function $u(e){return Yu()?e instanceof Node||e instanceof Zu(e).Node:!1}function Y(e){return Yu()?e instanceof Element||e instanceof Zu(e).Element:!1}function X(e){return Yu()?e instanceof HTMLElement||e instanceof Zu(e).HTMLElement:!1}function ed(e){return!Yu()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Zu(e).ShadowRoot}function td(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=fd(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function nd(e){return/^(table|td|th)$/.test(Xu(e))}function rd(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var id=/transform|translate|scale|rotate|perspective|filter/,ad=/paint|layout|strict|content/,od=e=>!!e&&e!==`none`,sd;function cd(e){let t=Y(e)?fd(e):e;return od(t.transform)||od(t.translate)||od(t.scale)||od(t.rotate)||od(t.perspective)||!ud()&&(od(t.backdropFilter)||od(t.filter))||id.test(t.willChange||``)||ad.test(t.contain||``)}function ld(e){let t=md(e);for(;X(t)&&!dd(t);){if(cd(t))return t;if(rd(t))return null;t=md(t)}return null}function ud(){return sd??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),sd}function dd(e){return/^(html|body|#document)$/.test(Xu(e))}function fd(e){return Zu(e).getComputedStyle(e)}function pd(e){return Y(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function md(e){if(Xu(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ed(e)&&e.host||Qu(e);return ed(t)?t.host:t}function hd(e){let t=md(e);return dd(t)?(e.ownerDocument||e).body:X(t)&&td(t)?t:hd(t)}function gd(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=hd(e),i=r===e.ownerDocument?.body,a=Zu(r);if(i){let e=_d(a);return t.concat(a,a.visualViewport||[],td(r)?r:[],e&&n?gd(e):[])}return t.concat(r,gd(r,[],n))}function _d(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vd(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function yd(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:bd,platform:xd,maxTouchPoints:Sd}=yd(),Cd=bd.toLowerCase(),wd=xd.toLowerCase(),Td=/^i(os$|p)/.test(wd)||wd===`macintel`&&Sd>1,Ed=`android`,Dd=wd===Ed||Cd.includes(Ed),Od=!Td&&wd.startsWith(`mac`);wd.startsWith(`win`),!Dd&&/^(linux|chrome os)/.test(wd);var kd=Od||Td,Ad=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!Ad&&Cd.includes(`firefox`),!Ad&&Cd.includes(`chrom`);var jd=kd,Md=/jsdom|happydom/.test(Cd);function Nd(e){return e?.ownerDocument||document}var Pd={};function Fd(e,t){let n=D.useRef(Pd);return n.current===Pd&&(n.current=e(t)),n}function Id(){}var Ld=Object.freeze([]),Rd=Object.freeze({});function zd(e){D.useEffect(e,Ld)}var Bd=0,Vd=class e{static create(){return new e}currentId=Bd;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Bd,t()},e)}isStarted(){return this.currentId!==Bd}clear=()=>{this.currentId!==Bd&&(clearTimeout(this.currentId),this.currentId=Bd)};disposeEffect=()=>this.clear};function Hd(){let e=Fd(Vd.create).current;return zd(e.disposeEffect),e}var Ud=null;globalThis.requestAnimationFrame;var Wd=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||this.callbacks[t]!==null&&(this.callbacks[t]=null,--this.callbacksCount)}},Gd=class e{static create(){return new e}static request(e){return Wd.request(e)}static cancel(e){return Wd.cancel(e)}currentId=Ud;request(e){this.cancel(),this.currentId=Wd.request(()=>{this.currentId=Ud,e()})}cancel=()=>{this.currentId!==Ud&&(Wd.cancel(this.currentId),this.currentId=Ud)};disposeEffect=()=>this.cancel};function Kd(){let e=Fd(Gd.create).current;return zd(e.disposeEffect),e}var qd={},Jd={},Yd=``;function Xd(e,t){return td(e)?e:t}function Zd(e,t,n){return/hidden|clip/.test(e.getComputedStyle(Xd(t,n)).overflowY)}function Qd(e){if(typeof document>`u`)return!1;let t=Nd(e);return Zu(t).innerWidth-t.documentElement.clientWidth>0}function $d(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Nd(e),n=t.documentElement,r=t.body,i=Xd(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function ef(e){let t=Nd(e),n=t.documentElement,r=t.body,i=Xd(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function tf(e){let t=Nd(e),n=t.documentElement,r=t.body,i=Zu(n),a=0,o=0,s=!1,c=Gd.create();if(Ad&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,qd={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Yd=n.style.scrollBehavior,Jd={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=Xd(n,r);if(s=$d(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,qd),Object.assign(r.style,Jd),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=Yd)}function d(){u(),c.request(l)}l();let f=vd(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var nf=new class{lockCount=0;restore=null;timeoutLock=Vd.create();timeoutUnlock=Vd.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Nd(e),n=t.documentElement,r=t.body,i=Zu(n);if(Zd(i,n,r)){let t=new i.MutationObserver(()=>{Zd(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=Td||!Qd(e);this.restore=a?ef(e):tf(e)}};function rf(e=!0,t=null){J(()=>{if(e)return nf.acquire(t)},[e,t])}function af(e){e.preventDefault(),e.stopPropagation()}function of(e){return`nativeEvent`in e}function sf(e){return e.pointerType===``&&e.isTrusted?!0:Dd&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function cf(e){return Md?!1:!Dd&&e.width===0&&e.height===0||Dd&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function lf(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function uf(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function df(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function ff(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&ed(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function pf(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var mf=`data-base-ui-focusable`,hf=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,gf=`data-starting-style`,_f=`data-ending-style`,vf={[gf]:``},yf={[_f]:``},bf={transitionStatus(e){return e===`starting`?vf:e===`ending`?yf:null}},xf=`data-open`,Sf=`data-closed`,Cf=`data-anchor-hidden`,wf=`data-popup-open`,Tf=`data-pressed`,Ef={[wf]:``},Df={[wf]:``,[Tf]:``},Of={[xf]:``},kf={[Sf]:``},Af={[Cf]:``},jf={open(e){return e?Ef:null}},Mf={open(e){return e?Df:null}},Nf={open(e){return e?Of:kf},anchorHidden(e){return e?Af:null}},Pf={...Nf,...bf},Ff=`data-trigger-disabled`;function If(e,t){if(!Y(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(Ff);for(let[,e]of t.entries())if(ff(e,n))return!e.hasAttribute(Ff);return!1}function Lf(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Rf(e){return e.matches(`html,body`)}function zf(e){return X(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function Bf(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${hf}`)!=null}function Vf(e){return e?e.getAttribute(`role`)===`combobox`&&zf(e):!1}function Hf(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Uf(e,t){return t!=null&&!lf(t)?0:typeof e==`function`?e():e}function Wf(e,t,n){let r=Uf(e,n);return typeof r==`number`?r:r?.[t]}function Gf(e){return typeof e==`function`?e():e}function Kf(e,t){return t||e===`click`||e===`mousedown`}function qf(e){return e?.includes(`mouse`)&&e!==`mousedown`}var Jf=`none`,Yf=`trigger-press`,Xf=`trigger-hover`,Zf=`outside-press`,Qf=`close-press`,$f=`focus-out`,ep=`escape-key`,tp=`imperative-action`;function np(e,t,n,r){let i=!1,a=!1,o=r??Rd;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function rp(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function ip(e,t,n,r){let i=Fd(op).current;return sp(i,e,t,n,r)&&lp(i,[e,t,n,r]),i.callback}function ap(e){let t=Fd(op).current;return cp(t,e)&&lp(t,e),t.callback}function op(){return{callback:null,cleanup:null,refs:[]}}function sp(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function cp(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function lp(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null}}}}}}function up(e){let t=Fd(dp,e).current;return t.next=e,J(t.effect),t}function dp(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var fp={...D},pp=fp.useInsertionEffect,mp=pp&&pp!==fp.useLayoutEffect?pp:e=>e();function hp(e){let t=Fd(gp).current;return t.next=e,mp(t.effect),t.trampoline}function gp(){let e={next:void 0,callback:_p,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function _p(){}var vp={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},yp={...vp,position:`fixed`,top:0,left:0},bp={...vp,position:`absolute`},xp=D.forwardRef(function(e,t){let[n,r]=D.useState();J(()=>{jd&&Ad&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,H.jsx)(`span`,{...e,ref:t,style:yp,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),Sp=Math.min,Cp=Math.max,wp=Math.round,Tp=Math.floor,Ep=e=>({x:e,y:e}),Dp={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Op(e,t,n){return Cp(e,Sp(t,n))}function kp(e,t){return typeof e==`function`?e(t):e}function Ap(e){return e.split(`-`)[0]}function jp(e){return e.split(`-`)[1]}function Mp(e){return e===`x`?`y`:`x`}function Np(e){return e===`y`?`height`:`width`}function Pp(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Fp(e){return Mp(Pp(e))}function Ip(e,t,n){n===void 0&&(n=!1);let r=jp(e),i=Fp(e),a=Np(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Gp(o)),[o,Gp(o)]}function Lp(e){let t=Gp(e);return[Rp(e),t,Rp(t)]}function Rp(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var zp=[`left`,`right`],Bp=[`right`,`left`],Vp=[`top`,`bottom`],Hp=[`bottom`,`top`];function Up(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Bp:zp:t?zp:Bp;case`left`:case`right`:return t?Vp:Hp;default:return[]}}function Wp(e,t,n,r){let i=jp(e),a=Up(Ap(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Rp)))),a}function Gp(e){let t=Ap(e);return Dp[t]+e.slice(t.length)}function Kp(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function qp(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Kp(e)}function Jp(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Yp(e,t){return t<0||t>=e.length}function Xp(e,t){return Qp(e.current,{disabledIndices:t})}function Zp(e,t){return Qp(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Qp(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&$p(e,a,r));return a}function $p(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!tm(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function em(e){return e.visibility===`hidden`||e.visibility===`collapse`}function tm(e,t=e?fd(e):null){return!e||!e.isConnected||!t||em(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var nm=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function rm(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return ed(n)?n.host:null}function im(e){for(let t of Array.from(e.children))if(Xu(t)===`summary`)return t;return null}function am(e,t){let n=im(t);return!!n&&(e===n||ff(n,e))}function om(e){let t=e?Xu(e):``;return e!=null&&e.matches(nm)&&(t!==`summary`||e.parentElement!=null&&Xu(e.parentElement)===`details`&&im(e.parentElement)===e)&&(t!==`details`||im(e)==null)&&(t!==`input`||e.type!==`hidden`)}function sm(e){if(!om(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=rm(t)){let n=t!==e,r=Xu(t)===`slot`;if(t.hasAttribute(`inert`)||n&&Xu(t)===`details`&&!t.open&&!am(e,t)||t.hasAttribute(`hidden`)||!r&&!cm(t,n))return!1}return!0}function cm(e,t){let n=fd(e);return t?n.display!==`none`:tm(e,n)}function lm(e){let t=e.tabIndex;if(t<0){let t=Xu(e);if(t===`details`||t===`audio`||t===`video`||X(e)&&e.isContentEditable)return 0}return t}function um(e){if(Xu(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function dm(e,t){let n=um(e);if(!n)return!0;let r=t.find(e=>{let t=um(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=um(e);return t?.name===n.name&&t.form===n.form})===n}function fm(e){if(X(e)&&Xu(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return X(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function pm(e,t){fm(e).forEach(e=>{om(e)&&t.push(e),pm(e,t)})}function mm(e,t,n){fm(e).forEach(e=>{X(e)&&e.matches(t)&&n.push(e),mm(e,t,n)})}function hm(e){return sm(e)&&lm(e)>=0}function gm(e){let t=[];return pm(e,t),t.filter(sm)}function _m(e){let t=gm(e);return t.filter(e=>lm(e)>=0&&dm(e,t))}function vm(e,t){let n=_m(e),r=n.length;if(r===0)return;let i=df(Nd(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function ym(e){return vm(Nd(e).body,1)||e}function bm(e){return vm(Nd(e).body,-1)||e}function xm(e,t){if(!e)return null;let n=_m(Nd(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function Sm(e){return xm(e,1)}function Cm(e){return xm(e,-1)}function wm(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!ff(n,r)}function Tm(e){_m(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Em(e){let t=[];mm(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function Dm(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...Dm(e,t.id,n)])}function Om(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function km(e){return`data-base-ui-${e}`}var Am=0;function jm(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(Am);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),Id;let o=requestAnimationFrame(a);return Am=o,()=>{Am===o&&(cancelAnimationFrame(o),Am=0)}}var Mm={inert:new WeakMap,"aria-hidden":new WeakMap},Nm=`data-base-ui-inert`,Pm={inert:new WeakSet,"aria-hidden":new WeakSet},Fm=new WeakMap,Im=0;function Lm(e){return Pm[e]}function Rm(e){return e?ed(e)?e.host:Rm(e.parentNode):null}var zm=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Rm(t);return e.contains(n)?n:null}).filter(e=>e!=null),Bm=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},Vm=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{Xu(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function Hm(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=zm(t,e),l=i?Vm(t,Bm(c),new Set(c)):[],u=[],d=[];if(a){let e=Mm[a],n=Lm(a);s=n,o=e;let r=zm(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);Vm(t,Bm(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(Fm.get(e)||0)+1;Fm.set(e,t),d.push(e),t===1&&e.setAttribute(Nm,``)}),Im+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(Fm.get(e)||0)-1;Fm.set(e,t),t||e.removeAttribute(Nm)}),--Im,Im||(Mm.inert=new WeakMap,Mm[`aria-hidden`]=new WeakMap,Pm.inert=new WeakSet,Pm[`aria-hidden`]=new WeakSet,Fm=new WeakMap)}}function Um(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=Nd(e[0]).body;return Hm(e,a,n,r,{mark:i})}var Wm=0;function Gm(e,t=`mui`){let[n,r]=D.useState(e),i=e||n;return D.useEffect(()=>{n??(Wm+=1,r(`${t}-${Wm}`))},[n,t]),i}var Km=fp.useId;function qm(e,t){if(Km!==void 0){let n=Km();return e??(t?`${t}-${n}`:n)}return Gm(e,t)}function Jm(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var Ym=Jm(`https://base-ui.com/production-error`,`Base UI`),Xm=19;function Zm(e){return Xm>=e}function Qm(e){if(!D.isValidElement(e))return null;let t=e,n=t.props;return(Zm(19)?n?.ref:t.ref)??null}function $m(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function eh(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function th(e,t){return typeof e==`function`?e(t):e}function nh(e,t){return typeof e==`function`?e(t):e}var rh={};function ih(e,t,n,r,i){if(!n&&!r&&!i&&!e)return oh(t);let a=oh(e);return t&&(a=sh(a,t)),n&&(a=sh(a,n)),r&&(a=sh(a,r)),i&&(a=sh(a,i)),a}function ah(e){if(e.length===0)return rh;if(e.length===1)return oh(e[0]);let t=oh(e[0]);for(let n=1;n<e.length;n+=1)t=sh(t,e[n]);return t}function oh(e){return dh(e)?{...fh(e,rh)}:ch(e)}function sh(e,t){return dh(t)?fh(t,e):lh(e,t)}function ch(e){let t={...e};for(let e in t){let n=t[e];uh(e,n)&&(t[e]=mh(n))}return t}function lh(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=$m(e.style,r);break;case`className`:e[n]=gh(e.className,r);break;default:e[n]=uh(n,r)?ph(e[n],r):r}}return e}function uh(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function dh(e){return typeof e==`function`}function fh(e,t){return dh(e)?e(t):e??rh}function ph(e,t){return t?e?(...n)=>{let r=n[0];if(_h(r)){let i=r;hh(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:mh(t):e}function mh(e){return e&&((...t)=>{let n=t[0];return _h(n)&&hh(n),e(...t)})}function hh(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function gh(e,t){return t?e?t+` `+e:t:e}function _h(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function vh(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=Sh(r));let i=yh(t,n,r);if(n.enabled===!1)return null;let a=n.state??Rd;return Ch(e,r,i,a)}function yh(e,t,n){let{className:r,style:i}=e,{state:a=Rd,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?th(r,a):void 0,d=l?nh(i,a):void 0,f=l?eh(a,c):Rd,p=l&&s?bh(s):void 0,m=l?$m(f,p)??{}:Rd;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?ap([m.ref,Qm(n),...o]):ip(m.ref,Qm(n),o):ip(null,null)),l?(u!==void 0&&(m.className=gh(m.className,u)),d!==void 0&&(m.style=$m(m.style,d)),m):Rd}function bh(e){return Array.isArray(e)?ah(e):ih(void 0,e)}var xh=Symbol.for(`react.lazy`);function Sh(e){if(e?.$$typeof!==xh)return e;let t=D.Children.toArray(e)[0];return D.isValidElement(t)?t:e}function Ch(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=ih(n,t.props);return e.ref=n.ref,D.cloneElement(t,e)}if(e&&typeof e==`string`)return wh(e,n);throw Error(Ym(8))}function wh(e,t){return e===`button`?(0,D.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,D.createElement)(`img`,{alt:``,...t,key:t.key}):D.createElement(e,t)}var Th={style:{transition:`none`}},Eh=`data-base-ui-click-trigger`,Dh={fallbackAxisSide:`end`},Oh={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},kh=c(m(),1),Ah=D.createContext(null),jh=()=>D.useContext(Ah),Mh=km(`portal`);function Nh(e={}){let{ref:t,container:n,componentProps:r=Rd,elementProps:i}=e,a=qm(),o=jh()?.portalNode,[s,c]=D.useState(null),[l,u]=D.useState(null),d=hp(e=>{e!==null&&u(e)}),f=D.useRef(null);J(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&($u(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=vh(`div`,r,{ref:[t,d],props:[{id:a,[Mh]:``},i]}),m=s&&p?kh.createPortal(p,s):null;return{node:l,nodeId:D.isValidElement(p)?p.props.id:void 0,subtree:m}}var Ph=D.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=Nh({container:o,ref:t,componentProps:e,elementProps:c}),f=D.useRef(null),p=D.useRef(null),m=D.useRef(null),h=D.useRef(null),[g,_]=D.useState(null),v=D.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;D.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&wm(e)&&(e.type===`focusin`?v.current&&=(Em(l),!1):(Tm(l),v.current=!0))}return rp(vd(l,`focusin`,e,!0),vd(l,`focusout`,e,!0))},[l,y]),J(()=>{l&&b===!0&&v.current&&(Em(l),v.current=!1)},[b,l]);let S=D.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,H.jsxs)(D.Fragment,{children:[d,(0,H.jsxs)(Ah.Provider,{value:S,children:[x&&l&&(0,H.jsx)(xp,{"data-type":`outside`,ref:f,onFocus:e=>{wm(e,l)?m.current?.focus():bm(g?g.domReference:null)?.focus()}}),x&&l&&(0,H.jsx)(`span`,{role:s,"aria-owns":u,style:Oh}),l&&kh.createPortal(a,l),x&&l&&(0,H.jsx)(xp,{"data-type":`outside`,ref:p,onFocus:e=>{wm(e,l)?h.current?.focus():(ym(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,np(`focus-out`,e.nativeEvent)))}})]})]})});function Fh(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var Ih=class{nodesRef={current:[]};events=Fh();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},Lh=D.createContext(null),Rh=D.createContext(null),zh=()=>D.useContext(Lh)?.id||null,Bh=e=>{let t=D.useContext(Rh);return e??t};function Vh(e){let t=qm(),n=Bh(e),r=zh();return J(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function Hh(e){let{children:t,id:n}=e,r=zh();return(0,H.jsx)(Lh.Provider,{value:D.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Uh(e){let{children:t,externalTree:n}=e,r=Fd(()=>n??new Ih).current;return(0,H.jsx)(Rh.Provider,{value:r,children:t})}function Wh(e){return e==null?e:`current`in e?e.current:e}function Gh(e,t){let n=Zu(pf(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var Kh=20,qh=[];function Jh(){qh=qh.filter(e=>e.deref()?.isConnected)}function Yh(e){Jh(),e&&Xu(e)!==`body`&&(qh.push(new WeakRef(e)),qh.length>Kh&&(qh=qh.slice(-20)))}function Xh(){return Jh(),qh[qh.length-1]?.deref()}function Zh(e){return e?hm(e)?e:_m(e)[0]||e:null}function Qh(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=gm(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return hm(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function $h(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,x=hp(()=>b.current.floatingContext?.nodeId),S=i===!1,C=Vf(_)&&S,w=up(i),T=up(a),E=up(l),O=up(g),k=Bh(p),A=jh(),j=D.useRef(!1),M=D.useRef(!1),N=D.useRef(!1),P=D.useRef(null),F=D.useRef(``),I=D.useRef(``),L=D.useRef(null),R=D.useRef(null),z=ip(L,f,A?.beforeInsideRef),ee=ip(R,A?.afterInsideRef),te=Hd(),ne=Hd(),re=Kd(),ie=A!=null,B=Hf(v),ae=hp((e=B)=>e?_m(e):[]),oe=hp(()=>m?.().filter(e=>e!=null)??[]);D.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&ff(B,df(Nd(B)))&&ae().length===0&&!C&&af(e)}return vd(Nd(B),`keydown`,e)},[r,B,s,C,ae]),D.useEffect(()=>{if(r||!g)return;let e=Nd(B);function t(){N.current=!1}function n(e){let t=pf(e),n=oe(),r=ff(v,t)||ff(_,t)||ff(A?.portalNode,t)||n.some(e=>e===t||ff(e,t));N.current=!r,I.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(M.current=!0,ne.start(0,()=>{M.current=!1}))}function i(){I.current=`keyboard`}return rp(vd(e,`pointerdown`,n,!0),vd(e,`pointerup`,t,!0),vd(e,`pointercancel`,t,!0),vd(e,`keydown`,i,!0),t)},[r,v,_,B,g,A,ne,oe]),D.useEffect(()=>{if(r||!c)return;let e=Nd(B);function t(){M.current=!0,ne.start(0,()=>{M.current=!1})}function n(e){let t=pf(e);hm(t)&&(P.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=pf(t);s&&n==null&&i!=null&&ff(v,i)&&Yh(i),queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=oe(),f=n?.hasAttribute(km(`focus-guard`))&&[L.current,R.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,Wh(d),Wh(u)].includes(n),p=!(ff(_,n)||ff(v,n)||ff(n,v)||ff(A?.portalNode,n)||l.some(e=>e===n||ff(e,n))||c.hasMatchingElement(e=>ff(e,n))||f||k&&(Dm(k.nodesRef.current,a).find(e=>ff(e.context?.elements.floating,n)||ff(e.context?.elements.domReference,n))||Om(k.nodesRef.current,a).find(e=>[e.context?.elements.floating,Hf(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&B&&Qh(B),o&&r!==_&&!tm(i)&&df(e)===e.body){if(X(B)&&(B.focus(),o===`popup`)){re.request(()=>{B.focus()});return}let e=ae(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||B;X(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!s)&&n&&p&&!M.current&&(C||n!==Xh())&&(j.current=!0,h.setOpen(!1,np($f,t)))})}function a(){N.current||(b.current.insideReactTree=!0,te.start(0,()=>{b.current.insideReactTree=!1}))}let l=X(_)?_:null;if(v||l)return rp(l&&vd(l,`focusout`,i),l&&vd(l,`pointerdown`,t),v&&vd(v,`focusin`,n),v&&vd(v,`focusout`,i),v&&A&&vd(v,`focusout`,a,!0))},[r,_,v,B,s,k,A,h,c,o,ae,C,x,b,te,ne,re,u,d,oe]),D.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${km(`portal`)}]`)||[]),t=(k?Om(k.nodesRef.current,x()):[]).find(e=>Vf(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Um([v,...e,L.current,R.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...oe(),t,Wh(d),Wh(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=Um([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,A,C,k,x,u,d,oe]),J(()=>{if(!g||r||!X(B))return;F.current=``,I.current=``;let e=Nd(B),t=df(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(E.current||``):n;if(r===void 0||r===!1||ff(B,t))return;let i=null,a=()=>(i??=ae(B),i[0]||B),o;o=r===!0||r===null?a():Wh(r),o||=a();let s=ff(B,df(e));jm(o,{preventScroll:o===B,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=df(e);return!(t!==o&&ff(B,t))}})})},[r,g,B,ae,w,E,O]),J(()=>{if(r||!B)return;let e=Nd(B),t=df(e),n=E.current==null;Yh(t);function i(e){if(e.open||(F.current=Gh(e.nativeEvent,I.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(j.current=!0),e.reason===`outside-press`){if(e.nested)j.current=!1;else if(sf(e.nativeEvent)||cf(e.nativeEvent))j.current=!1;else{let e=!1;Nd(B).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&Xu(t)!==`body`?t:null,s=n?o||a:a||o;return s||=Xh()||null,typeof i==`boolean`?s:Wh(i)||s||null}return()=>{y.off(`openchange`,i);let t=df(e),n=oe(),r=ff(v,t)||n.some(e=>e===t||ff(e,t))||k&&Dm(k.nodesRef.current,x(),!1).some(e=>ff(e.context?.elements.floating,t)),o=T.current,s=F.current,c=a(s);queueMicrotask(()=>{let n=Zh(c),i=typeof o!=`boolean`;if(o&&!j.current&&X(n)&&(i||n===t||t===e.body||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}j.current=!1})}},[r,v,B,T,E,y,k,_,x,oe]),J(()=>{if(!Ad||g||!v)return;let e=df(Nd(v));X(e)&&zf(e)&&ff(v,e)&&e.blur()},[g,v]),J(()=>{if(!r&&A)return A.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{A.setFocusManagerState(null)}},[r,A,s,g,h,c,_]),J(()=>{if(!r&&B)return Qh(B),()=>{queueMicrotask(Jh)}},[r,B]);let se=!r&&(!s||!C)&&(ie||s);return(0,H.jsxs)(D.Fragment,{children:[se&&(0,H.jsx)(xp,{"data-type":`inside`,ref:z,onFocus:e=>{if(s){let e=ae();jm(e[e.length-1])}else A?.portalNode&&(j.current=!1,wm(e,A.portalNode)?ym(_)?.focus():Wh(d??A.beforeOutsideRef)?.focus())}}),n,se&&(0,H.jsx)(xp,{"data-type":`inside`,ref:ee,onFocus:e=>{s?jm(ae()[0]):A?.portalNode&&(c&&(j.current=!0),wm(e,A.portalNode)?bm(_)?.focus():Wh(u??A.afterOutsideRef)?.focus())}})]})}function eg(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=Yf}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=D.useRef(void 0),f=Kd(),p=Hd(),m=D.useMemo(()=>{function e(e,t,n,r){let i=np(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=lf(e.pointerType,!0)&&cf(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||lf(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=pf(o);if(zf(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}lf(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return D.useMemo(()=>n?{reference:m}:Rd,[n,m])}function tg(){return!1}function ng(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function rg(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=tg,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f,events:p}=l.context,m=Bh(c),h=hp(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,v=hp(()=>a),{escapeKey:y,outsidePress:b}=ng(s),x=D.useRef(!1),S=D.useRef(!1),C=D.useRef(!1),w=D.useRef(!1),T=D.useRef(!1),E=D.useRef(``),O=D.useRef(null),k=Hd(),A=Hd(),j=hp(()=>{A.clear(),f.current.insideReactTree=!1}),M=hp(e=>{let t=f.current.floatingContext?.nodeId;return(m?Dm(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),N=hp(e=>Lf(e,l.select(`floatingElement`))||Lf(e,l.select(`domReferenceElement`))),P=hp(e=>{o()&&l.setOpen(!1,np(Yf,e.nativeEvent))}),F=hp(e=>{if(!u||!n||!r||e.key!==`Escape`||T.current||!y&&M(`__escapeKeyBubbles`))return;let t=np(ep,of(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!y&&!t.isPropagationAllowed&&e.stopPropagation()}),I=hp(()=>{f.current.insideReactTree=!0,A.start(0,j)}),L=hp(e=>{if(!u||!n||e.button!==0)return;let t=pf(e.nativeEvent);ff(l.select(`floatingElement`),t)&&(x.current||(x.current=!0,S.current=!1))}),R=hp(e=>{u&&n&&(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&x.current&&(S.current=!0)});D.useEffect(()=>{function e(e){e.open||(w.current=!1)}return p.on(`openchange`,e),()=>{p.off(`openchange`,e)}},[p]),D.useEffect(()=>{if(!u||!n)return u||(w.current=!1),j;f.current.__escapeKeyBubbles=y,f.current.__outsidePressBubbles=b;let e=new Vd,t=new Vd,i=Nd(d);function a(){e.clear(),T.current=!0}function o(){e.start(Ad?5:0,()=>{T.current=!1})}function s(){C.current=!0,t.start(0,()=>{C.current=!1})}function c(){x.current=!1,S.current=!1}function p(){let e=E.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function h(e){let t=p();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function D(e){let t=f.current.floatingContext?.nodeId,n=m&&Dm(m.nodesRef.current,t).some(t=>Lf(e,t.context?.elements.floating));return N(e)||n}function A(e){if(h(e)){e.type!==`click`&&!N(e)&&(t.clear(),C.current=!1),j();return}if(f.current.insideReactTree){j();return}let n=pf(e),r=`[${km(`inert`)}]`,i=Y(n)?n.getRootNode():null,a=Array.from((ed(i)?i:Nd(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>ff(e,n))))return;let s=Y(n)?n:null;for(;s&&!dd(s);){let e=md(s);if(dd(e)||!Y(e))break;s=e}if(!(a.length&&Y(n)&&!Rf(n)&&!ff(n,l.select(`floatingElement`))&&a.every(e=>!ff(s,e)))){if(X(n)&&!(`touches`in e)){let t=dd(n),r=fd(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!D(e)){if(p()===`intentional`){if(e.detail!==0&&!sf(e)&&!w.current)return;if(C.current){t.clear(),C.current=!1;return}}(typeof g!=`function`||g(e))&&(M(`__outsidePressBubbles`)||(l.setOpen(!1,np(Zf,e)),j()))}}}function P(e){p()===`sloppy`&&e.pointerType!==`touch`&&l.select(`open`)&&n&&!N(e)&&A(e)}function I(e){if(p()!==`sloppy`||!l.select(`open`)||!n||N(e))return;let t=e.touches[0];t&&(O.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},k.start(1e3,()=>{O.current&&(O.current.dismissOnTouchEnd=!1,O.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=pf(e);if(!n)return;let r=vd(n,e.type,()=>{t(e),r()})}function R(e){E.current=`touch`,L(e,I)}function z(e){k.clear(),e.type===`pointerdown`&&(e.button===0&&(w.current=!0),E.current=e.pointerType),(e.type!==`mousedown`||!O.current||O.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?P(e):A(e)})}function ee(e){if(e.type===`pointercancel`&&(w.current=!1),!x.current)return;let n=S.current;if(c(),p()===`intentional`){if(e.type===`pointercancel`){n&&s();return}if(!D(e)){if(n){s();return}(typeof g!=`function`||g(e))&&(t.clear(),C.current=!0,j())}}}function te(e){if(p()!==`sloppy`||!O.current||N(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-O.current.startX),r=Math.abs(t.clientY-O.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(O.current.dismissOnTouchEnd=!0),i>10&&(A(e),k.clear(),O.current=null)}function ne(e){L(e,te)}function re(e){p()===`sloppy`&&O.current&&!N(e)&&(O.current.dismissOnTouchEnd&&A(e),k.clear(),O.current=null)}function ie(e){L(e,re)}let B=rp(r&&rp(vd(i,`keydown`,F),vd(i,`compositionstart`,a),vd(i,`compositionend`,o)),_&&rp(vd(i,`click`,z,!0),vd(i,`pointerdown`,z,!0),vd(i,`pointerup`,ee,!0),vd(i,`pointercancel`,ee,!0),vd(i,`mousedown`,z,!0),vd(i,`mouseup`,ee,!0),vd(i,`touchstart`,R,{capture:!0,passive:!0}),vd(i,`touchmove`,ne,{capture:!0,passive:!0}),vd(i,`touchend`,ie,{capture:!0,passive:!0})));return()=>{B(),e.clear(),t.clear(),c(),C.current=!1,j()}},[f,d,r,_,g,u,n,y,b,F,j,v,M,N,m,l,k]);let z=D.useMemo(()=>({onKeyDown:F,onPointerDown:P,onClick:P}),[F,P]),ee=D.useMemo(()=>({onKeyDown:F,onPointerDown:R,onMouseDown:R,onClickCapture:I,onMouseDownCapture(e){I(),L(e)},onPointerDownCapture(e){I(),L(e)},onMouseUpCapture:I,onTouchEndCapture:I,onTouchMoveCapture:I}),[F,I,L,R]);return D.useMemo(()=>n?{reference:z,floating:ee,trigger:z}:{},[n,z,ee])}function ig(e,t,n){let{reference:r,floating:i}=e,a=Pp(t),o=Fp(t),s=Np(o),c=Ap(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=jp(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ag(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=kp(t,e),p=qp(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Jp(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Jp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var og=50,sg=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ag},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ig(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<og&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ig(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},cg=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=kp(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Ap(r),_=Pp(o),v=Ap(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Gp(o)]:Lp(o)),x=p!==`none`;!d&&x&&b.push(...Wp(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ip(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Pp(t)||T.every(e=>Pp(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Pp(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},lg=new Set([`left`,`top`]);async function ug(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ap(n),s=jp(n),c=Pp(n)===`y`,l=lg.has(o)?-1:1,u=a&&c?-1:1,d=kp(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var dg=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await ug(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},fg=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=kp(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Pp(i),p=Mp(f),m=u[p],h=u[f],g=(e,t)=>Op(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},pg=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=kp(e,t),u={x:n,y:r},d=Pp(i),f=Mp(d),p=u[f],m=u[d],h=kp(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=lg.has(Ap(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},mg=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=kp(e,t),c=await i.detectOverflow(t,s),l=Ap(n),u=jp(n),d=Pp(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Sp(p-c[m],g),y=Sp(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Cp(c.left,c.right):S=p-2*Cp(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function hg(e){let t=fd(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=X(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=wp(n)!==a||wp(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function gg(e){return Y(e)?e:e.contextElement}function _g(e){let t=gg(e);if(!X(t))return Ep(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=hg(t),o=(a?wp(n.width):n.width)/r,s=(a?wp(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var vg=Ep(0);function yg(e){let t=Zu(e);return!ud()||!t.visualViewport?vg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function bg(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Zu(e)}function xg(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=gg(e),o=Ep(1);t&&(r?Y(r)&&(o=_g(r)):o=_g(e));let s=bg(a,n,r)?yg(a):Ep(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Zu(a),t=Y(r)?Zu(r):r,n=e,i=_d(n);for(;i&&t!==n;){let e=_g(i),t=i.getBoundingClientRect(),r=fd(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Zu(i),i=_d(n)}}return Jp({width:u,height:d,x:c,y:l})}function Sg(e,t){let n=pd(e).scrollLeft;return t?t.left+n:xg(Qu(e)).left+n}function Cg(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Sg(e,n),y:n.top+t.scrollTop}}function wg(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Qu(r),s=t?rd(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Ep(1),u=Ep(0),d=X(r);if((d||!a)&&((Xu(r)!==`body`||td(o))&&(c=pd(r)),d)){let e=xg(r);l=_g(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Cg(o,c):Ep(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Tg(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Eg(e){let t=pd(e),n=e.ownerDocument.body,r=Cp(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Cp(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Sg(e),o=-t.scrollTop;return fd(n).direction===`rtl`&&(a+=Cp(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Dg=25;function Og(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Zu(e),a=Qu(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!ud()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Sg(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Dg&&(s-=o)}return{width:s,height:c,x:l,y:u}}function kg(e,t){let n=xg(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=_g(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ag(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Og(e,n,t);else if(t===`document`)r=Eg(Qu(e));else if(Y(t))r=kg(t,n);else{let n=yg(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Jp(r)}function jg(e,t){let n=t.get(e);if(n)return n;let r=gd(e,[],!1).filter(e=>Y(e)&&Xu(e)!==`body`),i=null,a=fd(e).position===`fixed`,o=a?md(e):e;for(;Y(o)&&!dd(o);){let e=fd(o),t=cd(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=md(o)}return t.set(e,r),r}function Mg(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?rd(t)?[]:jg(t,this._c):[].concat(n),r],o=Ag(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ag(t,a[e],i);s=Cp(n.top,s),c=Sp(n.right,c),l=Sp(n.bottom,l),u=Cp(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Ng(e){let{width:t,height:n}=hg(e);return{width:t,height:n}}function Pg(e,t,n){let r=X(t),i=Qu(t),a=n===`fixed`,o=xg(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Ep(0);if((r||!a)&&((Xu(t)!==`body`||td(i))&&(s=pd(t)),r)){let e=xg(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Sg(i));let l=i&&!r&&!a?Cg(i,s):Ep(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Fg(e){return fd(e).position===`static`}function Ig(e,t){if(!X(e)||fd(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Qu(e)===n&&(n=n.ownerDocument.body),n}function Lg(e,t){let n=Zu(e);if(rd(e))return n;if(!X(e)){let t=md(e);for(;t&&!dd(t);){if(Y(t)&&!Fg(t))return t;t=md(t)}return n}let r=Ig(e,t);for(;r&&nd(r)&&Fg(r);)r=Ig(r,t);return r&&dd(r)&&Fg(r)&&!cd(r)?n:r||ld(e)||n}var Rg=async function(e){let t=this.getOffsetParent||Lg,n=this.getDimensions,r=await n(e.floating);return{reference:Pg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function zg(e){return fd(e).direction===`rtl`}var Bg={convertOffsetParentRelativeRectToViewportRelativeRect:wg,getDocumentElement:Qu,getClippingRect:Mg,getOffsetParent:Lg,getElementRects:Rg,getClientRects:Tg,getDimensions:Ng,getScale:_g,isElement:Y,isRTL:zg};function Vg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Hg(e,t,n){let r=null,i,a=Qu(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Tp(d),h=Tp(a.clientWidth-(u+f)),g=Tp(a.clientHeight-(d+p)),_=Tp(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Cp(0,Sp(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Vg(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Zu(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Ug(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=gg(e),u=i||a?[...l?gd(l):[],...t?gd(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Hg(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?xg(e):null;c&&g();function g(){let t=xg(e);h&&!Vg(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Wg=dg,Gg=fg,Kg=cg,qg=mg,Jg=pg,Yg=(e,t,n)=>{let r=new Map,i=n??{},a={...Bg,...i.platform,_c:r};return sg(e,t,{...i,platform:a})},Xg=typeof document<`u`?D.useLayoutEffect:function(){};function Zg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Zg(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Zg(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Qg(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $g(e,t){let n=Qg(e);return Math.round(t*n)/n}function e_(e){let t=D.useRef(e);return Xg(()=>{t.current=e}),t}function t_(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=D.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=D.useState(r);Zg(f,r)||p(r);let[m,h]=D.useState(null),[g,_]=D.useState(null),v=D.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=D.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=D.useRef(null),C=D.useRef(null),w=D.useRef(u),T=c!=null,E=e_(c),O=e_(i),k=e_(l),A=D.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Yg(S.current,C.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Zg(w.current,t)&&(w.current=t,kh.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Xg(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=D.useRef(!1);Xg(()=>(j.current=!0,()=>{j.current=!1}),[]),Xg(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,A);A()}},[b,x,A,E,T]);let M=D.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),N=D.useMemo(()=>({reference:b,floating:x}),[b,x]),P=D.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=$g(N.floating,u.x),r=$g(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Qg(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return D.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var n_=(e,t)=>{let n=Wg(e);return{name:n.name,fn:n.fn,options:[e,t]}},r_=(e,t)=>{let n=Gg(e);return{name:n.name,fn:n.fn,options:[e,t]}},i_=(e,t)=>({fn:Jg(e).fn,options:[e,t]}),a_=(e,t)=>{let n=Kg(e);return{name:n.name,fn:n.fn,options:[e,t]}},o_=(e,t)=>{let n=qg(e);return{name:n.name,fn:n.fn,options:[e,t]}},s_=o((e=>{var t=u();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),c_=o(((e,t)=>{t.exports=s_()})),l_=o((e=>{var t=u(),n=c_();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),u_=o(((e,t)=>{t.exports=l_()})),d_=[],f_=void 0;function p_(){return f_}function m_(e){d_.push(e)}function h_(e){let t=(t,n)=>{let r=Fd(__).current,i;try{f_=r;for(let e of d_)e.before(r);i=e(t,n);for(let e of d_)e.after(r);r.didInitialize=!0}finally{f_=void 0}return i};return t.displayName=e.displayName||e.name,t}function g_(e){return D.forwardRef(h_(e))}function __(){return{didInitialize:!1}}var v_=c_(),y_=u_(),b_=Zm(19)?C_:w_;function x_(e,t,n,r,i){return b_(e,t,n,r,i)}function S_(e,t,n,r,i){let a=D.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,v_.useSyncExternalStore)(e.subscribe,a,a)}m_({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,v_.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function C_(e,t,n,r,i){let a=p_();if(!a)return S_(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function w_(e,t,n,r,i){return(0,y_.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var T_=class{static create(e){return new this(e)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return x_(this,e,t,n,r)}},E_=class extends T_{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){D.useDebugValue(e);let n=this;J(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;J(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;J(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){D.useDebugValue(e);let n=this,r=t!==void 0;J(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return D.useDebugValue(e),x_(this,this.selectors[e],t,n,r)}useContextCallback(e,t){D.useDebugValue(e);let n=hp(t??Id);this.context[e]=n}useStateSetter(e){let t=D.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},D_={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},O_=class extends E_{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Fh(),nested:n,triggerElements:i},D_),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&uf(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function k_(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=D.useRef(null);r===void 0&&f.current===null&&(f.current=new O_({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),J(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};Y(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function A_(e,t=!1,n=!1,r=!1){let[i,a]=D.useState(e&&t?`idle`:void 0),[o,s]=D.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),J(()=>{if(!e&&o&&i!==`ending`&&n){let e=Gd.request(()=>{a(`ending`)});return()=>{Gd.cancel(e)}}},[e,o,i,n]),J(()=>{if(!e||t)return;let n=Gd.request(()=>{a(void 0)});return()=>{Gd.cancel(n)}},[t,e]),J(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=Gd.request(()=>{a(`idle`)});return()=>{Gd.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var j_=null;function M_(e){if(!j_){let e=[];j_=e,queueMicrotask(()=>{j_=null,kh.flushSync(()=>{for(let t of e)t()})})}j_.push(e)}function N_(e,t=!1,n=!1){let r=Kd();return hp((i,a=null)=>{r.cancel();let o=Wh(e);if(o==null)return;let s=o,c=()=>{if(!n){kh.flushSync(i);return}M_(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if(s.getAnimations().some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=gf;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function P_(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=hp(a),s=N_(r,n,i);D.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}var F_={tabIndex:-1,[mf]:``};function I_(e){return t=>t!==`touch`||e.current}function L_(e,t=!1){let n=qm(),r=zh()!=null,i=Fd(()=>e(n,r)).current;return k_({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function R_({handle:e,store:t}){return J(()=>e.attachStore(t),[e,t]),null}function z_(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function B_(e,t){let n=D.useRef(null);return hp(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),z_(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),z_(t))})}function V_(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s}}function H_(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function U_(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=B_(e,n),o=hp(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e);return}if(a==null&&i){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=hp(e=>{a(e),e&&o(e)});return J(()=>(s(t.current),()=>s(null)),[s,t,n,e]),J(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function W_(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=D.useRef(null),i=e.useState(`open`);J(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=np(Jf);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function G_(e,t,n,r){let{mounted:i,setMounted:a,transitionStatus:o}=A_(e,!1,!1,r),s=t.useState(`preventUnmountingOnClose`),c=!e&&s;t.useSyncedValues({mounted:i,transitionStatus:o,preventUnmountingOnClose:c});let l=hp(()=>{a(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return P_({enabled:i&&!e&&!c,open:e,ref:t.context.popupRef,onComplete(){e||l()}}),{forceUnmount:l,transitionStatus:o}}function K_(e,t){e.useSyncedValues(t),J(()=>()=>{e.update({activeTriggerProps:Rd,inactiveTriggerProps:Rd,popupProps:Rd})},[e])}function q_(e,t){J(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),J(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var J_=class{constructor(){this.idMap=new Map}add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};function Y_(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new O_({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Rd,inactiveTriggerProps:Rd,popupProps:Rd}}var X_=e=>e.triggerIdProp??e.activeTriggerId,Z_=e=>e.openProp??e.open,Q_=e=>(e.popupElement?.id??e.floatingId)||void 0;function $_(e,t){return t!==void 0&&Z_(e)&&X_(e)===t}function ev(e,t){return $_(e,t)?!0:t!==void 0&&Z_(e)&&X_(e)==null&&e.triggerCount===1}var tv={open:Z_,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:X_,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Q_,isTriggerActive:(e,t)=>t!==void 0&&X_(e)===t,isOpenedByTrigger:(e,t)=>$_(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&X_(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>ev(e,t)?Q_(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function nv(e){let t=D.useCallback(t=>e===void 0?Id:e.subscribeStore(t),[e]),n=D.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,v_.useSyncExternalStore)(t,n,()=>e?.serverStore)}function rv(e){return iv(e,e.rootContext)}function iv(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=D.useState(null),[d,f]=D.useState(void 0),[p,m]=D.useState(void 0),h=D.useRef(null),g=Bh(r),_=D.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=t_({...e,elements:{..._,...l&&{reference:l}}}),y=Y(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=D.useCallback(e=>{let t=Y(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=D.useCallback(e=>{(Y(e)||e===null)&&(h.current=e,f(e)),(Y(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!Y(e))&&v.refs.setReference(e)},[v.refs,f]),C=D.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=D.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=D.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=D.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return J(()=>{o&&(h.current=o)},[o]),J(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),D.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var av=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Vd,this.restTimeout=new Vd,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},ov=new WeakMap;function sv(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&ov.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),ov.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function cv(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=ov.get(n);a&&a!==e&&sv(a),sv(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,ov.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function lv(e){let t=e.context.dataRef.current,n=Fd(()=>t.hoverInteractionState??av.create()).current;return t.hoverInteractionState||=n,zd(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function uv(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=Bh(),d=zh(),f=lv(a),p=Hd(),m=hp(()=>Kf(l.current.openEvent?.type,f.interactedInside)),h=hp(()=>qf(l.current.openEvent?.type)),g=hp(()=>{sv(f)});J(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),D.useEffect(()=>g,[g]),J(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&Y(c)&&s){let e=c,t=s,n=Nd(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return cv(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),D.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&Dm(u.nodesRef.current,d).length>0)}function t(e){let t=Wf(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,np(Xf,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=pf(e);if(!Bf(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(If(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&Y(o)&&Dm(u.nodesRef.current,r,!1).some(e=>ff(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}g(),h()&&!m()&&t(n)}}function v(t){u&&d&&!e()&&p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,np(Xf,t)),u.events.emit(`floating.closed`,t)})}let y=s;return rp(y&&vd(y,`mouseenter`,c),y&&vd(y,`mouseleave`,_),y&&vd(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var dv={current:null};function fv(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=dv,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,h=`rootStore`in e?e.rootStore:e,{dataRef:g,events:_}=h.context,v=Bh(l),y=lv(h),b=D.useRef(!1),x=up(i),S=up(r),C=up(o),w=up(n),T=up(p),E=up(f),O=hp(()=>Kf(g.current.openEvent?.type,y.interactedInside)),k=hp(()=>T.current?.()!==!1),A=hp((e,t,n)=>{let r=h.context.triggerElements;if(r.hasElement(t))return!e||!ff(e,t);if(!Y(n))return!1;let i=n;return r.hasMatchingElement(e=>ff(e,i))&&(!e||!ff(e,i))}),j=hp(()=>{y.handler&&=(Nd(h.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),M=hp(()=>{sv(y)});return u&&(y.handleCloseOptions=i?.__options),D.useEffect(()=>j,[j]),D.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===Xf,j(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return _.on(`openchange`,e),()=>{_.off(`openchange`,e)}},[n,_,y,j]),D.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Wf(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{h.setOpen(!1,np(Xf,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),h.setOpen(!1,np(Xf,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?h.select(`domReferenceElement`):null);if(!Y(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!lf(y.pointerType))return;let t=Gf(C.current),n=Wf(S.current,`open`,y.pointerType),r=pf(e),i=e.currentTarget??null,o=h.select(`domReferenceElement`),s=i;if(Y(r)&&!h.context.triggerElements.hasElement(r)){for(let e of h.context.triggerElements.elements())if(ff(e,r)){s=e;break}}Y(i)&&Y(o)&&!h.context.triggerElements.hasElement(i)&&ff(i,o)&&(s=o);let c=s!=null&&A(o,s,r),l=h.select(`open`),u=E.current?.()??h.select(`transitionStatus`)===`ending`,d=!l&&u&&b.current,f=!c&&Y(s)&&Y(o)&&ff(o,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,g=!l||c;if(m){k()&&h.setOpen(!0,np(Xf,e,s));return}p||(n?y.openChangeTimeout.start(n,()=>{g&&k()&&h.setOpen(!0,np(Xf,e,s))}):g&&k()&&h.setOpen(!0,np(Xf,e,s)))}function i(t){if(O()){M();return}j();let n=Nd(h.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=g.current.floatingContext??d?.();if(!If(t.relatedTarget,h.context.triggerElements)){if(x.current&&r){h.select(`open`)||y.openChangeTimeout.clear();let i=c.current;y.handler=x.current({...r,tree:v,x:t.clientX,y:t.clientY,onClose(){M(),j(),w.current&&!O()&&i===h.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,y.handler),y.handler(t);return}(y.pointerType!==`touch`||!ff(h.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){ff(t,e.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}let l=m?vd(t,`mouseout`,o):void 0;return s?rp(vd(t,`mousemove`,r,{once:!0}),vd(t,`mouseenter`,r),vd(t,`mouseleave`,i),l):rp(vd(t,`mouseenter`,r),vd(t,`mouseleave`,i),l)},[j,M,g,S,h,n,x,y,u,A,O,a,s,C,c,v,w,d,E,k,m]),D.useMemo(()=>{if(!n)return;function e(e){y.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=h.select(`domReferenceElement`),i=h.select(`open`),o=A(r,n,e.target);if(a&&!lf(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=h.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;cv(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=Gf(C.current);if(i&&!o||s===0||!o&&y.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;y.restTimeout.clear();function c(){if(y.restTimeoutPending=!1,O())return;let e=h.select(`open`);!y.blockMouseMove&&(!e||o)&&k()&&h.setOpen(!0,np(Xf,t,n))}y.pointerType===`touch`?kh.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,O,A,a,h,C,k])}var pv=.1,mv=pv*pv,hv=.5;function gv(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function _v(e,t,n,r,i,a,o,s,c,l){let u=!1;return gv(e,t,n,r,i,a)&&(u=!u),gv(e,t,i,a,o,s)&&(u=!u),gv(e,t,o,s,c,l)&&(u=!u),gv(e,t,c,l,n,r)&&(u=!u),u}function vv(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function yv(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function bv(e={}){let{blockPointerEvents:t=!1}=e,n=new Vd,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*mv;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=pf(r),g=r.type===`mouseleave`,_=ff(u,h),v=ff(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&Y(r.relatedTarget)&&ff(u,r.relatedTarget))return;function y(){return!!(s&&Dm(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=yv(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=yv(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=yv(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=yv(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!vv(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?hv/2:hv*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+hv+1,o=C||T?S.bottom-hv:S.top,s=C?T?S.bottom-hv:S.top:S.bottom-hv;M=_v(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?hv/2:hv*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-hv,o=C||T?S.top+hv:S.bottom,s=C?T?S.top+hv:S.bottom:S.top+hv;M=_v(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?hv/2:hv*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+hv+1,o=w||E?S.right-hv:S.left,s=w?E?S.right-hv:S.left:S.right-hv;M=_v(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?hv/2:hv*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-hv,o=w||E?S.left+hv:S.right,s=w?E?S.left+hv:S.right:S.left+hv;M=_v(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function xv({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=D.useState(0),[u,d]=D.useState(0),f=c===0,p=rg(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=pf(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||ff(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return rf(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),J(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),K_(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var Sv=D.createContext(void 0);function Cv(e){let t=D.useContext(Sv);if(!e&&t===void 0)throw Error(Ym(27));return t}var wv={...tv,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},Tv=class extends E_{constructor(e,t,n){let r=new J_,i=Ev(e,r,t,n);super(i,Dv(r),wv)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(V_(this.state,e,t.trigger)))}};function Ev(e,t,n,r=!1){return{...Y_(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function Dv(e){return{popupRef:D.createRef(),backdropRef:D.createRef(),internalBackdropRef:D.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Ov(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=Cv(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=L_((e,t)=>new Tv({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);q_(b,x),W_(b);let{forceUnmount:w}=G_(x,b);D.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,np(tp))}),[w,b]);let T=x||S;return(0,H.jsxs)(Sv.Provider,{value:b,children:[u&&(0,H.jsx)(R_,{handle:u,store:b}),T&&(0,H.jsx)(xv,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}function kv(e){return Ov(`alert-dialog`,e)}var Av=D.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=Cv(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return vh(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Pf,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),jv=D.createContext(void 0);function Mv(e=!1){let t=D.useContext(jv);if(t===void 0&&!e)throw Error(Ym(16));return t}function Nv(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:D.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function Pv(e,t,{detail:n=0}={}){e.dispatchEvent(new(Zu(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Fv(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=D.useRef(null),s=Mv(!0),c=a??s!==void 0,{props:l}=Nv({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=D.useCallback(()=>{let e=o.current;Iv(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return J(u,[u]),{getButtonProps:D.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return ih({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(hh(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=Iv(r),s=!i&&Lv(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),Pv(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),Pv(r,e)))},onKeyUp(e){if(!t){if(hh(e),a?.(e),e.target===e.currentTarget&&i&&c&&Iv(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),Pv(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:hp(e=>{o.current=e,u()})}}function Iv(e){return X(e)&&e.tagName===`BUTTON`}function Lv(e){return X(e)&&e.tagName===`A`&&!!e.href}var Rv=D.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=Cv(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=Fv({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,np(Qf,e.nativeEvent))}return vh(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})});function zv(e){return qm(e,`base-ui`)}var Bv=D.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Cv(),c=zv(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),vh(`p`,e,{ref:t,props:[{id:c},o]})}),Vv=D.createContext(void 0);function Hv(){let e=D.useContext(Vv);if(e===void 0)throw Error(Ym(26));return e}var Uv=`ArrowUp`,Wv=`ArrowDown`,Gv=`ArrowLeft`,Kv=`ArrowRight`,qv=new Set([Uv,Wv,Gv,Kv,`Home`,`End`]),Jv=`Shift`,Yv=[Jv,`Control`,`Alt`,`Meta`];function Xv(e){return X(e)&&e.tagName===`INPUT`}function Zv(e){return!!(Xv(e)&&e.selectionStart!=null||X(e)&&e.tagName===`TEXTAREA`)}function Qv(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=$v(e,t,`left`),a=ey(e),o=ey(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=$v(e,t,`top`),r=ey(e),i=ey(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function $v(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function ey(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var ty=`--nested-dialogs`,ny=`data-nested-dialog-open`,ry={...Nf,...bf,nestedDialogOpen(e){return e?{[ny]:``}:null}},iy=D.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=Cv(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);Hv(),P_({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?I_(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=vh(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...F_,hidden:!m,onKeyDown(e){qv.has(e.key)&&e.stopPropagation()},style:{[ty]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:ry});return(0,H.jsx)($h,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})});function ay(e){return Zm(19)?e:e?`true`:void 0}var oy=D.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,H.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),sy=D.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Cv(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,H.jsx)(Vv.Provider,{value:n,children:(0,H.jsxs)(Ph,{ref:t,...r,children:[a&&o===!0&&(0,H.jsx)(oy,{ref:i.context.internalBackdropRef,inert:ay(!s)}),e.children]})}):null}),cy=D.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Cv(),c=zv(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),vh(`h2`,e,{ref:t,props:[{id:c},o]})});function ly(e){let t=D.useRef(``),n=D.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:D.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function uy(e,t){let n=D.useRef(e),r=hp(t);J(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function dy(e,t){let{onClick:n,onPointerDown:r}=ly(hp((n,r)=>{(typeof e==`function`?e():e)||t(r||(Td?`touch`:``))}));return D.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}var fy=48,py=(e,t=0)=>{let n=new Int32Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r)-fy-t;return n},my=e=>{let t=new Int32Array(e.length+1);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t},hy=e=>{let t=new Int32Array(e.length),n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r)-fy;n+=i>>>1^-(i&1),t[r]=n}return t},gy=384,_y=[],vy=my(py(`E0500002005282000000002000150000020021820000011200000003022202000300004200120000200420001200021200301200010400162000010000220021010:2192001200220012000220012000200200200400010200040000000000400200108200110100000022010313000162002000020020012020080213000228200000000082000000000120002000120020020040101020300130001001010`)),yy=my(py(`:11111111211111119311546544411119731869:671397415686432441111111111161114151214313433415:78311132233313187211117221449443411141111151152226611131111112212518142224214215421421542142424242516171151615616347111111111197911327451111111111111111111113134714133513411111311111111111111111111112444411111342312715245411117:3`)),by=`@containerabcdefghinlmoprstunderlineviawzccentlignnimatespectuto-colsrowsaglorightnessckdrop-sisbcontrastfiltergrayscalehue-rotateinvertopacityslurrightnessaturateepia-coniclinearpositionradialsizeockurrderttom-belrstxyespacing-xyaretoursorlnt-umnsendspantartainentrasteividerop-shadowurationcorationlay-xyasendillexontromlter-featuresstretchapr-xyayscaleidow-colsrowsue-rotatedentlinesetvert-beringsxyeshadoweiadingftnest-clamp-imageabein-lrstxyskx--b-coniclpositionrsizet-x-y-fromto-fromto-inearfromto-fromto-adialfromto-fromtofromtofromtofromtoblockhinlinew-screenesblockhinlinewbjectpacityrutlinederigin-offsetbelrstxyesrspective-originaceholderioghtng-offsettateundedw-xyz-belrstlreseslr-endspantartaturatecepiahizekewpace-taleroll-xyz-barmpbelrstxyesbelrstxyes-thumbrackadowrink-xyxyartrokeabextora-shadowpckingnsformitionlate-xyz-offsetill-changeoom`,xy=(()=>{let e=vy.length-1,t=new Int32Array(e);for(let n=e-1;n>=0;n--){let e=1,r=n+1;for(let i=vy[n];i<vy[n+1];i++)e+=t[r],r+=t[r];t[n]=e}let n=new Int32Array(vy[e]),r=0;for(let i=0;i<e;i++){let e=i+1;for(let a=vy[i];a<vy[i+1];a++)n[r++]=e,e+=t[e]}return n})(),Sy=py(`02000000000000900<=0?000B000F00F00ŏI0J0LNPRTVX0000]_a00000000000000000000000rst0000000zŏ00000000000
ŏ0000000ŏ00000000000000000000000000000000000000000000000000000000000000Ë000000000000000000000Þ000000000000000000ð0000000ø0ùúûüýþÿĀāĂ㥹Ć000000000000000000000000000000000000000000ħ0ĨĪ00000000000000000000ļĽ00000Ŭ000000`,1),Cy=my(py(`123333359346463635126536711576`)),wy=py(`93203242332583253248325D>E?F@03263243255B:032523853:0325B:8GA032542H<C=12727B:0328432553;D>E?3257D>032585:0325B:;0328B:032`),Ty=py(`012113445661666666789111:5;;;;;;;;444;;;:62999<1161=62>>?61:21@ABCD4446996:64E:::;:?::64:F114GHHIHHHHIHH1HH1HH1HHHHHH::EEJ4444::EE4444441691;644444114244444:;K6666555555555555555999666664444444444444444444444226?6:66644L9M?D:111::::6DE199`),Ey=hy(`020200202020020020020020020020200200200200200200200002020202001003040106000200200200200200200200200200200200200200200200200200200200200200200200200200200200020020020020020020002020200202002002002002002002002002002020002002020020200220200200200200200200200200200200020020020000200020002000200200200020020020002000200200200020020202002020202000200200020022000200200020020002002000200220002002000200W0Z00020020002002020002002000200g0j0002002000200200020020002002000200200020020002000200002000002002002002002000200020000200002002002002002002002020020020200200200200200200200200202020020020020020020020020002002002020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020002002002002002002000200200200200200200200200200020202020002000200020002002002002000020200200`),Dy=(()=>{let e=new Int32Array(319).fill(-1),t=hy(`02422242:222222242224222242442222222422222244442242226224222426222422442462222422622222222626222462242622422622422424242422222222422222222242422222222222222222622442224222222222222224424442262222222222222222222226224222424242422224422422422222`),n=hy(`02222222222222222222202222222222222222222222221422222222222222222222222222222222222Y\\222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221422222222222222222222222222222222222222Ŀł222222222222222222`);for(let r=0;r<t.length;r++)e[t[r]]=n[r];return e})(),Oy=`container |break-after- all auto avoid avoid-page column left page right|break-before- all auto avoid avoid-page column left page right|break-inside-a uto void void-column void-page|box-decoration- clone slice|box- border content| contents flow-root hidden table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group| not-sr-only sr-only|float- end left none right start|clear- both end left none right start|isolat e ion-auto|overflow- auto clip hidden scroll visible|overflow-x- auto clip hidden scroll visible|overflow-y- auto clip hidden scroll visible|overscroll- auto contain none|overscroll-x- auto contain none|overscroll-y- auto contain none| absolute fixed relative static sticky| collapse invisible visible|justify- around baseline between center center-safe end end-safe evenly normal start stretch|justify-items- center center-safe end end-safe normal start stretch|justify-self- auto center center-safe end end-safe start stretch|items- baseline baseline-last center center-safe end end-safe start stretch|self- auto baseline baseline-last center center-safe end end-safe start stretch|place-content- around baseline between center center-safe end end-safe evenly start stretch|place-items- baseline center center-safe end end-safe start stretch|place-self- auto center center-safe end end-safe start stretch| antialiased subpixel-antialiased| italic not-italic|normal-nums |ordinal |slashed-zero | lining-nums oldstyle-nums| proportional-nums tabular-nums| diagonal-fractions stacked-fractions| no-underline overline| capitalize lowercase normal-case uppercase|truncate |whitespace- break-spaces normal nowrap pre pre-line pre-wrap|break- all keep normal words|wrap- anywhere break-word normal|hyphens- auto manual none|mix-blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay plus-darker plus-lighter saturation screen soft-light|table- auto fixed|caption- bottom top|backface- hidden visible|appearance- auto none|scheme- dark light light-dark normal only-dark only-light|field-sizing- content fixed|pointer-events- auto none|resize -none -x -y|snap- align-none center end start|snap- always normal|snap- both none x y|snap- mandatory proximity|touch- auto manipulation none|touch-pan- left right x|touch-pan- down up y|touch-pinch-zoom |select- all auto none text|forced-color-adjust- auto none| normal size| baseline bottom middle sub super text-bottom text-top top| bounce none ping pulse spin| auto square video| auto fr max min px|none | auto full px| fixed local scroll|clip- border content padding text|origin- border content padding| bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| no-repeat repeat repeat-round repeat-space repeat-x repeat-y| auto contain cover| gradient-to-b gradient-to-bl gradient-to-br gradient-to-l gradient-to-r gradient-to-t gradient-to-tl gradient-to-tr none|blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay saturation screen soft-light|to- b bl br l r t tl tr| auto dvh fit full lh lvh max min px screen svh| dashed dotted double hidden none solid| collapse separate|px |auto |full | content none strict| inline-size size|layout |paint |style | around baseline between center center-safe end end-safe evenly normal start stretch| alias all-scroll auto cell col-resize context-menu copy crosshair default e-resize ew-resize grab grabbing help move n-resize ne-resize nesw-resize no-drop none not-allowed ns-resize nw-resize nwse-resize pointer progress row-resize s-resize se-resize sw-resize text vertical-text w-resize wait zoom-in zoom-out| dashed dotted double solid wavy| auto from-font|reverse |initial | in in-out initial linear out| col col-reverse row row-reverse| nowrap wrap wrap-reverse| auto initial none| black bold extrabold extralight light medium normal semibold thin| condensed expanded extra-condensed extra-expanded normal semi-condensed semi-expanded ultra-condensed ultra-expanded|flow- col col-dense dense row row-dense| none subgrid| auto dvh dvw fit full lh lvh lvw max min px screen svh svw| block flex grid table| auto dvw fit full lvw max min px screen svw| loose none normal px relaxed snug tight|through |item | inside outside| decimal disc none| auto px| clip-border clip-content clip-fill clip-padding clip-stroke clip-view no-clip| add exclude intersect subtract| alpha luminance match|origin- border content fill padding stroke view|type- alpha luminance| circle ellipse| closest-corner closest-side farthest-corner farthest-side|at- bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| dvh fit full lh lvh max min none px screen svh| auto dvh dvw fit full lh lvh lvw max min none px screen svh svw| dvw fit full lvw max min none px screen svw| auto dvh dvw fit full lvh lvw max min none prose px svh svw| auto dvh dvw fit full lvh lvw max min none px screen svh svw| contain cover fill none scale-down| first last none| distant dramatic midrange near none normal|inset | full none|3d | auto smooth|gutter- auto both stable| auto none thin| inner none| auto dvh dvw fit full lvh lvw max min px svh svw|base | center end justify left right start| clip ellipsis| balance nowrap pretty wrap| normal tight tighter wide wider widest| cpu gpu none| 3d flat| all colors none opacity shadow transform| discrete normal| full px| auto dvh dvw fit full lvh lvw max min px screen svh svw| auto contents scroll transform`.split(`|`).map(e=>{let t=e.split(` `),n=t.shift();for(let e=0;e<t.length;e++)t[e]=n+t[e];return t}),ky=hy(`0000000000000000000000000000000000000000000000000000000000000262242:6@200000006:240B428:4422400002046044222426220026642642462026224222824220022400000000\\00N222422242222222224062242222222422226264222422222222222222442804222422222222222222222222220<4<0204260002444020204224422`),Ay=hy(`ɠ222222222222222222222222222222222222222222222222222222222222˕4222226>ʶ22ʷʺʷ2ʸʷ42ʴ2ʓ22>621422ɶ222ɹɼɷɺɷɺ22ɱ42222ɨ2ɧ26622ɘɓ244ƸƵ222]d24242ǖǓƚÄȫ2263ȨȥȨ2222222ǣ222222222222222222ǂƽ2ƾƵ2222222422222ƜƑ22222222222222222222144Ŧţ22Ţş222222222222222222222ĸ2ı68ĦģĦɡŰ4Ġ«®ĝ822ĔđĔ2ē2222622`),jy=hy(`02222222222222222222222222222222222222222222222222222222222222222202022222222222EH2200IL021042222Y\\222IL0cf2e10j2222U00X202[^2y0000120|{~22
:22|22222222222G000qOVI00000}2>40000B00000I¨©000¬00000000000000021M®00°000000000000000000000222HGHa1º222¿2À2222ÉÌ000°2±`),My=new Int32Array(995),Ny=new Int32Array(995),Py=new Int32Array(995),Fy=``,Iy=new Int32Array(1038);{let e=new Map,t=0,n=0;for(let r=0;r<ky.length;r++)for(let i of Oy[jy[r]]){let a=e.get(i);a===void 0&&(a=t++,e.set(i,a),Iy[a*2]=Fy.length,Iy[a*2+1]=i.length,Fy+=i),My[n]=ky[r],Ny[n]=Ay[r],Py[n]=a,n++}}var Ly=hy(`0b2N:222@R>F@286¦2@H2D266226FB22B2>BD\\6N22222Z222D222p`),Ry=my(py(`1::24444432:442:44:44>222222:44:4421322511111311111114`)),zy=hy(`24A;33N=C@H4A;33N=C@<27;83:;8393NQ:3NQʰ222ˉºŴŽ2R2=18cƴÅŇ=cĞÛC1ƈǝȈ:ħ25=11D3A@4=<1;1DEr25;11B3?<6;:371BCn9@7=<8192>2E121@9@EHE@9>2T25511<398454131<=V25511<398454131<=ƧNž2Đå242L222290000f22500ɛ000ǘ222`),By=py(`ij`),Vy=py(``),Hy=py(`1`),Uy={GROUP_COUNT:gy,customValidatorNames:_y,edgeStart:vy,labelStart:yy,labelText:by,edgeTarget:xy,nodeGroup:Sy,nodeVlist:Dy,vlistPat:Cy,vlistOps:wy,vlistRef:Ty,vlistGroup:Ey,litAnchor:My,litGroup:Ny,litPool:Py,poolOffsets:Iy,poolText:Fy,adjGid:Ly,adjStart:Ry,adjTgt:zy,patGid:By,patTgt:Vy,postfixLookupGroups:Hy,orderSensitiveModifiers:`* ** after backdrop before details-content file first-letter first-line marker placeholder selection`},Wy=`line`in Error(),Gy=-1,Ky=-1,qy=(e,t,n)=>{let r=2166136261;for(let i=t;i<n;i++)r=Math.imul(r^e.charCodeAt(i),16777619);return r},Jy=(e,t,n)=>{let r=n-t,i=Math.imul(r,2654435761)^e.charCodeAt(t);if(r>3){let a=r>>2,o=r>>1;i=Math.imul(i^e.charCodeAt(t+1)<<8^e.charCodeAt(t+2)<<16^e.charCodeAt(t+a),2246822507),i=Math.imul(i^e.charCodeAt(t+o)<<8^e.charCodeAt(t+o+a)<<16^e.charCodeAt(n-3),3266489909),i^=e.charCodeAt(n-2)<<8^e.charCodeAt(n-1)<<16;for(let r=t+3,a=n-4;r<t+8&&r<a;r++,a--)i=Math.imul(i^e.charCodeAt(r)^e.charCodeAt(a)<<8,16777619)}return i^i>>>15|0},Yy=(e,t,n={})=>{let{GROUP_COUNT:r,edgeStart:i,labelStart:a,labelText:o,edgeTarget:s,nodeGroup:c,nodeVlist:l,vlistPat:u,vlistOps:d,vlistRef:f,vlistGroup:p,litAnchor:m,litGroup:h,litPool:g,poolOffsets:_,poolText:v,adjGid:y,adjStart:b,adjTgt:x,patGid:S,patTgt:C,postfixLookupGroups:w,customValidatorNames:T,orderSensitiveModifiers:E}=e,D=new Int32Array(r).fill(-1);for(let e=0;e<y.length;e++)D[y[e]]=e;let O=0;for(let e=0;e+1<b.length;e++){let t=b[e+1]-b[e];t>O&&(O=t)}let k=32;for(;k<2*(1+O+S.length);)k<<=1;let A=new Int32Array(f.length+1);for(let e=0;e<f.length;e++)A[e+1]=A[e]+u[f[e]+1]-u[f[e]];let j=new Uint8Array(r);for(let e=0;e<w.length;e++)j[w[e]]=1;let M=i.length-1,N=new Uint8Array(M),P=0,F=!0;for(let e=0;e<m.length;e++){N[m[e]]=1;let t=_[g[e]*2+1];t>P&&(P=t);let n=v.charCodeAt(_[g[e]*2]);(n===91||n===40)&&(F=!1)}let I=1;for(;I<m.length*2;)I<<=1;let L=new Int32Array(I).fill(-1);for(let e=0;e<m.length;e++){let t=_[g[e]*2],n=(qy(v,t,t+_[g[e]*2+1])^Math.imul(m[e],2654435761)|0)&I-1;for(;L[n]!==-1;)n=n+1&I-1;L[n]=e}let R=(e,t,n,r)=>{let i=(qy(t,n,r)^Math.imul(e,2654435761)|0)&I-1,a=r-n;for(;;){let r=L[i];if(r===-1)return-1;if(m[r]===e&&_[g[r]*2+1]===a){let e=_[g[r]*2],i=!0;for(let r=0;r<a;r++)if(v.charCodeAt(e+r)!==t.charCodeAt(n+r)){i=!1;break}if(i)return h[r]}i=i+1&I-1}},z=n.cacheSize??8192,ee=n.prefix??e.prefix??``,te=ee===``?``:ee+`:`,ne=te.length,re=(T??[]).map(e=>{let n=t&&t[e];if(!n)throw Error(`cn: missing validator `+e);return n}),ie=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,B=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ae=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,oe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,se=0,ce=-1,le=-1,V=-1,ue=-1,de=e=>e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95,fe=e=>/\s/.test(String.fromCharCode(e)),pe=(e,t,n)=>{if(se=0,ce=-1,n-t<3)return;let r=e.charCodeAt(t),i=e.charCodeAt(n-1);if(r===91&&i===93)se=1;else if(r===40&&i===41)se=2;else return;V=t+1,ue=n-1;let a=t+1;if(de(e.charCodeAt(a))){for(a++;a<n-1;){let t=e.charCodeAt(a);if(!de(t)&&t!==45)break;a++}a<n-2&&e.charCodeAt(a)===58&&(ce=t+1,le=a,V=a+1)}},me=(e,t,n,r)=>{if(n-t!==r.length)return!1;for(let n=0;n<r.length;n++)if(e.charCodeAt(t+n)!==r.charCodeAt(n))return!1;return!0},he=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ge=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_e=e=>!!e&&!Number.isNaN(Number(e)),ve=(e,t,n)=>{if(n-t<11||!me(e,t,t+10,`@container`))return!1;if(e.charCodeAt(t+10)===47)return n-t>=12;let r=e.charCodeAt(t+11);return r===115&&n-t>=17&&me(e,t+10,t+16,`-size/`)||r===110&&n-t>=19&&me(e,t+10,t+18,`-normal/`)},ye=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],be=`length|number|number weight|family-name|position percentage|length size bg-size|image url|shadow|length|family-name|position percentage|length size bg-size|image url|shadow|number weight`.split(`|`).map(e=>e.split(` `)),xe=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],Se=(e,t,n,r)=>{if(e>=10){if(e>=25)return re[e-25](t.slice(n,r));let i=e-10;if(se!==ye[i])return!1;if(ce>=0){for(let e of be[i])if(me(t,ce,le,e))return!0;return!1}switch(xe[i]){case 0:return!1;case 1:return!0;case 2:{let e=t.slice(V,ue);return ie.test(e)&&!B.test(e)}case 3:return _e(t.slice(V,ue));case 4:return oe.test(t.slice(V,ue));default:return ae.test(t.slice(V,ue))}}switch(e){case 0:return!0;case 1:return se===0;case 2:return se===1;case 3:return se===2;case 4:return he.test(t.slice(n,r));case 5:return _e(t.slice(n,r));case 6:{let e=t.slice(n,r);return!!e&&Number.isInteger(Number(e))}case 7:return r>n&&t.charCodeAt(r-1)===37&&_e(t.slice(n,r-1));case 8:return ge.test(t.slice(n,r));default:return ve(t,n,r)}},Ce=new Set(typeof E==`string`?E.split(` `):E),we=(e,t,n,r,i,a)=>{let o=qy(t,n,r)^(i?2654435769:0)|0,s=e.get(o);if(s!==void 0)outer:for(let e=0;e<s.length;e++){let a=s[e];if(a.imp===i&&a.k.length===r-n){for(let e=0;e<a.k.length;e++)if(a.k.charCodeAt(e)!==t.charCodeAt(n+e))continue outer;return a.id}}else e.set(o,s=[]);let c=t.slice(n,r),l=a(c);return s.push({k:c,imp:i,id:l}),l},Te=new Map,Ee=new Map,De=2,Oe=4096,ke=(e,t)=>{let n=[],r=0,i=0,a=0;for(let t=0;t<e.length;t++){let o=e.charCodeAt(t);r===0&&i===0&&o===58?(n.push(e.slice(a,t)),a=t+1):o===91?r++:o===93?r--:o===40?i++:o===41&&i--}n.push(e.slice(a));let o=n[0];if(n.length>1){let e=[],t=[];for(let r of n)r.charCodeAt(0)===91||Ce.has(r)?(t.length&&(e.push(...t.sort()),t=[]),e.push(r)):t.push(r);t.length&&e.push(...t.sort()),o=e.join(`:`)}let s=t?o+` !`:o,c=Ee.get(s);return c===void 0&&Ee.set(s,c=De++),c},Ae=new Map,je=r,Me=r+4096,Ne=()=>je++,Pe=2097152,Fe=8192,Ie=new Int32Array(Fe),Le=Array(Fe).fill(null),Re=new Int32Array(Fe),ze=new Int32Array(Fe),Be=new Uint8Array(Fe),Ve=0,He=(e,t,n,r,i,a,o,s)=>{let c=e;if(Le[e]!==null){if(Le[e|1]===null)c=e|1;else if(!(Ve++&3))c=e|Ve>>2&1;else return}Le[c]=t.slice(n,r),Ie[c]=i,Re[c]=a,ze[c]=o,Be[c]=s},Ue=()=>Le.fill(null),We=256,Ge=[new Int32Array(We),new Int32Array(We),new Int32Array(We),new Int32Array(We)],[Ke,qe,Je,Ye]=Ge,Xe=new Uint8Array(We),Ze=new Uint8Array(We),Qe=()=>{We*=2,Ge=Ge.map(e=>{let t=new Int32Array(We);return t.set(e),t}),[Ke,qe,Je,Ye]=Ge;let e=new Uint8Array(We);e.set(Xe),Xe=e,Ze=new Uint8Array(We)},$e=64,et=new Int32Array($e),tt=new Int32Array($e),H=new Int32Array(r),nt=2048,rt=21,it=new Float64Array(nt),at=new Int32Array(nt),ot=0,st=(e,t)=>{if(e===0&&t<r)return H[t]===ot?1:(H[t]=ot,0);let n=e*2097152+t+1,i=Math.imul(n,2654435761)>>>rt;for(;at[i]===ot;){if(it[i]===n)return 1;i=i+1&nt-1}return it[i]=n,at[i]=ot,0},ct=(e,t,n,r,i)=>{if(n-t>=2&&e.charCodeAt(t)===91&&e.charCodeAt(n-1)===93){let r=-1;for(let i=t+1;i<n-1;i++)if(e.charCodeAt(i)===58){r=i;break}return r===-1||r===t+1?Gy:we(Ae,e,t+1,r,0,Ne)}if(r>=0&&c[r]>=0)return c[r];for(let t=i-1;t>=0;t--){let r=tt[t];if(r>n)continue;let i=et[t],a=n-r;if(N[i]===1&&a>0&&a<=P){let t=e.charCodeAt(r);if(F===!1||t!==91&&t!==40){let t=R(i,e,r,n);if(t>=0)return t}}let o=l[i];if(o<0)continue;let s=f[o],c=u[s],m=u[s+1];if(c===m)continue;pe(e,r,n);let h=A[o]-c;for(let t=c;t<m;t++)if(Se(d[t],e,r,n))return p[h+t]}return Gy},lt=e=>{let t=e.length,n=0,c=0,u=!1;(De>Oe||Te.size>Oe)&&(Te=new Map,Ee=new Map,De=2,Ue()),je>Me&&(Ae=new Map,je=r,Ue());let d=0;for(;d<t;){let f=e.charCodeAt(d);if(f===32||f>=9&&f<=13||f>=160&&fe(f)){f!==32&&(u=!0),d++;continue}let p=d,m=0;for(;d<t;){if(f=e.charCodeAt(d),f<=32){if(f===32)break;if(f>=9&&f<=13){u=!0;break}}else if(f>=160&&fe(f)){u=!0;break}m=Math.imul(m^f,16777619),d++}let h=d,g=h-p;n===We&&Qe();let _=n++;Ke[_]=p,qe[_]=h,c+=g,m^=Math.imul(g,2654435761);let v=m^m>>>15|0,y=v&8190;{let t=-1;if(Ie[y]===v&&Le[y]!==null&&Le[y].length===g?t=y:Ie[y|1]===v&&Le[y|1]!==null&&Le[y|1].length===g&&(t=y|1),t>=0){let n=Le[t],r=!0;for(let t=0;t<g;t++)if(n.charCodeAt(t)!==e.charCodeAt(p+t)){r=!1;break}if(r){Je[_]=Re[t],Ye[_]=ze[t],Xe[_]=Be[t];continue}}}let b=p;if(ne!==0){if(h-p<=ne||!e.startsWith(te,p)){Je[_]=Gy,He(y,e,p,h,v,Gy,0,0);continue}b=p+ne}let x=0,S=0,C=-1,w=-1;for(let t=b;t<h;t++){let n=e.charCodeAt(t);if(x===0&&S===0){if(n===58){C=t;continue}if(n===47){w=t;continue}}n===91?x++:n===93?x--:n===40?S++:n===41&&S--}let T=C>=b?C+1:b,E=T,D=h,O=!1,k=0;D>E&&e.charCodeAt(D-1)===33?(O=!0,D--):D>E&&e.charCodeAt(E)===33&&(O=!0,E++,k=1);let A=-1;w>T&&(A=w+k,A>=D&&(A=-1));let M=E;D-E>1&&e.charCodeAt(E)===45&&(M=E+1);let P=0,F=0,I=0,L=-1,R=0;(l[0]>=0||N[0]===1)&&(et[0]=0,tt[0]=M,R=1);let z=Ky,ee=0;for(let t=M;t<D;t++)if(t===A&&(z=F<I?Ky:P,ee=R),P!==Ky){let n=e.charCodeAt(t),r=-1;if(F<I)o.charCodeAt(F)===n?(F++,F===I&&(r=P=L)):P=Ky;else{let e=i[P],t=i[P+1],c=Ky;for(let i=e;i<t;i++){let e=a[i];if(o.charCodeAt(e)===n){a[i+1]-e===1?r=c=s[i]:(F=e+1,I=a[i+1],L=s[i],c=P);break}}P=c}if(r>=0&&(l[r]>=0||N[r]===1)&&t+1<D&&e.charCodeAt(t+1)===45){if(R===$e){$e*=2;let e=new Int32Array($e);e.set(et),et=e;let t=new Int32Array($e);t.set(tt),tt=t}et[R]=r,tt[R]=t+2,R++}}A===D&&(z=F<I?Ky:P,ee=R);let re=F<I?Ky:P,ie,B=!1;if(A>=0){if(B=!0,ie=ct(e,E,A,z,ee),ie!==Gy&&ie<r&&j[ie]){let t=ct(e,E,D,re,R);t!==Gy&&t!==ie&&(ie=t,B=!1)}else ie===Gy&&(ie=ct(e,E,D,re,R),B=!1)}else ie=ct(e,E,D,re,R);let ae=0,oe=0;ie===Gy?Je[_]=Gy:(oe=+!!B,ae=b>=C?+!!O:we(Te,e,b,C,+!!O,e=>ke(e,O)),Je[_]=ie,Xe[_]=oe,Ye[_]=ae),He(y,e,p,h,v,ie,ae,oe)}if(n===0)return``;if(n===1)return Ke[0]===0&&qe[0]===t?e:e.slice(Ke[0],qe[0]);if(n*k>nt){for(;n*k>nt;)nt<<=1,rt--;it=new Float64Array(nt),at=new Int32Array(nt)}if(De>=Pe||je>=Pe)throw Error(`cn: too many distinct classes in one merge`);ot=ot+1|0,ot===0&&(H.fill(0),at.fill(0),ot=1);let f=!1;for(let e=n-1;e>=0;e--){let t=Je[e];if(t===Gy){Ze[e]=1;continue}let n=Ye[e];if(st(n,t)===1){Ze[e]=0,f=!0;continue}if(Ze[e]=1,t<r){let r=D[t];if(r>=0)for(let e=b[r];e<b[r+1];e++)st(n,x[e]);if(Xe[e]&1)for(let e=0;e<S.length;e++)S[e]===t&&st(n,C[e])}}if(!f&&!u&&t===c+n-1)return e;let p=``,m=0;for(;m<n;){if(!Ze[m]){m++;continue}let t=Ke[m],r=qe[m],i=m+1;for(;i<n&&Ze[i]&&Ke[i]===r+1&&e.charCodeAt(r)===32;)r=qe[i],i++;p.length>0&&(p+=` `),p+=e.slice(t,r),m=i}return p},ut=16384,dt=new Int32Array(ut*2),ft=0,pt=1,mt=Object.create(null),ht=Object.create(null),gt=new Map,_t=new Map,vt=0,yt=0,bt=()=>{ft^=ut,pt=pt+1|0,yt=0},xt=e=>{let t=mt[e];if(t!==void 0)return t;let n=Jy(e,0,e.length),r=(n&16383)+ft,i=dt[r]===(n^pt)||dt[r^ut]===(n^pt-1);return i&&(t=ht[e],t!==void 0)?(mt[e]=t,t):(t=lt(e),i?(mt[e]=t,++vt>z&&(vt=0,ht=mt,mt=Object.create(null),bt())):(dt[r]=n^pt,++yt>ut&&bt()),t)},St=e=>{let t=gt.get(e);if(t!==void 0)return t;let n=Jy(e,0,e.length),r=(n&16383)+ft,i=dt[r]===(n^pt)||dt[r^ut]===(n^pt-1);return i&&(t=_t.get(e),t!==void 0)?(gt.set(e,t),t):(t=lt(e),i?(gt.set(e,t),++vt>z&&(vt=0,_t=gt,gt=new Map,bt())):(dt[r]=n^pt,++yt>ut&&bt()),t)},Ct=e=>{let t=Jy(e,0,e.length),n=(t&16383)+ft;return dt[n]===(t^pt)||dt[n^ut]===(t^pt-1)||(dt[n]=t^pt,++yt>ut&&bt(),!1)},wt=z===0?lt:Wy?e=>{let t=gt.get(e);return t===void 0?St(e):t}:xt;return{merge:function(){return arguments.length===1&&typeof arguments[0]==`string`?wt(arguments[0]):wt(Qy.apply(null,arguments))},mergeString:wt,seenBefore:z===0?()=>!1:Ct,mergeUncached:lt}},Xy=(e,t)=>{if(!e)return``;if(typeof e==`string`)return e;let n=``;if(typeof e.length==`number`&&(!t||Array.isArray(e))){let r=e;for(let e=0;e<r.length;e++){let i=r[e];if(!i)continue;let a=typeof i==`string`?i:Xy(i,t);a&&(n&&(n+=` `),n+=a)}return n}if(t){if(typeof e==`number`)return``+e;if(typeof e==`object`)for(let t in e)e[t]&&(n&&(n+=` `),n+=t)}return n},Zy=(e,t)=>{let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(!i)continue;let a=typeof i==`string`?i:Xy(i,t);a&&(n&&(n+=` `),n+=a)}return n},Qy=function(){return Zy(arguments,!1)},$y=256,eb=16,tb=1024,nb=4096,rb=(e,t)=>{let n=t===void 0?()=>!0:t.seenBefore,r=t===void 0?e:t.mergeUncached,i=new Map,a=new Map,o=0,s=null,c=null,l=[],u=[],d=0,f=(t,n,r)=>{c===null&&(c=Array(nb).fill(``),l=Array(nb).fill(``),u=Array(nb).fill(``));let i=Jy(t,0,t.length)&4094;if(c[i]===t&&l[i]===n)return u[i];if(c[i|1]===t&&l[i|1]===n)return u[i|1];let a=e(r?n+` `+t:t),o=c[i]===``?i:i|(c[i|1]===``?1:d++&1);return c[o]=t,l[o]=n,u[o]=a,a},p=(e,t,n,r)=>{let i=0;if(t){if(t!==e.a0)return!1;i=1}if(n){if(n!==(i===0?e.a0:e.a1))return!1;i++}if(r){if(r!==(i===0?e.a0:i===1?e.a1:e.a2))return!1;i++}return i===e.t},m=(e,t)=>{let n=e.a,r=0;for(let e=0;e<t.length;e++){let i=t[e];if(i){if(i!==n[r])return!1;r++}}return r===e.t},h=(t,c)=>{let l=t.length,u=s===null?null:s.n;if(!c){if(u!==null&&m(u,t))return s=u,u.r;if(s!==null&&s!==u&&m(s,t))return s.r}let d=``,p=-1,h=0,g=!1;for(let e=0;e<l;e++){let n=t[e];if(n){if(typeof n!=`string`){if(n=t[e]=Xy(n,!0),!n)continue;g=!0}p<0&&(d=n,p=e),h++}}if(h===0)return``;if(h===1)return e(d);if(g){if(u!==null&&m(u,t))return s=u,u.r;if(s!==null&&s!==u&&m(s,t))return s.r}let _=i.get(d);_===void 0&&(_=a.get(d),_!==void 0&&i.set(d,_));let v=null;if(_!==void 0){if(_.skip>0){_.skip--,s=null;let e=d;for(let n=p+1;n<l;n++){let r=t[n];r&&(e+=` `+r)}return f(e,``,!1)}let e=_.e;outer:for(let n=0;n<e.length;n++){let r=e[n];if(r.t!==h)continue;let i=r.a,a=1;for(let e=p+1;e<l;e++){let n=t[e];if(n&&n!==i[a++])continue outer}v=r;break}v!==null&&(_.miss=0)}if(v===null){let s=d,c=[d];for(let e=p+1;e<l;e++){let n=t[e];n&&(s+=` `+n,c.push(n))}if(!n(s))return r(s);v={r:e(s),t:c.length,a0:c[0],a1:c[1],a2:c[2]??``,a:c,n:null},_===void 0?i.set(d,_={e:[],miss:0,skip:0,at:0}):++_.miss>eb&&(_.miss=eb,_.skip=tb,_.e.length=0,_.at=0);let u=_.e;u.length<$y?u.push(v):(u[_.at]=v,_.at=_.at+1&255),++o>1e3&&(o=0,a=i,i=new Map)}return s!==null&&s!==v&&(s.n=v),s=v,v.r},g=t=>Array.isArray(t)?h(t.slice(),!1):e(Xy(t,!0));return function(t,n,r){let a=arguments.length;if((a|1)==3){let e=s;if(e!==null){let i=e.n;if(i!==null&&p(i,t,n,r))return s=i,i.r;if(e!==i&&p(e,t,n,r))return e.r}if(a===2&&typeof n==`string`&&n!==``){let e=i.get(t);if(e!==void 0&&e.skip>0)return e.skip--,s=null,f(n,t,!0)}return h([t,n,r],!0)}if(a===1)return typeof t==`string`?e(t):g(t);let o=s;if(o!==null){let e=o.n;if(e!==null){let t=e.a,n=0,r=!0;for(let e=0;e<a;e++){let i=arguments[e];if(i){if(i!==t[n]){r=!1;break}n++}}if(r&&n===e.t)return s=e,e.r}if(o!==e){let e=o.a,t=0,n=!0;for(let r=0;r<a;r++){let i=arguments[r];if(i){if(i!==e[t]){n=!1;break}t++}}if(n&&t===o.t)return o.r}}let c=[];for(let e=0;e<a;e++)c.push(arguments[e]);return h(c,!0)}},ib=Yy(Uy),ab=rb(ib.mergeString,ib);ib.merge;var ob=D.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=Fv({disabled:i,focusableWhenDisabled:a,native:o});return vh(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})});function sb(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=sb(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function cb(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=sb(e))&&(r&&(r+=` `),r+=t);return r}var lb=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,ub=cb,db=(e,t)=>n=>{if(t?.variants==null)return ub(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=lb(t)||lb(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return ub(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},fb=db(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function pb({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,H.jsx)(ob,{"data-slot":`button`,className:ab(fb({variant:t,size:n,className:e})),...r})}function mb({...e}){return(0,H.jsx)(kv,{"data-slot":`alert-dialog`,...e})}function hb({...e}){return(0,H.jsx)(sy,{"data-slot":`alert-dialog-portal`,...e})}function gb({className:e,...t}){return(0,H.jsx)(Av,{"data-slot":`alert-dialog-overlay`,className:ab(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function _b({className:e,size:t=`default`,...n}){return(0,H.jsxs)(hb,{children:[(0,H.jsx)(gb,{}),(0,H.jsx)(iy,{"data-slot":`alert-dialog-content`,"data-size":t,className:ab(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function vb({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:ab(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function yb({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:ab(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function bb({className:e,...t}){return(0,H.jsx)(cy,{"data-slot":`alert-dialog-title`,className:ab(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function xb({className:e,...t}){return(0,H.jsx)(Bv,{"data-slot":`alert-dialog-description`,className:ab(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Sb({className:e,...t}){return(0,H.jsx)(pb,{"data-slot":`alert-dialog-action`,className:ab(e),...t})}function Cb({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,H.jsx)(Rv,{"data-slot":`alert-dialog-cancel`,className:ab(e),render:(0,H.jsx)(pb,{variant:t,size:n}),...r})}var wb=D.createContext(void 0);function Tb(e){let t=D.useContext(wb);if(t===void 0&&!e)throw Error(Ym(47));return t}var Eb={...tv,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},Db=class extends E_{constructor(e,t,n){let r=new J_;super(Ob(e,r,t,n),kb(r),Eb)}setOpen=(e,t)=>{let n=t.reason===Xf,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=H_(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=V_(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),kh.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function Ob(e,t,n,r=!1){let i={...Y_(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function kb(e){return{popupRef:D.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:D.createRef(),beforeContentFocusGuardRef:D.createRef(),stickIfOpenTimeout:new Vd,triggerElements:e}}var Ab=h_(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Mb(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),q_(u,d),W_(u);let{forceUnmount:m}=G_(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o}),D.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),D.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,np(tp))}),[m,u]);let h=d||f;return(0,H.jsxs)(wb.Provider,{value:u,children:[s&&(0,H.jsx)(R_,{handle:s,store:u}),h&&(0,H.jsx)(Nb,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function jb(e){return Tb(!0)?(0,H.jsx)(Ab,{props:e}):(0,H.jsx)(Uh,{children:(0,H.jsx)(Ab,{props:e})})}function Mb(e,t){let n=L_((e,n)=>new Db(t,e,n));return D.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function Nb({store:e,modal:t}){let n=rg(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return K_(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}function Pb(e,t){let n=D.useRef(null);function r(t){kh.flushSync(()=>{e.setOpen(!1,np($f,t.nativeEvent,t.currentTarget))}),Cm(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&wm(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{kh.flushSync(()=>{e.setOpen(!1,np($f,n.nativeEvent,n.currentTarget))});let i=Sm(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&ff(r,i);){let e=i;if(i=ym(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}var Fb=g_(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=Tb(!0),h=nv(s)??m;if(!h)throw Error(Ym(74));let g=zv(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=D.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=U_(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`openChangeReason`),T=h.useState(`stickIfOpen`),E=h.useState(`openMethod`),O=h.useState(`focusManagerModal`),k=fv(v,{enabled:!a&&l&&(E!==`touch`||w!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:bv(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),A=eg(v,{stickIfOpen:T}),j=dy(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),M=h.useState(`triggerProps`,C),{getButtonProps:N,buttonRef:P}=Fv({disabled:a,native:o}),F={open(e){return e&&w===`trigger-press`?Mf.open(e):jf.open(e)}},{preFocusGuardRef:I,handlePreFocusGuardFocus:L,handleFocusTargetFocus:R}=Pb(h,x),z=vh(`button`,e,{state:{disabled:a,open:y},ref:[P,t,S,x],props:[A.reference,k,M,j,{[Eh]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,N],stateAttributesMapping:F}),ee=(0,H.jsx)(D.Fragment,{children:z},g);return C&&!O?(0,H.jsxs)(D.Fragment,{children:[(0,H.jsx)(xp,{ref:I,onFocus:L}),ee,(0,H.jsx)(xp,{ref:h.context.triggerFocusTargetRef,onFocus:R})]}):ee}),Ib=D.createContext(void 0);function Lb(){let e=D.useContext(Ib);if(e===void 0)throw Error(Ym(45));return e}var Rb=D.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Tb().useState(`mounted`)||n?(0,H.jsx)(Ib.Provider,{value:n,children:(0,H.jsx)(Ph,{ref:t,...r})}):null}),zb=D.createContext(void 0);function Bb(){let e=D.useContext(zb);if(!e)throw Error(Ym(46));return e}var Vb=D.createContext(void 0);function Hb(){return D.useContext(Vb)?.direction??`ltr`}var Ub=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=kp(e,t)||{};if(l==null)return{};let f=qp(u),p={x:n,y:r},m=Fp(i),h=Np(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=Op(k,j,A),N=!c.arrow&&jp(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),Wb=(e,t)=>{let{name:n,fn:r}=Ub(e);return{name:n,fn:r,options:[e,t]}},Gb={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},Kb={sideX:`left`,sideY:`top`},qb=`--available-width`,Jb=`--available-height`,Yb=`--anchor-width`,Xb=`--anchor-height`,Zb=`--transform-origin`,Qb=qb,$b=Jb;function ex(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function tx(e,t,n){let{rects:r,placement:i}=e;return{side:ex(t,Ap(i),n),align:jp(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function nx(e){return rx(e,rv)}function rx(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=D.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,O=_.fallbackAxisSide||`end`,k=v?.crossAxis??!1,A=v?.rootBoundary,j=typeof n==`function`?n:void 0,M=hp(j),N=j?M:n,P=up(n),F=up(g),I=Hb()===`rtl`,L=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":I?`left`:`right`,"inline-start":I?`right`:`left`}[i],R=o===`center`?L:`${L}-${o}`,z=l;typeof z==`number`?z={top:z,right:z,bottom:z,left:z}:z&&={top:z.top||0,right:z.right||0,bottom:z.bottom||0,left:z.left||0};let ee=+(i===`bottom`),te=+(i===`top`),ne=+(i===`right`),re=+(i===`left`),ie={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:z},B=D.useRef(null),ae=up(a),oe=up(s),se=typeof a==`function`?0:a,ce=typeof s==`function`?0:s,le=[];p&&le.push(p),le.push(n_(e=>{let t=tx(e,i,I),n=typeof ae.current==`function`?ae.current(t):ae.current,r=typeof oe.current==`function`?oe.current(t):oe.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[se,ce,I,i]));let V=E===`none`&&T!==`shift`,ue=!V&&(u||k||T===`shift`),de=T===`none`?null:a_({...ie,padding:{top:z.top+1+ee,right:z.right+1+re,bottom:z.bottom+1+te,left:z.left+1+ne},mainAxis:!k&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:O}),fe=V?null:r_({...ie,rootBoundary:A,mainAxis:E!==`none`,crossAxis:ue,limiter:u||k?void 0:i_(e=>{if(!B.current)return{};let{width:t,height:n}=B.current.getBoundingClientRect(),r=Pp(Ap(e.placement)),i=r===`y`?t:n,a=r===`y`?z.left+z.right:z.top+z.bottom;return{offset:i/2+a/2}})},[ie,u,k,A,z,E]);T===`shift`||E===`shift`||o===`center`?le.push(fe,de):le.push(de,fe),le.push(o_({...ie,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!F.current)return;let i=e.style;i.setProperty(Qb,`${t}px`),i.setProperty($b,`${n}px`);let a=Zu(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(Yb,`${u}px`),i.setProperty(Xb,`${d}px`)}}),Wb(e=>({element:B.current||Nd(e.elements.floating).createElement(`div`),padding:B.current?d:0,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=Ap(r),u=jp(r),d=Pp(l)===`y`,f=B.current,p=typeof a==`function`?a(tx(e,i,I)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return ue&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(Zb,d?`${m} ${h}`:`${h} ${m}`),{}}},Gb,b),J(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let pe=D.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:me,elements:he,x:ge,y:_e,middlewareData:ve,update:ye,placement:be,context:xe,isPositioned:Se,floatingStyles:Ce}=t({rootContext:h,open:m?g:void 0,placement:R,middleware:le,strategy:r,whileElementsMounted:m?void 0:(...e)=>Ug(...e,pe),nodeId:y,externalTree:S}),{sideX:we,sideY:Te}=ve.adaptiveOrigin||Kb,Ee=Se?r:`fixed`,De=D.useMemo(()=>{let e;return e=Se?b?{position:Ee,[we]:ge,[Te]:_e}:{...Ce,position:Ee}:{position:Ee,top:0,left:0},e[Qb]=`100vw`,e[$b]=`100vh`,Se||(e.opacity=0),e},[b,Ee,we,ge,Te,_e,Ce,Se]),Oe=D.useRef(null);J(()=>{if(!g)return;let e=P.current,t=typeof e==`function`?e():e,n=(ix(t)?t.current:t)||null;n!==Oe.current&&(me.setPositionReference(n),Oe.current=n)},[g,me,N,P]),D.useEffect(()=>{if(!g)return;let e=P.current;typeof e!=`function`&&ix(e)&&e.current!==Oe.current&&(me.setPositionReference(e.current),Oe.current=e.current)},[g,me,N,P]),D.useEffect(()=>{if(m&&g&&he.reference&&he.floating)return Ug(he.reference,he.floating,ye,pe)},[m,g,he,ye,pe]);let ke=Ap(be),Ae=ex(i,ke,I),je=jp(be)||`center`,Me=!!ve.hide?.referenceHidden;J(()=>{x&&g&&Se&&ke!==L&&w(ke)},[x,g,Se,ke,L]);let Ne=D.useMemo(()=>({position:`absolute`,top:ve.arrow?.y,left:ve.arrow?.x}),[ve.arrow]),Pe=ve.arrow?.centerOffset!==0;return D.useMemo(()=>({positionerStyles:De,arrowStyles:Ne,arrowRef:B,arrowUncentered:Pe,side:Ae,align:je,physicalSide:ke,anchorHidden:Me,refs:me,context:xe,isPositioned:Se,update:ye}),[De,Ne,B,Pe,Ae,je,ke,Me,me,xe,Se,ye])}function ix(e){return e!=null&&`current`in e}function ax(e){return e===`starting`?Th:Rd}function ox(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),vh(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},ax(r),i],stateAttributesMapping:Nf})}var sx=20;function cx(e,t,n,r){let[i,a]=D.useState(!1);J(()=>{if(!e||!t||n==null){a(!1);return}let r=Nd(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-sx)},[e,t,n]),rf(e&&(!t||i),r)}var lx=D.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=Dh,..._}=e,v=Tb(),y=Lb(),b=Vh(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),O=v.useState(`openMethod`),k=v.useState(`positionerElement`),A=v.useState(`instantType`),j=v.useState(`transitionStatus`),M=v.useState(`adaptiveOrigin`),N=D.useRef(null),P=N_(k),F=nx({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:M}),I=x.useState(`domReferenceElement`);J(()=>{let e=I,t=N.current;if(e&&(N.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return P(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,P,v]);let L=E===!0&&w!==`trigger-hover`;cx(C&&L,O===`touch`,k,T);let R=v.useStateSetter(`positionerElement`),z=ox(e,{open:C,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:A},{styles:F.positionerStyles,transitionStatus:j,props:_,refs:[t,R],hidden:!S,inert:!C});return(0,H.jsxs)(zb.Provider,{value:F,children:[S&&L&&(0,H.jsx)(oy,{inert:ay(!C),cutout:T}),(0,H.jsx)(Hh,{id:b,children:z})]})}),ux=D.createContext(void 0);function dx(e){let t=D.useContext(ux);if(t===void 0&&!e)throw Error(Ym(69));return t}var fx=D.createContext(void 0);function px(){let[e,t]=D.useState(0),n=hp(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:D.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function mx(){let e=D.useContext(fx);J(()=>e?.register(),[e])}var hx=D.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=Tb(),l=Bb(),u=dx(!0)!=null,{context:d,hasClosePart:f}=px(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);P_({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),uv(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?I_(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=vh(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...F_,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&qv.has(e.key)&&e.stopPropagation()}},ax(g),s],stateAttributesMapping:Pf});return(0,H.jsx)($h,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:X(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,H.jsx)(fx.Provider,{value:d,children:M})})}),gx=D.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Tb(),s=zv(a.id);return o.useSyncedValueWithCleanup(`titleElementId`,s),vh(`h2`,e,{ref:t,props:[{id:s},a]})}),_x=D.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,{buttonRef:c,getButtonProps:l}=Fv({disabled:a,focusableWhenDisabled:!1,native:o}),u=Tb();return mx(),vh(`button`,e,{ref:[t,c],props:[{onClick(e){u.setOpen(!1,np(Qf,e.nativeEvent))}},s,l]})});function vx({trigger:e,title:t,children:n,enabled:r=!0}){let[i,a]=(0,D.useState)(!1);return!r&&i&&a(!1),(0,H.jsxs)(jb,{open:r&&i,onOpenChange:e=>a(r&&e),children:[(0,H.jsx)(Fb,{render:e,"aria-haspopup":r?`dialog`:!1,"aria-expanded":r?i:void 0}),(0,H.jsx)(Rb,{children:(0,H.jsx)(lx,{sideOffset:6,align:`end`,className:`z-50`,children:(0,H.jsxs)(hx,{className:`max-h-(--available-height) w-96 max-w-[calc(100vw-1rem)] overflow-y-auto rounded-lg border bg-popover p-4 text-sm text-popover-foreground shadow-lg outline-none`,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,H.jsx)(gx,{className:`font-medium`,children:t}),(0,H.jsx)(_x,{render:(0,H.jsx)(pb,{variant:`ghost`,size:`icon-xs`,"aria-label":`Close details`}),children:(0,H.jsx)(ze,{"aria-hidden":`true`})})]}),(0,H.jsx)(`div`,{className:`flex flex-col gap-3 break-words`,children:n})]})})})]})}function yx({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=D.useRef(e!==void 0),[a,o]=D.useState(t);return[i&&e!==void 0?e:a,D.useCallback(e=>{i||o(e)},[])]}function bx(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var xx=`data-valid`,Sx=`data-invalid`,Cx={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},wx={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Tx={valid(e){return e===null?null:e?{[xx]:``}:{[Sx]:``}}},Ex=`data-checked`,Dx=`data-unchecked`;function Ox(e){return{checked(t){return e.indeterminate?{}:t?{[Ex]:``}:{[Dx]:``}},...Tx}}var kx={invalid:void 0,name:void 0,validityData:{state:Cx,errors:[],error:``,value:``,initialValue:null},setValidityData:Id,disabled:void 0,setTouched:Id,setDirty:Id,setFilled:Id,setFocused:Id,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:wx,registerFieldControl:Id,validation:{getValidationProps:(e,t=Rd)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:Id,getInputControl:()=>null,commit:async()=>{},change:Id}},Ax=D.createContext(kx);function jx(e=!0){let t=D.useContext(Ax);if(t.setValidityData===Id&&!e)throw Error(Ym(28));return t}function Mx(e,t,n,r,i=!0,a){let{registerFieldControl:o}=jx(),s=Fd(()=>Symbol());J(()=>{let c=s.current;if(!i){o(c,void 0);return}o(c,{controlRef:e,getValue:r,id:t,name:a,value:n})},[e,i,r,t,a,o,s,n]),J(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}var Nx=D.createContext({disabled:!1});function Px(){return D.useContext(Nx)}var Fx=D.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:Id,validationMode:`onSubmit`,submitCountRef:{current:0}});function Ix(){return D.useContext(Fx)}var Lx=D.createContext({controlId:void 0,registerControlId:Id,resetControlId:Id,labelId:void 0,setLabelId:Id,messageIds:[],setMessageIds:Id,getDescriptionProps:e=>e});function Rx(){return D.useContext(Lx)}function zx(e,t,n,r=!0,i){let[a,o]=D.useState(),s=zv(i?`${i}-label`:void 0),c=e??t??a;return J(()=>{let i=e||t||!r?void 0:Bx(n.current,s);a!==i&&o(i)}),c}function Bx(e,t){let n=Vx(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Vx(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function Hx(e={}){let{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:i,resetControlId:a}=Rx(),o=zv(),s=Fd(()=>Symbol()),c=D.useRef(!1),l=D.useRef(!1),u=hp(()=>{c.current&&i!==Id&&(c.current=!1,i(s.current,void 0))});return J(()=>{if(!n||i===Id){u();return}let e;if(t!==void 0)l.current=!0,e=t;else if(l.current)e=o;else{a();return}if(e===void 0){u();return}c.current=!0,i(s.current,e)},[t,n,i,a,o,s,u]),J(()=>u,[u]),(n?r:void 0)??t??o}var Ux=D.createContext(void 0);function Wx(){return D.useContext(Ux)}var Gx=D.createContext(void 0);function Kx(){let e=D.useContext(Gx);if(e===void 0)throw Error(Ym(14));return e}var qx=`data-parent`,Jx=D.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":a,disabled:o=!1,form:s,id:c,indeterminate:l=!1,inputRef:u,name:d,onCheckedChange:f,parent:p=!1,readOnly:m=!1,render:h,required:g=!1,uncheckedValue:_,value:v,nativeButton:y=!1,style:b,...x}=e,{clearErrors:S}=Ix(),{disabled:C,name:w,setDirty:T,setFilled:E,setFocused:O,setTouched:k,state:A,validationMode:j,validityData:M,validation:N}=jx(),P=Px(),{labelId:F,registerControlId:I,getDescriptionProps:L}=Rx(),R=Wx(),z=R?.allValues===void 0?void 0:R.parent,ee=z!==void 0,te=C||P.disabled||R?.disabled||o,ne=w??d,re=v??ne,ie=zv(),B=R?.registerControlId!==I,ae=Hx({id:c||void 0,enabled:B}),oe=y?ae:ie,se={};ee&&(p?se=z.getParentProps():re!==void 0&&(se=z.getChildProps(re)));let{checked:ce=n,indeterminate:le=l,onCheckedChange:V,...ue}=se,de=R?.value,fe=D.useRef(null),{getButtonProps:pe,buttonRef:me}=Fv({disabled:te,native:y}),he=R?.validation??N,[ge,_e]=yx({controlled:re!==void 0&&de!==void 0&&!p?de.includes(re):ce,default:i,name:`Checkbox`,state:`checked`}),ve=ee?!!ce:ge,ye=ee&&le||l;Mx(fe,ie,ge,void 0,!R&&!te,d);let be=z?.registerChildId,xe=D.useRef(null),Se=he.registerInput,Ce=R?re:void 0,we=D.useCallback(e=>Se(e,{controlRef:fe,value:Ce}),[Se,Ce]),Te=ip(u,xe,p?void 0:we),Ee=zx(a,F,xe,!y,ae);J(()=>{xe.current&&(xe.current.indeterminate=ye),R||E(ge)},[ge,ye,R,E]),uy(ge,()=>{R||(S(ne),T(ge!==M.initialValue),he.change(ge))});let De=ih({checked:ge,disabled:te,form:s,name:p?void 0:ne,id:y?void 0:ae,required:g,ref:Te,style:ne?bp:yp,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(m){e.preventDefault();return}let t=e.currentTarget.checked,n=np(Jf,e.nativeEvent);if(f?.(t,n),!n.isCanceled&&(V?.(t,n),!n.isCanceled&&(_e(t),re!==void 0&&R!==void 0&&!p&&!ee))){let e=t?[...R.value,re]:R.value.filter(e=>e!==re);R.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){fe.current?.focus()}},v===void 0?Rd:{value:(R?ge&&v:v)||``},L,e=>he.getValidationProps(te,e));D.useEffect(()=>{if(!z||re===void 0)return;let e=z.disabledStatesRef.current;return e.set(re,te),()=>{e.delete(re)}},[z,te,re]);let Oe=D.useMemo(()=>({...A,checked:ve,disabled:te,readOnly:m,required:g,indeterminate:ye}),[A,ve,te,m,g,ye]),ke=Ox(Oe),Ae=vh(`span`,e,{state:Oe,ref:[me,fe,t],props:[{id:oe,role:`checkbox`,"aria-checked":ye?`mixed`:ve,"aria-readonly":m||void 0,"aria-required":g||void 0,"aria-labelledby":Ee,[qx]:p?``:void 0,onFocus(){te||O(!0)},onBlur(){let e=xe.current;e&&(k(!0),O(!1),j===`onBlur`&&he.commit(R?de:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=xe.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),Zu(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||bx(t)?.click()})},onClick(e){if(m||te)return;e.preventDefault();let t=xe.current;t&&Pv(t,e)}},x,ue,pe,L,e=>he.getValidationProps(te,e)],stateAttributesMapping:ke}),je=Ae.props.id;return J(()=>{if(be&&!p&&re!==void 0&&je!==void 0)return be(re,je)},[be,p,re,je]),(0,H.jsxs)(Gx.Provider,{value:Oe,children:[Ae,!ge&&!R&&ne&&!p&&_!==void 0&&(0,H.jsx)(`input`,{type:`hidden`,form:s,name:ne,value:_,disabled:te}),(0,H.jsx)(`input`,{...De,suppressHydrationWarning:!0})]})}),Yx=D.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Kx(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=A_(c),f=D.useRef(null),p={...s,transitionStatus:u};P_({batch:!0,enabled:!c,open:c,ref:f,onComplete(){c||d(!1)}});let m={...Ox(s),...bf},h=a||l,g=vh(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null});function Xx({className:e,...t}){return(0,H.jsx)(Jx,{"data-slot":`checkbox`,className:ab(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary`,e),...t,children:(0,H.jsx)(Yx,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,H.jsx)(N,{})})})}var Zx=D.createContext(void 0);function Qx(e=!1){let t=D.useContext(Zx);if(!t&&!e)throw Error(Ym(86));return t}Object.keys(Cx);function $x(e,t){return e.matches(`:disabled`)?!1:!t||e.form===t||e.form===null&&!e.hasAttribute(`form`)}var eS=D.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:b,validationMode:x,validation:S}=jx(),{clearErrors:C,elementRef:w,submitCountRef:T}=Ix(),E=h||s,O=m??a,k={...p,disabled:E},{labelId:A}=Rx(),j=Hx({id:i}),[M]=yx({controlled:o,default:l,name:`FieldControl`,state:`value`}),N=o!==void 0,P=N?M:void 0,F=P==null?void 0:String(P),I=hp(()=>S.inputRef.current?.value);Mx(S.inputRef,j,F,I,!E,a),J(()=>{let e=F??S.inputRef.current?.value;e!==void 0&&b(e!==``)},[F,S.inputRef,b]),uy(F,()=>{F!==void 0&&(C(O),_(F!==(v.initialValue??``)),S.change(F))});let L=D.useRef(null),R=Hd();return J(()=>{u&&L.current===df(Nd(L.current))&&y(!0)},[u,y]),vh(`input`,e,{ref:[t,L],state:k,props:[{id:j,disabled:E,name:O,ref:S.inputRef,"aria-labelledby":A,autoFocus:u,...N?{value:P}:{defaultValue:l},onChange(e){let t=e.currentTarget.value,n=np(Jf,e.nativeEvent);c?.(t,n),!N&&(_(t!==(v.initialValue??``)),b(t!==``),!e.nativeEvent.defaultPrevented&&!n.isCanceled&&(C(O),S.change(t)))},onFocus(){y(!0)},onBlur(e){if(g(!0),y(!1),x===`onBlur`){let t=e.currentTarget.value;S.commit(t),N&&queueMicrotask(()=>{let e=S.inputRef.current?.value;e!==void 0&&e!==t&&e!==(v.initialValue??``)&&S.commit(e)})}},onKeyDown(e){if(e.currentTarget.tagName===`INPUT`&&e.key===`Enter`){g(!0);let t=e.currentTarget.value,n=e.currentTarget.form;if(n&&n===w.current&&!e.defaultPrevented){let t=e.currentTarget,n=T.current;R.start(0,()=>{T.current===n&&S.commit(t.value)})}else S.commit(t)}}},f,e=>S.getValidationProps(E,e)],stateAttributesMapping:Tx})}),tS=D.forwardRef(function(e,t){return(0,H.jsx)(eS,{ref:t,...e})});function nS({className:e,type:t,...n}){return(0,H.jsx)(tS,{type:t,"data-slot":`input`,className:ab(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function rS({className:e,...t}){return(0,H.jsx)(`label`,{"data-slot":`label`,className:ab(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var iS=`data-checked`,aS=`data-unchecked`,oS={checked(e){return e?{[iS]:``}:{[aS]:``}},...bf,...Tx},sS=`data-composite-item-active`,cS=D.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function lS(){return D.useContext(cS)}function uS(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=lS(),u=D.useRef(-1),[d,f]=D.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=D.useRef(null),h=D.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return J(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}function dS(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Mv(),{ref:i,index:a}=uS(e),o=n===a,s=D.useRef(null),c=ip(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function fS(e){let{render:t,className:n,style:r,state:i=Rd,props:a=Ld,refs:o=Ld,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=dS({metadata:s});return vh(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}var pS=D.createContext(void 0);function mS(){return D.useContext(pS)}function hS(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var gS=D.createContext(void 0);function _S(){let e=D.useContext(gS);if(e===void 0)throw Error(Ym(52));return e}var vS=D.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,readOnly:a=!1,required:o=!1,"aria-labelledby":s,value:c,inputRef:l,nativeButton:u=!1,id:d,style:f,...p}=e,m=mS(),{disabled:h,readOnly:g,required:_,form:v,checkedValue:y,touched:b=!1,validation:x,name:S,setCheckedValue:C=Id,setTouched:w=Id,registerInputRef:T=Id}=m??{},{setTouched:E,setFilled:O,state:k,disabled:A}=jx(),j=Px(),{labelId:M,getDescriptionProps:N}=Rx(),P=A||j.disabled||h||i,F=g||a,I=_||o,L=v,R=m?y===c:c===``,z=D.useRef(null),ee=D.useRef(null),te=x?.registerInput,ne=ip(l,ee,T,D.useCallback(e=>te?.(e,{controlRef:z,value:void 0}),[te]));J(()=>{ee.current?.checked&&O(!0)},[O]),J(()=>{if(ee.current){if(P&&R){T(null);return}T(ee.current)}},[R,P,T]);let re=zv(),ie=Hx({id:d}),B=u?void 0:ie,ae={role:`radio`,"aria-checked":R,"aria-labelledby":zx(s,M,ee,!u,B),[sS]:R?``:void 0,id:u?ie:re,onKeyDown(e){e.key===`Enter`&&e.preventDefault()},onClick(e){if(e.defaultPrevented||P||F)return;e.preventDefault();let t=ee.current;t&&Pv(t,e)},onFocus(e){e.defaultPrevented||P||F||!b||(ee.current?.click(),w(!1))}},{getButtonProps:oe,buttonRef:se}=Fv({disabled:P,native:u,composite:!1}),ce={type:`radio`,ref:ne,form:L,id:B,name:S,tabIndex:-1,style:S?bp:yp,"aria-hidden":!0,...c===void 0?Rd:{value:hS(c)},disabled:P,checked:R,required:I,readOnly:F,onChange(e){if(e.nativeEvent.defaultPrevented||P||F||c===void 0)return;let t=np(Jf,e.nativeEvent);C(c,t),!t.isCanceled&&E(!0)},onClick(e){e.stopPropagation()},onFocus(){z.current?.focus()}},le=D.useMemo(()=>({...k,required:I,disabled:P,readOnly:F,checked:R}),[k,P,F,R,I]),V=le,ue=m!==void 0,de=[t,z,se],fe=[ae,p,oe,N,x?e=>x.getValidationProps(P,e):Rd],pe=vh(`span`,e,{enabled:!ue,state:le,ref:de,props:fe,stateAttributesMapping:oS});return(0,H.jsxs)(gS.Provider,{value:V,children:[ue?(0,H.jsx)(fS,{tag:`span`,render:n,className:r,style:f,state:le,refs:de,props:fe,stateAttributesMapping:oS}):pe,(0,H.jsx)(`input`,{...ce,suppressHydrationWarning:!0})]})}),yS=D.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=_S(),c=s.checked,{mounted:l,transitionStatus:u,setMounted:d}=A_(c),f={...s,transitionStatus:u},p=D.useRef(null),m=a||l,h=vh(`span`,e,{ref:[t,p],state:f,props:o,stateAttributesMapping:oS});return P_({batch:!0,enabled:!c,open:c,ref:p,onComplete(){c||d(!1)}}),m?h:null});function bS(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=hp(i),[,o]=D.useState(!1),s=Fd(SS).current,c=Fd(xS).current,l=D.useRef(0),u=D.useRef(!0),d=D.useRef(null),f=D.useRef(null),p=hp(()=>{u.current||(u.current=!0,o(e=>!e))}),m=hp((e,t)=>{c.set(e,t),p()}),h=hp(e=>{c.delete(e),p()}),g=hp(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!TS(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&ES(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=wS(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=hp(()=>{let[e,t]=CS(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});J(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),J(()=>{u.current&&v()}),J(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=hp(e=>(s.add(e),()=>{s.delete(e)})),b=D.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,H.jsx)(cS.Provider,{value:b,children:t})}function xS(){return new Map}function SS(){return new Set}function CS(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>ES(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function wS(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function TS(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function ES(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function DS(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function OS(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=Ld}=e,[p,m]=D.useState(0),h=r!=null,g=D.useRef(null),_=ip(g,c),v=D.useRef([]),y=D.useRef(!1),b=D.useRef(null),x=o??p,S=hp((e,t=!1)=>{if(b.current=v.current[e]??null,(s??m)(e),t){let t=v.current[e];Qv(g.current,t,a,n)}}),C=hp(e=>{if(e.size===0)return;if(y.current){let e=v.current,t=e.indexOf(b.current);if(t===-1){let t=e[x];!t||$p(e,x,d)?S(kS(e,d)):b.current=t}else t!==x&&S(t);return}y.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)S(i);else if($p(t,x,d)){let e=Qp(t,{disabledIndices:d});Yp(t,e)||S(e)}Qv(g.current,r,a,n)});J(()=>{if(d==null||o!=null||!y.current)return;let e=v.current;if($p(e,x,d)){let t=Qp(e,{disabledIndices:d});Yp(e,t)||S(t)}},[d,o,x,v,S]);let w=hp((e,t,n)=>i?i(e,t,n,v):n),T=hp(e=>{let o=e.key===`Home`||e.key===`End`;if(!qv.has(e.key)||!l&&o||AS(e,f)||!g.current)return;let s=a===`rtl`,c=s?Gv:Kv,p=s?Kv:Gv,m=n===`vertical`?Wv:c,_=n===`vertical`?Uv:p,y=pf(e.nativeEvent);if(y!=null&&Zv(y)&&!DS(y)){let t=y.selectionStart,n=y.selectionEnd,r=y.value;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==m&&t>0)return}let b=x,C=Xp(v,d),T=Zp(v,d);r!=null&&(b=r({disabledIndices:d,elementsRef:v,event:e,highlightedIndex:x,loopFocus:t,maxIndex:T,minIndex:C,onLoop:w,orientation:n,rtl:s}));let E=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,D=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?b=C:e.key===`End`&&(b=T)),b===x&&(E||D)&&(t&&b===T&&E?(b=C,i&&(b=i(e,x,b,v))):t&&b===C&&D?(b=T,i&&(b=i(e,x,b,v))):b=Qp(v.current,{startingIndex:b,decrement:D,disabledIndices:d})),b!==x&&!Yp(v.current,b)&&(u&&e.stopPropagation(),(h||o||E||D)&&e.preventDefault(),S(b,!0),queueMicrotask(()=>{v.current[b]?.focus()}))});return{props:{ref:_,onFocus(e){let t=g.current,n=pf(e.nativeEvent);t&&n!=null&&Zv(n)&&n.setSelectionRange(0,n.value.length)},onKeyDown:T},highlightedIndex:x,onHighlightedIndexChange:S,elementsRef:v,onMapChange:C,relayKeyboardEvent:T}}function kS(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!$p(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function AS(e,t){for(let n of Yv)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function jS(e){let{render:t,className:n,style:r,refs:i=Ld,props:a=Ld,state:o=Rd,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:v,modifierKeys:y,highlightItemOnHover:b=!1,tag:x=`div`,...S}=e,{props:C,highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:E,onMapChange:O,relayKeyboardEvent:k}=OS({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:Hb(),disabledIndices:v,modifierKeys:y}),A=vh(x,e,{state:o,ref:i,props:[C,...a,S],stateAttributesMapping:s}),j=D.useMemo(()=>({highlightedIndex:w,onHighlightedIndexChange:T,highlightItemOnHover:b,relayKeyboardEvent:k}),[w,T,b,k]);return(0,H.jsx)(jv.Provider,{value:j,children:(0,H.jsx)(bS,{elementsRef:E,onMapChange:e=>{h?.(e),O(e)},children:A})})}var MS=[Jv],NS=D.forwardRef(function(e,t){let{render:n,className:r,disabled:i,readOnly:a,required:o,onValueChange:s,value:c,defaultValue:l,form:u,name:d,inputRef:f,id:p,style:m,...h}=e,{setTouched:g,setFocused:_,validationMode:v,name:y,disabled:b,state:x,validation:S,setDirty:C,setFilled:w,validityData:T}=jx(),{labelId:E}=Rx(),{clearErrors:O,elementRef:k}=Ix(),A=Qx(!0),j=b||i,M=y??d,N=zv(p),[P,F]=yx({controlled:c,default:l,name:`RadioGroup`,state:`value`}),[I,L]=D.useState(!1),R=hp((e,t)=>{s?.(e,t),!t.isCanceled&&F(e)}),z=S.getInputControl,ee=D.useMemo(()=>({get current(){return z()}}),[z]),te=D.useRef(null),ne=D.useRef(null);function re(e){let t;return f&&(typeof f==`function`?t=f(e):f.current=e),te.current=e,t}let ie=hp(e=>{if(!e||e.disabled)return;ne.current||=e;let t=te.current,n=e.checked||t==null||t.disabled?re(e):void 0;return()=>{ne.current===e&&(ne.current=null),te.current===e?n?(n(),te.current=null):re(null):n?.()}}),B=hp(()=>{let e=k.current;if(!e)return P??null;for(let t of S.registeredInputs.keys())if(t.checked&&$x(t,e))return P??null;return null});Mx(ee,N,P??null,B,!j,d),uy(P,()=>{O(M),C(P!==T.initialValue),w(P!=null),S.change(P);let e=ne.current;P==null&&e&&!e.disabled&&re(e)});let ae=E??A?.legendId,oe={...x,disabled:j??!1,required:o??!1,readOnly:a??!1},se=D.useMemo(()=>({checkedValue:P,disabled:j,form:u,validation:S,name:M,readOnly:a,registerInputRef:ie,required:o,setCheckedValue:R,setTouched:L,touched:I}),[P,j,u,S,M,a,ie,o,R,L,I]),ce={id:p,role:`radiogroup`,"aria-required":o||void 0,"aria-disabled":j||void 0,"aria-readonly":a||void 0,"aria-labelledby":ae,onFocus(){_(!0)},onBlur(e){ff(e.currentTarget,e.relatedTarget)||(g(!0),_(!1),v===`onBlur`&&S.commit(P))},onKeyDownCapture(e){e.key.startsWith(`Arrow`)&&(L(!0),_(!0))}};return(0,H.jsx)(pS.Provider,{value:se,children:(0,H.jsx)(jS,{render:n,className:r,style:m,state:oe,props:[ce,h,e=>S.getValidationProps(j??!1,e)],refs:[t],stateAttributesMapping:Tx,enableHomeAndEndKeys:!1,modifierKeys:MS})})});function PS({className:e,...t}){return(0,H.jsx)(NS,{"data-slot":`radio-group`,className:ab(`grid w-full gap-2`,e),...t})}function FS({className:e,...t}){return(0,H.jsx)(vS,{"data-slot":`radio-group-item`,className:ab(`group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary`,e),...t,children:(0,H.jsx)(yS,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:(0,H.jsx)(`span`,{className:`absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground`})})})}function IS({className:e,...t}){return(0,H.jsx)(`textarea`,{"data-slot":`textarea`,className:ab(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function LS(e){let t=new TextDecoder(`utf-8`),n=``,r=``,i=[],a=null,o=()=>{i.length>0&&e({event:r===``?`message`:r,data:i.join(`
|
|
64
|
+
`),id:a}),r=``,i=[]},s=e=>{if(e===``){o();return}if(e.startsWith(`:`))return;let t=e.indexOf(`:`),n=t===-1?e:e.slice(0,t),s=t===-1?``:e.slice(t+1);s.startsWith(` `)&&(s=s.slice(1)),n===`event`?r=s:n===`data`?i.push(s):n===`id`&&(a=s)};return{push(e){for(n+=t.decode(e,{stream:!0});;){let e=/\r\n|\n|\r/.exec(n);if(!e||e[0]===`\r`&&e.index===n.length-1)break;s(n.slice(0,e.index)),n=n.slice(e.index+e[0].length)}}}}var RS=`/_/api/v1`,zS=1048576,BS=1e4,VS=class extends Error{code;status;details;constructor(e,t,n,r){super(t),this.name=`ApiError`,this.code=e,this.status=n,this.details=r}};async function HS(e){let t=await e.json();if(!e.ok||!t.ok)throw new VS(t.error?.code??`E_INTERNAL`,t.error?.message??`The operation failed.`,e.status,t.error?.details??{});return t}function US(){let e=async(e,t={})=>HS(await fetch(`${RS}${e}`,{...t,headers:t.body===void 0?{}:{"Content-Type":`application/json`}}));return{async status(){return(await e(`/status`)).data},async documents(){let t=[],n=null,r=0;do{let i=n===null?`?limit=500`:`?limit=500&cursor=${encodeURIComponent(n)}`,a=await e(`/documents${i}`);t.push(...a.data.documents),n=a.data.nextCursor,r=a.meta?.catalogVersion??r}while(n!==null);return{documents:t,catalogVersion:r}},async content(t,n){let r=``,i=null;do{let a=i===null?`?revision=${n}&maxBytes=${String(zS)}`:`?maxBytes=${String(zS)}&cursor=${encodeURIComponent(i)}`,o=await e(`/documents/${t}/content${a}`);r+=o.data.content??``,i=o.data.nextCursor}while(i!==null);return r},async outline(t,n){let r=[],i=null;do{let a=i===null?`?revision=${n}&maxBytes=${String(zS)}`:`?maxBytes=${String(zS)}&cursor=${encodeURIComponent(i)}`,o=await e(`/documents/${t}/outline${a}`);r.push(...o.data.outline??[]),i=o.data.nextCursor}while(i!==null);return r},async close(t){await e(`/documents/${t}`,{method:`DELETE`})},async reorder(t,n){return(await e(`/documents/order`,{method:`PUT`,body:JSON.stringify({order:t,expectedCatalogVersion:n})})).meta?.catalogVersion??n},async focus(t){await e(`/documents/${t}/focus`,{method:`POST`})},async refresh(t){await e(`/documents/${t}/refresh`,{method:`POST`})},async exportPdf(e,t){let n=await fetch(`${RS}/documents/${e}/pdf`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({revision:t})});return n.ok||await HS(n),n.blob()},async renderGrant(t,n,r={}){let{data:i}=await e(`/documents/${t}/render-grants`,{method:`POST`,body:JSON.stringify({revision:n,mode:r.mode??`static`})});return i},async search(t,n){let r=new URLSearchParams({query:t,limit:String(n)});return(await e(`/search?${r.toString()}`)).data},async feedbackRenderGrant(t){let{data:n}=await e(`/feedback/${t}/render-grants`,{method:`POST`,body:JSON.stringify({})});return n},async bridgeReady(t){return(await e(`/render-grants/bridge/ready`,{method:`POST`,body:JSON.stringify({grant:t})})).data},async bridgeDraft(t,n,r){return(await e(`/render-grants/bridge/draft`,{method:`PUT`,body:JSON.stringify({grant:t,expectedDraftVersion:n,answers:r})})).data},async renderMissing(t){let{data:n}=await e(`/render-grants/missing`,{method:`POST`,body:JSON.stringify({grant:t})});return n.missing},async setHtmlMode(t,n){let{data:r}=await e(`/documents/${t}/html-mode`,{method:`POST`,body:JSON.stringify({mode:n,confirmed:!0})});return r},async releaseGrants(t){await e(`/render-grants/release`,{method:`POST`,body:JSON.stringify({grants:t})})},async openLink(t,n,r,i){let{data:a}=await e(`/documents/${t}/links/${r}/open`,{method:`POST`,body:JSON.stringify({revision:n,confirmation:i})});return a},async feedback(t){return(await e(`/feedback/${t}`)).data},async saveDraft(t,n,r){return(await e(`/feedback/${t}/draft`,{method:`PUT`,body:JSON.stringify({expectedDraftVersion:n,answers:r})})).data},async submitFeedback(t,n){return(await e(`/feedback/${t}/submit`,{method:`POST`,body:JSON.stringify(n)})).data},async cancelFeedback(t){await e(`/feedback/${t}/cancel`,{method:`POST`,body:JSON.stringify({confirmed:!0})})},events({onEvent:e,onConnect:t}){let n=new AbortController,r=0;return(async()=>{for(;!n.signal.aborted;){try{let i=await fetch(`${RS}/events`,{cache:`no-store`,signal:n.signal});if(!i.ok||!i.body)throw Error(`events unavailable`);r=0,t();let a=LS(t=>{try{e(JSON.parse(t.data))}catch{}}),o=i.body.getReader();for(;;){let{done:e,value:t}=await o.read();if(e)break;a.push(t)}}catch{if(n.signal.aborted)return}r+=1;let i=Math.min(BS,250*2**r)*(.5+Math.random()/2);await new Promise(e=>setTimeout(e,i))}})(),{close:()=>n.abort()}}}}function WS(e,t,n){let r={};for(let[n,i]of Object.entries(e))n!==t&&(r[n]=i);return n!==void 0&&(r[t]=n),r}function GS(e,t){if(t){if(e.type===`string`&&e.enum===void 0&&(e.minLength??0)===0)return``;if(e.type===`array`&&(e.minItems??0)===0)return[]}}var KS=e=>e===``?`(empty)`:e;function qS(e,t){return t===void 0?`Not answered`:e.type===`boolean`?t===!0?`Yes`:`No`:Array.isArray(t)?t.length===0?`(none selected)`:t.join(`, `):t===``?`(empty)`:String(t)}function JS(e,t){let{properties:n,required:r}=e.answerSchema;return e.fieldOrder.flatMap(e=>{let i=n[e];return i?[{name:e,title:i.title,value:qS(i,t[e]),required:r.includes(e)}]:[]})}var YS={"not-object":`The answers are not in the right shape`,"too-large":`The answers are too large`,"unknown-field":`Not a field of this question`,required:`An answer is required`,type:`Wrong value type`,enum:`Not one of the options`,"too-long":`Too long`,"too-short":`Too short`,"out-of-range":`Out of range`,duplicate:`The same option is selected more than once`,"too-many":`Too many selected`,"too-few":`Too few selected`};function XS(e,t){return t.map(t=>{let n=e.answerSchema.properties[t.field]?.title??`Whole answer`;return{name:t.field,text:`${n}: ${YS[t.code]}`}})}var ZS=6,QS=200,$S=300,eC=()=>`sub_${crypto.randomUUID()}`;function tC(e){let{name:t,field:n,required:r,value:i,disabled:a,onChange:o}=e,s=GS(n,r);if(s===void 0)return(0,H.jsx)(nC,{...e});let c=Array.isArray(s)?Array.isArray(i)&&i.length===0:i===``;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(nC,{...e}),(0,H.jsxs)(rS,{className:`text-xs font-normal text-muted-foreground`,children:[(0,H.jsx)(Xx,{checked:c,disabled:a,onCheckedChange:e=>o(e?s:void 0),"data-testid":`feedback-${t}-empty`}),n.type===`array`?`Answer with none selected`:`Answer with an empty value`]})]})}function nC({name:e,field:t,value:n,disabled:r,onChange:i}){let a=`feedback-${e}`;switch(t.type){case`boolean`:return(0,H.jsxs)(rS,{htmlFor:a,className:`font-normal`,children:[(0,H.jsx)(Xx,{id:a,checked:n===!0,disabled:r,onCheckedChange:e=>i(e)}),`Yes`]});case`number`:case`integer`:return(0,H.jsx)(nS,{id:a,type:`number`,inputMode:t.type===`integer`?`numeric`:`decimal`,step:t.type===`integer`?1:`any`,min:t.minimum,max:t.maximum,disabled:r,value:typeof n==`number`?String(n):``,onChange:e=>{let t=e.target.value,n=Number(t);i(t===``||!Number.isFinite(n)?void 0:n)}});case`array`:{let e=Array.isArray(n)?n:[];return(0,H.jsx)(`div`,{className:`flex flex-col gap-2`,role:`group`,"aria-labelledby":`${a}-label`,children:t.items.enum.map(t=>(0,H.jsxs)(rS,{className:`font-normal`,children:[(0,H.jsx)(Xx,{checked:e.includes(t),disabled:r,onCheckedChange:n=>{let r=n?[...e,t]:e.filter(e=>e!==t);i(r.length===0?void 0:r)}}),KS(t)]},t))})}case`string`:{if(t.enum!==void 0&&t.enum.length<=ZS)return(0,H.jsx)(PS,{"aria-labelledby":`${a}-label`,value:typeof n==`string`?n:null,disabled:r,onValueChange:e=>i(typeof e==`string`?e:void 0),children:t.enum.map(e=>(0,H.jsxs)(rS,{className:`font-normal`,children:[(0,H.jsx)(FS,{value:e}),KS(e)]},e))});if(t.enum!==void 0){let e=t.enum,o=typeof n==`string`?e.indexOf(n):-1;return(0,H.jsxs)(`select`,{id:a,className:`h-9 rounded-md border bg-transparent px-2 text-sm`,disabled:r,value:o===-1?`none`:String(o),onChange:t=>{let n=Number(t.target.value);i(t.target.value===`none`?void 0:e[n])},children:[(0,H.jsx)(`option`,{value:`none`,children:`Select an option`}),e.map((e,t)=>(0,H.jsx)(`option`,{value:String(t),children:KS(e)},e))]})}let e=t.maxLength===void 0||t.maxLength>QS,o={id:a,disabled:r,maxLength:t.maxLength,value:typeof n==`string`?n:``,onChange:e=>i(e.target.value===``?void 0:e.target.value)};return e?(0,H.jsx)(IS,{rows:4,...o}):(0,H.jsx)(nS,{...o})}}}function rC({api:e,request:t,reload:n}){let{requestId:r,questionnaire:i}=t,a=t.status===`pending`,[o,s]=(0,D.useState)({version:t.draftVersion,answers:t.draftAnswers}),[c,l]=(0,D.useState)(t.draftAnswers),[u,d]=(0,D.useState)(!1),[f,p]=(0,D.useState)(`idle`),[m,h]=(0,D.useState)(null),[g,_]=(0,D.useState)(null),[v,y]=(0,D.useState)(eC),[b,x]=(0,D.useState)(!1),S=(0,D.useRef)(0);t.draftVersion>o.version&&!u&&f===`idle`&&(s({version:t.draftVersion,answers:t.draftAnswers}),l(t.draftAnswers));let C=a&&t.currentRevision!==t.revision,w=C&&g===t.currentRevision,T=a?c:t.submission?.answers??t.draftAnswers,E=zu(i,T,{complete:!0}),O=JS(i,T),k=(e,t)=>{if(!(e instanceof VS)){h(t);return}switch(e.code){case`E_DRAFT_CONFLICT`:d(!1),l(o.answers),h(`The draft answer was updated in another window. Showing the latest content. Enter your answers again if needed.`),y(eC()),n();return;case`E_NEWER_REVISION`:_(null),y(eC()),h(`The document revision changed. Confirm again that this answer is for the revision shown.`),n();return;case`E_REQUEST_NOT_PENDING`:case`E_SUBMISSION_CONFLICT`:y(eC()),h(e.message),n();return;default:h(e.message)}};(0,D.useEffect)(()=>{if(!u||f!==`idle`||!a)return;let t=setTimeout(()=>{let t=S.current,n=c;p(`saving`),e.saveDraft(r,o.version,n).then(e=>{s({version:e.draftVersion,answers:n}),S.current===t&&d(!1),p(`idle`)},e=>{p(`idle`),k(e,`Could not save the draft answer.`)})},$S);return()=>clearTimeout(t)});let A=(e,t)=>{S.current+=1,l(n=>WS(n,e,t)),d(!0),h(null)},j=()=>{p(`submitting`),h(null),e.submitFeedback(r,{submissionId:v,expectedDraftVersion:o.version,revision:t.revision,currentRevision:C?g:t.currentRevision,confirmOlderRevision:w}).then(()=>{p(`idle`),n()},e=>{p(`idle`),k(e,`Could not confirm whether the submission succeeded. Submit again.`)})},M=()=>{x(!1),e.cancelFeedback(r).then(n,e=>k(e,`Could not cancel.`))},N=t.status===`cancelled`?`Cancelled`:t.status===`submitted`?t.acknowledgedAt===null?`Submitted. Waiting for the agent to retrieve it`:`The agent retrieved the answers`:f===`submitting`?`Submitting…`:f===`saving`?`Saving draft answer…`:u?`Unsaved changes`:o.version>0?`Draft answer saved`:`Not answered`,P=!a||f!==`idle`||u||E.length>0||C&&!w;return(0,H.jsxs)(`aside`,{"aria-label":`Answer the question`,className:`flex max-h-[50svh] w-full shrink-0 flex-col border-t bg-background min-[900px]:max-h-none min-[900px]:w-96 min-[900px]:border-t-0 min-[900px]:border-l`,"data-testid":`feedback-panel`,children:[(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Question from the agent`}),(0,H.jsx)(`h2`,{className:`mt-1 text-base font-semibold break-words`,children:i.title}),i.instructions&&(0,H.jsx)(`p`,{className:`mt-2 text-sm whitespace-pre-wrap text-muted-foreground`,children:i.instructions}),C&&(0,H.jsxs)(`div`,{role:`alert`,className:`mt-3 rounded-md border border-warning/50 p-3 text-sm`,children:[(0,H.jsx)(`p`,{children:`A newer revision is available. This answer is for the older revision shown.`}),g!==null&&!w&&(0,H.jsx)(`p`,{className:`mt-1`,children:`The document was updated again after you confirmed. Confirm again.`}),(0,H.jsxs)(rS,{className:`mt-2 font-normal`,children:[(0,H.jsx)(Xx,{checked:w,onCheckedChange:e=>_(e?t.currentRevision:null)}),`I confirm that this answer is for the older revision`]})]}),(0,H.jsx)(`div`,{className:`mt-4 flex flex-col gap-5`,children:i.fieldOrder.map(e=>{let t=i.answerSchema.properties[e];if(!t)return null;let n=i.answerSchema.required.includes(e);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,"data-field":e,children:[(0,H.jsxs)(`p`,{id:`feedback-${e}-label`,className:`text-sm font-medium`,children:[(0,H.jsx)(`label`,{htmlFor:`feedback-${e}`,children:t.title}),n&&(0,H.jsx)(`span`,{className:`ml-1 text-xs text-destructive`,children:`(required)`})]}),t.description&&(0,H.jsx)(`p`,{className:`text-xs whitespace-pre-wrap text-muted-foreground`,children:t.description}),(0,H.jsx)(tC,{name:e,field:t,required:n,value:T[e],disabled:!a||f===`submitting`,onChange:t=>A(e,t)})]},e)})})]}),(0,H.jsxs)(`div`,{className:`border-t px-4 py-3`,"data-testid":`feedback-footer`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Submitting to`}),(0,H.jsx)(`p`,{className:`text-sm font-medium break-words`,children:i.title}),(0,H.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Target revision `,(0,H.jsx)(`code`,{className:`font-mono`,children:t.revision.slice(4,16)})]}),(0,H.jsx)(`dl`,{className:`mt-2 max-h-40 overflow-y-auto text-xs`,"aria-label":`Answer summary`,children:O.map(e=>(0,H.jsxs)(`div`,{className:`flex gap-2 py-0.5`,children:[(0,H.jsx)(`dt`,{className:`w-24 shrink-0 truncate text-muted-foreground`,children:e.title}),(0,H.jsx)(`dd`,{className:`min-w-0 break-words`,children:e.value})]},e.name))}),a&&E.length>0&&(0,H.jsx)(`ul`,{className:`mt-2 text-xs text-muted-foreground`,"aria-label":`Required before submitting`,children:XS(i,E).map(e=>(0,H.jsx)(`li`,{children:e.text},`${e.name}:${e.text}`))}),(0,H.jsxs)(`div`,{className:`mt-2 flex min-h-6 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,H.jsx)(`p`,{role:`status`,className:`text-xs`,"data-testid":`feedback-status`,children:N}),m&&(0,H.jsx)(vx,{title:`Answer needs attention`,trigger:(0,H.jsxs)(pb,{variant:`ghost`,size:`xs`,className:`text-destructive`,children:[(0,H.jsx)(L,{"aria-hidden":`true`}),`Details`]}),children:(0,H.jsx)(`p`,{children:m})}),m&&(0,H.jsx)(`span`,{role:`alert`,className:`sr-only`,children:m})]}),a&&(0,H.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,H.jsx)(pb,{type:`button`,className:`flex-1`,disabled:P,onClick:j,children:`Send answers to the agent`}),(0,H.jsx)(pb,{type:`button`,variant:`outline`,onClick:()=>x(!0),children:`Cancel`})]})]}),(0,H.jsx)(mb,{open:b,onOpenChange:x,children:(0,H.jsxs)(_b,{children:[(0,H.jsxs)(vb,{children:[(0,H.jsx)(bb,{children:`Cancel this question?`}),(0,H.jsx)(xb,{children:`After cancelling, this question can no longer be answered. The agent is told that it was cancelled.`})]}),(0,H.jsxs)(yb,{children:[(0,H.jsx)(Cb,{children:`Back`}),(0,H.jsx)(Sb,{onClick:M,children:`Cancel question`})]})]})})]})}function iC(e){return e.replace(/^\uFEFF/,``).replace(/\r\n?/g,`
|
|
65
|
+
`)}function aC(e){return/^\s*$/.test(e)}function oC(e,t){let n=0;for(;n<e.length&&n<t&&e[n]===` `;)n++;return e.slice(n)}function sC(e){let t=``;for(let n of e)n.type===`text`||n.type===`inlineCode`?t+=n.value:`children`in n?t+=sC(n.children):n.type===`image`&&(t+=n.alt);return t}function cC(e=lC){let t=new Map;return n=>{let r=e(n),i=t.get(r)??1,a=r;for(;t.has(a);)a=`${r}-${++i}`;return t.set(r,i),t.set(a,1),a}}function lC(e){return e.toLowerCase().normalize(`NFKD`).replace(/[\u0300-\u036f]/g,``).replace(/&[a-z0-9#]+;/gi,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`section`}function uC(e){let t=e.replace(/[\u0000-\u001F\u007F\s]+/g,``);return/^(?!https?:|mailto:|tel:)[a-z][a-z0-9+.-]*:/i.test(t)?``:t}function dC(e){let t=e.match(/^(?:<([^<>\n]*)>|([^<>\s]*?))(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?$/);if(!t)return;let n=t[1]??t[2],r=t[3]??t[4]??t[5];return{href:n.replace(/\\([!-/:-@\[-`{-~])/g,`$1`),...r?{title:r}:{}}}function fC(e){return e.trim().replace(/\s+/g,` `).toLowerCase()}function pC(e){return fC(e).replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)||`footnote`}function mC(e,t=1){return t>1?`${e}-${t}`:e}function hC(e,t={}){let n=t.extensions?.flatMap(e=>e.inlineParser?[e.inlineParser]:[])??[],r=n.length?RegExp(yC.source+`|[`+n.map(e=>e.markers).join(``).replace(/[\\\]\[\-^]/g,`\\$&`)+`]`,`g`):yC,i=bC(e,t,{scans:Math.max(e.length*vC,1024),depth:0,links:0,parsers:n,marker:r});for(let e of t.extensions??[])i=e.transformInline?.(i,{options:t})??i;return i}function gC(e){return e.type===`link`||`children`in e&&e.children.some(gC)}var _C=32,vC=16,yC=/[\\`!\[_*~<]/g;function bC(e,t,n,r=!1){if(n.depth>=_C)return e?[{type:`text`,value:e}]:[];n.depth++;let i=t.extensions?n.parsers:[],a=i.length?n.marker:yC,o=[],s=0,c=``,l=()=>{c&&=(o.push({type:`text`,value:c}),``)};scan:for(;s<e.length;){let u=e[s],d=e[s+1];if(u===`\\`){if(d===`
|
|
66
|
+
`){l(),o.push({type:`break`}),s+=2;continue}if(d&&/[!-/:-@\[-`{-~]/.test(d)){c+=d,s+=2;continue}}if(u==="`"){let t=TC(e,s,"`"),r=EC(e,s+t,"`",t,n);if(r!==-1){l(),o.push({type:`inlineCode`,value:e.slice(s+t,r).replace(/\n/g,` `).replace(/^ (?! *$)(.*) $/s,`$1`)}),s=r+t;continue}c+=e.slice(s,s+t),s+=t;continue}for(let a of i){if(!a.markers.includes(u)||n.scans--<=0)continue;let i=a.parse({source:e,index:s,options:t,inLink:r,parseInline:e=>bC(e,t,n,r)});if(i){if(!Number.isInteger(i.length)||i.length<=0||i.length>e.length-s)throw RangeError(`Inline parser must consume a positive length within the source`);l(),o.push(i.node),gC(i.node)&&n.links++,s+=i.length;continue scan}}if(u===`[`||u===`!`&&d===`[`){let r=u===`!`,i=d===`^`&&xC(e,s,t,n);if(i){l(),o.push(i.node),n.links++,s=i.end;continue}let a=SC(e,s+Number(r),t,n);if(a){let e=n.links,i=bC(a.label,r?t.references?{references:t.references}:{}:t,n,!r),u=!r&&n.links!==e,d=uC(a.href),f=t.urlTransform?t.urlTransform(a.href,r?`image`:`link`,d):d;if(f!==null&&(r||!u&&(f||!a.href)))l(),o.push({...r?{type:`image`,src:f,alt:sC(i)}:{type:`link`,href:f,children:i},...a.title?{title:a.title}:{}});else{u&&(c+=`[`);for(let e of i)e.type===`text`?c+=e.value:(l(),o.push(e))}n.links=r?e:n.links+1,s=u?s+a.label.length+1:a.end;continue}}if(u===`*`&&d===`*`&&e[s+2]===`*`){let i=DC(e,s+3,`***`,n);if(i!==-1){l(),o.push({type:`emphasis`,children:bC(e.slice(s+1,i+2),t,n,r)}),s=i+3;continue}}if(u===`~`&&d===`~`&&e[s+2]===`~`){let t=TC(e,s,`~`);c+=e.slice(s,s+t),s+=t;continue}if(u===`*`||u===`_`||u===`~`){let i=d===u?2:1,a=u===`_`&&!kC(e,s,i,!0)?-1:DC(e,s+i,u.repeat(i),n);a===-1?(c+=u.repeat(i),s+=i):(l(),o.push({type:u===`~`?`strike`:i===2?`strong`:`emphasis`,children:bC(e.slice(s+i,a),t,n,r)}),s=a+i);continue}if(u===`<`&&t.allowHtml){let t=OC(e,s+1,`>`,n);if(t!==-1&&CC(e.slice(s,t+1))){l(),o.push({type:`inlineHtml`,value:e.slice(s,t+1)}),s=t+1;continue}}a.lastIndex=s+1;let f=n.scans>0?a.exec(e)?.index??e.length:e.indexOf(`\\`,s+1);c+=e.slice(s,f<0?e.length:f),s=f<0?e.length:f}return l(),n.depth--,o}function xC(e,t,n,r){let i=OC(e,t+2,`]`,r);if(i===-1)return;let a=fC(e.slice(t+2,i)),o=n.footnotes?.[a];if(!o||!n.footnoteOrder)return;let s=n.footnoteOrder.indexOf(a)+1;s||=n.footnoteOrder.push(a);let c=(n.footnoteCounts?.[a]??0)+1;return n.footnoteCounts&&(n.footnoteCounts[a]=c),{node:{type:`footnoteReference`,id:o.id??pC(o.label),number:s,...c>1?{referenceIndex:c}:{}},end:i+1}}function SC(e,t,n,r){let i=wC(e,t,`[`,`]`,r);if(i===-1)return;let a=e.slice(t+1,i),o=i+1,s;if(e[o]===`(`){let t=wC(e,o,`(`,`)`,r);if(t===-1)return;s=dC(e.slice(o+1,t).trim()),o=t+1}else if(e[o]===`[`){let t=wC(e,o,`[`,`]`,r);if(t===-1)return;s=n.references?.[fC(e.slice(o+1,t)||a)],o=t+1}else s=n.references?.[fC(a)];if(s)return{...s,label:a,end:o}}function CC(e){return/^<(?:!--(?:[\s\S]*--|-?)|\?[\s\S]*\?|![A-Z][\s\S]*|!\[CDATA\[[\s\S]*\]\]|\/[A-Za-z][\w:-]*\s*|[A-Za-z][\w:-]*(?:\s+[A-Za-z_:][\w:.-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*\s*\/?)>$/.test(e)}function wC(e,t,n,r,i){if(OC(e,t+1,r,i)===-1)return-1;let a=0;for(let o=t;o<e.length;o++){if(--i.scans<0)return-1;if(e[o]===`\\`){o++;continue}if(e[o]===n&&a++,e[o]===r&&(a--,a===0))return o}return-1}function TC(e,t,n,r){let i=0;for(;e[t+i]===n&&!(r&&--r.scans<0);)i++;return i}function EC(e,t,n,r,i){let a=t;for(;(a=OC(e,a,n,i))!==-1;){let t=TC(e,a,n,i);if(t===r)return a;a+=t}return-1}function DC(e,t,n,r){if(n===`~`&&/[\s\d]/.test(e[t]??``))return-1;for(let i=t;i<e.length;i++){if(--r.scans<0)return-1;if(e[i]===`\\`){i++;continue}if(e.startsWith(n,i)){if(n[0]===`~`){if(e[i-1]===`~`||e[i+n.length]===`~`)continue;if(n===`~`&&/\s/.test(e[i-1]??``))return-1}else if(e[i+1]===n){let t=TC(e,i,n,r),a=DC(e,i+t,n.repeat(t),r);if(a>i+t){i=a+t-1;continue}}if(n[0]!==`_`||kC(e,i,n.length,!1))return i}}return-1}function OC(e,t,n,r){if(r.scans<=0)return-1;let i=e.indexOf(n,t);return r.scans-=(i<0?e.length:i+1)-t,r.scans<0?-1:i}function kC(e,t,n,r){let i=e[r?t+n:t-1],a=e[r?t-1:t+n];return i!==void 0&&!/\s/.test(i)&&(a===void 0||/[^\p{L}\p{N}]/u.test(a))}var AC=64;function jC(e,t={}){let n=iC(e),r=t.frontmatter!==!1,i=n.split(`
|
|
67
67
|
`),a;if(r&&i[0]===`---`){let e=i.findIndex((e,t)=>t>0&&e===`---`);e>0&&(a=i.slice(1,e).join(`
|
|
68
|
-
`),i=i.slice(e+1))}let o=
|
|
69
|
-
`);return i=e.length,n?[{type:`paragraph`,children:
|
|
70
|
-
`),t,n,r).parse(),consume:e=>{o=e}});if(s)return i+=Math.max(o,1),s}}function c(){let t=_().match(/^( {0,3})(`{3,}|~{3,})(.*)$/);if(!t)return;let n=t[2],r=t[3].trim(),a=[];for(i++;i<e.length;){let e=_();if(e.includes(n)&&/^ {0,3}(?:`+|~+)\s*$/.test(e)){i++;break}a.push(
|
|
71
|
-
`),...
|
|
72
|
-
`)}}for(;i<e.length&&!
|
|
73
|
-
`)}}function h(){let n=[];for(;i<e.length;){let e=_();if(
|
|
74
|
-
`),t)}}function g(e){if(t.headingIds===!1)return;let r=
|
|
75
|
-
`),id:r(t)});continue}let a=s.match(/^ {0,3}\[([^\]\n]+)\]:[ \t]*(\S.*)$/),c=a&&
|
|
76
|
-
`),n,r).parse()})}for(let e of i){let r=n.footnoteCounts?.[t[e.number-1]]??1;r>1&&(e.referenceCount=r)}return{type:`footnotes`,items:i}}function zC(e){let t=new Set;for(let n of e.split(`,`)){let e=n.trim().match(/^(\d+)(?:-(\d+))?$/);if(!e)continue;let r=Number(e[1]),i=Number(e[2]??e[1]);if(!(i>2**53-1))for(let e=r;e<=i&&e<r+1e3;e++)t.add(e)}return[...t].sort((e,t)=>e-t)}function BC(e){let t=e.match(/^(\s{0,8})([-+*]|\d{1,9}[.)])(?:([ \t]+)(.*))?$/);if(!t)return;let n=t[2],r=/\d/.test(n[0]);return{ordered:r,...r&&{number:Number.parseInt(n,10)},indent:t[1].length,marker:r?n.at(-1):n,contentIndent:t[1].length+n.length+(t[3]?.length??1),content:t[4]??``}}function VC(e){return e.match(/^ */)?.[0].length??0}function HC(e,t){let n=BC(e);return/^ {0,3}(?:`{3,}|~{3,}|#{1,6}(?:\s|$)|([-*_])(?:\s*\1){2,}\s*$|>)/.test(e)||n!==void 0&&(!n.ordered||n.number===1)||!!t&&UC(e,t)}function UC(e,t){if(!e.includes(`|`))return!1;let n=WC(t);return n.length===WC(e).length&&n.every(e=>/^:?-+:?$/.test(e.trim()))}function WC(e){let t=e.trim(),n=[],r=``;for(let e=+!!t.startsWith(`|`);e<t.length;e++){let i=t[e];if(i===`\\`&&t[e+1]===`|`){r+=`|`,e++;continue}if(i===`|`){n.push(r.trim()),r=``;continue}r+=i}return(r||!t.endsWith(`|`)||!n.length)&&n.push(r.trim()),n}function GC(e){let t=e.trim();if(t.startsWith(`:`)&&t.endsWith(`:`))return`center`;if(t.endsWith(`:`))return`right`;if(t.startsWith(`:`))return`left`}function KC(e,t){return{type:`tableCell`,children:vC(e,t)}}var qC;(function(e){e[e.EOF=-1]=`EOF`,e[e.NULL=0]=`NULL`,e[e.TABULATION=9]=`TABULATION`,e[e.CARRIAGE_RETURN=13]=`CARRIAGE_RETURN`,e[e.LINE_FEED=10]=`LINE_FEED`,e[e.FORM_FEED=12]=`FORM_FEED`,e[e.SPACE=32]=`SPACE`,e[e.EXCLAMATION_MARK=33]=`EXCLAMATION_MARK`,e[e.QUOTATION_MARK=34]=`QUOTATION_MARK`,e[e.AMPERSAND=38]=`AMPERSAND`,e[e.APOSTROPHE=39]=`APOSTROPHE`,e[e.HYPHEN_MINUS=45]=`HYPHEN_MINUS`,e[e.SOLIDUS=47]=`SOLIDUS`,e[e.DIGIT_0=48]=`DIGIT_0`,e[e.DIGIT_9=57]=`DIGIT_9`,e[e.SEMICOLON=59]=`SEMICOLON`,e[e.LESS_THAN_SIGN=60]=`LESS_THAN_SIGN`,e[e.EQUALS_SIGN=61]=`EQUALS_SIGN`,e[e.GREATER_THAN_SIGN=62]=`GREATER_THAN_SIGN`,e[e.QUESTION_MARK=63]=`QUESTION_MARK`,e[e.LATIN_CAPITAL_A=65]=`LATIN_CAPITAL_A`,e[e.LATIN_CAPITAL_Z=90]=`LATIN_CAPITAL_Z`,e[e.RIGHT_SQUARE_BRACKET=93]=`RIGHT_SQUARE_BRACKET`,e[e.GRAVE_ACCENT=96]=`GRAVE_ACCENT`,e[e.LATIN_SMALL_A=97]=`LATIN_SMALL_A`,e[e.LATIN_SMALL_Z=122]=`LATIN_SMALL_Z`})(qC||={});var JC;(function(e){e.controlCharacterInInputStream=`control-character-in-input-stream`,e.noncharacterInInputStream=`noncharacter-in-input-stream`,e.surrogateInInputStream=`surrogate-in-input-stream`,e.nonVoidHtmlElementStartTagWithTrailingSolidus=`non-void-html-element-start-tag-with-trailing-solidus`,e.endTagWithAttributes=`end-tag-with-attributes`,e.endTagWithTrailingSolidus=`end-tag-with-trailing-solidus`,e.unexpectedSolidusInTag=`unexpected-solidus-in-tag`,e.unexpectedNullCharacter=`unexpected-null-character`,e.unexpectedQuestionMarkInsteadOfTagName=`unexpected-question-mark-instead-of-tag-name`,e.invalidFirstCharacterOfTagName=`invalid-first-character-of-tag-name`,e.unexpectedEqualsSignBeforeAttributeName=`unexpected-equals-sign-before-attribute-name`,e.missingEndTagName=`missing-end-tag-name`,e.unexpectedCharacterInAttributeName=`unexpected-character-in-attribute-name`,e.unknownNamedCharacterReference=`unknown-named-character-reference`,e.missingSemicolonAfterCharacterReference=`missing-semicolon-after-character-reference`,e.unexpectedCharacterAfterDoctypeSystemIdentifier=`unexpected-character-after-doctype-system-identifier`,e.unexpectedCharacterInUnquotedAttributeValue=`unexpected-character-in-unquoted-attribute-value`,e.eofBeforeTagName=`eof-before-tag-name`,e.eofInTag=`eof-in-tag`,e.missingAttributeValue=`missing-attribute-value`,e.missingWhitespaceBetweenAttributes=`missing-whitespace-between-attributes`,e.missingWhitespaceAfterDoctypePublicKeyword=`missing-whitespace-after-doctype-public-keyword`,e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers=`missing-whitespace-between-doctype-public-and-system-identifiers`,e.missingWhitespaceAfterDoctypeSystemKeyword=`missing-whitespace-after-doctype-system-keyword`,e.missingQuoteBeforeDoctypePublicIdentifier=`missing-quote-before-doctype-public-identifier`,e.missingQuoteBeforeDoctypeSystemIdentifier=`missing-quote-before-doctype-system-identifier`,e.missingDoctypePublicIdentifier=`missing-doctype-public-identifier`,e.missingDoctypeSystemIdentifier=`missing-doctype-system-identifier`,e.abruptDoctypePublicIdentifier=`abrupt-doctype-public-identifier`,e.abruptDoctypeSystemIdentifier=`abrupt-doctype-system-identifier`,e.cdataInHtmlContent=`cdata-in-html-content`,e.incorrectlyOpenedComment=`incorrectly-opened-comment`,e.eofInScriptHtmlCommentLikeText=`eof-in-script-html-comment-like-text`,e.eofInDoctype=`eof-in-doctype`,e.nestedComment=`nested-comment`,e.abruptClosingOfEmptyComment=`abrupt-closing-of-empty-comment`,e.eofInComment=`eof-in-comment`,e.incorrectlyClosedComment=`incorrectly-closed-comment`,e.eofInCdata=`eof-in-cdata`,e.absenceOfDigitsInNumericCharacterReference=`absence-of-digits-in-numeric-character-reference`,e.nullCharacterReference=`null-character-reference`,e.surrogateCharacterReference=`surrogate-character-reference`,e.characterReferenceOutsideUnicodeRange=`character-reference-outside-unicode-range`,e.controlCharacterReference=`control-character-reference`,e.noncharacterCharacterReference=`noncharacter-character-reference`,e.missingWhitespaceBeforeDoctypeName=`missing-whitespace-before-doctype-name`,e.missingDoctypeName=`missing-doctype-name`,e.invalidCharacterSequenceAfterDoctypeName=`invalid-character-sequence-after-doctype-name`,e.duplicateAttribute=`duplicate-attribute`,e.nonConformingDoctype=`non-conforming-doctype`,e.missingDoctype=`missing-doctype`,e.misplacedDoctype=`misplaced-doctype`,e.endTagWithoutMatchingOpenElement=`end-tag-without-matching-open-element`,e.closingOfElementWithOpenChildElements=`closing-of-element-with-open-child-elements`,e.disallowedContentInNoscriptInHead=`disallowed-content-in-noscript-in-head`,e.openElementsLeftAfterEof=`open-elements-left-after-eof`,e.abandonedHeadElementChild=`abandoned-head-element-child`,e.misplacedStartTagForHeadElement=`misplaced-start-tag-for-head-element`,e.nestedNoscriptInHead=`nested-noscript-in-head`,e.eofInElementThatCanContainOnlyText=`eof-in-element-that-can-contain-only-text`})(JC||={});var YC;(function(e){e[e.CHARACTER=0]=`CHARACTER`,e[e.NULL_CHARACTER=1]=`NULL_CHARACTER`,e[e.WHITESPACE_CHARACTER=2]=`WHITESPACE_CHARACTER`,e[e.START_TAG=3]=`START_TAG`,e[e.END_TAG=4]=`END_TAG`,e[e.COMMENT=5]=`COMMENT`,e[e.DOCTYPE=6]=`DOCTYPE`,e[e.EOF=7]=`EOF`,e[e.HIBERNATION=8]=`HIBERNATION`})(YC||={});var XC;(function(e){e.HTML=`http://www.w3.org/1999/xhtml`,e.MATHML=`http://www.w3.org/1998/Math/MathML`,e.SVG=`http://www.w3.org/2000/svg`,e.XLINK=`http://www.w3.org/1999/xlink`,e.XML=`http://www.w3.org/XML/1998/namespace`,e.XMLNS=`http://www.w3.org/2000/xmlns/`})(XC||={});var ZC;(function(e){e.TYPE=`type`,e.ACTION=`action`,e.ENCODING=`encoding`,e.PROMPT=`prompt`,e.NAME=`name`,e.COLOR=`color`,e.FACE=`face`,e.SIZE=`size`})(ZC||={});var QC;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(QC||={});var Z;(function(e){e.A=`a`,e.ADDRESS=`address`,e.ANNOTATION_XML=`annotation-xml`,e.APPLET=`applet`,e.AREA=`area`,e.ARTICLE=`article`,e.ASIDE=`aside`,e.B=`b`,e.BASE=`base`,e.BASEFONT=`basefont`,e.BGSOUND=`bgsound`,e.BIG=`big`,e.BLOCKQUOTE=`blockquote`,e.BODY=`body`,e.BR=`br`,e.BUTTON=`button`,e.CAPTION=`caption`,e.CENTER=`center`,e.CODE=`code`,e.COL=`col`,e.COLGROUP=`colgroup`,e.DD=`dd`,e.DESC=`desc`,e.DETAILS=`details`,e.DIALOG=`dialog`,e.DIR=`dir`,e.DIV=`div`,e.DL=`dl`,e.DT=`dt`,e.EM=`em`,e.EMBED=`embed`,e.FIELDSET=`fieldset`,e.FIGCAPTION=`figcaption`,e.FIGURE=`figure`,e.FONT=`font`,e.FOOTER=`footer`,e.FOREIGN_OBJECT=`foreignObject`,e.FORM=`form`,e.FRAME=`frame`,e.FRAMESET=`frameset`,e.H1=`h1`,e.H2=`h2`,e.H3=`h3`,e.H4=`h4`,e.H5=`h5`,e.H6=`h6`,e.HEAD=`head`,e.HEADER=`header`,e.HGROUP=`hgroup`,e.HR=`hr`,e.HTML=`html`,e.I=`i`,e.IMG=`img`,e.IMAGE=`image`,e.INPUT=`input`,e.IFRAME=`iframe`,e.KEYGEN=`keygen`,e.LABEL=`label`,e.LI=`li`,e.LINK=`link`,e.LISTING=`listing`,e.MAIN=`main`,e.MALIGNMARK=`malignmark`,e.MARQUEE=`marquee`,e.MATH=`math`,e.MENU=`menu`,e.META=`meta`,e.MGLYPH=`mglyph`,e.MI=`mi`,e.MO=`mo`,e.MN=`mn`,e.MS=`ms`,e.MTEXT=`mtext`,e.NAV=`nav`,e.NOBR=`nobr`,e.NOFRAMES=`noframes`,e.NOEMBED=`noembed`,e.NOSCRIPT=`noscript`,e.OBJECT=`object`,e.OL=`ol`,e.OPTGROUP=`optgroup`,e.OPTION=`option`,e.P=`p`,e.PARAM=`param`,e.PLAINTEXT=`plaintext`,e.PRE=`pre`,e.RB=`rb`,e.RP=`rp`,e.RT=`rt`,e.RTC=`rtc`,e.RUBY=`ruby`,e.S=`s`,e.SCRIPT=`script`,e.SEARCH=`search`,e.SECTION=`section`,e.SELECT=`select`,e.SOURCE=`source`,e.SMALL=`small`,e.SPAN=`span`,e.STRIKE=`strike`,e.STRONG=`strong`,e.STYLE=`style`,e.SUB=`sub`,e.SUMMARY=`summary`,e.SUP=`sup`,e.TABLE=`table`,e.TBODY=`tbody`,e.TEMPLATE=`template`,e.TEXTAREA=`textarea`,e.TFOOT=`tfoot`,e.TD=`td`,e.TH=`th`,e.THEAD=`thead`,e.TITLE=`title`,e.TR=`tr`,e.TRACK=`track`,e.TT=`tt`,e.U=`u`,e.UL=`ul`,e.SVG=`svg`,e.VAR=`var`,e.WBR=`wbr`,e.XMP=`xmp`})(Z||={});var Q;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.A=1]=`A`,e[e.ADDRESS=2]=`ADDRESS`,e[e.ANNOTATION_XML=3]=`ANNOTATION_XML`,e[e.APPLET=4]=`APPLET`,e[e.AREA=5]=`AREA`,e[e.ARTICLE=6]=`ARTICLE`,e[e.ASIDE=7]=`ASIDE`,e[e.B=8]=`B`,e[e.BASE=9]=`BASE`,e[e.BASEFONT=10]=`BASEFONT`,e[e.BGSOUND=11]=`BGSOUND`,e[e.BIG=12]=`BIG`,e[e.BLOCKQUOTE=13]=`BLOCKQUOTE`,e[e.BODY=14]=`BODY`,e[e.BR=15]=`BR`,e[e.BUTTON=16]=`BUTTON`,e[e.CAPTION=17]=`CAPTION`,e[e.CENTER=18]=`CENTER`,e[e.CODE=19]=`CODE`,e[e.COL=20]=`COL`,e[e.COLGROUP=21]=`COLGROUP`,e[e.DD=22]=`DD`,e[e.DESC=23]=`DESC`,e[e.DETAILS=24]=`DETAILS`,e[e.DIALOG=25]=`DIALOG`,e[e.DIR=26]=`DIR`,e[e.DIV=27]=`DIV`,e[e.DL=28]=`DL`,e[e.DT=29]=`DT`,e[e.EM=30]=`EM`,e[e.EMBED=31]=`EMBED`,e[e.FIELDSET=32]=`FIELDSET`,e[e.FIGCAPTION=33]=`FIGCAPTION`,e[e.FIGURE=34]=`FIGURE`,e[e.FONT=35]=`FONT`,e[e.FOOTER=36]=`FOOTER`,e[e.FOREIGN_OBJECT=37]=`FOREIGN_OBJECT`,e[e.FORM=38]=`FORM`,e[e.FRAME=39]=`FRAME`,e[e.FRAMESET=40]=`FRAMESET`,e[e.H1=41]=`H1`,e[e.H2=42]=`H2`,e[e.H3=43]=`H3`,e[e.H4=44]=`H4`,e[e.H5=45]=`H5`,e[e.H6=46]=`H6`,e[e.HEAD=47]=`HEAD`,e[e.HEADER=48]=`HEADER`,e[e.HGROUP=49]=`HGROUP`,e[e.HR=50]=`HR`,e[e.HTML=51]=`HTML`,e[e.I=52]=`I`,e[e.IMG=53]=`IMG`,e[e.IMAGE=54]=`IMAGE`,e[e.INPUT=55]=`INPUT`,e[e.IFRAME=56]=`IFRAME`,e[e.KEYGEN=57]=`KEYGEN`,e[e.LABEL=58]=`LABEL`,e[e.LI=59]=`LI`,e[e.LINK=60]=`LINK`,e[e.LISTING=61]=`LISTING`,e[e.MAIN=62]=`MAIN`,e[e.MALIGNMARK=63]=`MALIGNMARK`,e[e.MARQUEE=64]=`MARQUEE`,e[e.MATH=65]=`MATH`,e[e.MENU=66]=`MENU`,e[e.META=67]=`META`,e[e.MGLYPH=68]=`MGLYPH`,e[e.MI=69]=`MI`,e[e.MO=70]=`MO`,e[e.MN=71]=`MN`,e[e.MS=72]=`MS`,e[e.MTEXT=73]=`MTEXT`,e[e.NAV=74]=`NAV`,e[e.NOBR=75]=`NOBR`,e[e.NOFRAMES=76]=`NOFRAMES`,e[e.NOEMBED=77]=`NOEMBED`,e[e.NOSCRIPT=78]=`NOSCRIPT`,e[e.OBJECT=79]=`OBJECT`,e[e.OL=80]=`OL`,e[e.OPTGROUP=81]=`OPTGROUP`,e[e.OPTION=82]=`OPTION`,e[e.P=83]=`P`,e[e.PARAM=84]=`PARAM`,e[e.PLAINTEXT=85]=`PLAINTEXT`,e[e.PRE=86]=`PRE`,e[e.RB=87]=`RB`,e[e.RP=88]=`RP`,e[e.RT=89]=`RT`,e[e.RTC=90]=`RTC`,e[e.RUBY=91]=`RUBY`,e[e.S=92]=`S`,e[e.SCRIPT=93]=`SCRIPT`,e[e.SEARCH=94]=`SEARCH`,e[e.SECTION=95]=`SECTION`,e[e.SELECT=96]=`SELECT`,e[e.SOURCE=97]=`SOURCE`,e[e.SMALL=98]=`SMALL`,e[e.SPAN=99]=`SPAN`,e[e.STRIKE=100]=`STRIKE`,e[e.STRONG=101]=`STRONG`,e[e.STYLE=102]=`STYLE`,e[e.SUB=103]=`SUB`,e[e.SUMMARY=104]=`SUMMARY`,e[e.SUP=105]=`SUP`,e[e.TABLE=106]=`TABLE`,e[e.TBODY=107]=`TBODY`,e[e.TEMPLATE=108]=`TEMPLATE`,e[e.TEXTAREA=109]=`TEXTAREA`,e[e.TFOOT=110]=`TFOOT`,e[e.TD=111]=`TD`,e[e.TH=112]=`TH`,e[e.THEAD=113]=`THEAD`,e[e.TITLE=114]=`TITLE`,e[e.TR=115]=`TR`,e[e.TRACK=116]=`TRACK`,e[e.TT=117]=`TT`,e[e.U=118]=`U`,e[e.UL=119]=`UL`,e[e.SVG=120]=`SVG`,e[e.VAR=121]=`VAR`,e[e.WBR=122]=`WBR`,e[e.XMP=123]=`XMP`})(Q||={}),Z.A,Q.A,Z.ADDRESS,Q.ADDRESS,Z.ANNOTATION_XML,Q.ANNOTATION_XML,Z.APPLET,Q.APPLET,Z.AREA,Q.AREA,Z.ARTICLE,Q.ARTICLE,Z.ASIDE,Q.ASIDE,Z.B,Q.B,Z.BASE,Q.BASE,Z.BASEFONT,Q.BASEFONT,Z.BGSOUND,Q.BGSOUND,Z.BIG,Q.BIG,Z.BLOCKQUOTE,Q.BLOCKQUOTE,Z.BODY,Q.BODY,Z.BR,Q.BR,Z.BUTTON,Q.BUTTON,Z.CAPTION,Q.CAPTION,Z.CENTER,Q.CENTER,Z.CODE,Q.CODE,Z.COL,Q.COL,Z.COLGROUP,Q.COLGROUP,Z.DD,Q.DD,Z.DESC,Q.DESC,Z.DETAILS,Q.DETAILS,Z.DIALOG,Q.DIALOG,Z.DIR,Q.DIR,Z.DIV,Q.DIV,Z.DL,Q.DL,Z.DT,Q.DT,Z.EM,Q.EM,Z.EMBED,Q.EMBED,Z.FIELDSET,Q.FIELDSET,Z.FIGCAPTION,Q.FIGCAPTION,Z.FIGURE,Q.FIGURE,Z.FONT,Q.FONT,Z.FOOTER,Q.FOOTER,Z.FOREIGN_OBJECT,Q.FOREIGN_OBJECT,Z.FORM,Q.FORM,Z.FRAME,Q.FRAME,Z.FRAMESET,Q.FRAMESET,Z.H1,Q.H1,Z.H2,Q.H2,Z.H3,Q.H3,Z.H4,Q.H4,Z.H5,Q.H5,Z.H6,Q.H6,Z.HEAD,Q.HEAD,Z.HEADER,Q.HEADER,Z.HGROUP,Q.HGROUP,Z.HR,Q.HR,Z.HTML,Q.HTML,Z.I,Q.I,Z.IMG,Q.IMG,Z.IMAGE,Q.IMAGE,Z.INPUT,Q.INPUT,Z.IFRAME,Q.IFRAME,Z.KEYGEN,Q.KEYGEN,Z.LABEL,Q.LABEL,Z.LI,Q.LI,Z.LINK,Q.LINK,Z.LISTING,Q.LISTING,Z.MAIN,Q.MAIN,Z.MALIGNMARK,Q.MALIGNMARK,Z.MARQUEE,Q.MARQUEE,Z.MATH,Q.MATH,Z.MENU,Q.MENU,Z.META,Q.META,Z.MGLYPH,Q.MGLYPH,Z.MI,Q.MI,Z.MO,Q.MO,Z.MN,Q.MN,Z.MS,Q.MS,Z.MTEXT,Q.MTEXT,Z.NAV,Q.NAV,Z.NOBR,Q.NOBR,Z.NOFRAMES,Q.NOFRAMES,Z.NOEMBED,Q.NOEMBED,Z.NOSCRIPT,Q.NOSCRIPT,Z.OBJECT,Q.OBJECT,Z.OL,Q.OL,Z.OPTGROUP,Q.OPTGROUP,Z.OPTION,Q.OPTION,Z.P,Q.P,Z.PARAM,Q.PARAM,Z.PLAINTEXT,Q.PLAINTEXT,Z.PRE,Q.PRE,Z.RB,Q.RB,Z.RP,Q.RP,Z.RT,Q.RT,Z.RTC,Q.RTC,Z.RUBY,Q.RUBY,Z.S,Q.S,Z.SCRIPT,Q.SCRIPT,Z.SEARCH,Q.SEARCH,Z.SECTION,Q.SECTION,Z.SELECT,Q.SELECT,Z.SOURCE,Q.SOURCE,Z.SMALL,Q.SMALL,Z.SPAN,Q.SPAN,Z.STRIKE,Q.STRIKE,Z.STRONG,Q.STRONG,Z.STYLE,Q.STYLE,Z.SUB,Q.SUB,Z.SUMMARY,Q.SUMMARY,Z.SUP,Q.SUP,Z.TABLE,Q.TABLE,Z.TBODY,Q.TBODY,Z.TEMPLATE,Q.TEMPLATE,Z.TEXTAREA,Q.TEXTAREA,Z.TFOOT,Q.TFOOT,Z.TD,Q.TD,Z.TH,Q.TH,Z.THEAD,Q.THEAD,Z.TITLE,Q.TITLE,Z.TR,Q.TR,Z.TRACK,Q.TRACK,Z.TT,Q.TT,Z.U,Q.U,Z.UL,Q.UL,Z.SVG,Q.SVG,Z.VAR,Q.VAR,Z.WBR,Q.WBR,Z.XMP,Q.XMP;var $=Q;XC.HTML,$.ADDRESS,$.APPLET,$.AREA,$.ARTICLE,$.ASIDE,$.BASE,$.BASEFONT,$.BGSOUND,$.BLOCKQUOTE,$.BODY,$.BR,$.BUTTON,$.CAPTION,$.CENTER,$.COL,$.COLGROUP,$.DD,$.DETAILS,$.DIR,$.DIV,$.DL,$.DT,$.EMBED,$.FIELDSET,$.FIGCAPTION,$.FIGURE,$.FOOTER,$.FORM,$.FRAME,$.FRAMESET,$.H1,$.H2,$.H3,$.H4,$.H5,$.H6,$.HEAD,$.HEADER,$.HGROUP,$.HR,$.HTML,$.IFRAME,$.IMG,$.INPUT,$.LI,$.LINK,$.LISTING,$.MAIN,$.MARQUEE,$.MENU,$.META,$.NAV,$.NOEMBED,$.NOFRAMES,$.NOSCRIPT,$.OBJECT,$.OL,$.P,$.PARAM,$.PLAINTEXT,$.PRE,$.SCRIPT,$.SECTION,$.SELECT,$.SOURCE,$.STYLE,$.SUMMARY,$.TABLE,$.TBODY,$.TD,$.TEMPLATE,$.TEXTAREA,$.TFOOT,$.TH,$.THEAD,$.TITLE,$.TR,$.TRACK,$.UL,$.WBR,$.XMP,XC.MATHML,$.MI,$.MO,$.MN,$.MS,$.MTEXT,$.ANNOTATION_XML,XC.SVG,$.TITLE,$.FOREIGN_OBJECT,$.DESC,XC.XLINK,XC.XML,XC.XMLNS,$.H1,$.H2,$.H3,$.H4,$.H5,$.H6,Z.STYLE,Z.SCRIPT,Z.XMP,Z.IFRAME,Z.NOEMBED,Z.NOFRAMES,Z.PLAINTEXT;var $C;(function(e){e[e.DATA=0]=`DATA`,e[e.RCDATA=1]=`RCDATA`,e[e.RAWTEXT=2]=`RAWTEXT`,e[e.SCRIPT_DATA=3]=`SCRIPT_DATA`,e[e.PLAINTEXT=4]=`PLAINTEXT`,e[e.TAG_OPEN=5]=`TAG_OPEN`,e[e.END_TAG_OPEN=6]=`END_TAG_OPEN`,e[e.TAG_NAME=7]=`TAG_NAME`,e[e.RCDATA_LESS_THAN_SIGN=8]=`RCDATA_LESS_THAN_SIGN`,e[e.RCDATA_END_TAG_OPEN=9]=`RCDATA_END_TAG_OPEN`,e[e.RCDATA_END_TAG_NAME=10]=`RCDATA_END_TAG_NAME`,e[e.RAWTEXT_LESS_THAN_SIGN=11]=`RAWTEXT_LESS_THAN_SIGN`,e[e.RAWTEXT_END_TAG_OPEN=12]=`RAWTEXT_END_TAG_OPEN`,e[e.RAWTEXT_END_TAG_NAME=13]=`RAWTEXT_END_TAG_NAME`,e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]=`SCRIPT_DATA_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_END_TAG_OPEN=15]=`SCRIPT_DATA_END_TAG_OPEN`,e[e.SCRIPT_DATA_END_TAG_NAME=16]=`SCRIPT_DATA_END_TAG_NAME`,e[e.SCRIPT_DATA_ESCAPE_START=17]=`SCRIPT_DATA_ESCAPE_START`,e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]=`SCRIPT_DATA_ESCAPE_START_DASH`,e[e.SCRIPT_DATA_ESCAPED=19]=`SCRIPT_DATA_ESCAPED`,e[e.SCRIPT_DATA_ESCAPED_DASH=20]=`SCRIPT_DATA_ESCAPED_DASH`,e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]=`SCRIPT_DATA_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]=`SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]=`SCRIPT_DATA_ESCAPED_END_TAG_OPEN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]=`SCRIPT_DATA_ESCAPED_END_TAG_NAME`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]=`SCRIPT_DATA_DOUBLE_ESCAPE_START`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]=`SCRIPT_DATA_DOUBLE_ESCAPED`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]=`SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]=`SCRIPT_DATA_DOUBLE_ESCAPE_END`,e[e.BEFORE_ATTRIBUTE_NAME=31]=`BEFORE_ATTRIBUTE_NAME`,e[e.ATTRIBUTE_NAME=32]=`ATTRIBUTE_NAME`,e[e.AFTER_ATTRIBUTE_NAME=33]=`AFTER_ATTRIBUTE_NAME`,e[e.BEFORE_ATTRIBUTE_VALUE=34]=`BEFORE_ATTRIBUTE_VALUE`,e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]=`ATTRIBUTE_VALUE_DOUBLE_QUOTED`,e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]=`ATTRIBUTE_VALUE_SINGLE_QUOTED`,e[e.ATTRIBUTE_VALUE_UNQUOTED=37]=`ATTRIBUTE_VALUE_UNQUOTED`,e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]=`AFTER_ATTRIBUTE_VALUE_QUOTED`,e[e.SELF_CLOSING_START_TAG=39]=`SELF_CLOSING_START_TAG`,e[e.BOGUS_COMMENT=40]=`BOGUS_COMMENT`,e[e.MARKUP_DECLARATION_OPEN=41]=`MARKUP_DECLARATION_OPEN`,e[e.COMMENT_START=42]=`COMMENT_START`,e[e.COMMENT_START_DASH=43]=`COMMENT_START_DASH`,e[e.COMMENT=44]=`COMMENT`,e[e.COMMENT_LESS_THAN_SIGN=45]=`COMMENT_LESS_THAN_SIGN`,e[e.COMMENT_LESS_THAN_SIGN_BANG=46]=`COMMENT_LESS_THAN_SIGN_BANG`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]=`COMMENT_LESS_THAN_SIGN_BANG_DASH`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]=`COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH`,e[e.COMMENT_END_DASH=49]=`COMMENT_END_DASH`,e[e.COMMENT_END=50]=`COMMENT_END`,e[e.COMMENT_END_BANG=51]=`COMMENT_END_BANG`,e[e.DOCTYPE=52]=`DOCTYPE`,e[e.BEFORE_DOCTYPE_NAME=53]=`BEFORE_DOCTYPE_NAME`,e[e.DOCTYPE_NAME=54]=`DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_NAME=55]=`AFTER_DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]=`AFTER_DOCTYPE_PUBLIC_KEYWORD`,e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]=`BEFORE_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]=`DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]=`DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]=`AFTER_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]=`BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS`,e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]=`AFTER_DOCTYPE_SYSTEM_KEYWORD`,e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]=`BEFORE_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]=`DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]=`DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]=`AFTER_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.BOGUS_DOCTYPE=67]=`BOGUS_DOCTYPE`,e[e.CDATA_SECTION=68]=`CDATA_SECTION`,e[e.CDATA_SECTION_BRACKET=69]=`CDATA_SECTION_BRACKET`,e[e.CDATA_SECTION_END=70]=`CDATA_SECTION_END`,e[e.CHARACTER_REFERENCE=71]=`CHARACTER_REFERENCE`,e[e.AMBIGUOUS_AMPERSAND=72]=`AMBIGUOUS_AMPERSAND`})($C||={}),$C.DATA,$C.RCDATA,$C.RAWTEXT,$C.SCRIPT_DATA,$C.PLAINTEXT,$C.CDATA_SECTION,[...new Set([Q.DD,Q.DT,Q.LI,Q.OPTGROUP,Q.OPTION,Q.P,Q.RB,Q.RP,Q.RT,Q.RTC]),Q.CAPTION,Q.COLGROUP,Q.TBODY,Q.TD,Q.TFOOT,Q.TH,Q.THEAD,Q.TR];var ew=new Set([Q.APPLET,Q.CAPTION,Q.HTML,Q.MARQUEE,Q.OBJECT,Q.TABLE,Q.TD,Q.TEMPLATE,Q.TH]);[...ew,Q.OL,Q.UL],[...ew,Q.BUTTON],Q.ANNOTATION_XML,Q.MI,Q.MN,Q.MO,Q.MS,Q.MTEXT,Q.DESC,Q.FOREIGN_OBJECT,Q.TITLE,Q.TR,Q.TEMPLATE,Q.HTML,Q.TBODY,Q.TFOOT,Q.THEAD,Q.TEMPLATE,Q.HTML,Q.TABLE,Q.TEMPLATE,Q.HTML,Q.TD,Q.TH;var tw;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(tw||={}),tw.Marker,[...`+//silmaril//dtd html pro v0r11 19970101//,-//as//dtd html 3.0 aswedit + extensions//,-//advasoft ltd//dtd html 3.0 aswedit + extensions//,-//ietf//dtd html 2.0 level 1//,-//ietf//dtd html 2.0 level 2//,-//ietf//dtd html 2.0 strict level 1//,-//ietf//dtd html 2.0 strict level 2//,-//ietf//dtd html 2.0 strict//,-//ietf//dtd html 2.0//,-//ietf//dtd html 2.1e//,-//ietf//dtd html 3.0//,-//ietf//dtd html 3.2 final//,-//ietf//dtd html 3.2//,-//ietf//dtd html 3//,-//ietf//dtd html level 0//,-//ietf//dtd html level 1//,-//ietf//dtd html level 2//,-//ietf//dtd html level 3//,-//ietf//dtd html strict level 0//,-//ietf//dtd html strict level 1//,-//ietf//dtd html strict level 2//,-//ietf//dtd html strict level 3//,-//ietf//dtd html strict//,-//ietf//dtd html//,-//metrius//dtd metrius presentational//,-//microsoft//dtd internet explorer 2.0 html strict//,-//microsoft//dtd internet explorer 2.0 html//,-//microsoft//dtd internet explorer 2.0 tables//,-//microsoft//dtd internet explorer 3.0 html strict//,-//microsoft//dtd internet explorer 3.0 html//,-//microsoft//dtd internet explorer 3.0 tables//,-//netscape comm. corp.//dtd html//,-//netscape comm. corp.//dtd strict html//,-//o'reilly and associates//dtd html 2.0//,-//o'reilly and associates//dtd html extended 1.0//,-//o'reilly and associates//dtd html extended relaxed 1.0//,-//sq//dtd html 2.0 hotmetal + extensions//,-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//,-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//,-//spyglass//dtd html 2.0 extended//,-//sun microsystems corp.//dtd hotjava html//,-//sun microsystems corp.//dtd hotjava strict html//,-//w3c//dtd html 3 1995-03-24//,-//w3c//dtd html 3.2 draft//,-//w3c//dtd html 3.2 final//,-//w3c//dtd html 3.2//,-//w3c//dtd html 3.2s draft//,-//w3c//dtd html 4.0 frameset//,-//w3c//dtd html 4.0 transitional//,-//w3c//dtd html experimental 19960712//,-//w3c//dtd html experimental 970421//,-//w3c//dtd w3 html//,-//w3o//dtd w3 html 3.0//,-//webtechs//dtd mozilla html 2.0//,-//webtechs//dtd mozilla html//`.split(`,`)],new Map(`attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`).map(e=>[e.toLowerCase(),e])),XC.XLINK,XC.XLINK,XC.XLINK,XC.XLINK,XC.XLINK,XC.XLINK,XC.XLINK,XC.XML,XC.XML,XC.XMLNS,XC.XMLNS,new Map(`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`).map(e=>[e.toLowerCase(),e])),Q.B,Q.BIG,Q.BLOCKQUOTE,Q.BODY,Q.BR,Q.CENTER,Q.CODE,Q.DD,Q.DIV,Q.DL,Q.DT,Q.EM,Q.EMBED,Q.H1,Q.H2,Q.H3,Q.H4,Q.H5,Q.H6,Q.HEAD,Q.HR,Q.I,Q.IMG,Q.LI,Q.LISTING,Q.MENU,Q.META,Q.NOBR,Q.OL,Q.P,Q.PRE,Q.RUBY,Q.S,Q.SMALL,Q.SPAN,Q.STRONG,Q.STRIKE,Q.SUB,Q.SUP,Q.TABLE,Q.TT,Q.U,Q.UL,Q.VAR;var nw;(function(e){e[e.INITIAL=0]=`INITIAL`,e[e.BEFORE_HTML=1]=`BEFORE_HTML`,e[e.BEFORE_HEAD=2]=`BEFORE_HEAD`,e[e.IN_HEAD=3]=`IN_HEAD`,e[e.IN_HEAD_NO_SCRIPT=4]=`IN_HEAD_NO_SCRIPT`,e[e.AFTER_HEAD=5]=`AFTER_HEAD`,e[e.IN_BODY=6]=`IN_BODY`,e[e.TEXT=7]=`TEXT`,e[e.IN_TABLE=8]=`IN_TABLE`,e[e.IN_TABLE_TEXT=9]=`IN_TABLE_TEXT`,e[e.IN_CAPTION=10]=`IN_CAPTION`,e[e.IN_COLUMN_GROUP=11]=`IN_COLUMN_GROUP`,e[e.IN_TABLE_BODY=12]=`IN_TABLE_BODY`,e[e.IN_ROW=13]=`IN_ROW`,e[e.IN_CELL=14]=`IN_CELL`,e[e.IN_SELECT=15]=`IN_SELECT`,e[e.IN_SELECT_IN_TABLE=16]=`IN_SELECT_IN_TABLE`,e[e.IN_TEMPLATE=17]=`IN_TEMPLATE`,e[e.AFTER_BODY=18]=`AFTER_BODY`,e[e.IN_FRAMESET=19]=`IN_FRAMESET`,e[e.AFTER_FRAMESET=20]=`AFTER_FRAMESET`,e[e.AFTER_AFTER_BODY=21]=`AFTER_AFTER_BODY`,e[e.AFTER_AFTER_FRAMESET=22]=`AFTER_AFTER_FRAMESET`})(nw||={}),Q.TABLE,Q.TBODY,Q.TFOOT,Q.THEAD,Q.TR,Q.CAPTION,Q.COL,Q.COLGROUP,Q.TBODY,Q.TD,Q.TFOOT,Q.TH,Q.THEAD,Q.TR,Z.AREA,Z.BASE,Z.BASEFONT,Z.BGSOUND,Z.BR,Z.COL,Z.EMBED,Z.FRAME,Z.HR,Z.IMG,Z.INPUT,Z.KEYGEN,Z.LINK,Z.META,Z.PARAM,Z.SOURCE,Z.TRACK,Z.WBR;function rw(e,t){for(let n=0;n<e.length;n+=1)if(e.charCodeAt(n)===t)return!0;return!1}function iw(e){let t=``;for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);r!==9&&r!==10&&r!==13&&(t+=e[n])}let n=0,r=t.length;for(;n<r&&t.charCodeAt(n)<=32;)n+=1;for(;r>n&&t.charCodeAt(r-1)<=32;)--r;return t.slice(n,r)}var aw=/^([a-zA-Z][a-zA-Z0-9+.-]*):/,ow=/%(2f|5c|00)/i,sw=/%[0-9a-f]{2}/i;function cw(e,t){let n=iw(e);if(n===``)return{kind:`rejected`,reason:`empty`};if(n.startsWith(`#`))return{kind:`fragment`};if(rw(n,0))return{kind:`rejected`,reason:`nul`};if(n.includes(`\\`))return{kind:`rejected`,reason:`backslash`};let r=aw.exec(n)?.[1]?.toLowerCase();if(r!==void 0)return r===`http`||r===`https`?{kind:`remote`}:r===`data`?{kind:`data`,mime:((n.slice(5).split(`,`,1)[0]??``).split(`;`,1)[0]??``).trim().toLowerCase()}:r===`file`?{kind:`rejected`,reason:`file-url`}:{kind:`rejected`,reason:`scheme`};if(n.startsWith(`//`))return{kind:`remote`};let i=n.indexOf(`#`),a=i===-1?n:n.slice(0,i),o=a.indexOf(`?`),s=o===-1?a:a.slice(0,o),c=n.slice(s.length);if(s===``)return{kind:`rejected`,reason:`empty`};if(ow.test(s))return{kind:`rejected`,reason:`encoded`};let l=s.startsWith(`/`)?[]:t.split(`/`).filter(e=>e!==``),u=s.split(`/`);for(let e of u){let t;try{t=decodeURIComponent(e)}catch{return{kind:`rejected`,reason:`encoded`}}if(rw(t,0))return{kind:`rejected`,reason:`nul`};if(t.includes(`/`)||t.includes(`\\`)||sw.test(t))return{kind:`rejected`,reason:`encoded`};if(t!==``&&t!==`.`){if(t===`..`){if(l.length===0)return{kind:`rejected`,reason:`outside-root`};l.pop();continue}l.push(t)}}let d=u.at(-1)??``;return l.length===0||d===``||d===`.`||d===`..`?{kind:`rejected`,reason:`directory`}:{kind:`local`,logicalPath:l.join(`/`),suffix:c}}function lw(e){let t=iw(e);return t===``||t.startsWith(`#`)||t.startsWith(`//`)||rw(t,0)||t.includes(`\\`)?!1:!aw.test(t)}function uw(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function dw(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}var fw=new Set([`md`,`markdown`,`html`,`htm`]);function pw(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n>0&&fw.has(t.slice(n+1).toLowerCase())}function mw(e){let t=iw(e);if(t.startsWith(`#`))return{kind:`fragment`};if(t===``||rw(t,0)||t.includes(`\\`))return{kind:`other`};let n=aw.exec(t)?.[1]?.toLowerCase();if(n!==void 0)return n===`http`||n===`https`||n===`mailto`?{kind:`external`,url:t}:{kind:`other`};if(t.startsWith(`//`))return{kind:`other`};let r=(t.split(`#`,1)[0]??``).split(`?`,1)[0]??``;if(r===``||ow.test(r))return{kind:`other`};let i=[];for(let e of r.split(`/`)){let t;try{t=decodeURIComponent(e)}catch{return{kind:`other`}}if(rw(t,0)||t.includes(`/`)||t.includes(`\\`)||sw.test(t))return{kind:`other`};t!==``&&t!==`.`&&i.push(t)}let a=i.at(-1);return a===void 0||a===`..`||!pw(a)?{kind:`other`}:{kind:`document`,fromRoot:r.startsWith(`/`),segments:i}}var hw=(e,t)=>`h${String(t+1)}`,gw=/^(https?:|mailto:)/i;function _w(e){return e.startsWith(`#`)||gw.test(e)}var vw={allowHtml:!1,frontmatter:!0,headingIds:hw,urlTransform:(e,t)=>t===`image`?lw(e)?e:null:_w(e)||mw(e).kind===`document`?e:null};function yw(e){return encodeURIComponent(e)}function bw(e){return e===void 0||e===``?`text`:_w(e)?e.startsWith(`#`)?`fragment`:`external`:mw(e).kind===`document`?`document`:`text`}function xw(e,t){let n=cw(e,uw(t));return n.kind===`local`?n.logicalPath:null}function Sw(e,t={}){return(typeof e==`string`?PC(e,t):e).children.map((e,n)=>Cw(e,t,`b:${n}`))}function Cw(e,t={},n){switch(e.type){case`heading`:return Mw(t,`h${e.depth}`,{key:n,...e.id&&{id:e.id},...e.framework&&{"data-framework":e.framework}},Tw(e.children,t),Pw(e.id,t));case`paragraph`:return Mw(t,`p`,{key:n},Tw(e.children,t));case`code`:return Ew(e,t,n);case`list`:return Mw(t,e.ordered?`ol`:`ul`,{key:n,...e.ordered&&e.start!==void 0&&e.start!==1&&{start:e.start}},e.items.map((n,r)=>Mw(t,`li`,{key:r},Dw(n.children,n.checked,e.loose,t,`${r}`))));case`blockquote`:return Mw(t,`blockquote`,{key:n},e.children.map((e,r)=>Cw(e,t,`${n}:${r}`)));case`table`:return Mw(t,`table`,{key:n},Mw(t,`thead`,null,Mw(t,`tr`,null,e.header.map((n,r)=>Ow(`th`,n,e.align[r],t,r)))),e.rows.length?Mw(t,`tbody`,null,e.rows.map((n,r)=>Mw(t,`tr`,{key:r},n.map((n,r)=>Ow(`td`,n,e.align[r],t,r))))):null);case`footnotes`:return kw(e.items,t,n);case`thematicBreak`:return Mw(t,`hr`,{key:n});case`html`:return t.allowHtml?Mw(t,`div`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):Mw(t,`p`,{key:n},e.value);case`callout`:return Mw(t,`div`,{key:n,className:`markdown-alert markdown-alert-${e.kind.toLowerCase()}`},Mw(t,`p`,{className:`markdown-alert-title`},e.title),Mw(t,`div`,{className:`markdown-alert-content`},e.children.map((e,r)=>Cw(e,t,`${n}:${r}`))));case`component`:return Nw(e,t,n)}}function ww(e,t={},n){switch(e.type){case`text`:return e.value;case`inlineCode`:return Mw(t,`code`,{key:n},e.value);case`strong`:return Mw(t,`strong`,{key:n},Tw(e.children,t));case`emphasis`:return Mw(t,`em`,{key:n},Tw(e.children,t));case`strike`:return Mw(t,`del`,{key:n},Tw(e.children,t));case`footnoteReference`:return Mw(t,`sup`,{key:n},Mw(t,`a`,{id:`user-content-fnref-${_C(e.id,e.referenceIndex)}`,"data-footnote-ref":``,"aria-describedby":`footnote-label`,href:`#user-content-fn-${e.id}`},e.number));case`link`:return Mw(t,`a`,{key:n,href:e.href,...e.title&&{title:e.title}},Tw(e.children,t));case`image`:return Mw(t,`img`,{key:n,src:e.src,alt:e.alt,...e.title&&{title:e.title}});case`break`:return Mw(t,`br`,{key:n});case`inlineHtml`:return t.allowHtml?Mw(t,`span`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):e.value;case`inlineComponent`:return Nw(e,t,n)}}function Tw(e,t){return e.map((e,n)=>ww(e,t,`i:${n}`))}function Ew(e,t,n){let r=e.lang??`plaintext`,i=t.highlighter,a=i?void 0:!t.components?.code&&t.extensions?.some(e=>e.name===`streaming`)?e.value.match(/(?:[^\n]*\n){1,4}|[^\n]+$/g):e.value,o=i?{dangerouslySetInnerHTML:{__html:i(e.value,r,{...e.meta&&{meta:e.meta},...e.highlightLines&&{highlightLines:e.highlightLines},...t.codeLineNumbers!==void 0&&{lineNumbers:t.codeLineNumbers}})}}:void 0,s=Mw(t,`pre`,{key:n,className:`tm-code${t.codeLineNumbers?` tm-code--line-numbers`:``}`,"data-lang":r,...e.meta&&{"data-meta":e.meta},...e.title&&{"data-code-title":e.title},...e.file&&{"data-filename":e.file},...e.framework&&{"data-framework":e.framework}},Mw(t,`code`,{className:`language-${r}`,...o},a));return e.title?Mw(t,`figure`,{key:n,className:`tm-code-frame`,"data-lang":r},Mw(t,`figcaption`,null,e.title),s):s}function Dw(e,t,n,r,i){let a=t===void 0?[]:[Mw(r,`input`,{key:`${i}:checkbox`,type:`checkbox`,disabled:!0,checked:t,readOnly:!0}),` `];for(let t=0;t<e.length;t++){let o=e[t];if(o.type===`paragraph`&&(!n||t===0)){for(let e of Tw(o.children,r))a.push(e);n&&(a=[Mw(r,`p`,{key:`${i}:paragraph`},a)])}else a.push(Cw(o,r,`${i}:${t}`))}return a}function Ow(e,t,n,r,i){return Mw(r,e,{key:i,...n&&{style:{textAlign:n}}},Tw(t.children,r))}function kw(e,t,n){return Mw(t,`section`,{key:n,"data-footnotes":``,className:`footnotes`},Mw(t,`h2`,{id:`footnote-label`,className:`sr-only`},`Footnotes`,Pw(`footnote-label`,t)),Mw(t,`ol`,null,e.map(e=>Mw(t,`li`,{key:e.id,id:`user-content-fn-${e.id}`},Aw(e,t)))))}function Aw(e,t){let n=e.children.length-1,r=jw(e,t),i=e.children.map((e,i)=>i===n&&e.type===`paragraph`?Mw(t,`p`,{key:i},Tw(e.children,t),r):Cw(e,t,`${i}`));return e.children[n]?.type!==`paragraph`&&i.push(Mw(t,`p`,{key:`backref-wrapper`},r.slice(1))),i}function jw(e,t){let n=[];for(let r=1;r<=(e.referenceCount??1);r++){let i=_C(e.id,r),a=r===1?`${e.number}`:`${e.number}-${r}`;n.push(` `,Mw(t,`a`,{key:r,"data-footnote-backref":``,"aria-label":`Back to reference ${a}`,className:`data-footnote-backref`,href:`#user-content-fnref-${i}`},`↩`))}return n}function Mw(e,t,n,...r){let i=typeof t==`string`?e.components?.[t]??t:t;return(0,D.createElement)(i,n,...r)}function Nw(e,t,n){let r=e.tagName??(e.type===`inlineComponent`?`span`:`md-comment-component`),i={...e.properties};return e.tagName||(i[`data-component`]=e.name,i[`data-attributes`]||=JSON.stringify(e.attributes)),Mw(t,r,{key:n,...i},e.type===`inlineComponent`?Tw(e.children,t):e.children.map((e,r)=>Cw(e,t,`${n}:${r}`)))}function Pw(e,t){if(!e||!t.headingAnchors)return null;let n=typeof t.headingAnchors==`object`?t.headingAnchors:{};return Mw(t,`a`,{href:`#${e}`,"aria-hidden":n.ariaHidden??!0,className:n.className??`anchor-heading anchor-heading-link`,tabIndex:n.tabIndex??-1},n.content??`#`)}function Fw(e){return e}function Iw({fallbackLanguage:e=`plaintext`,languages:t}){let n=new Map,r=new Map;for(let e of t){let t=Vw(e.name);n.set(t,e),r.set(t,t);for(let n of e.aliases||[])r.set(Vw(n),t)}let i=Vw(e);function a(e){return r.get(Vw(e||i))||i}function o(e,t,i=0){let s=n.get(a(t));return!s||i>24?[]:Hw(e.length,s.tokenize(e,{hasLanguage(e){let t=r.get(Vw(e));return!!(t&&n.has(t))},tokenize(e,t){return o(e,t,i+1)}}))}function s(e,t={}){let n=a(t.lang),r=o(e,n);return{code:e,lang:n,tokens:r.length?Uw(e,r):[{value:e}]}}function c(e,t={}){let n=s(e,t),r=Rw(Lw(n.tokens,t));return{...n,html:`<pre class="th-code th-code--${Bw(n.lang)}${t.lineNumbers?` th-code--line-numbers`:``}" data-language="${Bw(n.lang)}"><code>${r}</code></pre>`}}function l({code:e,decorations:t,lang:n,lineNumbers:r,title:i}){let a=e.trimEnd(),o=c(a,{decorations:t,lang:n,lineNumbers:r});return{copyText:a,htmlMarkup:o.html,lang:o.lang,title:i,tokens:o.tokens}}return{highlight:c,highlightToHtml(e,t={}){return c(e,t).html},listLanguages(){return[...n.keys()]},normalizeLanguage:a,renderCodeBlockData:l,tokenize:s}}function Lw(e,t={}){let n=[],r=[];for(let e of t.decorations||[])e.range?n.push(e):r.push(e);let i=!!(t.lineNumbers||r.length),a={index:0,offset:0};if(!i)return Ww(e,0,1/0,n,a);let o=e.map(e=>e.value).join(``),s=[],c=Gw(o);for(let t=0;t<c.length;t++){let i=t+1,l=c[t],u=c[t+1]??o.length,d=u>l&&o[u-1]===`
|
|
77
|
-
`,f=d?u-1:u,p=r.filter(e=>
|
|
78
|
-
`})}return s}function
|
|
79
|
-
`&&n+1<e.length&&t.push(n+1);return t}function
|
|
80
|
-
`,t-1)+1,t)))return!0;let r=e.slice(0,t).trimEnd();return!r||/\b(?:return|case|yield)$/.test(r)?!0:/(?:[=([{,:;!&|?]|>)$/.test(r)}function
|
|
81
|
-
`;)if(e[r]===`\\`)r+=2;else if(e[r]===`[`)n=!0,r++;else if(e[r]===`]`)n=!1,r++;else if(e[r]===`/`&&!n){for(r++;/[a-z]/i.test(e[r]||``);)r++;return r}else r++;return t+1}function
|
|
82
|
-
`)return i;else i++;return e.length}function
|
|
83
|
-
`,t);return n<0?e.length:n}function
|
|
84
|
-
`,i.index+i[0].length);if(o<0)break;let s=RegExp(`^ {0,3}${a[0]}{${a.length},}\\s*$`,`gm`);s.lastIndex=o+1;let c=s.exec(e),l=c?.index??e.length,u=i[3].trim().split(/\s+/)[0],d=u&&t.hasLanguage(u)?
|
|
68
|
+
`),i=i.slice(e+1))}let o=PC(i);i=o.lines;let s=[],c=Object.create(null),l=Object.keys(o.references).length>0,u=Object.keys(o.footnotes).length>0,d=l||u?{...t,...l&&{references:o.references},...u&&{footnotes:o.footnotes,footnoteOrder:s,footnoteCounts:c}}:t,f=cC(),p=MC(i,d,f).parse();u&&s.length>0&&p.push(FC(o.footnotes,s,d,f));let m=a===void 0?{type:`root`,children:p}:{type:`root`,frontmatter:a,children:p};for(let e of d.extensions??[])m=e.transformDocument?.(m,{options:d})??m;return m}function MC(e,t,n,r={depth:0}){let i=0,a=!1;return{parse:o,get loose(){return a}};function o(){if(r.depth>=AC){let n=e.slice(i).join(`
|
|
69
|
+
`);return i=e.length,n?[{type:`paragraph`,children:hC(n,t)}]:[]}r.depth++;let n=[];for(;i<e.length;){if(aC(_())){n.length&&(a=!0),i++;continue}let e=s();if(e){n.push(e);continue}let t=(/^[a-z]/i.test(_())?void 0:c()??l()??u()??d()??f())??p()??m()??h();n.push(t)}return r.depth--,n}function s(){for(let a of t.extensions??[]){let o=0,s=a.parseBlock?.({lines:e,index:i,options:t,parseInline:e=>hC(e,t),parseBlocks:e=>MC(iC(e).split(`
|
|
70
|
+
`),t,n,r).parse(),consume:e=>{o=e}});if(s)return i+=Math.max(o,1),s}}function c(){let t=_().match(/^( {0,3})(`{3,}|~{3,})(.*)$/);if(!t)return;let n=t[2],r=t[3].trim(),a=[];for(i++;i<e.length;){let e=_();if(e.includes(n)&&/^ {0,3}(?:`+|~+)\s*$/.test(e)){i++;break}a.push(oC(e,t[1].length)),i++}return{type:`code`,value:a.join(`
|
|
71
|
+
`),...NC(r)}}function l(){let e=_().match(/^ {0,3}(#{1,6})(?:[ \t]+(.*)|[ \t]*)$/);if(!e)return;let n=e[1].length,r=e[2]??``,a=hC((/^#+[ \t]*$/.test(r)?``:r.replace(/[ \t]+#+[ \t]*$/,``)).trim(),t),o=g(a);return i++,o?{type:`heading`,depth:n,id:o,children:a}:{type:`heading`,depth:n,children:a}}function u(){if(/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(_()))return i++,{type:`thematicBreak`}}function d(){if(!/^ {0,3}>\s?/.test(_()))return;let o=[];for(;i<e.length;){let e=_(),t=e.match(/^ {0,3}>\s?(.*)$/);if(!t){if(!aC(e))break;a=!0}o.push(t?.[1]??``),i++}return{type:`blockquote`,children:MC(o,t,n,r).parse()}}function f(){let a=LC(_());if(!a)return;let o=[],s=a.ordered,c=a.indent,l=!1;for(;i<e.length;){let s=LC(_());if(!s||s.marker!==a.marker||s.indent!==c)break;let u=s.content,d=u.match(/^\[([ xX])\]\s+(.*)$/),f=d?d[1].toLowerCase()===`x`:void 0;d&&(u=d[2]);let p=[u];for(i++;i<e.length;){let t=_(),n=LC(t);if(n&&n.indent===c)break;if(aC(t)){let t=i;for(;t<e.length&&aC(e[t]);)t++;let n=e[t];if(n===void 0)break;let r=LC(n);if(r?.indent===c){if(r.marker!==a.marker)break;l=!0,i=t;break}if(RC(n)<s.contentIndent)break;for(;i<t;)p.push(oC(e[i++],s.contentIndent));continue}if(RC(t)>=s.contentIndent){p.push(oC(t,s.contentIndent)),i++;continue}if(zC(t,v()))break;p.push(t.trimStart()),i++}let m=MC(p,t,n,r),h=m.parse();l||=m.loose;let g={type:`listItem`,children:h};f!==void 0&&(g.checked=f),o.push(g)}return{type:`list`,ordered:s,...s&&{start:a.number},...l&&{loose:!0},items:o}}function p(){let n=_(),r=v();if(!r||!BC(n,r))return;let a=VC(n),o=VC(r).map(HC),s=a.length,c=[];for(i+=2;i<e.length;){let e=_();if(aC(e)||zC(e,v()))break;let n=VC(e);c.push(Array.from({length:s},(e,r)=>UC(n[r]??``,t))),i++}return{type:`table`,align:o,header:a.map(e=>UC(e,t)),rows:c}}function m(){if(!t.allowHtml||!/^ {0,3}<([A-Za-z][\w:-]*|!--|\/[A-Za-z])/.test(_()))return;let n=[];if(/^ {0,3}<!--/.test(_())){for(;i<e.length;){let e=_();if(n.push(e),i++,e.includes(`-->`))break}return{type:`html`,value:n.join(`
|
|
72
|
+
`)}}for(;i<e.length&&!aC(_());)n.push(_()),i++;return{type:`html`,value:n.join(`
|
|
73
|
+
`)}}function h(){let n=[];for(;i<e.length;){let e=_();if(aC(e)||n.length>0&&zC(e,v()))break;n.push(e.trim()),i++}return{type:`paragraph`,children:hC(n.join(`
|
|
74
|
+
`),t)}}function g(e){if(t.headingIds===!1)return;let r=sC(e);return typeof t.headingIds==`function`?t.headingIds(r,i):n(r)}function _(){return e[i]??``}function v(){return e[i+1]}}function NC(e){let t=e.match(/^([A-Za-z0-9_+.#-]+)/)?.[1],n=t?e.slice(t.length).trim():e,r=n.match(/(?:^|\s)(?:title|file)=(?:"([^"]+)"|'([^']+)'|([^\s}]+))/)?.slice(1).find(Boolean),i=n.match(/(?:^|\s)framework=(?:"([^"]+)"|'([^']+)'|([^\s}]+))/)?.slice(1).find(Boolean),a=n.match(/\{([^}]+)\}|(?:^|\s)lines=([^\s]+)/),o=a?IC(a[1]??a[2]):[];return{...t&&{lang:t},...n&&{meta:n},...r&&{title:r,file:r},...i&&{framework:i.toLowerCase()},...o.length&&{highlightLines:o}}}function PC(e){let t=Object.create(null),n=Object.create(null),r=cC(pC),i=[],a=``,o=0;for(;o<e.length;){let s=e[o],c=(!a||s.includes(a))&&s.match(/^ {0,3}(`{3,}|~{3,})(.*)$/);if(c)a?c[1].startsWith(a)&&aC(c[2])&&(a=``):a=c[1];else if(!a){let i=s.match(/^ {0,3}\[\^([^\]\n]+)\]:[ \t]*(.*)$/);if(i){let t=i[1],a=[i[2]??``];for(o++;o<e.length;){let t=e[o];if(!/^(?: {4,}|\t)/.test(t))break;a.push(t.replace(/^(?: {4}|\t)/,``)),o++}let s=fC(t);n[s]||(n[s]={label:t,content:a.join(`
|
|
75
|
+
`),id:r(t)});continue}let a=s.match(/^ {0,3}\[([^\]\n]+)\]:[ \t]*(\S.*)$/),c=a&&dC(a[2].trimEnd());if(c){t[fC(a[1])]??=c,o++;continue}}i.push(s),o++}return{lines:i,references:t,footnotes:n}}function FC(e,t,n,r){let i=[];for(let a=0;a<t.length;a++){let o=e[t[a]];o&&i.push({id:o.id??pC(o.label),number:a+1,children:MC(iC(o.content).split(`
|
|
76
|
+
`),n,r).parse()})}for(let e of i){let r=n.footnoteCounts?.[t[e.number-1]]??1;r>1&&(e.referenceCount=r)}return{type:`footnotes`,items:i}}function IC(e){let t=new Set;for(let n of e.split(`,`)){let e=n.trim().match(/^(\d+)(?:-(\d+))?$/);if(!e)continue;let r=Number(e[1]),i=Number(e[2]??e[1]);if(!(i>2**53-1))for(let e=r;e<=i&&e<r+1e3;e++)t.add(e)}return[...t].sort((e,t)=>e-t)}function LC(e){let t=e.match(/^(\s{0,8})([-+*]|\d{1,9}[.)])(?:([ \t]+)(.*))?$/);if(!t)return;let n=t[2],r=/\d/.test(n[0]);return{ordered:r,...r&&{number:Number.parseInt(n,10)},indent:t[1].length,marker:r?n.at(-1):n,contentIndent:t[1].length+n.length+(t[3]?.length??1),content:t[4]??``}}function RC(e){return e.match(/^ */)?.[0].length??0}function zC(e,t){let n=LC(e);return/^ {0,3}(?:`{3,}|~{3,}|#{1,6}(?:\s|$)|([-*_])(?:\s*\1){2,}\s*$|>)/.test(e)||n!==void 0&&(!n.ordered||n.number===1)||!!t&&BC(e,t)}function BC(e,t){if(!e.includes(`|`))return!1;let n=VC(t);return n.length===VC(e).length&&n.every(e=>/^:?-+:?$/.test(e.trim()))}function VC(e){let t=e.trim(),n=[],r=``;for(let e=+!!t.startsWith(`|`);e<t.length;e++){let i=t[e];if(i===`\\`&&t[e+1]===`|`){r+=`|`,e++;continue}if(i===`|`){n.push(r.trim()),r=``;continue}r+=i}return(r||!t.endsWith(`|`)||!n.length)&&n.push(r.trim()),n}function HC(e){let t=e.trim();if(t.startsWith(`:`)&&t.endsWith(`:`))return`center`;if(t.endsWith(`:`))return`right`;if(t.startsWith(`:`))return`left`}function UC(e,t){return{type:`tableCell`,children:hC(e,t)}}var WC;(function(e){e[e.EOF=-1]=`EOF`,e[e.NULL=0]=`NULL`,e[e.TABULATION=9]=`TABULATION`,e[e.CARRIAGE_RETURN=13]=`CARRIAGE_RETURN`,e[e.LINE_FEED=10]=`LINE_FEED`,e[e.FORM_FEED=12]=`FORM_FEED`,e[e.SPACE=32]=`SPACE`,e[e.EXCLAMATION_MARK=33]=`EXCLAMATION_MARK`,e[e.QUOTATION_MARK=34]=`QUOTATION_MARK`,e[e.AMPERSAND=38]=`AMPERSAND`,e[e.APOSTROPHE=39]=`APOSTROPHE`,e[e.HYPHEN_MINUS=45]=`HYPHEN_MINUS`,e[e.SOLIDUS=47]=`SOLIDUS`,e[e.DIGIT_0=48]=`DIGIT_0`,e[e.DIGIT_9=57]=`DIGIT_9`,e[e.SEMICOLON=59]=`SEMICOLON`,e[e.LESS_THAN_SIGN=60]=`LESS_THAN_SIGN`,e[e.EQUALS_SIGN=61]=`EQUALS_SIGN`,e[e.GREATER_THAN_SIGN=62]=`GREATER_THAN_SIGN`,e[e.QUESTION_MARK=63]=`QUESTION_MARK`,e[e.LATIN_CAPITAL_A=65]=`LATIN_CAPITAL_A`,e[e.LATIN_CAPITAL_Z=90]=`LATIN_CAPITAL_Z`,e[e.RIGHT_SQUARE_BRACKET=93]=`RIGHT_SQUARE_BRACKET`,e[e.GRAVE_ACCENT=96]=`GRAVE_ACCENT`,e[e.LATIN_SMALL_A=97]=`LATIN_SMALL_A`,e[e.LATIN_SMALL_Z=122]=`LATIN_SMALL_Z`})(WC||={});var GC;(function(e){e.controlCharacterInInputStream=`control-character-in-input-stream`,e.noncharacterInInputStream=`noncharacter-in-input-stream`,e.surrogateInInputStream=`surrogate-in-input-stream`,e.nonVoidHtmlElementStartTagWithTrailingSolidus=`non-void-html-element-start-tag-with-trailing-solidus`,e.endTagWithAttributes=`end-tag-with-attributes`,e.endTagWithTrailingSolidus=`end-tag-with-trailing-solidus`,e.unexpectedSolidusInTag=`unexpected-solidus-in-tag`,e.unexpectedNullCharacter=`unexpected-null-character`,e.unexpectedQuestionMarkInsteadOfTagName=`unexpected-question-mark-instead-of-tag-name`,e.invalidFirstCharacterOfTagName=`invalid-first-character-of-tag-name`,e.unexpectedEqualsSignBeforeAttributeName=`unexpected-equals-sign-before-attribute-name`,e.missingEndTagName=`missing-end-tag-name`,e.unexpectedCharacterInAttributeName=`unexpected-character-in-attribute-name`,e.unknownNamedCharacterReference=`unknown-named-character-reference`,e.missingSemicolonAfterCharacterReference=`missing-semicolon-after-character-reference`,e.unexpectedCharacterAfterDoctypeSystemIdentifier=`unexpected-character-after-doctype-system-identifier`,e.unexpectedCharacterInUnquotedAttributeValue=`unexpected-character-in-unquoted-attribute-value`,e.eofBeforeTagName=`eof-before-tag-name`,e.eofInTag=`eof-in-tag`,e.missingAttributeValue=`missing-attribute-value`,e.missingWhitespaceBetweenAttributes=`missing-whitespace-between-attributes`,e.missingWhitespaceAfterDoctypePublicKeyword=`missing-whitespace-after-doctype-public-keyword`,e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers=`missing-whitespace-between-doctype-public-and-system-identifiers`,e.missingWhitespaceAfterDoctypeSystemKeyword=`missing-whitespace-after-doctype-system-keyword`,e.missingQuoteBeforeDoctypePublicIdentifier=`missing-quote-before-doctype-public-identifier`,e.missingQuoteBeforeDoctypeSystemIdentifier=`missing-quote-before-doctype-system-identifier`,e.missingDoctypePublicIdentifier=`missing-doctype-public-identifier`,e.missingDoctypeSystemIdentifier=`missing-doctype-system-identifier`,e.abruptDoctypePublicIdentifier=`abrupt-doctype-public-identifier`,e.abruptDoctypeSystemIdentifier=`abrupt-doctype-system-identifier`,e.cdataInHtmlContent=`cdata-in-html-content`,e.incorrectlyOpenedComment=`incorrectly-opened-comment`,e.eofInScriptHtmlCommentLikeText=`eof-in-script-html-comment-like-text`,e.eofInDoctype=`eof-in-doctype`,e.nestedComment=`nested-comment`,e.abruptClosingOfEmptyComment=`abrupt-closing-of-empty-comment`,e.eofInComment=`eof-in-comment`,e.incorrectlyClosedComment=`incorrectly-closed-comment`,e.eofInCdata=`eof-in-cdata`,e.absenceOfDigitsInNumericCharacterReference=`absence-of-digits-in-numeric-character-reference`,e.nullCharacterReference=`null-character-reference`,e.surrogateCharacterReference=`surrogate-character-reference`,e.characterReferenceOutsideUnicodeRange=`character-reference-outside-unicode-range`,e.controlCharacterReference=`control-character-reference`,e.noncharacterCharacterReference=`noncharacter-character-reference`,e.missingWhitespaceBeforeDoctypeName=`missing-whitespace-before-doctype-name`,e.missingDoctypeName=`missing-doctype-name`,e.invalidCharacterSequenceAfterDoctypeName=`invalid-character-sequence-after-doctype-name`,e.duplicateAttribute=`duplicate-attribute`,e.nonConformingDoctype=`non-conforming-doctype`,e.missingDoctype=`missing-doctype`,e.misplacedDoctype=`misplaced-doctype`,e.endTagWithoutMatchingOpenElement=`end-tag-without-matching-open-element`,e.closingOfElementWithOpenChildElements=`closing-of-element-with-open-child-elements`,e.disallowedContentInNoscriptInHead=`disallowed-content-in-noscript-in-head`,e.openElementsLeftAfterEof=`open-elements-left-after-eof`,e.abandonedHeadElementChild=`abandoned-head-element-child`,e.misplacedStartTagForHeadElement=`misplaced-start-tag-for-head-element`,e.nestedNoscriptInHead=`nested-noscript-in-head`,e.eofInElementThatCanContainOnlyText=`eof-in-element-that-can-contain-only-text`})(GC||={});var KC;(function(e){e[e.CHARACTER=0]=`CHARACTER`,e[e.NULL_CHARACTER=1]=`NULL_CHARACTER`,e[e.WHITESPACE_CHARACTER=2]=`WHITESPACE_CHARACTER`,e[e.START_TAG=3]=`START_TAG`,e[e.END_TAG=4]=`END_TAG`,e[e.COMMENT=5]=`COMMENT`,e[e.DOCTYPE=6]=`DOCTYPE`,e[e.EOF=7]=`EOF`,e[e.HIBERNATION=8]=`HIBERNATION`})(KC||={});var qC;(function(e){e.HTML=`http://www.w3.org/1999/xhtml`,e.MATHML=`http://www.w3.org/1998/Math/MathML`,e.SVG=`http://www.w3.org/2000/svg`,e.XLINK=`http://www.w3.org/1999/xlink`,e.XML=`http://www.w3.org/XML/1998/namespace`,e.XMLNS=`http://www.w3.org/2000/xmlns/`})(qC||={});var JC;(function(e){e.TYPE=`type`,e.ACTION=`action`,e.ENCODING=`encoding`,e.PROMPT=`prompt`,e.NAME=`name`,e.COLOR=`color`,e.FACE=`face`,e.SIZE=`size`})(JC||={});var YC;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(YC||={});var Z;(function(e){e.A=`a`,e.ADDRESS=`address`,e.ANNOTATION_XML=`annotation-xml`,e.APPLET=`applet`,e.AREA=`area`,e.ARTICLE=`article`,e.ASIDE=`aside`,e.B=`b`,e.BASE=`base`,e.BASEFONT=`basefont`,e.BGSOUND=`bgsound`,e.BIG=`big`,e.BLOCKQUOTE=`blockquote`,e.BODY=`body`,e.BR=`br`,e.BUTTON=`button`,e.CAPTION=`caption`,e.CENTER=`center`,e.CODE=`code`,e.COL=`col`,e.COLGROUP=`colgroup`,e.DD=`dd`,e.DESC=`desc`,e.DETAILS=`details`,e.DIALOG=`dialog`,e.DIR=`dir`,e.DIV=`div`,e.DL=`dl`,e.DT=`dt`,e.EM=`em`,e.EMBED=`embed`,e.FIELDSET=`fieldset`,e.FIGCAPTION=`figcaption`,e.FIGURE=`figure`,e.FONT=`font`,e.FOOTER=`footer`,e.FOREIGN_OBJECT=`foreignObject`,e.FORM=`form`,e.FRAME=`frame`,e.FRAMESET=`frameset`,e.H1=`h1`,e.H2=`h2`,e.H3=`h3`,e.H4=`h4`,e.H5=`h5`,e.H6=`h6`,e.HEAD=`head`,e.HEADER=`header`,e.HGROUP=`hgroup`,e.HR=`hr`,e.HTML=`html`,e.I=`i`,e.IMG=`img`,e.IMAGE=`image`,e.INPUT=`input`,e.IFRAME=`iframe`,e.KEYGEN=`keygen`,e.LABEL=`label`,e.LI=`li`,e.LINK=`link`,e.LISTING=`listing`,e.MAIN=`main`,e.MALIGNMARK=`malignmark`,e.MARQUEE=`marquee`,e.MATH=`math`,e.MENU=`menu`,e.META=`meta`,e.MGLYPH=`mglyph`,e.MI=`mi`,e.MO=`mo`,e.MN=`mn`,e.MS=`ms`,e.MTEXT=`mtext`,e.NAV=`nav`,e.NOBR=`nobr`,e.NOFRAMES=`noframes`,e.NOEMBED=`noembed`,e.NOSCRIPT=`noscript`,e.OBJECT=`object`,e.OL=`ol`,e.OPTGROUP=`optgroup`,e.OPTION=`option`,e.P=`p`,e.PARAM=`param`,e.PLAINTEXT=`plaintext`,e.PRE=`pre`,e.RB=`rb`,e.RP=`rp`,e.RT=`rt`,e.RTC=`rtc`,e.RUBY=`ruby`,e.S=`s`,e.SCRIPT=`script`,e.SEARCH=`search`,e.SECTION=`section`,e.SELECT=`select`,e.SOURCE=`source`,e.SMALL=`small`,e.SPAN=`span`,e.STRIKE=`strike`,e.STRONG=`strong`,e.STYLE=`style`,e.SUB=`sub`,e.SUMMARY=`summary`,e.SUP=`sup`,e.TABLE=`table`,e.TBODY=`tbody`,e.TEMPLATE=`template`,e.TEXTAREA=`textarea`,e.TFOOT=`tfoot`,e.TD=`td`,e.TH=`th`,e.THEAD=`thead`,e.TITLE=`title`,e.TR=`tr`,e.TRACK=`track`,e.TT=`tt`,e.U=`u`,e.UL=`ul`,e.SVG=`svg`,e.VAR=`var`,e.WBR=`wbr`,e.XMP=`xmp`})(Z||={});var Q;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.A=1]=`A`,e[e.ADDRESS=2]=`ADDRESS`,e[e.ANNOTATION_XML=3]=`ANNOTATION_XML`,e[e.APPLET=4]=`APPLET`,e[e.AREA=5]=`AREA`,e[e.ARTICLE=6]=`ARTICLE`,e[e.ASIDE=7]=`ASIDE`,e[e.B=8]=`B`,e[e.BASE=9]=`BASE`,e[e.BASEFONT=10]=`BASEFONT`,e[e.BGSOUND=11]=`BGSOUND`,e[e.BIG=12]=`BIG`,e[e.BLOCKQUOTE=13]=`BLOCKQUOTE`,e[e.BODY=14]=`BODY`,e[e.BR=15]=`BR`,e[e.BUTTON=16]=`BUTTON`,e[e.CAPTION=17]=`CAPTION`,e[e.CENTER=18]=`CENTER`,e[e.CODE=19]=`CODE`,e[e.COL=20]=`COL`,e[e.COLGROUP=21]=`COLGROUP`,e[e.DD=22]=`DD`,e[e.DESC=23]=`DESC`,e[e.DETAILS=24]=`DETAILS`,e[e.DIALOG=25]=`DIALOG`,e[e.DIR=26]=`DIR`,e[e.DIV=27]=`DIV`,e[e.DL=28]=`DL`,e[e.DT=29]=`DT`,e[e.EM=30]=`EM`,e[e.EMBED=31]=`EMBED`,e[e.FIELDSET=32]=`FIELDSET`,e[e.FIGCAPTION=33]=`FIGCAPTION`,e[e.FIGURE=34]=`FIGURE`,e[e.FONT=35]=`FONT`,e[e.FOOTER=36]=`FOOTER`,e[e.FOREIGN_OBJECT=37]=`FOREIGN_OBJECT`,e[e.FORM=38]=`FORM`,e[e.FRAME=39]=`FRAME`,e[e.FRAMESET=40]=`FRAMESET`,e[e.H1=41]=`H1`,e[e.H2=42]=`H2`,e[e.H3=43]=`H3`,e[e.H4=44]=`H4`,e[e.H5=45]=`H5`,e[e.H6=46]=`H6`,e[e.HEAD=47]=`HEAD`,e[e.HEADER=48]=`HEADER`,e[e.HGROUP=49]=`HGROUP`,e[e.HR=50]=`HR`,e[e.HTML=51]=`HTML`,e[e.I=52]=`I`,e[e.IMG=53]=`IMG`,e[e.IMAGE=54]=`IMAGE`,e[e.INPUT=55]=`INPUT`,e[e.IFRAME=56]=`IFRAME`,e[e.KEYGEN=57]=`KEYGEN`,e[e.LABEL=58]=`LABEL`,e[e.LI=59]=`LI`,e[e.LINK=60]=`LINK`,e[e.LISTING=61]=`LISTING`,e[e.MAIN=62]=`MAIN`,e[e.MALIGNMARK=63]=`MALIGNMARK`,e[e.MARQUEE=64]=`MARQUEE`,e[e.MATH=65]=`MATH`,e[e.MENU=66]=`MENU`,e[e.META=67]=`META`,e[e.MGLYPH=68]=`MGLYPH`,e[e.MI=69]=`MI`,e[e.MO=70]=`MO`,e[e.MN=71]=`MN`,e[e.MS=72]=`MS`,e[e.MTEXT=73]=`MTEXT`,e[e.NAV=74]=`NAV`,e[e.NOBR=75]=`NOBR`,e[e.NOFRAMES=76]=`NOFRAMES`,e[e.NOEMBED=77]=`NOEMBED`,e[e.NOSCRIPT=78]=`NOSCRIPT`,e[e.OBJECT=79]=`OBJECT`,e[e.OL=80]=`OL`,e[e.OPTGROUP=81]=`OPTGROUP`,e[e.OPTION=82]=`OPTION`,e[e.P=83]=`P`,e[e.PARAM=84]=`PARAM`,e[e.PLAINTEXT=85]=`PLAINTEXT`,e[e.PRE=86]=`PRE`,e[e.RB=87]=`RB`,e[e.RP=88]=`RP`,e[e.RT=89]=`RT`,e[e.RTC=90]=`RTC`,e[e.RUBY=91]=`RUBY`,e[e.S=92]=`S`,e[e.SCRIPT=93]=`SCRIPT`,e[e.SEARCH=94]=`SEARCH`,e[e.SECTION=95]=`SECTION`,e[e.SELECT=96]=`SELECT`,e[e.SOURCE=97]=`SOURCE`,e[e.SMALL=98]=`SMALL`,e[e.SPAN=99]=`SPAN`,e[e.STRIKE=100]=`STRIKE`,e[e.STRONG=101]=`STRONG`,e[e.STYLE=102]=`STYLE`,e[e.SUB=103]=`SUB`,e[e.SUMMARY=104]=`SUMMARY`,e[e.SUP=105]=`SUP`,e[e.TABLE=106]=`TABLE`,e[e.TBODY=107]=`TBODY`,e[e.TEMPLATE=108]=`TEMPLATE`,e[e.TEXTAREA=109]=`TEXTAREA`,e[e.TFOOT=110]=`TFOOT`,e[e.TD=111]=`TD`,e[e.TH=112]=`TH`,e[e.THEAD=113]=`THEAD`,e[e.TITLE=114]=`TITLE`,e[e.TR=115]=`TR`,e[e.TRACK=116]=`TRACK`,e[e.TT=117]=`TT`,e[e.U=118]=`U`,e[e.UL=119]=`UL`,e[e.SVG=120]=`SVG`,e[e.VAR=121]=`VAR`,e[e.WBR=122]=`WBR`,e[e.XMP=123]=`XMP`})(Q||={}),Z.A,Q.A,Z.ADDRESS,Q.ADDRESS,Z.ANNOTATION_XML,Q.ANNOTATION_XML,Z.APPLET,Q.APPLET,Z.AREA,Q.AREA,Z.ARTICLE,Q.ARTICLE,Z.ASIDE,Q.ASIDE,Z.B,Q.B,Z.BASE,Q.BASE,Z.BASEFONT,Q.BASEFONT,Z.BGSOUND,Q.BGSOUND,Z.BIG,Q.BIG,Z.BLOCKQUOTE,Q.BLOCKQUOTE,Z.BODY,Q.BODY,Z.BR,Q.BR,Z.BUTTON,Q.BUTTON,Z.CAPTION,Q.CAPTION,Z.CENTER,Q.CENTER,Z.CODE,Q.CODE,Z.COL,Q.COL,Z.COLGROUP,Q.COLGROUP,Z.DD,Q.DD,Z.DESC,Q.DESC,Z.DETAILS,Q.DETAILS,Z.DIALOG,Q.DIALOG,Z.DIR,Q.DIR,Z.DIV,Q.DIV,Z.DL,Q.DL,Z.DT,Q.DT,Z.EM,Q.EM,Z.EMBED,Q.EMBED,Z.FIELDSET,Q.FIELDSET,Z.FIGCAPTION,Q.FIGCAPTION,Z.FIGURE,Q.FIGURE,Z.FONT,Q.FONT,Z.FOOTER,Q.FOOTER,Z.FOREIGN_OBJECT,Q.FOREIGN_OBJECT,Z.FORM,Q.FORM,Z.FRAME,Q.FRAME,Z.FRAMESET,Q.FRAMESET,Z.H1,Q.H1,Z.H2,Q.H2,Z.H3,Q.H3,Z.H4,Q.H4,Z.H5,Q.H5,Z.H6,Q.H6,Z.HEAD,Q.HEAD,Z.HEADER,Q.HEADER,Z.HGROUP,Q.HGROUP,Z.HR,Q.HR,Z.HTML,Q.HTML,Z.I,Q.I,Z.IMG,Q.IMG,Z.IMAGE,Q.IMAGE,Z.INPUT,Q.INPUT,Z.IFRAME,Q.IFRAME,Z.KEYGEN,Q.KEYGEN,Z.LABEL,Q.LABEL,Z.LI,Q.LI,Z.LINK,Q.LINK,Z.LISTING,Q.LISTING,Z.MAIN,Q.MAIN,Z.MALIGNMARK,Q.MALIGNMARK,Z.MARQUEE,Q.MARQUEE,Z.MATH,Q.MATH,Z.MENU,Q.MENU,Z.META,Q.META,Z.MGLYPH,Q.MGLYPH,Z.MI,Q.MI,Z.MO,Q.MO,Z.MN,Q.MN,Z.MS,Q.MS,Z.MTEXT,Q.MTEXT,Z.NAV,Q.NAV,Z.NOBR,Q.NOBR,Z.NOFRAMES,Q.NOFRAMES,Z.NOEMBED,Q.NOEMBED,Z.NOSCRIPT,Q.NOSCRIPT,Z.OBJECT,Q.OBJECT,Z.OL,Q.OL,Z.OPTGROUP,Q.OPTGROUP,Z.OPTION,Q.OPTION,Z.P,Q.P,Z.PARAM,Q.PARAM,Z.PLAINTEXT,Q.PLAINTEXT,Z.PRE,Q.PRE,Z.RB,Q.RB,Z.RP,Q.RP,Z.RT,Q.RT,Z.RTC,Q.RTC,Z.RUBY,Q.RUBY,Z.S,Q.S,Z.SCRIPT,Q.SCRIPT,Z.SEARCH,Q.SEARCH,Z.SECTION,Q.SECTION,Z.SELECT,Q.SELECT,Z.SOURCE,Q.SOURCE,Z.SMALL,Q.SMALL,Z.SPAN,Q.SPAN,Z.STRIKE,Q.STRIKE,Z.STRONG,Q.STRONG,Z.STYLE,Q.STYLE,Z.SUB,Q.SUB,Z.SUMMARY,Q.SUMMARY,Z.SUP,Q.SUP,Z.TABLE,Q.TABLE,Z.TBODY,Q.TBODY,Z.TEMPLATE,Q.TEMPLATE,Z.TEXTAREA,Q.TEXTAREA,Z.TFOOT,Q.TFOOT,Z.TD,Q.TD,Z.TH,Q.TH,Z.THEAD,Q.THEAD,Z.TITLE,Q.TITLE,Z.TR,Q.TR,Z.TRACK,Q.TRACK,Z.TT,Q.TT,Z.U,Q.U,Z.UL,Q.UL,Z.SVG,Q.SVG,Z.VAR,Q.VAR,Z.WBR,Q.WBR,Z.XMP,Q.XMP;var $=Q;qC.HTML,$.ADDRESS,$.APPLET,$.AREA,$.ARTICLE,$.ASIDE,$.BASE,$.BASEFONT,$.BGSOUND,$.BLOCKQUOTE,$.BODY,$.BR,$.BUTTON,$.CAPTION,$.CENTER,$.COL,$.COLGROUP,$.DD,$.DETAILS,$.DIR,$.DIV,$.DL,$.DT,$.EMBED,$.FIELDSET,$.FIGCAPTION,$.FIGURE,$.FOOTER,$.FORM,$.FRAME,$.FRAMESET,$.H1,$.H2,$.H3,$.H4,$.H5,$.H6,$.HEAD,$.HEADER,$.HGROUP,$.HR,$.HTML,$.IFRAME,$.IMG,$.INPUT,$.LI,$.LINK,$.LISTING,$.MAIN,$.MARQUEE,$.MENU,$.META,$.NAV,$.NOEMBED,$.NOFRAMES,$.NOSCRIPT,$.OBJECT,$.OL,$.P,$.PARAM,$.PLAINTEXT,$.PRE,$.SCRIPT,$.SECTION,$.SELECT,$.SOURCE,$.STYLE,$.SUMMARY,$.TABLE,$.TBODY,$.TD,$.TEMPLATE,$.TEXTAREA,$.TFOOT,$.TH,$.THEAD,$.TITLE,$.TR,$.TRACK,$.UL,$.WBR,$.XMP,qC.MATHML,$.MI,$.MO,$.MN,$.MS,$.MTEXT,$.ANNOTATION_XML,qC.SVG,$.TITLE,$.FOREIGN_OBJECT,$.DESC,qC.XLINK,qC.XML,qC.XMLNS,$.H1,$.H2,$.H3,$.H4,$.H5,$.H6,Z.STYLE,Z.SCRIPT,Z.XMP,Z.IFRAME,Z.NOEMBED,Z.NOFRAMES,Z.PLAINTEXT;var XC;(function(e){e[e.DATA=0]=`DATA`,e[e.RCDATA=1]=`RCDATA`,e[e.RAWTEXT=2]=`RAWTEXT`,e[e.SCRIPT_DATA=3]=`SCRIPT_DATA`,e[e.PLAINTEXT=4]=`PLAINTEXT`,e[e.TAG_OPEN=5]=`TAG_OPEN`,e[e.END_TAG_OPEN=6]=`END_TAG_OPEN`,e[e.TAG_NAME=7]=`TAG_NAME`,e[e.RCDATA_LESS_THAN_SIGN=8]=`RCDATA_LESS_THAN_SIGN`,e[e.RCDATA_END_TAG_OPEN=9]=`RCDATA_END_TAG_OPEN`,e[e.RCDATA_END_TAG_NAME=10]=`RCDATA_END_TAG_NAME`,e[e.RAWTEXT_LESS_THAN_SIGN=11]=`RAWTEXT_LESS_THAN_SIGN`,e[e.RAWTEXT_END_TAG_OPEN=12]=`RAWTEXT_END_TAG_OPEN`,e[e.RAWTEXT_END_TAG_NAME=13]=`RAWTEXT_END_TAG_NAME`,e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]=`SCRIPT_DATA_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_END_TAG_OPEN=15]=`SCRIPT_DATA_END_TAG_OPEN`,e[e.SCRIPT_DATA_END_TAG_NAME=16]=`SCRIPT_DATA_END_TAG_NAME`,e[e.SCRIPT_DATA_ESCAPE_START=17]=`SCRIPT_DATA_ESCAPE_START`,e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]=`SCRIPT_DATA_ESCAPE_START_DASH`,e[e.SCRIPT_DATA_ESCAPED=19]=`SCRIPT_DATA_ESCAPED`,e[e.SCRIPT_DATA_ESCAPED_DASH=20]=`SCRIPT_DATA_ESCAPED_DASH`,e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]=`SCRIPT_DATA_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]=`SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]=`SCRIPT_DATA_ESCAPED_END_TAG_OPEN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]=`SCRIPT_DATA_ESCAPED_END_TAG_NAME`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]=`SCRIPT_DATA_DOUBLE_ESCAPE_START`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]=`SCRIPT_DATA_DOUBLE_ESCAPED`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]=`SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]=`SCRIPT_DATA_DOUBLE_ESCAPE_END`,e[e.BEFORE_ATTRIBUTE_NAME=31]=`BEFORE_ATTRIBUTE_NAME`,e[e.ATTRIBUTE_NAME=32]=`ATTRIBUTE_NAME`,e[e.AFTER_ATTRIBUTE_NAME=33]=`AFTER_ATTRIBUTE_NAME`,e[e.BEFORE_ATTRIBUTE_VALUE=34]=`BEFORE_ATTRIBUTE_VALUE`,e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]=`ATTRIBUTE_VALUE_DOUBLE_QUOTED`,e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]=`ATTRIBUTE_VALUE_SINGLE_QUOTED`,e[e.ATTRIBUTE_VALUE_UNQUOTED=37]=`ATTRIBUTE_VALUE_UNQUOTED`,e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]=`AFTER_ATTRIBUTE_VALUE_QUOTED`,e[e.SELF_CLOSING_START_TAG=39]=`SELF_CLOSING_START_TAG`,e[e.BOGUS_COMMENT=40]=`BOGUS_COMMENT`,e[e.MARKUP_DECLARATION_OPEN=41]=`MARKUP_DECLARATION_OPEN`,e[e.COMMENT_START=42]=`COMMENT_START`,e[e.COMMENT_START_DASH=43]=`COMMENT_START_DASH`,e[e.COMMENT=44]=`COMMENT`,e[e.COMMENT_LESS_THAN_SIGN=45]=`COMMENT_LESS_THAN_SIGN`,e[e.COMMENT_LESS_THAN_SIGN_BANG=46]=`COMMENT_LESS_THAN_SIGN_BANG`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]=`COMMENT_LESS_THAN_SIGN_BANG_DASH`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]=`COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH`,e[e.COMMENT_END_DASH=49]=`COMMENT_END_DASH`,e[e.COMMENT_END=50]=`COMMENT_END`,e[e.COMMENT_END_BANG=51]=`COMMENT_END_BANG`,e[e.DOCTYPE=52]=`DOCTYPE`,e[e.BEFORE_DOCTYPE_NAME=53]=`BEFORE_DOCTYPE_NAME`,e[e.DOCTYPE_NAME=54]=`DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_NAME=55]=`AFTER_DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]=`AFTER_DOCTYPE_PUBLIC_KEYWORD`,e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]=`BEFORE_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]=`DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]=`DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]=`AFTER_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]=`BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS`,e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]=`AFTER_DOCTYPE_SYSTEM_KEYWORD`,e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]=`BEFORE_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]=`DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]=`DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]=`AFTER_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.BOGUS_DOCTYPE=67]=`BOGUS_DOCTYPE`,e[e.CDATA_SECTION=68]=`CDATA_SECTION`,e[e.CDATA_SECTION_BRACKET=69]=`CDATA_SECTION_BRACKET`,e[e.CDATA_SECTION_END=70]=`CDATA_SECTION_END`,e[e.CHARACTER_REFERENCE=71]=`CHARACTER_REFERENCE`,e[e.AMBIGUOUS_AMPERSAND=72]=`AMBIGUOUS_AMPERSAND`})(XC||={}),XC.DATA,XC.RCDATA,XC.RAWTEXT,XC.SCRIPT_DATA,XC.PLAINTEXT,XC.CDATA_SECTION,[...new Set([Q.DD,Q.DT,Q.LI,Q.OPTGROUP,Q.OPTION,Q.P,Q.RB,Q.RP,Q.RT,Q.RTC]),Q.CAPTION,Q.COLGROUP,Q.TBODY,Q.TD,Q.TFOOT,Q.TH,Q.THEAD,Q.TR];var ZC=new Set([Q.APPLET,Q.CAPTION,Q.HTML,Q.MARQUEE,Q.OBJECT,Q.TABLE,Q.TD,Q.TEMPLATE,Q.TH]);[...ZC,Q.OL,Q.UL],[...ZC,Q.BUTTON],Q.ANNOTATION_XML,Q.MI,Q.MN,Q.MO,Q.MS,Q.MTEXT,Q.DESC,Q.FOREIGN_OBJECT,Q.TITLE,Q.TR,Q.TEMPLATE,Q.HTML,Q.TBODY,Q.TFOOT,Q.THEAD,Q.TEMPLATE,Q.HTML,Q.TABLE,Q.TEMPLATE,Q.HTML,Q.TD,Q.TH;var QC;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(QC||={}),QC.Marker,[...`+//silmaril//dtd html pro v0r11 19970101//,-//as//dtd html 3.0 aswedit + extensions//,-//advasoft ltd//dtd html 3.0 aswedit + extensions//,-//ietf//dtd html 2.0 level 1//,-//ietf//dtd html 2.0 level 2//,-//ietf//dtd html 2.0 strict level 1//,-//ietf//dtd html 2.0 strict level 2//,-//ietf//dtd html 2.0 strict//,-//ietf//dtd html 2.0//,-//ietf//dtd html 2.1e//,-//ietf//dtd html 3.0//,-//ietf//dtd html 3.2 final//,-//ietf//dtd html 3.2//,-//ietf//dtd html 3//,-//ietf//dtd html level 0//,-//ietf//dtd html level 1//,-//ietf//dtd html level 2//,-//ietf//dtd html level 3//,-//ietf//dtd html strict level 0//,-//ietf//dtd html strict level 1//,-//ietf//dtd html strict level 2//,-//ietf//dtd html strict level 3//,-//ietf//dtd html strict//,-//ietf//dtd html//,-//metrius//dtd metrius presentational//,-//microsoft//dtd internet explorer 2.0 html strict//,-//microsoft//dtd internet explorer 2.0 html//,-//microsoft//dtd internet explorer 2.0 tables//,-//microsoft//dtd internet explorer 3.0 html strict//,-//microsoft//dtd internet explorer 3.0 html//,-//microsoft//dtd internet explorer 3.0 tables//,-//netscape comm. corp.//dtd html//,-//netscape comm. corp.//dtd strict html//,-//o'reilly and associates//dtd html 2.0//,-//o'reilly and associates//dtd html extended 1.0//,-//o'reilly and associates//dtd html extended relaxed 1.0//,-//sq//dtd html 2.0 hotmetal + extensions//,-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//,-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//,-//spyglass//dtd html 2.0 extended//,-//sun microsystems corp.//dtd hotjava html//,-//sun microsystems corp.//dtd hotjava strict html//,-//w3c//dtd html 3 1995-03-24//,-//w3c//dtd html 3.2 draft//,-//w3c//dtd html 3.2 final//,-//w3c//dtd html 3.2//,-//w3c//dtd html 3.2s draft//,-//w3c//dtd html 4.0 frameset//,-//w3c//dtd html 4.0 transitional//,-//w3c//dtd html experimental 19960712//,-//w3c//dtd html experimental 970421//,-//w3c//dtd w3 html//,-//w3o//dtd w3 html 3.0//,-//webtechs//dtd mozilla html 2.0//,-//webtechs//dtd mozilla html//`.split(`,`)],new Map(`attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`).map(e=>[e.toLowerCase(),e])),qC.XLINK,qC.XLINK,qC.XLINK,qC.XLINK,qC.XLINK,qC.XLINK,qC.XLINK,qC.XML,qC.XML,qC.XMLNS,qC.XMLNS,new Map(`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`).map(e=>[e.toLowerCase(),e])),Q.B,Q.BIG,Q.BLOCKQUOTE,Q.BODY,Q.BR,Q.CENTER,Q.CODE,Q.DD,Q.DIV,Q.DL,Q.DT,Q.EM,Q.EMBED,Q.H1,Q.H2,Q.H3,Q.H4,Q.H5,Q.H6,Q.HEAD,Q.HR,Q.I,Q.IMG,Q.LI,Q.LISTING,Q.MENU,Q.META,Q.NOBR,Q.OL,Q.P,Q.PRE,Q.RUBY,Q.S,Q.SMALL,Q.SPAN,Q.STRONG,Q.STRIKE,Q.SUB,Q.SUP,Q.TABLE,Q.TT,Q.U,Q.UL,Q.VAR;var $C;(function(e){e[e.INITIAL=0]=`INITIAL`,e[e.BEFORE_HTML=1]=`BEFORE_HTML`,e[e.BEFORE_HEAD=2]=`BEFORE_HEAD`,e[e.IN_HEAD=3]=`IN_HEAD`,e[e.IN_HEAD_NO_SCRIPT=4]=`IN_HEAD_NO_SCRIPT`,e[e.AFTER_HEAD=5]=`AFTER_HEAD`,e[e.IN_BODY=6]=`IN_BODY`,e[e.TEXT=7]=`TEXT`,e[e.IN_TABLE=8]=`IN_TABLE`,e[e.IN_TABLE_TEXT=9]=`IN_TABLE_TEXT`,e[e.IN_CAPTION=10]=`IN_CAPTION`,e[e.IN_COLUMN_GROUP=11]=`IN_COLUMN_GROUP`,e[e.IN_TABLE_BODY=12]=`IN_TABLE_BODY`,e[e.IN_ROW=13]=`IN_ROW`,e[e.IN_CELL=14]=`IN_CELL`,e[e.IN_SELECT=15]=`IN_SELECT`,e[e.IN_SELECT_IN_TABLE=16]=`IN_SELECT_IN_TABLE`,e[e.IN_TEMPLATE=17]=`IN_TEMPLATE`,e[e.AFTER_BODY=18]=`AFTER_BODY`,e[e.IN_FRAMESET=19]=`IN_FRAMESET`,e[e.AFTER_FRAMESET=20]=`AFTER_FRAMESET`,e[e.AFTER_AFTER_BODY=21]=`AFTER_AFTER_BODY`,e[e.AFTER_AFTER_FRAMESET=22]=`AFTER_AFTER_FRAMESET`})($C||={}),Q.TABLE,Q.TBODY,Q.TFOOT,Q.THEAD,Q.TR,Q.CAPTION,Q.COL,Q.COLGROUP,Q.TBODY,Q.TD,Q.TFOOT,Q.TH,Q.THEAD,Q.TR,Z.AREA,Z.BASE,Z.BASEFONT,Z.BGSOUND,Z.BR,Z.COL,Z.EMBED,Z.FRAME,Z.HR,Z.IMG,Z.INPUT,Z.KEYGEN,Z.LINK,Z.META,Z.PARAM,Z.SOURCE,Z.TRACK,Z.WBR;function ew(e,t){for(let n=0;n<e.length;n+=1)if(e.charCodeAt(n)===t)return!0;return!1}function tw(e){let t=``;for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);r!==9&&r!==10&&r!==13&&(t+=e[n])}let n=0,r=t.length;for(;n<r&&t.charCodeAt(n)<=32;)n+=1;for(;r>n&&t.charCodeAt(r-1)<=32;)--r;return t.slice(n,r)}var nw=/^([a-zA-Z][a-zA-Z0-9+.-]*):/,rw=/%(2f|5c|00)/i,iw=/%[0-9a-f]{2}/i;function aw(e,t){let n=tw(e);if(n===``)return{kind:`rejected`,reason:`empty`};if(n.startsWith(`#`))return{kind:`fragment`};if(ew(n,0))return{kind:`rejected`,reason:`nul`};if(n.includes(`\\`))return{kind:`rejected`,reason:`backslash`};let r=nw.exec(n)?.[1]?.toLowerCase();if(r!==void 0)return r===`http`||r===`https`?{kind:`remote`}:r===`data`?{kind:`data`,mime:((n.slice(5).split(`,`,1)[0]??``).split(`;`,1)[0]??``).trim().toLowerCase()}:r===`file`?{kind:`rejected`,reason:`file-url`}:{kind:`rejected`,reason:`scheme`};if(n.startsWith(`//`))return{kind:`remote`};let i=n.indexOf(`#`),a=i===-1?n:n.slice(0,i),o=a.indexOf(`?`),s=o===-1?a:a.slice(0,o),c=n.slice(s.length);if(s===``)return{kind:`rejected`,reason:`empty`};if(rw.test(s))return{kind:`rejected`,reason:`encoded`};let l=s.startsWith(`/`)?[]:t.split(`/`).filter(e=>e!==``),u=s.split(`/`);for(let e of u){let t;try{t=decodeURIComponent(e)}catch{return{kind:`rejected`,reason:`encoded`}}if(ew(t,0))return{kind:`rejected`,reason:`nul`};if(t.includes(`/`)||t.includes(`\\`)||iw.test(t))return{kind:`rejected`,reason:`encoded`};if(t!==``&&t!==`.`){if(t===`..`){if(l.length===0)return{kind:`rejected`,reason:`outside-root`};l.pop();continue}l.push(t)}}let d=u.at(-1)??``;return l.length===0||d===``||d===`.`||d===`..`?{kind:`rejected`,reason:`directory`}:{kind:`local`,logicalPath:l.join(`/`),suffix:c}}function ow(e){let t=tw(e);return t===``||t.startsWith(`#`)||t.startsWith(`//`)||ew(t,0)||t.includes(`\\`)?!1:!nw.test(t)}function sw(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function cw(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}var lw=new Set([`md`,`markdown`,`html`,`htm`]);function uw(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n>0&&lw.has(t.slice(n+1).toLowerCase())}function dw(e){let t=tw(e);if(t.startsWith(`#`))return{kind:`fragment`};if(t===``||ew(t,0)||t.includes(`\\`))return{kind:`other`};let n=nw.exec(t)?.[1]?.toLowerCase();if(n!==void 0)return n===`http`||n===`https`||n===`mailto`?{kind:`external`,url:t}:{kind:`other`};if(t.startsWith(`//`))return{kind:`other`};let r=(t.split(`#`,1)[0]??``).split(`?`,1)[0]??``;if(r===``||rw.test(r))return{kind:`other`};let i=[];for(let e of r.split(`/`)){let t;try{t=decodeURIComponent(e)}catch{return{kind:`other`}}if(ew(t,0)||t.includes(`/`)||t.includes(`\\`)||iw.test(t))return{kind:`other`};t!==``&&t!==`.`&&i.push(t)}let a=i.at(-1);return a===void 0||a===`..`||!uw(a)?{kind:`other`}:{kind:`document`,fromRoot:r.startsWith(`/`),segments:i}}var fw=(e,t)=>`h${String(t+1)}`,pw=/^(https?:|mailto:)/i;function mw(e){return e.startsWith(`#`)||pw.test(e)}var hw={allowHtml:!1,frontmatter:!0,headingIds:fw,urlTransform:(e,t)=>t===`image`?ow(e)?e:null:mw(e)||dw(e).kind===`document`?e:null};function gw(e){return encodeURIComponent(e)}function _w(e){return e===void 0||e===``?`text`:mw(e)?e.startsWith(`#`)?`fragment`:`external`:dw(e).kind===`document`?`document`:`text`}function vw(e,t){let n=aw(e,sw(t));return n.kind===`local`?n.logicalPath:null}function yw(e,t={}){return(typeof e==`string`?jC(e,t):e).children.map((e,n)=>bw(e,t,`b:${n}`))}function bw(e,t={},n){switch(e.type){case`heading`:return kw(t,`h${e.depth}`,{key:n,...e.id&&{id:e.id},...e.framework&&{"data-framework":e.framework}},Sw(e.children,t),jw(e.id,t));case`paragraph`:return kw(t,`p`,{key:n},Sw(e.children,t));case`code`:return Cw(e,t,n);case`list`:return kw(t,e.ordered?`ol`:`ul`,{key:n,...e.ordered&&e.start!==void 0&&e.start!==1&&{start:e.start}},e.items.map((n,r)=>kw(t,`li`,{key:r},ww(n.children,n.checked,e.loose,t,`${r}`))));case`blockquote`:return kw(t,`blockquote`,{key:n},e.children.map((e,r)=>bw(e,t,`${n}:${r}`)));case`table`:return kw(t,`table`,{key:n},kw(t,`thead`,null,kw(t,`tr`,null,e.header.map((n,r)=>Tw(`th`,n,e.align[r],t,r)))),e.rows.length?kw(t,`tbody`,null,e.rows.map((n,r)=>kw(t,`tr`,{key:r},n.map((n,r)=>Tw(`td`,n,e.align[r],t,r))))):null);case`footnotes`:return Ew(e.items,t,n);case`thematicBreak`:return kw(t,`hr`,{key:n});case`html`:return t.allowHtml?kw(t,`div`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):kw(t,`p`,{key:n},e.value);case`callout`:return kw(t,`div`,{key:n,className:`markdown-alert markdown-alert-${e.kind.toLowerCase()}`},kw(t,`p`,{className:`markdown-alert-title`},e.title),kw(t,`div`,{className:`markdown-alert-content`},e.children.map((e,r)=>bw(e,t,`${n}:${r}`))));case`component`:return Aw(e,t,n)}}function xw(e,t={},n){switch(e.type){case`text`:return e.value;case`inlineCode`:return kw(t,`code`,{key:n},e.value);case`strong`:return kw(t,`strong`,{key:n},Sw(e.children,t));case`emphasis`:return kw(t,`em`,{key:n},Sw(e.children,t));case`strike`:return kw(t,`del`,{key:n},Sw(e.children,t));case`footnoteReference`:return kw(t,`sup`,{key:n},kw(t,`a`,{id:`user-content-fnref-${mC(e.id,e.referenceIndex)}`,"data-footnote-ref":``,"aria-describedby":`footnote-label`,href:`#user-content-fn-${e.id}`},e.number));case`link`:return kw(t,`a`,{key:n,href:e.href,...e.title&&{title:e.title}},Sw(e.children,t));case`image`:return kw(t,`img`,{key:n,src:e.src,alt:e.alt,...e.title&&{title:e.title}});case`break`:return kw(t,`br`,{key:n});case`inlineHtml`:return t.allowHtml?kw(t,`span`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):e.value;case`inlineComponent`:return Aw(e,t,n)}}function Sw(e,t){return e.map((e,n)=>xw(e,t,`i:${n}`))}function Cw(e,t,n){let r=e.lang??`plaintext`,i=t.highlighter,a=i?void 0:!t.components?.code&&t.extensions?.some(e=>e.name===`streaming`)?e.value.match(/(?:[^\n]*\n){1,4}|[^\n]+$/g):e.value,o=i?{dangerouslySetInnerHTML:{__html:i(e.value,r,{...e.meta&&{meta:e.meta},...e.highlightLines&&{highlightLines:e.highlightLines},...t.codeLineNumbers!==void 0&&{lineNumbers:t.codeLineNumbers}})}}:void 0,s=kw(t,`pre`,{key:n,className:`tm-code${t.codeLineNumbers?` tm-code--line-numbers`:``}`,"data-lang":r,...e.meta&&{"data-meta":e.meta},...e.title&&{"data-code-title":e.title},...e.file&&{"data-filename":e.file},...e.framework&&{"data-framework":e.framework}},kw(t,`code`,{className:`language-${r}`,...o},a));return e.title?kw(t,`figure`,{key:n,className:`tm-code-frame`,"data-lang":r},kw(t,`figcaption`,null,e.title),s):s}function ww(e,t,n,r,i){let a=t===void 0?[]:[kw(r,`input`,{key:`${i}:checkbox`,type:`checkbox`,disabled:!0,checked:t,readOnly:!0}),` `];for(let t=0;t<e.length;t++){let o=e[t];if(o.type===`paragraph`&&(!n||t===0)){for(let e of Sw(o.children,r))a.push(e);n&&(a=[kw(r,`p`,{key:`${i}:paragraph`},a)])}else a.push(bw(o,r,`${i}:${t}`))}return a}function Tw(e,t,n,r,i){return kw(r,e,{key:i,...n&&{style:{textAlign:n}}},Sw(t.children,r))}function Ew(e,t,n){return kw(t,`section`,{key:n,"data-footnotes":``,className:`footnotes`},kw(t,`h2`,{id:`footnote-label`,className:`sr-only`},`Footnotes`,jw(`footnote-label`,t)),kw(t,`ol`,null,e.map(e=>kw(t,`li`,{key:e.id,id:`user-content-fn-${e.id}`},Dw(e,t)))))}function Dw(e,t){let n=e.children.length-1,r=Ow(e,t),i=e.children.map((e,i)=>i===n&&e.type===`paragraph`?kw(t,`p`,{key:i},Sw(e.children,t),r):bw(e,t,`${i}`));return e.children[n]?.type!==`paragraph`&&i.push(kw(t,`p`,{key:`backref-wrapper`},r.slice(1))),i}function Ow(e,t){let n=[];for(let r=1;r<=(e.referenceCount??1);r++){let i=mC(e.id,r),a=r===1?`${e.number}`:`${e.number}-${r}`;n.push(` `,kw(t,`a`,{key:r,"data-footnote-backref":``,"aria-label":`Back to reference ${a}`,className:`data-footnote-backref`,href:`#user-content-fnref-${i}`},`↩`))}return n}function kw(e,t,n,...r){let i=typeof t==`string`?e.components?.[t]??t:t;return(0,D.createElement)(i,n,...r)}function Aw(e,t,n){let r=e.tagName??(e.type===`inlineComponent`?`span`:`md-comment-component`),i={...e.properties};return e.tagName||(i[`data-component`]=e.name,i[`data-attributes`]||=JSON.stringify(e.attributes)),kw(t,r,{key:n,...i},e.type===`inlineComponent`?Sw(e.children,t):e.children.map((e,r)=>bw(e,t,`${n}:${r}`)))}function jw(e,t){if(!e||!t.headingAnchors)return null;let n=typeof t.headingAnchors==`object`?t.headingAnchors:{};return kw(t,`a`,{href:`#${e}`,"aria-hidden":n.ariaHidden??!0,className:n.className??`anchor-heading anchor-heading-link`,tabIndex:n.tabIndex??-1},n.content??`#`)}function Mw(e){return e}function Nw({fallbackLanguage:e=`plaintext`,languages:t}){let n=new Map,r=new Map;for(let e of t){let t=Rw(e.name);n.set(t,e),r.set(t,t);for(let n of e.aliases||[])r.set(Rw(n),t)}let i=Rw(e);function a(e){return r.get(Rw(e||i))||i}function o(e,t,i=0){let s=n.get(a(t));return!s||i>24?[]:zw(e.length,s.tokenize(e,{hasLanguage(e){let t=r.get(Rw(e));return!!(t&&n.has(t))},tokenize(e,t){return o(e,t,i+1)}}))}function s(e,t={}){let n=a(t.lang),r=o(e,n);return{code:e,lang:n,tokens:r.length?Bw(e,r):[{value:e}]}}function c(e,t={}){let n=s(e,t),r=Fw(Pw(n.tokens,t));return{...n,html:`<pre class="th-code th-code--${Lw(n.lang)}${t.lineNumbers?` th-code--line-numbers`:``}" data-language="${Lw(n.lang)}"><code>${r}</code></pre>`}}function l({code:e,decorations:t,lang:n,lineNumbers:r,title:i}){let a=e.trimEnd(),o=c(a,{decorations:t,lang:n,lineNumbers:r});return{copyText:a,htmlMarkup:o.html,lang:o.lang,title:i,tokens:o.tokens}}return{highlight:c,highlightToHtml(e,t={}){return c(e,t).html},listLanguages(){return[...n.keys()]},normalizeLanguage:a,renderCodeBlockData:l,tokenize:s}}function Pw(e,t={}){let n=[],r=[];for(let e of t.decorations||[])e.range?n.push(e):r.push(e);let i=!!(t.lineNumbers||r.length),a={index:0,offset:0};if(!i)return Vw(e,0,1/0,n,a);let o=e.map(e=>e.value).join(``),s=[],c=Hw(o);for(let t=0;t<c.length;t++){let i=t+1,l=c[t],u=c[t+1]??o.length,d=u>l&&o[u-1]===`
|
|
77
|
+
`,f=d?u-1:u,p=r.filter(e=>Uw(e.lines,i));s.push({type:`element`,classNames:[`th-line`,...p.flatMap(e=>qw(e.className))],data:{...Ww(p),line:String(i)},children:Vw(e,l,f,n,a)}),d&&s.push({type:`text`,value:`
|
|
78
|
+
`})}return s}function Fw(e){let t=``;for(let n of e){if(n.type===`text`){t+=Lw(n.value);continue}let e=Lw(n.classNames.join(` `)),r=``;if(n.data)for(let[e,t]of Object.entries(n.data))r+=` data-${Kw(e)}="${Lw(t)}"`;t+=`<span${e?` class="${e}"`:``}${r}>${Fw(n.children)}</span>`}return t}var Iw={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};function Lw(e){return e.replace(/[&<>"']/g,e=>Iw[e])}function Rw(e){return e.trim().toLowerCase()}function zw(e,t){let n=[],r=!0,i=0;for(let a of t){if(!Number.isInteger(a.start)||!Number.isInteger(a.end))continue;let t=Math.max(0,Math.min(e,a.start)),o=Math.max(0,Math.min(e,a.end));t>=o||(t<i&&(r=!1),i=t,n.push({className:a.className,start:t,end:o}))}r||n.sort((e,t)=>e.start-t.start);let a=0,o=0;for(let e of n)e.start<a||(n[o++]=e,a=e.end);return n.length=o,n}function Bw(e,t){let n=[],r=0;for(let i of t)i.start>r&&n.push({value:e.slice(r,i.start)}),n.push({className:i.className,value:e.slice(i.start,i.end)}),r=i.end;return r<e.length&&n.push({value:e.slice(r)}),n}function Vw(e,t,n,r,i){let a=[];for(;i.index<e.length;i.index++){let o=e[i.index],s=i.offset,c=s+o.value.length,l=Math.max(t,s),u=Math.min(n,c);if(l<u){let e=[l,u];if(r.length){let t=new Set(e);for(let e of r){let[n,r]=e.range;r<=l||n>=u||(t.add(Math.max(l,n)),t.add(Math.min(u,r)))}e=[...t].sort((e,t)=>e-t)}for(let t=0;t<e.length-1;t++){let n=e[t],i=e[t+1],c={type:`text`,value:o.value.slice(n-s,i-s)};o.className&&(c={type:`element`,classNames:[`th-token`,`th-${o.className}`],children:[c]});for(let e of r)e.range[0]>n||e.range[1]<i||(c={type:`element`,classNames:[`th-decoration`,...qw(e.className)],data:Gw(e.data),children:[c]});a.push(c)}}if(c>n)break;i.offset=c}return a}function Hw(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
|
|
79
|
+
`&&n+1<e.length&&t.push(n+1);return t}function Uw(e,t){return typeof e==`number`?e===t:t>=e[0]&&t<=e[1]}function Ww(e){let t={};for(let n of e)Object.assign(t,Gw(n.data));return t}function Gw(e){if(e)return Object.fromEntries(Object.entries(e).map(([e,t])=>[Kw(e),String(t)]))}function Kw(e){return Jw(e).replace(/[^a-z0-9_.:-]/gi,`-`)}function qw(e){return e?.trim().split(/\s+/).filter(Boolean)||[]}function Jw(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Yw(e){return t=>Xw(t,e)}function Xw(e,t,n=[],r=new Uint8Array(e.length)){let i=[...n];for(let e of n)r.fill(1,e.start,e.end);for(let n of t){if(`collect`in n){for(let t of n.collect(e))Qw(i,r,t);continue}let t=$w(n.regex),a;for(;a=t.exec(e);){let e=n.group?a[n.group]:a[0];if(!e){a[0].length||t.lastIndex++;continue}let o=n.group?a[0].length-e.length:0,s=a.index+o;Qw(i,r,{start:s,end:s+e.length,className:typeof n.className==`function`?n.className(a):n.className})}}return i}function Zw(e,t){return e.map(e=>({...e,start:e.start+t,end:e.end+t}))}function Qw(e,t,n){return n.start>=n.end||n.start<0||n.end>t.length||eT(t,n.start,n.end)?!1:(e.push(n),t.fill(1,n.start,n.end),!0)}function $w(e){return new RegExp(e.source,e.global?e.flags:`${e.flags}g`)}function eT(e,t,n){for(let r=t;r<n;r++)if(e[r])return!0;return!1}var tT=Mw({name:`css`,tokenize:Yw([{className:e=>e[0].startsWith(`/*`)?`comment`:`string`,regex:/\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'/g},{className:`variable`,regex:/--[A-Za-z0-9_-]+/g},{className:`selector`,regex:/(^|[}\n])\s*([^@{}\n][^{}\n]*)(?=\s*\{)/g,group:2},{className:`property`,regex:/(?:^|[;{]\s*)([A-Za-z-]+)(?=\s*:)/gm,group:1},{className:`function`,regex:/\b[A-Za-z-]+(?=\()/g},{className:`number`,regex:/\b\d+(?:\.\d+)?(?:px|rem|em|%|s|ms|vh|vw|deg)?\b/g}])}),nT={script:/<\/script(?=[\s/>])/gi,style:/<\/style(?=[\s/>])/gi};function rT(e,t,n=`html`){let r=[],i=[],a=0;for(;(a=e.indexOf(`<`,a))>=0;){if(e.startsWith(`<!--`,a)){let t=e.indexOf(`-->`,a+4),n=t<0?e.length:t+3;r.push({start:a,end:n,className:`comment`}),a=n;continue}if(n===`ejs`&&e.startsWith(`<%`,a)){let t=e.indexOf(`%>`,a+2),n=t<0?e.length:t;i.push({start:a+2,end:n,lang:`js`}),a=t<0?e.length:t+2;continue}let t=e[a+1]===`/`,o=a+(t?2:1),s=/^[A-Za-z][\w:.-]*/.exec(e.slice(o));if(!s){a++;continue}let c=cT(e,o+s[0].length);if(c<0){a++;continue}let l=s[0].toLowerCase();if(r.push({start:o,end:o+s[0].length,className:`tag`}),t||iT(e,o+s[0].length,c,r),!t&&(l===`script`||l===`style`)){let t=nT[l];t.lastIndex=c+1;let n=t.exec(e)?.index??e.length,r=aT(l,e.slice(a,c+1));i.push({start:c+1,end:n,lang:r}),a=n;continue}a=c+1}n===`vue`&&oT(e,`{{`,`}}`,`js`,i),n===`svelte`&&sT(e,i);for(let n of i)n.start>=n.end||!t.hasLanguage(n.lang)||r.push(...Zw(t.tokenize(e.slice(n.start,n.end),n.lang),n.start));return r}function iT(e,t,n,r){let i=e.slice(t,n),a=/\s([:@A-Za-z_][\w:.-]*)(?=\s*(?:=|\/?>))/g,o;for(;o=a.exec(i);){let e=o[0].indexOf(o[1]),n=t+o.index+e;r.push({start:n,end:n+o[1].length,className:`attr`})}let s=t;for(;s<n;){let t=e[s];if(t!==`"`&&t!==`'`){s++;continue}let i=lT(e,s,t,n);r.push({start:s,end:i,className:`string`}),s=i}}function aT(e,t){if(e===`style`)return`css`;let n=/\blang\s*=\s*["']?([\w-]+)/i.exec(t)?.[1];return n===`ts`||n===`typescript`?`ts`:`js`}function oT(e,t,n,r,i){let a=0;for(;(a=e.indexOf(t,a))>=0;){let o=e.indexOf(n,a+t.length);if(o<0)return;i.push({start:a+t.length,end:o,lang:r}),a=o+n.length}}function sT(e,t){let n=0;for(;n<e.length;){if(e[n]!==`{`||e[n+1]===`#`){n++;continue}let r=e.indexOf(`}`,n+1);if(r<0)return;t.push({start:n+1,end:r,lang:`js`}),n=r+1}}function cT(e,t){let n=t;for(;n<e.length;)if(e[n]===`"`||e[n]===`'`)n=lT(e,n,e[n],e.length);else if(e[n]===`>`)return n;else n++;return-1}function lT(e,t,n,r){let i=t+1;for(;i<r;)if(e[i]===`\\`)i+=2;else if(e[i]===n)return i+1;else i++;return r}var uT=Mw({name:`html`,aliases:[`htm`,`xml`,`angular-html`],tokenize:(e,t)=>rT(e,t)}),dT=[{className:`property`,regex:/(?<!\.)\.([A-Za-z_$][\w$]*)/g,group:1},{className:`function`,regex:/@[A-Za-z_$][\w$]*/g},{className:`keyword`,regex:RegExp(`\\b(?:abstract|as|asserts|async|await|break|case|catch|class|const|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|infer|instanceof|interface|is|keyof|let|module|namespace|new|of|override|package|private|protected|public|readonly|return|satisfies|set|static|super|switch|this|throw|try|type|typeof|using|var|while|with|yield)\\b`,`g`)},{className:`literal`,regex:/\b(?:false|null|true|undefined|NaN|Infinity)\b/g},{className:`number`,regex:/\b(?:0x[\da-f](?:_?[\da-f])*n?|0b[01](?:_?[01])*n?|0o[0-7](?:_?[0-7])*n?|\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:e[+-]?\d(?:_?\d)*)?n?)\b/gi},{className:`function`,regex:/\bfunction\s*\*?\s*([A-Za-z_$][\w$]*)/g,group:1},{className:`function`,regex:/(^|[^.A-Za-z0-9_$])([A-Za-z_$][\w$]*)(?=\s*\()/g,group:2},{className:`type`,regex:/\b(?:Array|Record|Promise|Readonly|Set|Map|WeakMap|WeakSet|string|number|boolean|bigint|symbol|object|unknown|never|void|any|[A-Z][A-Za-z0-9_$]*)\b/g}];function fT(e,t=!1,n=!1){let r=t?new Uint8Array(e.length):void 0,i=[];return pT(e,t,n,r,i),Xw(e,dT,i,r)}function pT(e,t,n,r,i,a=0,o=e.length,s=!1){let c=[],l=[],u=0;for(;a<o;){let d=l.at(-1),f=u>(d||0),p=e[a],m=e[a+1];if(f){if(p===`{`){l.push(u),a++;continue}if(p!==`<`){let t=a;for(;a<e.length&&e[a]!==`<`&&e[a]!==`{`;)a++;r.fill(1,t,a);continue}}if(s&&!l.length&&!u&&p===`>`)return a;if(p===`/`&&m===`/`){let t=CT(e,a+2);i.push({start:a,end:t,className:`comment`}),a=t;continue}if(p===`/`&&m===`*`){let t=e.indexOf(`*/`,a+2),n=t<0?e.length:t+2;i.push({start:a,end:n,className:`comment`}),a=n;continue}if(p===`'`||p===`"`){let t=ST(e,a,p,s&&!l.length);i.push({start:a,end:t,className:`string`}),a=t;continue}if(p==="`"){a=mT(e,a,i,t,n);continue}if(p===`/`&&!(t&&e[a-1]===`<`)&&bT(e,a)){let t=xT(e,a);if(t>a+1){i.push({start:a,end:t,className:`literal`}),a=t;continue}}if(p===`{`){let t=wT(e,a,i),n=t;for(;n>=0&&/[\w$]/.test(e[n]);)n--;let r=e.slice(n+1,t+1);c.push(`=(:,[`.includes(e[t]||`\0`)||/^(?:return|yield|const|let|var)$/.test(r))}else if(p===`}`)c.pop();else if(c.at(-1)&&/[A-Za-z_$]/.test(p)){let t=wT(e,a,i);if(`{,;`.includes(e[t]||`\0`)){let t=a+1;for(;t<o&&/[\w$]/.test(e[t]);)t++;if(e[t+(e.slice(t).match(/^(?:\s|\/\*[\s\S]*?\*\/|\/\/[^\n]*(?:\n|$))*/)?.[0].length||0)]===`:`){i.push({start:a,end:t,className:`property`}),a=t;continue}}}if(!t){a++;continue}if(!f&&p===`{`&&(l.length||s)){l.push(l.length?d:u),a++;continue}if(!f&&l.length&&p===`}`){l.pop(),a++;continue}if(p!==`<`){a++;continue}if(e.startsWith(`</>`,a)){u--,a+=3;continue}if(e.startsWith(`<>`,a)&&(f||vT(e,a,n))){u++,a+=2;continue}let h=e[a+1]===`/`,g=a+(h?2:1),_=/^[A-Za-z][\w:.-]*/.exec(e.slice(g));if(!_||!h&&!f&&!vT(e,a,n)){a++;continue}let v=pT(e,!0,n,r,i,g+_[0].length,o,!0);if(v<0||yT(e,a,v,h)){a++;continue}i.push({start:g,end:g+_[0].length,className:`tag`}),h||_T(e,g+_[0].length,v,i);let y=/\/\s*$/.test(e.slice(g,v));h?u--:y||u++,a=v+1}return-1}function mT(e,t,n,r,i){let a=t,o=t+1;for(;o<e.length;){if(e[o]===`\\`){o+=2;continue}if(e[o]==="`")return n.push({start:a,end:o+1,className:`string`}),o+1;if(e[o]===`$`&&e[o+1]===`{`){a<o&&n.push({start:a,end:o,className:`string`}),n.push({start:o,end:o+2,className:`operator`});let t=hT(e,o+2),s=t<0?e.length:t,c=e.slice(o+2,s);if(n.push(...Zw(fT(c,r,i),o+2)),t<0)return e.length;n.push({start:t,end:t+1,className:`operator`}),o=t+1,a=o;continue}o++}return a<e.length&&n.push({start:a,end:e.length,className:`string`}),e.length}function hT(e,t){let n=1,r=t;for(;r<e.length;){let t=e[r],i=e[r+1];if(t===`'`||t===`"`){r=ST(e,r,t);continue}if(t==="`"){r=gT(e,r);continue}if(t===`/`&&i===`/`){r=CT(e,r+2);continue}if(t===`/`&&i===`*`){let t=e.indexOf(`*/`,r+2);r=t<0?e.length:t+2;continue}if(t===`/`&&bT(e,r)){r=xT(e,r);continue}if(t===`{`&&n++,t===`}`&&--n===0)return r;r++}return-1}function gT(e,t){let n=t+1;for(;n<e.length;)if(e[n]===`\\`)n+=2;else if(e[n]==="`")return n+1;else if(e[n]===`$`&&e[n+1]===`{`){let t=hT(e,n+2);n=t<0?e.length:t+1}else n++;return e.length}function _T(e,t,n,r){let i=e.slice(t,n),a=/\s([:@A-Za-z_$][\w$:.-]*)(?=\s*(?:=|\/?>))/g,o;for(;o=a.exec(i);){let e=t+o.index+1;r.push({start:e,end:e+o[1].length,className:`attr`})}}function vT(e,t,n){if(n&&/^\s*$/.test(e.slice(e.lastIndexOf(`
|
|
80
|
+
`,t-1)+1,t)))return!0;let r=e.slice(0,t).trimEnd();return!r||/\b(?:return|case|yield)$/.test(r)?!0:/(?:[=([{,:;!&|?]|>)$/.test(r)}function yT(e,t,n,r){if(r)return!1;let i=e.slice(t+1,n),a=e.slice(n+1).trimStart();return/\s+extends\s+/.test(i)||a[0]===`(`&&!i.trimEnd().endsWith(`/`)}function bT(e,t){let n=e.slice(0,t).trimEnd();return!n||/\b(?:case|delete|in|instanceof|of|return|throw|typeof|void|yield)$/.test(n)?!0:/[=([{,:;!&|?~+*%^<>-]$/.test(n)}function xT(e,t){let n=!1,r=t+1;for(;r<e.length&&e[r]!==`
|
|
81
|
+
`;)if(e[r]===`\\`)r+=2;else if(e[r]===`[`)n=!0,r++;else if(e[r]===`]`)n=!1,r++;else if(e[r]===`/`&&!n){for(r++;/[a-z]/i.test(e[r]||``);)r++;return r}else r++;return t+1}function ST(e,t,n,r=!1){let i=t+1;for(;i<e.length;)if(e[i]===`\\`)i+=2;else if(e[i]===n)return i+1;else if(!r&&e[i]===`
|
|
82
|
+
`)return i;else i++;return e.length}function CT(e,t){let n=e.indexOf(`
|
|
83
|
+
`,t);return n<0?e.length:n}function wT(e,t,n){let r=t-1,i=n.length-1;for(;r>=0;){if(/\s/.test(e[r])){r--;continue}let t=n[i];if(t&&t.end>r){if(i--,t.className===`comment`&&t.start<=r){r=t.start-1;continue}}else break}return r}var TT=Mw({name:`js`,aliases:[`javascript`,`mjs`,`cjs`,`js-vue`],tokenize:e=>fT(e)}),ET=Mw({name:`json`,aliases:[`jsonc`,`json5`],tokenize:Yw([{className:e=>e[0].startsWith(`//`)||e[0].startsWith(`/*`)?`comment`:e[1]?`property`:`string`,regex:/\/\/[^\n]*|\/\*[\s\S]*?\*\/|("(?:\\.|[^"\\])*")(?=\s*:)|"(?:\\.|[^"\\])*"/g},{className:`literal`,regex:/\b(?:false|null|true)\b/g},{className:`number`,regex:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/gi}])}),DT=Mw({name:`jsx`,tokenize:e=>fT(e,!0)}),OT=Mw({name:`markdown`,aliases:[`md`],tokenize(e,t){return Xw(e,[{className:`heading`,regex:/^#{1,6}\s.*$/gm},{className:`heading`,regex:/^.+\n(?:=+|-+)\s*$/gm},{className:`code-inline`,regex:/`[^`\n]+`/g},{className:`link`,regex:/!?\[[^\]]+\]\([^)]+\)/g},{className:`meta`,regex:/^\s{0,3}(?:>|[-*+] |\d+\. )/gm}],kT(e,t))}});function kT(e,t){let n=[],r=/^( {0,3})(`{3,}|~{3,})\s*([^\n]*)$/gm,i;for(;i=r.exec(e);){let a=i[2],o=e.indexOf(`
|
|
84
|
+
`,i.index+i[0].length);if(o<0)break;let s=RegExp(`^ {0,3}${a[0]}{${a.length},}\\s*$`,`gm`);s.lastIndex=o+1;let c=s.exec(e),l=c?.index??e.length,u=i[3].trim().split(/\s+/)[0],d=u&&t.hasLanguage(u)?Zw(t.tokenize(e.slice(o+1,l),u),o+1):[];n.push({start:i.index,end:o,className:`meta`}),n.push(...AT(o+1,l,d)),c&&n.push({start:c.index,end:c.index+c[0].length,className:`meta`}),r.lastIndex=c?c.index+c[0].length:e.length}return n}function AT(e,t,n){let r=[],i=e;for(let e of n)e.start>i&&r.push({start:i,end:e.start,className:`code-inline`}),r.push(e),i=e.end;return i<t&&r.push({start:i,end:t,className:`code-inline`}),r}var jT=Mw({name:`plaintext`,aliases:[`text`,`txt`,`-->`],tokenize:()=>[]}),MT=Mw({name:`shell`,aliases:[`bash`,`sh`,`zsh`,`cmd`,`console`],tokenize:Yw([{collect:NT},{className:`variable`,regex:/\$[A-Za-z_][A-Za-z0-9_]*|\b[A-Z_][A-Z0-9_]*(?==)/g},{className:`keyword`,regex:/\b(?:case|do|done|elif|else|esac|export|fi|for|function|if|in|select|then|time|until|while)\b/g},{className:`command`,regex:/(^|[\n;|&])\s*([A-Za-z0-9_./-]+)(?=\s|$)/g,group:2}])});function NT(e){let t=[];PT(e,t);let n=[...t],r=0,i=0;for(;i<e.length;){for(;r<t.length&&t[r].end<=i;)r++;let a=t[r];if(a&&a.start<=i){i=a.end;continue}let o=e[i];if(o===`"`||o===`'`){let t=o,r=i+1;for(;r<e.length;)if(e[r]===`\\`&&t===`"`)r+=2;else if(e[r]===t){r++;break}else r++;r=Math.min(r,e.length),n.push({start:i,end:r,className:`string`}),i=r;continue}if(o===`$`&&e[i+1]===`{`){let t=e.indexOf(`}`,i+2),r=t<0?e.length:t+1;n.push({start:i,end:r,className:`variable`}),i=r;continue}if(o===`#`&&(i===0||e[i-1]===`
|
|
85
85
|
`||/[\s;|&()]/.test(e[i-1]))){let t=e.indexOf(`
|
|
86
|
-
`,i),r=t<0?e.length:t;n.push({start:i,end:r,className:`comment`}),i=r;continue}i++}return n}function
|
|
87
|
-
`,r.index+r[0].length);if(n<0)continue;let i=n+1,a=RegExp(`^\\t*${r[2]}\\s*$`,`m`).exec(e.slice(i));if(!a){t.push({start:i,end:e.length,className:`string`});continue}let o=i+a.index;o>i&&t.push({start:i,end:o,className:`string`});let s=i+a.index;t.push({start:s,end:s+a[0].length,className:`meta`})}}function
|
|
88
|
-
`,t-1)+1,r=``;for(let i=n;i<t;i++)e[i]===`\\`&&r!==`'`?i++:r&&e[i]===r?r=``:!r&&(e[i]===`"`||e[i]===`'`)&&(r=e[i]);return!!r}var
|
|
86
|
+
`,i),r=t<0?e.length:t;n.push({start:i,end:r,className:`comment`}),i=r;continue}i++}return n}function PT(e,t){let n=/<<-?\s*(['"]?)([A-Za-z_][A-Za-z0-9_]*)\1/g,r;for(;r=n.exec(e);){if(e[r.index-1]===`<`||FT(e,r.index))continue;let n=e.indexOf(`
|
|
87
|
+
`,r.index+r[0].length);if(n<0)continue;let i=n+1,a=RegExp(`^\\t*${r[2]}\\s*$`,`m`).exec(e.slice(i));if(!a){t.push({start:i,end:e.length,className:`string`});continue}let o=i+a.index;o>i&&t.push({start:i,end:o,className:`string`});let s=i+a.index;t.push({start:s,end:s+a[0].length,className:`meta`})}}function FT(e,t){let n=e.lastIndexOf(`
|
|
88
|
+
`,t-1)+1,r=``;for(let i=n;i<t;i++)e[i]===`\\`&&r!==`'`?i++:r&&e[i]===r?r=``:!r&&(e[i]===`"`||e[i]===`'`)&&(r=e[i]);return!!r}var IT=Mw({name:`ts`,aliases:[`typescript`,`angular-ts`],tokenize:e=>fT(e)}),LT=Mw({name:`tsx`,tokenize:e=>fT(e,!0)}),RT=Mw({name:`yaml`,aliases:[`yml`],tokenize(e){let t=[...zT(e),...BT(e)];return Xw(e,[{className:`property`,regex:/^[ \t-]*([A-Za-z0-9_.-]+)(?=\s*:)/gm,group:1},{collect:VT},{className:`literal`,regex:/\b(?:false|null|true|yes|no|on|off|~)\b/gi},{className:`number`,regex:/\b\d+(?:\.\d+)?\b/g}],t)}});function zT(e){let t=[],n=/^(\s*)[\w.-]+:\s*[>|][+-]?\s*(?:#.*)?$/gm,r;for(;r=n.exec(e);){let n=e.indexOf(`
|
|
89
89
|
`,r.index+r[0].length);if(n<0)continue;let i=r[1].length,a=n+1;for(;a<e.length;){let t=e.indexOf(`
|
|
90
|
-
`,a),n=t<0?e.length:t,r=e.slice(a,n);if(r.trim()&&(r.match(/^\s*/)?.[0].length||0)<=i)break;a=t<0?e.length:t+1}a>n+1&&t.push({start:n+1,end:a,className:`string`})}return t}function
|
|
90
|
+
`,a),n=t<0?e.length:t,r=e.slice(a,n);if(r.trim()&&(r.match(/^\s*/)?.[0].length||0)<=i)break;a=t<0?e.length:t+1}a>n+1&&t.push({start:n+1,end:a,className:`string`})}return t}function BT(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`"`||r===`'`){let i=r,a=n+1;for(;a<e.length&&e[a]!==`
|
|
91
91
|
`;)if(e[a]===`\\`&&i===`"`)a+=2;else if(e[a]===i){a++;break}else a++;t.push({start:n,end:a,className:`string`}),n=a;continue}if(r===`#`&&(n===0||e[n-1]===`
|
|
92
92
|
`||/\s/.test(e[n-1]))){let r=e.indexOf(`
|
|
93
|
-
`,n),i=r<0?e.length:r;t.push({start:n,end:i,className:`comment`}),n=i;continue}n++}return t}function
|
|
94
|
-
`);for(let e=0;e<n.length;e++){let r=n[e],i=
|
|
95
|
-
`),decorations:t}}function qT(e){return(t,n=`plaintext`,r={})=>{let i=KT(t),a=e.tokenize(i.code,{lang:n});for(let e of r.highlightLines||[])i.decorations.push({className:`th-line--highlighted`,lines:e});return Rw(Lw(a.tokens,{lineNumbers:r.lineNumbers,decorations:i.decorations}))}}var JT=262144,YT=Iw({languages:[OT,AT,zT,BT,kT,VT,pT,iT,FT,jT,PT]}),XT=new Set(YT.listLanguages()),ZT=qT(YT),QT=(e,t,n)=>{let r=t?YT.normalizeLanguage(t):`plaintext`;return ZT(e,XT.has(r)&&e.length<=JT?r:`plaintext`,n)};function $T(e){return e.closest(`[data-code-block]`)?.querySelector(`pre code`)?.textContent??``}function eE({children:e,...t}){return(0,H.jsx)(`div`,{"data-table-scroll":``,role:`region`,"aria-label":`Scrollable table`,tabIndex:0,onKeyDown:e=>{if(e.target!==e.currentTarget||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let t=e.key===`ArrowRight`?64:e.key===`ArrowLeft`?-64:0;t===0||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollBy({left:t}))},children:(0,H.jsx)(`table`,{...t,children:e})})}function tE(e,t,n){function r({href:e,children:n,...r}){let i=bw(e);return i===`fragment`?(0,H.jsx)(`a`,{href:e,...r,children:n}):i===`external`?(0,H.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,...r,children:n}):i===`document`&&t&&e!==void 0?(0,H.jsx)(`button`,{type:`button`,"data-local-link":``,onClick:()=>t(e),children:n}):(0,H.jsx)(`span`,{children:n})}function i({src:t,alt:n,title:r}){let i=typeof t==`string`?e?.(t)??null:null;return i===null?(0,H.jsx)(`span`,{"data-blocked-image":``,children:n?`[image: ${n}]`:`[image]`}):(0,H.jsx)(`img`,{src:i,alt:n??``,title:r,loading:`lazy`,referrerPolicy:`no-referrer`})}function a({children:e,...t}){return n===void 0?(0,H.jsx)(`pre`,{...t,children:e}):(0,H.jsxs)(`div`,{"data-code-block":``,children:[(0,H.jsx)(`div`,{"data-code-actions":``,children:n}),(0,H.jsx)(`pre`,{...t,children:e})]})}return{a:r,img:i,pre:a,table:eE}}function nE({document:e,resolveImage:t,onOpenLink:n,codeActions:r}){let i=(0,D.useMemo)(()=>tE(t,n,r),[t,n,r]);return Sw(e,{...vw,allowHtml:!1,highlighter:QT,components:i})}var rE=3e3;function iE(){let[e,t]=(0,D.useState)(null),[n,r]=(0,D.useState)(!1),i=(0,D.useRef)(null),a=(0,D.useRef)(0);return(0,D.useEffect)(()=>()=>{a.current+=1,i.current&&clearTimeout(i.current)},[]),{result:e,copy:(0,D.useCallback)(async(e,n)=>{let o=++a.current;i.current&&clearTimeout(i.current),r(!0);let s;try{if(typeof navigator.clipboard?.writeText!=`function`)throw Error(`This browser cannot write to the clipboard`);await navigator.clipboard.writeText(n),s={ok:!0,message:`Copied the ${e}.`}}catch(t){s={ok:!1,message:`Could not copy the ${e} (${t instanceof Error?t.message:`unknown reason`}).`}}o===a.current&&(r(!1),t(s),s.ok&&(i.current=setTimeout(()=>t(null),rE)))},[]),pending:n,dismiss:()=>t(null)}}function aE({label:e,text:t,icon:n=z,title:r,code:i=!1}){let{result:a,copy:o,pending:s,dismiss:c}=iE(),l=(0,D.useRef)(``),u=a?.ok===!1,d=u?L:a?.ok===!0?N:n;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(vx,{enabled:u,title:`Copy failed`,trigger:(0,H.jsxs)(pb,{variant:i?`outline`:`ghost`,size:i?`xs`:`icon-sm`,"aria-label":`Copy ${e}`,title:u?`${a.message} Click for details.`:r??`Copy ${e}`,disabled:s,className:u?`text-destructive`:void 0,"data-copy-state":u?`failed`:a?.ok===!0?`copied`:`idle`,onClick:n=>{u||(l.current=typeof t==`string`?t:t(n.currentTarget),o(e,l.current))},children:[(0,H.jsx)(d,{"aria-hidden":`true`}),i&&`Copy code`]}),children:[(0,H.jsx)(`p`,{children:a?.message}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(pb,{variant:`outline`,size:`sm`,disabled:s,onClick:()=>void o(e,l.current),children:`Try again`}),(0,H.jsx)(pb,{variant:`ghost`,size:`sm`,onClick:c,children:`Dismiss`})]})]}),(0,H.jsx)(`span`,{role:u?`alert`:`status`,className:`sr-only`,"data-testid":`copy-result`,children:a?.message})]})}function oE(){return(0,H.jsx)(H.Fragment,{children:`Scripts can load only the files registered for this document and cannot reach this app, its management API, or unregistered files. Some outbound requests, including navigation inside the view, are not blocked.`})}var sE={navigated:`View reloaded`,"request-closed":`Question closed`,expired:`Render permission expired`,replaced:`Draft connection ended`};function cE(e){return e.status===`connected`?`Drafts linked (not sent)`:e.status===`closed`?sE[e.reason]??`Invalid draft message`:null}function lE({mode:e,bridge:t,needsPermission:n,pinnedStatic:r,modeError:i,onRunScripts:a,onStopScripts:o,onReload:s}){let c=e===`interactive`,l=t.status===`closed`,u=cE(t);return(0,H.jsxs)(`div`,{className:`flex min-h-9 flex-wrap items-center gap-x-3 gap-y-1 border-b bg-muted/50 px-3 py-1 text-[0.8rem]`,"data-testid":`html-view-bar`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:`Document content`}),(0,H.jsx)(`span`,{className:`text-muted-foreground`,"data-testid":`html-mode`,children:c?`Scripts running`:r?`Scripts off for this question`:`Scripts off`}),n&&(0,H.jsx)(`span`,{className:`text-destructive`,children:`Permission cleared`}),u!==null&&(0,H.jsx)(`span`,{role:`status`,className:l?`text-destructive`:`text-muted-foreground`,"data-testid":`bridge-status`,children:u}),i&&(0,H.jsx)(`span`,{role:`alert`,className:`text-destructive`,children:`Script change failed`}),(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[l&&t.reason!==`request-closed`&&(0,H.jsx)(pb,{size:`xs`,variant:`ghost`,onClick:s,children:`Reload view`}),(0,H.jsx)(vx,{title:`Document view`,trigger:(0,H.jsxs)(pb,{size:`xs`,variant:`ghost`,children:[l||i?(0,H.jsx)(L,{"aria-hidden":`true`}):(0,H.jsx)(_e,{"aria-hidden":`true`}),`Details`]}),children:(0,H.jsx)(uE,{mode:e,bridge:t,needsPermission:n,pinnedStatic:r,modeError:i,connection:u})}),c&&(0,H.jsx)(pb,{size:`xs`,variant:`ghost`,onClick:o,children:`Turn off scripts`}),n&&(0,H.jsx)(pb,{size:`xs`,variant:`outline`,onClick:a,children:`Run scripts…`})]})]})}function uE({mode:e,bridge:t,needsPermission:n,pinnedStatic:r,modeError:i,connection:a}){let o=e===`interactive`,s=t.status===`closed`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{children:`Buttons and text inside the view belong to the opened document, rather than this app.`}),(0,H.jsx)(`p`,{children:`Links and form submission inside the view are disabled. Open links from “Links in this document”.`}),o?(0,H.jsx)(`p`,{children:(0,H.jsx)(oE,{})}):(0,H.jsx)(`p`,{children:`Scripts do not run in this view.`}),r&&(0,H.jsx)(`p`,{children:`This question was created in the Static view, so scripts stay off until it is answered.`}),n&&(0,H.jsx)(`p`,{children:`The permission to run scripts was cleared, for example by a daemon restart. Use “Run scripts…” to allow them again.`}),t.status===`connected`&&(0,H.jsx)(`p`,{children:`The document can read and replace draft answers. It cannot submit them. Only “Send answers to the agent” in the answer panel submits answers.`}),s&&(0,H.jsxs)(`p`,{children:[`Draft answers from this view are no longer accepted. `,a,`.`,` `,t.reason===`request-closed`?`Reloading cannot reopen the question.`:`Reload the view to reconnect.`]}),s&&!sE[t.reason]&&(0,H.jsx)(`p`,{children:`The document sent a message that breaks the rules, such as a malformed or oversized message or too many messages.`}),i&&(0,H.jsx)(`p`,{className:`text-destructive`,children:i})]})}function dE(e){return vh(e.defaultTagName??`div`,e,e)}var fE=db(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function pE({className:e,variant:t=`default`,render:n,...r}){return dE({defaultTagName:`span`,props:ih({className:ab(fE({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}var mE=D.createContext(void 0);function hE(){return D.useContext(mE)}var gE=D.forwardRef(function(e,t){let{className:n,defaultPressed:r=!1,disabled:i=!1,form:a,onPressedChange:o,pressed:s,render:c,type:l,value:u,nativeButton:d=!0,style:f,...p}=e,m=zv(u||void 0),h=hE(),g=h?.value??[],_=(i||h?.disabled)??!1,[v,y]=yx({controlled:h?m!==void 0&&g.indexOf(m)>-1:s,default:r,name:`Toggle`,state:`pressed`}),{getButtonProps:b,buttonRef:x}=Fv({disabled:_,native:d}),S={disabled:_,pressed:v},C=[x,t],w=[{"aria-pressed":v,onClick(e){let t=!v,n=np(Jf,e.nativeEvent);o?.(t,n),!n.isCanceled&&(m&&h?.setGroupValue?.(m,t,n),!n.isCanceled&&y(t))}},p,b],T=vh(`button`,e,{enabled:!h,state:S,ref:C,props:w}),E=D.useMemo(()=>({disabled:_,focusableWhenDisabled:!1}),[_]);return h?(0,H.jsx)(fS,{tag:`button`,render:c,className:n,style:f,metadata:E,state:S,refs:C,props:w}):T}),_E=D.createContext(void 0);function vE(){return D.useContext(_E)}var yE=D.forwardRef(function(e,t){let{defaultValue:n,disabled:r=!1,loopFocus:i=!0,onValueChange:a,orientation:o=`horizontal`,multiple:s=!1,value:c,className:l,render:u,style:d,...f}=e,p=dx(!0),m=vE(),h=n??Ld,g=c!==void 0||n!==void 0,_=(p?.disabled??!1)||(m?.disabled??!1)||r,[v,y]=yx({controlled:c,default:h,name:`ToggleGroup`,state:`value`}),b=hp((e,t,n)=>{let r;s?(r=v.slice(),t?r.push(e):r.splice(v.indexOf(e),1)):r=t?[e]:[],a?.(r,n),!n.isCanceled&&y(r)}),x={disabled:_,multiple:s,orientation:o},S=D.useMemo(()=>({disabled:_,setGroupValue:b,value:v,isValueInitialized:g}),[_,b,v,g]),C={role:`group`},w=vh(`div`,e,{enabled:!!p,state:x,ref:t,props:[C,f]});return(0,H.jsx)(mE.Provider,{value:S,children:p?w:(0,H.jsx)(jS,{render:u,className:l,style:d,state:x,refs:[t],props:[C,f],loopFocus:i,enableHomeAndEndKeys:!0,orientation:o})})}),bE=db(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}}),xE=D.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});function SE({className:e,variant:t,size:n,spacing:r=2,orientation:i=`horizontal`,children:a,...o}){return(0,H.jsx)(yE,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:ab(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,e),...o,children:(0,H.jsx)(xE.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function CE({className:e,children:t,variant:n=`default`,size:r=`default`,...i}){let a=D.useContext(xE);return(0,H.jsx)(gE,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:ab(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,bE({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}var wE=(e,t)=>`${String(e)} ${t}${e===1?``:`s`}`,TE={"asset-scan-failed":()=>`Scanning the files this document references did not finish in time or exceeded the structure limits, so images and CSS were not registered. Run vo refresh <document ID> to scan again.`,"script-removed":(e,t)=>`Removed ${wE(t,`script`)}. Scripts do not run in this view, so content that scripts would create is not shown.`,"script-not-loaded":(e,t)=>`Removed ${wE(t,`script`)} that could not be loaded (referencing unregistered files or external URLs).`,"noscript-removed":(e,t)=>`Removed ${wE(t,`noscript element`)}. In the Interactive view, noscript content is not shown.`,"asset-requested":e=>`The view tried to load ${e}, but it is not registered, so it could not be loaded. Register it with vo open <document> --assets-root <dir> --asset ${e} to make it loadable (files that scripts load at run time are not registered automatically).`,"event-handler-removed":(e,t)=>`Removed event attributes such as onclick from ${wE(t,`element`)}.`,"embed-removed":(e,t)=>`Removed ${wE(t,`embedded element`)} (iframe, object, embed, and similar). Other pages and plugins cannot be embedded.`,"inline-svg-removed":(e,t)=>`Removed ${wE(t,`inline SVG`)}. Save the SVG as a file (.svg) and reference it with <img> to show it.`,"mathml-removed":(e,t)=>`Removed ${wE(t,`MathML element`)}.`,"meta-refresh-removed":()=>`Removed the automatic redirect (meta refresh).`,"base-removed":()=>`Removed the base element. Relative references resolve against the document location.`,"network-hint-removed":(e,t)=>`Removed ${wE(t,`resource hint`)} (prefetch, preconnect, and similar).`,"form-action-removed":()=>`Removed the form action. Form controls are display-only and cannot submit.`,"element-removed":(e,t)=>`Removed ${wE(t,`legacy element`)} that treats the rest of the document as text (such as plaintext).`,"media-blocked":e=>`Video and audio (${e}) cannot be shown.`,"remote-asset-blocked":e=>`External URL (${e}) is not loaded. Put the file under the document's directory and reference it with a relative path to show it.`,"asset-not-registered":e=>`${e} was not found. Make sure the file is under the assets-root used when the document was opened (the document's directory if none was given).`,"asset-rejected":e=>`${e} cannot be loaded. References outside the assets-root, file: URLs, and encoded separators are not allowed. To widen the range, reopen with vo open <document> --assets-root <dir>.`,"asset-hidden":e=>`${e} is not loaded. Files and directories whose names start with "." (such as .env and .git) cannot be referenced from documents.`,"asset-unsupported":e=>`${e} is a file type that cannot be used here. Allowed types are images (PNG, JPEG, WebP, GIF, AVIF, SVG), CSS, fonts (WOFF, WOFF2), and, in the Interactive view, scripts (.js, .mjs) and JSON registered with --asset.`,"data-url-blocked":e=>`data URL (${e}) cannot be used. Only PNG, JPEG, WebP, GIF, and AVIF images are allowed as data URLs.`,"css-invalid":e=>`${e===``?`The CSS in the document`:e} has parts that could not be parsed, and those parts were disabled.`,"link-disabled":(e,t)=>`Links in this document (${String(t)}) cannot be clicked inside the view. Open them from the "Links in this document" list.`};function EE(e){let t=TE[e.code],n=e.target??``;if(!t)return`${e.code}${n===``?``:`: ${n}`}`;let r=t(n,e.count);return e.target!==null&&e.count>1?`${r} (${String(e.count)} occurrences)`:r}function DE(e){if(!(e instanceof HS))return`Could not export the PDF.`;switch(e.code){case`E_BROWSER_NOT_FOUND`:return e.message;case`E_REVISION_UNAVAILABLE`:return`This revision is no longer kept. Show the latest revision and export again.`;case`E_PARSE_FAILED`:return`The document could not be prepared for printing (it is too large or too deeply nested).`;case`E_LIMIT_EXCEEDED`:return e.details.reason===`page-size`?`The document is too large to print (including images, fonts, and stylesheets).`:`Other PDF exports are still waiting. Try again after they finish.`;case`E_EXPORT_FAILED`:return e.details.reason===`timeout`?`The browser did not finish printing the PDF in time.`:`The browser could not print the PDF.`;default:return`Could not export the PDF. ${e.message}`}}var OE={exporting:!1,error:null};function kE(e,t){let n=URL.createObjectURL(e),r=window.document.createElement(`a`);r.href=n,r.download=t,window.document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),6e4)}function AE(e=kE){let t=new Map,n=new Set,r=(e,r)=>{r===OE?t.delete(e):t.set(e,r);for(let e of n)e()};return{state:e=>t.get(e)??OE,subscribe(e){return n.add(e),()=>n.delete(e)},start(n,i,a){let{documentId:o}=i;t.get(o)?.exporting!==!0&&(r(o,{exporting:!0,error:null}),n.exportPdf(o,a).then(t=>{r(o,OE),e(t,Ju(i))},e=>{r(o,{exporting:!1,error:DE(e)})}))},dismiss(e){t.get(e)?.exporting===!1&&r(e,OE)}}}var jE=AE();function ME(e){return(0,D.useSyncExternalStore)(jE.subscribe,()=>jE.state(e))}function NE(e,t,n){try{let r=JSON.parse(window.localStorage.getItem(`vde-open.pref.${e}`)??`null`);return n(r)?r:t}catch{return t}}function PE(e,t,n){let r=`vde-open.pref.${e}`,[i,a]=(0,D.useState)(()=>NE(e,t,n));return[i,(0,D.useCallback)(e=>{a(e);try{window.localStorage.setItem(r,JSON.stringify(e))}catch{}},[r])]}var FE=e=>e===`light`||e===`dark`||e===`system`,IE=[{value:`standard`,label:`Standard`},{value:`github`,label:`GitHub`},{value:`gruvbox`,label:`Gruvbox`},{value:`catppuccin`,label:`Catppuccin`},{value:`github-high-contrast`,label:`GitHub High Contrast`}],LE=e=>IE.some(t=>t.value===e);function RE(e,t){let n=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;window.document.documentElement.classList.toggle(`dark`,n),window.document.documentElement.dataset.colorPalette=t}var zE=e=>e===`flat`||e===`tree`,BE=e=>e===`preview`||e===`source`,VE=e=>e===`standard`||e===`wide`,HE=1e3,UE=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null),WE=(e,t)=>Object.keys(e).every(e=>t.includes(e));function GE(e){try{let t=JSON.stringify(e);return t===void 0?null:Lu(t)}catch{return null}}function KE(e){return e instanceof HS?{code:e.code,message:e.message}:{code:`E_BRIDGE_FAILED`,message:`Could not handle the draft answer.`}}function qE(e){let{instanceId:t,port:n,handlers:r}=e,i=e.now??Date.now,a=!1,o=0,s=[],c=new Set,l=-1,u=0,d=null,f=e=>{if(a)return;let t=GE(e);if(t===null||t>Xl.bridgeOutboundFrameBytes){e.type===`response`&&n.postMessage({type:`response`,sequence:e.sequence,ok:!1,error:{code:`E_LIMIT_EXCEEDED`,message:`The response is too large.`}});return}n.postMessage(e)},p=(e,t)=>t.then(t=>f({type:`response`,sequence:e,ok:!0,result:t}),t=>f({type:`response`,sequence:e,ok:!1,error:KE(t)})),m=(e,t,n)=>f({type:`response`,sequence:e,ok:!1,error:{code:t,message:n}}),h=e=>{a||e.draftVersion<=l||c.has(e.draftVersion)||(l=e.draftVersion,f({type:`event`,method:`draftChanged`,payload:e}))},g=({sequence:e,method:t,payload:n})=>{if(t===`ready`){if(!WE(n,[])){m(e,`E_INVALID_ARGUMENT`,`ready takes no arguments.`);return}p(e,r.ready().then(e=>(l=Math.max(l,e.draftVersion),e)));return}if(t===`updateDraft`){let{answers:t,baseDraftVersion:i}=n;if(!WE(n,[`answers`,`baseDraftVersion`])||!UE(t)||typeof i!=`number`||!Number.isSafeInteger(i)||i<0){m(e,`E_INVALID_ARGUMENT`,`updateDraft requires a draft-answer object and baseDraftVersion.`);return}let a=GE(t);if(a===null||a>Xl.answerBytes){m(e,`E_LIMIT_EXCEEDED`,`The draft answer is too large.`);return}if(Object.hasOwn(t,`__proto__`)||!Fu.safeParse(t).success){m(e,`E_ANSWER_INVALID`,`Draft answer values must be strings, finite numbers, booleans, or arrays of strings, keyed by field name.`);return}u+=1,p(e,r.updateDraft(t,i).then(e=>(c.add(e.draftVersion),l=Math.max(l,e.draftVersion),e)).finally(()=>{if(--u,u===0&&d!==null){let e=d;d=null,h(e)}}));return}m(e,`E_METHOD_NOT_ALLOWED`,`${t.slice(0,64)} cannot be called from HTML.`)},_={get closed(){return a},notifyDraft(e){if(!a){if(u>0){d=e;return}h(e)}},close(t){if(!a){try{n.postMessage({type:`closed`,reason:t})}catch{}a=!0,n.removeEventListener(`message`,v),n.close(),e.onClose?.(t)}}};function v(e){if(a)return;let n=i();if(s=s.filter(e=>n-e<HE),s.push(n),s.length>Xl.bridgeMessagesPerSecond){_.close(`rate`);return}let r=e.data,c=GE(r);if(c===null){_.close(`malformed`);return}if(c>Xl.bridgeInboundFrameBytes){_.close(`too-large`);return}if(!UE(r)||r.protocolVersion!==1||typeof r.sequence!=`number`||!Number.isSafeInteger(r.sequence)||typeof r.method!=`string`||!UE(r.payload)){_.close(`malformed`);return}if(r.instanceId!==t){_.close(`instance`);return}if(r.sequence<=o){_.close(`sequence`);return}o=r.sequence,g({sequence:r.sequence,method:r.method,payload:r.payload})}return n.addEventListener(`message`,v),n.start(),_}var JE=(e,t)=>typeof e==`object`&&!!e&&e.type===`vde-bridge-hello`&&e.protocolVersion===1&&e.instanceId===t;function YE(e,t,n,r,i){let a=n?.bridge?.instanceId??null,o=n?.bridge?.requestId??null,s=n?.grant??null,c=n?.documentUrl??null,[l,u]=(0,D.useState)(null),d=(0,D.useRef)(null);return(0,D.useEffect)(()=>{if(a===null||o===null||s===null)return;let n=t.current,r=i.current?.url===c?i.current.count:0,l=r>1,f=null,p=e=>u({instanceId:a,status:{status:`closed`,reason:e}}),m=t=>{let r=n?.contentWindow;if(!r||t.source!==r||!JE(t.data,a)||l)return;l=!0;let i=new MessageChannel,o=async e=>{try{return await e}catch(e){throw e instanceof HS&&e.code===`E_RENDER_GRANT_INVALID`&&setTimeout(()=>f?.close(`expired`),0),e}};f=qE({instanceId:a,port:i.port1,handlers:{async ready(){let t=await o(e.bridgeReady(s));return{protocolVersion:1,requestId:t.requestId,documentId:t.documentId,revision:t.revision,questionnaire:t.questionnaire,draftVersion:t.draftVersion,answers:t.draftAnswers}},updateDraft:(t,n)=>o(e.bridgeDraft(s,n,t))},onClose:p}),d.current=f,r.postMessage({type:it,instanceId:a},`*`,[i.port2]),u({instanceId:a,status:{status:`connected`}})},h=()=>{r+=1,!(r<2)&&(l=!0,f?f.close(`navigated`):p(`navigated`))};return window.addEventListener(`message`,m),n?.addEventListener(`load`,h),()=>{window.removeEventListener(`message`,m),n?.removeEventListener(`load`,h),f?.close(`replaced`),d.current=null}},[e,t,a,o,s,c,i]),(0,D.useEffect)(()=>{let t=d.current;if(t===null||r===null||r.requestId!==o||s===null)return;if(r.status!==`pending`){t.close(`request-closed`);return}let n=!1;return e.bridgeReady(s).then(e=>{n||e.status!==`pending`||t.notifyDraft({answers:e.draftAnswers,draftVersion:e.draftVersion})},e=>{e instanceof HS&&e.code===`E_RENDER_GRANT_INVALID`&&t.close(`expired`)}),()=>{n=!0}},[e,r,o,s]),a===null?{status:`none`}:i.current?.url===c&&i.current.count>1?{status:`closed`,reason:`navigated`}:l?.instanceId===a?l.status:{status:`waiting`}}var XE=2e3;function ZE(e){let[t,n]=(0,D.useState)(null);return(0,D.useEffect)(()=>{if(e===null)return;let t=new Worker(new URL(`/assets/markdown.worker-BhrAVXtB.js`,``+import.meta.url),{type:`module`}),r=r=>{clearTimeout(i),t.terminate(),n({source:e,state:r})},i=setTimeout(()=>r({status:`failed`,reason:`timeout`}),XE);return t.addEventListener(`message`,e=>{r(e.data.ok?{status:`ready`,document:e.data.document}:{status:`failed`,reason:e.data.reason})}),t.addEventListener(`error`,()=>r({status:`failed`,reason:`parse-error`})),t.postMessage({id:1,source:e}),()=>{clearTimeout(i),t.terminate()}},[e]),t!==null&&t.source===e?t.state:{status:`parsing`}}function QE(e,t,n){let[r,i]=(0,D.useState)(null);return(0,D.useEffect)(()=>{if(t===null)return;let r=!1;return e.renderMissing(t).then(e=>{r||i({grant:t,fetchedFor:n,missing:e})},()=>void 0),()=>{r=!0}},[e,t,n]),r!==null&&r.grant===t?r.missing:[]}function $E(e,t){return e===null||e.state.status===`ready`&&e.state.grant.diagnostics.some(e=>e.code===`asset-scan-failed`)?t:e.updatedAt}function eD(e,t){return{release:e.filter(e=>e!==t),keep:e.filter(e=>e===t)}}var tD={mode:`static`,requestId:null,nonce:0};function nD(e,t,n,r,i=tD){let{mode:a,requestId:o,nonce:s}=i,[c,l]=(0,D.useState)(null),u=(0,D.useRef)(null),d=(0,D.useRef)([]),f=`${t}\n${n??``}\n${a}\n${o??``}\n${String(s)}`,p=c!==null&&c.key===f?c:null,m=$E(p,r),h=p?.state.status===`ready`?p.state.grant.grant:null;return(0,D.useEffect)(()=>{let r=()=>{u.current!==null&&d.current.push(u.current.grant),u.current=null};if(n===null){r();return}let i=!1;return(o===null?e.renderGrant(t,n,{mode:a}):e.feedbackRenderGrant(o)).then(t=>{if(i){e.releaseGrants([t.grant]).catch(()=>void 0);return}r(),u.current={key:f,grant:t.grant},l({key:f,updatedAt:m,state:{status:`ready`,grant:t}})},e=>{if(!i){if(u.current?.key===f){l(e=>e!==null&&e.key===f?{...e,updatedAt:m}:e);return}r(),l({key:f,updatedAt:m,state:{status:`failed`,message:e instanceof Error?e.message:`Could not prepare the view.`}})}}),()=>{i=!0}},[e,t,n,a,o,f,m]),(0,D.useEffect)(()=>{let{release:t,keep:n}=eD(d.current,h);t.length!==0&&(d.current=n,e.releaseGrants(t).catch(()=>void 0))}),(0,D.useEffect)(()=>()=>{let t=d.current.splice(0);u.current!==null&&t.push(u.current.grant),u.current=null,t.length>0&&e.releaseGrants(t).catch(()=>void 0)},[e]),p?.state??{status:`loading`}}var rD=160,iD=480,aD=240,oD=e=>typeof e==`number`&&Number.isInteger(e)&&e>=rD&&e<=iD,sD={timeout:`Parsing did not finish within 2 seconds, so the source is shown.`,"limit-nodes":`The document has more than 100,000 elements, so the source is shown.`,"limit-depth":`The document is nested deeper than 64 levels, so the source is shown.`,"parse-error":`The document could not be parsed, so the source is shown.`},cD={missing:`The file was not found. Showing the last content that could be read.`,unreadable:`No permission to read the file. Showing the last content that could be read.`,error:`The file cannot be read as a document. Showing the last content that could be read.`};function lD(e,t){if(e===null)return null;for(let n of e.querySelectorAll(`[id]`))if(n.id===t)return n;return null}function uD({api:e,document:t,fixedRevision:n=null,request:r=null,renderSignal:i=0,waitingForRequest:a=!1,sectionTarget:o=null,restoreHeading:s=null,onHeadingShown:c,displayed:l=!0,onReady:u}){let[d,f]=PE(`view-mode`,`preview`,BE),[p,m]=PE(`markdown-width`,`standard`,VE),[h,g]=PE(`outline-width`,aD,oD),_=(0,D.useId)(),v=(0,D.useRef)(null),[y,b]=(0,D.useState)(0),x=(0,D.useRef)(null),S=Math.max(rD,Math.min(iD,y-248)),C=Math.min(h,S);(0,D.useLayoutEffect)(()=>{let e=v.current;if(!e)return;let t=()=>b(e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let w=e=>{g(Math.round(Math.min(S,Math.max(rD,e))))},T=e=>{e.button===0&&e.isPrimary&&(e.preventDefault(),e.currentTarget.focus(),x.current={pointerId:e.pointerId,x:e.clientX,width:C},e.currentTarget.setPointerCapture(e.pointerId))},E=e=>{let t=x.current;t&&t.pointerId===e.pointerId&&e.currentTarget.hasPointerCapture(e.pointerId)&&w(t.width+t.x-e.clientX)},[O,k]=(0,D.useState)(null),A=O!==null,j=n!==null,M=a?null:n??O??t.revision,[N,P]=(0,D.useState)(null),[I,R]=(0,D.useState)(null),[z,ee]=(0,D.useState)(null),[te,ne]=(0,D.useState)(null),ie=(0,D.useRef)(null),B=(0,D.useRef)(0);(0,D.useEffect)(()=>{if(M===null)return;let n=!1;return B.current=ie.current?.scrollTop??0,Promise.all([e.content(t.documentId,M),e.outline(t.documentId,M).then(e=>({items:e,error:null}),e=>({items:[],error:e instanceof Error?e.message:`Could not be fetched.`}))]).then(([e,t])=>{n||(P({revision:M,text:e,outline:t.items,outlineError:t.error}),R(null))},e=>{n||R({revision:M,message:e instanceof Error?e.message:`Could not be loaded.`})}),()=>{n=!0}},[e,t.documentId,M]);let ae=N?.text??null,oe=N?.outline??[],se=N?.outlineError??null,ce=I!==null&&I.revision===M?I.message:null,le=t.format===`markdown`,V=d===`preview`,ue=ZE(le&&V?ae:null),de=n!==null&&r?.status===`pending`&&r.revision===n?r.requestId:null,fe=de!==null&&r?.renderMode===`static`,pe=!le&&t.htmlMode===`interactive`&&t.interactiveAllowed,[me,ge]=(0,D.useState)(0),_e=nD(e,t.documentId,M,t.updatedAt,{mode:pe?`interactive`:`static`,requestId:de,nonce:me}),ve=_e.status===`ready`?_e.grant:null,ye=QE(e,ve?.grant??null,i),[be,xe]=(0,D.useState)(!1),[Se,Ce]=(0,D.useState)(null),we=ME(t.documentId),Te=n=>{xe(!1),Ce(null),e.setHtmlMode(t.documentId,n).catch(e=>Ce(e instanceof Error?e.message:`Could not change the view mode.`))},Ee=le&&V&&ue.status===`ready`,De=!le&&V?ve?.documentUrl??null:null,Oe=(0,D.useRef)(null),Ae=(0,D.useRef)(null),[Me,Pe]=(0,D.useState)(null),Fe=YE(e,Oe,l&&De!==null?ve:null,r,Ae),Ie=ae!==null&&(!V||(le?ue.status===`failed`||ue.status===`ready`&&_e.status!==`loading`:_e.status===`failed`)),Le=!a&&(M===null||(De===null?ce!==null||Ie:Me===De)),Re=(0,D.useCallback)(e=>{e!==null&&Le&&u?.()},[Le,u]);(0,D.useLayoutEffect)(()=>{ie.current&&(ae!==null||Ee)&&(ie.current.scrollTop=B.current)},[ae,Ee]);let ze=(0,D.useMemo)(()=>{if(!ve)return;let e=new Set(ve.assets.filter(e=>e.role===`image`||e.role===`svg`).map(e=>e.logicalPath));return t=>{let n=xw(t,ve.documentLogicalPath);return n===null||!e.has(n)?null:`${ve.filesBaseUrl}${dw(n)}`}},[ve]),Be=(0,D.useCallback)(async(n,r,i)=>{ne(null);try{await e.openLink(t.documentId,r,n,i),ee(null)}catch(e){if(e instanceof HS&&e.code===`E_CONFIRMATION_REQUIRED`){ee({linkId:n,revision:r,path:String(e.details.path??``),confirmation:String(e.details.confirmation??``),changed:e.details.changed===!0});return}ee(null),ne({linkId:n,revision:r,message:e instanceof Error?e.message:`Could not open the link.`})}},[e,t.documentId]),Ve=(0,D.useCallback)(e=>{let t=ve?.links.find(t=>t.href===e);ve&&t?.kind===`document`&&Be(t.linkId,ve.revision)},[ve,Be]),He=(0,D.useMemo)(()=>(0,H.jsx)(aE,{code:!0,label:`code`,text:$T}),[]),Ue=A&&!j&&t.revision!==M,We=(0,D.useMemo)(()=>new Map(ve?.headingTargets.map(e=>[e.sectionId,e.anchor])??[]),[ve]),Ge=Ee?null:De===null?le?`Available in the Markdown preview`:`Available in the HTML preview`:ve?.mode===`static`?N?.revision===ve.revision?null:`Available once the outline of the shown revision has loaded`:`Not available in the Interactive view (jumping reloads the view and restarts its scripts)`,Ke=e=>Ge===null&&(Ee||We.get(e.sectionId)===e.anchor),qe=(0,D.useCallback)(e=>{if(Ee){lD(ie.current,e.anchor)?.scrollIntoView({block:`start`});return}De!==null&&Oe.current?.contentWindow?.location.replace(`${De}#${yw(e.anchor)}`)},[Ee,De]),Je=o?.nonce??0,[Ye,Xe]=(0,D.useState)(0),Ze=o!==null&&M!==null&&N?.revision===M,Qe=Ze&&o.revision===M,$e=Qe&&Ee?oe.find(e=>e.sectionId===o.sectionId)??null:null,et=o===null||Je===Ye?null:Ze?Qe?Ee?null:`This view does not jump to sections (only the Markdown preview does).`:j?`The search result is in a different revision than the one shown. The view is showing the question's revision while awaiting an answer, so it did not jump.`:A?`The search result is in a different revision than the one shown. Updates are paused, so the view did not jump.`:`The document was updated after the search, so the view did not jump to the section. Search again.`:ce===null?null:`The revision to show could not be loaded, so the view did not jump to the section.`;(0,D.useEffect)(()=>{$e!==null&&Je!==0&&(qe($e),c?.({sectionId:$e.sectionId,title:$e.title}))},[$e,Je,qe,c]);let tt=s!==null&&Ge===null&&M!==null&&N?.revision===M&&se===null,nt=tt?oe.find(e=>e.sectionId===s.sectionId&&e.title===s.title)??oe.find(e=>e.title===s.title)??null:null,it=nt!==null&&Ke(nt),at=s?.id??null,ot=(0,D.useRef)(null);(0,D.useEffect)(()=>{if(tt&&at!==null&&ot.current!==at){if(ot.current=at,nt===null||!it){c?.(null);return}qe(nt),c?.({sectionId:nt.sectionId,title:nt.title})}},[tt,at,nt,it,qe,c]);let st=[...ve?.diagnostics??[],...ye.map(e=>({code:`asset-requested`,target:e,count:1}))],ct=ve?.mode??`static`,lt=le?[]:ve?.links??[],ut=[...et?[{label:`Section not reached`,message:et,dismiss:()=>Xe(Je),testId:`section-target-notice`}]:[],...t.sourceState!==`ready`&&cD[t.sourceState]?[{label:t.sourceState===`missing`?`File missing`:`File unreadable`,message:cD[t.sourceState]}]:[],...!le&&V&&_e.status===`failed`?[{label:`Showing source`,message:`The HTML could not be converted for display, so the source is shown (${_e.message}).`}]:[],...le&&V&&ue.status===`failed`?[{label:`Showing source`,message:sD[ue.reason]??sD[`parse-error`]}]:[],...ce?[{label:`Could not load document`,message:ce}]:[],...le&&te?[{label:`Could not open link`,message:te.message,dismiss:()=>ne(null)}]:[],...De===null&&Se?[{label:`Script change failed`,message:Se,dismiss:()=>Ce(null)}]:[]];return(0,H.jsxs)(`section`,{ref:Re,className:`flex h-full min-h-0 min-w-0 flex-1 flex-col`,"aria-label":`Document view`,children:[(0,H.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 border-b px-4 py-2`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 basis-56`,children:[(0,H.jsx)(`h1`,{className:`truncate text-base font-semibold`,children:t.title}),(0,H.jsxs)(`p`,{className:`text-xs [overflow-wrap:anywhere] text-muted-foreground`,title:t.canonicalPath??void 0,"data-testid":`document-location`,children:[(0,H.jsx)(rt,{document:t}),M&&(0,H.jsxs)(`span`,{title:M,children:[` · Revision `,M.slice(4,12)]})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t.displayPath!==null&&(0,H.jsx)(aE,{label:`document path`,text:t.displayPath}),(0,H.jsx)(aE,{label:`document ID`,text:t.documentId,icon:he,title:`Copy document ID (${t.documentId})`})]}),(0,H.jsx)(pE,{variant:`outline`,children:le?`Markdown`:`HTML`}),j?(0,H.jsx)(pE,{variant:`secondary`,children:`Showing the question's revision`}):A&&(Ue?(0,H.jsxs)(vx,{title:`A newer revision is available`,trigger:(0,H.jsxs)(pb,{variant:`ghost`,size:`xs`,children:[(0,H.jsx)(L,{"aria-hidden":`true`}),`Update available`]}),children:[(0,H.jsx)(`p`,{children:`Updates are paused. The view stays on the revision from when they were paused.`}),(0,H.jsx)(pb,{size:`sm`,variant:`outline`,onClick:()=>k(null),children:`Resume updates`})]}):(0,H.jsx)(pE,{variant:`secondary`,children:`Updates paused`})),(0,H.jsxs)(SE,{value:[d],onValueChange:e=>{let t=e[0];BE(t)&&(t===`preview`&&d!==`preview`&&!le&&ge(e=>e+1),f(t))},size:`sm`,"aria-label":`View`,children:[(0,H.jsx)(CE,{value:`preview`,children:`Preview`}),(0,H.jsx)(CE,{value:`source`,children:`Source`})]}),le&&V&&(0,H.jsxs)(pb,{variant:p===`wide`?`secondary`:`outline`,size:`sm`,"aria-pressed":p===`wide`,title:p===`wide`?`Return to standard Markdown width`:`Use the full available width for Markdown`,onClick:()=>m(p===`wide`?`standard`:`wide`),children:[(0,H.jsx)(F,{"aria-hidden":`true`}),`Wide view`]}),(0,H.jsxs)(pb,{variant:`outline`,size:`sm`,"aria-pressed":A,disabled:j,title:j?`A question is awaiting an answer, so the question's revision is shown`:void 0,onClick:()=>k(A?null:t.revision),children:[A?(0,H.jsx)(je,{"aria-hidden":`true`}):(0,H.jsx)(ke,{"aria-hidden":`true`}),A?`Resume updates`:`Pause updates`]}),(0,H.jsxs)(pb,{variant:`ghost`,size:`sm`,onClick:()=>void e.refresh(t.documentId).catch(()=>void 0),children:[(0,H.jsx)(Ne,{"aria-hidden":`true`}),`Refresh`]}),(0,H.jsxs)(vx,{title:`PDF export failed`,enabled:we.error!==null,trigger:(0,H.jsxs)(pb,{variant:`ghost`,size:`sm`,disabled:we.exporting||N===null,title:le?void 0:`Exports static HTML; scripts and interactive changes are not included`,onClick:()=>{we.error===null&&N!==null&&jE.start(e,t,N.revision)},children:[we.error?(0,H.jsx)(L,{"aria-hidden":`true`,className:`text-destructive`}):(0,H.jsx)(re,{"aria-hidden":`true`}),(0,H.jsxs)(`span`,{className:`inline-grid`,children:[(0,H.jsx)(`span`,{className:`invisible col-start-1 row-start-1`,"aria-hidden":`true`,children:`Export PDF`}),(0,H.jsx)(`span`,{className:`invisible col-start-1 row-start-1`,"aria-hidden":`true`,children:`Exporting…`}),(0,H.jsx)(`span`,{className:`col-start-1 row-start-1`,children:we.exporting?`Exporting…`:`Export PDF`})]})]}),children:[(0,H.jsx)(`p`,{children:we.error}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(pb,{size:`sm`,variant:`outline`,onClick:()=>{N&&jE.start(e,t,N.revision)},children:`Try again`}),(0,H.jsx)(pb,{size:`sm`,variant:`ghost`,onClick:()=>jE.dismiss(t.documentId),children:`Dismiss`})]})]})]}),(we.error||te)&&(0,H.jsxs)(`span`,{role:`alert`,className:`sr-only`,children:[we.error,te?.message]}),ut.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 border-b px-3 py-1`,"data-testid":`document-notices`,children:[ut.map(e=>(0,H.jsxs)(vx,{title:e.label,trigger:(0,H.jsxs)(pb,{variant:`ghost`,size:`xs`,className:`text-destructive`,"data-testid":`testId`in e?e.testId:void 0,children:[(0,H.jsx)(L,{"aria-hidden":`true`}),e.label]}),children:[(0,H.jsx)(`p`,{children:e.message}),`dismiss`in e&&(0,H.jsx)(pb,{variant:`outline`,size:`sm`,onClick:e.dismiss,children:`Dismiss`})]},e.label)),(0,H.jsx)(`span`,{role:`status`,className:`sr-only`,children:ut.map(e=>e.message).join(` `)})]}),(st.length>0||lt.length>0)&&(0,H.jsxs)(`div`,{className:`flex flex-col border-b text-sm`,children:[st.length>0&&(0,H.jsxs)(`details`,{className:`px-4 py-2`,"data-testid":`render-diagnostics`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer`,children:[`Differences from the original document (`,st.length,` kinds)`]}),(0,H.jsx)(`ul`,{className:`mt-2 flex max-h-40 list-disc flex-col gap-1 overflow-y-auto pl-5 text-muted-foreground`,children:st.map(e=>(0,H.jsx)(`li`,{className:`break-words`,children:EE(e)},`${e.code}:${e.target??``}`))})]}),lt.length>0&&(0,H.jsxs)(`details`,{className:`border-t px-4 py-2 first:border-t-0`,"data-testid":`render-links`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer`,children:[`Links in this document (`,lt.length,`)`]}),(0,H.jsx)(`ul`,{className:`mt-2 flex max-h-40 flex-col gap-1 overflow-y-auto`,children:lt.map(e=>(0,H.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[e.kind===`external`&&(0,H.jsx)(`a`,{className:`underline underline-offset-2`,href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:e.text||e.href}),e.kind===`document`&&(0,H.jsxs)(vx,{title:`Could not open link`,enabled:te?.linkId===e.linkId,trigger:(0,H.jsxs)(pb,{variant:`link`,size:`xs`,className:`h-auto p-0`,onClick:()=>{ve&&te?.linkId!==e.linkId&&Be(e.linkId,ve.revision)},children:[te?.linkId===e.linkId&&(0,H.jsx)(L,{"aria-hidden":`true`,className:`text-destructive`}),e.text||e.href]}),children:[(0,H.jsx)(`p`,{children:te?.message}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(pb,{size:`sm`,variant:`outline`,onClick:()=>{te&&Be(te.linkId,te.revision)},children:`Try again`}),(0,H.jsx)(pb,{size:`sm`,variant:`ghost`,onClick:()=>ne(null),children:`Dismiss`})]})]}),e.kind===`other`&&(0,H.jsx)(`span`,{children:e.text||e.href}),(0,H.jsxs)(`span`,{className:`text-xs break-all text-muted-foreground`,children:[e.href,e.kind===`other`&&` (this kind of link cannot be opened)`]})]},e.linkId))})]})]}),(0,H.jsxs)(`div`,{ref:v,className:`flex min-h-0 min-w-0 flex-1`,children:[De?(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(lE,{mode:ct,bridge:Fe,pinnedStatic:fe,needsPermission:t.htmlMode===`interactive`&&!t.interactiveAllowed&&!fe,modeError:Se,onRunScripts:()=>xe(!0),onStopScripts:()=>Te(`static`),onReload:()=>ge(e=>e+1)}),(0,H.jsx)(`iframe`,{ref:Oe,title:`View of ${t.title}`,src:De,onLoad:()=>{let e=Ae.current;Ae.current={url:De,count:e?.url===De?e.count+1:1},Pe(De)},sandbox:ct===`interactive`?`allow-scripts`:``,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white`,"data-testid":`document-frame`},De)]}):(0,H.jsx)(`div`,{ref:ie,className:`min-w-0 flex-1 overflow-y-auto px-6 py-5`,"data-testid":`document-body`,children:ae===null?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:ce===null?`Loading…`:`Could not load this document.`}):Ee?(0,H.jsx)(`article`,{className:`markdown-body mx-auto`,"data-width":p,children:(0,H.jsx)(nE,{document:ue.document,...ze?{resolveImage:ze}:{},onOpenLink:Ve,codeActions:He})}):V&&(le?ue.status===`parsing`:_e.status===`loading`)?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Preparing the view…`}):(0,H.jsx)(`pre`,{className:`font-mono text-sm leading-relaxed break-words whitespace-pre-wrap`,children:ae})}),(oe.length>0||se!==null)&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize outline`,"aria-controls":_,"aria-valuemin":rD,"aria-valuemax":S,"aria-valuenow":C,tabIndex:0,className:`relative hidden w-2 shrink-0 touch-none cursor-col-resize before:absolute before:inset-y-0 before:left-1/2 before:w-px before:bg-border hover:bg-muted hover:before:bg-primary/60 focus-visible:bg-primary/10 focus-visible:before:bg-primary focus-visible:outline-none active:bg-primary/10 active:before:bg-primary lg:block`,onPointerDown:T,onPointerMove:E,onLostPointerCapture:()=>{x.current=null},onKeyDown:e=>{let t=e.key===`ArrowLeft`?C+16:e.key===`ArrowRight`?C-16:e.key===`Home`?rD:e.key===`End`?S:null;t!==null&&(e.preventDefault(),w(t))}}),(0,H.jsxs)(`aside`,{id:_,style:{width:C},className:`hidden shrink-0 overflow-y-auto px-3 py-4 lg:block`,"aria-label":`Outline`,children:[(0,H.jsx)(`h2`,{className:`mb-2 text-xs font-medium text-muted-foreground`,children:`Outline`}),se!==null&&(0,H.jsxs)(`p`,{className:`text-xs text-destructive`,role:`alert`,children:[`Could not fetch the outline (`,se,`).`]}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-0.5 text-sm`,children:oe.map(e=>{let t=Ke(e);return(0,H.jsx)(`li`,{style:{paddingLeft:`${String((e.level-1)*.75)}rem`},children:(0,H.jsx)(`button`,{type:`button`,className:`w-full truncate rounded px-2 py-1 text-left hover:bg-muted disabled:opacity-50`,disabled:!t,title:t?e.title:Ge??`This heading is not in the view (removed from the display, or an earlier element has the same id)`,onClick:()=>{qe(e),c?.({sectionId:e.sectionId,title:e.title})},children:e.title})},e.sectionId)})})]})]})]}),(0,H.jsx)(mb,{open:be,onOpenChange:xe,children:(0,H.jsxs)(_b,{children:[(0,H.jsxs)(vb,{children:[(0,H.jsx)(bb,{children:`Run the scripts in this document?`}),(0,H.jsxs)(xb,{children:[`This runs the scripts in this HTML inside your browser. `,(0,H.jsx)(oE,{}),` This is not a mechanism for running arbitrary scripts safely. Enable it only for trusted HTML that you or your agent prepared.`]})]}),(0,H.jsxs)(yb,{children:[(0,H.jsx)(Cb,{children:`Back`}),(0,H.jsx)(Sb,{onClick:()=>Te(`interactive`),children:`Run scripts`})]})]})}),(0,H.jsx)(mb,{open:z!==null,onOpenChange:e=>{e||ee(null)},children:(0,H.jsxs)(_b,{children:[(0,H.jsxs)(vb,{children:[(0,H.jsx)(bb,{children:`Add this document to the list and open it?`}),(0,H.jsx)(xb,{className:`break-all`,children:z?.path})]}),z?.changed&&(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:`While you were confirming, the link target changed or the confirmation expired. Check the path above again.`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This is the file that a link in the document points to. It is not open yet. Opening it adds it to the document list and to search.`}),(0,H.jsxs)(yb,{children:[(0,H.jsx)(Cb,{children:`Don't open`}),(0,H.jsx)(Sb,{onClick:()=>{z&&Be(z.linkId,z.revision,z.confirmation)},children:`Add to list and open`})]})]})})]})}function dD(e,t,n,r){let[i,a]=(0,D.useState)(null),[o,s]=(0,D.useState)(0),c=(0,D.useCallback)(()=>s(e=>e+1),[]),l=`${String(n)}\n${r??``}\n${String(o)}`;(0,D.useEffect)(()=>{if(t===null)return;let n=!1;return e.feedback(t).then(e=>{n||a({requestId:t,fetchedFor:l,request:e,error:null})},e=>{n||a(n=>({requestId:t,fetchedFor:l,request:n?.requestId===t?n.request:null,error:e instanceof Error?e.message:`Could not fetch the question.`}))}),()=>{n=!0}},[e,t,l]);let u=i!==null&&i.requestId===t?i:null;return{request:u?.request??null,error:u?.error??null,reload:c}}function fD({documents:e,...t}){let[n,r]=(0,D.useState)(t.document.documentId),i=e.find(e=>e.documentId===n),a=i!==void 0&&i.documentId!==t.document.documentId,o=a?[i,t.document]:[t.document],s=(0,D.useCallback)(()=>r(t.document.documentId),[t.document.documentId]);return(0,H.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1`,"aria-busy":a,children:o.map(e=>{let n=e.documentId===t.document.documentId,r=!a||!n;return(0,H.jsx)(`div`,{className:r?`flex min-h-0 min-w-0 flex-1`:`invisible absolute inset-0 flex min-h-0 min-w-0`,"aria-hidden":!r,inert:a,"data-testid":`document-workspace`,children:(0,H.jsx)(pD,{...t,document:e,displayed:r,onReady:n?s:void 0,sectionTarget:n&&r?t.sectionTarget:null,restoreHeading:n&&r?t.restoreHeading:null,onHeadingShown:n&&r?t.onHeadingShown:void 0})},e.documentId)})})}function pD({api:e,document:t,feedbackSignal:n,renderSignal:r,sectionTarget:i=null,restoreHeading:a=null,onHeadingShown:o,displayed:s=!0,onReady:c}){let l=t.pendingRequestIds[0]??null,[u,d]=(0,D.useState)(l);l!==null&&l!==u&&d(l);let f=l??u,{request:p,error:m,reload:h}=dD(e,f,n,t.revision),g=p?.status===`pending`?p.revision:null;return(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col min-[900px]:flex-row`,children:[(0,H.jsx)(uD,{api:e,document:t,fixedRevision:g,request:p,renderSignal:r,waitingForRequest:l!==null&&p===null&&m===null,sectionTarget:i,restoreHeading:a,displayed:s,...c?{onReady:c}:{},...o?{onHeadingShown:o}:{}}),p?(0,H.jsx)(oC,{api:e,request:p,reload:h},p.requestId):m!==null&&f!==null&&(0,H.jsx)(`aside`,{"aria-label":`Answer the question`,className:`w-full shrink-0 border-t px-4 py-4 min-[900px]:w-96 min-[900px]:border-t-0 min-[900px]:border-l`,children:(0,H.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Could not fetch the question (`,m,`).`]})})]})}var mD=h_(function(e){return Ov(`dialog`,e)});function hD({...e}){return(0,H.jsx)(mD,{"data-slot":`dialog`,...e})}function gD({...e}){return(0,H.jsx)(sy,{"data-slot":`dialog-portal`,...e})}function _D({className:e,...t}){return(0,H.jsx)(Av,{"data-slot":`dialog-overlay`,className:ab(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function vD({className:e,children:t,showCloseButton:n=!0,...r}){return(0,H.jsxs)(gD,{children:[(0,H.jsx)(_D,{}),(0,H.jsxs)(iy,{"data-slot":`dialog-content`,className:ab(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,H.jsxs)(Rv,{"data-slot":`dialog-close`,render:(0,H.jsx)(pb,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,H.jsx)(ze,{}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function yD({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`dialog-header`,className:ab(`flex flex-col gap-2`,e),...t})}function bD({className:e,...t}){return(0,H.jsx)(cy,{"data-slot":`dialog-title`,className:ab(`font-heading text-base leading-none font-medium`,e),...t})}function xD({className:e,...t}){return(0,H.jsx)(Bv,{"data-slot":`dialog-description`,className:ab(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}var SD=200,CD=20;function wD({api:e,open:t,onOpenChange:n,onSelect:r}){let[i,a]=(0,D.useState)(``),[o,s]=(0,D.useState)(null),[c,l]=(0,D.useState)(0),u=(0,D.useId)(),d=i.trim();(0,D.useEffect)(()=>{if(!t||d===``)return;let n=!1,r=setTimeout(()=>{e.search(d,CD).then(e=>{n||s({query:d,result:e,error:null})},e=>{n||s({query:d,result:null,error:e instanceof Error?e.message:`Search failed.`})})},SD);return()=>{n=!0,clearTimeout(r)}},[e,t,d]);let f=o!==null&&o.query===d?o:null,p=f?.result?.hits??[],m=e=>Math.max(0,Math.min(e,p.length-1)),h=m(c);(0,D.useEffect)(()=>{p.length!==0&&window.document.getElementById(`${u}-${String(h)}`)?.scrollIntoView?.({block:`nearest`})},[h,p.length,u]);let g=e=>{e&&(n(!1),r(e))};return(0,H.jsx)(hD,{open:t,onOpenChange:e=>{n(e),e||(a(``),l(0))},children:(0,H.jsxs)(vD,{className:`top-[15%] translate-y-0 sm:max-w-xl`,children:[(0,H.jsxs)(yD,{children:[(0,H.jsx)(bD,{children:`Search open documents`}),(0,H.jsx)(xD,{children:`Only documents that are currently open are searched. Closed documents and other files are not.`})]}),(0,H.jsx)(nS,{"aria-label":`Search query`,"aria-controls":u,"aria-activedescendant":p.length>0?`${u}-${String(h)}`:void 0,placeholder:`Words or a file name`,value:i,onChange:e=>{a(e.target.value),l(0)},onKeyDown:e=>{e.nativeEvent.isComposing||p.length!==0&&(e.key===`ArrowDown`?(e.preventDefault(),l(e=>m(m(e)+1))):e.key===`ArrowUp`?(e.preventDefault(),l(e=>m(m(e)-1))):e.key===`Enter`&&(e.preventDefault(),g(p[h])))}}),(0,H.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`text-xs text-muted-foreground`,children:d===``?`Type to search the open documents. Use ↑↓ to select and Enter to jump.`:f===null?`Searching…`:f.error===null?`${String(p.length)} ${p.length===1?`result`:`results`}${f.result?.incomplete===!0?` (some documents are not indexed yet, so not all documents were searched)`:``}`:`Search failed (${f.error}).`}),(0,H.jsx)(`div`,{id:u,role:`listbox`,"aria-label":`Search results`,className:`flex max-h-80 flex-col gap-1 overflow-y-auto`,children:p.map((e,t)=>(0,H.jsxs)(`div`,{id:`${u}-${String(t)}`,role:`option`,"aria-selected":t===h,className:`cursor-pointer rounded-md px-3 py-2 text-sm aria-selected:bg-muted`,tabIndex:-1,onMouseEnter:()=>l(t),onClick:()=>g(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),g(e))},children:[(0,H.jsxs)(`p`,{className:`truncate font-medium`,children:[e.title,e.headingPath.length>0&&(0,H.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[` `,`— `,e.headingPath.join(` › `)]})]}),(0,H.jsx)(`p`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:e.excerpt}),e.displayPath&&(0,H.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.displayPath})]},`${e.documentId}:${e.sectionId}`))})]})})}var TD=Symbol.for(`preact-signals`);function ED(){if(MD>1)MD--;else{var e,t=!1;for((function(){var e=ID;for(ID=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();jD!==void 0;){var n=jD;for(jD=void 0,ND++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&VD(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(ND=0,MD--,t)throw e}}function DD(e){if(MD>0)return e();FD=++PD,MD++;try{return e()}finally{ED()}}var OD,kD=void 0;function AD(e){var t=kD,n=OD;kD=void 0,OD=void 0;try{return e()}finally{kD=t,OD=n}}var jD=void 0,MD=0,ND=0,PD=0,FD=0,ID=void 0,LD=0;function RD(e){if(kD!==void 0){var t=e.n;if(t===void 0||t.t!==kD)return t={i:0,S:e,p:kD.s,n:void 0,t:kD,e:void 0,x:void 0,r:t},kD.s!==void 0&&(kD.s.n=t),kD.s=t,e.n=t,32&kD.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=kD.s,t.n=void 0,kD.s.n=t,kD.s=t),t}}function zD(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}zD.prototype.brand=TD,zD.prototype.h=function(){return!0},zD.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?AD(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},zD.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&AD(function(){var e;(e=t.Z)==null||e.call(t)}))}},zD.prototype.subscribe=function(e){var t=this;return XD(function(){var n=t.value;AD(function(){return e(n)})},{name:`sub`})},zD.prototype.valueOf=function(){return this.value},zD.prototype.toString=function(){return this.value+``},zD.prototype.toJSON=function(){return this.value},zD.prototype.peek=function(){var e=this;return AD(function(){return e.value})},Object.defineProperty(zD.prototype,"value",{get:function(){var e=RD(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(ND>100)throw Error(`Cycle detected`);(function(e){MD!==0&&ND===0&&e.l!==FD&&(e.l=FD,ID={S:e,v:e.v,i:e.i,o:ID})})(this),this.v=e,this.i++,LD++,MD++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{ED()}}}});function BD(e,t){return new zD(e,t)}function VD(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function HD(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function UD(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function WD(e,t){zD.call(this,void 0,t),this.x=e,this.s=void 0,this.g=LD-1,this.f=4}WD.prototype=new zD,WD.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===LD))return!0;if(this.g=LD,this.f|=1,this.i>0&&!VD(this))return this.f&=-2,!0;var e=kD;try{HD(this),kD=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return kD=e,UD(this),this.f&=-2,!0},WD.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}zD.prototype.S.call(this,e)},WD.prototype.U=function(e){if(this.t!==void 0&&(zD.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},WD.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(WD.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=RD(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function GD(e,t){return new WD(e,t)}function KD(e){var t=e.m;if(e.m=void 0,typeof t==`function`){MD++;var n=kD;kD=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,qD(e),t}finally{kD=n,ED()}}}function qD(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,KD(e)}function JD(e){if(kD!==this)throw Error(`Out-of-order effect`);UD(this),kD=e,this.f&=-2,8&this.f&&qD(this),ED()}function YD(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,OD&&OD.push(this)}YD.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.m=t)}finally{e()}},YD.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,KD(this),HD(this),MD++;var e=kD;return kD=this,JD.bind(this,e)},YD.prototype.N=function(){2&this.f||(this.f|=2,this.u=jD,jD=this)},YD.prototype.d=function(){this.f|=8,1&this.f||qD(this)},YD.prototype.dispose=function(){this.d()};function XD(e,t){var n=new YD(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var ZD=Object.create,QD=Object.defineProperty,$D=Object.defineProperties,eO=Object.getOwnPropertyDescriptor,tO=Object.getOwnPropertyDescriptors,nO=Object.getOwnPropertySymbols,rO=Object.prototype.hasOwnProperty,iO=Object.prototype.propertyIsEnumerable,aO=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),oO=e=>{throw TypeError(e)},sO=(e,t,n)=>t in e?QD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cO=(e,t)=>{for(var n in t||={})rO.call(t,n)&&sO(e,n,t[n]);if(nO)for(var n of nO(t))iO.call(t,n)&&sO(e,n,t[n]);return e},lO=(e,t)=>$D(e,tO(t)),uO=(e,t)=>QD(e,`name`,{value:t,configurable:!0}),dO=e=>[,,,ZD(e?.[aO(`metadata`)]??null)],fO=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],pO=e=>e!==void 0&&typeof e!=`function`?oO(`Function expected`):e,mO=(e,t,n,r,i)=>({kind:fO[e],name:t,metadata:r,addInitializer:e=>n._?oO(`Already initialized`):i.push(pO(e||null))}),hO=(e,t)=>sO(t,aO(`metadata`),e[3]),gO=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},_O=(e,t,n,r,i,a)=>{var o,s,c,l,u,d=t&7,f=!!(t&8),p=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,h=fO[d+5],g=d>3&&(e[m-1]=[]),_=e[m]||(e[m]=[]),v=d&&(!p&&!f&&(i=i.prototype),d<5&&(d>3||!p)&&eO(d<4?i:{get[n](){return bO(this,a)},set[n](e){return SO(this,a,e)}},n));d?p&&d<4&&uO(a,(d>2?`set `:d>1?`get `:``)+n):uO(i,n);for(var y=r.length-1;y>=0;y--)l=mO(d,n,c={},e[3],_),d&&(l.static=f,l.private=p,u=l.access={has:p?e=>yO(i,e):e=>n in e},d^3&&(u.get=p?e=>(d^1?bO:CO)(e,i,d^4?a:v.get):e=>e[n]),d>2&&(u.set=p?(e,t)=>SO(e,i,t,d^4?a:v.set):(e,t)=>e[n]=t)),s=(0,r[y])(d?d<4?p?a:v[h]:d>4?void 0:{get:v.get,set:v.set}:i,l),c._=1,d^4||s===void 0?pO(s)&&(d>4?g.unshift(s):d?p?a=s:v[h]=s:i=s):typeof s!=`object`||!s?oO(`Object expected`):(pO(o=s.get)&&(v.get=o),pO(o=s.set)&&(v.set=o),pO(o=s.init)&&g.unshift(o));return d||hO(e,i),v&&QD(i,n,v),p?d^4?a:v:i},vO=(e,t,n)=>t.has(e)||oO(`Cannot `+n),yO=(e,t)=>Object(t)===t?e.has(t):oO(`Cannot use the "in" operator on this value`),bO=(e,t,n)=>(vO(e,t,`read from private field`),n?n.call(e):t.get(e)),xO=(e,t,n)=>t.has(e)?oO(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),SO=(e,t,n,r)=>(vO(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),CO=(e,t,n)=>(vO(e,t,`access private method`),n);function wO(e,t){if(t){let n;return GD(()=>{let r=e();return r&&n&&t(n,r)?n:(n=r,r)})}return GD(e)}function TO(e,t){if(Object.is(e,t))return!0;if(e===null||t===null)return!1;if(typeof e==`function`&&typeof t==`function`)return e===t;if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:!e.some((e,n)=>!TO(e,t[n]));if(typeof e==`object`&&typeof t==`object`){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&!n.some(n=>!TO(e[n],t[n]))}return!1}function EO({get:e},t){return{init(e){return BD(e)},get(){return e.call(this).value},set(t){let n=e.call(this);n.peek()!==t&&(n.value=t)}}}function DO(e,t){let n=new WeakMap;return function(){let t=n.get(this);return t||(t=wO(e.bind(this)),n.set(this,t)),t.value}}function OO(e=!0){return function(t,n){n.addInitializer(function(){let t=n.kind===`field`||n.static?this:Object.getPrototypeOf(this),r=Object.getOwnPropertyDescriptor(t,n.name);r&&Object.defineProperty(t,n.name,lO(cO({},r),{enumerable:e}))})}}function kO(...e){let t=e.map(e=>XD(e));return()=>t.forEach(e=>e())}var AO,jO,MO,NO,PO,FO=[EO],IO,LO,RO,zO,BO,VO,HO,UO,WO,GO,KO,qO,JO,YO;PO=[EO],NO=[EO],MO=[OO()],jO=[OO()],AO=[OO()];var XO=class{constructor(e,t=Object.is){this.defaultValue=e,this.equals=t,gO(IO,5,this),xO(this,VO),xO(this,LO,gO(IO,8,this)),gO(IO,11,this),xO(this,HO,gO(IO,12,this)),gO(IO,15,this),xO(this,KO,gO(IO,16,this)),gO(IO,19,this),this.reset=this.reset.bind(this),this.reset()}get current(){return bO(this,VO,JO)}get initial(){return bO(this,VO,zO)}get previous(){return bO(this,VO,WO)}set current(e){let t=AD(()=>bO(this,VO,JO));e&&t&&this.equals(t,e)||DD(()=>{bO(this,VO,zO)||SO(this,VO,e,BO),SO(this,VO,t,GO),SO(this,VO,e,YO)})}reset(e=this.defaultValue){DD(()=>{SO(this,VO,void 0,GO),SO(this,VO,e,BO),SO(this,VO,e,YO)})}};IO=dO(null),LO=new WeakMap,VO=new WeakSet,HO=new WeakMap,KO=new WeakMap,RO=_O(IO,20,`#initial`,FO,VO,LO),zO=RO.get,BO=RO.set,UO=_O(IO,20,`#previous`,PO,VO,HO),WO=UO.get,GO=UO.set,qO=_O(IO,20,`#current`,NO,VO,KO),JO=qO.get,YO=qO.set,_O(IO,2,`current`,MO,XO),_O(IO,2,`initial`,jO,XO),_O(IO,2,`previous`,AO,XO),hO(IO,XO);function ZO(e){return AD(()=>{let t={};for(let n in e)t[n]=e[n];return t})}var QO,$O=class{constructor(){xO(this,QO,new WeakMap)}get(e,t){return e?bO(this,QO).get(e)?.get(t):void 0}set(e,t,n){if(e)return bO(this,QO).has(e)||bO(this,QO).set(e,new Map),bO(this,QO).get(e)?.set(t,n)}clear(e){return e?bO(this,QO).get(e)?.clear():void 0}};QO=new WeakMap;var ek=Object.create,tk=Object.defineProperty,nk=Object.getOwnPropertyDescriptor,rk=Object.getOwnPropertySymbols,ik=Object.prototype.hasOwnProperty,ak=Object.prototype.propertyIsEnumerable,ok=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),sk=e=>{throw TypeError(e)},ck=Math.pow,lk=(e,t,n)=>t in e?tk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uk=(e,t)=>{for(var n in t||={})ik.call(t,n)&&lk(e,n,t[n]);if(rk)for(var n of rk(t))ak.call(t,n)&&lk(e,n,t[n]);return e},dk=(e,t)=>tk(e,`name`,{value:t,configurable:!0}),fk=e=>[,,,ek(e?.[ok(`metadata`)]??null)],pk=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],mk=e=>e!==void 0&&typeof e!=`function`?sk(`Function expected`):e,hk=(e,t,n,r,i)=>({kind:pk[e],name:t,metadata:r,addInitializer:e=>n._?sk(`Already initialized`):i.push(mk(e||null))}),gk=(e,t)=>lk(t,ok(`metadata`),e[3]),_k=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},vk=(e,t,n,r,i,a)=>{var o,s,c,l,u,d=t&7,f=!!(t&8),p=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,h=pk[d+5],g=d>3&&(e[m-1]=[]),_=e[m]||(e[m]=[]),v=d&&(!p&&!f&&(i=i.prototype),d<5&&(d>3||!p)&&nk(d<4?i:{get[n](){return xk(this,a)},set[n](e){return Ck(this,a,e)}},n));d?p&&d<4&&dk(a,(d>2?`set `:d>1?`get `:``)+n):dk(i,n);for(var y=r.length-1;y>=0;y--)l=hk(d,n,c={},e[3],_),d&&(l.static=f,l.private=p,u=l.access={has:p?e=>bk(i,e):e=>n in e},d^3&&(u.get=p?e=>(d^1?xk:wk)(e,i,d^4?a:v.get):e=>e[n]),d>2&&(u.set=p?(e,t)=>Ck(e,i,t,d^4?a:v.set):(e,t)=>e[n]=t)),s=(0,r[y])(d?d<4?p?a:v[h]:d>4?void 0:{get:v.get,set:v.set}:i,l),c._=1,d^4||s===void 0?mk(s)&&(d>4?g.unshift(s):d?p?a=s:v[h]=s:i=s):typeof s!=`object`||!s?sk(`Object expected`):(mk(o=s.get)&&(v.get=o),mk(o=s.set)&&(v.set=o),mk(o=s.init)&&g.unshift(o));return d||gk(e,i),v&&tk(i,n,v),p?d^4?a:v:i},yk=(e,t,n)=>t.has(e)||sk(`Cannot `+n),bk=(e,t)=>Object(t)===t?e.has(t):sk(`Cannot use the "in" operator on this value`),xk=(e,t,n)=>(yk(e,t,`read from private field`),n?n.call(e):t.get(e)),Sk=(e,t,n)=>t.has(e)?sk(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Ck=(e,t,n,r)=>(yk(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),wk=(e,t,n)=>(yk(e,t,`access private method`),n),Tk=class e{constructor(e,t){this.x=e,this.y=t}static delta(t,n){return new e(t.x-n.x,t.y-n.y)}static distance(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}static equals(e,t){return e.x===t.x&&e.y===t.y}static from({x:t,y:n}){return new e(t,n)}},Ek=class e{constructor(e,t,n,r){this.left=e,this.top=t,this.width=n,this.height=r,this.scale={x:1,y:1}}get inverseScale(){return{x:1/this.scale.x,y:1/this.scale.y}}translate(t,n){let{top:r,left:i,width:a,height:o,scale:s}=this,c=new e(i+t,r+n,a,o);return c.scale=uk({},s),c}get boundingRectangle(){let{width:e,height:t,left:n,top:r,right:i,bottom:a}=this;return{width:e,height:t,left:n,top:r,right:i,bottom:a}}get center(){let{left:e,top:t,right:n,bottom:r}=this;return new Tk((e+n)/2,(t+r)/2)}get area(){let{width:e,height:t}=this;return e*t}equals(t){if(!(t instanceof e))return!1;let{left:n,top:r,width:i,height:a}=this;return n===t.left&&r===t.top&&i===t.width&&a===t.height}containsPoint(e){let{top:t,left:n,bottom:r,right:i}=this;return t<=e.y&&e.y<=r&&n<=e.x&&e.x<=i}intersectionArea(t){return t instanceof e?Dk(this,t):0}intersectionRatio(e){let{area:t}=this,n=this.intersectionArea(e);return n/(e.area+t-n)}get bottom(){let{top:e,height:t}=this;return e+t}get right(){let{left:e,width:t}=this;return e+t}get aspectRatio(){let{width:e,height:t}=this;return e/t}get corners(){return[{x:this.left,y:this.top},{x:this.right,y:this.top},{x:this.left,y:this.bottom},{x:this.right,y:this.bottom}]}static from({top:t,left:n,width:r,height:i}){return new e(n,t,r,i)}static delta(e,t,n={x:`center`,y:`center`}){let r=(e,t)=>{let r=n[t],i=t===`x`?e.left:e.top,a=t===`x`?e.width:e.height;return r==`start`?i:r==`end`?i+a:i+a/2};return Tk.delta({x:r(e,`x`),y:r(e,`y`)},{x:r(t,`x`),y:r(t,`y`)})}static intersectionRatio(t,n){return e.from(t).intersectionRatio(e.from(n))}};function Dk(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;return r<i&&n<a?o*s:0}var Ok,kk,Ak,jk,Mk,Nk=class extends (Ak=XO,kk=[DO],Ok=[DO],Ak){constructor(e){let t=Tk.from(e);super(t,(e,t)=>Tk.equals(e,t)),_k(Mk,5,this),Sk(this,jk,0),this.velocity={x:0,y:0}}get delta(){return Tk.delta(this.current,this.initial)}get direction(){let{current:e,previous:t}=this;if(!t)return null;let n={x:e.x-t.x,y:e.y-t.y};return!n.x&&!n.y?null:Math.abs(n.x)>Math.abs(n.y)?n.x>0?`right`:`left`:n.y>0?`down`:`up`}get current(){return super.current}set current(e){let{current:t}=this,n=Tk.from(e),r={x:n.x-t.x,y:n.y-t.y},i=Date.now(),a=i-xk(this,jk),o=e=>Math.round(e/a*100);DD(()=>{Ck(this,jk,i),this.velocity={x:o(r.x),y:o(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(Tk.from(e)),this.velocity={x:0,y:0}}};Mk=fk(Ak),jk=new WeakMap,vk(Mk,2,`delta`,kk,Nk),vk(Mk,2,`direction`,Ok,Nk),gk(Mk,Nk);function Pk({x:e,y:t},n){let r=Math.abs(e),i=Math.abs(t);return typeof n==`number`?Math.sqrt(ck(r,2)+ck(i,2))>n:`x`in n&&`y`in n?r>n.x&&i>n.y:`x`in n?r>n.x:`y`in n&&i>n.y}var Fk=(e=>(e.Horizontal=`x`,e.Vertical=`y`,e))(Fk||{}),Ik=Object.values(Fk),Lk=Object.create,Rk=Object.defineProperty,zk=Object.defineProperties,Bk=Object.getOwnPropertyDescriptor,Vk=Object.getOwnPropertyDescriptors,Hk=Object.getOwnPropertySymbols,Uk=Object.prototype.hasOwnProperty,Wk=Object.prototype.propertyIsEnumerable,Gk=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),Kk=e=>{throw TypeError(e)},qk=(e,t,n)=>t in e?Rk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jk=(e,t)=>{for(var n in t||={})Uk.call(t,n)&&qk(e,n,t[n]);if(Hk)for(var n of Hk(t))Wk.call(t,n)&&qk(e,n,t[n]);return e},Yk=(e,t)=>zk(e,Vk(t)),Xk=(e,t)=>Rk(e,`name`,{value:t,configurable:!0}),Zk=(e,t)=>{var n={};for(var r in e)Uk.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Hk)for(var r of Hk(e))t.indexOf(r)<0&&Wk.call(e,r)&&(n[r]=e[r]);return n},Qk=e=>[,,,Lk(e?.[Gk(`metadata`)]??null)],$k=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],eA=e=>e!==void 0&&typeof e!=`function`?Kk(`Function expected`):e,tA=(e,t,n,r,i)=>({kind:$k[e],name:t,metadata:r,addInitializer:e=>n._?Kk(`Already initialized`):i.push(eA(e||null))}),nA=(e,t)=>qk(t,Gk(`metadata`),e[3]),rA=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},iA=(e,t,n,r,i,a)=>{var o,s,c,l,u,d=t&7,f=!!(t&8),p=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,h=$k[d+5],g=d>3&&(e[m-1]=[]),_=e[m]||(e[m]=[]),v=d&&(!p&&!f&&(i=i.prototype),d<5&&(d>3||!p)&&Bk(d<4?i:{get[n](){return sA(this,a)},set[n](e){return lA(this,a,e)}},n));d?p&&d<4&&Xk(a,(d>2?`set `:d>1?`get `:``)+n):Xk(i,n);for(var y=r.length-1;y>=0;y--)l=tA(d,n,c={},e[3],_),d&&(l.static=f,l.private=p,u=l.access={has:p?e=>oA(i,e):e=>n in e},d^3&&(u.get=p?e=>(d^1?sA:uA)(e,i,d^4?a:v.get):e=>e[n]),d>2&&(u.set=p?(e,t)=>lA(e,i,t,d^4?a:v.set):(e,t)=>e[n]=t)),s=(0,r[y])(d?d<4?p?a:v[h]:d>4?void 0:{get:v.get,set:v.set}:i,l),c._=1,d^4||s===void 0?eA(s)&&(d>4?g.unshift(s):d?p?a=s:v[h]=s:i=s):typeof s!=`object`||!s?Kk(`Object expected`):(eA(o=s.get)&&(v.get=o),eA(o=s.set)&&(v.set=o),eA(o=s.init)&&g.unshift(o));return d||nA(e,i),v&&Rk(i,n,v),p?d^4?a:v:i},aA=(e,t,n)=>t.has(e)||Kk(`Cannot `+n),oA=(e,t)=>Object(t)===t?e.has(t):Kk(`Cannot use the "in" operator on this value`),sA=(e,t,n)=>(aA(e,t,`read from private field`),n?n.call(e):t.get(e)),cA=(e,t,n)=>t.has(e)?Kk(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),lA=(e,t,n,r)=>(aA(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),uA=(e,t,n)=>(aA(e,t,`access private method`),n);function dA(e,t){return{plugin:e,options:t}}function fA(e){return t=>dA(e,t)}function pA(e){return typeof e==`function`?{plugin:e,options:void 0}:e}var mA=[EO],hA,gA,_A,vA=class{constructor(e,t){this.manager=e,this.options=t,cA(this,gA,rA(hA,8,this,!1)),rA(hA,11,this),cA(this,_A,new Set)}enable(){this.disabled=!1}disable(){this.disabled=!0}isDisabled(){return AD(()=>this.disabled)}configure(e){this.options=e}registerEffect(e){let t=XD(e.bind(this));return sA(this,_A).add(t),t}destroy(){sA(this,_A).forEach(e=>e())}static configure(e){return dA(this,e)}};hA=Qk(null),gA=new WeakMap,_A=new WeakMap,iA(hA,4,`disabled`,mA,vA,gA),nA(hA,vA);var yA=class extends vA{},bA,xA=class{constructor(e){this.manager=e,this.instances=new Map,cA(this,bA,[])}get values(){return Array.from(this.instances.values())}set values(e){let t=e.map(pA).reduce((e,t)=>{let n=e.find(({plugin:e})=>e===t.plugin);return n?(n.options=t.options,e):[...e,t]},[]),n=t.map(({plugin:e})=>e);for(let e of sA(this,bA))if(!n.includes(e)){if(e.prototype instanceof yA)continue;this.unregister(e)}for(let{plugin:e,options:n}of t)this.register(e,n);lA(this,bA,n)}get(e){return this.instances.get(e)}register(e,t){let n=this.instances.get(e);if(n)return n.options!==t&&(n.options=t),n;let r=new e(this.manager,t);return this.instances.set(e,r),r}unregister(e){let t=this.instances.get(e);t&&(t.destroy(),this.instances.delete(e))}destroy(){for(let e of this.instances.values())e.destroy();this.instances.clear()}};bA=new WeakMap;function SA(e,t){return e.priority===t.priority?e.type===t.type?t.value-e.value:t.type-e.type:t.priority-e.priority}var CA=[],wA,TA,EA=class extends vA{constructor(e){super(e),cA(this,wA),cA(this,TA),this.computeCollisions=this.computeCollisions.bind(this),lA(this,TA,BD(CA)),this.destroy=kO(()=>{let e=this.computeCollisions(),t=AD(()=>this.manager.dragOperation.position.current);if(e!==CA){let e=sA(this,wA);if(lA(this,wA,t),e&&t.x==e.x&&t.y==e.y)return}else lA(this,wA,void 0);sA(this,TA).value=e},()=>{let{dragOperation:e}=this.manager;e.status.initialized&&this.forceUpdate()})}forceUpdate(e=!0){AD(()=>{e?sA(this,TA).value=this.computeCollisions():lA(this,wA,void 0)})}computeCollisions(e,t){let{registry:n,dragOperation:r}=this.manager,{source:i,shape:a,status:o}=r;if(!o.initialized||!a)return CA;let s=[],c=[];for(let a of e??n.droppables){if(a.disabled||i&&!a.accepts(i))continue;let e=t??a.collisionDetector;if(!e)continue;c.push(a),a.shape;let n=AD(()=>e({droppable:a,dragOperation:r}));n&&(a.collisionPriority!=null&&(n.priority=a.collisionPriority),s.push(n))}return c.length===0?CA:(s.sort(SA),s)}get collisions(){return sA(this,TA).value}};wA=new WeakMap,TA=new WeakMap;var DA,OA,kA=[EO],AA,jA,MA,NA,PA,FA,IA;OA=[EO],DA=[EO];var LA=class e{constructor(e,t){cA(this,NA,rA(MA,8,this)),rA(MA,11,this),cA(this,PA),cA(this,FA,rA(MA,12,this)),rA(MA,15,this),cA(this,IA,rA(MA,16,this)),rA(MA,19,this);let{effects:n,id:r,data:i={},disabled:a=!1,register:o=!0}=e,s=r;lA(this,PA,BD(r)),this.manager=t,this.data=i,this.disabled=a,this.effects=()=>[()=>{let{id:e,manager:t}=this;if(e!==s)return s=e,t?.registry.register(this),()=>t?.registry.unregister(this)},...n?.()??[]],this.register=this.register.bind(this),this.unregister=this.unregister.bind(this),this.destroy=this.destroy.bind(this),t&&o&&queueMicrotask(this.register)}get id(){let t=sA(this,PA).value;return e.pendingIdChanges?.get(this)??t}set id(t){t!==(e.pendingIdChanges?.get(this)??sA(this,PA).peek())&&(e.pendingIdChanges||(e.pendingIdChanges=new Map,queueMicrotask(()=>{var t;return uA(t=e,AA,jA).call(t)})),e.pendingIdChanges.set(this,t))}register(){return this.manager?.registry.register(this)}unregister(){var e;(e=this.manager)==null||e.registry.unregister(this)}destroy(){var e;(e=this.manager)==null||e.registry.unregister(this)}};MA=Qk(null),AA=new WeakSet,jA=function(){let e=LA.pendingIdChanges;LA.pendingIdChanges=null,e&&DD(()=>{for(let[t,n]of e)sA(t,PA).value=n})},NA=new WeakMap,PA=new WeakMap,FA=new WeakMap,IA=new WeakMap,iA(MA,4,`manager`,kA,LA,NA),iA(MA,4,`data`,OA,LA,FA),iA(MA,4,`disabled`,DA,LA,IA),cA(LA,AA),nA(MA,LA),LA.pendingIdChanges=null;var RA=LA,zA=class{constructor(){this.map=BD(new Map),this.cleanupFunctions=new WeakMap,this.register=(e,t)=>{let n=this.map.peek(),r=n.get(e),i=()=>this.unregister(e,t);if(r===t)return i;r&&r.id===e&&(this.cleanupFunctions.get(r)?.(),this.cleanupFunctions.delete(r));let a=new Map(n);for(let[r,i]of n)if(i===t&&r!==e){a.delete(r);break}a.set(e,t),this.map.value=a;let o=kO(...t.effects());return this.cleanupFunctions.set(t,o),i},this.unregister=(e,t)=>{let n=this.map.peek();if(n.get(e)!==t)return;this.cleanupFunctions.get(t)?.(),this.cleanupFunctions.delete(t);let r=new Map(n);r.delete(e),this.map.value=r}}[Symbol.iterator](){return this.map.peek().values()}get value(){return this.map.value.values()}has(e){return this.map.value.has(e)}get(e){return this.map.value.get(e)}destroy(){for(let e of this)this.cleanupFunctions.get(e)?.(),e.destroy();this.map.value=new Map}},BA,VA,HA,UA,WA,GA,KA,qA,JA,YA,XA,ZA=class extends (KA=RA,GA=[EO],WA=[EO],UA=[EO],HA=[DO],VA=[DO],BA=[DO],KA){constructor(e,t){var n=e,{modifiers:r,type:i,sensors:a,plugins:o,effects:s}=n,c=Zk(n,[`modifiers`,`type`,`sensors`,`plugins`,`effects`]);super(Yk(Jk({},c),{effects:()=>[...s?.()??[],()=>{let{manager:e,plugins:t}=this;if(e&&t)for(let n of t){let{plugin:t}=pA(n);e.registry.plugins.register(t)}}]}),t),rA(qA,5,this),cA(this,JA,rA(qA,8,this)),rA(qA,11,this),cA(this,YA,rA(qA,12,this)),rA(qA,15,this),cA(this,XA,rA(qA,16,this,this.isDragSource?`dragging`:`idle`)),rA(qA,19,this),this.type=i,this.sensors=a,this.modifiers=r,this.alignment=c.alignment,this.plugins=o}pluginConfig(e){if(this.plugins)for(let t of this.plugins){let n=pA(t);if(n.plugin===e)return n.options}}get isDropping(){return this.status===`dropping`&&this.isDragSource}get isDragging(){return this.status===`dragging`&&this.isDragSource}get isDragSource(){return this.manager?.dragOperation.source?.id===this.id}};qA=Qk(KA),JA=new WeakMap,YA=new WeakMap,XA=new WeakMap,iA(qA,4,`type`,GA,ZA,JA),iA(qA,4,`modifiers`,WA,ZA,YA),iA(qA,4,`status`,UA,ZA,XA),iA(qA,2,`isDropping`,HA,ZA),iA(qA,2,`isDragging`,VA,ZA),iA(qA,2,`isDragSource`,BA,ZA),nA(qA,ZA);var QA,$A,ej,tj,nj,rj,ij,aj,oj,sj,cj,lj,uj,dj=class extends (ij=RA,rj=[EO],nj=[EO],tj=[EO],ej=[EO],$A=[EO],QA=[DO],ij){constructor(e,t){var n=e,{accept:r,collisionDetector:i,collisionPriority:a,type:o}=n,s=Zk(n,[`accept`,`collisionDetector`,`collisionPriority`,`type`]);super(s,t),rA(aj,5,this),cA(this,oj,rA(aj,8,this)),rA(aj,11,this),cA(this,sj,rA(aj,12,this)),rA(aj,15,this),cA(this,cj,rA(aj,16,this)),rA(aj,19,this),cA(this,lj,rA(aj,20,this)),rA(aj,23,this),cA(this,uj,rA(aj,24,this)),rA(aj,27,this),this.accept=r,this.collisionDetector=i,this.collisionPriority=a,this.type=o}accepts(e){let{accept:t}=this;return t?typeof t==`function`?t(e):e.type?Array.isArray(t)?t.includes(e.type):e.type===t:!1:!0}get isDropTarget(){return this.manager?.dragOperation.target?.id===this.id}};aj=Qk(ij),oj=new WeakMap,sj=new WeakMap,cj=new WeakMap,lj=new WeakMap,uj=new WeakMap,iA(aj,4,`accept`,rj,dj,oj),iA(aj,4,`type`,nj,dj,sj),iA(aj,4,`collisionDetector`,tj,dj,cj),iA(aj,4,`collisionPriority`,ej,dj,lj),iA(aj,4,`shape`,$A,dj,uj),iA(aj,2,`isDropTarget`,QA,dj),nA(aj,dj);var fj=class{constructor(){this.registry=new Map}addEventListener(e,t){let{registry:n}=this,r=new Set(n.get(e));return r.add(t),n.set(e,r),()=>this.removeEventListener(e,t)}removeEventListener(e,t){let{registry:n}=this,r=new Set(n.get(e));r.delete(t),n.set(e,r)}dispatch(e,...t){let{registry:n}=this,r=n.get(e);if(r)for(let e of r)e(...t)}},pj=class extends fj{constructor(e){super(),this.manager=e}dispatch(e,t){let n=[t,this.manager];super.dispatch(e,...n)}};function mj(e,t=!0){let n=!1;return Yk(Jk({},e),{cancelable:t,get defaultPrevented(){return n},preventDefault(){t&&(n=!0)}})}var hj=class extends yA{constructor(e){super(e);let t=(e,t)=>e.map(({id:e})=>e).join(``)===t.map(({id:e})=>e).join(``),n=[];this.destroy=kO(()=>{let{dragOperation:t,collisionObserver:r}=e;t.status.initializing&&(n=[],r.enable())},()=>{let{collisionObserver:r,monitor:i}=e,{collisions:a}=r;if(r.isDisabled()||RA.pendingIdChanges)return;let o=mj({collisions:a});if(i.dispatch(`collision`,o),o.defaultPrevented||t(a,n))return;n=a;let[s]=a;AD(()=>{s?.id!==e.dragOperation.target?.id&&(r.disable(),e.actions.setDropTarget(s?.id).then(()=>{r.enable()}))})})}},gj=(e=>(e[e.Lowest=0]=`Lowest`,e[e.Low=1]=`Low`,e[e.Normal=2]=`Normal`,e[e.High=3]=`High`,e[e.Highest=4]=`Highest`,e))(gj||{}),_j=(e=>(e[e.Collision=0]=`Collision`,e[e.ShapeIntersection=1]=`ShapeIntersection`,e[e.PointerIntersection=2]=`PointerIntersection`,e))(_j||{}),vj,yj,bj,xj,Sj,Cj,wj=[EO],Tj,Ej;Cj=[DO],Sj=[DO],xj=[DO],bj=[DO],yj=[DO],vj=[DO];var Dj=class{constructor(){rA(Tj,5,this),cA(this,Ej,rA(Tj,8,this,`idle`)),rA(Tj,11,this)}get current(){return this.value}get idle(){return this.value===`idle`}get initializing(){return this.value===`initializing`}get initialized(){let{value:e}=this;return e!==`idle`&&e!==`initialization-pending`}get dragging(){return this.value===`dragging`}get dropped(){return this.value===`dropped`}set(e){this.value=e}};Tj=Qk(null),Ej=new WeakMap,iA(Tj,4,`value`,wj,Dj,Ej),iA(Tj,2,`current`,Cj,Dj),iA(Tj,2,`idle`,Sj,Dj),iA(Tj,2,`initializing`,xj,Dj),iA(Tj,2,`initialized`,bj,Dj),iA(Tj,2,`dragging`,yj,Dj),iA(Tj,2,`dropped`,vj,Dj),nA(Tj,Dj);var Oj=class{constructor(e){this.manager=e}setDragSource(e){let{dragOperation:t}=this.manager;t.sourceIdentifier=typeof e==`string`||typeof e==`number`?e:e.id}setDropTarget(e){return AD(()=>{let{dragOperation:t}=this.manager,n=e??null;if(t.targetIdentifier===n)return Promise.resolve(!1);t.targetIdentifier=n;let r=mj({operation:t.snapshot()});return t.status.dragging&&this.manager.monitor.dispatch(`dragover`,r),this.manager.renderer.rendering.then(()=>r.defaultPrevented)})}start(e){return AD(()=>{let{dragOperation:t}=this.manager;if(e.source!=null&&this.setDragSource(e.source),!t.source)throw Error(`Cannot start a drag operation without a drag source`);if(!t.status.idle)throw Error(`Cannot start a drag operation while another is active`);let n=new AbortController,{event:r,coordinates:i}=e;DD(()=>{t.status.set(`initialization-pending`),t.shape=null,t.canceled=!1,t.activatorEvent=r??null,t.position.reset(i)});let a=mj({operation:t.snapshot()});return this.manager.monitor.dispatch(`beforedragstart`,a),a.defaultPrevented?(t.reset(),n.abort(),n):(t.status.set(`initializing`),t.controller=n,this.manager.renderer.rendering.then(()=>{if(n.signal.aborted)return;let{status:e}=t;e.current===`initializing`&&DD(()=>{t.status.set(`dragging`),this.manager.monitor.dispatch(`dragstart`,{nativeEvent:r,operation:t.snapshot(),cancelable:!1})})}),n)})}move(e){return AD(()=>{let{dragOperation:t}=this.manager,{status:n,controller:r}=t;if(!n.dragging||!r||r.signal.aborted)return;let i=mj({nativeEvent:e.event,operation:t.snapshot(),by:e.by,to:e.to},e.cancelable??!0);(e.propagate??!0)&&this.manager.monitor.dispatch(`dragmove`,i),queueMicrotask(()=>{if(i.defaultPrevented)return;let n=e.to??{x:t.position.current.x+(e.by?.x??0),y:t.position.current.y+(e.by?.y??0)};t.position.current=n})})}stop(e={}){return AD(()=>{let{dragOperation:t}=this.manager,{controller:n}=t;if(!n||n.signal.aborted)return;let r,i=()=>{let e={resume:()=>{},abort:()=>{}};return r=new Promise((t,n)=>{e.resume=t,e.abort=n}),e};n.abort();let a=()=>{this.manager.renderer.rendering.then(()=>{t.status.set(`dropped`);let e=AD(()=>t.source?.status===`dropping`),r=()=>{t.controller===n&&(t.controller=void 0),t.reset()};if(e){let{source:e}=t,n=XD(()=>{e?.status===`idle`&&(n(),r())})}else this.manager.renderer.rendering.then(r)})};t.canceled=e.canceled??!1,this.manager.monitor.dispatch(`dragend`,{nativeEvent:e.event,operation:t.snapshot(),canceled:e.canceled??!1,suspend:i}),r?r.then(a).catch(()=>t.reset()):a()})}},kj=class extends vA{constructor(e,t){super(e,t),this.manager=e,this.options=t}},Aj=class extends AbortController{constructor(e,t){super(),this.constraints=e,this.onActivate=t,this.activated=!1;for(let t of e??[])t.controller=this}onEvent(e){if(!this.activated){if(this.constraints?.length)for(let t of this.constraints)t.onEvent(e);else this.activate(e)}}activate(e){this.activated||(this.activated=!0,this.onActivate(e))}abort(e){this.activated=!1,super.abort(e)}},jj,Mj=class{constructor(e){this.options=e,cA(this,jj)}set controller(e){lA(this,jj,e),e.signal.addEventListener(`abort`,()=>this.abort())}activate(e){var t;(t=sA(this,jj))==null||t.activate(e)}};jj=new WeakMap;var Nj=class extends vA{constructor(e,t){super(e,t),this.manager=e,this.options=t}apply(e){return e.transform}},Pj=class{constructor(e){this.draggables=new zA,this.droppables=new zA,this.plugins=new xA(e),this.sensors=new xA(e),this.modifiers=new xA(e)}register(e,t){if(e instanceof ZA)return this.draggables.register(e.id,e);if(e instanceof dj)return this.droppables.register(e.id,e);if(e.prototype instanceof Nj)return this.modifiers.register(e,t);if(e.prototype instanceof kj)return this.sensors.register(e,t);if(e.prototype instanceof vA)return this.plugins.register(e,t);throw Error(`Invalid instance type`)}unregister(e){if(e instanceof RA)return e instanceof ZA?this.draggables.unregister(e.id,e):e instanceof dj?this.droppables.unregister(e.id,e):()=>{};if(e.prototype instanceof Nj)return this.modifiers.unregister(e);if(e.prototype instanceof kj)return this.sensors.unregister(e);if(e.prototype instanceof vA)return this.plugins.unregister(e);throw Error(`Invalid instance type`)}destroy(){this.draggables.destroy(),this.droppables.destroy(),this.plugins.destroy(),this.sensors.destroy(),this.modifiers.destroy()}},Fj,Ij,Lj,Rj,zj,Bj,Vj,Hj,Uj=[DO],Wj,Gj,Kj,qj,Jj,Yj,Xj,Zj,Qj,$j;Hj=[EO],Vj=[EO],Bj=[EO],zj=[EO],Rj=[EO],Lj=[DO],Ij=[DO],Fj=[DO];var eM=class{constructor(e){rA(qj,5,this),cA(this,Wj),cA(this,Gj),cA(this,Kj,new XO(void 0,(e,t)=>e&&t?e.equals(t):e===t)),this.status=new Dj,cA(this,Jj,rA(qj,8,this,!1)),rA(qj,11,this),cA(this,Yj,rA(qj,12,this,null)),rA(qj,15,this),cA(this,Xj,rA(qj,16,this,null)),rA(qj,19,this),cA(this,Zj,rA(qj,20,this,null)),rA(qj,23,this),cA(this,Qj,rA(qj,24,this,[])),rA(qj,27,this),this.position=new Nk({x:0,y:0}),cA(this,$j,{x:0,y:0}),lA(this,Wj,e)}get shape(){let{current:e,initial:t,previous:n}=sA(this,Kj);return!e||!t?null:{current:e,initial:t,previous:n}}set shape(e){e?sA(this,Kj).current=e:sA(this,Kj).reset()}get source(){let e=this.sourceIdentifier;if(e==null)return null;let t=sA(this,Wj).registry.draggables.get(e);return t&&lA(this,Gj,t),t??sA(this,Gj)??null}get target(){let e=this.targetIdentifier;return e==null?null:sA(this,Wj).registry.droppables.get(e)??null}get transform(){let{x:e,y:t}=this.position.delta,n={x:e,y:t};for(let e of this.modifiers)n=e.apply(Yk(Jk({},this.snapshot()),{transform:n}));return lA(this,$j,n),n}snapshot(){return AD(()=>({source:this.source,target:this.target,activatorEvent:this.activatorEvent,transform:sA(this,$j),shape:this.shape?ZO(this.shape):null,position:ZO(this.position),status:ZO(this.status),canceled:this.canceled}))}reset(){DD(()=>{this.status.set(`idle`),this.sourceIdentifier=null,this.targetIdentifier=null,sA(this,Kj).reset(),this.position.reset({x:0,y:0}),lA(this,$j,{x:0,y:0}),this.modifiers=[]})}};qj=Qk(null),Wj=new WeakMap,Gj=new WeakMap,Kj=new WeakMap,Jj=new WeakMap,Yj=new WeakMap,Xj=new WeakMap,Zj=new WeakMap,Qj=new WeakMap,$j=new WeakMap,iA(qj,2,`shape`,Uj,eM),iA(qj,4,`canceled`,Hj,eM,Jj),iA(qj,4,`activatorEvent`,Vj,eM,Yj),iA(qj,4,`sourceIdentifier`,Bj,eM,Xj),iA(qj,4,`targetIdentifier`,zj,eM,Zj),iA(qj,4,`modifiers`,Rj,eM,Qj),iA(qj,2,`source`,Lj,eM),iA(qj,2,`target`,Ij,eM),iA(qj,2,`transform`,Fj,eM),nA(qj,eM);var tM={get rendering(){return Promise.resolve()}};function nM(e,t){return typeof e==`function`?e(t):e??t}var rM=class{constructor(e){this.destroy=()=>{this.dragOperation.status.idle||this.actions.stop({canceled:!0}),this.dragOperation.modifiers.forEach(e=>e.destroy()),this.registry.destroy(),this.collisionObserver.destroy()};let t=e??{},n=nM(t.plugins,[]),r=nM(t.sensors,[]),i=nM(t.modifiers,[]),a=t.renderer??tM,o=new pj(this),s=new Pj(this);this.registry=s,this.monitor=o,this.renderer=a,this.actions=new Oj(this),this.dragOperation=new eM(this),this.collisionObserver=new EA(this),this.plugins=[hj,...n],this.modifiers=i,this.sensors=r;let{destroy:c}=this,l=kO(()=>{let e=AD(()=>this.dragOperation.modifiers),t=this.modifiers;for(let n of e)t.includes(n)||n.destroy();this.dragOperation.modifiers=(this.dragOperation.source?.modifiers)?.map(e=>{let{plugin:t,options:n}=pA(e);return new t(this,n)})??t});this.destroy=()=>{l(),c()}}get plugins(){return this.registry.plugins.values}set plugins(e){this.registry.plugins.values=e}get modifiers(){return this.registry.modifiers.values}set modifiers(e){this.registry.modifiers.values=e}get sensors(){return this.registry.sensors.values}set sensors(e){this.registry.sensors.values=e}},iM=e=>{throw TypeError(e)},aM=(e,t,n)=>t.has(e)||iM(`Cannot `+n),oM=(e,t,n)=>(aM(e,t,`read from private field`),t.get(e)),sM=(e,t,n)=>t.has(e)?iM(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),cM=(e,t,n,r)=>(aM(e,t,`write to private field`),t.set(e,n),n),lM=(e,t,n)=>(aM(e,t,`access private method`),n);function uM(e){return e?e instanceof KeyframeEffect||`getKeyframes`in e&&typeof e.getKeyframes==`function`:!1}function dM(e,t){let n=e.getAnimations(),r=null;for(let e of n){if(e.playState!==`running`)continue;let{effect:n}=e,i=(uM(n)?n.getKeyframes():[]).filter(t);i.length>0&&(r=[i[i.length-1],e])}return r}function fM(e){let{width:t,height:n,top:r,left:i,bottom:a,right:o}=e.getBoundingClientRect();return{width:t,height:n,top:r,left:i,bottom:a,right:o}}function pM(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function mM(e){return`nodeType`in e}function hM(e){return e?pM(e)?e:mM(e)?`defaultView`in e?e.defaultView??window:e.ownerDocument?.defaultView??window:window:window}function gM(e){let{Document:t}=hM(e);return e instanceof t||`nodeType`in e&&e.nodeType===Node.DOCUMENT_NODE}function _M(e){return!e||pM(e)?!1:e instanceof hM(e).HTMLElement||`namespaceURI`in e&&typeof e.namespaceURI==`string`&&e.namespaceURI.endsWith(`html`)}function vM(e){return e instanceof hM(e).SVGElement||`namespaceURI`in e&&typeof e.namespaceURI==`string`&&e.namespaceURI.endsWith(`svg`)}function yM(e){return e?pM(e)?e.document:mM(e)?gM(e)?e:_M(e)||vM(e)?e.ownerDocument:document:document:document}function bM(e){let{documentElement:t}=yM(e),n=hM(e).visualViewport,r=n?.width??t.clientWidth,i=n?.height??t.clientHeight,a=n?.offsetTop??0,o=n?.offsetLeft??0;return{top:a,left:o,right:o+r,bottom:a+i,width:r,height:i}}function xM(e,t){if(SM(e)&&e.open===!1)return!1;let{overflow:n,overflowX:r,overflowY:i}=getComputedStyle(e);return n===`visible`&&r===`visible`&&i===`visible`}function SM(e){return e.tagName===`DETAILS`}function CM(e,t=e.getBoundingClientRect(),n=0){let r=t,{ownerDocument:i}=e,a=i.defaultView??window,o=e.parentElement;for(;o&&o!==i.documentElement;){if(!xM(o)){let e=o.getBoundingClientRect(),t=n*(e.bottom-e.top),i=n*(e.right-e.left),a=n*(e.bottom-e.top),s=n*(e.right-e.left);r={top:Math.max(r.top,e.top-t),right:Math.min(r.right,e.right+i),bottom:Math.min(r.bottom,e.bottom+a),left:Math.max(r.left,e.left-s),width:0,height:0},r.width=r.right-r.left,r.height=r.bottom-r.top}o=o.parentElement}let s=a.visualViewport,c=s?.offsetTop??0,l=s?.offsetLeft??0,u=s?.width??a.innerWidth,d=s?.height??a.innerHeight,f=n*d,p=n*u;return r={top:Math.max(r.top,c-f),right:Math.min(r.right,l+u+p),bottom:Math.min(r.bottom,c+d+f),left:Math.max(r.left,l-p),width:0,height:0},r.width=r.right-r.left,r.height=r.bottom-r.top,r.width<0&&(r.width=0),r.height<0&&(r.height=0),r}function wM(e){return{x:e.clientX,y:e.clientY}}var TM=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function EM(e=document,t=new Set){if(t.has(e))return[];t.add(e);let n=[e];for(let r of Array.from(e.querySelectorAll(`iframe, frame`)))try{let e=r.contentDocument;e&&!t.has(e)&&n.push(...EM(e,t))}catch{}try{let r=e.defaultView;if(r&&r!==window.top){let i=r.parent;i&&i.document&&i.document!==e&&n.push(...EM(i.document,t))}}catch{}return n}function DM(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function OM(){let e=DM()?window.visualViewport:null;return{x:e?.offsetLeft??0,y:e?.offsetTop??0}}function kM(e){return!e||!mM(e)?!1:e instanceof hM(e).ShadowRoot}function AM(e){if(e&&mM(e)){let t=e.getRootNode();if(kM(t)||t instanceof Document)return t}return yM(e)}function jM(e){return e.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function MM(e){let t=`input, textarea, select, canvas, [contenteditable]`,n=e.cloneNode(!0),r=Array.from(e.querySelectorAll(t));return Array.from(n.querySelectorAll(t)).forEach((e,t)=>{let n=r[t];NM(e)&&NM(n)&&(e.type!==`file`&&(e.value=n.value),e.type===`radio`&&e.name&&(e.name=`Cloned__${e.name}`)),PM(e)&&PM(n)&&n.width>0&&n.height>0&&e.getContext(`2d`)?.drawImage(n,0,0)}),n}function NM(e){return`value`in e}function PM(e){return e.tagName===`CANVAS`}function FM(e,{x:t,y:n}){let r=e.elementFromPoint(t,n);if(IM(r)){let{contentDocument:e}=r;if(e){let{left:i,top:a}=r.getBoundingClientRect();return FM(e,{x:t-i,y:n-a})}}return r}function IM(e){return e?.tagName===`IFRAME`}var LM=new WeakMap;function RM(e){return e.closest(`
|
|
93
|
+
`,n),i=r<0?e.length:r;t.push({start:n,end:i,className:`comment`}),n=i;continue}n++}return t}function VT(e){let t=[],n=/:\s*([^\n]*)/g,r;for(;r=n.exec(e);){let n=r[1],i=n.trimEnd();if(!i)continue;let a=r.index+r[0].indexOf(n),o=a+i.length,s=/\s+#/.exec(i);for(s&&(o=a+s.index);o>a&&/\s/.test(e[o-1]);)o--;o>a&&t.push({start:a,end:o,className:`string`})}return t}var HT=/(?:(?:\/\/|#)[ \t]*\[!code[ \t]+(\+\+|--)\]|\/\*[ \t]*\[!code[ \t]+(\+\+|--)\][ \t]*\*\/|<!--[ \t]*\[!code[ \t]+(\+\+|--)\][ \t]*-->)[ \t]*\r?$/;function UT(e){let t=[];if(!e.includes(`[!code`))return{code:e,decorations:t};let n=e.split(`
|
|
94
|
+
`);for(let e=0;e<n.length;e++){let r=n[e],i=HT.exec(r);if(!i)continue;let a=i[1]||i[2]||i[3];t.push({className:a===`++`?`th-line--inserted`:`th-line--deleted`,lines:e+1}),n[e]=r.slice(0,i.index).replace(/[ \t]+$/,``)+(r.endsWith(`\r`)?`\r`:``)}return{code:n.join(`
|
|
95
|
+
`),decorations:t}}function WT(e){return(t,n=`plaintext`,r={})=>{let i=UT(t),a=e.tokenize(i.code,{lang:n});for(let e of r.highlightLines||[])i.decorations.push({className:`th-line--highlighted`,lines:e});return Fw(Pw(a.tokens,{lineNumbers:r.lineNumbers,decorations:i.decorations}))}}var GT=262144,KT=Nw({languages:[TT,DT,IT,LT,ET,RT,uT,tT,MT,OT,jT]}),qT=new Set(KT.listLanguages()),JT=WT(KT),YT=(e,t,n)=>{let r=t?KT.normalizeLanguage(t):`plaintext`;return JT(e,qT.has(r)&&e.length<=GT?r:`plaintext`,n)};function XT(e){return e.closest(`[data-code-block]`)?.querySelector(`pre code`)?.textContent??``}function ZT({children:e,...t}){return(0,H.jsx)(`div`,{"data-table-scroll":``,role:`region`,"aria-label":`Scrollable table`,tabIndex:0,onKeyDown:e=>{if(e.target!==e.currentTarget||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let t=e.key===`ArrowRight`?64:e.key===`ArrowLeft`?-64:0;t===0||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollBy({left:t}))},children:(0,H.jsx)(`table`,{...t,children:e})})}function QT(e,t,n){function r({href:e,children:n,...r}){let i=_w(e);return i===`fragment`?(0,H.jsx)(`a`,{href:e,...r,children:n}):i===`external`?(0,H.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,...r,children:n}):i===`document`&&t&&e!==void 0?(0,H.jsx)(`button`,{type:`button`,"data-local-link":``,onClick:()=>t(e),children:n}):(0,H.jsx)(`span`,{children:n})}function i({src:t,alt:n,title:r}){let i=typeof t==`string`?e?.(t)??null:null;return i===null?(0,H.jsx)(`span`,{"data-blocked-image":``,children:n?`[image: ${n}]`:`[image]`}):(0,H.jsx)(`img`,{src:i,alt:n??``,title:r,loading:`lazy`,referrerPolicy:`no-referrer`})}function a({children:e,...t}){return n===void 0?(0,H.jsx)(`pre`,{...t,children:e}):(0,H.jsxs)(`div`,{"data-code-block":``,children:[(0,H.jsx)(`div`,{"data-code-actions":``,children:n}),(0,H.jsx)(`pre`,{...t,children:e})]})}return{a:r,img:i,pre:a,table:ZT}}function $T({document:e,resolveImage:t,onOpenLink:n,codeActions:r}){let i=(0,D.useMemo)(()=>QT(t,n,r),[t,n,r]);return yw(e,{...hw,allowHtml:!1,highlighter:YT,components:i})}var eE=3e3;function tE(){let[e,t]=(0,D.useState)(null),[n,r]=(0,D.useState)(!1),i=(0,D.useRef)(null),a=(0,D.useRef)(0);return(0,D.useEffect)(()=>()=>{a.current+=1,i.current&&clearTimeout(i.current)},[]),{result:e,copy:(0,D.useCallback)(async(e,n)=>{let o=++a.current;i.current&&clearTimeout(i.current),r(!0);let s;try{if(typeof navigator.clipboard?.writeText!=`function`)throw Error(`This browser cannot write to the clipboard`);await navigator.clipboard.writeText(n),s={ok:!0,message:`Copied the ${e}.`}}catch(t){s={ok:!1,message:`Could not copy the ${e} (${t instanceof Error?t.message:`unknown reason`}).`}}o===a.current&&(r(!1),t(s),s.ok&&(i.current=setTimeout(()=>t(null),eE)))},[]),pending:n,dismiss:()=>t(null)}}function nE({label:e,text:t,icon:n=z,title:r,code:i=!1}){let{result:a,copy:o,pending:s,dismiss:c}=tE(),l=(0,D.useRef)(``),u=a?.ok===!1,d=u?L:a?.ok===!0?N:n;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(vx,{enabled:u,title:`Copy failed`,trigger:(0,H.jsxs)(pb,{variant:i?`outline`:`ghost`,size:i?`xs`:`icon-sm`,"aria-label":`Copy ${e}`,title:u?`${a.message} Click for details.`:r??`Copy ${e}`,disabled:s,className:u?`text-destructive`:void 0,"data-copy-state":u?`failed`:a?.ok===!0?`copied`:`idle`,onClick:n=>{u||(l.current=typeof t==`string`?t:t(n.currentTarget),o(e,l.current))},children:[(0,H.jsx)(d,{"aria-hidden":`true`}),i&&`Copy code`]}),children:[(0,H.jsx)(`p`,{children:a?.message}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(pb,{variant:`outline`,size:`sm`,disabled:s,onClick:()=>void o(e,l.current),children:`Try again`}),(0,H.jsx)(pb,{variant:`ghost`,size:`sm`,onClick:c,children:`Dismiss`})]})]}),(0,H.jsx)(`span`,{role:u?`alert`:`status`,className:`sr-only`,"data-testid":`copy-result`,children:a?.message})]})}function rE(){return(0,H.jsx)(H.Fragment,{children:`Scripts can load only the files registered for this document and cannot reach this app, its management API, or unregistered files. Some outbound requests, including navigation inside the view, are not blocked.`})}var iE={navigated:`View reloaded`,"request-closed":`Question closed`,expired:`Render permission expired`,replaced:`Draft connection ended`};function aE(e){return e.status===`connected`?`Drafts linked (not sent)`:e.status===`closed`?iE[e.reason]??`Invalid draft message`:null}function oE({mode:e,bridge:t,needsPermission:n,pinnedStatic:r,modeError:i,onRunScripts:a,onStopScripts:o,onReload:s}){let c=e===`interactive`,l=t.status===`closed`,u=aE(t);return(0,H.jsxs)(`div`,{className:`flex min-h-9 flex-wrap items-center gap-x-3 gap-y-1 border-b bg-muted/50 px-3 py-1 text-[0.8rem]`,"data-testid":`html-view-bar`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:`Document content`}),(0,H.jsx)(`span`,{className:`text-muted-foreground`,"data-testid":`html-mode`,children:c?`Scripts running`:r?`Scripts off for this question`:`Scripts off`}),n&&(0,H.jsx)(`span`,{className:`text-destructive`,children:`Permission cleared`}),u!==null&&(0,H.jsx)(`span`,{role:`status`,className:l?`text-destructive`:`text-muted-foreground`,"data-testid":`bridge-status`,children:u}),i&&(0,H.jsx)(`span`,{role:`alert`,className:`text-destructive`,children:`Script change failed`}),(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[l&&t.reason!==`request-closed`&&(0,H.jsx)(pb,{size:`xs`,variant:`ghost`,onClick:s,children:`Reload view`}),(0,H.jsx)(vx,{title:`Document view`,trigger:(0,H.jsxs)(pb,{size:`xs`,variant:`ghost`,children:[l||i?(0,H.jsx)(L,{"aria-hidden":`true`}):(0,H.jsx)(_e,{"aria-hidden":`true`}),`Details`]}),children:(0,H.jsx)(sE,{mode:e,bridge:t,needsPermission:n,pinnedStatic:r,modeError:i,connection:u})}),c&&(0,H.jsx)(pb,{size:`xs`,variant:`ghost`,onClick:o,children:`Turn off scripts`}),n&&(0,H.jsx)(pb,{size:`xs`,variant:`outline`,onClick:a,children:`Run scripts…`})]})]})}function sE({mode:e,bridge:t,needsPermission:n,pinnedStatic:r,modeError:i,connection:a}){let o=e===`interactive`,s=t.status===`closed`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{children:`Buttons and text inside the view belong to the opened document, rather than this app.`}),(0,H.jsx)(`p`,{children:`Links and form submission inside the view are disabled. Open links from “Links in this document”.`}),o?(0,H.jsx)(`p`,{children:(0,H.jsx)(rE,{})}):(0,H.jsx)(`p`,{children:`Scripts do not run in this view.`}),r&&(0,H.jsx)(`p`,{children:`This question was created in the Static view, so scripts stay off until it is answered.`}),n&&(0,H.jsx)(`p`,{children:`The permission to run scripts was cleared, for example by a daemon restart. Use “Run scripts…” to allow them again.`}),t.status===`connected`&&(0,H.jsx)(`p`,{children:`The document can read and replace draft answers. It cannot submit them. Only “Send answers to the agent” in the answer panel submits answers.`}),s&&(0,H.jsxs)(`p`,{children:[`Draft answers from this view are no longer accepted. `,a,`.`,` `,t.reason===`request-closed`?`Reloading cannot reopen the question.`:`Reload the view to reconnect.`]}),s&&!iE[t.reason]&&(0,H.jsx)(`p`,{children:`The document sent a message that breaks the rules, such as a malformed or oversized message or too many messages.`}),i&&(0,H.jsx)(`p`,{className:`text-destructive`,children:i})]})}function cE(e){return vh(e.defaultTagName??`div`,e,e)}var lE=db(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function uE({className:e,variant:t=`default`,render:n,...r}){return cE({defaultTagName:`span`,props:ih({className:ab(lE({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}var dE=D.createContext(void 0);function fE(){return D.useContext(dE)}var pE=D.forwardRef(function(e,t){let{className:n,defaultPressed:r=!1,disabled:i=!1,form:a,onPressedChange:o,pressed:s,render:c,type:l,value:u,nativeButton:d=!0,style:f,...p}=e,m=zv(u||void 0),h=fE(),g=h?.value??[],_=(i||h?.disabled)??!1,[v,y]=yx({controlled:h?m!==void 0&&g.indexOf(m)>-1:s,default:r,name:`Toggle`,state:`pressed`}),{getButtonProps:b,buttonRef:x}=Fv({disabled:_,native:d}),S={disabled:_,pressed:v},C=[x,t],w=[{"aria-pressed":v,onClick(e){let t=!v,n=np(Jf,e.nativeEvent);o?.(t,n),!n.isCanceled&&(m&&h?.setGroupValue?.(m,t,n),!n.isCanceled&&y(t))}},p,b],T=vh(`button`,e,{enabled:!h,state:S,ref:C,props:w}),E=D.useMemo(()=>({disabled:_,focusableWhenDisabled:!1}),[_]);return h?(0,H.jsx)(fS,{tag:`button`,render:c,className:n,style:f,metadata:E,state:S,refs:C,props:w}):T}),mE=D.createContext(void 0);function hE(){return D.useContext(mE)}var gE=D.forwardRef(function(e,t){let{defaultValue:n,disabled:r=!1,loopFocus:i=!0,onValueChange:a,orientation:o=`horizontal`,multiple:s=!1,value:c,className:l,render:u,style:d,...f}=e,p=dx(!0),m=hE(),h=n??Ld,g=c!==void 0||n!==void 0,_=(p?.disabled??!1)||(m?.disabled??!1)||r,[v,y]=yx({controlled:c,default:h,name:`ToggleGroup`,state:`value`}),b=hp((e,t,n)=>{let r;s?(r=v.slice(),t?r.push(e):r.splice(v.indexOf(e),1)):r=t?[e]:[],a?.(r,n),!n.isCanceled&&y(r)}),x={disabled:_,multiple:s,orientation:o},S=D.useMemo(()=>({disabled:_,setGroupValue:b,value:v,isValueInitialized:g}),[_,b,v,g]),C={role:`group`},w=vh(`div`,e,{enabled:!!p,state:x,ref:t,props:[C,f]});return(0,H.jsx)(dE.Provider,{value:S,children:p?w:(0,H.jsx)(jS,{render:u,className:l,style:d,state:x,refs:[t],props:[C,f],loopFocus:i,enableHomeAndEndKeys:!0,orientation:o})})}),_E=db(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}}),vE=D.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});function yE({className:e,variant:t,size:n,spacing:r=2,orientation:i=`horizontal`,children:a,...o}){return(0,H.jsx)(gE,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:ab(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,e),...o,children:(0,H.jsx)(vE.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function bE({className:e,children:t,variant:n=`default`,size:r=`default`,...i}){let a=D.useContext(vE);return(0,H.jsx)(pE,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:ab(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,_E({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}var xE=(e,t)=>`${String(e)} ${t}${e===1?``:`s`}`,SE={"asset-scan-failed":()=>`Scanning the files this document references did not finish in time or exceeded the structure limits, so images and CSS were not registered. Run vo refresh <document ID> to scan again.`,"script-removed":(e,t)=>`Removed ${xE(t,`script`)}. Scripts do not run in this view, so content that scripts would create is not shown.`,"script-not-loaded":(e,t)=>`Removed ${xE(t,`script`)} that could not be loaded (referencing unregistered files or external URLs).`,"noscript-removed":(e,t)=>`Removed ${xE(t,`noscript element`)}. In the Interactive view, noscript content is not shown.`,"asset-requested":e=>`The view tried to load ${e}, but it is not registered, so it could not be loaded. Register it with vo open <document> --assets-root <dir> --asset ${e} to make it loadable (files that scripts load at run time are not registered automatically).`,"event-handler-removed":(e,t)=>`Removed event attributes such as onclick from ${xE(t,`element`)}.`,"embed-removed":(e,t)=>`Removed ${xE(t,`embedded element`)} (iframe, object, embed, and similar). Other pages and plugins cannot be embedded.`,"inline-svg-removed":(e,t)=>`Removed ${xE(t,`inline SVG`)}. Save the SVG as a file (.svg) and reference it with <img> to show it.`,"mathml-removed":(e,t)=>`Removed ${xE(t,`MathML element`)}.`,"meta-refresh-removed":()=>`Removed the automatic redirect (meta refresh).`,"base-removed":()=>`Removed the base element. Relative references resolve against the document location.`,"network-hint-removed":(e,t)=>`Removed ${xE(t,`resource hint`)} (prefetch, preconnect, and similar).`,"form-action-removed":()=>`Removed the form action. Form controls are display-only and cannot submit.`,"element-removed":(e,t)=>`Removed ${xE(t,`legacy element`)} that treats the rest of the document as text (such as plaintext).`,"media-blocked":e=>`Video and audio (${e}) cannot be shown.`,"remote-asset-blocked":e=>`External URL (${e}) is not loaded. Put the file under the document's directory and reference it with a relative path to show it.`,"asset-not-registered":e=>`${e} was not found. Make sure the file is under the assets-root used when the document was opened (the document's directory if none was given).`,"asset-rejected":e=>`${e} cannot be loaded. References outside the assets-root, file: URLs, and encoded separators are not allowed. To widen the range, reopen with vo open <document> --assets-root <dir>.`,"asset-hidden":e=>`${e} is not loaded. Files and directories whose names start with "." (such as .env and .git) cannot be referenced from documents.`,"asset-unsupported":e=>`${e} is a file type that cannot be used here. Allowed types are images (PNG, JPEG, WebP, GIF, AVIF, SVG), CSS, fonts (WOFF, WOFF2), and, in the Interactive view, scripts (.js, .mjs) and JSON registered with --asset.`,"data-url-blocked":e=>`data URL (${e}) cannot be used. Only PNG, JPEG, WebP, GIF, and AVIF images are allowed as data URLs.`,"css-invalid":e=>`${e===``?`The CSS in the document`:e} has parts that could not be parsed, and those parts were disabled.`,"link-disabled":(e,t)=>`Links in this document (${String(t)}) cannot be clicked inside the view. Open them from the "Links in this document" list.`};function CE(e){let t=SE[e.code],n=e.target??``;if(!t)return`${e.code}${n===``?``:`: ${n}`}`;let r=t(n,e.count);return e.target!==null&&e.count>1?`${r} (${String(e.count)} occurrences)`:r}function wE(e){if(!(e instanceof VS))return`Could not export the PDF.`;switch(e.code){case`E_BROWSER_NOT_FOUND`:return e.message;case`E_REVISION_UNAVAILABLE`:return`This revision is no longer kept. Show the latest revision and export again.`;case`E_PARSE_FAILED`:return`The document could not be prepared for printing (it is too large or too deeply nested).`;case`E_LIMIT_EXCEEDED`:return e.details.reason===`page-size`?`The document is too large to print (including images, fonts, and stylesheets).`:`Other PDF exports are still waiting. Try again after they finish.`;case`E_EXPORT_FAILED`:return e.details.reason===`timeout`?`The browser did not finish printing the PDF in time.`:`The browser could not print the PDF.`;default:return`Could not export the PDF. ${e.message}`}}var TE={exporting:!1,error:null};function EE(e,t){let n=URL.createObjectURL(e),r=window.document.createElement(`a`);r.href=n,r.download=t,window.document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),6e4)}function DE(e=EE){let t=new Map,n=new Set,r=(e,r)=>{r===TE?t.delete(e):t.set(e,r);for(let e of n)e()};return{state:e=>t.get(e)??TE,subscribe(e){return n.add(e),()=>n.delete(e)},start(n,i,a){let{documentId:o}=i;t.get(o)?.exporting!==!0&&(r(o,{exporting:!0,error:null}),n.exportPdf(o,a).then(t=>{r(o,TE),e(t,Ju(i))},e=>{r(o,{exporting:!1,error:wE(e)})}))},dismiss(e){t.get(e)?.exporting===!1&&r(e,TE)}}}var OE=DE();function kE(e){return(0,D.useSyncExternalStore)(OE.subscribe,()=>OE.state(e))}function AE(e,t,n){try{let r=JSON.parse(window.localStorage.getItem(`vde-open.pref.${e}`)??`null`);return n(r)?r:t}catch{return t}}function jE(e,t,n){let r=`vde-open.pref.${e}`,[i,a]=(0,D.useState)(()=>AE(e,t,n));return[i,(0,D.useCallback)(e=>{a(e);try{window.localStorage.setItem(r,JSON.stringify(e))}catch{}},[r])]}var ME=e=>e===`light`||e===`dark`||e===`system`,NE=[{value:`standard`,label:`Standard`},{value:`github`,label:`GitHub`},{value:`gruvbox`,label:`Gruvbox`},{value:`catppuccin`,label:`Catppuccin`},{value:`github-high-contrast`,label:`GitHub High Contrast`}],PE=e=>NE.some(t=>t.value===e);function FE(e,t){let n=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;window.document.documentElement.classList.toggle(`dark`,n),window.document.documentElement.dataset.colorPalette=t}var IE=e=>e===`flat`||e===`tree`,LE=e=>e===`preview`||e===`source`,RE=e=>e===`standard`||e===`wide`,zE=1e3,BE=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null),VE=(e,t)=>Object.keys(e).every(e=>t.includes(e));function HE(e){try{let t=JSON.stringify(e);return t===void 0?null:Lu(t)}catch{return null}}function UE(e){return e instanceof VS?{code:e.code,message:e.message}:{code:`E_BRIDGE_FAILED`,message:`Could not handle the draft answer.`}}function WE(e){let{instanceId:t,port:n,handlers:r}=e,i=e.now??Date.now,a=!1,o=0,s=[],c=new Set,l=-1,u=0,d=null,f=e=>{if(a)return;let t=HE(e);if(t===null||t>Xl.bridgeOutboundFrameBytes){e.type===`response`&&n.postMessage({type:`response`,sequence:e.sequence,ok:!1,error:{code:`E_LIMIT_EXCEEDED`,message:`The response is too large.`}});return}n.postMessage(e)},p=(e,t)=>t.then(t=>f({type:`response`,sequence:e,ok:!0,result:t}),t=>f({type:`response`,sequence:e,ok:!1,error:UE(t)})),m=(e,t,n)=>f({type:`response`,sequence:e,ok:!1,error:{code:t,message:n}}),h=e=>{a||e.draftVersion<=l||c.has(e.draftVersion)||(l=e.draftVersion,f({type:`event`,method:`draftChanged`,payload:e}))},g=({sequence:e,method:t,payload:n})=>{if(t===`ready`){if(!VE(n,[])){m(e,`E_INVALID_ARGUMENT`,`ready takes no arguments.`);return}p(e,r.ready().then(e=>(l=Math.max(l,e.draftVersion),e)));return}if(t===`updateDraft`){let{answers:t,baseDraftVersion:i}=n;if(!VE(n,[`answers`,`baseDraftVersion`])||!BE(t)||typeof i!=`number`||!Number.isSafeInteger(i)||i<0){m(e,`E_INVALID_ARGUMENT`,`updateDraft requires a draft-answer object and baseDraftVersion.`);return}let a=HE(t);if(a===null||a>Xl.answerBytes){m(e,`E_LIMIT_EXCEEDED`,`The draft answer is too large.`);return}if(Object.hasOwn(t,`__proto__`)||!Fu.safeParse(t).success){m(e,`E_ANSWER_INVALID`,`Draft answer values must be strings, finite numbers, booleans, or arrays of strings, keyed by field name.`);return}u+=1,p(e,r.updateDraft(t,i).then(e=>(c.add(e.draftVersion),l=Math.max(l,e.draftVersion),e)).finally(()=>{if(--u,u===0&&d!==null){let e=d;d=null,h(e)}}));return}m(e,`E_METHOD_NOT_ALLOWED`,`${t.slice(0,64)} cannot be called from HTML.`)},_={get closed(){return a},notifyDraft(e){if(!a){if(u>0){d=e;return}h(e)}},close(t){if(!a){try{n.postMessage({type:`closed`,reason:t})}catch{}a=!0,n.removeEventListener(`message`,v),n.close(),e.onClose?.(t)}}};function v(e){if(a)return;let n=i();if(s=s.filter(e=>n-e<zE),s.push(n),s.length>Xl.bridgeMessagesPerSecond){_.close(`rate`);return}let r=e.data,c=HE(r);if(c===null){_.close(`malformed`);return}if(c>Xl.bridgeInboundFrameBytes){_.close(`too-large`);return}if(!BE(r)||r.protocolVersion!==1||typeof r.sequence!=`number`||!Number.isSafeInteger(r.sequence)||typeof r.method!=`string`||!BE(r.payload)){_.close(`malformed`);return}if(r.instanceId!==t){_.close(`instance`);return}if(r.sequence<=o){_.close(`sequence`);return}o=r.sequence,g({sequence:r.sequence,method:r.method,payload:r.payload})}return n.addEventListener(`message`,v),n.start(),_}var GE=(e,t)=>typeof e==`object`&&!!e&&e.type===`vde-bridge-hello`&&e.protocolVersion===1&&e.instanceId===t;function KE(e,t,n,r,i){let a=n?.bridge?.instanceId??null,o=n?.bridge?.requestId??null,s=n?.grant??null,c=n?.documentUrl??null,[l,u]=(0,D.useState)(null),d=(0,D.useRef)(null);return(0,D.useEffect)(()=>{if(a===null||o===null||s===null)return;let n=t.current,r=i.current?.url===c?i.current.count:0,l=r>1,f=null,p=e=>u({instanceId:a,status:{status:`closed`,reason:e}}),m=t=>{let r=n?.contentWindow;if(!r||t.source!==r||!GE(t.data,a)||l)return;l=!0;let i=new MessageChannel,o=async e=>{try{return await e}catch(e){throw e instanceof VS&&e.code===`E_RENDER_GRANT_INVALID`&&setTimeout(()=>f?.close(`expired`),0),e}};f=WE({instanceId:a,port:i.port1,handlers:{async ready(){let t=await o(e.bridgeReady(s));return{protocolVersion:1,requestId:t.requestId,documentId:t.documentId,revision:t.revision,questionnaire:t.questionnaire,draftVersion:t.draftVersion,answers:t.draftAnswers}},updateDraft:(t,n)=>o(e.bridgeDraft(s,n,t))},onClose:p}),d.current=f,r.postMessage({type:it,instanceId:a},`*`,[i.port2]),u({instanceId:a,status:{status:`connected`}})},h=()=>{r+=1,!(r<2)&&(l=!0,f?f.close(`navigated`):p(`navigated`))};return window.addEventListener(`message`,m),n?.addEventListener(`load`,h),()=>{window.removeEventListener(`message`,m),n?.removeEventListener(`load`,h),f?.close(`replaced`),d.current=null}},[e,t,a,o,s,c,i]),(0,D.useEffect)(()=>{let t=d.current;if(t===null||r===null||r.requestId!==o||s===null)return;if(r.status!==`pending`){t.close(`request-closed`);return}let n=!1;return e.bridgeReady(s).then(e=>{n||e.status!==`pending`||t.notifyDraft({answers:e.draftAnswers,draftVersion:e.draftVersion})},e=>{e instanceof VS&&e.code===`E_RENDER_GRANT_INVALID`&&t.close(`expired`)}),()=>{n=!0}},[e,r,o,s]),a===null?{status:`none`}:i.current?.url===c&&i.current.count>1?{status:`closed`,reason:`navigated`}:l?.instanceId===a?l.status:{status:`waiting`}}var qE=2e3;function JE(e){let[t,n]=(0,D.useState)(null);return(0,D.useEffect)(()=>{if(e===null)return;let t=new Worker(new URL(`/assets/markdown.worker-BhrAVXtB.js`,``+import.meta.url),{type:`module`}),r=r=>{clearTimeout(i),t.terminate(),n({source:e,state:r})},i=setTimeout(()=>r({status:`failed`,reason:`timeout`}),qE);return t.addEventListener(`message`,e=>{r(e.data.ok?{status:`ready`,document:e.data.document}:{status:`failed`,reason:e.data.reason})}),t.addEventListener(`error`,()=>r({status:`failed`,reason:`parse-error`})),t.postMessage({id:1,source:e}),()=>{clearTimeout(i),t.terminate()}},[e]),t!==null&&t.source===e?t.state:{status:`parsing`}}function YE(e,t,n){let[r,i]=(0,D.useState)(null);return(0,D.useEffect)(()=>{if(t===null)return;let r=!1;return e.renderMissing(t).then(e=>{r||i({grant:t,fetchedFor:n,missing:e})},()=>void 0),()=>{r=!0}},[e,t,n]),r!==null&&r.grant===t?r.missing:[]}function XE(e,t){return e===null||e.state.status===`ready`&&e.state.grant.diagnostics.some(e=>e.code===`asset-scan-failed`)?t:e.updatedAt}function ZE(e,t){return{release:e.filter(e=>e!==t),keep:e.filter(e=>e===t)}}var QE={mode:`static`,requestId:null,nonce:0};function $E(e,t,n,r,i=QE){let{mode:a,requestId:o,nonce:s}=i,[c,l]=(0,D.useState)(null),u=(0,D.useRef)(null),d=(0,D.useRef)([]),f=`${t}\n${n??``}\n${a}\n${o??``}\n${String(s)}`,p=c!==null&&c.key===f?c:null,m=XE(p,r),h=p?.state.status===`ready`?p.state.grant.grant:null;return(0,D.useEffect)(()=>{let r=()=>{u.current!==null&&d.current.push(u.current.grant),u.current=null};if(n===null){r();return}let i=!1;return(o===null?e.renderGrant(t,n,{mode:a}):e.feedbackRenderGrant(o)).then(t=>{if(i){e.releaseGrants([t.grant]).catch(()=>void 0);return}r(),u.current={key:f,grant:t.grant},l({key:f,updatedAt:m,state:{status:`ready`,grant:t}})},e=>{if(!i){if(u.current?.key===f){l(e=>e!==null&&e.key===f?{...e,updatedAt:m}:e);return}r(),l({key:f,updatedAt:m,state:{status:`failed`,message:e instanceof Error?e.message:`Could not prepare the view.`}})}}),()=>{i=!0}},[e,t,n,a,o,f,m]),(0,D.useEffect)(()=>{let{release:t,keep:n}=ZE(d.current,h);t.length!==0&&(d.current=n,e.releaseGrants(t).catch(()=>void 0))}),(0,D.useEffect)(()=>()=>{let t=d.current.splice(0);u.current!==null&&t.push(u.current.grant),u.current=null,t.length>0&&e.releaseGrants(t).catch(()=>void 0)},[e]),p?.state??{status:`loading`}}var eD=160,tD=480,nD=240,rD=e=>typeof e==`number`&&Number.isInteger(e)&&e>=eD&&e<=tD,iD={timeout:`Parsing did not finish within 2 seconds, so the source is shown.`,"limit-nodes":`The document has more than 100,000 elements, so the source is shown.`,"limit-depth":`The document is nested deeper than 64 levels, so the source is shown.`,"parse-error":`The document could not be parsed, so the source is shown.`},aD={missing:`The file was not found. Showing the last content that could be read.`,unreadable:`No permission to read the file. Showing the last content that could be read.`,error:`The file cannot be read as a document. Showing the last content that could be read.`};function oD(e,t){if(e===null)return null;for(let n of e.querySelectorAll(`[id]`))if(n.id===t)return n;return null}function sD({api:e,document:t,fixedRevision:n=null,request:r=null,renderSignal:i=0,waitingForRequest:a=!1,sectionTarget:o=null,restoreHeading:s=null,onHeadingShown:c,displayed:l=!0,onReady:u}){let[d,f]=jE(`view-mode`,`preview`,LE),[p,m]=jE(`markdown-width`,`standard`,RE),[h,g]=jE(`outline-width`,nD,rD),_=(0,D.useId)(),v=(0,D.useRef)(null),[y,b]=(0,D.useState)(0),x=(0,D.useRef)(null),S=Math.max(eD,Math.min(tD,y-248)),C=Math.min(h,S);(0,D.useLayoutEffect)(()=>{let e=v.current;if(!e)return;let t=()=>b(e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let w=e=>{g(Math.round(Math.min(S,Math.max(eD,e))))},T=e=>{e.button===0&&e.isPrimary&&(e.preventDefault(),e.currentTarget.focus(),x.current={pointerId:e.pointerId,x:e.clientX,width:C},e.currentTarget.setPointerCapture(e.pointerId))},E=e=>{let t=x.current;t&&t.pointerId===e.pointerId&&e.currentTarget.hasPointerCapture(e.pointerId)&&w(t.width+t.x-e.clientX)},[O,k]=(0,D.useState)(null),A=O!==null,j=n!==null,M=a?null:n??O??t.revision,[N,P]=(0,D.useState)(null),[I,R]=(0,D.useState)(null),[z,ee]=(0,D.useState)(null),[te,ne]=(0,D.useState)(null),ie=(0,D.useRef)(null),B=(0,D.useRef)(0);(0,D.useEffect)(()=>{if(M===null)return;let n=!1;return B.current=ie.current?.scrollTop??0,Promise.all([e.content(t.documentId,M),e.outline(t.documentId,M).then(e=>({items:e,error:null}),e=>({items:[],error:e instanceof Error?e.message:`Could not be fetched.`}))]).then(([e,t])=>{n||(P({revision:M,text:e,outline:t.items,outlineError:t.error}),R(null))},e=>{n||R({revision:M,message:e instanceof Error?e.message:`Could not be loaded.`})}),()=>{n=!0}},[e,t.documentId,M]);let ae=N?.text??null,oe=N?.outline??[],se=N?.outlineError??null,ce=I!==null&&I.revision===M?I.message:null,le=t.format===`markdown`,V=d===`preview`,ue=JE(le&&V?ae:null),de=n!==null&&r?.status===`pending`&&r.revision===n?r.requestId:null,fe=de!==null&&r?.renderMode===`static`,pe=!le&&t.htmlMode===`interactive`&&t.interactiveAllowed,[me,ge]=(0,D.useState)(0),_e=$E(e,t.documentId,M,t.updatedAt,{mode:pe?`interactive`:`static`,requestId:de,nonce:me}),ve=_e.status===`ready`?_e.grant:null,ye=YE(e,ve?.grant??null,i),[be,xe]=(0,D.useState)(!1),[Se,Ce]=(0,D.useState)(null),we=kE(t.documentId),Te=n=>{xe(!1),Ce(null),e.setHtmlMode(t.documentId,n).catch(e=>Ce(e instanceof Error?e.message:`Could not change the view mode.`))},Ee=le&&V&&ue.status===`ready`,De=!le&&V?ve?.documentUrl??null:null,Oe=(0,D.useRef)(null),Ae=(0,D.useRef)(null),[Me,Pe]=(0,D.useState)(null),Fe=KE(e,Oe,l&&De!==null?ve:null,r,Ae),Ie=ae!==null&&(!V||(le?ue.status===`failed`||ue.status===`ready`&&_e.status!==`loading`:_e.status===`failed`)),Le=!a&&(M===null||(De===null?ce!==null||Ie:Me===De)),Re=(0,D.useCallback)(e=>{e!==null&&Le&&u?.()},[Le,u]);(0,D.useLayoutEffect)(()=>{ie.current&&(ae!==null||Ee)&&(ie.current.scrollTop=B.current)},[ae,Ee]);let ze=(0,D.useMemo)(()=>{if(!ve)return;let e=new Set(ve.assets.filter(e=>e.role===`image`||e.role===`svg`).map(e=>e.logicalPath));return t=>{let n=vw(t,ve.documentLogicalPath);return n===null||!e.has(n)?null:`${ve.filesBaseUrl}${cw(n)}`}},[ve]),Be=(0,D.useCallback)(async(n,r,i)=>{ne(null);try{await e.openLink(t.documentId,r,n,i),ee(null)}catch(e){if(e instanceof VS&&e.code===`E_CONFIRMATION_REQUIRED`){ee({linkId:n,revision:r,path:String(e.details.path??``),confirmation:String(e.details.confirmation??``),changed:e.details.changed===!0});return}ee(null),ne({linkId:n,revision:r,message:e instanceof Error?e.message:`Could not open the link.`})}},[e,t.documentId]),Ve=(0,D.useCallback)(e=>{let t=ve?.links.find(t=>t.href===e);ve&&t?.kind===`document`&&Be(t.linkId,ve.revision)},[ve,Be]),He=(0,D.useMemo)(()=>(0,H.jsx)(nE,{code:!0,label:`code`,text:XT}),[]),Ue=A&&!j&&t.revision!==M,We=(0,D.useMemo)(()=>new Map(ve?.headingTargets.map(e=>[e.sectionId,e.anchor])??[]),[ve]),Ge=Ee?null:De===null?le?`Available in the Markdown preview`:`Available in the HTML preview`:ve?.mode===`static`?N?.revision===ve.revision?null:`Available once the outline of the shown revision has loaded`:`Not available in the Interactive view (jumping reloads the view and restarts its scripts)`,Ke=e=>Ge===null&&(Ee||We.get(e.sectionId)===e.anchor),qe=(0,D.useCallback)(e=>{if(Ee){oD(ie.current,e.anchor)?.scrollIntoView({block:`start`});return}De!==null&&Oe.current?.contentWindow?.location.replace(`${De}#${gw(e.anchor)}`)},[Ee,De]),Je=o?.nonce??0,[Ye,Xe]=(0,D.useState)(0),Ze=o!==null&&M!==null&&N?.revision===M,Qe=Ze&&o.revision===M,$e=Qe&&Ee?oe.find(e=>e.sectionId===o.sectionId)??null:null,et=o===null||Je===Ye?null:Ze?Qe?Ee?null:`This view does not jump to sections (only the Markdown preview does).`:j?`The search result is in a different revision than the one shown. The view is showing the question's revision while awaiting an answer, so it did not jump.`:A?`The search result is in a different revision than the one shown. Updates are paused, so the view did not jump.`:`The document was updated after the search, so the view did not jump to the section. Search again.`:ce===null?null:`The revision to show could not be loaded, so the view did not jump to the section.`;(0,D.useEffect)(()=>{$e!==null&&Je!==0&&(qe($e),c?.({sectionId:$e.sectionId,title:$e.title}))},[$e,Je,qe,c]);let tt=s!==null&&Ge===null&&M!==null&&N?.revision===M&&se===null,nt=tt?oe.find(e=>e.sectionId===s.sectionId&&e.title===s.title)??oe.find(e=>e.title===s.title)??null:null,it=nt!==null&&Ke(nt),at=s?.id??null,ot=(0,D.useRef)(null);(0,D.useEffect)(()=>{if(tt&&at!==null&&ot.current!==at){if(ot.current=at,nt===null||!it){c?.(null);return}qe(nt),c?.({sectionId:nt.sectionId,title:nt.title})}},[tt,at,nt,it,qe,c]);let st=[...ve?.diagnostics??[],...ye.map(e=>({code:`asset-requested`,target:e,count:1}))],ct=ve?.mode??`static`,lt=le?[]:ve?.links??[],ut=[...et?[{label:`Section not reached`,message:et,dismiss:()=>Xe(Je),testId:`section-target-notice`}]:[],...t.sourceState!==`ready`&&aD[t.sourceState]?[{label:t.sourceState===`missing`?`File missing`:`File unreadable`,message:aD[t.sourceState]}]:[],...!le&&V&&_e.status===`failed`?[{label:`Showing source`,message:`The HTML could not be converted for display, so the source is shown (${_e.message}).`}]:[],...le&&V&&ue.status===`failed`?[{label:`Showing source`,message:iD[ue.reason]??iD[`parse-error`]}]:[],...ce?[{label:`Could not load document`,message:ce}]:[],...le&&te?[{label:`Could not open link`,message:te.message,dismiss:()=>ne(null)}]:[],...De===null&&Se?[{label:`Script change failed`,message:Se,dismiss:()=>Ce(null)}]:[]];return(0,H.jsxs)(`section`,{ref:Re,className:`flex h-full min-h-0 min-w-0 flex-1 flex-col`,"aria-label":`Document view`,children:[(0,H.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 border-b px-4 py-2`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 basis-56`,children:[(0,H.jsx)(`h1`,{className:`truncate text-base font-semibold`,children:t.title}),(0,H.jsxs)(`p`,{className:`text-xs [overflow-wrap:anywhere] text-muted-foreground`,title:t.canonicalPath??void 0,"data-testid":`document-location`,children:[(0,H.jsx)(rt,{document:t}),M&&(0,H.jsxs)(`span`,{title:M,children:[` · Revision `,M.slice(4,12)]})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t.displayPath!==null&&(0,H.jsx)(nE,{label:`document path`,text:t.displayPath}),(0,H.jsx)(nE,{label:`document ID`,text:t.documentId,icon:he,title:`Copy document ID (${t.documentId})`})]}),(0,H.jsx)(uE,{variant:`outline`,children:le?`Markdown`:`HTML`}),j?(0,H.jsx)(uE,{variant:`secondary`,children:`Showing the question's revision`}):A&&(Ue?(0,H.jsxs)(vx,{title:`A newer revision is available`,trigger:(0,H.jsxs)(pb,{variant:`ghost`,size:`xs`,children:[(0,H.jsx)(L,{"aria-hidden":`true`}),`Update available`]}),children:[(0,H.jsx)(`p`,{children:`Updates are paused. The view stays on the revision from when they were paused.`}),(0,H.jsx)(pb,{size:`sm`,variant:`outline`,onClick:()=>k(null),children:`Resume updates`})]}):(0,H.jsx)(uE,{variant:`secondary`,children:`Updates paused`})),(0,H.jsxs)(yE,{value:[d],onValueChange:e=>{let t=e[0];LE(t)&&(t===`preview`&&d!==`preview`&&!le&&ge(e=>e+1),f(t))},size:`sm`,"aria-label":`View`,children:[(0,H.jsx)(bE,{value:`preview`,children:`Preview`}),(0,H.jsx)(bE,{value:`source`,children:`Source`})]}),le&&V&&(0,H.jsxs)(pb,{variant:p===`wide`?`secondary`:`outline`,size:`sm`,"aria-pressed":p===`wide`,title:p===`wide`?`Return to standard Markdown width`:`Use the full available width for Markdown`,onClick:()=>m(p===`wide`?`standard`:`wide`),children:[(0,H.jsx)(F,{"aria-hidden":`true`}),`Wide view`]}),(0,H.jsxs)(pb,{variant:`outline`,size:`sm`,"aria-pressed":A,disabled:j,title:j?`A question is awaiting an answer, so the question's revision is shown`:void 0,onClick:()=>k(A?null:t.revision),children:[A?(0,H.jsx)(je,{"aria-hidden":`true`}):(0,H.jsx)(ke,{"aria-hidden":`true`}),A?`Resume updates`:`Pause updates`]}),(0,H.jsxs)(pb,{variant:`ghost`,size:`sm`,onClick:()=>void e.refresh(t.documentId).catch(()=>void 0),children:[(0,H.jsx)(Ne,{"aria-hidden":`true`}),`Refresh`]}),(0,H.jsxs)(vx,{title:`PDF export failed`,enabled:we.error!==null,trigger:(0,H.jsxs)(pb,{variant:`ghost`,size:`sm`,disabled:we.exporting||N===null,title:le?void 0:`Exports static HTML; scripts and interactive changes are not included`,onClick:()=>{we.error===null&&N!==null&&OE.start(e,t,N.revision)},children:[we.error?(0,H.jsx)(L,{"aria-hidden":`true`,className:`text-destructive`}):(0,H.jsx)(re,{"aria-hidden":`true`}),(0,H.jsxs)(`span`,{className:`inline-grid`,children:[(0,H.jsx)(`span`,{className:`invisible col-start-1 row-start-1`,"aria-hidden":`true`,children:`Export PDF`}),(0,H.jsx)(`span`,{className:`invisible col-start-1 row-start-1`,"aria-hidden":`true`,children:`Exporting…`}),(0,H.jsx)(`span`,{className:`col-start-1 row-start-1`,children:we.exporting?`Exporting…`:`Export PDF`})]})]}),children:[(0,H.jsx)(`p`,{children:we.error}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(pb,{size:`sm`,variant:`outline`,onClick:()=>{N&&OE.start(e,t,N.revision)},children:`Try again`}),(0,H.jsx)(pb,{size:`sm`,variant:`ghost`,onClick:()=>OE.dismiss(t.documentId),children:`Dismiss`})]})]})]}),(we.error||te)&&(0,H.jsxs)(`span`,{role:`alert`,className:`sr-only`,children:[we.error,te?.message]}),ut.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 border-b px-3 py-1`,"data-testid":`document-notices`,children:[ut.map(e=>(0,H.jsxs)(vx,{title:e.label,trigger:(0,H.jsxs)(pb,{variant:`ghost`,size:`xs`,className:`text-destructive`,"data-testid":`testId`in e?e.testId:void 0,children:[(0,H.jsx)(L,{"aria-hidden":`true`}),e.label]}),children:[(0,H.jsx)(`p`,{children:e.message}),`dismiss`in e&&(0,H.jsx)(pb,{variant:`outline`,size:`sm`,onClick:e.dismiss,children:`Dismiss`})]},e.label)),(0,H.jsx)(`span`,{role:`status`,className:`sr-only`,children:ut.map(e=>e.message).join(` `)})]}),(st.length>0||lt.length>0)&&(0,H.jsxs)(`div`,{className:`flex flex-col border-b text-sm`,children:[st.length>0&&(0,H.jsxs)(`details`,{className:`px-4 py-2`,"data-testid":`render-diagnostics`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer`,children:[`Differences from the original document (`,st.length,` kinds)`]}),(0,H.jsx)(`ul`,{className:`mt-2 flex max-h-40 list-disc flex-col gap-1 overflow-y-auto pl-5 text-muted-foreground`,children:st.map(e=>(0,H.jsx)(`li`,{className:`break-words`,children:CE(e)},`${e.code}:${e.target??``}`))})]}),lt.length>0&&(0,H.jsxs)(`details`,{className:`border-t px-4 py-2 first:border-t-0`,"data-testid":`render-links`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer`,children:[`Links in this document (`,lt.length,`)`]}),(0,H.jsx)(`ul`,{className:`mt-2 flex max-h-40 flex-col gap-1 overflow-y-auto`,children:lt.map(e=>(0,H.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[e.kind===`external`&&(0,H.jsx)(`a`,{className:`underline underline-offset-2`,href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:e.text||e.href}),e.kind===`document`&&(0,H.jsxs)(vx,{title:`Could not open link`,enabled:te?.linkId===e.linkId,trigger:(0,H.jsxs)(pb,{variant:`link`,size:`xs`,className:`h-auto p-0`,onClick:()=>{ve&&te?.linkId!==e.linkId&&Be(e.linkId,ve.revision)},children:[te?.linkId===e.linkId&&(0,H.jsx)(L,{"aria-hidden":`true`,className:`text-destructive`}),e.text||e.href]}),children:[(0,H.jsx)(`p`,{children:te?.message}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(pb,{size:`sm`,variant:`outline`,onClick:()=>{te&&Be(te.linkId,te.revision)},children:`Try again`}),(0,H.jsx)(pb,{size:`sm`,variant:`ghost`,onClick:()=>ne(null),children:`Dismiss`})]})]}),e.kind===`other`&&(0,H.jsx)(`span`,{children:e.text||e.href}),(0,H.jsxs)(`span`,{className:`text-xs break-all text-muted-foreground`,children:[e.href,e.kind===`other`&&` (this kind of link cannot be opened)`]})]},e.linkId))})]})]}),(0,H.jsxs)(`div`,{ref:v,className:`flex min-h-0 min-w-0 flex-1`,children:[De?(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(oE,{mode:ct,bridge:Fe,pinnedStatic:fe,needsPermission:t.htmlMode===`interactive`&&!t.interactiveAllowed&&!fe,modeError:Se,onRunScripts:()=>xe(!0),onStopScripts:()=>Te(`static`),onReload:()=>ge(e=>e+1)}),(0,H.jsx)(`iframe`,{ref:Oe,title:`View of ${t.title}`,src:De,onLoad:()=>{let e=Ae.current;Ae.current={url:De,count:e?.url===De?e.count+1:1},Pe(De)},sandbox:ct===`interactive`?`allow-scripts`:``,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white`,"data-testid":`document-frame`},De)]}):(0,H.jsx)(`div`,{ref:ie,className:`min-w-0 flex-1 overflow-y-auto px-6 py-5`,"data-testid":`document-body`,children:ae===null?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:ce===null?`Loading…`:`Could not load this document.`}):Ee?(0,H.jsx)(`article`,{className:`markdown-body mx-auto`,"data-width":p,children:(0,H.jsx)($T,{document:ue.document,...ze?{resolveImage:ze}:{},onOpenLink:Ve,codeActions:He})}):V&&(le?ue.status===`parsing`:_e.status===`loading`)?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Preparing the view…`}):(0,H.jsx)(`pre`,{className:`font-mono text-sm leading-relaxed break-words whitespace-pre-wrap`,children:ae})}),(oe.length>0||se!==null)&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize outline`,"aria-controls":_,"aria-valuemin":eD,"aria-valuemax":S,"aria-valuenow":C,tabIndex:0,className:`relative hidden w-2 shrink-0 touch-none cursor-col-resize before:absolute before:inset-y-0 before:left-1/2 before:w-px before:bg-border hover:bg-muted hover:before:bg-primary/60 focus-visible:bg-primary/10 focus-visible:before:bg-primary focus-visible:outline-none active:bg-primary/10 active:before:bg-primary lg:block`,onPointerDown:T,onPointerMove:E,onLostPointerCapture:()=>{x.current=null},onKeyDown:e=>{let t=e.key===`ArrowLeft`?C+16:e.key===`ArrowRight`?C-16:e.key===`Home`?eD:e.key===`End`?S:null;t!==null&&(e.preventDefault(),w(t))}}),(0,H.jsxs)(`aside`,{id:_,style:{width:C},className:`hidden shrink-0 overflow-y-auto px-3 py-4 lg:block`,"aria-label":`Outline`,children:[(0,H.jsx)(`h2`,{className:`mb-2 text-xs font-medium text-muted-foreground`,children:`Outline`}),se!==null&&(0,H.jsxs)(`p`,{className:`text-xs text-destructive`,role:`alert`,children:[`Could not fetch the outline (`,se,`).`]}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-0.5 text-sm`,children:oe.map(e=>{let t=Ke(e);return(0,H.jsx)(`li`,{style:{paddingLeft:`${String((e.level-1)*.75)}rem`},children:(0,H.jsx)(`button`,{type:`button`,className:`w-full truncate rounded px-2 py-1 text-left hover:bg-muted disabled:opacity-50`,disabled:!t,title:t?e.title:Ge??`This heading is not in the view (removed from the display, or an earlier element has the same id)`,onClick:()=>{qe(e),c?.({sectionId:e.sectionId,title:e.title})},children:e.title})},e.sectionId)})})]})]})]}),(0,H.jsx)(mb,{open:be,onOpenChange:xe,children:(0,H.jsxs)(_b,{children:[(0,H.jsxs)(vb,{children:[(0,H.jsx)(bb,{children:`Run the scripts in this document?`}),(0,H.jsxs)(xb,{children:[`This runs the scripts in this HTML inside your browser. `,(0,H.jsx)(rE,{}),` This is not a mechanism for running arbitrary scripts safely. Enable it only for trusted HTML that you or your agent prepared.`]})]}),(0,H.jsxs)(yb,{children:[(0,H.jsx)(Cb,{children:`Back`}),(0,H.jsx)(Sb,{onClick:()=>Te(`interactive`),children:`Run scripts`})]})]})}),(0,H.jsx)(mb,{open:z!==null,onOpenChange:e=>{e||ee(null)},children:(0,H.jsxs)(_b,{children:[(0,H.jsxs)(vb,{children:[(0,H.jsx)(bb,{children:`Add this document to the list and open it?`}),(0,H.jsx)(xb,{className:`break-all`,children:z?.path})]}),z?.changed&&(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:`While you were confirming, the link target changed or the confirmation expired. Check the path above again.`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This is the file that a link in the document points to. It is not open yet. Opening it adds it to the document list and to search.`}),(0,H.jsxs)(yb,{children:[(0,H.jsx)(Cb,{children:`Don't open`}),(0,H.jsx)(Sb,{onClick:()=>{z&&Be(z.linkId,z.revision,z.confirmation)},children:`Add to list and open`})]})]})})]})}function cD(e,t,n,r){let[i,a]=(0,D.useState)(null),[o,s]=(0,D.useState)(0),c=(0,D.useCallback)(()=>s(e=>e+1),[]),l=`${String(n)}\n${r??``}\n${String(o)}`;(0,D.useEffect)(()=>{if(t===null)return;let n=!1;return e.feedback(t).then(e=>{n||a({requestId:t,fetchedFor:l,request:e,error:null})},e=>{n||a(n=>({requestId:t,fetchedFor:l,request:n?.requestId===t?n.request:null,error:e instanceof Error?e.message:`Could not fetch the question.`}))}),()=>{n=!0}},[e,t,l]);let u=i!==null&&i.requestId===t?i:null;return{request:u?.request??null,error:u?.error??null,reload:c}}function lD({documents:e,...t}){let[n,r]=(0,D.useState)(t.document.documentId),i=e.find(e=>e.documentId===n),a=i!==void 0&&i.documentId!==t.document.documentId,o=a?[i,t.document]:[t.document],s=(0,D.useCallback)(()=>r(t.document.documentId),[t.document.documentId]);return(0,H.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1`,"aria-busy":a,children:o.map(e=>{let n=e.documentId===t.document.documentId,r=!a||!n;return(0,H.jsx)(`div`,{className:r?`flex min-h-0 min-w-0 flex-1`:`invisible absolute inset-0 flex min-h-0 min-w-0`,"aria-hidden":!r,inert:a,"data-testid":`document-workspace`,children:(0,H.jsx)(uD,{...t,document:e,displayed:r,onReady:n?s:void 0,sectionTarget:n&&r?t.sectionTarget:null,restoreHeading:n&&r?t.restoreHeading:null,onHeadingShown:n&&r?t.onHeadingShown:void 0})},e.documentId)})})}function uD({api:e,document:t,feedbackSignal:n,renderSignal:r,sectionTarget:i=null,restoreHeading:a=null,onHeadingShown:o,displayed:s=!0,onReady:c}){let l=t.pendingRequestIds[0]??null,[u,d]=(0,D.useState)(l);l!==null&&l!==u&&d(l);let f=l??u,{request:p,error:m,reload:h}=cD(e,f,n,t.revision),g=p?.status===`pending`?p.revision:null;return(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col min-[900px]:flex-row`,children:[(0,H.jsx)(sD,{api:e,document:t,fixedRevision:g,request:p,renderSignal:r,waitingForRequest:l!==null&&p===null&&m===null,sectionTarget:i,restoreHeading:a,displayed:s,...c?{onReady:c}:{},...o?{onHeadingShown:o}:{}}),p?(0,H.jsx)(rC,{api:e,request:p,reload:h},p.requestId):m!==null&&f!==null&&(0,H.jsx)(`aside`,{"aria-label":`Answer the question`,className:`w-full shrink-0 border-t px-4 py-4 min-[900px]:w-96 min-[900px]:border-t-0 min-[900px]:border-l`,children:(0,H.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Could not fetch the question (`,m,`).`]})})]})}var dD=h_(function(e){return Ov(`dialog`,e)});function fD({...e}){return(0,H.jsx)(dD,{"data-slot":`dialog`,...e})}function pD({...e}){return(0,H.jsx)(sy,{"data-slot":`dialog-portal`,...e})}function mD({className:e,...t}){return(0,H.jsx)(Av,{"data-slot":`dialog-overlay`,className:ab(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function hD({className:e,children:t,showCloseButton:n=!0,...r}){return(0,H.jsxs)(pD,{children:[(0,H.jsx)(mD,{}),(0,H.jsxs)(iy,{"data-slot":`dialog-content`,className:ab(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,H.jsxs)(Rv,{"data-slot":`dialog-close`,render:(0,H.jsx)(pb,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,H.jsx)(ze,{}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function gD({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`dialog-header`,className:ab(`flex flex-col gap-2`,e),...t})}function _D({className:e,...t}){return(0,H.jsx)(cy,{"data-slot":`dialog-title`,className:ab(`font-heading text-base leading-none font-medium`,e),...t})}function vD({className:e,...t}){return(0,H.jsx)(Bv,{"data-slot":`dialog-description`,className:ab(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}var yD=200,bD=20;function xD({api:e,open:t,onOpenChange:n,onSelect:r}){let[i,a]=(0,D.useState)(``),[o,s]=(0,D.useState)(null),[c,l]=(0,D.useState)(0),u=(0,D.useId)(),d=i.trim();(0,D.useEffect)(()=>{if(!t||d===``)return;let n=!1,r=setTimeout(()=>{e.search(d,bD).then(e=>{n||s({query:d,result:e,error:null})},e=>{n||s({query:d,result:null,error:e instanceof Error?e.message:`Search failed.`})})},yD);return()=>{n=!0,clearTimeout(r)}},[e,t,d]);let f=o!==null&&o.query===d?o:null,p=f?.result?.hits??[],m=e=>Math.max(0,Math.min(e,p.length-1)),h=m(c);(0,D.useEffect)(()=>{p.length!==0&&window.document.getElementById(`${u}-${String(h)}`)?.scrollIntoView?.({block:`nearest`})},[h,p.length,u]);let g=e=>{e&&(n(!1),r(e))};return(0,H.jsx)(fD,{open:t,onOpenChange:e=>{n(e),e||(a(``),l(0))},children:(0,H.jsxs)(hD,{className:`top-[15%] translate-y-0 sm:max-w-xl`,children:[(0,H.jsxs)(gD,{children:[(0,H.jsx)(_D,{children:`Search open documents`}),(0,H.jsx)(vD,{children:`Only documents that are currently open are searched. Closed documents and other files are not.`})]}),(0,H.jsx)(nS,{"aria-label":`Search query`,"aria-controls":u,"aria-activedescendant":p.length>0?`${u}-${String(h)}`:void 0,placeholder:`Words or a file name`,value:i,onChange:e=>{a(e.target.value),l(0)},onKeyDown:e=>{e.nativeEvent.isComposing||p.length!==0&&(e.key===`ArrowDown`?(e.preventDefault(),l(e=>m(m(e)+1))):e.key===`ArrowUp`?(e.preventDefault(),l(e=>m(m(e)-1))):e.key===`Enter`&&(e.preventDefault(),g(p[h])))}}),(0,H.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`text-xs text-muted-foreground`,children:d===``?`Type to search the open documents. Use ↑↓ to select and Enter to jump.`:f===null?`Searching…`:f.error===null?`${String(p.length)} ${p.length===1?`result`:`results`}${f.result?.incomplete===!0?` (some documents are not indexed yet, so not all documents were searched)`:``}`:`Search failed (${f.error}).`}),(0,H.jsx)(`div`,{id:u,role:`listbox`,"aria-label":`Search results`,className:`flex max-h-80 flex-col gap-1 overflow-y-auto`,children:p.map((e,t)=>(0,H.jsxs)(`div`,{id:`${u}-${String(t)}`,role:`option`,"aria-selected":t===h,className:`cursor-pointer rounded-md px-3 py-2 text-sm aria-selected:bg-muted`,tabIndex:-1,onMouseEnter:()=>l(t),onClick:()=>g(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),g(e))},children:[(0,H.jsxs)(`p`,{className:`truncate font-medium`,children:[e.title,e.headingPath.length>0&&(0,H.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[` `,`— `,e.headingPath.join(` › `)]})]}),(0,H.jsx)(`p`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:e.excerpt}),e.displayPath&&(0,H.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.displayPath})]},`${e.documentId}:${e.sectionId}`))})]})})}var SD=Symbol.for(`preact-signals`);function CD(){if(kD>1)kD--;else{var e,t=!1;for((function(){var e=ND;for(ND=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();OD!==void 0;){var n=OD;for(OD=void 0,AD++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&RD(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(AD=0,kD--,t)throw e}}function wD(e){if(kD>0)return e();MD=++jD,kD++;try{return e()}finally{CD()}}var TD,ED=void 0;function DD(e){var t=ED,n=TD;ED=void 0,TD=void 0;try{return e()}finally{ED=t,TD=n}}var OD=void 0,kD=0,AD=0,jD=0,MD=0,ND=void 0,PD=0;function FD(e){if(ED!==void 0){var t=e.n;if(t===void 0||t.t!==ED)return t={i:0,S:e,p:ED.s,n:void 0,t:ED,e:void 0,x:void 0,r:t},ED.s!==void 0&&(ED.s.n=t),ED.s=t,e.n=t,32&ED.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=ED.s,t.n=void 0,ED.s.n=t,ED.s=t),t}}function ID(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}ID.prototype.brand=SD,ID.prototype.h=function(){return!0},ID.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?DD(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},ID.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&DD(function(){var e;(e=t.Z)==null||e.call(t)}))}},ID.prototype.subscribe=function(e){var t=this;return qD(function(){var n=t.value;DD(function(){return e(n)})},{name:`sub`})},ID.prototype.valueOf=function(){return this.value},ID.prototype.toString=function(){return this.value+``},ID.prototype.toJSON=function(){return this.value},ID.prototype.peek=function(){var e=this;return DD(function(){return e.value})},Object.defineProperty(ID.prototype,"value",{get:function(){var e=FD(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(AD>100)throw Error(`Cycle detected`);(function(e){kD!==0&&AD===0&&e.l!==MD&&(e.l=MD,ND={S:e,v:e.v,i:e.i,o:ND})})(this),this.v=e,this.i++,PD++,kD++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{CD()}}}});function LD(e,t){return new ID(e,t)}function RD(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function zD(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function BD(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function VD(e,t){ID.call(this,void 0,t),this.x=e,this.s=void 0,this.g=PD-1,this.f=4}VD.prototype=new ID,VD.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===PD))return!0;if(this.g=PD,this.f|=1,this.i>0&&!RD(this))return this.f&=-2,!0;var e=ED;try{zD(this),ED=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return ED=e,BD(this),this.f&=-2,!0},VD.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}ID.prototype.S.call(this,e)},VD.prototype.U=function(e){if(this.t!==void 0&&(ID.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},VD.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(VD.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=FD(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function HD(e,t){return new VD(e,t)}function UD(e){var t=e.m;if(e.m=void 0,typeof t==`function`){kD++;var n=ED;ED=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,WD(e),t}finally{ED=n,CD()}}}function WD(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,UD(e)}function GD(e){if(ED!==this)throw Error(`Out-of-order effect`);BD(this),ED=e,this.f&=-2,8&this.f&&WD(this),CD()}function KD(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,TD&&TD.push(this)}KD.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.m=t)}finally{e()}},KD.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,UD(this),zD(this),kD++;var e=ED;return ED=this,GD.bind(this,e)},KD.prototype.N=function(){2&this.f||(this.f|=2,this.u=OD,OD=this)},KD.prototype.d=function(){this.f|=8,1&this.f||WD(this)},KD.prototype.dispose=function(){this.d()};function qD(e,t){var n=new KD(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var JD=Object.create,YD=Object.defineProperty,XD=Object.defineProperties,ZD=Object.getOwnPropertyDescriptor,QD=Object.getOwnPropertyDescriptors,$D=Object.getOwnPropertySymbols,eO=Object.prototype.hasOwnProperty,tO=Object.prototype.propertyIsEnumerable,nO=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),rO=e=>{throw TypeError(e)},iO=(e,t,n)=>t in e?YD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aO=(e,t)=>{for(var n in t||={})eO.call(t,n)&&iO(e,n,t[n]);if($D)for(var n of $D(t))tO.call(t,n)&&iO(e,n,t[n]);return e},oO=(e,t)=>XD(e,QD(t)),sO=(e,t)=>YD(e,`name`,{value:t,configurable:!0}),cO=e=>[,,,JD(e?.[nO(`metadata`)]??null)],lO=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],uO=e=>e!==void 0&&typeof e!=`function`?rO(`Function expected`):e,dO=(e,t,n,r,i)=>({kind:lO[e],name:t,metadata:r,addInitializer:e=>n._?rO(`Already initialized`):i.push(uO(e||null))}),fO=(e,t)=>iO(t,nO(`metadata`),e[3]),pO=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},mO=(e,t,n,r,i,a)=>{var o,s,c,l,u,d=t&7,f=!!(t&8),p=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,h=lO[d+5],g=d>3&&(e[m-1]=[]),_=e[m]||(e[m]=[]),v=d&&(!p&&!f&&(i=i.prototype),d<5&&(d>3||!p)&&ZD(d<4?i:{get[n](){return _O(this,a)},set[n](e){return yO(this,a,e)}},n));d?p&&d<4&&sO(a,(d>2?`set `:d>1?`get `:``)+n):sO(i,n);for(var y=r.length-1;y>=0;y--)l=dO(d,n,c={},e[3],_),d&&(l.static=f,l.private=p,u=l.access={has:p?e=>gO(i,e):e=>n in e},d^3&&(u.get=p?e=>(d^1?_O:bO)(e,i,d^4?a:v.get):e=>e[n]),d>2&&(u.set=p?(e,t)=>yO(e,i,t,d^4?a:v.set):(e,t)=>e[n]=t)),s=(0,r[y])(d?d<4?p?a:v[h]:d>4?void 0:{get:v.get,set:v.set}:i,l),c._=1,d^4||s===void 0?uO(s)&&(d>4?g.unshift(s):d?p?a=s:v[h]=s:i=s):typeof s!=`object`||!s?rO(`Object expected`):(uO(o=s.get)&&(v.get=o),uO(o=s.set)&&(v.set=o),uO(o=s.init)&&g.unshift(o));return d||fO(e,i),v&&YD(i,n,v),p?d^4?a:v:i},hO=(e,t,n)=>t.has(e)||rO(`Cannot `+n),gO=(e,t)=>Object(t)===t?e.has(t):rO(`Cannot use the "in" operator on this value`),_O=(e,t,n)=>(hO(e,t,`read from private field`),n?n.call(e):t.get(e)),vO=(e,t,n)=>t.has(e)?rO(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),yO=(e,t,n,r)=>(hO(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),bO=(e,t,n)=>(hO(e,t,`access private method`),n);function xO(e,t){if(t){let n;return HD(()=>{let r=e();return r&&n&&t(n,r)?n:(n=r,r)})}return HD(e)}function SO(e,t){if(Object.is(e,t))return!0;if(e===null||t===null)return!1;if(typeof e==`function`&&typeof t==`function`)return e===t;if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:!e.some((e,n)=>!SO(e,t[n]));if(typeof e==`object`&&typeof t==`object`){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&!n.some(n=>!SO(e[n],t[n]))}return!1}function CO({get:e},t){return{init(e){return LD(e)},get(){return e.call(this).value},set(t){let n=e.call(this);n.peek()!==t&&(n.value=t)}}}function wO(e,t){let n=new WeakMap;return function(){let t=n.get(this);return t||(t=xO(e.bind(this)),n.set(this,t)),t.value}}function TO(e=!0){return function(t,n){n.addInitializer(function(){let t=n.kind===`field`||n.static?this:Object.getPrototypeOf(this),r=Object.getOwnPropertyDescriptor(t,n.name);r&&Object.defineProperty(t,n.name,oO(aO({},r),{enumerable:e}))})}}function EO(...e){let t=e.map(e=>qD(e));return()=>t.forEach(e=>e())}var DO,OO,kO,AO,jO,MO=[CO],NO,PO,FO,IO,LO,RO,zO,BO,VO,HO,UO,WO,GO,KO;jO=[CO],AO=[CO],kO=[TO()],OO=[TO()],DO=[TO()];var qO=class{constructor(e,t=Object.is){this.defaultValue=e,this.equals=t,pO(NO,5,this),vO(this,RO),vO(this,PO,pO(NO,8,this)),pO(NO,11,this),vO(this,zO,pO(NO,12,this)),pO(NO,15,this),vO(this,UO,pO(NO,16,this)),pO(NO,19,this),this.reset=this.reset.bind(this),this.reset()}get current(){return _O(this,RO,GO)}get initial(){return _O(this,RO,IO)}get previous(){return _O(this,RO,VO)}set current(e){let t=DD(()=>_O(this,RO,GO));e&&t&&this.equals(t,e)||wD(()=>{_O(this,RO,IO)||yO(this,RO,e,LO),yO(this,RO,t,HO),yO(this,RO,e,KO)})}reset(e=this.defaultValue){wD(()=>{yO(this,RO,void 0,HO),yO(this,RO,e,LO),yO(this,RO,e,KO)})}};NO=cO(null),PO=new WeakMap,RO=new WeakSet,zO=new WeakMap,UO=new WeakMap,FO=mO(NO,20,`#initial`,MO,RO,PO),IO=FO.get,LO=FO.set,BO=mO(NO,20,`#previous`,jO,RO,zO),VO=BO.get,HO=BO.set,WO=mO(NO,20,`#current`,AO,RO,UO),GO=WO.get,KO=WO.set,mO(NO,2,`current`,kO,qO),mO(NO,2,`initial`,OO,qO),mO(NO,2,`previous`,DO,qO),fO(NO,qO);function JO(e){return DD(()=>{let t={};for(let n in e)t[n]=e[n];return t})}var YO,XO=class{constructor(){vO(this,YO,new WeakMap)}get(e,t){return e?_O(this,YO).get(e)?.get(t):void 0}set(e,t,n){if(e)return _O(this,YO).has(e)||_O(this,YO).set(e,new Map),_O(this,YO).get(e)?.set(t,n)}clear(e){return e?_O(this,YO).get(e)?.clear():void 0}};YO=new WeakMap;var ZO=Object.create,QO=Object.defineProperty,$O=Object.getOwnPropertyDescriptor,ek=Object.getOwnPropertySymbols,tk=Object.prototype.hasOwnProperty,nk=Object.prototype.propertyIsEnumerable,rk=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),ik=e=>{throw TypeError(e)},ak=Math.pow,ok=(e,t,n)=>t in e?QO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sk=(e,t)=>{for(var n in t||={})tk.call(t,n)&&ok(e,n,t[n]);if(ek)for(var n of ek(t))nk.call(t,n)&&ok(e,n,t[n]);return e},ck=(e,t)=>QO(e,`name`,{value:t,configurable:!0}),lk=e=>[,,,ZO(e?.[rk(`metadata`)]??null)],uk=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],dk=e=>e!==void 0&&typeof e!=`function`?ik(`Function expected`):e,fk=(e,t,n,r,i)=>({kind:uk[e],name:t,metadata:r,addInitializer:e=>n._?ik(`Already initialized`):i.push(dk(e||null))}),pk=(e,t)=>ok(t,rk(`metadata`),e[3]),mk=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},hk=(e,t,n,r,i,a)=>{var o,s,c,l,u,d=t&7,f=!!(t&8),p=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,h=uk[d+5],g=d>3&&(e[m-1]=[]),_=e[m]||(e[m]=[]),v=d&&(!p&&!f&&(i=i.prototype),d<5&&(d>3||!p)&&$O(d<4?i:{get[n](){return vk(this,a)},set[n](e){return bk(this,a,e)}},n));d?p&&d<4&&ck(a,(d>2?`set `:d>1?`get `:``)+n):ck(i,n);for(var y=r.length-1;y>=0;y--)l=fk(d,n,c={},e[3],_),d&&(l.static=f,l.private=p,u=l.access={has:p?e=>_k(i,e):e=>n in e},d^3&&(u.get=p?e=>(d^1?vk:xk)(e,i,d^4?a:v.get):e=>e[n]),d>2&&(u.set=p?(e,t)=>bk(e,i,t,d^4?a:v.set):(e,t)=>e[n]=t)),s=(0,r[y])(d?d<4?p?a:v[h]:d>4?void 0:{get:v.get,set:v.set}:i,l),c._=1,d^4||s===void 0?dk(s)&&(d>4?g.unshift(s):d?p?a=s:v[h]=s:i=s):typeof s!=`object`||!s?ik(`Object expected`):(dk(o=s.get)&&(v.get=o),dk(o=s.set)&&(v.set=o),dk(o=s.init)&&g.unshift(o));return d||pk(e,i),v&&QO(i,n,v),p?d^4?a:v:i},gk=(e,t,n)=>t.has(e)||ik(`Cannot `+n),_k=(e,t)=>Object(t)===t?e.has(t):ik(`Cannot use the "in" operator on this value`),vk=(e,t,n)=>(gk(e,t,`read from private field`),n?n.call(e):t.get(e)),yk=(e,t,n)=>t.has(e)?ik(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),bk=(e,t,n,r)=>(gk(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),xk=(e,t,n)=>(gk(e,t,`access private method`),n),Sk=class e{constructor(e,t){this.x=e,this.y=t}static delta(t,n){return new e(t.x-n.x,t.y-n.y)}static distance(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}static equals(e,t){return e.x===t.x&&e.y===t.y}static from({x:t,y:n}){return new e(t,n)}},Ck=class e{constructor(e,t,n,r){this.left=e,this.top=t,this.width=n,this.height=r,this.scale={x:1,y:1}}get inverseScale(){return{x:1/this.scale.x,y:1/this.scale.y}}translate(t,n){let{top:r,left:i,width:a,height:o,scale:s}=this,c=new e(i+t,r+n,a,o);return c.scale=sk({},s),c}get boundingRectangle(){let{width:e,height:t,left:n,top:r,right:i,bottom:a}=this;return{width:e,height:t,left:n,top:r,right:i,bottom:a}}get center(){let{left:e,top:t,right:n,bottom:r}=this;return new Sk((e+n)/2,(t+r)/2)}get area(){let{width:e,height:t}=this;return e*t}equals(t){if(!(t instanceof e))return!1;let{left:n,top:r,width:i,height:a}=this;return n===t.left&&r===t.top&&i===t.width&&a===t.height}containsPoint(e){let{top:t,left:n,bottom:r,right:i}=this;return t<=e.y&&e.y<=r&&n<=e.x&&e.x<=i}intersectionArea(t){return t instanceof e?wk(this,t):0}intersectionRatio(e){let{area:t}=this,n=this.intersectionArea(e);return n/(e.area+t-n)}get bottom(){let{top:e,height:t}=this;return e+t}get right(){let{left:e,width:t}=this;return e+t}get aspectRatio(){let{width:e,height:t}=this;return e/t}get corners(){return[{x:this.left,y:this.top},{x:this.right,y:this.top},{x:this.left,y:this.bottom},{x:this.right,y:this.bottom}]}static from({top:t,left:n,width:r,height:i}){return new e(n,t,r,i)}static delta(e,t,n={x:`center`,y:`center`}){let r=(e,t)=>{let r=n[t],i=t===`x`?e.left:e.top,a=t===`x`?e.width:e.height;return r==`start`?i:r==`end`?i+a:i+a/2};return Sk.delta({x:r(e,`x`),y:r(e,`y`)},{x:r(t,`x`),y:r(t,`y`)})}static intersectionRatio(t,n){return e.from(t).intersectionRatio(e.from(n))}};function wk(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;return r<i&&n<a?o*s:0}var Tk,Ek,Dk,Ok,kk,Ak=class extends (Dk=qO,Ek=[wO],Tk=[wO],Dk){constructor(e){let t=Sk.from(e);super(t,(e,t)=>Sk.equals(e,t)),mk(kk,5,this),yk(this,Ok,0),this.velocity={x:0,y:0}}get delta(){return Sk.delta(this.current,this.initial)}get direction(){let{current:e,previous:t}=this;if(!t)return null;let n={x:e.x-t.x,y:e.y-t.y};return!n.x&&!n.y?null:Math.abs(n.x)>Math.abs(n.y)?n.x>0?`right`:`left`:n.y>0?`down`:`up`}get current(){return super.current}set current(e){let{current:t}=this,n=Sk.from(e),r={x:n.x-t.x,y:n.y-t.y},i=Date.now(),a=i-vk(this,Ok),o=e=>Math.round(e/a*100);wD(()=>{bk(this,Ok,i),this.velocity={x:o(r.x),y:o(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(Sk.from(e)),this.velocity={x:0,y:0}}};kk=lk(Dk),Ok=new WeakMap,hk(kk,2,`delta`,Ek,Ak),hk(kk,2,`direction`,Tk,Ak),pk(kk,Ak);function jk({x:e,y:t},n){let r=Math.abs(e),i=Math.abs(t);return typeof n==`number`?Math.sqrt(ak(r,2)+ak(i,2))>n:`x`in n&&`y`in n?r>n.x&&i>n.y:`x`in n?r>n.x:`y`in n&&i>n.y}var Mk=(e=>(e.Horizontal=`x`,e.Vertical=`y`,e))(Mk||{}),Nk=Object.values(Mk),Pk=Object.create,Fk=Object.defineProperty,Ik=Object.defineProperties,Lk=Object.getOwnPropertyDescriptor,Rk=Object.getOwnPropertyDescriptors,zk=Object.getOwnPropertySymbols,Bk=Object.prototype.hasOwnProperty,Vk=Object.prototype.propertyIsEnumerable,Hk=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),Uk=e=>{throw TypeError(e)},Wk=(e,t,n)=>t in e?Fk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gk=(e,t)=>{for(var n in t||={})Bk.call(t,n)&&Wk(e,n,t[n]);if(zk)for(var n of zk(t))Vk.call(t,n)&&Wk(e,n,t[n]);return e},Kk=(e,t)=>Ik(e,Rk(t)),qk=(e,t)=>Fk(e,`name`,{value:t,configurable:!0}),Jk=(e,t)=>{var n={};for(var r in e)Bk.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&zk)for(var r of zk(e))t.indexOf(r)<0&&Vk.call(e,r)&&(n[r]=e[r]);return n},Yk=e=>[,,,Pk(e?.[Hk(`metadata`)]??null)],Xk=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],Zk=e=>e!==void 0&&typeof e!=`function`?Uk(`Function expected`):e,Qk=(e,t,n,r,i)=>({kind:Xk[e],name:t,metadata:r,addInitializer:e=>n._?Uk(`Already initialized`):i.push(Zk(e||null))}),$k=(e,t)=>Wk(t,Hk(`metadata`),e[3]),eA=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},tA=(e,t,n,r,i,a)=>{var o,s,c,l,u,d=t&7,f=!!(t&8),p=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,h=Xk[d+5],g=d>3&&(e[m-1]=[]),_=e[m]||(e[m]=[]),v=d&&(!p&&!f&&(i=i.prototype),d<5&&(d>3||!p)&&Lk(d<4?i:{get[n](){return iA(this,a)},set[n](e){return oA(this,a,e)}},n));d?p&&d<4&&qk(a,(d>2?`set `:d>1?`get `:``)+n):qk(i,n);for(var y=r.length-1;y>=0;y--)l=Qk(d,n,c={},e[3],_),d&&(l.static=f,l.private=p,u=l.access={has:p?e=>rA(i,e):e=>n in e},d^3&&(u.get=p?e=>(d^1?iA:sA)(e,i,d^4?a:v.get):e=>e[n]),d>2&&(u.set=p?(e,t)=>oA(e,i,t,d^4?a:v.set):(e,t)=>e[n]=t)),s=(0,r[y])(d?d<4?p?a:v[h]:d>4?void 0:{get:v.get,set:v.set}:i,l),c._=1,d^4||s===void 0?Zk(s)&&(d>4?g.unshift(s):d?p?a=s:v[h]=s:i=s):typeof s!=`object`||!s?Uk(`Object expected`):(Zk(o=s.get)&&(v.get=o),Zk(o=s.set)&&(v.set=o),Zk(o=s.init)&&g.unshift(o));return d||$k(e,i),v&&Fk(i,n,v),p?d^4?a:v:i},nA=(e,t,n)=>t.has(e)||Uk(`Cannot `+n),rA=(e,t)=>Object(t)===t?e.has(t):Uk(`Cannot use the "in" operator on this value`),iA=(e,t,n)=>(nA(e,t,`read from private field`),n?n.call(e):t.get(e)),aA=(e,t,n)=>t.has(e)?Uk(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),oA=(e,t,n,r)=>(nA(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),sA=(e,t,n)=>(nA(e,t,`access private method`),n);function cA(e,t){return{plugin:e,options:t}}function lA(e){return t=>cA(e,t)}function uA(e){return typeof e==`function`?{plugin:e,options:void 0}:e}var dA=[CO],fA,pA,mA,hA=class{constructor(e,t){this.manager=e,this.options=t,aA(this,pA,eA(fA,8,this,!1)),eA(fA,11,this),aA(this,mA,new Set)}enable(){this.disabled=!1}disable(){this.disabled=!0}isDisabled(){return DD(()=>this.disabled)}configure(e){this.options=e}registerEffect(e){let t=qD(e.bind(this));return iA(this,mA).add(t),t}destroy(){iA(this,mA).forEach(e=>e())}static configure(e){return cA(this,e)}};fA=Yk(null),pA=new WeakMap,mA=new WeakMap,tA(fA,4,`disabled`,dA,hA,pA),$k(fA,hA);var gA=class extends hA{},_A,vA=class{constructor(e){this.manager=e,this.instances=new Map,aA(this,_A,[])}get values(){return Array.from(this.instances.values())}set values(e){let t=e.map(uA).reduce((e,t)=>{let n=e.find(({plugin:e})=>e===t.plugin);return n?(n.options=t.options,e):[...e,t]},[]),n=t.map(({plugin:e})=>e);for(let e of iA(this,_A))if(!n.includes(e)){if(e.prototype instanceof gA)continue;this.unregister(e)}for(let{plugin:e,options:n}of t)this.register(e,n);oA(this,_A,n)}get(e){return this.instances.get(e)}register(e,t){let n=this.instances.get(e);if(n)return n.options!==t&&(n.options=t),n;let r=new e(this.manager,t);return this.instances.set(e,r),r}unregister(e){let t=this.instances.get(e);t&&(t.destroy(),this.instances.delete(e))}destroy(){for(let e of this.instances.values())e.destroy();this.instances.clear()}};_A=new WeakMap;function yA(e,t){return e.priority===t.priority?e.type===t.type?t.value-e.value:t.type-e.type:t.priority-e.priority}var bA=[],xA,SA,CA=class extends hA{constructor(e){super(e),aA(this,xA),aA(this,SA),this.computeCollisions=this.computeCollisions.bind(this),oA(this,SA,LD(bA)),this.destroy=EO(()=>{let e=this.computeCollisions(),t=DD(()=>this.manager.dragOperation.position.current);if(e!==bA){let e=iA(this,xA);if(oA(this,xA,t),e&&t.x==e.x&&t.y==e.y)return}else oA(this,xA,void 0);iA(this,SA).value=e},()=>{let{dragOperation:e}=this.manager;e.status.initialized&&this.forceUpdate()})}forceUpdate(e=!0){DD(()=>{e?iA(this,SA).value=this.computeCollisions():oA(this,xA,void 0)})}computeCollisions(e,t){let{registry:n,dragOperation:r}=this.manager,{source:i,shape:a,status:o}=r;if(!o.initialized||!a)return bA;let s=[],c=[];for(let a of e??n.droppables){if(a.disabled||i&&!a.accepts(i))continue;let e=t??a.collisionDetector;if(!e)continue;c.push(a),a.shape;let n=DD(()=>e({droppable:a,dragOperation:r}));n&&(a.collisionPriority!=null&&(n.priority=a.collisionPriority),s.push(n))}return c.length===0?bA:(s.sort(yA),s)}get collisions(){return iA(this,SA).value}};xA=new WeakMap,SA=new WeakMap;var wA,TA,EA=[CO],DA,OA,kA,AA,jA,MA,NA;TA=[CO],wA=[CO];var PA=class e{constructor(e,t){aA(this,AA,eA(kA,8,this)),eA(kA,11,this),aA(this,jA),aA(this,MA,eA(kA,12,this)),eA(kA,15,this),aA(this,NA,eA(kA,16,this)),eA(kA,19,this);let{effects:n,id:r,data:i={},disabled:a=!1,register:o=!0}=e,s=r;oA(this,jA,LD(r)),this.manager=t,this.data=i,this.disabled=a,this.effects=()=>[()=>{let{id:e,manager:t}=this;if(e!==s)return s=e,t?.registry.register(this),()=>t?.registry.unregister(this)},...n?.()??[]],this.register=this.register.bind(this),this.unregister=this.unregister.bind(this),this.destroy=this.destroy.bind(this),t&&o&&queueMicrotask(this.register)}get id(){let t=iA(this,jA).value;return e.pendingIdChanges?.get(this)??t}set id(t){t!==(e.pendingIdChanges?.get(this)??iA(this,jA).peek())&&(e.pendingIdChanges||(e.pendingIdChanges=new Map,queueMicrotask(()=>{var t;return sA(t=e,DA,OA).call(t)})),e.pendingIdChanges.set(this,t))}register(){return this.manager?.registry.register(this)}unregister(){var e;(e=this.manager)==null||e.registry.unregister(this)}destroy(){var e;(e=this.manager)==null||e.registry.unregister(this)}};kA=Yk(null),DA=new WeakSet,OA=function(){let e=PA.pendingIdChanges;PA.pendingIdChanges=null,e&&wD(()=>{for(let[t,n]of e)iA(t,jA).value=n})},AA=new WeakMap,jA=new WeakMap,MA=new WeakMap,NA=new WeakMap,tA(kA,4,`manager`,EA,PA,AA),tA(kA,4,`data`,TA,PA,MA),tA(kA,4,`disabled`,wA,PA,NA),aA(PA,DA),$k(kA,PA),PA.pendingIdChanges=null;var FA=PA,IA=class{constructor(){this.map=LD(new Map),this.cleanupFunctions=new WeakMap,this.register=(e,t)=>{let n=this.map.peek(),r=n.get(e),i=()=>this.unregister(e,t);if(r===t)return i;r&&r.id===e&&(this.cleanupFunctions.get(r)?.(),this.cleanupFunctions.delete(r));let a=new Map(n);for(let[r,i]of n)if(i===t&&r!==e){a.delete(r);break}a.set(e,t),this.map.value=a;let o=EO(...t.effects());return this.cleanupFunctions.set(t,o),i},this.unregister=(e,t)=>{let n=this.map.peek();if(n.get(e)!==t)return;this.cleanupFunctions.get(t)?.(),this.cleanupFunctions.delete(t);let r=new Map(n);r.delete(e),this.map.value=r}}[Symbol.iterator](){return this.map.peek().values()}get value(){return this.map.value.values()}has(e){return this.map.value.has(e)}get(e){return this.map.value.get(e)}destroy(){for(let e of this)this.cleanupFunctions.get(e)?.(),e.destroy();this.map.value=new Map}},LA,RA,zA,BA,VA,HA,UA,WA,GA,KA,qA,JA=class extends (UA=FA,HA=[CO],VA=[CO],BA=[CO],zA=[wO],RA=[wO],LA=[wO],UA){constructor(e,t){var n=e,{modifiers:r,type:i,sensors:a,plugins:o,effects:s}=n,c=Jk(n,[`modifiers`,`type`,`sensors`,`plugins`,`effects`]);super(Kk(Gk({},c),{effects:()=>[...s?.()??[],()=>{let{manager:e,plugins:t}=this;if(e&&t)for(let n of t){let{plugin:t}=uA(n);e.registry.plugins.register(t)}}]}),t),eA(WA,5,this),aA(this,GA,eA(WA,8,this)),eA(WA,11,this),aA(this,KA,eA(WA,12,this)),eA(WA,15,this),aA(this,qA,eA(WA,16,this,this.isDragSource?`dragging`:`idle`)),eA(WA,19,this),this.type=i,this.sensors=a,this.modifiers=r,this.alignment=c.alignment,this.plugins=o}pluginConfig(e){if(this.plugins)for(let t of this.plugins){let n=uA(t);if(n.plugin===e)return n.options}}get isDropping(){return this.status===`dropping`&&this.isDragSource}get isDragging(){return this.status===`dragging`&&this.isDragSource}get isDragSource(){return this.manager?.dragOperation.source?.id===this.id}};WA=Yk(UA),GA=new WeakMap,KA=new WeakMap,qA=new WeakMap,tA(WA,4,`type`,HA,JA,GA),tA(WA,4,`modifiers`,VA,JA,KA),tA(WA,4,`status`,BA,JA,qA),tA(WA,2,`isDropping`,zA,JA),tA(WA,2,`isDragging`,RA,JA),tA(WA,2,`isDragSource`,LA,JA),$k(WA,JA);var YA,XA,ZA,QA,$A,ej,tj,nj,rj,ij,aj,oj,sj,cj=class extends (tj=FA,ej=[CO],$A=[CO],QA=[CO],ZA=[CO],XA=[CO],YA=[wO],tj){constructor(e,t){var n=e,{accept:r,collisionDetector:i,collisionPriority:a,type:o}=n,s=Jk(n,[`accept`,`collisionDetector`,`collisionPriority`,`type`]);super(s,t),eA(nj,5,this),aA(this,rj,eA(nj,8,this)),eA(nj,11,this),aA(this,ij,eA(nj,12,this)),eA(nj,15,this),aA(this,aj,eA(nj,16,this)),eA(nj,19,this),aA(this,oj,eA(nj,20,this)),eA(nj,23,this),aA(this,sj,eA(nj,24,this)),eA(nj,27,this),this.accept=r,this.collisionDetector=i,this.collisionPriority=a,this.type=o}accepts(e){let{accept:t}=this;return t?typeof t==`function`?t(e):e.type?Array.isArray(t)?t.includes(e.type):e.type===t:!1:!0}get isDropTarget(){return this.manager?.dragOperation.target?.id===this.id}};nj=Yk(tj),rj=new WeakMap,ij=new WeakMap,aj=new WeakMap,oj=new WeakMap,sj=new WeakMap,tA(nj,4,`accept`,ej,cj,rj),tA(nj,4,`type`,$A,cj,ij),tA(nj,4,`collisionDetector`,QA,cj,aj),tA(nj,4,`collisionPriority`,ZA,cj,oj),tA(nj,4,`shape`,XA,cj,sj),tA(nj,2,`isDropTarget`,YA,cj),$k(nj,cj);var lj=class{constructor(){this.registry=new Map}addEventListener(e,t){let{registry:n}=this,r=new Set(n.get(e));return r.add(t),n.set(e,r),()=>this.removeEventListener(e,t)}removeEventListener(e,t){let{registry:n}=this,r=new Set(n.get(e));r.delete(t),n.set(e,r)}dispatch(e,...t){let{registry:n}=this,r=n.get(e);if(r)for(let e of r)e(...t)}},uj=class extends lj{constructor(e){super(),this.manager=e}dispatch(e,t){let n=[t,this.manager];super.dispatch(e,...n)}};function dj(e,t=!0){let n=!1;return Kk(Gk({},e),{cancelable:t,get defaultPrevented(){return n},preventDefault(){t&&(n=!0)}})}var fj=class extends gA{constructor(e){super(e);let t=(e,t)=>e.map(({id:e})=>e).join(``)===t.map(({id:e})=>e).join(``),n=[];this.destroy=EO(()=>{let{dragOperation:t,collisionObserver:r}=e;t.status.initializing&&(n=[],r.enable())},()=>{let{collisionObserver:r,monitor:i}=e,{collisions:a}=r;if(r.isDisabled()||FA.pendingIdChanges)return;let o=dj({collisions:a});if(i.dispatch(`collision`,o),o.defaultPrevented||t(a,n))return;n=a;let[s]=a;DD(()=>{s?.id!==e.dragOperation.target?.id&&(r.disable(),e.actions.setDropTarget(s?.id).then(()=>{r.enable()}))})})}},pj=(e=>(e[e.Lowest=0]=`Lowest`,e[e.Low=1]=`Low`,e[e.Normal=2]=`Normal`,e[e.High=3]=`High`,e[e.Highest=4]=`Highest`,e))(pj||{}),mj=(e=>(e[e.Collision=0]=`Collision`,e[e.ShapeIntersection=1]=`ShapeIntersection`,e[e.PointerIntersection=2]=`PointerIntersection`,e))(mj||{}),hj,gj,_j,vj,yj,bj,xj=[CO],Sj,Cj;bj=[wO],yj=[wO],vj=[wO],_j=[wO],gj=[wO],hj=[wO];var wj=class{constructor(){eA(Sj,5,this),aA(this,Cj,eA(Sj,8,this,`idle`)),eA(Sj,11,this)}get current(){return this.value}get idle(){return this.value===`idle`}get initializing(){return this.value===`initializing`}get initialized(){let{value:e}=this;return e!==`idle`&&e!==`initialization-pending`}get dragging(){return this.value===`dragging`}get dropped(){return this.value===`dropped`}set(e){this.value=e}};Sj=Yk(null),Cj=new WeakMap,tA(Sj,4,`value`,xj,wj,Cj),tA(Sj,2,`current`,bj,wj),tA(Sj,2,`idle`,yj,wj),tA(Sj,2,`initializing`,vj,wj),tA(Sj,2,`initialized`,_j,wj),tA(Sj,2,`dragging`,gj,wj),tA(Sj,2,`dropped`,hj,wj),$k(Sj,wj);var Tj=class{constructor(e){this.manager=e}setDragSource(e){let{dragOperation:t}=this.manager;t.sourceIdentifier=typeof e==`string`||typeof e==`number`?e:e.id}setDropTarget(e){return DD(()=>{let{dragOperation:t}=this.manager,n=e??null;if(t.targetIdentifier===n)return Promise.resolve(!1);t.targetIdentifier=n;let r=dj({operation:t.snapshot()});return t.status.dragging&&this.manager.monitor.dispatch(`dragover`,r),this.manager.renderer.rendering.then(()=>r.defaultPrevented)})}start(e){return DD(()=>{let{dragOperation:t}=this.manager;if(e.source!=null&&this.setDragSource(e.source),!t.source)throw Error(`Cannot start a drag operation without a drag source`);if(!t.status.idle)throw Error(`Cannot start a drag operation while another is active`);let n=new AbortController,{event:r,coordinates:i}=e;wD(()=>{t.status.set(`initialization-pending`),t.shape=null,t.canceled=!1,t.activatorEvent=r??null,t.position.reset(i)});let a=dj({operation:t.snapshot()});return this.manager.monitor.dispatch(`beforedragstart`,a),a.defaultPrevented?(t.reset(),n.abort(),n):(t.status.set(`initializing`),t.controller=n,this.manager.renderer.rendering.then(()=>{if(n.signal.aborted)return;let{status:e}=t;e.current===`initializing`&&wD(()=>{t.status.set(`dragging`),this.manager.monitor.dispatch(`dragstart`,{nativeEvent:r,operation:t.snapshot(),cancelable:!1})})}),n)})}move(e){return DD(()=>{let{dragOperation:t}=this.manager,{status:n,controller:r}=t;if(!n.dragging||!r||r.signal.aborted)return;let i=dj({nativeEvent:e.event,operation:t.snapshot(),by:e.by,to:e.to},e.cancelable??!0);(e.propagate??!0)&&this.manager.monitor.dispatch(`dragmove`,i),queueMicrotask(()=>{if(i.defaultPrevented)return;let n=e.to??{x:t.position.current.x+(e.by?.x??0),y:t.position.current.y+(e.by?.y??0)};t.position.current=n})})}stop(e={}){return DD(()=>{let{dragOperation:t}=this.manager,{controller:n}=t;if(!n||n.signal.aborted)return;let r,i=()=>{let e={resume:()=>{},abort:()=>{}};return r=new Promise((t,n)=>{e.resume=t,e.abort=n}),e};n.abort();let a=()=>{this.manager.renderer.rendering.then(()=>{t.status.set(`dropped`);let e=DD(()=>t.source?.status===`dropping`),r=()=>{t.controller===n&&(t.controller=void 0),t.reset()};if(e){let{source:e}=t,n=qD(()=>{e?.status===`idle`&&(n(),r())})}else this.manager.renderer.rendering.then(r)})};t.canceled=e.canceled??!1,this.manager.monitor.dispatch(`dragend`,{nativeEvent:e.event,operation:t.snapshot(),canceled:e.canceled??!1,suspend:i}),r?r.then(a).catch(()=>t.reset()):a()})}},Ej=class extends hA{constructor(e,t){super(e,t),this.manager=e,this.options=t}},Dj=class extends AbortController{constructor(e,t){super(),this.constraints=e,this.onActivate=t,this.activated=!1;for(let t of e??[])t.controller=this}onEvent(e){if(!this.activated){if(this.constraints?.length)for(let t of this.constraints)t.onEvent(e);else this.activate(e)}}activate(e){this.activated||(this.activated=!0,this.onActivate(e))}abort(e){this.activated=!1,super.abort(e)}},Oj,kj=class{constructor(e){this.options=e,aA(this,Oj)}set controller(e){oA(this,Oj,e),e.signal.addEventListener(`abort`,()=>this.abort())}activate(e){var t;(t=iA(this,Oj))==null||t.activate(e)}};Oj=new WeakMap;var Aj=class extends hA{constructor(e,t){super(e,t),this.manager=e,this.options=t}apply(e){return e.transform}},jj=class{constructor(e){this.draggables=new IA,this.droppables=new IA,this.plugins=new vA(e),this.sensors=new vA(e),this.modifiers=new vA(e)}register(e,t){if(e instanceof JA)return this.draggables.register(e.id,e);if(e instanceof cj)return this.droppables.register(e.id,e);if(e.prototype instanceof Aj)return this.modifiers.register(e,t);if(e.prototype instanceof Ej)return this.sensors.register(e,t);if(e.prototype instanceof hA)return this.plugins.register(e,t);throw Error(`Invalid instance type`)}unregister(e){if(e instanceof FA)return e instanceof JA?this.draggables.unregister(e.id,e):e instanceof cj?this.droppables.unregister(e.id,e):()=>{};if(e.prototype instanceof Aj)return this.modifiers.unregister(e);if(e.prototype instanceof Ej)return this.sensors.unregister(e);if(e.prototype instanceof hA)return this.plugins.unregister(e);throw Error(`Invalid instance type`)}destroy(){this.draggables.destroy(),this.droppables.destroy(),this.plugins.destroy(),this.sensors.destroy(),this.modifiers.destroy()}},Mj,Nj,Pj,Fj,Ij,Lj,Rj,zj,Bj=[wO],Vj,Hj,Uj,Wj,Gj,Kj,qj,Jj,Yj,Xj;zj=[CO],Rj=[CO],Lj=[CO],Ij=[CO],Fj=[CO],Pj=[wO],Nj=[wO],Mj=[wO];var Zj=class{constructor(e){eA(Wj,5,this),aA(this,Vj),aA(this,Hj),aA(this,Uj,new qO(void 0,(e,t)=>e&&t?e.equals(t):e===t)),this.status=new wj,aA(this,Gj,eA(Wj,8,this,!1)),eA(Wj,11,this),aA(this,Kj,eA(Wj,12,this,null)),eA(Wj,15,this),aA(this,qj,eA(Wj,16,this,null)),eA(Wj,19,this),aA(this,Jj,eA(Wj,20,this,null)),eA(Wj,23,this),aA(this,Yj,eA(Wj,24,this,[])),eA(Wj,27,this),this.position=new Ak({x:0,y:0}),aA(this,Xj,{x:0,y:0}),oA(this,Vj,e)}get shape(){let{current:e,initial:t,previous:n}=iA(this,Uj);return!e||!t?null:{current:e,initial:t,previous:n}}set shape(e){e?iA(this,Uj).current=e:iA(this,Uj).reset()}get source(){let e=this.sourceIdentifier;if(e==null)return null;let t=iA(this,Vj).registry.draggables.get(e);return t&&oA(this,Hj,t),t??iA(this,Hj)??null}get target(){let e=this.targetIdentifier;return e==null?null:iA(this,Vj).registry.droppables.get(e)??null}get transform(){let{x:e,y:t}=this.position.delta,n={x:e,y:t};for(let e of this.modifiers)n=e.apply(Kk(Gk({},this.snapshot()),{transform:n}));return oA(this,Xj,n),n}snapshot(){return DD(()=>({source:this.source,target:this.target,activatorEvent:this.activatorEvent,transform:iA(this,Xj),shape:this.shape?JO(this.shape):null,position:JO(this.position),status:JO(this.status),canceled:this.canceled}))}reset(){wD(()=>{this.status.set(`idle`),this.sourceIdentifier=null,this.targetIdentifier=null,iA(this,Uj).reset(),this.position.reset({x:0,y:0}),oA(this,Xj,{x:0,y:0}),this.modifiers=[]})}};Wj=Yk(null),Vj=new WeakMap,Hj=new WeakMap,Uj=new WeakMap,Gj=new WeakMap,Kj=new WeakMap,qj=new WeakMap,Jj=new WeakMap,Yj=new WeakMap,Xj=new WeakMap,tA(Wj,2,`shape`,Bj,Zj),tA(Wj,4,`canceled`,zj,Zj,Gj),tA(Wj,4,`activatorEvent`,Rj,Zj,Kj),tA(Wj,4,`sourceIdentifier`,Lj,Zj,qj),tA(Wj,4,`targetIdentifier`,Ij,Zj,Jj),tA(Wj,4,`modifiers`,Fj,Zj,Yj),tA(Wj,2,`source`,Pj,Zj),tA(Wj,2,`target`,Nj,Zj),tA(Wj,2,`transform`,Mj,Zj),$k(Wj,Zj);var Qj={get rendering(){return Promise.resolve()}};function $j(e,t){return typeof e==`function`?e(t):e??t}var eM=class{constructor(e){this.destroy=()=>{this.dragOperation.status.idle||this.actions.stop({canceled:!0}),this.dragOperation.modifiers.forEach(e=>e.destroy()),this.registry.destroy(),this.collisionObserver.destroy()};let t=e??{},n=$j(t.plugins,[]),r=$j(t.sensors,[]),i=$j(t.modifiers,[]),a=t.renderer??Qj,o=new uj(this),s=new jj(this);this.registry=s,this.monitor=o,this.renderer=a,this.actions=new Tj(this),this.dragOperation=new Zj(this),this.collisionObserver=new CA(this),this.plugins=[fj,...n],this.modifiers=i,this.sensors=r;let{destroy:c}=this,l=EO(()=>{let e=DD(()=>this.dragOperation.modifiers),t=this.modifiers;for(let n of e)t.includes(n)||n.destroy();this.dragOperation.modifiers=(this.dragOperation.source?.modifiers)?.map(e=>{let{plugin:t,options:n}=uA(e);return new t(this,n)})??t});this.destroy=()=>{l(),c()}}get plugins(){return this.registry.plugins.values}set plugins(e){this.registry.plugins.values=e}get modifiers(){return this.registry.modifiers.values}set modifiers(e){this.registry.modifiers.values=e}get sensors(){return this.registry.sensors.values}set sensors(e){this.registry.sensors.values=e}},tM=e=>{throw TypeError(e)},nM=(e,t,n)=>t.has(e)||tM(`Cannot `+n),rM=(e,t,n)=>(nM(e,t,`read from private field`),t.get(e)),iM=(e,t,n)=>t.has(e)?tM(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),aM=(e,t,n,r)=>(nM(e,t,`write to private field`),t.set(e,n),n),oM=(e,t,n)=>(nM(e,t,`access private method`),n);function sM(e){return e?e instanceof KeyframeEffect||`getKeyframes`in e&&typeof e.getKeyframes==`function`:!1}function cM(e,t){let n=e.getAnimations(),r=null;for(let e of n){if(e.playState!==`running`)continue;let{effect:n}=e,i=(sM(n)?n.getKeyframes():[]).filter(t);i.length>0&&(r=[i[i.length-1],e])}return r}function lM(e){let{width:t,height:n,top:r,left:i,bottom:a,right:o}=e.getBoundingClientRect();return{width:t,height:n,top:r,left:i,bottom:a,right:o}}function uM(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function dM(e){return`nodeType`in e}function fM(e){return e?uM(e)?e:dM(e)?`defaultView`in e?e.defaultView??window:e.ownerDocument?.defaultView??window:window:window}function pM(e){let{Document:t}=fM(e);return e instanceof t||`nodeType`in e&&e.nodeType===Node.DOCUMENT_NODE}function mM(e){return!e||uM(e)?!1:e instanceof fM(e).HTMLElement||`namespaceURI`in e&&typeof e.namespaceURI==`string`&&e.namespaceURI.endsWith(`html`)}function hM(e){return e instanceof fM(e).SVGElement||`namespaceURI`in e&&typeof e.namespaceURI==`string`&&e.namespaceURI.endsWith(`svg`)}function gM(e){return e?uM(e)?e.document:dM(e)?pM(e)?e:mM(e)||hM(e)?e.ownerDocument:document:document:document}function _M(e){let{documentElement:t}=gM(e),n=fM(e).visualViewport,r=n?.width??t.clientWidth,i=n?.height??t.clientHeight,a=n?.offsetTop??0,o=n?.offsetLeft??0;return{top:a,left:o,right:o+r,bottom:a+i,width:r,height:i}}function vM(e,t){if(yM(e)&&e.open===!1)return!1;let{overflow:n,overflowX:r,overflowY:i}=getComputedStyle(e);return n===`visible`&&r===`visible`&&i===`visible`}function yM(e){return e.tagName===`DETAILS`}function bM(e,t=e.getBoundingClientRect(),n=0){let r=t,{ownerDocument:i}=e,a=i.defaultView??window,o=e.parentElement;for(;o&&o!==i.documentElement;){if(!vM(o)){let e=o.getBoundingClientRect(),t=n*(e.bottom-e.top),i=n*(e.right-e.left),a=n*(e.bottom-e.top),s=n*(e.right-e.left);r={top:Math.max(r.top,e.top-t),right:Math.min(r.right,e.right+i),bottom:Math.min(r.bottom,e.bottom+a),left:Math.max(r.left,e.left-s),width:0,height:0},r.width=r.right-r.left,r.height=r.bottom-r.top}o=o.parentElement}let s=a.visualViewport,c=s?.offsetTop??0,l=s?.offsetLeft??0,u=s?.width??a.innerWidth,d=s?.height??a.innerHeight,f=n*d,p=n*u;return r={top:Math.max(r.top,c-f),right:Math.min(r.right,l+u+p),bottom:Math.min(r.bottom,c+d+f),left:Math.max(r.left,l-p),width:0,height:0},r.width=r.right-r.left,r.height=r.bottom-r.top,r.width<0&&(r.width=0),r.height<0&&(r.height=0),r}function xM(e){return{x:e.clientX,y:e.clientY}}var SM=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function CM(e=document,t=new Set){if(t.has(e))return[];t.add(e);let n=[e];for(let r of Array.from(e.querySelectorAll(`iframe, frame`)))try{let e=r.contentDocument;e&&!t.has(e)&&n.push(...CM(e,t))}catch{}try{let r=e.defaultView;if(r&&r!==window.top){let i=r.parent;i&&i.document&&i.document!==e&&n.push(...CM(i.document,t))}}catch{}return n}function wM(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function TM(){let e=wM()?window.visualViewport:null;return{x:e?.offsetLeft??0,y:e?.offsetTop??0}}function EM(e){return!e||!dM(e)?!1:e instanceof fM(e).ShadowRoot}function DM(e){if(e&&dM(e)){let t=e.getRootNode();if(EM(t)||t instanceof Document)return t}return gM(e)}function OM(e){return e.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function kM(e){let t=`input, textarea, select, canvas, [contenteditable]`,n=e.cloneNode(!0),r=Array.from(e.querySelectorAll(t));return Array.from(n.querySelectorAll(t)).forEach((e,t)=>{let n=r[t];AM(e)&&AM(n)&&(e.type!==`file`&&(e.value=n.value),e.type===`radio`&&e.name&&(e.name=`Cloned__${e.name}`)),jM(e)&&jM(n)&&n.width>0&&n.height>0&&e.getContext(`2d`)?.drawImage(n,0,0)}),n}function AM(e){return`value`in e}function jM(e){return e.tagName===`CANVAS`}function MM(e,{x:t,y:n}){let r=e.elementFromPoint(t,n);if(NM(r)){let{contentDocument:e}=r;if(e){let{left:i,top:a}=r.getBoundingClientRect();return MM(e,{x:t-i,y:n-a})}}return r}function NM(e){return e?.tagName===`IFRAME`}var PM=new WeakMap;function FM(e){return e.closest(`
|
|
96
96
|
input:not([disabled]),
|
|
97
97
|
select:not([disabled]),
|
|
98
98
|
textarea:not([disabled]),
|
|
99
99
|
button:not([disabled]),
|
|
100
100
|
a[href],
|
|
101
101
|
[contenteditable]:not([contenteditable="false"])
|
|
102
|
-
`)}var zM=class{constructor(){this.entries=new Set,this.clear=()=>{for(let e of this.entries){let[t,{type:n,listener:r,options:i}]=e;t.removeEventListener(n,r,i)}this.entries.clear()}}bind(e,t){let n=Array.isArray(e)?e:[e],r=Array.isArray(t)?t:[t],i=[];for(let e of n)for(let t of r){let{type:n,listener:r,options:a}=t,o=[e,t];e.addEventListener(n,r,a),this.entries.add(o),i.push(o)}let a=this.entries;return function(){for(let e of i){let[t,{type:n,listener:r,options:i}]=e;t.removeEventListener(n,r,i),a.delete(e)}}}};function BM(e){let t=e?.ownerDocument.defaultView;if(t&&t.self!==t.parent)return t.frameElement}function VM(e){let t=new Set,n=BM(e);for(;n;)t.add(n),n=BM(n);return t}function HM(e,t){let n=setTimeout(e,t);return()=>clearTimeout(n)}function UM(e,t){let n=()=>performance.now(),r,i;return function(...a){let o=this;i?(r?.(),r=HM(()=>{e.apply(o,a),i=n()},t-(n()-i))):(e.apply(o,a),i=n())}}function WM(e,t){return e===t?!0:!e||!t?!1:e.top==t.top&&e.left==t.left&&e.right==t.right&&e.bottom==t.bottom}function GM(e,t=e.getBoundingClientRect()){let{width:n,height:r}=CM(e,t);return n>0&&r>0}var KM=TM?ResizeObserver:class{observe(){}unobserve(){}disconnect(){}},qM,JM=class extends KM{constructor(e){super(t=>{if(!oM(this,qM)){cM(this,qM,!0);return}e(t,this)}),sM(this,qM,!1)}};qM=new WeakMap;var YM=Array.from({length:100},(e,t)=>t/100),XM=75,ZM,QM,$M,eN,tN,nN,rN,iN,aN,oN,sN,cN=class{constructor(e,t,n={debug:!1,skipInitial:!1}){this.element=e,this.callback=t,sM(this,aN),this.disconnect=()=>{var e,t,n;cM(this,rN,!0),(e=oM(this,$M))==null||e.disconnect(),(t=oM(this,eN))==null||t.disconnect(),oM(this,tN).disconnect(),(n=oM(this,nN))==null||n.remove()},sM(this,ZM,!0),sM(this,QM),sM(this,$M),sM(this,eN),sM(this,tN),sM(this,nN),sM(this,rN,!1),sM(this,iN,UM(()=>{var e;let{element:t}=this;if((e=oM(this,eN))==null||e.disconnect(),oM(this,rN)||!oM(this,ZM)||!t.isConnected)return;let n=t.ownerDocument??document,{innerHeight:r,innerWidth:i}=n.defaultView??window,a=t.getBoundingClientRect(),{top:o,left:s,bottom:c,right:l}=CM(t,a),u=-Math.floor(o),d=-Math.floor(s),f=`${u}px ${-Math.floor(i-l)}px ${-Math.floor(r-c)}px ${d}px`;this.boundingClientRect=a,cM(this,eN,new IntersectionObserver(e=>{let[n]=e,{intersectionRect:r}=n;(n.intersectionRatio===1?Ek.intersectionRatio(r,CM(t)):n.intersectionRatio)!==1&&oM(this,iN).call(this)},{threshold:YM,rootMargin:f,root:n})),oM(this,eN).observe(t),lM(this,aN,oN).call(this)},XM)),this.boundingClientRect=e.getBoundingClientRect(),cM(this,ZM,GM(e,this.boundingClientRect));let r=!0;this.callback=e=>{r&&(r=!1,n.skipInitial)||t(e)};let i=e.ownerDocument;n?.debug&&(cM(this,nN,document.createElement(`div`)),oM(this,nN).style.background=`rgba(0,0,0,0.15)`,oM(this,nN).style.position=`fixed`,oM(this,nN).style.pointerEvents=`none`,i.body.appendChild(oM(this,nN))),cM(this,tN,new IntersectionObserver(t=>{var n,r;let{boundingClientRect:i,isIntersecting:a}=t[t.length-1],{width:o,height:s}=i,c=oM(this,ZM);cM(this,ZM,a),(o||s)&&(c&&!a?((n=oM(this,eN))==null||n.disconnect(),this.callback(null),(r=oM(this,$M))==null||r.disconnect(),cM(this,$M,void 0),oM(this,nN)&&(oM(this,nN).style.visibility=`hidden`)):oM(this,iN).call(this),a&&!oM(this,$M)&&(cM(this,$M,new JM(oM(this,iN))),oM(this,$M).observe(e)))},{threshold:YM,root:i})),oM(this,ZM)&&!n.skipInitial&&this.callback(this.boundingClientRect),oM(this,tN).observe(e)}};ZM=new WeakMap,QM=new WeakMap,$M=new WeakMap,eN=new WeakMap,tN=new WeakMap,nN=new WeakMap,rN=new WeakMap,iN=new WeakMap,aN=new WeakSet,oN=function(){oM(this,rN)||(lM(this,aN,sN).call(this),!WM(this.boundingClientRect,oM(this,QM))&&(this.callback(this.boundingClientRect),cM(this,QM,this.boundingClientRect)))},sN=function(){if(oM(this,nN)){let{top:e,left:t,width:n,height:r}=CM(this.element);oM(this,nN).style.overflow=`hidden`,oM(this,nN).style.visibility=`visible`,oM(this,nN).style.top=`${Math.floor(e)}px`,oM(this,nN).style.left=`${Math.floor(t)}px`,oM(this,nN).style.width=`${Math.floor(n)}px`,oM(this,nN).style.height=`${Math.floor(r)}px`}};var lN=new WeakMap,uN=new WeakMap;function dN(e,t){let n=lN.get(e);return n||={disconnect:new cN(e,t=>{let n=lN.get(e);n&&n.callbacks.forEach(e=>e(t))},{skipInitial:!0}).disconnect,callbacks:new Set},n.callbacks.add(t),lN.set(e,n),()=>{n.callbacks.delete(t),n.callbacks.size===0&&(lN.delete(e),n.disconnect())}}function fN(e,t){let n=new Set;for(let r of e){let e=dN(r,t);n.add(e)}return()=>n.forEach(e=>e())}function pN(e,t){let n=e.ownerDocument;if(!uN.has(n)){let e=new AbortController,t=new Set;document.addEventListener(`scroll`,e=>t.forEach(t=>t(e)),{capture:!0,passive:!0,signal:e.signal}),uN.set(n,{disconnect:()=>e.abort(),listeners:t})}let{listeners:r,disconnect:i}=uN.get(n)??{};return!r||!i?()=>{}:(r.add(t),()=>{r.delete(t),r.size===0&&(i(),uN.delete(n))})}var mN,hN,gN,_N,vN=class{constructor(e,t,n){this.callback=t,sM(this,mN),sM(this,hN,!1),sM(this,gN),sM(this,_N,UM(e=>{if(!oM(this,hN)&&e.target&&`contains`in e.target&&typeof e.target.contains==`function`){for(let t of oM(this,gN))if(e.target.contains(t)){this.callback(oM(this,mN).boundingClientRect);break}}},XM));let r=VM(e),i=fN(r,t),a=pN(e,oM(this,_N));cM(this,gN,r),cM(this,mN,new cN(e,t,n)),this.disconnect=()=>{oM(this,hN)||(cM(this,hN,!0),i(),a(),oM(this,mN).disconnect())}}};mN=new WeakMap,hN=new WeakMap,gN=new WeakMap,_N=new WeakMap;function yN(e){return`showPopover`in e&&`hidePopover`in e&&typeof e.showPopover==`function`&&typeof e.hidePopover==`function`}function bN(e){try{yN(e)&&e.isConnected&&e.hasAttribute(`popover`)&&!e.matches(`:popover-open`)&&e.showPopover()}catch{}}function xN(e){return!TM||!e?!1:e===yM(e).scrollingElement}function SN(e){let t=hM(e),n=xN(e)?bM(e):fM(e),r=t.visualViewport,i=xN(e)?{height:r?.height??t.innerHeight,width:r?.width??t.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={current:{x:e.scrollLeft,y:e.scrollTop},max:{x:e.scrollWidth-i.width,y:e.scrollHeight-i.height}};return{rect:n,position:a,isTop:a.current.y<=0,isLeft:a.current.x<=0,isBottom:a.current.y>=a.max.y,isRight:a.current.x>=a.max.x}}function CN(e,t){let{isTop:n,isBottom:r,isLeft:i,isRight:a,position:o}=SN(e),{x:s,y:c}=t??{x:0,y:0},l=!n&&o.current.y+c>0,u=!r&&o.current.y+c<o.max.y,d=!i&&o.current.x+s>0,f=!a&&o.current.x+s<o.max.x;return{top:l,bottom:u,left:d,right:f,x:d||f,y:l||u}}var wN=class{constructor(e){this.scheduler=e,this.pending=!1,this.tasks=new Set,this.resolvers=new Set,this.flush=()=>{let{tasks:e,resolvers:t}=this;this.pending=!1,this.tasks=new Set,this.resolvers=new Set;for(let t of e)t();for(let e of t)e()}}schedule(e){return this.tasks.add(e),this.pending||(this.pending=!0,this.scheduler(this.flush)),new Promise(e=>this.resolvers.add(e))}},TN=new wN(e=>{typeof requestAnimationFrame==`function`?requestAnimationFrame(e):e()}),EN=new wN(e=>setTimeout(e,50)),DN=new Map,ON=DN.clear.bind(DN);function kN(e,t=!1){if(!t)return AN(e);let n=DN.get(e);return n||(n=AN(e),DN.set(e,n),EN.schedule(ON),n)}function AN(e){return hM(e).getComputedStyle(e)}function jN(e,t=kN(e,!0)){return t.position===`fixed`||t.position===`sticky`}function MN(e,t=kN(e,!0)){let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}var NN={excludeElement:!0,escapeShadowDOM:!0};function PN(e,t=NN){let{limit:n,excludeElement:r,escapeShadowDOM:i}=t,a=new Set;function o(t){if(n!=null&&a.size>=n||!t)return a;if(gM(t)&&t.scrollingElement!=null&&!a.has(t.scrollingElement))return a.add(t.scrollingElement),a;if(i&&kM(t))return o(t.host);if(!_M(t))return vM(t)?o(t.parentElement):a;if(a.has(t))return a;let s=kN(t,!0);if(r&&t===e||MN(t,s)&&a.add(t),jN(t,s)){let{scrollingElement:e}=t.ownerDocument;return e&&a.add(e),a}return o(t.parentNode)}return e?o(e):a}function FN(e,t=window.frameElement){let n={x:0,y:0,scaleX:1,scaleY:1};if(!e)return n;let r=BM(e);for(;r;){if(r===t)return n;let e=fM(r),{x:i,y:a}=IN(r,e);n.x+=e.left,n.y+=e.top,n.scaleX*=i,n.scaleY*=a,r=BM(r)}return n}function IN(e,t=fM(e)){let n=Math.round(t.width),r=Math.round(t.height);if(_M(e))return{x:n/e.offsetWidth,y:r/e.offsetHeight};let i=kN(e,!0);return{x:(parseFloat(i.width)||n)/n,y:(parseFloat(i.height)||r)/r}}function LN(e){if(!e||e===`none`)return null;let t=e.split(` `),n=parseFloat(t[0]),r=parseFloat(t[1]);return isNaN(n)&&isNaN(r)?null:{x:isNaN(n)?r:n,y:isNaN(r)?n:r}}function RN(e){if(!e||e===`none`)return null;let[t,n,r=`0`]=e.split(` `),i={x:parseFloat(t),y:parseFloat(n),z:parseInt(r,10)};return isNaN(i.x)&&isNaN(i.y)?null:{x:isNaN(i.x)?0:i.x,y:isNaN(i.y)?0:i.y,z:isNaN(i.z)?0:i.z}}function zN(e){let{scale:t,transform:n,translate:r}=e,i=LN(t),a=RN(r),o=BN(n);if(!o&&!i&&!a)return null;let s={x:i?.x??1,y:i?.y??1},c={x:a?.x??0,y:a?.y??0},l={x:o?.x??0,y:o?.y??0,scaleX:o?.scaleX??1,scaleY:o?.scaleY??1};return{x:c.x+l.x,y:c.y+l.y,z:a?.z??0,scaleX:s.x*l.scaleX,scaleY:s.y*l.scaleY}}function BN(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}var VN=(e=>(e[e.Idle=0]=`Idle`,e[e.Forward=1]=`Forward`,e[e.Reverse=-1]=`Reverse`,e))(VN||{}),HN={x:.2,y:.2},UN={x:10,y:10};function WN(e,t,n,r=25,i=HN,a=UN){let{x:o,y:s}=t,{rect:c,isTop:l,isBottom:u,isLeft:d,isRight:f}=SN(e),p=FN(e),m=zN(kN(e,!0)),h=m!==null&&m?.scaleX<0,g=m!==null&&m?.scaleY<0,_=new Ek(c.left*p.scaleX+p.x,c.top*p.scaleY+p.y,c.width*p.scaleX,c.height*p.scaleY),v={x:0,y:0},y={x:0,y:0},b={height:_.height*i.y,width:_.width*i.x};return b.height>0&&(!l||g&&!u)&&s<=_.top+b.height&&n?.y!==1&&o>=_.left-a.x&&o<=_.right+a.x?(v.y=g?1:-1,y.y=r*Math.abs((_.top+b.height-s)/b.height)):b.height>0&&(!u||g&&!l)&&s>=_.bottom-b.height&&n?.y!==-1&&o>=_.left-a.x&&o<=_.right+a.x&&(v.y=g?-1:1,y.y=r*Math.abs((_.bottom-b.height-s)/b.height)),b.width>0&&(!f||h&&!d)&&o>=_.right-b.width&&n?.x!==-1&&s>=_.top-a.y&&s<=_.bottom+a.y?(v.x=h?-1:1,y.x=r*Math.abs((_.right-b.width-o)/b.width)):b.width>0&&(!d||h&&!f)&&o<=_.left+b.width&&n?.x!==1&&s>=_.top-a.y&&s<=_.bottom+a.y&&(v.x=h?1:-1,y.x=r*Math.abs((_.left+b.width-o)/b.width)),{direction:v,speed:y}}function GN(e,{block:t=`nearest`,inline:n=`nearest`}={}){if(!_M(e))return;let r=PN(e),i=[];for(let a of r){if(!_M(a))continue;let{top:r,left:o}=qN(e,a),s=r,c=o;for(let e of i)s-=e.scrollTop,c-=e.scrollLeft;if(t!==`none`){let n=s<a.scrollTop;n!==s+e.offsetHeight>a.scrollTop+a.clientHeight&&(a.scrollTop=t===`center`?s-a.clientHeight/2+e.offsetHeight/2:n?s:s+e.offsetHeight-a.clientHeight)}if(n!==`none`){let t=c<a.scrollLeft;t!==c+e.offsetWidth>a.scrollLeft+a.clientWidth&&(a.scrollLeft=n===`center`?c-a.clientWidth/2+e.offsetWidth/2:t?c:c+e.offsetWidth-a.clientWidth)}i.push(a)}}function KN(e){let t=0,n=0,r=e;for(;r;){t+=r.offsetTop,n+=r.offsetLeft;let e=r.offsetParent;if(!_M(e))break;t+=e.clientTop,n+=e.clientLeft,r=e}return{top:t,left:n}}function qN(e,t){let n=KN(e),r=KN(t);return{top:n.top-r.top-t.clientTop,left:n.left-r.left-t.clientLeft}}function JN(e,t,n){let{scaleX:r,scaleY:i,x:a,y:o}=t,s=e.left+a+(1-r)*parseFloat(n),c=e.top+o+(1-i)*parseFloat(n.slice(n.indexOf(` `)+1)),l=r?e.width*r:e.width,u=i?e.height*i:e.height;return{width:l,height:u,top:c,right:s+l,bottom:c+u,left:s}}function YN(e,t,n){let{scaleX:r,scaleY:i,x:a,y:o}=t,s=e.left-a-(1-r)*parseFloat(n),c=e.top-o-(1-i)*parseFloat(n.slice(n.indexOf(` `)+1)),l=r?e.width/r:e.width,u=i?e.height/i:e.height;return{width:l,height:u,top:c,right:s+l,bottom:c+u,left:s}}function XN({element:e,keyframes:t,options:n}){return e.animate(t,n).finished}function ZN(e,t=kN(e).translate,n=!0){if(n){let t=dM(e,e=>`translate`in e);if(t){let{translate:e=``}=t[0];if(typeof e==`string`){let t=RN(e);if(t)return t}}}if(t){let e=RN(t);if(e)return e}return{x:0,y:0,z:0}}var QN=new wN(e=>setTimeout(e,0)),$N=new Map,eP=$N.clear.bind($N);function tP(e){let t=e.ownerDocument,n=$N.get(t);if(n)return n;n=t.getAnimations(),$N.set(t,n),QN.schedule(eP);let r=n.filter(t=>uM(t.effect)&&t.effect.target===e);return $N.set(e,r),n}function nP(e,t){let n=tP(e).filter(e=>{if(uM(e.effect)){let{target:n}=e.effect;if((n&&t.isValidTarget?.call(t,n))??!0)return e.effect.getKeyframes().some(e=>{for(let n of t.properties)if(e[n])return!0})}}).map(e=>{let{effect:t,currentTime:n}=e,r=t?.getComputedTiming().duration;if(!(e.pending||e.playState===`finished`)&&typeof r==`number`&&typeof n==`number`&&n<r)return e.currentTime=r,()=>{e.currentTime=n}});if(n.length>0)return()=>n.forEach(e=>e?.())}var rP=class extends Ek{constructor(e,t={}){let{frameTransform:n=FN(e),ignoreTransforms:r,getBoundingClientRect:i=fM}=t,a=nP(e,{properties:[`transform`,`translate`,`scale`,`width`,`height`],isValidTarget:t=>(t!==e||DM())&&t.contains(e)}),o=i(e),{top:s,left:c,width:l,height:u}=o,d,f=kN(e),p=zN(f),m={x:p?.scaleX??1,y:p?.scaleY??1},h=iP(e,f);a?.(),p&&(d=YN(o,p,f.transformOrigin),(r||h)&&(s=d.top,c=d.left,l=d.width,u=d.height));let g={width:d?.width??l,height:d?.height??u};if(h&&!r&&d){let e=JN(d,h,f.transformOrigin);s=e.top,c=e.left,l=e.width,u=e.height,m.x=h.scaleX,m.y=h.scaleY}n&&(r||(c*=n.scaleX,l*=n.scaleX,s*=n.scaleY,u*=n.scaleY),c+=n.x,s+=n.y),super(c,s,l,u),this.scale=m,this.intrinsicWidth=g.width,this.intrinsicHeight=g.height}};function iP(e,t){let n=e.getAnimations();if(!n.length)return null;let r,i,a,o=!1;for(let e of n){if(e.playState!==`running`)continue;let t=uM(e.effect)?e.effect.getKeyframes():[],n=t[t.length-1];if(!n)continue;let{transform:s,translate:c,scale:l}=n;typeof s==`string`&&s&&(r=s,o=!0),typeof c==`string`&&c&&(i=c,o=!0),typeof l==`string`&&l&&(a=l,o=!0)}return o?zN({transform:r??t.transform,translate:i??t.translate,scale:a??t.scale}):null}function aP(e){return`style`in e&&typeof e.style==`object`&&e.style!==null&&`setProperty`in e.style&&`removeProperty`in e.style&&typeof e.style.setProperty==`function`&&typeof e.style.removeProperty==`function`}var oP=class{constructor(e){this.element=e,this.initial=new Map}set(e,t=``){let{element:n}=this;if(aP(n))for(let[r,i]of Object.entries(e)){let e=`${t}${r}`;this.initial.has(e)||this.initial.set(e,n.style.getPropertyValue(e)),n.style.setProperty(e,typeof i==`string`?i:`${i}px`)}}remove(e,t=``){let{element:n}=this;if(aP(n))for(let r of e){let e=`${t}${r}`;n.style.removeProperty(e)}}reset(){let{element:e}=this;if(aP(e)){for(let[t,n]of this.initial)e.style.setProperty(t,n);e.getAttribute(`style`)===``&&e.removeAttribute(`style`)}}};function sP(e){return e?e instanceof hM(e).Element||mM(e)&&e.nodeType===Node.ELEMENT_NODE:!1}function cP(e){if(!e)return!1;let{KeyboardEvent:t}=hM(e.target);return e instanceof t}function lP(e){if(!e)return!1;let{PointerEvent:t}=hM(e.target);return e instanceof t}function uP(e){if(!sP(e))return!1;let{tagName:t}=e;return t===`INPUT`||t===`TEXTAREA`||dP(e)}function dP(e){return e.hasAttribute(`contenteditable`)&&e.getAttribute(`contenteditable`)!==`false`}var fP={};function pP(e){let t=fP[e]==null?0:fP[e]+1;return fP[e]=t,`${e}-${t}`}var mP=({dragOperation:e,droppable:t})=>{let n=e.position.current;if(!n)return null;let{id:r}=t;return t.shape&&t.shape.containsPoint(n)?{id:r,value:1/Tk.distance(t.shape.center,n),type:_j.PointerIntersection,priority:gj.High}:null},hP=({dragOperation:e,droppable:t})=>{let{shape:n}=e;if(!t.shape||!n?.current)return null;let r=n.current.intersectionArea(t.shape);if(r){let{position:i}=e,a=Tk.distance(t.shape.center,i.current),o=r/(n.current.area+t.shape.area-r)/a;return{id:t.id,value:o,type:_j.ShapeIntersection,priority:gj.Normal}}return null},gP=e=>mP(e)??hP(e),_P=e=>{let{dragOperation:t,droppable:n}=e,{shape:r,position:i}=t;if(!n.shape)return null;let a=r?Ek.from(r.current.boundingRectangle).corners:void 0,o=Ek.from(n.shape.boundingRectangle).corners.reduce((e,t,n)=>e+Tk.distance(Tk.from(t),a?.[n]??i.current),0)/4;return{id:n.id,value:1/o,type:_j.Collision,priority:gj.Normal}},vP=Object.create,yP=Object.defineProperty,bP=Object.defineProperties,xP=Object.getOwnPropertyDescriptor,SP=Object.getOwnPropertyDescriptors,CP=Object.getOwnPropertySymbols,wP=Object.prototype.hasOwnProperty,TP=Object.prototype.propertyIsEnumerable,EP=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),DP=e=>{throw TypeError(e)},OP=(e,t,n)=>t in e?yP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kP=(e,t)=>{for(var n in t||={})wP.call(t,n)&&OP(e,n,t[n]);if(CP)for(var n of CP(t))TP.call(t,n)&&OP(e,n,t[n]);return e},AP=(e,t)=>bP(e,SP(t)),jP=(e,t)=>yP(e,`name`,{value:t,configurable:!0}),MP=(e,t)=>{var n={};for(var r in e)wP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&CP)for(var r of CP(e))t.indexOf(r)<0&&TP.call(e,r)&&(n[r]=e[r]);return n},NP=e=>[,,,vP(e?.[EP(`metadata`)]??null)],PP=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],FP=e=>e!==void 0&&typeof e!=`function`?DP(`Function expected`):e,IP=(e,t,n,r,i)=>({kind:PP[e],name:t,metadata:r,addInitializer:e=>n._?DP(`Already initialized`):i.push(FP(e||null))}),LP=(e,t)=>OP(t,EP(`metadata`),e[3]),RP=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},zP=(e,t,n,r,i,a)=>{var o,s,c,l,u,d=t&7,f=!!(t&8),p=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,h=PP[d+5],g=d>3&&(e[m-1]=[]),_=e[m]||(e[m]=[]),v=d&&(!p&&!f&&(i=i.prototype),d<5&&(d>3||!p)&&xP(d<4?i:{get[n](){return HP(this,a)},set[n](e){return WP(this,a,e)}},n));d?p&&d<4&&jP(a,(d>2?`set `:d>1?`get `:``)+n):jP(i,n);for(var y=r.length-1;y>=0;y--)l=IP(d,n,c={},e[3],_),d&&(l.static=f,l.private=p,u=l.access={has:p?e=>VP(i,e):e=>n in e},d^3&&(u.get=p?e=>(d^1?HP:GP)(e,i,d^4?a:v.get):e=>e[n]),d>2&&(u.set=p?(e,t)=>WP(e,i,t,d^4?a:v.set):(e,t)=>e[n]=t)),s=(0,r[y])(d?d<4?p?a:v[h]:d>4?void 0:{get:v.get,set:v.set}:i,l),c._=1,d^4||s===void 0?FP(s)&&(d>4?g.unshift(s):d?p?a=s:v[h]=s:i=s):typeof s!=`object`||!s?DP(`Object expected`):(FP(o=s.get)&&(v.get=o),FP(o=s.set)&&(v.set=o),FP(o=s.init)&&g.unshift(o));return d||LP(e,i),v&&yP(i,n,v),p?d^4?a:v:i},BP=(e,t,n)=>t.has(e)||DP(`Cannot `+n),VP=(e,t)=>Object(t)===t?e.has(t):DP(`Cannot use the "in" operator on this value`),HP=(e,t,n)=>(BP(e,t,`read from private field`),n?n.call(e):t.get(e)),UP=(e,t,n)=>t.has(e)?DP(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),WP=(e,t,n,r)=>(BP(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),GP=(e,t,n)=>(BP(e,t,`access private method`),n),KP={role:`button`,roleDescription:`draggable`},qP=`dnd-kit-description`,JP=`dnd-kit-announcement`,YP={draggable:`To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item in a given direction. Press space again to drop the item in its new position, or press escape to cancel.`},XP={dragstart({operation:{source:e}}){if(e)return`Picked up draggable item ${e.id}.`},dragover({operation:{source:e,target:t}}){if(e&&e.id!==t?.id)return t?`Draggable item ${e.id} was moved over droppable target ${t.id}.`:`Draggable item ${e.id} is no longer over a droppable target.`},dragend({operation:{source:e,target:t},canceled:n}){if(e)return n?`Dragging was cancelled. Draggable item ${e.id} was dropped.`:t?`Draggable item ${e.id} was dropped over droppable target ${t.id}`:`Draggable item ${e.id} was dropped.`}};function ZP(e){let t=e.tagName.toLowerCase();return[`input`,`select`,`textarea`,`a`,`button`].includes(t)}function QP(e,t){let n=document.createElement(`div`);return n.id=e,n.style.setProperty(`display`,`none`),n.textContent=t,n}function $P(e){let t=document.createElement(`div`);return t.id=e,t.setAttribute(`role`,`status`),t.setAttribute(`aria-live`,`polite`),t.setAttribute(`aria-atomic`,`true`),t.style.setProperty(`position`,`fixed`),t.style.setProperty(`width`,`1px`),t.style.setProperty(`height`,`1px`),t.style.setProperty(`margin`,`-1px`),t.style.setProperty(`border`,`0`),t.style.setProperty(`padding`,`0`),t.style.setProperty(`overflow`,`hidden`),t.style.setProperty(`clip`,`rect(0 0 0 0)`),t.style.setProperty(`clip-path`,`inset(100%)`),t.style.setProperty(`white-space`,`nowrap`),t}var eF=[`dragover`,`dragmove`],tF=class extends vA{constructor(e,t){super(e);let{id:n,idPrefix:{description:r=qP,announcement:i=JP}={},announcements:a=XP,screenReaderInstructions:o=YP,debounce:s=500}=t??{},c=n?`${r}-${n}`:pP(r),l=n?`${i}-${n}`:pP(i),u,d,f,p,m=(e=p)=>{f&&e&&f?.nodeValue!==e&&(f.nodeValue=e)},h=()=>TN.schedule(m),g=nF(h,s),_=Object.entries(a).map(([e,t])=>this.manager.monitor.addEventListener(e,(n,r)=>{let i=f;if(!i)return;let a=t?.(n,r);a&&i.nodeValue!==a&&(p=a,eF.includes(e)?g():(h(),g.cancel()))})),v=()=>{let e=[];u?.isConnected||(u=QP(c,o.draggable),e.push(u)),d?.isConnected||(d=$P(l),f=document.createTextNode(``),d.appendChild(f),e.push(d)),e.length>0&&document.body.append(...e)},y=new Set;function b(){for(let e of y)e()}this.registerEffect(()=>{y.clear();for(let e of this.manager.registry.draggables.value){let t=e.handle??e.element;if(t){(!u||!d)&&y.add(v),(!ZP(t)||DM())&&!t.hasAttribute(`tabindex`)&&y.add(()=>t.setAttribute(`tabindex`,`0`)),!t.hasAttribute(`role`)&&t.tagName.toLowerCase()!==`button`&&y.add(()=>t.setAttribute(`role`,KP.role)),t.hasAttribute(`aria-roledescription`)||y.add(()=>t.setAttribute(`aria-roledescription`,KP.roleDescription)),t.hasAttribute(`aria-describedby`)||y.add(()=>t.setAttribute(`aria-describedby`,c));for(let n of[`aria-pressed`,`aria-grabbed`]){let r=String(e.isDragging);t.getAttribute(n)!==r&&y.add(()=>t.setAttribute(n,r))}let n=String(e.disabled);t.getAttribute(`aria-disabled`)!==n&&y.add(()=>t.setAttribute(`aria-disabled`,n))}}y.size>0&&TN.schedule(b)}),this.destroy=()=>{super.destroy(),u?.remove(),d?.remove(),_.forEach(e=>e())}}};function nF(e,t){let n,r=()=>{clearTimeout(n),n=setTimeout(e,t)};return r.cancel=()=>clearTimeout(n),r}var rF=new Map,iF,aF,oF,sF,cF,lF,uF,dF,fF,pF,mF,hF,gF,_F=class extends (cF=yA,sF=[EO],oF=[DO],aF=[DO],iF=[DO],cF){constructor(e,t){super(e,t),RP(uF,5,this),UP(this,fF),UP(this,lF,new Set),UP(this,dF,RP(uF,8,this,new Set)),RP(uF,11,this),this.registerEffect(GP(this,fF,pF))}register(e){return HP(this,lF).add(e),()=>{HP(this,lF).delete(e)}}addRoot(e){return AD(()=>{let t=new Set(this.additionalRoots);t.add(e),this.additionalRoots=t}),()=>{AD(()=>{let t=new Set(this.additionalRoots);t.delete(e),this.additionalRoots=t})}}get sourceRoot(){let{source:e}=this.manager.dragOperation;return AM(e?.element??null)}get targetRoot(){let{target:e}=this.manager.dragOperation;return AM(e?.element??null)}get roots(){let{status:e}=this.manager.dragOperation;if(e.initializing||e.initialized){let e=[this.sourceRoot,this.targetRoot].filter(e=>e!=null);return new Set([...e,...this.additionalRoots])}return new Set}};uF=NP(cF),lF=new WeakMap,dF=new WeakMap,fF=new WeakSet,pF=function(){let{roots:e}=this,t=[];for(let n of e)for(let e of HP(this,lF))t.push(GP(this,fF,mF).call(this,n,e));return()=>{for(let e of t)e()}},mF=function(e,t){let n=rF.get(e);n||(n=new Map,rF.set(e,n));let r=n.get(t);if(!r){let i=gM(e)?GP(this,fF,hF).call(this,e,n,t):GP(this,fF,gF).call(this,e,n,t);if(!i)return()=>{};r=i,n.set(t,r)}r.refCount++;let i=!1;return()=>{i||(i=!0,r.refCount--,r.refCount===0&&r.cleanup())}},hF=function(e,t,n){let r=e.createElement(`style`),{nonce:i}=this.options??{};i&&r.setAttribute(`nonce`,i),r.textContent=n,e.head.prepend(r);let a=new MutationObserver(t=>{for(let n of t)for(let t of Array.from(n.removedNodes))if(t===r){e.head.prepend(r);return}});return a.observe(e.head,{childList:!0}),{refCount:0,cleanup:()=>{a.disconnect(),r.remove(),t.delete(n),t.size===0&&rF.delete(e)}}},gF=function(e,t,n){`adoptedStyleSheets`in e&&Array.isArray(e.adoptedStyleSheets);let{CSSStyleSheet:r}=e.ownerDocument.defaultView??{};if(!r)return null;let i=new r;return i.replaceSync(n),e.adoptedStyleSheets.push(i),{refCount:0,cleanup:()=>{if(kM(e)&&e.host?.isConnected){let t=e.adoptedStyleSheets.indexOf(i);t!==-1&&e.adoptedStyleSheets.splice(t,1)}t.delete(n),t.size===0&&rF.delete(e)}}},zP(uF,4,`additionalRoots`,sF,_F,dF),zP(uF,2,`sourceRoot`,oF,_F),zP(uF,2,`targetRoot`,aF,_F),zP(uF,2,`roots`,iF,_F),LP(uF,_F),_F.configure=fA(_F);var vF=_F,yF=class extends vA{constructor(e,t){super(e,t),this.manager=e;let{cursor:n=`grabbing`}=t??{},r=e.registry.plugins.get(vF)?.register(`* { cursor: ${n} !important; }`);if(r){let e=this.destroy.bind(this);this.destroy=()=>{r(),e()}}}},bF=`data-dnd-`,xF=`${bF}dropping`,SF=`--dnd-`,CF=`${bF}dragging`,wF=`${bF}placeholder`,TF=[CF,wF,`popover`,`aria-pressed`,`aria-grabbing`],EF=[`view-transition-name`],DF=`
|
|
103
|
-
:is(:root,:host) [${
|
|
102
|
+
`)}var IM=class{constructor(){this.entries=new Set,this.clear=()=>{for(let e of this.entries){let[t,{type:n,listener:r,options:i}]=e;t.removeEventListener(n,r,i)}this.entries.clear()}}bind(e,t){let n=Array.isArray(e)?e:[e],r=Array.isArray(t)?t:[t],i=[];for(let e of n)for(let t of r){let{type:n,listener:r,options:a}=t,o=[e,t];e.addEventListener(n,r,a),this.entries.add(o),i.push(o)}let a=this.entries;return function(){for(let e of i){let[t,{type:n,listener:r,options:i}]=e;t.removeEventListener(n,r,i),a.delete(e)}}}};function LM(e){let t=e?.ownerDocument.defaultView;if(t&&t.self!==t.parent)return t.frameElement}function RM(e){let t=new Set,n=LM(e);for(;n;)t.add(n),n=LM(n);return t}function zM(e,t){let n=setTimeout(e,t);return()=>clearTimeout(n)}function BM(e,t){let n=()=>performance.now(),r,i;return function(...a){let o=this;i?(r?.(),r=zM(()=>{e.apply(o,a),i=n()},t-(n()-i))):(e.apply(o,a),i=n())}}function VM(e,t){return e===t?!0:!e||!t?!1:e.top==t.top&&e.left==t.left&&e.right==t.right&&e.bottom==t.bottom}function HM(e,t=e.getBoundingClientRect()){let{width:n,height:r}=bM(e,t);return n>0&&r>0}var UM=SM?ResizeObserver:class{observe(){}unobserve(){}disconnect(){}},WM,GM=class extends UM{constructor(e){super(t=>{if(!rM(this,WM)){aM(this,WM,!0);return}e(t,this)}),iM(this,WM,!1)}};WM=new WeakMap;var KM=Array.from({length:100},(e,t)=>t/100),qM=75,JM,YM,XM,ZM,QM,$M,eN,tN,nN,rN,iN,aN=class{constructor(e,t,n={debug:!1,skipInitial:!1}){this.element=e,this.callback=t,iM(this,nN),this.disconnect=()=>{var e,t,n;aM(this,eN,!0),(e=rM(this,XM))==null||e.disconnect(),(t=rM(this,ZM))==null||t.disconnect(),rM(this,QM).disconnect(),(n=rM(this,$M))==null||n.remove()},iM(this,JM,!0),iM(this,YM),iM(this,XM),iM(this,ZM),iM(this,QM),iM(this,$M),iM(this,eN,!1),iM(this,tN,BM(()=>{var e;let{element:t}=this;if((e=rM(this,ZM))==null||e.disconnect(),rM(this,eN)||!rM(this,JM)||!t.isConnected)return;let n=t.ownerDocument??document,{innerHeight:r,innerWidth:i}=n.defaultView??window,a=t.getBoundingClientRect(),{top:o,left:s,bottom:c,right:l}=bM(t,a),u=-Math.floor(o),d=-Math.floor(s),f=`${u}px ${-Math.floor(i-l)}px ${-Math.floor(r-c)}px ${d}px`;this.boundingClientRect=a,aM(this,ZM,new IntersectionObserver(e=>{let[n]=e,{intersectionRect:r}=n;(n.intersectionRatio===1?Ck.intersectionRatio(r,bM(t)):n.intersectionRatio)!==1&&rM(this,tN).call(this)},{threshold:KM,rootMargin:f,root:n})),rM(this,ZM).observe(t),oM(this,nN,rN).call(this)},qM)),this.boundingClientRect=e.getBoundingClientRect(),aM(this,JM,HM(e,this.boundingClientRect));let r=!0;this.callback=e=>{r&&(r=!1,n.skipInitial)||t(e)};let i=e.ownerDocument;n?.debug&&(aM(this,$M,document.createElement(`div`)),rM(this,$M).style.background=`rgba(0,0,0,0.15)`,rM(this,$M).style.position=`fixed`,rM(this,$M).style.pointerEvents=`none`,i.body.appendChild(rM(this,$M))),aM(this,QM,new IntersectionObserver(t=>{var n,r;let{boundingClientRect:i,isIntersecting:a}=t[t.length-1],{width:o,height:s}=i,c=rM(this,JM);aM(this,JM,a),(o||s)&&(c&&!a?((n=rM(this,ZM))==null||n.disconnect(),this.callback(null),(r=rM(this,XM))==null||r.disconnect(),aM(this,XM,void 0),rM(this,$M)&&(rM(this,$M).style.visibility=`hidden`)):rM(this,tN).call(this),a&&!rM(this,XM)&&(aM(this,XM,new GM(rM(this,tN))),rM(this,XM).observe(e)))},{threshold:KM,root:i})),rM(this,JM)&&!n.skipInitial&&this.callback(this.boundingClientRect),rM(this,QM).observe(e)}};JM=new WeakMap,YM=new WeakMap,XM=new WeakMap,ZM=new WeakMap,QM=new WeakMap,$M=new WeakMap,eN=new WeakMap,tN=new WeakMap,nN=new WeakSet,rN=function(){rM(this,eN)||(oM(this,nN,iN).call(this),!VM(this.boundingClientRect,rM(this,YM))&&(this.callback(this.boundingClientRect),aM(this,YM,this.boundingClientRect)))},iN=function(){if(rM(this,$M)){let{top:e,left:t,width:n,height:r}=bM(this.element);rM(this,$M).style.overflow=`hidden`,rM(this,$M).style.visibility=`visible`,rM(this,$M).style.top=`${Math.floor(e)}px`,rM(this,$M).style.left=`${Math.floor(t)}px`,rM(this,$M).style.width=`${Math.floor(n)}px`,rM(this,$M).style.height=`${Math.floor(r)}px`}};var oN=new WeakMap,sN=new WeakMap;function cN(e,t){let n=oN.get(e);return n||={disconnect:new aN(e,t=>{let n=oN.get(e);n&&n.callbacks.forEach(e=>e(t))},{skipInitial:!0}).disconnect,callbacks:new Set},n.callbacks.add(t),oN.set(e,n),()=>{n.callbacks.delete(t),n.callbacks.size===0&&(oN.delete(e),n.disconnect())}}function lN(e,t){let n=new Set;for(let r of e){let e=cN(r,t);n.add(e)}return()=>n.forEach(e=>e())}function uN(e,t){let n=e.ownerDocument;if(!sN.has(n)){let e=new AbortController,t=new Set;document.addEventListener(`scroll`,e=>t.forEach(t=>t(e)),{capture:!0,passive:!0,signal:e.signal}),sN.set(n,{disconnect:()=>e.abort(),listeners:t})}let{listeners:r,disconnect:i}=sN.get(n)??{};return!r||!i?()=>{}:(r.add(t),()=>{r.delete(t),r.size===0&&(i(),sN.delete(n))})}var dN,fN,pN,mN,hN=class{constructor(e,t,n){this.callback=t,iM(this,dN),iM(this,fN,!1),iM(this,pN),iM(this,mN,BM(e=>{if(!rM(this,fN)&&e.target&&`contains`in e.target&&typeof e.target.contains==`function`){for(let t of rM(this,pN))if(e.target.contains(t)){this.callback(rM(this,dN).boundingClientRect);break}}},qM));let r=RM(e),i=lN(r,t),a=uN(e,rM(this,mN));aM(this,pN,r),aM(this,dN,new aN(e,t,n)),this.disconnect=()=>{rM(this,fN)||(aM(this,fN,!0),i(),a(),rM(this,dN).disconnect())}}};dN=new WeakMap,fN=new WeakMap,pN=new WeakMap,mN=new WeakMap;function gN(e){return`showPopover`in e&&`hidePopover`in e&&typeof e.showPopover==`function`&&typeof e.hidePopover==`function`}function _N(e){try{gN(e)&&e.isConnected&&e.hasAttribute(`popover`)&&!e.matches(`:popover-open`)&&e.showPopover()}catch{}}function vN(e){return!SM||!e?!1:e===gM(e).scrollingElement}function yN(e){let t=fM(e),n=vN(e)?_M(e):lM(e),r=t.visualViewport,i=vN(e)?{height:r?.height??t.innerHeight,width:r?.width??t.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={current:{x:e.scrollLeft,y:e.scrollTop},max:{x:e.scrollWidth-i.width,y:e.scrollHeight-i.height}};return{rect:n,position:a,isTop:a.current.y<=0,isLeft:a.current.x<=0,isBottom:a.current.y>=a.max.y,isRight:a.current.x>=a.max.x}}function bN(e,t){let{isTop:n,isBottom:r,isLeft:i,isRight:a,position:o}=yN(e),{x:s,y:c}=t??{x:0,y:0},l=!n&&o.current.y+c>0,u=!r&&o.current.y+c<o.max.y,d=!i&&o.current.x+s>0,f=!a&&o.current.x+s<o.max.x;return{top:l,bottom:u,left:d,right:f,x:d||f,y:l||u}}var xN=class{constructor(e){this.scheduler=e,this.pending=!1,this.tasks=new Set,this.resolvers=new Set,this.flush=()=>{let{tasks:e,resolvers:t}=this;this.pending=!1,this.tasks=new Set,this.resolvers=new Set;for(let t of e)t();for(let e of t)e()}}schedule(e){return this.tasks.add(e),this.pending||(this.pending=!0,this.scheduler(this.flush)),new Promise(e=>this.resolvers.add(e))}},SN=new xN(e=>{typeof requestAnimationFrame==`function`?requestAnimationFrame(e):e()}),CN=new xN(e=>setTimeout(e,50)),wN=new Map,TN=wN.clear.bind(wN);function EN(e,t=!1){if(!t)return DN(e);let n=wN.get(e);return n||(n=DN(e),wN.set(e,n),CN.schedule(TN),n)}function DN(e){return fM(e).getComputedStyle(e)}function ON(e,t=EN(e,!0)){return t.position===`fixed`||t.position===`sticky`}function kN(e,t=EN(e,!0)){let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}var AN={excludeElement:!0,escapeShadowDOM:!0};function jN(e,t=AN){let{limit:n,excludeElement:r,escapeShadowDOM:i}=t,a=new Set;function o(t){if(n!=null&&a.size>=n||!t)return a;if(pM(t)&&t.scrollingElement!=null&&!a.has(t.scrollingElement))return a.add(t.scrollingElement),a;if(i&&EM(t))return o(t.host);if(!mM(t))return hM(t)?o(t.parentElement):a;if(a.has(t))return a;let s=EN(t,!0);if(r&&t===e||kN(t,s)&&a.add(t),ON(t,s)){let{scrollingElement:e}=t.ownerDocument;return e&&a.add(e),a}return o(t.parentNode)}return e?o(e):a}function MN(e,t=window.frameElement){let n={x:0,y:0,scaleX:1,scaleY:1};if(!e)return n;let r=LM(e);for(;r;){if(r===t)return n;let e=lM(r),{x:i,y:a}=NN(r,e);n.x+=e.left,n.y+=e.top,n.scaleX*=i,n.scaleY*=a,r=LM(r)}return n}function NN(e,t=lM(e)){let n=Math.round(t.width),r=Math.round(t.height);if(mM(e))return{x:n/e.offsetWidth,y:r/e.offsetHeight};let i=EN(e,!0);return{x:(parseFloat(i.width)||n)/n,y:(parseFloat(i.height)||r)/r}}function PN(e){if(!e||e===`none`)return null;let t=e.split(` `),n=parseFloat(t[0]),r=parseFloat(t[1]);return isNaN(n)&&isNaN(r)?null:{x:isNaN(n)?r:n,y:isNaN(r)?n:r}}function FN(e){if(!e||e===`none`)return null;let[t,n,r=`0`]=e.split(` `),i={x:parseFloat(t),y:parseFloat(n),z:parseInt(r,10)};return isNaN(i.x)&&isNaN(i.y)?null:{x:isNaN(i.x)?0:i.x,y:isNaN(i.y)?0:i.y,z:isNaN(i.z)?0:i.z}}function IN(e){let{scale:t,transform:n,translate:r}=e,i=PN(t),a=FN(r),o=LN(n);if(!o&&!i&&!a)return null;let s={x:i?.x??1,y:i?.y??1},c={x:a?.x??0,y:a?.y??0},l={x:o?.x??0,y:o?.y??0,scaleX:o?.scaleX??1,scaleY:o?.scaleY??1};return{x:c.x+l.x,y:c.y+l.y,z:a?.z??0,scaleX:s.x*l.scaleX,scaleY:s.y*l.scaleY}}function LN(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}var RN=(e=>(e[e.Idle=0]=`Idle`,e[e.Forward=1]=`Forward`,e[e.Reverse=-1]=`Reverse`,e))(RN||{}),zN={x:.2,y:.2},BN={x:10,y:10};function VN(e,t,n,r=25,i=zN,a=BN){let{x:o,y:s}=t,{rect:c,isTop:l,isBottom:u,isLeft:d,isRight:f}=yN(e),p=MN(e),m=IN(EN(e,!0)),h=m!==null&&m?.scaleX<0,g=m!==null&&m?.scaleY<0,_=new Ck(c.left*p.scaleX+p.x,c.top*p.scaleY+p.y,c.width*p.scaleX,c.height*p.scaleY),v={x:0,y:0},y={x:0,y:0},b={height:_.height*i.y,width:_.width*i.x};return b.height>0&&(!l||g&&!u)&&s<=_.top+b.height&&n?.y!==1&&o>=_.left-a.x&&o<=_.right+a.x?(v.y=g?1:-1,y.y=r*Math.abs((_.top+b.height-s)/b.height)):b.height>0&&(!u||g&&!l)&&s>=_.bottom-b.height&&n?.y!==-1&&o>=_.left-a.x&&o<=_.right+a.x&&(v.y=g?-1:1,y.y=r*Math.abs((_.bottom-b.height-s)/b.height)),b.width>0&&(!f||h&&!d)&&o>=_.right-b.width&&n?.x!==-1&&s>=_.top-a.y&&s<=_.bottom+a.y?(v.x=h?-1:1,y.x=r*Math.abs((_.right-b.width-o)/b.width)):b.width>0&&(!d||h&&!f)&&o<=_.left+b.width&&n?.x!==1&&s>=_.top-a.y&&s<=_.bottom+a.y&&(v.x=h?1:-1,y.x=r*Math.abs((_.left+b.width-o)/b.width)),{direction:v,speed:y}}function HN(e,{block:t=`nearest`,inline:n=`nearest`}={}){if(!mM(e))return;let r=jN(e),i=[];for(let a of r){if(!mM(a))continue;let{top:r,left:o}=WN(e,a),s=r,c=o;for(let e of i)s-=e.scrollTop,c-=e.scrollLeft;if(t!==`none`){let n=s<a.scrollTop;n!==s+e.offsetHeight>a.scrollTop+a.clientHeight&&(a.scrollTop=t===`center`?s-a.clientHeight/2+e.offsetHeight/2:n?s:s+e.offsetHeight-a.clientHeight)}if(n!==`none`){let t=c<a.scrollLeft;t!==c+e.offsetWidth>a.scrollLeft+a.clientWidth&&(a.scrollLeft=n===`center`?c-a.clientWidth/2+e.offsetWidth/2:t?c:c+e.offsetWidth-a.clientWidth)}i.push(a)}}function UN(e){let t=0,n=0,r=e;for(;r;){t+=r.offsetTop,n+=r.offsetLeft;let e=r.offsetParent;if(!mM(e))break;t+=e.clientTop,n+=e.clientLeft,r=e}return{top:t,left:n}}function WN(e,t){let n=UN(e),r=UN(t);return{top:n.top-r.top-t.clientTop,left:n.left-r.left-t.clientLeft}}function GN(e,t,n){let{scaleX:r,scaleY:i,x:a,y:o}=t,s=e.left+a+(1-r)*parseFloat(n),c=e.top+o+(1-i)*parseFloat(n.slice(n.indexOf(` `)+1)),l=r?e.width*r:e.width,u=i?e.height*i:e.height;return{width:l,height:u,top:c,right:s+l,bottom:c+u,left:s}}function KN(e,t,n){let{scaleX:r,scaleY:i,x:a,y:o}=t,s=e.left-a-(1-r)*parseFloat(n),c=e.top-o-(1-i)*parseFloat(n.slice(n.indexOf(` `)+1)),l=r?e.width/r:e.width,u=i?e.height/i:e.height;return{width:l,height:u,top:c,right:s+l,bottom:c+u,left:s}}function qN({element:e,keyframes:t,options:n}){return e.animate(t,n).finished}function JN(e,t=EN(e).translate,n=!0){if(n){let t=cM(e,e=>`translate`in e);if(t){let{translate:e=``}=t[0];if(typeof e==`string`){let t=FN(e);if(t)return t}}}if(t){let e=FN(t);if(e)return e}return{x:0,y:0,z:0}}var YN=new xN(e=>setTimeout(e,0)),XN=new Map,ZN=XN.clear.bind(XN);function QN(e){let t=e.ownerDocument,n=XN.get(t);if(n)return n;n=t.getAnimations(),XN.set(t,n),YN.schedule(ZN);let r=n.filter(t=>sM(t.effect)&&t.effect.target===e);return XN.set(e,r),n}function $N(e,t){let n=QN(e).filter(e=>{if(sM(e.effect)){let{target:n}=e.effect;if((n&&t.isValidTarget?.call(t,n))??!0)return e.effect.getKeyframes().some(e=>{for(let n of t.properties)if(e[n])return!0})}}).map(e=>{let{effect:t,currentTime:n}=e,r=t?.getComputedTiming().duration;if(!(e.pending||e.playState===`finished`)&&typeof r==`number`&&typeof n==`number`&&n<r)return e.currentTime=r,()=>{e.currentTime=n}});if(n.length>0)return()=>n.forEach(e=>e?.())}var eP=class extends Ck{constructor(e,t={}){let{frameTransform:n=MN(e),ignoreTransforms:r,getBoundingClientRect:i=lM}=t,a=$N(e,{properties:[`transform`,`translate`,`scale`,`width`,`height`],isValidTarget:t=>(t!==e||wM())&&t.contains(e)}),o=i(e),{top:s,left:c,width:l,height:u}=o,d,f=EN(e),p=IN(f),m={x:p?.scaleX??1,y:p?.scaleY??1},h=tP(e,f);a?.(),p&&(d=KN(o,p,f.transformOrigin),(r||h)&&(s=d.top,c=d.left,l=d.width,u=d.height));let g={width:d?.width??l,height:d?.height??u};if(h&&!r&&d){let e=GN(d,h,f.transformOrigin);s=e.top,c=e.left,l=e.width,u=e.height,m.x=h.scaleX,m.y=h.scaleY}n&&(r||(c*=n.scaleX,l*=n.scaleX,s*=n.scaleY,u*=n.scaleY),c+=n.x,s+=n.y),super(c,s,l,u),this.scale=m,this.intrinsicWidth=g.width,this.intrinsicHeight=g.height}};function tP(e,t){let n=e.getAnimations();if(!n.length)return null;let r,i,a,o=!1;for(let e of n){if(e.playState!==`running`)continue;let t=sM(e.effect)?e.effect.getKeyframes():[],n=t[t.length-1];if(!n)continue;let{transform:s,translate:c,scale:l}=n;typeof s==`string`&&s&&(r=s,o=!0),typeof c==`string`&&c&&(i=c,o=!0),typeof l==`string`&&l&&(a=l,o=!0)}return o?IN({transform:r??t.transform,translate:i??t.translate,scale:a??t.scale}):null}function nP(e){return`style`in e&&typeof e.style==`object`&&e.style!==null&&`setProperty`in e.style&&`removeProperty`in e.style&&typeof e.style.setProperty==`function`&&typeof e.style.removeProperty==`function`}var rP=class{constructor(e){this.element=e,this.initial=new Map}set(e,t=``){let{element:n}=this;if(nP(n))for(let[r,i]of Object.entries(e)){let e=`${t}${r}`;this.initial.has(e)||this.initial.set(e,n.style.getPropertyValue(e)),n.style.setProperty(e,typeof i==`string`?i:`${i}px`)}}remove(e,t=``){let{element:n}=this;if(nP(n))for(let r of e){let e=`${t}${r}`;n.style.removeProperty(e)}}reset(){let{element:e}=this;if(nP(e)){for(let[t,n]of this.initial)e.style.setProperty(t,n);e.getAttribute(`style`)===``&&e.removeAttribute(`style`)}}};function iP(e){return e?e instanceof fM(e).Element||dM(e)&&e.nodeType===Node.ELEMENT_NODE:!1}function aP(e){if(!e)return!1;let{KeyboardEvent:t}=fM(e.target);return e instanceof t}function oP(e){if(!e)return!1;let{PointerEvent:t}=fM(e.target);return e instanceof t}function sP(e){if(!iP(e))return!1;let{tagName:t}=e;return t===`INPUT`||t===`TEXTAREA`||cP(e)}function cP(e){return e.hasAttribute(`contenteditable`)&&e.getAttribute(`contenteditable`)!==`false`}var lP={};function uP(e){let t=lP[e]==null?0:lP[e]+1;return lP[e]=t,`${e}-${t}`}var dP=({dragOperation:e,droppable:t})=>{let n=e.position.current;if(!n)return null;let{id:r}=t;return t.shape&&t.shape.containsPoint(n)?{id:r,value:1/Sk.distance(t.shape.center,n),type:mj.PointerIntersection,priority:pj.High}:null},fP=({dragOperation:e,droppable:t})=>{let{shape:n}=e;if(!t.shape||!n?.current)return null;let r=n.current.intersectionArea(t.shape);if(r){let{position:i}=e,a=Sk.distance(t.shape.center,i.current),o=r/(n.current.area+t.shape.area-r)/a;return{id:t.id,value:o,type:mj.ShapeIntersection,priority:pj.Normal}}return null},pP=e=>dP(e)??fP(e),mP=e=>{let{dragOperation:t,droppable:n}=e,{shape:r,position:i}=t;if(!n.shape)return null;let a=r?Ck.from(r.current.boundingRectangle).corners:void 0,o=Ck.from(n.shape.boundingRectangle).corners.reduce((e,t,n)=>e+Sk.distance(Sk.from(t),a?.[n]??i.current),0)/4;return{id:n.id,value:1/o,type:mj.Collision,priority:pj.Normal}},hP=Object.create,gP=Object.defineProperty,_P=Object.defineProperties,vP=Object.getOwnPropertyDescriptor,yP=Object.getOwnPropertyDescriptors,bP=Object.getOwnPropertySymbols,xP=Object.prototype.hasOwnProperty,SP=Object.prototype.propertyIsEnumerable,CP=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),wP=e=>{throw TypeError(e)},TP=(e,t,n)=>t in e?gP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,EP=(e,t)=>{for(var n in t||={})xP.call(t,n)&&TP(e,n,t[n]);if(bP)for(var n of bP(t))SP.call(t,n)&&TP(e,n,t[n]);return e},DP=(e,t)=>_P(e,yP(t)),OP=(e,t)=>gP(e,`name`,{value:t,configurable:!0}),kP=(e,t)=>{var n={};for(var r in e)xP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&bP)for(var r of bP(e))t.indexOf(r)<0&&SP.call(e,r)&&(n[r]=e[r]);return n},AP=e=>[,,,hP(e?.[CP(`metadata`)]??null)],jP=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],MP=e=>e!==void 0&&typeof e!=`function`?wP(`Function expected`):e,NP=(e,t,n,r,i)=>({kind:jP[e],name:t,metadata:r,addInitializer:e=>n._?wP(`Already initialized`):i.push(MP(e||null))}),PP=(e,t)=>TP(t,CP(`metadata`),e[3]),FP=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},IP=(e,t,n,r,i,a)=>{var o,s,c,l,u,d=t&7,f=!!(t&8),p=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,h=jP[d+5],g=d>3&&(e[m-1]=[]),_=e[m]||(e[m]=[]),v=d&&(!p&&!f&&(i=i.prototype),d<5&&(d>3||!p)&&vP(d<4?i:{get[n](){return zP(this,a)},set[n](e){return VP(this,a,e)}},n));d?p&&d<4&&OP(a,(d>2?`set `:d>1?`get `:``)+n):OP(i,n);for(var y=r.length-1;y>=0;y--)l=NP(d,n,c={},e[3],_),d&&(l.static=f,l.private=p,u=l.access={has:p?e=>RP(i,e):e=>n in e},d^3&&(u.get=p?e=>(d^1?zP:HP)(e,i,d^4?a:v.get):e=>e[n]),d>2&&(u.set=p?(e,t)=>VP(e,i,t,d^4?a:v.set):(e,t)=>e[n]=t)),s=(0,r[y])(d?d<4?p?a:v[h]:d>4?void 0:{get:v.get,set:v.set}:i,l),c._=1,d^4||s===void 0?MP(s)&&(d>4?g.unshift(s):d?p?a=s:v[h]=s:i=s):typeof s!=`object`||!s?wP(`Object expected`):(MP(o=s.get)&&(v.get=o),MP(o=s.set)&&(v.set=o),MP(o=s.init)&&g.unshift(o));return d||PP(e,i),v&&gP(i,n,v),p?d^4?a:v:i},LP=(e,t,n)=>t.has(e)||wP(`Cannot `+n),RP=(e,t)=>Object(t)===t?e.has(t):wP(`Cannot use the "in" operator on this value`),zP=(e,t,n)=>(LP(e,t,`read from private field`),n?n.call(e):t.get(e)),BP=(e,t,n)=>t.has(e)?wP(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),VP=(e,t,n,r)=>(LP(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),HP=(e,t,n)=>(LP(e,t,`access private method`),n),UP={role:`button`,roleDescription:`draggable`},WP=`dnd-kit-description`,GP=`dnd-kit-announcement`,KP={draggable:`To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item in a given direction. Press space again to drop the item in its new position, or press escape to cancel.`},qP={dragstart({operation:{source:e}}){if(e)return`Picked up draggable item ${e.id}.`},dragover({operation:{source:e,target:t}}){if(e&&e.id!==t?.id)return t?`Draggable item ${e.id} was moved over droppable target ${t.id}.`:`Draggable item ${e.id} is no longer over a droppable target.`},dragend({operation:{source:e,target:t},canceled:n}){if(e)return n?`Dragging was cancelled. Draggable item ${e.id} was dropped.`:t?`Draggable item ${e.id} was dropped over droppable target ${t.id}`:`Draggable item ${e.id} was dropped.`}};function JP(e){let t=e.tagName.toLowerCase();return[`input`,`select`,`textarea`,`a`,`button`].includes(t)}function YP(e,t){let n=document.createElement(`div`);return n.id=e,n.style.setProperty(`display`,`none`),n.textContent=t,n}function XP(e){let t=document.createElement(`div`);return t.id=e,t.setAttribute(`role`,`status`),t.setAttribute(`aria-live`,`polite`),t.setAttribute(`aria-atomic`,`true`),t.style.setProperty(`position`,`fixed`),t.style.setProperty(`width`,`1px`),t.style.setProperty(`height`,`1px`),t.style.setProperty(`margin`,`-1px`),t.style.setProperty(`border`,`0`),t.style.setProperty(`padding`,`0`),t.style.setProperty(`overflow`,`hidden`),t.style.setProperty(`clip`,`rect(0 0 0 0)`),t.style.setProperty(`clip-path`,`inset(100%)`),t.style.setProperty(`white-space`,`nowrap`),t}var ZP=[`dragover`,`dragmove`],QP=class extends hA{constructor(e,t){super(e);let{id:n,idPrefix:{description:r=WP,announcement:i=GP}={},announcements:a=qP,screenReaderInstructions:o=KP,debounce:s=500}=t??{},c=n?`${r}-${n}`:uP(r),l=n?`${i}-${n}`:uP(i),u,d,f,p,m=(e=p)=>{f&&e&&f?.nodeValue!==e&&(f.nodeValue=e)},h=()=>SN.schedule(m),g=$P(h,s),_=Object.entries(a).map(([e,t])=>this.manager.monitor.addEventListener(e,(n,r)=>{let i=f;if(!i)return;let a=t?.(n,r);a&&i.nodeValue!==a&&(p=a,ZP.includes(e)?g():(h(),g.cancel()))})),v=()=>{let e=[];u?.isConnected||(u=YP(c,o.draggable),e.push(u)),d?.isConnected||(d=XP(l),f=document.createTextNode(``),d.appendChild(f),e.push(d)),e.length>0&&document.body.append(...e)},y=new Set;function b(){for(let e of y)e()}this.registerEffect(()=>{y.clear();for(let e of this.manager.registry.draggables.value){let t=e.handle??e.element;if(t){(!u||!d)&&y.add(v),(!JP(t)||wM())&&!t.hasAttribute(`tabindex`)&&y.add(()=>t.setAttribute(`tabindex`,`0`)),!t.hasAttribute(`role`)&&t.tagName.toLowerCase()!==`button`&&y.add(()=>t.setAttribute(`role`,UP.role)),t.hasAttribute(`aria-roledescription`)||y.add(()=>t.setAttribute(`aria-roledescription`,UP.roleDescription)),t.hasAttribute(`aria-describedby`)||y.add(()=>t.setAttribute(`aria-describedby`,c));for(let n of[`aria-pressed`,`aria-grabbed`]){let r=String(e.isDragging);t.getAttribute(n)!==r&&y.add(()=>t.setAttribute(n,r))}let n=String(e.disabled);t.getAttribute(`aria-disabled`)!==n&&y.add(()=>t.setAttribute(`aria-disabled`,n))}}y.size>0&&SN.schedule(b)}),this.destroy=()=>{super.destroy(),u?.remove(),d?.remove(),_.forEach(e=>e())}}};function $P(e,t){let n,r=()=>{clearTimeout(n),n=setTimeout(e,t)};return r.cancel=()=>clearTimeout(n),r}var eF=new Map,tF,nF,rF,iF,aF,oF,sF,cF,lF,uF,dF,fF,pF,mF=class extends (aF=gA,iF=[CO],rF=[wO],nF=[wO],tF=[wO],aF){constructor(e,t){super(e,t),FP(sF,5,this),BP(this,lF),BP(this,oF,new Set),BP(this,cF,FP(sF,8,this,new Set)),FP(sF,11,this),this.registerEffect(HP(this,lF,uF))}register(e){return zP(this,oF).add(e),()=>{zP(this,oF).delete(e)}}addRoot(e){return DD(()=>{let t=new Set(this.additionalRoots);t.add(e),this.additionalRoots=t}),()=>{DD(()=>{let t=new Set(this.additionalRoots);t.delete(e),this.additionalRoots=t})}}get sourceRoot(){let{source:e}=this.manager.dragOperation;return DM(e?.element??null)}get targetRoot(){let{target:e}=this.manager.dragOperation;return DM(e?.element??null)}get roots(){let{status:e}=this.manager.dragOperation;if(e.initializing||e.initialized){let e=[this.sourceRoot,this.targetRoot].filter(e=>e!=null);return new Set([...e,...this.additionalRoots])}return new Set}};sF=AP(aF),oF=new WeakMap,cF=new WeakMap,lF=new WeakSet,uF=function(){let{roots:e}=this,t=[];for(let n of e)for(let e of zP(this,oF))t.push(HP(this,lF,dF).call(this,n,e));return()=>{for(let e of t)e()}},dF=function(e,t){let n=eF.get(e);n||(n=new Map,eF.set(e,n));let r=n.get(t);if(!r){let i=pM(e)?HP(this,lF,fF).call(this,e,n,t):HP(this,lF,pF).call(this,e,n,t);if(!i)return()=>{};r=i,n.set(t,r)}r.refCount++;let i=!1;return()=>{i||(i=!0,r.refCount--,r.refCount===0&&r.cleanup())}},fF=function(e,t,n){let r=e.createElement(`style`),{nonce:i}=this.options??{};i&&r.setAttribute(`nonce`,i),r.textContent=n,e.head.prepend(r);let a=new MutationObserver(t=>{for(let n of t)for(let t of Array.from(n.removedNodes))if(t===r){e.head.prepend(r);return}});return a.observe(e.head,{childList:!0}),{refCount:0,cleanup:()=>{a.disconnect(),r.remove(),t.delete(n),t.size===0&&eF.delete(e)}}},pF=function(e,t,n){`adoptedStyleSheets`in e&&Array.isArray(e.adoptedStyleSheets);let{CSSStyleSheet:r}=e.ownerDocument.defaultView??{};if(!r)return null;let i=new r;return i.replaceSync(n),e.adoptedStyleSheets.push(i),{refCount:0,cleanup:()=>{if(EM(e)&&e.host?.isConnected){let t=e.adoptedStyleSheets.indexOf(i);t!==-1&&e.adoptedStyleSheets.splice(t,1)}t.delete(n),t.size===0&&eF.delete(e)}}},IP(sF,4,`additionalRoots`,iF,mF,cF),IP(sF,2,`sourceRoot`,rF,mF),IP(sF,2,`targetRoot`,nF,mF),IP(sF,2,`roots`,tF,mF),PP(sF,mF),mF.configure=lA(mF);var hF=mF,gF=class extends hA{constructor(e,t){super(e,t),this.manager=e;let{cursor:n=`grabbing`}=t??{},r=e.registry.plugins.get(hF)?.register(`* { cursor: ${n} !important; }`);if(r){let e=this.destroy.bind(this);this.destroy=()=>{r(),e()}}}},_F=`data-dnd-`,vF=`${_F}dropping`,yF=`--dnd-`,bF=`${_F}dragging`,xF=`${_F}placeholder`,SF=[bF,xF,`popover`,`aria-pressed`,`aria-grabbing`],CF=[`view-transition-name`],wF=`
|
|
103
|
+
:is(:root,:host) [${bF}] {
|
|
104
104
|
position: fixed !important;
|
|
105
105
|
pointer-events: none !important;
|
|
106
106
|
touch-action: none;
|
|
107
107
|
z-index: calc(infinity);
|
|
108
108
|
will-change: translate;
|
|
109
|
-
top: var(${
|
|
110
|
-
left: var(${
|
|
109
|
+
top: var(${yF}top, 0px) !important;
|
|
110
|
+
left: var(${yF}left, 0px) !important;
|
|
111
111
|
right: unset !important;
|
|
112
112
|
bottom: unset !important;
|
|
113
|
-
width: var(${
|
|
114
|
-
max-width: var(${
|
|
115
|
-
height: var(${
|
|
116
|
-
max-height: var(${
|
|
117
|
-
transform: var(${
|
|
118
|
-
transition: var(${
|
|
113
|
+
width: var(${yF}width, auto);
|
|
114
|
+
max-width: var(${yF}width, auto);
|
|
115
|
+
height: var(${yF}height, auto);
|
|
116
|
+
max-height: var(${yF}height, auto);
|
|
117
|
+
transform: var(${yF}transform, none) !important;
|
|
118
|
+
transition: var(${yF}transition) !important;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
:is(:root,:host) [${
|
|
121
|
+
:is(:root,:host) [${xF}] {
|
|
122
122
|
transition: none;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
:is(:root,:host) [${
|
|
125
|
+
:is(:root,:host) [${xF}='hidden'] {
|
|
126
126
|
visibility: hidden;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
[${
|
|
129
|
+
[${bF}] * {
|
|
130
130
|
pointer-events: none !important;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
[${
|
|
134
|
-
translate: var(${
|
|
133
|
+
[${bF}]:not([${vF}]) {
|
|
134
|
+
translate: var(${yF}translate) !important;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
[${
|
|
138
|
-
scale: var(${
|
|
139
|
-
transform-origin: var(${
|
|
137
|
+
[${bF}][style*='${yF}scale'] {
|
|
138
|
+
scale: var(${yF}scale) !important;
|
|
139
|
+
transform-origin: var(${yF}transform-origin) !important;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
@layer dnd-kit {
|
|
143
|
-
:where([${
|
|
143
|
+
:where([${bF}][popover]) {
|
|
144
144
|
overflow: visible;
|
|
145
145
|
background: unset;
|
|
146
146
|
border: unset;
|
|
@@ -154,10 +154,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
[${
|
|
157
|
+
[${bF}]::backdrop, [${_F}overlay]:not([${bF}]) {
|
|
158
158
|
display: none;
|
|
159
159
|
visibility: hidden;
|
|
160
160
|
}
|
|
161
|
-
`.replace(/\n+/g,` `).replace(/\s+/g,` `).trim();function OF(e,t=`hidden`){return AD(()=>{let{element:n,manager:r}=e;if(!n||!r)return;let i=kF(n,r.registry.droppables),a=[],o=MM(n),{remove:s}=o;return AF(i,o,a),jF(o,t),o.remove=()=>{a.forEach(e=>e()),s.call(o)},o})}function kF(e,t){let n=new Map;for(let r of t)if(r.element&&(e===r.element||e.contains(r.element))){let e=`${bF}${pP(`dom-id`)}`;r.element.setAttribute(e,``),n.set(r,e)}return n}function AF(e,t,n){for(let[r,i]of e){if(!r.element)continue;let e=`[${i}]`,a=t.matches(e)?t:t.querySelector(e);if(r.element.removeAttribute(i),!a)continue;let o=r.element;r.proxy=a,a.removeAttribute(i),LM.set(o,a),n.push(()=>{LM.delete(o),r.proxy=void 0})}}function jF(e,t=`hidden`){e.setAttribute(`inert`,`true`),e.setAttribute(`tab-index`,`-1`),e.setAttribute(`aria-hidden`,`true`),e.setAttribute(wF,t)}function MF(e,t){return e===t||BM(e)===BM(t)}function NF(e){let{target:t}=e;`newState`in e&&e.newState===`closed`&&sP(t)&&t.hasAttribute(`popover`)&&requestAnimationFrame(()=>bN(t))}function PF(e){return e.tagName===`TR`}function FF(e,t,n){let r=new MutationObserver(r=>{let i=!1;for(let n of r){if(n.target!==e){i=!0;continue}if(n.type!==`attributes`)continue;let r=n.attributeName;if(r.startsWith(`aria-`)||TF.includes(r))continue;let a=e.getAttribute(r);if(r===`style`){if(aP(e)&&aP(t)){let n=e.style;for(let e of Array.from(t.style))n.getPropertyValue(e)===``&&t.style.removeProperty(e);for(let e of Array.from(n)){if(EF.includes(e)||e.startsWith(SF))continue;let r=n.getPropertyValue(e);t.style.setProperty(e,r)}}}else a===null?t.removeAttribute(r):t.setAttribute(r,a)}i&&n&&t.replaceChildren(...e.cloneNode(!0).childNodes)});return r.observe(e,{attributes:!0,subtree:!0,childList:!0}),r}function IF(e,t,n){let r=new MutationObserver(r=>{for(let i of r)if(i.addedNodes.length!==0)for(let r of Array.from(i.addedNodes)){if(r.contains(e)&&e.nextElementSibling!==t){e.insertAdjacentElement(`afterend`,t),bN(n);return}if(r.contains(t)&&t.previousElementSibling!==e){t.insertAdjacentElement(`beforebegin`,e),bN(n);return}}e.isConnected&&t.isConnected&&e.nextElementSibling!==t&&(e.insertAdjacentElement(`afterend`,t),bN(n))});return r.observe(e.ownerDocument.body,{childList:!0,subtree:!0}),r}function LF(e){return new ResizeObserver(()=>{var t;let n=new rP(e.placeholder,{frameTransform:e.frameTransform,ignoreTransforms:!0}),r=e.transformOrigin??{x:1,y:1},i=(e.width-n.width)*r.x+e.delta.x,a=(e.height-n.height)*r.y+e.delta.y,o=OM();if(e.styles.set({width:n.width-e.widthOffset,height:n.height-e.heightOffset,top:e.top+a+o.y,left:e.left+i+o.x},SF),(t=e.getElementMutationObserver())==null||t.takeRecords(),PF(e.element)&&PF(e.placeholder)){let t=Array.from(e.element.cells),n=Array.from(e.placeholder.cells);e.getSavedCellWidths()||e.setSavedCellWidths(t.map(e=>e.style.width));for(let[e,r]of t.entries()){let t=n[e];r.style.width=`${t.getBoundingClientRect().width}px`}}let s=e.getTranslate()??{x:0,y:0},c=e.left+i+o.x+s.x,l=e.top+a+o.y+s.y,u=n.width-e.widthOffset,d=n.height-e.heightOffset,f=e.frameTransform;e.dragOperation.shape=new Ek(c*f.scaleX+f.x,l*f.scaleY+f.y,u*f.scaleX,d*f.scaleY)})}var RF=250,zF=`ease`;function BF(e){var t;let{animation:n}=e;if(typeof n==`function`){let t=n({source:e.source,element:e.element,feedbackElement:e.feedbackElement,placeholder:e.placeholder,translate:e.translate,moved:e.moved});Promise.resolve(t).then(()=>{e.cleanup(),requestAnimationFrame(e.restoreFocus)});return}let{duration:r=RF,easing:i=zF}=n??{};bN(e.feedbackElement);let[,a]=dM(e.feedbackElement,e=>`translate`in e)??[];a?.pause();let o=e.placeholder??e.element,s={frameTransform:MF(e.feedbackElement,o)?null:void 0},c=new rP(e.feedbackElement,s),l=RN(kN(e.feedbackElement).translate)??e.translate,u=new rP(o,s),d=Ek.delta(c,u,e.alignment),f={x:l.x-d.x,y:l.y-d.y},p=Math.round(c.intrinsicHeight)===Math.round(u.intrinsicHeight)?{}:{minHeight:[`${c.intrinsicHeight}px`,`${u.intrinsicHeight}px`],maxHeight:[`${c.intrinsicHeight}px`,`${u.intrinsicHeight}px`]},m=Math.round(c.intrinsicWidth)===Math.round(u.intrinsicWidth)?{}:{minWidth:[`${c.intrinsicWidth}px`,`${u.intrinsicWidth}px`],maxWidth:[`${c.intrinsicWidth}px`,`${u.intrinsicWidth}px`]};e.styles.set({transition:e.transition},SF),e.feedbackElement.setAttribute(xF,``),(t=e.getElementMutationObserver())==null||t.takeRecords(),XN({element:e.feedbackElement,keyframes:AP(kP(kP({},p),m),{translate:[`${l.x}px ${l.y}px 0`,`${f.x}px ${f.y}px 0`]}),options:{duration:jM(hM(e.feedbackElement))?0:e.moved||e.feedbackElement!==e.element?r:0,easing:i}}).then(()=>{e.feedbackElement.removeAttribute(xF),a?.finish(),e.cleanup(),requestAnimationFrame(e.restoreFocus)})}var VF,HF,UF,WF,GF,KF,qF,JF=class extends (HF=vA,VF=[EO],HF){constructor(e,t){super(e,t),UP(this,GF),UP(this,WF,RP(UF,8,this)),RP(UF,11,this),this.state={initial:{},current:{}};let n=e.registry.plugins.get(vF),r=n?.register(DF);if(r){let e=this.destroy.bind(this);this.destroy=()=>{r(),e()}}this.registerEffect(GP(this,GF,KF).bind(this,n)),this.registerEffect(GP(this,GF,qF))}};UF=NP(HF),WF=new WeakMap,GF=new WeakSet,KF=function(e){let{overlay:t}=this;if(!t||!e)return;let n=AM(t);if(n)return e.addRoot(n)},qF=function(){let{state:e,manager:t,options:n}=this,{dragOperation:r}=t,{position:i,source:a,status:o}=r;if(o.idle){e.current={},e.initial={};return}if(!a)return;let{element:s}=a,c=a.pluginConfig(JF),l=c?.feedback??n?.feedback??`default`,u=typeof l==`function`?l(a,t):l;if(!s||u===`none`||!o.initialized||o.initializing)return;let{initial:d}=e,f=this.overlay??s,p=FN(f),m=FN(s),h=!MF(s,f),g=new rP(s,{frameTransform:h?m:null,ignoreTransforms:!h}),_={x:m.scaleX/p.scaleX,y:m.scaleY/p.scaleY},{width:v,height:y,top:b,left:x}=g;h&&(v/=_.x,y/=_.y);let S=new oP(f),C=kN(s),{transition:w,translate:T,boxSizing:E,paddingBlockStart:D,paddingBlockEnd:O,paddingInlineStart:k,paddingInlineEnd:A,borderInlineStartWidth:j,borderInlineEndWidth:M,borderBlockStartWidth:N,borderBlockEndWidth:P}=C,F=w.split(`,`).filter(e=>!/^\s*(transform|translate|scale)\b/.test(e)).join(`,`),I=zN(C),L=C.transform,R=u===`clone`,z=E===`content-box`,ee=z?parseInt(k)+parseInt(A)+parseInt(j)+parseInt(M):0,te=z?parseInt(D)+parseInt(O)+parseInt(N)+parseInt(P):0,ne=u!==`move`&&!this.overlay?OF(a,R?`clone`:`hidden`):null,re=AD(()=>cP(t.dragOperation.activatorEvent));if(!d.translate){if(this.overlay&&I)d.translate={x:I.x,y:I.y};else if(T!==`none`){let e=RN(T);e&&(d.translate=e)}}if(!d.transformOrigin){let e=AD(()=>i.current),t=x+(I?.x??0),n=b+(I?.y??0);d.transformOrigin={x:(e.x-t*p.scaleX-p.x)/(v*p.scaleX),y:(e.y-n*p.scaleY-p.y)/(y*p.scaleY)}}let{transformOrigin:ie}=d,B=b*p.scaleY+p.y,ae=x*p.scaleX+p.x;if(!d.coordinates&&(d.coordinates={x:ae,y:B},_.x!==1||_.y!==1)){let{scaleX:e,scaleY:t}=m,{x:n,y:r}=ie;d.coordinates.x+=(v*e-v)*n,d.coordinates.y+=(y*t-y)*r}d.dimensions||={width:v,height:y},d.frameTransform||=p;let oe={x:d.coordinates.x-ae,y:d.coordinates.y-B},se={width:(d.dimensions.width*d.frameTransform.scaleX-v*p.scaleX)*ie.x,height:(d.dimensions.height*d.frameTransform.scaleY-y*p.scaleY)*ie.y},ce={x:oe.x/p.scaleX+se.width,y:oe.y/p.scaleY+se.height},le={left:x+ce.x,top:b+ce.y};f.setAttribute(CF,`true`);let V=AD(()=>r.transform),ue=d.translate??{x:0,y:0},de=V.x*p.scaleX+ue.x,fe=V.y*p.scaleY+ue.y,pe=OM();S.set({width:v-ee,height:y-te,top:le.top+pe.y,left:le.left+pe.x,translate:`${de}px ${fe}px 0`,transform:this.overlay?`none`:L,transition:F?`${F}, translate 0ms linear`:`translate 0ms linear`,scale:h?`${_.x} ${_.y}`:``,"transform-origin":`${ie.x*100}% ${ie.y*100}%`},SF),ne&&(s.insertAdjacentElement(`afterend`,ne),n?.rootElement&&(typeof n.rootElement==`function`?n.rootElement(a):n.rootElement).appendChild(s)),yN(f)&&(f.hasAttribute(`popover`)||f.setAttribute(`popover`,`manual`),bN(f),f.addEventListener(`beforetoggle`,NF));let me,he,ge,_e=LF({placeholder:ne,element:s,feedbackElement:f,frameTransform:p,transformOrigin:ie,width:v,height:y,top:b,left:x,widthOffset:ee,heightOffset:te,delta:ce,styles:S,dragOperation:r,getTranslate:()=>e.current.translate,getElementMutationObserver:()=>me,getSavedCellWidths:()=>ge,setSavedCellWidths:e=>{ge=e}}),ve=new rP(f);AD(()=>r.shape=ve);let ye=hM(f),be=e=>{this.manager.actions.stop({event:e})},xe=jM(ye);re&&ye.addEventListener(`resize`,be),AD(()=>a.status)===`idle`&&requestAnimationFrame(()=>a.status=`dragging`),ne&&(_e.observe(ne),me=FF(s,ne,R),he=IF(s,ne,f));let Se=t.dragOperation.source?.id,Ce=()=>{if(!re||Se==null)return;let e=t.registry.draggables.get(Se),n=e?.handle??e?.element;_M(n)&&n.focus()},we=()=>{me?.disconnect(),he?.disconnect(),_e.disconnect(),ye.removeEventListener(`resize`,be),yN(f)&&(f.removeEventListener(`beforetoggle`,NF),f.removeAttribute(`popover`)),f.removeAttribute(CF),S.reset();let t=()=>{if(ge&&PF(s)){let e=Array.from(s.cells);for(let[t,n]of e.entries())n.style.width=ge[t]??``}a.status=`idle`;let t=e.current.translate!=null,n=r.status.dragging;ne&&(!n&&t||ne.parentElement!==f.parentElement)&&f.isConnected&&ne.replaceWith(f),ne?.remove()};f===this.overlay?setTimeout(t,0):t()},Te=n?.dropAnimation,Ee=this,De=kO(()=>{let{transform:t,status:i}=r;if((t.x||t.y||e.current.translate)&&i.dragging){let i=d.translate??{x:0,y:0},a={x:t.x/p.scaleX+i.x,y:t.y/p.scaleY+i.y},o=e.current.translate,s=AD(()=>r.modifiers),c=AD(()=>r.shape?.current),l=n?.keyboardTransition,u=re&&!xe&&l!==null?`${l?.duration??250}ms ${l?.easing??`cubic-bezier(0.25, 1, 0.5, 1)`}`:`0ms linear`;if(S.set({transition:F?`${F}, translate ${u}`:`translate ${u}`,translate:`${a.x}px ${a.y}px 0`},SF),me?.takeRecords(),c&&c!==ve&&o&&!s.length){let e=Tk.delta(a,o);r.shape=Ek.from(c.boundingRectangle).translate(e.x*p.scaleX,e.y*p.scaleY)}else r.shape=new rP(f);e.current.translate=a}},function(){if(r.status.dropped){this.dispose(),a.status=`dropping`;let n=c?.dropAnimation===void 0?Ee.dropAnimation===void 0?Te:Ee.dropAnimation:c.dropAnimation,r=e.current.translate,i=r!=null;if(!r&&s!==f&&(r={x:0,y:0}),!r||n===null){we();return}t.renderer.rendering.then(()=>{BF({source:a,element:s,feedbackElement:f,placeholder:ne,translate:r,moved:i,transition:w,alignment:a.alignment,styles:S,animation:n??void 0,getElementMutationObserver:()=>me,cleanup:we,restoreFocus:Ce})})}});return()=>{we(),De()}},zP(UF,4,`overlay`,VF,JF,WF),LP(UF,JF),JF.configure=fA(JF);var YF=JF,XF=!0,ZF=!1,QF,$F,eI=[EO],tI=VN.Forward,nI,rI,iI;$F=(QF=[EO],VN.Reverse);var aI=class{constructor(){UP(this,rI,RP(nI,8,this,XF)),RP(nI,11,this),UP(this,iI,RP(nI,12,this,XF)),RP(nI,15,this)}isLocked(e){return e===VN.Idle?!1:e==null?this[VN.Forward]===XF&&this[VN.Reverse]===XF:this[e]===XF}unlock(e){e!==VN.Idle&&(this[e]=ZF)}};nI=NP(null),rI=new WeakMap,iI=new WeakMap,zP(nI,4,tI,eI,aI,rI),zP(nI,4,$F,QF,aI,iI),LP(nI,aI);var oI=[VN.Forward,VN.Reverse],sI=class{constructor(){this.x=new aI,this.y=new aI}isLocked(){return this.x.isLocked()&&this.y.isLocked()}},cI=class extends vA{constructor(e){super(e);let t=BD(new sI),n=null;this.signal=t,XD(()=>{let{status:r}=e.dragOperation;if(!r.initialized){n=null,t.value=new sI;return}let{delta:i}=e.dragOperation.position;if(n){let e={x:lI(i.x,n.x),y:lI(i.y,n.y)},r=t.peek();DD(()=>{for(let t of Ik)for(let n of oI)e[t]===n&&r[t].unlock(n);t.value=r})}n=i})}get current(){return this.signal.peek()}};function lI(e,t){return Math.sign(e-t)}var uI,dI,fI,pI,mI,hI,gI=class extends (dI=yA,uI=[EO],dI){constructor(e){super(e),UP(this,pI,RP(fI,8,this,!1)),RP(fI,11,this),UP(this,mI),UP(this,hI,()=>{if(!HP(this,mI))return;let{element:e,by:t}=HP(this,mI);t.y&&(e.scrollTop+=t.y),t.x&&(e.scrollLeft+=t.x)}),this.scroll=(e,t)=>{if(this.disabled)return!1;let n=this.getScrollableElements();if(!n)return WP(this,mI,void 0),!1;let{position:r}=this.manager.dragOperation,i=r?.current;if(i){let{by:r}=e??{},a=r?{x:_I(r.x),y:_I(r.y)}:void 0,o=a?void 0:this.scrollIntentTracker.current;if(o?.isLocked())return!1;for(let e of n){let n=CN(e,r);if(n.x||n.y){let{speed:n,direction:s}=WN(e,i,a,t?.acceleration,t?.threshold);if(o)for(let e of Ik)o[e].isLocked(s[e])&&(n[e]=0,s[e]=0);if(s.x||s.y){let{x:t,y:i}=r??s,a=t*n.x,o=i*n.y;if(a||o){let t=HP(this,mI)?.by;if(this.autoScrolling&&t&&(t.x&&!a||t.y&&!o))continue;return WP(this,mI,{element:e,by:{x:a,y:o}}),TN.schedule(HP(this,hI)),!0}}}}}return WP(this,mI,void 0),!1};let t=null,n=null,r=wO(()=>{let{position:n,source:r}=e.dragOperation;if(!n)return null;let i=FM(AM(r?.element),n.current);return i&&(t=i),i??t}),i=wO(()=>{let t=r.value,{documentElement:i}=yM(t);if(!t||t===i){let{target:t}=e.dragOperation,r=t?.element;if(r){let e=PN(r,{excludeElement:!1});return n=e,e}}if(t){let e=PN(t,{excludeElement:!1});return this.autoScrolling&&n&&e.size<n?.size?n:(n=e,e)}return n=null,null},TO);this.getScrollableElements=()=>i.value,this.scrollIntentTracker=new cI(e),this.destroy=e.monitor.addEventListener(`dragmove`,t=>{!this.disabled&&!t.defaultPrevented&&cP(e.dragOperation.activatorEvent)&&t.by&&this.scroll({by:t.by})&&t.preventDefault()})}};fI=NP(dI),pI=new WeakMap,mI=new WeakMap,hI=new WeakMap,zP(fI,4,`autoScrolling`,uI,gI,pI),LP(fI,gI);function _I(e){return e>0?VN.Forward:e<0?VN.Reverse:VN.Idle}var vI=new class{constructor(e){this.scheduler=e,this.pending=!1,this.tasks=new Set,this.resolvers=new Set,this.flush=()=>{let{tasks:e,resolvers:t}=this;this.pending=!1,this.tasks=new Set,this.resolvers=new Set;for(let t of e)t();for(let e of t)e()}}schedule(e){return this.tasks.add(e),this.pending||(this.pending=!0,this.scheduler(this.flush)),new Promise(e=>this.resolvers.add(e))}}(e=>{typeof requestAnimationFrame==`function`?requestAnimationFrame(e):e()}),yI=10,bI=class extends vA{constructor(e,t){super(e,t);let n=e.registry.plugins.get(gI);if(!n)throw Error(`AutoScroller plugin depends on Scroller plugin`);this.destroy=XD(()=>{if(this.disabled)return;let{position:t,status:r}=e.dragOperation;if(r.dragging){let e={acceleration:this.options?.acceleration,threshold:typeof this.options?.threshold==`number`?{x:this.options.threshold,y:this.options.threshold}:this.options?.threshold};if(n.scroll(void 0,e)){n.autoScrolling=!0;let t=setInterval(()=>vI.schedule(()=>n.scroll(void 0,e)),yI);return()=>{clearInterval(t)}}n.autoScrolling=!1}})}};bI.configure=fA(bI);var xI=bI,SI={capture:!0,passive:!0},CI,wI=class extends yA{constructor(e){super(e),UP(this,CI),this.handleScroll=()=>{HP(this,CI)??WP(this,CI,setTimeout(()=>{this.manager.collisionObserver.forceUpdate(!1),WP(this,CI,void 0)},50))};let{dragOperation:t}=this.manager;this.destroy=XD(()=>{if(t.status.dragging){let e=t.source?.element?.ownerDocument??document;return e.addEventListener(`scroll`,this.handleScroll,SI),()=>{e.removeEventListener(`scroll`,this.handleScroll,SI)}}})}};CI=new WeakMap;var TI=`* { user-select: none !important; -webkit-user-select: none !important; }`,EI=class extends vA{constructor(e){super(e),this.manager=e;let t=e.registry.plugins.get(vF)?.register(TI);if(this.destroy=XD(()=>{let{dragOperation:e}=this.manager;if(e.status.initialized)return DI(),document.addEventListener(`selectionchange`,DI,{capture:!0}),()=>{document.removeEventListener(`selectionchange`,DI,{capture:!0})}}),t){let e=this.destroy.bind(this);this.destroy=()=>{t(),e()}}}};function DI(){var e;(e=document.getSelection())==null||e.removeAllRanges()}var OI=Object.freeze({offset:10,keyboardCodes:{start:[`Space`,`Enter`],cancel:[`Escape`],end:[`Space`,`Enter`,`Tab`],up:[`ArrowUp`],down:[`ArrowDown`],left:[`ArrowLeft`],right:[`ArrowRight`]},preventActivation(e,t){let n=t.handle??t.element;return e.target!==n}}),kI,AI=class extends kj{constructor(e,t){super(e),this.manager=e,this.options=t,UP(this,kI,[]),this.listeners=new zM,this.handleSourceKeyDown=(e,t,n)=>{if(this.disabled||e.defaultPrevented||!sP(e.target)||t.disabled)return;let{keyboardCodes:r=OI.keyboardCodes,preventActivation:i=OI.preventActivation}=n??{};r.start.includes(e.code)&&this.manager.dragOperation.status.idle&&(i?.(e,t)||this.handleStart(e,t,n))}}bind(e,t=this.options){return XD(()=>{let n=e.handle??e.element,r=n=>{cP(n)&&this.handleSourceKeyDown(n,e,t)};if(n)return n.addEventListener(`keydown`,r),()=>{n.removeEventListener(`keydown`,r)}})}handleStart(e,t,n){let{element:r}=t;if(!r)throw Error(`Source draggable does not have an associated element`);e.preventDefault(),e.stopImmediatePropagation(),GN(r);let{center:i}=new rP(r);if(this.manager.actions.start({event:e,coordinates:{x:i.x,y:i.y},source:t}).signal.aborted)return this.cleanup();this.sideEffects();let a=yM(r),o=[this.listeners.bind(a,[{type:`keydown`,listener:e=>this.handleKeyDown(e,t,n),options:{capture:!0}}])];HP(this,kI).push(...o)}handleKeyDown(e,t,n){let{keyboardCodes:r=OI.keyboardCodes}=n??{};if(MI(e,[...r.end,...r.cancel])){e.preventDefault();let t=MI(e,r.cancel);this.handleEnd(e,t);return}MI(e,r.up)?this.handleMove(`up`,e):MI(e,r.down)&&this.handleMove(`down`,e),MI(e,r.left)?this.handleMove(`left`,e):MI(e,r.right)&&this.handleMove(`right`,e)}handleEnd(e,t){this.manager.actions.stop({event:e,canceled:t}),this.cleanup()}handleMove(e,t){let{shape:n}=this.manager.dragOperation,r=t.shiftKey?5:1,i={x:0,y:0},a=this.options?.offset??OI.offset;if(typeof a==`number`&&(a={x:a,y:a}),n){switch(e){case`up`:i={x:0,y:-a.y*r};break;case`down`:i={x:0,y:a.y*r};break;case`left`:i={x:-a.x*r,y:0};break;case`right`:i={x:a.x*r,y:0}}(i.x||i.y)&&(t.preventDefault(),this.manager.actions.move({event:t,by:i}))}}sideEffects(){let e=this.manager.registry.plugins.get(xI);e?.disabled===!1&&(e.disable(),HP(this,kI).push(()=>{e.enable()}))}cleanup(){HP(this,kI).forEach(e=>e()),WP(this,kI,[])}destroy(){this.cleanup(),this.listeners.clear()}};kI=new WeakMap,AI.configure=fA(AI),AI.defaults=OI;var jI=AI;function MI(e,t){return t.includes(e.code)}var NI,PI=class extends Mj{constructor(){super(...arguments),UP(this,NI)}onEvent(e){switch(e.type){case`pointerdown`:WP(this,NI,wM(e));break;case`pointermove`:if(!HP(this,NI))return;let{x:t,y:n}=wM(e),r={x:t-HP(this,NI).x,y:n-HP(this,NI).y},{tolerance:i}=this.options;if(i&&Pk(r,i)){this.abort();return}Pk(r,this.options.value)&&this.activate(e);break;case`pointerup`:this.abort()}}abort(){WP(this,NI,void 0)}};NI=new WeakMap;var FI,II,LI=class extends Mj{constructor(){super(...arguments),UP(this,FI),UP(this,II)}onEvent(e){switch(e.type){case`pointerdown`:WP(this,II,wM(e)),WP(this,FI,setTimeout(()=>this.activate(e),this.options.value));break;case`pointermove`:if(!HP(this,II))return;let{x:t,y:n}=wM(e);Pk({x:t-HP(this,II).x,y:n-HP(this,II).y},this.options.tolerance)&&this.abort();break;case`pointerup`:this.abort()}}abort(){HP(this,FI)&&(clearTimeout(HP(this,FI)),WP(this,II,void 0),WP(this,FI,void 0))}};FI=new WeakMap,II=new WeakMap;var RI=class{};RI.Delay=LI,RI.Distance=PI;var zI=Object.freeze({activationConstraints(e,t){let{pointerType:n,target:r}=e;if(n!==`mouse`||!sP(r)||t.handle!==r&&!t.handle?.contains(r))return n===`touch`?[new RI.Delay({value:250,tolerance:5})]:uP(r)&&!e.defaultPrevented?[new RI.Delay({value:200,tolerance:0})]:[new RI.Delay({value:200,tolerance:10}),new RI.Distance({value:5})]},preventActivation(e,t){let{target:n}=e;if(n===t.element||n===t.handle||!sP(n)||t.handle?.contains(n))return!1;let r=RM(n);return r!==t.element&&!!r}}),BI,VI=class extends kj{constructor(e,t){super(e),this.manager=e,this.options=t,UP(this,BI,new Set),this.listeners=new zM,this.latest={event:void 0,coordinates:void 0},this.handleMove=()=>{let{event:e,coordinates:t}=this.latest;e&&t&&this.manager.actions.move({event:e,to:t})},this.handleCancel=this.handleCancel.bind(this),this.handlePointerUp=this.handlePointerUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}activationConstraints(e,t,n=this.options){let{activationConstraints:r=zI.activationConstraints}=n??{};return typeof r==`function`?r(e,t):r}bind(e,t=this.options){return XD(()=>{let n=new AbortController,{signal:r}=n,i=n=>{lP(n)&&this.handlePointerDown(n,e,t)},a=[e.handle??e.element];t?.activatorElements&&(a=Array.isArray(t.activatorElements)?t.activatorElements:t.activatorElements(e));for(let e of a)e&&(qI(e.ownerDocument.defaultView),e.addEventListener(`pointerdown`,i,{signal:r}));return()=>n.abort()})}handlePointerDown(e,t,n){if(this.disabled||!e.isPrimary||e.button!==0||!sP(e.target)||t.disabled||UI(e)||!this.manager.dragOperation.status.idle)return;let{preventActivation:r=zI.preventActivation}=n??{};if(r?.(e,t))return;let{target:i}=e,a=_M(i)&&i.draggable&&i.getAttribute(`draggable`)===`true`,o=FN(t.element),{x:s,y:c}=wM(e);this.initialCoordinates={x:s*o.scaleX+o.x,y:c*o.scaleY+o.y};let l=this.activationConstraints(e,t,n);e.sensor=this;let u=new Aj(l,e=>this.handleStart(t,e));u.signal.onabort=()=>this.handleCancel(e),u.onEvent(e),this.controller=u;let d=EM(),f=this.listeners.bind(d,[{type:`pointermove`,listener:e=>this.handlePointerMove(e,t)},{type:`pointerup`,listener:this.handlePointerUp,options:{capture:!0}},{type:`pointercancel`,listener:this.handleCancel},{type:`dragstart`,listener:a?this.handleCancel:WI,options:{capture:!0}}]);HP(this,BI).add(()=>{f(),this.initialCoordinates=void 0})}handlePointerMove(e,t){var n;if(this.controller?.activated===!1){(n=this.controller)==null||n.onEvent(e);return}if(this.manager.dragOperation.status.dragging){let n=wM(e),r=FN(t.element);n.x=n.x*r.scaleX+r.x,n.y=n.y*r.scaleY+r.y,e.preventDefault(),e.stopPropagation(),this.latest.event=e,this.latest.coordinates=n,TN.schedule(this.handleMove)}}handlePointerUp(e){let{status:t}=this.manager.dragOperation;if(!t.idle){e.preventDefault(),e.stopPropagation();let n=!t.initialized;this.manager.actions.stop({event:e,canceled:n})}this.cleanup()}handleKeyDown(e){e.key===`Escape`&&(e.preventDefault(),this.handleCancel(e))}handleStart(e,t){let{manager:n,initialCoordinates:r}=this;if(!r||!n.dragOperation.status.idle||t.defaultPrevented)return;if(n.actions.start({coordinates:r,event:t,source:e}).signal.aborted)return this.cleanup();t.preventDefault();let i=yM(t.target).body;try{i.setPointerCapture(t.pointerId)}catch{this.handleCancel(t);return}let a=sP(t.target)?[t.target,i]:i,o=this.listeners.bind(a,[{type:`touchmove`,listener:WI,options:{passive:!1}},{type:`click`,listener:WI},{type:`contextmenu`,listener:WI},{type:`keydown`,listener:this.handleKeyDown}]);HP(this,BI).add(o)}handleCancel(e){let{dragOperation:t}=this.manager;t.status.initialized&&this.manager.actions.stop({event:e,canceled:!0}),this.cleanup()}cleanup(){let{controller:e}=this;this.controller=void 0,e&&!e.signal.aborted&&e.abort(),this.latest={event:void 0,coordinates:void 0},HP(this,BI).forEach(e=>e()),HP(this,BI).clear()}destroy(){this.cleanup(),this.listeners.clear()}};BI=new WeakMap,VI.configure=fA(VI),VI.defaults=zI;var HI=VI;function UI(e){return`sensor`in e}function WI(e){e.preventDefault()}function GI(){}var KI=new WeakSet;function qI(e){e&&!KI.has(e)&&(e.addEventListener(`touchmove`,GI,{capture:!1,passive:!1}),KI.add(e))}var JI={modifiers:[],plugins:[tF,xI,yF,YF,EI],sensors:[HI,jI]},YI=class extends rM{constructor(e={}){let t=nM(e.plugins,JI.plugins),n=nM(e.sensors,JI.sensors),r=nM(e.modifiers,JI.modifiers);super(AP(kP({},e),{plugins:[wI,gI,vF,...t],sensors:n,modifiers:r}))}},XI,ZI,QI,$I,eL,tL,nL=class extends (QI=ZA,ZI=[EO],XI=[EO],QI){constructor(e,t){var n=e,{element:r,effects:i=()=>[],handle:a}=n,o=MP(n,[`element`,`effects`,`handle`]);super(kP({effects:()=>[...i(),()=>{let{manager:e}=this;if(!e)return;let t=(this.sensors?.map(pA)??[...e.sensors]).map(t=>{let n=t instanceof kj?t:e.registry.register(t.plugin),r=t instanceof kj?void 0:t.options;return n.bind(this,r)});return function(){t.forEach(e=>e())}}]},o),t),UP(this,eL,RP($I,8,this)),RP($I,11,this),UP(this,tL,RP($I,12,this)),RP($I,15,this),this.element=r,this.handle=a}};$I=NP(QI),eL=new WeakMap,tL=new WeakMap,zP($I,4,`handle`,ZI,nL,eL),zP($I,4,`element`,XI,nL,tL),LP($I,nL);var rL,iL,aL,oL,sL,cL,lL,uL,dL,fL,pL=class extends (aL=dj,iL=[EO],rL=[EO],aL){constructor(e,t){var n=e,{element:r,effects:i=()=>[]}=n,a=MP(n,[`element`,`effects`]);let{collisionDetector:o=gP}=a,s=e=>{let{manager:t,element:n}=this;if(!n||e===null){this.shape=void 0;return}if(!t)return;let r=new rP(n),i=AD(()=>this.shape);return r&&i?.equals(r)?i:(this.shape=r,r)},c=BD(!1);super(AP(kP({},a),{collisionDetector:o,effects:()=>[...i(),()=>{let{element:e,manager:t}=this;if(!t)return;let{dragOperation:n}=t,{source:r}=n;c.value=!!(r&&n.status.initialized&&e&&!this.disabled&&this.accepts(r))},()=>{let{element:e}=this;if(c.value&&e){let t=new vN(e,s);return()=>{t.disconnect(),this.shape=void 0}}},()=>{if(this.manager?.dragOperation.status.initialized)return()=>{this.shape=void 0}}]}),t),UP(this,dL),UP(this,sL,RP(oL,8,this)),RP(oL,11,this),UP(this,fL,RP(oL,12,this)),RP(oL,15,this),this.element=r,this.refreshShape=()=>s()}set element(e){WP(this,dL,e,uL)}get element(){return this.proxy??HP(this,dL,lL)}};oL=NP(aL),sL=new WeakMap,dL=new WeakSet,fL=new WeakMap,cL=zP(oL,20,`#element`,iL,dL,sL),lL=cL.get,uL=cL.set,zP(oL,4,`proxy`,rL,pL,fL),LP(oL,pL);function mL(e){return typeof e==`object`&&!!e&&`current`in e}function hL(e){if(e!=null)return mL(e)?e.current??void 0:e}var gL=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?D.useLayoutEffect:D.useEffect;function _L(){let e=(0,D.useState)(0)[1];return(0,D.useCallback)(()=>{e(e=>e+1)},[e])}function vL(e,t=!1){let n=(0,D.useRef)(e.peek()),r=(0,D.useRef)(!1),i=_L();return gL(()=>XD(()=>{let a=n.current,o=e.value;if(a!==o){if(n.current=o,!r.current)return;t?(0,kh.flushSync)(i):i()}}),[e,t,i]),{get value(){return r.current=!0,e.peek()}}}function yL(e,t=[],n=!1){let r=(0,D.useRef)(e);return r.current=e,vL((0,D.useMemo)(()=>wO(()=>r.current()),t),n)}function bL(e,t){let n=(0,D.useRef)(new Map),r=_L();return gL(()=>{if(!e){n.current.clear();return}return XD(()=>{let i=!1,a=!1;for(let r of n.current){let[o]=r,s=AD(()=>r[1]),c=e[o];s!==c&&(i=!0,n.current.set(o,c),a=t?.(o,s,c)??!1)}i&&(a?queueMicrotask(()=>(0,kh.flushSync)(r)):r())})},[e]),(0,D.useMemo)(()=>e&&new Proxy(e,{get(e,t){let r=e[t];return n.current.set(t,r),r}}),[e])}function xL(e,t){e()}function SL(e){let t=(0,D.useRef)(e);return gL(()=>{t.current=e},[e]),t}function CL(e,t,n=D.useEffect,r=Object.is){let i=(0,D.useRef)(e);n(()=>{let n=i.current;r(e,n)||(i.current=e,t(e,n))},[t,e])}function wL(e,t){let n=(0,D.useRef)(hL(e));gL(()=>{let r=hL(e);r!==n.current&&(n.current=r,t(r))})}var TL=Object.getOwnPropertySymbols,EL=Object.prototype.hasOwnProperty,DL=Object.prototype.propertyIsEnumerable,OL=(e,t)=>{var n={};for(var r in e)EL.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&TL)for(var r of TL(e))t.indexOf(r)<0&&DL.call(e,r)&&(n[r]=e[r]);return n},kL=new YI,AL=(0,D.createContext)(kL),jL=(0,D.memo)((0,D.forwardRef)(({children:e},t)=>{let[n,r]=(0,D.useState)(0),i=(0,D.useRef)(null),a=(0,D.useRef)(null),o=(0,D.useMemo)(()=>({renderer:{get rendering(){return i.current??Promise.resolve()}},trackRendering(e){i.current||=new Promise(e=>{a.current=e}),(0,D.startTransition)(()=>{e(),r(e=>e+1)})}}),[]);return gL(()=>{var e;(e=a.current)==null||e.call(a),i.current=null},[e,n]),(0,D.useImperativeHandle)(t,()=>o),null})),ML=[void 0,TO];function NL(e){var t=e,{children:n,onCollision:r,onBeforeDragStart:i,onDragStart:a,onDragMove:o,onDragOver:s,onDragEnd:c}=t,l=OL(t,[`children`,`onCollision`,`onBeforeDragStart`,`onDragStart`,`onDragMove`,`onDragOver`,`onDragEnd`]);let u=(0,D.useRef)(null),{plugins:d,modifiers:f,sensors:p}=l,m=nM(d,JI.plugins),h=nM(p,JI.sensors),g=nM(f,JI.modifiers),_=SL(i),v=SL(a),y=SL(s),b=SL(o),x=SL(c),S=SL(r),C=PL(()=>l.manager??new YI(l));return(0,D.useEffect)(()=>{if(!u.current)throw Error(`Renderer not found`);let{renderer:e,trackRendering:t}=u.current,{monitor:n}=C;C.renderer=e;let r=[n.addEventListener(`beforedragstart`,e=>{let n=_.current;n&&t(()=>n(e,C))}),n.addEventListener(`dragstart`,e=>v.current?.call(v,e,C)),n.addEventListener(`dragover`,e=>{let n=y.current;n&&t(()=>n(e,C))}),n.addEventListener(`dragmove`,e=>{let n=b.current;n&&t(()=>n(e,C))}),n.addEventListener(`dragend`,e=>{let n=x.current;n&&t(()=>n(e,C))}),n.addEventListener(`collision`,e=>S.current?.call(S,e,C))];return()=>r.forEach(e=>e())},[C]),CL(m,()=>C&&(C.plugins=m),...ML),CL(h,()=>C&&(C.sensors=h),...ML),CL(g,()=>C&&(C.modifiers=g),...ML),(0,H.jsxs)(AL.Provider,{value:C,children:[(0,H.jsx)(jL,{ref:u,children:n}),n]})}function PL(e){let t=(0,D.useRef)(null);return t.current||=e(),(0,D.useInsertionEffect)(()=>()=>t.current?.destroy(),[]),t.current}function FL(){return(0,D.useContext)(AL)}function IL(e){let t=FL()??void 0,[n]=(0,D.useState)(()=>e(t));return n.manager!==t&&(n.manager=t),gL(n.register,[t,n]),n}function LL({children:e,className:t,dropAnimation:n,style:r,tag:i,disabled:a}){let o=(0,D.useRef)(null),s=FL(),c=yL(()=>s?.dragOperation.source,[s]).value??null,l=typeof a==`function`?a(c):a;(0,D.useEffect)(()=>{if(!o.current||!s||l)return;let e=s.plugins.find(e=>e instanceof YF);if(e)return e.overlay=o.current,()=>{e.overlay=void 0}},[s,l]),(0,D.useEffect)(()=>{if(!s)return;let e=s.plugins.find(e=>e instanceof YF);if(e)return e.dropAnimation=n,()=>{e.dropAnimation=void 0}},[s,n]);let u=(0,D.useMemo)(()=>{if(!s)return null;let e=new Proxy(s.registry,{get(e,t){return t===`register`||t===`unregister`?RL:e[t]}});return new Proxy(s,{get(t,n){return n===`registry`?e:t[n]}})},[s]);return(0,H.jsx)(AL.Provider,{value:u,children:(0,D.createElement)(i||`div`,{ref:o,className:t,style:r,"data-dnd-overlay":!0},d())});function d(){return!c||l?null:typeof e==`function`?(0,H.jsx)(zL,{source:c,children:e}):e}}function RL(){return()=>{}}function zL({children:e,source:t}){return e(bL(t))}var BL=Object.create,VL=Object.defineProperty,HL=Object.getOwnPropertyDescriptor,UL=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),WL=e=>{throw TypeError(e)},GL=(e,t,n)=>t in e?VL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,KL=e=>[,,,BL(e?.[UL(`metadata`)]??null)],qL=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],JL=e=>e!==void 0&&typeof e!=`function`?WL(`Function expected`):e,YL=(e,t,n,r,i)=>({kind:qL[e],name:t,metadata:r,addInitializer:e=>n._?WL(`Already initialized`):i.push(JL(e||null))}),XL=(e,t)=>GL(t,UL(`metadata`),e[3]),ZL=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)a[i].call(n);return r},QL=(e,t,n,r,i,a)=>{for(var o,s,c,l,u=t&7,d=!1,f=!1,p=2,m=qL[u+5],h=e[p]||(e[p]=[]),g=(i=i.prototype,HL(i,n)),_=r.length-1;_>=0;_--)c=YL(u,n,s={},e[3],h),c.static=d,c.private=f,l=c.access={has:e=>n in e},l.get=e=>e[n],o=(0,r[_])(g[m],c),s._=1,JL(o)&&(g[m]=o);return g&&VL(i,n,g),i},$L=(e,t,n)=>t.has(e)||WL(`Cannot `+n),eR=(e,t,n)=>($L(e,t,`read from private field`),t.get(e)),tR=(e,t,n)=>t.has(e)?WL(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),nR=(e,t,n,r)=>($L(e,t,`write to private field`),t.set(e,n),n),rR=class e{constructor(e,t){this.x=e,this.y=t}static delta(t,n){return new e(t.x-n.x,t.y-n.y)}static distance(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}static equals(e,t){return e.x===t.x&&e.y===t.y}static from({x:t,y:n}){return new e(t,n)}},iR,aR,oR,sR,cR,lR=class extends (oR=XO,aR=[DO],iR=[DO],oR){constructor(e){let t=rR.from(e);super(t,(e,t)=>rR.equals(e,t)),ZL(cR,5,this),tR(this,sR,0),this.velocity={x:0,y:0}}get delta(){return rR.delta(this.current,this.initial)}get direction(){let{current:e,previous:t}=this;if(!t)return null;let n={x:e.x-t.x,y:e.y-t.y};return!n.x&&!n.y?null:Math.abs(n.x)>Math.abs(n.y)?n.x>0?`right`:`left`:n.y>0?`down`:`up`}get current(){return super.current}set current(e){let{current:t}=this,n=rR.from(e),r={x:n.x-t.x,y:n.y-t.y},i=Date.now(),a=i-eR(this,sR),o=e=>Math.round(e/a*100);DD(()=>{nR(this,sR,i),this.velocity={x:o(r.x),y:o(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(rR.from(e)),this.velocity={x:0,y:0}}};cR=KL(oR),sR=new WeakMap,QL(cR,2,`delta`,aR,lR),QL(cR,2,`direction`,iR,lR),XL(cR,lR);var uR=(e=>(e.Horizontal=`x`,e.Vertical=`y`,e))(uR||{});Object.values(uR);function dR(){let e=FL(),t=yL(()=>e?.dragOperation.source,[e]),n=yL(()=>e?.dragOperation.target,[e]);return{get source(){return t.value},get target(){return n.value}}}var fR=Object.create,pR=Object.defineProperty,mR=Object.defineProperties,hR=Object.getOwnPropertyDescriptor,gR=Object.getOwnPropertyDescriptors,_R=Object.getOwnPropertySymbols,vR=Object.prototype.hasOwnProperty,yR=Object.prototype.propertyIsEnumerable,bR=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),xR=e=>{throw TypeError(e)},SR=(e,t,n)=>t in e?pR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,CR=(e,t)=>{for(var n in t||={})vR.call(t,n)&&SR(e,n,t[n]);if(_R)for(var n of _R(t))yR.call(t,n)&&SR(e,n,t[n]);return e},wR=(e,t)=>mR(e,gR(t)),TR=(e,t)=>{var n={};for(var r in e)vR.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_R)for(var r of _R(e))t.indexOf(r)<0&&yR.call(e,r)&&(n[r]=e[r]);return n},ER=e=>[,,,fR(null)],DR=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],OR=e=>e!==void 0&&typeof e!=`function`?xR(`Function expected`):e,kR=(e,t,n,r,i)=>({kind:DR[e],name:t,metadata:r,addInitializer:e=>n._?xR(`Already initialized`):i.push(OR(e||null))}),AR=(e,t)=>SR(t,bR(`metadata`),e[3]),jR=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},MR=(e,t,n,r,i,a)=>{for(var o,s,c,l,u,d=t&7,f=!1,p=!1,m=e.length+1,h=DR[d+5],g=e[m-1]=[],_=e[m]||(e[m]=[]),v=(i=i.prototype,hR({get[n](){return PR(this,a)},set[n](e){return IR(this,a,e)}},n)),y=r.length-1;y>=0;y--)l=kR(d,n,c={},e[3],_),l.static=f,l.private=p,u=l.access={has:e=>n in e},u.get=e=>e[n],u.set=(e,t)=>e[n]=t,s=(0,r[y])({get:v.get,set:v.set},l),c._=1,s===void 0?OR(s)&&(v[h]=s):typeof s!=`object`||!s?xR(`Object expected`):(OR(o=s.get)&&(v.get=o),OR(o=s.set)&&(v.set=o),OR(o=s.init)&&g.unshift(o));return v&&pR(i,n,v),i},NR=(e,t,n)=>t.has(e)||xR(`Cannot `+n),PR=(e,t,n)=>(NR(e,t,`read from private field`),t.get(e)),FR=(e,t,n)=>t.has(e)?xR(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),IR=(e,t,n,r)=>(NR(e,t,`write to private field`),t.set(e,n),n);function LR(e){return e instanceof Cz||e instanceof Sz}var RR=10,zR=class extends vA{constructor(e){super(e);let t=XD(()=>{let{dragOperation:t}=e;if(cP(t.activatorEvent)&&LR(t.source)&&t.status.initialized){let t=e.registry.plugins.get(gI);if(t)return t.disable(),()=>t.enable()}}),n=e.monitor.addEventListener(`dragmove`,(e,t)=>{queueMicrotask(()=>{if(this.disabled||e.defaultPrevented||!e.nativeEvent)return;let{dragOperation:n}=t;if(!cP(e.nativeEvent)||!LR(n.source)||!n.shape)return;let{actions:r,collisionObserver:i,registry:a}=t,{by:o}=e;if(!o)return;let s=BR(o),{source:c,target:l}=n,{center:u}=n.shape.current,d=[],f=[];DD(()=>{for(let e of a.droppables){let{id:t}=e;if(!e.accepts(c)||t===l?.id&&LR(e)||!e.element)continue;let n=e.shape,r=new rP(e.element,{getBoundingClientRect:e=>CM(e,void 0,.2)});r.height&&r.width&&(s==`down`&&u.y+RR<r.center.y||s==`up`&&u.y-RR>r.center.y||s==`left`&&u.x-RR>r.center.x||s==`right`&&u.x+RR<r.center.x)&&(d.push(e),e.shape=r,f.push(()=>e.shape=n))}}),e.preventDefault(),i.disable();let p=i.computeCollisions(d,_P);DD(()=>f.forEach(e=>e()));let[m]=p;if(!m)return;let{id:h}=m,{index:g,group:_}=c.sortable;r.setDropTarget(h).then(()=>{let{source:e,target:t,shape:a}=n;if(!e||!LR(e)||!a)return;let{index:o,group:s,target:c}=e.sortable,l=g!==o||_!==s,u=l?c:t?.element;if(!u)return;GN(u);let d=new rP(u);if(!d)return;let f=Ek.delta(d,Ek.from(a.current.boundingRectangle),e.alignment);r.move({by:f}),l?r.setDropTarget(e.id).then(()=>i.enable()):i.enable()})})});this.destroy=()=>{n(),t()}}};function BR(e){let{x:t,y:n}=e;if(t>0)return`right`;if(t<0)return`left`;if(n>0)return`down`;if(n<0)return`up`}var VR=Object.defineProperty,HR=Object.defineProperties,UR=Object.getOwnPropertyDescriptors,WR=Object.getOwnPropertySymbols,GR=Object.prototype.hasOwnProperty,KR=Object.prototype.propertyIsEnumerable,qR=(e,t,n)=>t in e?VR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,JR=(e,t)=>{for(var n in t||={})GR.call(t,n)&&qR(e,n,t[n]);if(WR)for(var n of WR(t))KR.call(t,n)&&qR(e,n,t[n]);return e},YR=(e,t)=>HR(e,UR(t));function XR(e,t,n){if(t===n)return e;let r=e.slice();return r.splice(n,0,r.splice(t,1)[0]),r}function ZR(e,t){let n=String(t);return Object.prototype.hasOwnProperty.call(e,n)?n:void 0}function QR(e){return`initialIndex`in e&&typeof e.initialIndex==`number`&&`index`in e&&typeof e.index==`number`}function $R(e,t,n){let{source:r,target:i,canceled:a}=t.operation;if(!r||!i||a)return`preventDefault`in t&&t.preventDefault(),e;let o=(e,t)=>e===t||typeof e==`object`&&!!e&&`id`in e&&e.id===t;if(Array.isArray(e)){let s=e.findIndex(e=>o(e,r.id)),c=e.findIndex(e=>o(e,i.id));if(s===-1||c===-1){if(QR(r)){let i=r.initialIndex,a=r.index;return i===a||i<0||i>=e.length?(`preventDefault`in t&&t.preventDefault(),e):n(e,i,a)}return e}if(!a&&`index`in r&&typeof r.index==`number`){let t=r.index;if(t!==s)return n(e,s,t)}return n(e,s,c)}let s=Object.entries(e),c=-1,l,u=-1,d;for(let[e,t]of s)if(c===-1&&(c=t.findIndex(e=>o(e,r.id)),c!==-1&&(l=e)),u===-1&&(u=t.findIndex(e=>o(e,i.id)),u!==-1&&(d=e)),c!==-1&&u!==-1)break;if(c===-1&&QR(r)){let i=r.initialGroup==null?void 0:ZR(e,r.initialGroup),a=r.initialIndex,o=r.group==null?void 0:ZR(e,r.group),s=r.index;if(i==null||o==null||i===o&&a===s)return`preventDefault`in t&&t.preventDefault(),e;if(i===o)return YR(JR({},e),{[i]:n(e[i],a,s)});let c=e[i][a];return YR(JR({},e),{[i]:[...e[i].slice(0,a),...e[i].slice(a+1)],[o]:[...e[o].slice(0,s),c,...e[o].slice(s)]})}if(!r.manager)return e;let{dragOperation:f}=r.manager,p=f.shape?.current.center??f.position.current;if(d==null){let t=ZR(e,i.id);if(t!=null){let n=i.shape&&p.y>i.shape.center.y?e[t].length:0;d=t,u=n}}if(l==null||d==null||l===d&&c===u){if(l!=null&&l===d&&c===u&&QR(r)){let t=r.group==null?void 0:ZR(e,r.group),i=r.group!=null&&t!==l,a=r.index!==c;if(i||a){let i=r.group==null?l:t;if(i!=null){if(l===i)return YR(JR({},e),{[l]:n(e[l],c,r.index)});let t=e[l][c];return YR(JR({},e),{[l]:[...e[l].slice(0,c),...e[l].slice(c+1)],[i]:[...e[i].slice(0,r.index),t,...e[i].slice(r.index)]})}}}return`preventDefault`in t&&t.preventDefault(),e}if(l===d)return YR(JR({},e),{[l]:n(e[l],c,u)});let m=i.shape&&Math.round(p.y)>Math.round(i.shape.center.y)?1:0,h=e[l][c];return YR(JR({},e),{[l]:[...e[l].slice(0,c),...e[l].slice(c+1)],[d]:[...e[d].slice(0,u+m),h,...e[d].slice(u+m)]})}function ez(e,t){return $R(e,t,XR)}function tz(e){let t=new Map;for(let[,n]of e)for(let e of n)t.set(e.id,e.index);return t}function nz(e,t,n){for(let[r,i]of t)for(let t of i){let i=e.get(t.id);if(t.index!==i||t.group!==r||!n.get(r)?.has(t))return!0}return!1}var rz=`__default__`,iz=class extends vA{constructor(e){super(e);let t=()=>{let t=new Map;for(let n of e.registry.droppables)if(n instanceof Cz){let{sortable:e}=n,{group:r}=e,i=t.get(r);i||(i=new Set,t.set(r,i)),i.add(e)}return t},n=[e.monitor.addEventListener(`dragover`,(e,n)=>{if(this.disabled)return;let{dragOperation:r}=n,{source:i,target:a}=r;if(!LR(i)||!LR(a)||i.sortable===a.sortable)return;let o=t(),s=tz(o),c=i.sortable.group===a.sortable.group,l=o.get(i.sortable.group),u=c?l:o.get(a.sortable.group);l&&u&&queueMicrotask(()=>{e.defaultPrevented||n.renderer.rendering.then(()=>{let r=t();if(nz(s,o,r))return;let d=i.sortable.element,f=a.sortable.element;if(!f||!d||!c&&a.id===i.sortable.group)return;let p=cz(l),m=c?p:cz(u),h=i.sortable.group??rz,g=a.sortable.group??rz,_={[h]:p,[g]:m},v=ez(_,e);if(_===v)return;let y=v[g].indexOf(i.sortable),b=v[g].indexOf(a.sortable);n.collisionObserver.disable(),az(d,y,f,b),DD(()=>{for(let[e,t]of v[h].entries())t.index=e;if(!c)for(let[e,t]of v[g].entries())t.group=a.sortable.group,t.index=e}),n.actions.setDropTarget(i.id).then(()=>n.collisionObserver.enable())})})}),e.monitor.addEventListener(`dragend`,(e,n)=>{if(!e.canceled)return;let{dragOperation:r}=n,{source:i}=r;LR(i)&&(i.sortable.initialIndex!==i.sortable.index||i.sortable.initialGroup!==i.sortable.group)&&queueMicrotask(()=>{let e=t(),r=tz(e),a=e.get(i.sortable.initialGroup);a&&n.renderer.rendering.then(()=>{let n=t();if(nz(r,e,n))return;let o=cz(a),s=cz(a,sz),c=i.sortable.element,l=o[s.indexOf(i.sortable)],u=l?.element;l&&u&&c&&(az(c,l.index,u,i.index),DD(()=>{for(let t of e.values()){let e=Array.from(t).values();for(let t of e)t.index=t.initialIndex,t.group=t.initialGroup}}))})})})];this.destroy=()=>{for(let e of n)e()}}};function az(e,t,n,r){let i=r<t?`afterend`:`beforebegin`;n.insertAdjacentElement(i,e)}function oz(e,t){return e.index-t.index}function sz(e,t){return e.initialIndex-t.initialIndex}function cz(e,t=oz){return Array.from(e).sort(t)}var lz=[zR,iz],uz={duration:250,easing:`cubic-bezier(0.25, 1, 0.5, 1)`,idle:!1};function dz(e){return typeof e==`boolean`?{draggable:e,droppable:e}:{draggable:e?.draggable??!1,droppable:e?.droppable??!1}}var fz=new $O,pz,mz=[EO],hz,gz,_z,vz,yz,bz;pz=[EO];var xz=class{constructor(e,t){FR(this,gz,jR(hz,8,this)),jR(hz,11,this),FR(this,_z),FR(this,vz),FR(this,yz,jR(hz,12,this)),jR(hz,15,this),FR(this,bz),this.register=()=>(DD(()=>{var e,t;(e=this.manager)==null||e.registry.register(this.droppable),(t=this.manager)==null||t.registry.register(this.draggable)}),()=>this.unregister()),this.unregister=()=>{DD(()=>{var e,t;(e=this.manager)==null||e.registry.unregister(this.droppable),(t=this.manager)==null||t.registry.unregister(this.draggable)})},this.destroy=()=>{DD(()=>{this.droppable.destroy(),this.draggable.destroy()})};var n=e,{effects:r=()=>[],disabled:i,group:a,index:o,sensors:s,type:c,transition:l=uz,plugins:u}=n,d=TR(n,[`effects`,`disabled`,`group`,`index`,`sensors`,`type`,`transition`,`plugins`]);let f=nM(u,lz),p=dz(i);this.droppable=new Cz(wR(CR({},d),{disabled:p.droppable}),t,this),this.draggable=new Sz(wR(CR({},d),{disabled:p.draggable,plugins:f,effects:()=>[()=>{let e=this.manager?.dragOperation.status;e?.initializing&&this.id===this.manager?.dragOperation.source?.id&&fz.clear(this.manager),e?.dragging&&fz.set(this.manager,this.id,AD(()=>({initialIndex:this.index,initialGroup:this.group})))},()=>{let{index:e,group:t,manager:n}=this,r=PR(this,vz),i=PR(this,_z);(e!==r||t!==i)&&(IR(this,vz,e),IR(this,_z,t),this.animate())},()=>{let{target:e}=this,{isDragSource:t}=this.draggable;(this.draggable.pluginConfig(YF)?.feedback??`default`)===`move`&&t&&(this.droppable.disabled=!e)},...r()],type:c,sensors:s}),t,this),IR(this,bz,d.element),this.manager=t,this.index=o,IR(this,vz,o),this.group=a,IR(this,_z,a),this.type=c,this.transition=l}get initialIndex(){return fz.get(this.manager,this.id)?.initialIndex??this.index}get initialGroup(){return fz.get(this.manager,this.id)?.initialGroup??this.group}animate(){AD(()=>{let{manager:e,transition:t}=this,{shape:n}=this.droppable;if(!e)return;let{idle:r}=e.dragOperation.status;n&&t&&(!r||t.idle)&&e.renderer.rendering.then(()=>{let{element:r}=this;if(!r)return;for(let e of r.getAnimations())`transitionProperty`in e&&(e.transitionProperty===`transform`||e.transitionProperty===`translate`||e.transitionProperty===`scale`)&&e.cancel();let i=this.refreshShape();if(!i)return;let a={x:n.boundingRectangle.left-i.boundingRectangle.left,y:n.boundingRectangle.top-i.boundingRectangle.top},{translate:o}=kN(r),s=ZN(r,o,!1),c=ZN(r,o);if(a.x||a.y){let n=jM(hM(r))?wR(CR({},t),{duration:0}):t;XN({element:r,keyframes:{translate:[`${s.x+a.x}px ${s.y+a.y}px ${s.z}`,`${c.x}px ${c.y}px ${c.z}`]},options:n}).then(()=>{e.dragOperation.status.dragging||(this.droppable.shape=void 0)})}})})}get manager(){return this.draggable.manager}set manager(e){DD(()=>{this.draggable.manager=e,this.droppable.manager=e})}set element(e){DD(()=>{let t=PR(this,bz),n=this.droppable.element,r=this.draggable.element;(!n||n===t)&&(this.droppable.element=e),(!r||r===t)&&(this.draggable.element=e),IR(this,bz,e)})}get element(){let e=PR(this,bz);if(e)return LM.get(e)??e??this.droppable.element}set target(e){this.droppable.element=e}get target(){return this.droppable.element}set source(e){this.draggable.element=e}get source(){return this.draggable.element}get disabled(){let{disabled:e}=this.draggable,{disabled:t}=this.droppable;return e===t?e:{draggable:e,droppable:t}}set plugins(e){this.draggable.plugins=nM(e,lz)}set disabled(e){let t=dz(e);DD(()=>{this.droppable.disabled=t.droppable,this.draggable.disabled=t.draggable})}set data(e){DD(()=>{this.droppable.data=e,this.draggable.data=e})}set handle(e){this.draggable.handle=e}set id(e){this.droppable.id=e,this.draggable.id=e}get id(){return this.droppable.id}set sensors(e){this.draggable.sensors=e}set modifiers(e){this.draggable.modifiers=e}set collisionPriority(e){this.droppable.collisionPriority=e}set collisionDetector(e){this.droppable.collisionDetector=e??gP}set alignment(e){this.draggable.alignment=e}get alignment(){return this.draggable.alignment}set type(e){DD(()=>{this.droppable.type=e,this.draggable.type=e})}get type(){return this.draggable.type}set accept(e){this.droppable.accept=e}get accept(){return this.droppable.accept}get isDropTarget(){return this.droppable.isDropTarget}get isDragSource(){return this.draggable.isDragSource}get isDragging(){return this.draggable.isDragging}get isDropping(){return this.draggable.isDropping}get status(){return this.draggable.status}refreshShape(){return this.droppable.refreshShape()}accepts(e){return this.droppable.accepts(e)}};hz=ER(),gz=new WeakMap,_z=new WeakMap,vz=new WeakMap,yz=new WeakMap,bz=new WeakMap,MR(hz,4,`index`,mz,xz,gz),MR(hz,4,`group`,pz,xz,yz),AR(hz,xz);var Sz=class extends nL{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}get initialIndex(){return this.sortable.initialIndex}get group(){return this.sortable.group}get initialGroup(){return this.sortable.initialGroup}},Cz=class extends pL{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}get group(){return this.sortable.group}},wz=Object.defineProperty,Tz=Object.defineProperties,Ez=Object.getOwnPropertyDescriptors,Dz=Object.getOwnPropertySymbols,Oz=Object.prototype.hasOwnProperty,kz=Object.prototype.propertyIsEnumerable,Az=(e,t,n)=>t in e?wz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jz=(e,t)=>{for(var n in t||={})Oz.call(t,n)&&Az(e,n,t[n]);if(Dz)for(var n of Dz(t))kz.call(t,n)&&Az(e,n,t[n]);return e},Mz=(e,t)=>Tz(e,Ez(t));function Nz(e){let{accept:t,collisionDetector:n,collisionPriority:r,id:i,data:a,element:o,handle:s,index:c,group:l,disabled:u,modifiers:d,sensors:f,target:p,type:m,plugins:h}=e,g=jz(jz({},uz),e.transition),_=IL(t=>new xz(Mz(jz({},e),{transition:g,register:!1,handle:hL(s),element:hL(o),target:hL(p)}),t)),v=bL(_,Pz);return CL(i,()=>_.id=i),gL(()=>{DD(()=>{_.group=l,_.index=c})},[_,l,c]),CL(m,()=>_.type=m),CL(t,()=>_.accept=t,void 0,TO),CL(a,()=>a&&(_.data=a)),CL(c,()=>{_.manager?.dragOperation.status.idle&&g?.idle&&_.refreshShape()},xL),wL(s,e=>_.handle=e),wL(o,e=>_.element=e),wL(p,e=>_.target=e),CL(u,()=>_.disabled=u??!1,void 0,TO),CL(f,()=>_.sensors=f,void 0,TO),CL(n,()=>_.collisionDetector=n),CL(r,()=>_.collisionPriority=r),CL(h,()=>_.plugins=h,void 0,TO),CL(g,()=>_.transition=g,void 0,TO),CL(d,()=>_.modifiers=d,void 0,TO),CL(e.alignment,()=>_.alignment=e.alignment),{sortable:v,get isDragging(){return v.isDragging},get isDropping(){return v.isDropping},get isDragSource(){return v.isDragSource},get isDropTarget(){return v.isDropTarget},handleRef:(0,D.useCallback)(e=>{_.handle=e??void 0},[_]),ref:(0,D.useCallback)(e=>{(e||!_.element?.isConnected||_.manager?.dragOperation.status.idle)&&(_.element=e??void 0)},[_]),sourceRef:(0,D.useCallback)(e=>{(e||!_.source?.isConnected||_.manager?.dragOperation.status.idle)&&(_.source=e??void 0)},[_]),targetRef:(0,D.useCallback)(e=>{(e||!_.target?.isConnected||_.manager?.dragOperation.status.idle)&&(_.target=e??void 0)},[_])}}function Pz(e,t,n){return!(e!==`isDragSource`||n||!t)}function Fz({format:e,className:t}){return(0,H.jsx)(e===`html`?te:oe,{className:ab(`size-4 shrink-0`,e===`html`?`text-format-html`:`text-format-markdown`,t),"data-format":e,"aria-hidden":`true`})}var Iz=`Input and generated documents`,Lz=`Outside a repository`,Rz=`Checking repositories`,zz=`Unknown checkout`;function Bz(){return{directories:new Map,documents:[]}}function Vz(e,t,n,r){let i=e;for(let e of t){let t=i.directories.get(e);t||(t=Bz(),i.directories.set(e,t)),i=t}i.documents.push({document:n,name:r})}function Hz(e,t){let n=[];for(let[r,i]of e.directories){let e=r,a=i;for(;a.documents.length===0&&a.directories.size===1;){let[t,n]=[...a.directories.entries()][0];e=`${e}/${t}`,a=n}let o=`${t}/${e}`;n.push({kind:`directory`,key:o,name:e,children:Hz(a,o)})}for(let{document:t,name:r}of e.documents)n.push({kind:`document`,key:t.documentId,name:r,document:t});return n}function Uz(e){return e.replace(/[\\/]\.git$/,``)}function Wz(e,t=Je(e)){let n=new Map,r=Bz(),i=Bz(),a=[],o=!1,s=!1;for(let c of e){let e=Ge(c);if(e.kind===`input`){a.push(c);continue}if(e.kind===`pending`||e.kind===`outside`){Vz(e.kind===`pending`?r:i,c.pathSegments.slice(0,-1),c,Xe(c)),e.kind===`pending`?o=!0:s=!0;continue}let l=n.get(e.key);l||(l={key:e.key,name:t.repository.get(e.key)??e.repository.nameSegments.at(-1)??``,location:Uz(e.repository.id),reason:e.kind===`unresolved`?e.repository.reason:null,main:Bz(),unknown:null,worktrees:new Map},n.set(e.key,l));let u=Ye(c),d=Xe(c),f=e.kind===`repository`?e.repository.checkout:void 0;if(f===null)l.unknown??=Bz(),Vz(l.unknown,u,c,d);else if(f?.kind===`linked`){let e=l.worktrees.get(f.id);e||(e={name:t.worktree.get(f.id)??f.name,location:f.id,branch:Bz()},l.worktrees.set(f.id,e)),Vz(e.branch,u,c,d)}else Vz(l.main,u,c,d)}let c=[];for(let e of n.values()){let t=Hz(e.main,e.key);if(e.unknown){let n=`${e.key}\0unknown`;t.push({kind:`group`,key:n,name:zz,children:Hz(e.unknown,n)})}let n=e.main.documents.length===0&&e.main.directories.size===0&&e.unknown===null&&e.worktrees.size===1;for(let[r,i]of e.worktrees){let a=`${e.key}\0worktree:${r}`;t.push({kind:`worktree`,key:a,name:i.name,location:i.location,hidden:n,children:Hz(i.branch,a)})}c.push({kind:`repository`,key:e.key,name:e.name,location:e.location,reason:e.reason,merged:n?[...e.worktrees.values()][0]?.name??null:null,children:t})}return o&&c.push({kind:`group`,key:`group:pending`,name:Rz,children:Hz(r,`group:pending`)}),s&&c.push({kind:`group`,key:`group:outside`,name:Lz,children:Hz(i,`group:outside`)}),a.length>0&&c.push({kind:`group`,key:`group:input`,name:Iz,children:a.map(e=>({kind:`document`,key:e.documentId,name:e.title,document:e}))}),c}var Gz={missing:{label:`File missing`,icon:ce},unreadable:{label:`Unreadable`,icon:B},updating:{label:`Updating`,icon:Ne},error:{label:`error`,icon:L}},Kz=`px-0.5 @min-[13rem]/list:px-2 @min-[13rem]/list:row-open:px-0.5`,qz=`@min-[13rem]/list:hidden @min-[13rem]/list:row-open:inline`,Jz=`sr-only @min-[13rem]/list:not-sr-only @min-[13rem]/list:row-open:sr-only`,Yz={badge:`px-0.5`,icon:``,text:`sr-only`};function Xz({document:e}){let t=e.sourceState===`ready`?null:Gz[e.sourceState],n=t?.icon??L,r=e.pendingRequestIds.length>0?Yz:{badge:Kz,icon:qz,text:Jz};return(0,H.jsxs)(H.Fragment,{children:[e.sourceState!==`ready`&&(0,H.jsxs)(pE,{variant:`outline`,className:ab(`shrink-0`,r.badge),title:t?.label??e.sourceState,children:[(0,H.jsx)(n,{className:r.icon,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:r.text,children:t?.label??e.sourceState})]}),e.pendingRequestIds.length>0&&(0,H.jsxs)(pE,{className:ab(`shrink-0`,Kz),"data-testid":`pending-question`,title:`A question is awaiting your answer`,children:[(0,H.jsx)(xe,{className:qz,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:Jz,children:`Question`})]})]})}function Zz(e,t,n){let r=[...e],[i]=r.splice(t,1);return i!==void 0&&r.splice(n,0,i),r}function Qz(e,t){let n=Ge(e),r=[We(et(e,t)),Ve[e.format]];return n.kind===`unresolved`&&r.push(He[n.repository.reason]),r.join(`. `)}function $z(e,t,n=!1){let r=[e.title,We(et(e,t))];return e.canonicalPath!==null&&r.push(e.canonicalPath),n&&(r.push(`Drag to reorder. Space picks up, ↑↓ moves, Space drops, Escape cancels.`),r.push(`Alt+↑ / Alt+↓ moves it in the list`)),[...new Set(r)].join(`
|
|
162
|
-
`)}function
|
|
163
|
-
`),children:[e.reason===null?(0,H.jsx)(V,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}):(0,H.jsx)(L,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,H.jsx)(`bdi`,{className:`max-w-[60%] shrink-0 truncate`,children:We(e.name)}),e.merged!==null&&(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 font-normal text-muted-foreground`,children:[(0,H.jsx)(pe,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`bdi`,{className:`truncate`,children:We(e.merged)})]}),o!==null&&(0,H.jsx)(`span`,{className:`sr-only`,children:o})]}),(0,H.jsx)(sB,{nodes:e.children,depth:t+1,labels:n,props:r})]},e.key)}case`worktree`:return(0,H.jsxs)(`li`,{role:`treeitem`,"aria-expanded":`true`,"aria-label":`Worktree ${We(e.name)}`,"data-node":`worktree`,children:[(0,H.jsxs)(`div`,{className:e.hidden?`sr-only`:ab(oB,`top-7 z-10`),style:e.hidden?void 0:i(t),title:e.location,children:[(0,H.jsx)(pe,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,H.jsx)(`bdi`,{className:`truncate`,children:We(e.name)})]}),(0,H.jsx)(sB,{nodes:e.children,depth:e.hidden?t:t+1,labels:n,props:r})]},e.key);case`group`:case`directory`:return(0,H.jsxs)(`li`,{role:`treeitem`,"aria-expanded":`true`,"aria-label":We(e.name),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 text-xs text-muted-foreground`,style:i(t),children:[(0,H.jsx)(de,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`bdi`,{className:`truncate`,children:We(e.name)})]}),(0,H.jsx)(sB,{nodes:e.children,depth:t+1,labels:n,props:r})]},e.key);default:return null}})})}function cB(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return r.bottom>n.top&&r.top<n.bottom}function lB(e,t){return e.querySelector(`[data-document-id="${CSS.escape(t)}"]`)}function uB(e){let t=(0,D.useRef)(null);(0,D.useEffect)(()=>{let n=e.current;if(!n)return;let r=e=>{let r=e.target.closest(`li`)?.querySelector(`[data-document-id]`),i=r?.dataset.documentId;t.current=r&&i!==void 0?{documentId:i,visible:cB(n,r)}:null},i=e=>{let r=e.target;setTimeout(()=>{r.isConnected&&(n.contains(globalThis.document.activeElement)||(t.current=null))},0)},a=()=>{let e=t.current;if(!e)return;let r=lB(n,e.documentId);e.visible=r!==null&&cB(n,r)};return n.addEventListener(`focusin`,r),n.addEventListener(`focusout`,i),n.addEventListener(`scroll`,a,{passive:!0}),()=>{n.removeEventListener(`focusin`,r),n.removeEventListener(`focusout`,i),n.removeEventListener(`scroll`,a)}},[e]),(0,D.useLayoutEffect)(()=>{let n=e.current,r=t.current;if(!n||!r)return;let i=lB(n,r.documentId);if(!i){t.current=null;return}let a=globalThis.document.activeElement;(a===null||a===globalThis.document.body)&&i.focus({preventScroll:!0}),r.visible&&!cB(n,i)&&i.scrollIntoView({block:`nearest`}),r.visible=cB(n,i)})}function dB({documents:e,snapshot:t,onChanged:n,onFinished:r}){let i=FL(),{source:a}=dR();return(0,D.useEffect)(()=>{t&&(a?!i?.dragOperation.controller?.signal.aborted&&(t.length!==e.length||t.some((t,n)=>t.documentId!==e[n]?.documentId))&&(n(),i?.actions.stop({canceled:!0})):r())},[e,t,a,i,n,r]),null}function fB(e){let{documents:t,activeId:n,view:r,onViewChange:i,onSelect:a,onClose:o,onReorder:s}=e,[c,l]=(0,D.useState)(null),[u,d]=(0,D.useState)(null),f=t.map(e=>e.documentId),p=e.labels,m=(0,D.useMemo)(()=>p??Je(t),[p,t]),h=(0,D.useRef)(null),g=(0,D.useMemo)(()=>Qe(t),[t]),_=(0,D.useMemo)(()=>r===`tree`?Wz(t,m):[],[t,m,r]),v=(0,D.useRef)(null);return uB(v),(0,H.jsxs)(`nav`,{"aria-label":`Open documents`,className:`flex h-full min-h-0 flex-col`,onPointerDownCapture:e=>{h.current=e.target.closest(`button`)},children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-3 py-2`,children:[(0,H.jsxs)(`h2`,{className:`text-sm font-medium`,children:[`Open documents (`,t.length,`)`]}),u&&(0,H.jsx)(vx,{title:`Order not changed`,trigger:(0,H.jsx)(pb,{variant:`ghost`,size:`icon-xs`,"aria-label":`Order not changed`,className:`text-destructive`,children:(0,H.jsx)(L,{"aria-hidden":`true`})}),children:(0,H.jsx)(`p`,{children:u})}),(0,H.jsx)(`span`,{role:`status`,className:`sr-only`,children:u}),(0,H.jsxs)(SE,{value:[r],onValueChange:e=>{let t=e[0];(t===`flat`||t===`tree`)&&i(t)},size:`sm`,"aria-label":`List layout`,children:[(0,H.jsx)(CE,{value:`flat`,children:`Flat`}),(0,H.jsx)(CE,{value:`tree`,children:`Tree`})]})]}),(0,H.jsx)(`div`,{ref:v,className:ab(`@container/list min-h-0 flex-1 overflow-y-auto p-2`,r===`tree`&&`scroll-pt-14`),children:t.length===0?(0,H.jsxs)(`p`,{className:`px-2 py-4 text-sm text-muted-foreground`,children:[`No documents are open. Run `,(0,H.jsx)(`code`,{children:`vo <file>`}),` in the CLI to show them here.`]}):r===`tree`?(0,H.jsx)(sB,{nodes:_,depth:0,labels:m,props:{activeId:n,onSelect:a,onClose:o}}):(0,H.jsxs)(NL,{onDragStart:()=>{l(t),d(null)},onDragEnd:e=>{if(e.canceled||!e.operation.target||!LR(e.operation.source))return;let n=e.operation.source;if(n.initialIndex===n.index)return;let r=(c??t).map(e=>e.documentId);if(r.length!==f.length||r.some((e,t)=>e!==f[t])){d(`The document list changed while dragging. Drag again to reorder the current list.`);return}s(Zz(f,n.initialIndex,n.index))},children:[(0,H.jsx)(dB,{documents:t,snapshot:c,onChanged:()=>d(`The document list changed while dragging. Drag again to reorder the current list.`),onFinished:()=>l(null)}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(c??t).map((e,r)=>(0,H.jsx)(iB,{document:e,index:r,count:(c??t).length,labels:m,short:g.get(e.documentId),active:e.documentId===n,pressedOn:h,onSelect:()=>a(e.documentId),onClose:()=>o(e.documentId),onMove:e=>s(Zz(f,r,e))},e.documentId))}),(0,H.jsx)(LL,{dropAnimation:{duration:180,easing:`ease-out`},children:e=>{let n=(c??t).find(t=>t.documentId===e.id);return n?(0,H.jsxs)(`div`,{"aria-hidden":`true`,"data-testid":`drag-card`,className:`rounded-md border border-primary bg-background p-3 text-sm shadow-lg`,children:[(0,H.jsxs)(`p`,{className:`flex items-center gap-2 font-medium`,children:[(0,H.jsx)(Fz,{format:n.format}),n.title]}),(0,H.jsx)(`p`,{className:`mt-1 truncate text-xs text-muted-foreground`,children:We(et(n,m))})]}):null}})]})})]})}var pB=`document`,mB=`section`,hB=`heading`;function gB(){return new URLSearchParams(window.location.search).get(pB)}function _B(){let e=new URLSearchParams(window.location.search),t=e.get(mB),n=e.get(hB);return t===null||n===null?null:{sectionId:t,title:n}}function vB(e,t){let n=new URL(window.location.href);n.searchParams.get(pB)!==e&&(n.searchParams.delete(mB),n.searchParams.delete(hB)),e===null?n.searchParams.delete(pB):n.searchParams.set(pB,e),n.href!==window.location.href&&(t===`push`?window.history.pushState(null,``,n):window.history.replaceState(null,``,n))}function yB(e,t){let n=new URL(window.location.href);n.searchParams.get(pB)===e&&(t===null?(n.searchParams.delete(mB),n.searchParams.delete(hB)):(n.searchParams.set(mB,t.sectionId),n.searchParams.set(hB,t.title)),n.href!==window.location.href&&window.history.replaceState(null,``,n))}function bB(e){let t=!1,n=null,r=async()=>{let r=!1;for(;t;){t=!1;try{await e(),r=!0}catch{r=!1}}return n=null,r};return()=>(t=!0,n??=r(),n)}var xB=180,SB=480,CB=260;function wB(e,t){if(t===null)return e;let n=new Map(e.map(e=>[e.documentId,e])),r=t.flatMap(e=>n.get(e)??[]),i=new Set(t),a=e.filter(e=>!i.has(e.documentId));return[...r,...a]}var TB=e=>typeof e==`number`&&e>=xB&&e<=SB;function EB(){let[e,t]=PE(`theme`,`system`,FE),[n,r]=PE(`color-palette`,`standard`,LE);return(0,D.useEffect)(()=>{let t=window.matchMedia(`(prefers-color-scheme: dark)`),r=()=>RE(e,n);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e,n]),{theme:e,setTheme:t,palette:n,setPalette:r}}function DB({api:e}){let[t,n]=(0,D.useState)({documents:[],version:0}),[r,i]=(0,D.useState)({activeId:null,initialized:!1,history:`replace`,requestedAt:0,restore:null,restores:0}),[a,o]=(0,D.useState)(null),s=(0,D.useMemo)(()=>wB(t.documents,a),[t.documents,a]),{activeId:c}=r,l=(0,D.useCallback)((e,t=0)=>{i(n=>n.activeId===e?t>n.requestedAt?{...n,requestedAt:t}:n:{...n,activeId:e,history:`push`,requestedAt:t,restore:null})},[]),u=(0,D.useCallback)(e=>{c!==null&&yB(c,e)},[c]),d=(0,D.useRef)(s);(0,D.useEffect)(()=>{d.current=s},[s]);let f=(0,D.useRef)(!1);(0,D.useEffect)(()=>{r.initialized&&(vB(r.activeId,f.current?r.history:`replace`),f.current=!0)},[r]),(0,D.useEffect)(()=>{let e=()=>{let e=gB(),t=_B();i(n=>{if(!n.initialized)return n;if(!(e===n.activeId||d.current.some(t=>t.documentId===e))||e===null)return{...n,history:`replace`};let r=n.restores+1;return{...n,activeId:e,history:`replace`,requestedAt:e===n.activeId?n.requestedAt:0,restore:t===null?null:{...t,id:r},restores:r}})};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);let[p,m]=(0,D.useState)(null),[h,g]=PE(`sidebar-view`,`flat`,zE),[_,v]=PE(`sidebar-width`,CB,TB),{theme:y,setTheme:b,palette:x,setPalette:S}=EB(),C=(0,D.useRef)(null),[w,T]=(0,D.useState)(0),[E,O]=(0,D.useState)(0),[k,A]=(0,D.useState)(!1),[j,M]=(0,D.useState)(!1),[N,P]=(0,D.useState)(null);(0,D.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()===`k`&&(e.preventDefault(),A(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let F=e=>{l(e.documentId),i(e=>e.restore===null?e:{...e,restore:null}),P(t=>({documentId:e.documentId,sectionId:e.sectionId,revision:e.revision,nonce:(t?.nonce??0)+1}))},I=(0,D.useCallback)(async()=>{let[t,r]=await Promise.all([e.documents(),e.status()]);n({documents:t.documents,version:t.catalogVersion}),i(e=>{let n=e=>e!==null&&t.documents.some(t=>t.documentId===e),i=t.catalogVersion<e.requestedAt;if(n(e.activeId)||i&&e.activeId!==null)return e.initialized?e:{...e,initialized:!0,history:`replace`};let a=gB(),o=e.initialized?null:[a,r.activeDocumentId].find(n)??null,s=o!==null&&o===a?_B():null,c=e.restores+1;return{...e,activeId:o??t.documents[0]?.documentId??null,initialized:!0,history:`replace`,requestedAt:0,restore:s===null?null:{...s,id:c},restores:c}})},[e]),L=(0,D.useMemo)(()=>bB(I),[I]),R=(0,D.useRef)({chain:Promise.resolve(),pending:0,drained:0}),z=(0,D.useCallback)(async()=>{let e=R.current,t=e.pending===0,n=e.drained;await L()&&t&&e.pending===0&&e.drained===n&&o(null)},[L]);(0,D.useEffect)(()=>{let t=e.events({onEvent:e=>{let t=C.current;if(C.current={daemonId:e.daemonId,sequence:e.sequence},e.type===`daemon-stopping`){m(`The daemon has stopped. Run the CLI to open it again.`);return}e.type===`focus-requested`&&e.documentId&&l(e.documentId,e.catalogVersion);let n=t!==null&&(t.daemonId!==e.daemonId||e.sequence>t.sequence+1);(e.type===`feedback-changed`||e.type===`resync-required`||n)&&T(e=>e+1),e.type===`render-diagnostics`&&O(e=>e+1),(e.type!==`hello`||n)&&z()},onConnect:()=>{m(null),T(e=>e+1),z()}});return()=>t.close()},[e,z,l]);let ee=(0,D.useMemo)(()=>s.find(e=>e.documentId===c)??null,[s,c]),te=(0,D.useMemo)(()=>Je(s),[s]),ne=(0,D.useRef)(0);return(0,D.useEffect)(()=>{ne.current=Math.max(ne.current,t.version)},[t.version]),(0,H.jsxs)(`div`,{className:`flex h-svh flex-col bg-background text-foreground`,children:[(0,H.jsxs)(`header`,{className:`flex min-w-0 items-center justify-between gap-2 border-b px-4 py-2 sm:gap-3`,children:[(0,H.jsxs)(pb,{variant:`ghost`,size:`sm`,className:`min-[900px]:hidden`,"aria-expanded":j,"aria-controls":`document-list`,onClick:()=>M(e=>!e),children:[j?(0,H.jsx)(ze,{"aria-hidden":`true`}):(0,H.jsx)(ye,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`max-sm:sr-only`,children:`Document list`})]}),(0,H.jsx)(`p`,{className:`shrink-0 text-sm font-semibold`,children:`vde-open`}),(0,H.jsxs)(pb,{variant:`outline`,size:`sm`,className:`ml-auto`,onClick:()=>A(!0),"aria-keyshortcuts":`Meta+K Control+K`,children:[(0,H.jsx)(Fe,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`max-sm:sr-only`,children:`Search open documents`}),(0,H.jsx)(`kbd`,{className:`ml-1 text-xs text-muted-foreground max-sm:hidden`,children:`⌘K`})]}),(0,H.jsxs)(vx,{title:`Color palette`,trigger:(0,H.jsx)(pb,{variant:`outline`,size:`icon-sm`,"aria-label":`Color palette`,title:`Color palette: ${IE.find(e=>e.value===x)?.label}`,children:(0,H.jsx)(De,{"aria-hidden":`true`})}),children:[(0,H.jsx)(`label`,{htmlFor:`color-palette`,className:`font-medium`,children:`Palette`}),(0,H.jsx)(`select`,{id:`color-palette`,value:x,onChange:e=>{LE(e.target.value)&&S(e.target.value)},className:`h-9 w-full rounded-md border border-input bg-background px-3 text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:IE.map(e=>(0,H.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,H.jsxs)(SE,{value:[y],onValueChange:e=>{let t=e[0];FE(t)&&b(t)},size:`sm`,"aria-label":`Color scheme`,children:[(0,H.jsx)(CE,{value:`light`,"aria-label":`Light`,children:(0,H.jsx)(Le,{"aria-hidden":`true`})}),(0,H.jsx)(CE,{value:`dark`,"aria-label":`Dark`,children:(0,H.jsx)(Te,{"aria-hidden":`true`})}),(0,H.jsx)(CE,{value:`system`,"aria-label":`Match OS setting`,children:(0,H.jsx)(Ce,{"aria-hidden":`true`})})]})]}),p&&(0,H.jsx)(`p`,{role:`status`,className:`border-b bg-muted px-4 py-2 text-sm`,children:p}),(0,H.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,children:[(0,H.jsx)(`div`,{id:`document-list`,className:`${j?`block`:`hidden`} absolute inset-y-0 left-0 z-20 w-72 max-w-[85vw] shrink-0 border-r bg-background shadow-lg min-[900px]:static min-[900px]:block min-[900px]:max-w-none min-[900px]:shadow-none`,style:{width:j?void 0:_},children:(0,H.jsx)(fB,{documents:s,labels:te,activeId:c,view:h,onViewChange:g,onSelect:e=>{l(e),M(!1)},onClose:t=>void e.close(t).then(L,L),onReorder:t=>{o(t);let n=R.current;n.pending+=1,n.chain=n.chain.then(async()=>{try{let n=await e.reorder(t,ne.current);ne.current=Math.max(ne.current,n)}catch{}--n.pending,n.pending===0&&(n.drained+=1,z())})}})}),(0,H.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize document list`,className:`hidden w-1 shrink-0 cursor-col-resize hover:bg-border min-[900px]:block`,onPointerDown:e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&v(Math.min(SB,Math.max(xB,e.clientX)))}}),ee?(0,H.jsx)(nt,{value:te,children:(0,H.jsx)(fD,{documents:s,api:e,document:ee,feedbackSignal:w,renderSignal:E,sectionTarget:N?.documentId===ee.documentId?N:null,restoreHeading:r.restore,onHeadingShown:u})}):(0,H.jsx)(`main`,{className:`flex flex-1 items-center justify-center p-8 text-sm text-muted-foreground`,children:`Select a document from the list on the left to show it here.`})]}),(0,H.jsx)(wD,{api:e,open:k,onOpenChange:A,onSelect:F})]})}function OB(){let[e,t]=(0,D.useState)(`loading`);(0,D.useEffect)(()=>{WS().then(e=>t(e?{token:e}:`missing`))},[]);let n=(0,D.useMemo)(()=>typeof e==`object`?KS(e.token,()=>{GS(),t(`missing`)}):null,[e]);return e===`loading`?null:n?(0,H.jsx)(DB,{api:n}):(0,H.jsxs)(`main`,{className:`mx-auto flex min-h-svh max-w-lg flex-col justify-center gap-3 p-8`,children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Open again from the CLI`}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`This UI must be opened from the one-time URL that the CLI issues. Run`,` `,(0,H.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5`,children:`vo ui`}),` in your terminal.`]})]})}RE(NE(`theme`,`system`,FE),NE(`color-palette`,`standard`,LE));var kB=document.getElementById(`root`);if(!kB)throw Error(`#root not found`);(0,Be.createRoot)(kB).render((0,H.jsx)(D.StrictMode,{children:(0,H.jsx)(OB,{})}));
|
|
161
|
+
`.replace(/\n+/g,` `).replace(/\s+/g,` `).trim();function TF(e,t=`hidden`){return DD(()=>{let{element:n,manager:r}=e;if(!n||!r)return;let i=EF(n,r.registry.droppables),a=[],o=kM(n),{remove:s}=o;return DF(i,o,a),OF(o,t),o.remove=()=>{a.forEach(e=>e()),s.call(o)},o})}function EF(e,t){let n=new Map;for(let r of t)if(r.element&&(e===r.element||e.contains(r.element))){let e=`${_F}${uP(`dom-id`)}`;r.element.setAttribute(e,``),n.set(r,e)}return n}function DF(e,t,n){for(let[r,i]of e){if(!r.element)continue;let e=`[${i}]`,a=t.matches(e)?t:t.querySelector(e);if(r.element.removeAttribute(i),!a)continue;let o=r.element;r.proxy=a,a.removeAttribute(i),PM.set(o,a),n.push(()=>{PM.delete(o),r.proxy=void 0})}}function OF(e,t=`hidden`){e.setAttribute(`inert`,`true`),e.setAttribute(`tab-index`,`-1`),e.setAttribute(`aria-hidden`,`true`),e.setAttribute(xF,t)}function kF(e,t){return e===t||LM(e)===LM(t)}function AF(e){let{target:t}=e;`newState`in e&&e.newState===`closed`&&iP(t)&&t.hasAttribute(`popover`)&&requestAnimationFrame(()=>_N(t))}function jF(e){return e.tagName===`TR`}function MF(e,t,n){let r=new MutationObserver(r=>{let i=!1;for(let n of r){if(n.target!==e){i=!0;continue}if(n.type!==`attributes`)continue;let r=n.attributeName;if(r.startsWith(`aria-`)||SF.includes(r))continue;let a=e.getAttribute(r);if(r===`style`){if(nP(e)&&nP(t)){let n=e.style;for(let e of Array.from(t.style))n.getPropertyValue(e)===``&&t.style.removeProperty(e);for(let e of Array.from(n)){if(CF.includes(e)||e.startsWith(yF))continue;let r=n.getPropertyValue(e);t.style.setProperty(e,r)}}}else a===null?t.removeAttribute(r):t.setAttribute(r,a)}i&&n&&t.replaceChildren(...e.cloneNode(!0).childNodes)});return r.observe(e,{attributes:!0,subtree:!0,childList:!0}),r}function NF(e,t,n){let r=new MutationObserver(r=>{for(let i of r)if(i.addedNodes.length!==0)for(let r of Array.from(i.addedNodes)){if(r.contains(e)&&e.nextElementSibling!==t){e.insertAdjacentElement(`afterend`,t),_N(n);return}if(r.contains(t)&&t.previousElementSibling!==e){t.insertAdjacentElement(`beforebegin`,e),_N(n);return}}e.isConnected&&t.isConnected&&e.nextElementSibling!==t&&(e.insertAdjacentElement(`afterend`,t),_N(n))});return r.observe(e.ownerDocument.body,{childList:!0,subtree:!0}),r}function PF(e){return new ResizeObserver(()=>{var t;let n=new eP(e.placeholder,{frameTransform:e.frameTransform,ignoreTransforms:!0}),r=e.transformOrigin??{x:1,y:1},i=(e.width-n.width)*r.x+e.delta.x,a=(e.height-n.height)*r.y+e.delta.y,o=TM();if(e.styles.set({width:n.width-e.widthOffset,height:n.height-e.heightOffset,top:e.top+a+o.y,left:e.left+i+o.x},yF),(t=e.getElementMutationObserver())==null||t.takeRecords(),jF(e.element)&&jF(e.placeholder)){let t=Array.from(e.element.cells),n=Array.from(e.placeholder.cells);e.getSavedCellWidths()||e.setSavedCellWidths(t.map(e=>e.style.width));for(let[e,r]of t.entries()){let t=n[e];r.style.width=`${t.getBoundingClientRect().width}px`}}let s=e.getTranslate()??{x:0,y:0},c=e.left+i+o.x+s.x,l=e.top+a+o.y+s.y,u=n.width-e.widthOffset,d=n.height-e.heightOffset,f=e.frameTransform;e.dragOperation.shape=new Ck(c*f.scaleX+f.x,l*f.scaleY+f.y,u*f.scaleX,d*f.scaleY)})}var FF=250,IF=`ease`;function LF(e){var t;let{animation:n}=e;if(typeof n==`function`){let t=n({source:e.source,element:e.element,feedbackElement:e.feedbackElement,placeholder:e.placeholder,translate:e.translate,moved:e.moved});Promise.resolve(t).then(()=>{e.cleanup(),requestAnimationFrame(e.restoreFocus)});return}let{duration:r=FF,easing:i=IF}=n??{};_N(e.feedbackElement);let[,a]=cM(e.feedbackElement,e=>`translate`in e)??[];a?.pause();let o=e.placeholder??e.element,s={frameTransform:kF(e.feedbackElement,o)?null:void 0},c=new eP(e.feedbackElement,s),l=FN(EN(e.feedbackElement).translate)??e.translate,u=new eP(o,s),d=Ck.delta(c,u,e.alignment),f={x:l.x-d.x,y:l.y-d.y},p=Math.round(c.intrinsicHeight)===Math.round(u.intrinsicHeight)?{}:{minHeight:[`${c.intrinsicHeight}px`,`${u.intrinsicHeight}px`],maxHeight:[`${c.intrinsicHeight}px`,`${u.intrinsicHeight}px`]},m=Math.round(c.intrinsicWidth)===Math.round(u.intrinsicWidth)?{}:{minWidth:[`${c.intrinsicWidth}px`,`${u.intrinsicWidth}px`],maxWidth:[`${c.intrinsicWidth}px`,`${u.intrinsicWidth}px`]};e.styles.set({transition:e.transition},yF),e.feedbackElement.setAttribute(vF,``),(t=e.getElementMutationObserver())==null||t.takeRecords(),qN({element:e.feedbackElement,keyframes:DP(EP(EP({},p),m),{translate:[`${l.x}px ${l.y}px 0`,`${f.x}px ${f.y}px 0`]}),options:{duration:OM(fM(e.feedbackElement))?0:e.moved||e.feedbackElement!==e.element?r:0,easing:i}}).then(()=>{e.feedbackElement.removeAttribute(vF),a?.finish(),e.cleanup(),requestAnimationFrame(e.restoreFocus)})}var RF,zF,BF,VF,HF,UF,WF,GF=class extends (zF=hA,RF=[CO],zF){constructor(e,t){super(e,t),BP(this,HF),BP(this,VF,FP(BF,8,this)),FP(BF,11,this),this.state={initial:{},current:{}};let n=e.registry.plugins.get(hF),r=n?.register(wF);if(r){let e=this.destroy.bind(this);this.destroy=()=>{r(),e()}}this.registerEffect(HP(this,HF,UF).bind(this,n)),this.registerEffect(HP(this,HF,WF))}};BF=AP(zF),VF=new WeakMap,HF=new WeakSet,UF=function(e){let{overlay:t}=this;if(!t||!e)return;let n=DM(t);if(n)return e.addRoot(n)},WF=function(){let{state:e,manager:t,options:n}=this,{dragOperation:r}=t,{position:i,source:a,status:o}=r;if(o.idle){e.current={},e.initial={};return}if(!a)return;let{element:s}=a,c=a.pluginConfig(GF),l=c?.feedback??n?.feedback??`default`,u=typeof l==`function`?l(a,t):l;if(!s||u===`none`||!o.initialized||o.initializing)return;let{initial:d}=e,f=this.overlay??s,p=MN(f),m=MN(s),h=!kF(s,f),g=new eP(s,{frameTransform:h?m:null,ignoreTransforms:!h}),_={x:m.scaleX/p.scaleX,y:m.scaleY/p.scaleY},{width:v,height:y,top:b,left:x}=g;h&&(v/=_.x,y/=_.y);let S=new rP(f),C=EN(s),{transition:w,translate:T,boxSizing:E,paddingBlockStart:D,paddingBlockEnd:O,paddingInlineStart:k,paddingInlineEnd:A,borderInlineStartWidth:j,borderInlineEndWidth:M,borderBlockStartWidth:N,borderBlockEndWidth:P}=C,F=w.split(`,`).filter(e=>!/^\s*(transform|translate|scale)\b/.test(e)).join(`,`),I=IN(C),L=C.transform,R=u===`clone`,z=E===`content-box`,ee=z?parseInt(k)+parseInt(A)+parseInt(j)+parseInt(M):0,te=z?parseInt(D)+parseInt(O)+parseInt(N)+parseInt(P):0,ne=u!==`move`&&!this.overlay?TF(a,R?`clone`:`hidden`):null,re=DD(()=>aP(t.dragOperation.activatorEvent));if(!d.translate){if(this.overlay&&I)d.translate={x:I.x,y:I.y};else if(T!==`none`){let e=FN(T);e&&(d.translate=e)}}if(!d.transformOrigin){let e=DD(()=>i.current),t=x+(I?.x??0),n=b+(I?.y??0);d.transformOrigin={x:(e.x-t*p.scaleX-p.x)/(v*p.scaleX),y:(e.y-n*p.scaleY-p.y)/(y*p.scaleY)}}let{transformOrigin:ie}=d,B=b*p.scaleY+p.y,ae=x*p.scaleX+p.x;if(!d.coordinates&&(d.coordinates={x:ae,y:B},_.x!==1||_.y!==1)){let{scaleX:e,scaleY:t}=m,{x:n,y:r}=ie;d.coordinates.x+=(v*e-v)*n,d.coordinates.y+=(y*t-y)*r}d.dimensions||={width:v,height:y},d.frameTransform||=p;let oe={x:d.coordinates.x-ae,y:d.coordinates.y-B},se={width:(d.dimensions.width*d.frameTransform.scaleX-v*p.scaleX)*ie.x,height:(d.dimensions.height*d.frameTransform.scaleY-y*p.scaleY)*ie.y},ce={x:oe.x/p.scaleX+se.width,y:oe.y/p.scaleY+se.height},le={left:x+ce.x,top:b+ce.y};f.setAttribute(bF,`true`);let V=DD(()=>r.transform),ue=d.translate??{x:0,y:0},de=V.x*p.scaleX+ue.x,fe=V.y*p.scaleY+ue.y,pe=TM();S.set({width:v-ee,height:y-te,top:le.top+pe.y,left:le.left+pe.x,translate:`${de}px ${fe}px 0`,transform:this.overlay?`none`:L,transition:F?`${F}, translate 0ms linear`:`translate 0ms linear`,scale:h?`${_.x} ${_.y}`:``,"transform-origin":`${ie.x*100}% ${ie.y*100}%`},yF),ne&&(s.insertAdjacentElement(`afterend`,ne),n?.rootElement&&(typeof n.rootElement==`function`?n.rootElement(a):n.rootElement).appendChild(s)),gN(f)&&(f.hasAttribute(`popover`)||f.setAttribute(`popover`,`manual`),_N(f),f.addEventListener(`beforetoggle`,AF));let me,he,ge,_e=PF({placeholder:ne,element:s,feedbackElement:f,frameTransform:p,transformOrigin:ie,width:v,height:y,top:b,left:x,widthOffset:ee,heightOffset:te,delta:ce,styles:S,dragOperation:r,getTranslate:()=>e.current.translate,getElementMutationObserver:()=>me,getSavedCellWidths:()=>ge,setSavedCellWidths:e=>{ge=e}}),ve=new eP(f);DD(()=>r.shape=ve);let ye=fM(f),be=e=>{this.manager.actions.stop({event:e})},xe=OM(ye);re&&ye.addEventListener(`resize`,be),DD(()=>a.status)===`idle`&&requestAnimationFrame(()=>a.status=`dragging`),ne&&(_e.observe(ne),me=MF(s,ne,R),he=NF(s,ne,f));let Se=t.dragOperation.source?.id,Ce=()=>{if(!re||Se==null)return;let e=t.registry.draggables.get(Se),n=e?.handle??e?.element;mM(n)&&n.focus()},we=()=>{me?.disconnect(),he?.disconnect(),_e.disconnect(),ye.removeEventListener(`resize`,be),gN(f)&&(f.removeEventListener(`beforetoggle`,AF),f.removeAttribute(`popover`)),f.removeAttribute(bF),S.reset();let t=()=>{if(ge&&jF(s)){let e=Array.from(s.cells);for(let[t,n]of e.entries())n.style.width=ge[t]??``}a.status=`idle`;let t=e.current.translate!=null,n=r.status.dragging;ne&&(!n&&t||ne.parentElement!==f.parentElement)&&f.isConnected&&ne.replaceWith(f),ne?.remove()};f===this.overlay?setTimeout(t,0):t()},Te=n?.dropAnimation,Ee=this,De=EO(()=>{let{transform:t,status:i}=r;if((t.x||t.y||e.current.translate)&&i.dragging){let i=d.translate??{x:0,y:0},a={x:t.x/p.scaleX+i.x,y:t.y/p.scaleY+i.y},o=e.current.translate,s=DD(()=>r.modifiers),c=DD(()=>r.shape?.current),l=n?.keyboardTransition,u=re&&!xe&&l!==null?`${l?.duration??250}ms ${l?.easing??`cubic-bezier(0.25, 1, 0.5, 1)`}`:`0ms linear`;if(S.set({transition:F?`${F}, translate ${u}`:`translate ${u}`,translate:`${a.x}px ${a.y}px 0`},yF),me?.takeRecords(),c&&c!==ve&&o&&!s.length){let e=Sk.delta(a,o);r.shape=Ck.from(c.boundingRectangle).translate(e.x*p.scaleX,e.y*p.scaleY)}else r.shape=new eP(f);e.current.translate=a}},function(){if(r.status.dropped){this.dispose(),a.status=`dropping`;let n=c?.dropAnimation===void 0?Ee.dropAnimation===void 0?Te:Ee.dropAnimation:c.dropAnimation,r=e.current.translate,i=r!=null;if(!r&&s!==f&&(r={x:0,y:0}),!r||n===null){we();return}t.renderer.rendering.then(()=>{LF({source:a,element:s,feedbackElement:f,placeholder:ne,translate:r,moved:i,transition:w,alignment:a.alignment,styles:S,animation:n??void 0,getElementMutationObserver:()=>me,cleanup:we,restoreFocus:Ce})})}});return()=>{we(),De()}},IP(BF,4,`overlay`,RF,GF,VF),PP(BF,GF),GF.configure=lA(GF);var KF=GF,qF=!0,JF=!1,YF,XF,ZF=[CO],QF=RN.Forward,$F,eI,tI;XF=(YF=[CO],RN.Reverse);var nI=class{constructor(){BP(this,eI,FP($F,8,this,qF)),FP($F,11,this),BP(this,tI,FP($F,12,this,qF)),FP($F,15,this)}isLocked(e){return e===RN.Idle?!1:e==null?this[RN.Forward]===qF&&this[RN.Reverse]===qF:this[e]===qF}unlock(e){e!==RN.Idle&&(this[e]=JF)}};$F=AP(null),eI=new WeakMap,tI=new WeakMap,IP($F,4,QF,ZF,nI,eI),IP($F,4,XF,YF,nI,tI),PP($F,nI);var rI=[RN.Forward,RN.Reverse],iI=class{constructor(){this.x=new nI,this.y=new nI}isLocked(){return this.x.isLocked()&&this.y.isLocked()}},aI=class extends hA{constructor(e){super(e);let t=LD(new iI),n=null;this.signal=t,qD(()=>{let{status:r}=e.dragOperation;if(!r.initialized){n=null,t.value=new iI;return}let{delta:i}=e.dragOperation.position;if(n){let e={x:oI(i.x,n.x),y:oI(i.y,n.y)},r=t.peek();wD(()=>{for(let t of Nk)for(let n of rI)e[t]===n&&r[t].unlock(n);t.value=r})}n=i})}get current(){return this.signal.peek()}};function oI(e,t){return Math.sign(e-t)}var sI,cI,lI,uI,dI,fI,pI=class extends (cI=gA,sI=[CO],cI){constructor(e){super(e),BP(this,uI,FP(lI,8,this,!1)),FP(lI,11,this),BP(this,dI),BP(this,fI,()=>{if(!zP(this,dI))return;let{element:e,by:t}=zP(this,dI);t.y&&(e.scrollTop+=t.y),t.x&&(e.scrollLeft+=t.x)}),this.scroll=(e,t)=>{if(this.disabled)return!1;let n=this.getScrollableElements();if(!n)return VP(this,dI,void 0),!1;let{position:r}=this.manager.dragOperation,i=r?.current;if(i){let{by:r}=e??{},a=r?{x:mI(r.x),y:mI(r.y)}:void 0,o=a?void 0:this.scrollIntentTracker.current;if(o?.isLocked())return!1;for(let e of n){let n=bN(e,r);if(n.x||n.y){let{speed:n,direction:s}=VN(e,i,a,t?.acceleration,t?.threshold);if(o)for(let e of Nk)o[e].isLocked(s[e])&&(n[e]=0,s[e]=0);if(s.x||s.y){let{x:t,y:i}=r??s,a=t*n.x,o=i*n.y;if(a||o){let t=zP(this,dI)?.by;if(this.autoScrolling&&t&&(t.x&&!a||t.y&&!o))continue;return VP(this,dI,{element:e,by:{x:a,y:o}}),SN.schedule(zP(this,fI)),!0}}}}}return VP(this,dI,void 0),!1};let t=null,n=null,r=xO(()=>{let{position:n,source:r}=e.dragOperation;if(!n)return null;let i=MM(DM(r?.element),n.current);return i&&(t=i),i??t}),i=xO(()=>{let t=r.value,{documentElement:i}=gM(t);if(!t||t===i){let{target:t}=e.dragOperation,r=t?.element;if(r){let e=jN(r,{excludeElement:!1});return n=e,e}}if(t){let e=jN(t,{excludeElement:!1});return this.autoScrolling&&n&&e.size<n?.size?n:(n=e,e)}return n=null,null},SO);this.getScrollableElements=()=>i.value,this.scrollIntentTracker=new aI(e),this.destroy=e.monitor.addEventListener(`dragmove`,t=>{!this.disabled&&!t.defaultPrevented&&aP(e.dragOperation.activatorEvent)&&t.by&&this.scroll({by:t.by})&&t.preventDefault()})}};lI=AP(cI),uI=new WeakMap,dI=new WeakMap,fI=new WeakMap,IP(lI,4,`autoScrolling`,sI,pI,uI),PP(lI,pI);function mI(e){return e>0?RN.Forward:e<0?RN.Reverse:RN.Idle}var hI=new class{constructor(e){this.scheduler=e,this.pending=!1,this.tasks=new Set,this.resolvers=new Set,this.flush=()=>{let{tasks:e,resolvers:t}=this;this.pending=!1,this.tasks=new Set,this.resolvers=new Set;for(let t of e)t();for(let e of t)e()}}schedule(e){return this.tasks.add(e),this.pending||(this.pending=!0,this.scheduler(this.flush)),new Promise(e=>this.resolvers.add(e))}}(e=>{typeof requestAnimationFrame==`function`?requestAnimationFrame(e):e()}),gI=10,_I=class extends hA{constructor(e,t){super(e,t);let n=e.registry.plugins.get(pI);if(!n)throw Error(`AutoScroller plugin depends on Scroller plugin`);this.destroy=qD(()=>{if(this.disabled)return;let{position:t,status:r}=e.dragOperation;if(r.dragging){let e={acceleration:this.options?.acceleration,threshold:typeof this.options?.threshold==`number`?{x:this.options.threshold,y:this.options.threshold}:this.options?.threshold};if(n.scroll(void 0,e)){n.autoScrolling=!0;let t=setInterval(()=>hI.schedule(()=>n.scroll(void 0,e)),gI);return()=>{clearInterval(t)}}n.autoScrolling=!1}})}};_I.configure=lA(_I);var vI=_I,yI={capture:!0,passive:!0},bI,xI=class extends gA{constructor(e){super(e),BP(this,bI),this.handleScroll=()=>{zP(this,bI)??VP(this,bI,setTimeout(()=>{this.manager.collisionObserver.forceUpdate(!1),VP(this,bI,void 0)},50))};let{dragOperation:t}=this.manager;this.destroy=qD(()=>{if(t.status.dragging){let e=t.source?.element?.ownerDocument??document;return e.addEventListener(`scroll`,this.handleScroll,yI),()=>{e.removeEventListener(`scroll`,this.handleScroll,yI)}}})}};bI=new WeakMap;var SI=`* { user-select: none !important; -webkit-user-select: none !important; }`,CI=class extends hA{constructor(e){super(e),this.manager=e;let t=e.registry.plugins.get(hF)?.register(SI);if(this.destroy=qD(()=>{let{dragOperation:e}=this.manager;if(e.status.initialized)return wI(),document.addEventListener(`selectionchange`,wI,{capture:!0}),()=>{document.removeEventListener(`selectionchange`,wI,{capture:!0})}}),t){let e=this.destroy.bind(this);this.destroy=()=>{t(),e()}}}};function wI(){var e;(e=document.getSelection())==null||e.removeAllRanges()}var TI=Object.freeze({offset:10,keyboardCodes:{start:[`Space`,`Enter`],cancel:[`Escape`],end:[`Space`,`Enter`,`Tab`],up:[`ArrowUp`],down:[`ArrowDown`],left:[`ArrowLeft`],right:[`ArrowRight`]},preventActivation(e,t){let n=t.handle??t.element;return e.target!==n}}),EI,DI=class extends Ej{constructor(e,t){super(e),this.manager=e,this.options=t,BP(this,EI,[]),this.listeners=new IM,this.handleSourceKeyDown=(e,t,n)=>{if(this.disabled||e.defaultPrevented||!iP(e.target)||t.disabled)return;let{keyboardCodes:r=TI.keyboardCodes,preventActivation:i=TI.preventActivation}=n??{};r.start.includes(e.code)&&this.manager.dragOperation.status.idle&&(i?.(e,t)||this.handleStart(e,t,n))}}bind(e,t=this.options){return qD(()=>{let n=e.handle??e.element,r=n=>{aP(n)&&this.handleSourceKeyDown(n,e,t)};if(n)return n.addEventListener(`keydown`,r),()=>{n.removeEventListener(`keydown`,r)}})}handleStart(e,t,n){let{element:r}=t;if(!r)throw Error(`Source draggable does not have an associated element`);e.preventDefault(),e.stopImmediatePropagation(),HN(r);let{center:i}=new eP(r);if(this.manager.actions.start({event:e,coordinates:{x:i.x,y:i.y},source:t}).signal.aborted)return this.cleanup();this.sideEffects();let a=gM(r),o=[this.listeners.bind(a,[{type:`keydown`,listener:e=>this.handleKeyDown(e,t,n),options:{capture:!0}}])];zP(this,EI).push(...o)}handleKeyDown(e,t,n){let{keyboardCodes:r=TI.keyboardCodes}=n??{};if(kI(e,[...r.end,...r.cancel])){e.preventDefault();let t=kI(e,r.cancel);this.handleEnd(e,t);return}kI(e,r.up)?this.handleMove(`up`,e):kI(e,r.down)&&this.handleMove(`down`,e),kI(e,r.left)?this.handleMove(`left`,e):kI(e,r.right)&&this.handleMove(`right`,e)}handleEnd(e,t){this.manager.actions.stop({event:e,canceled:t}),this.cleanup()}handleMove(e,t){let{shape:n}=this.manager.dragOperation,r=t.shiftKey?5:1,i={x:0,y:0},a=this.options?.offset??TI.offset;if(typeof a==`number`&&(a={x:a,y:a}),n){switch(e){case`up`:i={x:0,y:-a.y*r};break;case`down`:i={x:0,y:a.y*r};break;case`left`:i={x:-a.x*r,y:0};break;case`right`:i={x:a.x*r,y:0}}(i.x||i.y)&&(t.preventDefault(),this.manager.actions.move({event:t,by:i}))}}sideEffects(){let e=this.manager.registry.plugins.get(vI);e?.disabled===!1&&(e.disable(),zP(this,EI).push(()=>{e.enable()}))}cleanup(){zP(this,EI).forEach(e=>e()),VP(this,EI,[])}destroy(){this.cleanup(),this.listeners.clear()}};EI=new WeakMap,DI.configure=lA(DI),DI.defaults=TI;var OI=DI;function kI(e,t){return t.includes(e.code)}var AI,jI=class extends kj{constructor(){super(...arguments),BP(this,AI)}onEvent(e){switch(e.type){case`pointerdown`:VP(this,AI,xM(e));break;case`pointermove`:if(!zP(this,AI))return;let{x:t,y:n}=xM(e),r={x:t-zP(this,AI).x,y:n-zP(this,AI).y},{tolerance:i}=this.options;if(i&&jk(r,i)){this.abort();return}jk(r,this.options.value)&&this.activate(e);break;case`pointerup`:this.abort()}}abort(){VP(this,AI,void 0)}};AI=new WeakMap;var MI,NI,PI=class extends kj{constructor(){super(...arguments),BP(this,MI),BP(this,NI)}onEvent(e){switch(e.type){case`pointerdown`:VP(this,NI,xM(e)),VP(this,MI,setTimeout(()=>this.activate(e),this.options.value));break;case`pointermove`:if(!zP(this,NI))return;let{x:t,y:n}=xM(e);jk({x:t-zP(this,NI).x,y:n-zP(this,NI).y},this.options.tolerance)&&this.abort();break;case`pointerup`:this.abort()}}abort(){zP(this,MI)&&(clearTimeout(zP(this,MI)),VP(this,NI,void 0),VP(this,MI,void 0))}};MI=new WeakMap,NI=new WeakMap;var FI=class{};FI.Delay=PI,FI.Distance=jI;var II=Object.freeze({activationConstraints(e,t){let{pointerType:n,target:r}=e;if(n!==`mouse`||!iP(r)||t.handle!==r&&!t.handle?.contains(r))return n===`touch`?[new FI.Delay({value:250,tolerance:5})]:sP(r)&&!e.defaultPrevented?[new FI.Delay({value:200,tolerance:0})]:[new FI.Delay({value:200,tolerance:10}),new FI.Distance({value:5})]},preventActivation(e,t){let{target:n}=e;if(n===t.element||n===t.handle||!iP(n)||t.handle?.contains(n))return!1;let r=FM(n);return r!==t.element&&!!r}}),LI,RI=class extends Ej{constructor(e,t){super(e),this.manager=e,this.options=t,BP(this,LI,new Set),this.listeners=new IM,this.latest={event:void 0,coordinates:void 0},this.handleMove=()=>{let{event:e,coordinates:t}=this.latest;e&&t&&this.manager.actions.move({event:e,to:t})},this.handleCancel=this.handleCancel.bind(this),this.handlePointerUp=this.handlePointerUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}activationConstraints(e,t,n=this.options){let{activationConstraints:r=II.activationConstraints}=n??{};return typeof r==`function`?r(e,t):r}bind(e,t=this.options){return qD(()=>{let n=new AbortController,{signal:r}=n,i=n=>{oP(n)&&this.handlePointerDown(n,e,t)},a=[e.handle??e.element];t?.activatorElements&&(a=Array.isArray(t.activatorElements)?t.activatorElements:t.activatorElements(e));for(let e of a)e&&(WI(e.ownerDocument.defaultView),e.addEventListener(`pointerdown`,i,{signal:r}));return()=>n.abort()})}handlePointerDown(e,t,n){if(this.disabled||!e.isPrimary||e.button!==0||!iP(e.target)||t.disabled||BI(e)||!this.manager.dragOperation.status.idle)return;let{preventActivation:r=II.preventActivation}=n??{};if(r?.(e,t))return;let{target:i}=e,a=mM(i)&&i.draggable&&i.getAttribute(`draggable`)===`true`,o=MN(t.element),{x:s,y:c}=xM(e);this.initialCoordinates={x:s*o.scaleX+o.x,y:c*o.scaleY+o.y};let l=this.activationConstraints(e,t,n);e.sensor=this;let u=new Dj(l,e=>this.handleStart(t,e));u.signal.onabort=()=>this.handleCancel(e),u.onEvent(e),this.controller=u;let d=CM(),f=this.listeners.bind(d,[{type:`pointermove`,listener:e=>this.handlePointerMove(e,t)},{type:`pointerup`,listener:this.handlePointerUp,options:{capture:!0}},{type:`pointercancel`,listener:this.handleCancel},{type:`dragstart`,listener:a?this.handleCancel:VI,options:{capture:!0}}]);zP(this,LI).add(()=>{f(),this.initialCoordinates=void 0})}handlePointerMove(e,t){var n;if(this.controller?.activated===!1){(n=this.controller)==null||n.onEvent(e);return}if(this.manager.dragOperation.status.dragging){let n=xM(e),r=MN(t.element);n.x=n.x*r.scaleX+r.x,n.y=n.y*r.scaleY+r.y,e.preventDefault(),e.stopPropagation(),this.latest.event=e,this.latest.coordinates=n,SN.schedule(this.handleMove)}}handlePointerUp(e){let{status:t}=this.manager.dragOperation;if(!t.idle){e.preventDefault(),e.stopPropagation();let n=!t.initialized;this.manager.actions.stop({event:e,canceled:n})}this.cleanup()}handleKeyDown(e){e.key===`Escape`&&(e.preventDefault(),this.handleCancel(e))}handleStart(e,t){let{manager:n,initialCoordinates:r}=this;if(!r||!n.dragOperation.status.idle||t.defaultPrevented)return;if(n.actions.start({coordinates:r,event:t,source:e}).signal.aborted)return this.cleanup();t.preventDefault();let i=gM(t.target).body;try{i.setPointerCapture(t.pointerId)}catch{this.handleCancel(t);return}let a=iP(t.target)?[t.target,i]:i,o=this.listeners.bind(a,[{type:`touchmove`,listener:VI,options:{passive:!1}},{type:`click`,listener:VI},{type:`contextmenu`,listener:VI},{type:`keydown`,listener:this.handleKeyDown}]);zP(this,LI).add(o)}handleCancel(e){let{dragOperation:t}=this.manager;t.status.initialized&&this.manager.actions.stop({event:e,canceled:!0}),this.cleanup()}cleanup(){let{controller:e}=this;this.controller=void 0,e&&!e.signal.aborted&&e.abort(),this.latest={event:void 0,coordinates:void 0},zP(this,LI).forEach(e=>e()),zP(this,LI).clear()}destroy(){this.cleanup(),this.listeners.clear()}};LI=new WeakMap,RI.configure=lA(RI),RI.defaults=II;var zI=RI;function BI(e){return`sensor`in e}function VI(e){e.preventDefault()}function HI(){}var UI=new WeakSet;function WI(e){e&&!UI.has(e)&&(e.addEventListener(`touchmove`,HI,{capture:!1,passive:!1}),UI.add(e))}var GI={modifiers:[],plugins:[QP,vI,gF,KF,CI],sensors:[zI,OI]},KI=class extends eM{constructor(e={}){let t=$j(e.plugins,GI.plugins),n=$j(e.sensors,GI.sensors),r=$j(e.modifiers,GI.modifiers);super(DP(EP({},e),{plugins:[xI,pI,hF,...t],sensors:n,modifiers:r}))}},qI,JI,YI,XI,ZI,QI,$I=class extends (YI=JA,JI=[CO],qI=[CO],YI){constructor(e,t){var n=e,{element:r,effects:i=()=>[],handle:a}=n,o=kP(n,[`element`,`effects`,`handle`]);super(EP({effects:()=>[...i(),()=>{let{manager:e}=this;if(!e)return;let t=(this.sensors?.map(uA)??[...e.sensors]).map(t=>{let n=t instanceof Ej?t:e.registry.register(t.plugin),r=t instanceof Ej?void 0:t.options;return n.bind(this,r)});return function(){t.forEach(e=>e())}}]},o),t),BP(this,ZI,FP(XI,8,this)),FP(XI,11,this),BP(this,QI,FP(XI,12,this)),FP(XI,15,this),this.element=r,this.handle=a}};XI=AP(YI),ZI=new WeakMap,QI=new WeakMap,IP(XI,4,`handle`,JI,$I,ZI),IP(XI,4,`element`,qI,$I,QI),PP(XI,$I);var eL,tL,nL,rL,iL,aL,oL,sL,cL,lL,uL=class extends (nL=cj,tL=[CO],eL=[CO],nL){constructor(e,t){var n=e,{element:r,effects:i=()=>[]}=n,a=kP(n,[`element`,`effects`]);let{collisionDetector:o=pP}=a,s=e=>{let{manager:t,element:n}=this;if(!n||e===null){this.shape=void 0;return}if(!t)return;let r=new eP(n),i=DD(()=>this.shape);return r&&i?.equals(r)?i:(this.shape=r,r)},c=LD(!1);super(DP(EP({},a),{collisionDetector:o,effects:()=>[...i(),()=>{let{element:e,manager:t}=this;if(!t)return;let{dragOperation:n}=t,{source:r}=n;c.value=!!(r&&n.status.initialized&&e&&!this.disabled&&this.accepts(r))},()=>{let{element:e}=this;if(c.value&&e){let t=new hN(e,s);return()=>{t.disconnect(),this.shape=void 0}}},()=>{if(this.manager?.dragOperation.status.initialized)return()=>{this.shape=void 0}}]}),t),BP(this,cL),BP(this,iL,FP(rL,8,this)),FP(rL,11,this),BP(this,lL,FP(rL,12,this)),FP(rL,15,this),this.element=r,this.refreshShape=()=>s()}set element(e){VP(this,cL,e,sL)}get element(){return this.proxy??zP(this,cL,oL)}};rL=AP(nL),iL=new WeakMap,cL=new WeakSet,lL=new WeakMap,aL=IP(rL,20,`#element`,tL,cL,iL),oL=aL.get,sL=aL.set,IP(rL,4,`proxy`,eL,uL,lL),PP(rL,uL);function dL(e){return typeof e==`object`&&!!e&&`current`in e}function fL(e){if(e!=null)return dL(e)?e.current??void 0:e}var pL=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?D.useLayoutEffect:D.useEffect;function mL(){let e=(0,D.useState)(0)[1];return(0,D.useCallback)(()=>{e(e=>e+1)},[e])}function hL(e,t=!1){let n=(0,D.useRef)(e.peek()),r=(0,D.useRef)(!1),i=mL();return pL(()=>qD(()=>{let a=n.current,o=e.value;if(a!==o){if(n.current=o,!r.current)return;t?(0,kh.flushSync)(i):i()}}),[e,t,i]),{get value(){return r.current=!0,e.peek()}}}function gL(e,t=[],n=!1){let r=(0,D.useRef)(e);return r.current=e,hL((0,D.useMemo)(()=>xO(()=>r.current()),t),n)}function _L(e,t){let n=(0,D.useRef)(new Map),r=mL();return pL(()=>{if(!e){n.current.clear();return}return qD(()=>{let i=!1,a=!1;for(let r of n.current){let[o]=r,s=DD(()=>r[1]),c=e[o];s!==c&&(i=!0,n.current.set(o,c),a=t?.(o,s,c)??!1)}i&&(a?queueMicrotask(()=>(0,kh.flushSync)(r)):r())})},[e]),(0,D.useMemo)(()=>e&&new Proxy(e,{get(e,t){let r=e[t];return n.current.set(t,r),r}}),[e])}function vL(e,t){e()}function yL(e){let t=(0,D.useRef)(e);return pL(()=>{t.current=e},[e]),t}function bL(e,t,n=D.useEffect,r=Object.is){let i=(0,D.useRef)(e);n(()=>{let n=i.current;r(e,n)||(i.current=e,t(e,n))},[t,e])}function xL(e,t){let n=(0,D.useRef)(fL(e));pL(()=>{let r=fL(e);r!==n.current&&(n.current=r,t(r))})}var SL=Object.getOwnPropertySymbols,CL=Object.prototype.hasOwnProperty,wL=Object.prototype.propertyIsEnumerable,TL=(e,t)=>{var n={};for(var r in e)CL.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&SL)for(var r of SL(e))t.indexOf(r)<0&&wL.call(e,r)&&(n[r]=e[r]);return n},EL=new KI,DL=(0,D.createContext)(EL),OL=(0,D.memo)((0,D.forwardRef)(({children:e},t)=>{let[n,r]=(0,D.useState)(0),i=(0,D.useRef)(null),a=(0,D.useRef)(null),o=(0,D.useMemo)(()=>({renderer:{get rendering(){return i.current??Promise.resolve()}},trackRendering(e){i.current||=new Promise(e=>{a.current=e}),(0,D.startTransition)(()=>{e(),r(e=>e+1)})}}),[]);return pL(()=>{var e;(e=a.current)==null||e.call(a),i.current=null},[e,n]),(0,D.useImperativeHandle)(t,()=>o),null})),kL=[void 0,SO];function AL(e){var t=e,{children:n,onCollision:r,onBeforeDragStart:i,onDragStart:a,onDragMove:o,onDragOver:s,onDragEnd:c}=t,l=TL(t,[`children`,`onCollision`,`onBeforeDragStart`,`onDragStart`,`onDragMove`,`onDragOver`,`onDragEnd`]);let u=(0,D.useRef)(null),{plugins:d,modifiers:f,sensors:p}=l,m=$j(d,GI.plugins),h=$j(p,GI.sensors),g=$j(f,GI.modifiers),_=yL(i),v=yL(a),y=yL(s),b=yL(o),x=yL(c),S=yL(r),C=jL(()=>l.manager??new KI(l));return(0,D.useEffect)(()=>{if(!u.current)throw Error(`Renderer not found`);let{renderer:e,trackRendering:t}=u.current,{monitor:n}=C;C.renderer=e;let r=[n.addEventListener(`beforedragstart`,e=>{let n=_.current;n&&t(()=>n(e,C))}),n.addEventListener(`dragstart`,e=>v.current?.call(v,e,C)),n.addEventListener(`dragover`,e=>{let n=y.current;n&&t(()=>n(e,C))}),n.addEventListener(`dragmove`,e=>{let n=b.current;n&&t(()=>n(e,C))}),n.addEventListener(`dragend`,e=>{let n=x.current;n&&t(()=>n(e,C))}),n.addEventListener(`collision`,e=>S.current?.call(S,e,C))];return()=>r.forEach(e=>e())},[C]),bL(m,()=>C&&(C.plugins=m),...kL),bL(h,()=>C&&(C.sensors=h),...kL),bL(g,()=>C&&(C.modifiers=g),...kL),(0,H.jsxs)(DL.Provider,{value:C,children:[(0,H.jsx)(OL,{ref:u,children:n}),n]})}function jL(e){let t=(0,D.useRef)(null);return t.current||=e(),(0,D.useInsertionEffect)(()=>()=>t.current?.destroy(),[]),t.current}function ML(){return(0,D.useContext)(DL)}function NL(e){let t=ML()??void 0,[n]=(0,D.useState)(()=>e(t));return n.manager!==t&&(n.manager=t),pL(n.register,[t,n]),n}function PL({children:e,className:t,dropAnimation:n,style:r,tag:i,disabled:a}){let o=(0,D.useRef)(null),s=ML(),c=gL(()=>s?.dragOperation.source,[s]).value??null,l=typeof a==`function`?a(c):a;(0,D.useEffect)(()=>{if(!o.current||!s||l)return;let e=s.plugins.find(e=>e instanceof KF);if(e)return e.overlay=o.current,()=>{e.overlay=void 0}},[s,l]),(0,D.useEffect)(()=>{if(!s)return;let e=s.plugins.find(e=>e instanceof KF);if(e)return e.dropAnimation=n,()=>{e.dropAnimation=void 0}},[s,n]);let u=(0,D.useMemo)(()=>{if(!s)return null;let e=new Proxy(s.registry,{get(e,t){return t===`register`||t===`unregister`?FL:e[t]}});return new Proxy(s,{get(t,n){return n===`registry`?e:t[n]}})},[s]);return(0,H.jsx)(DL.Provider,{value:u,children:(0,D.createElement)(i||`div`,{ref:o,className:t,style:r,"data-dnd-overlay":!0},d())});function d(){return!c||l?null:typeof e==`function`?(0,H.jsx)(IL,{source:c,children:e}):e}}function FL(){return()=>{}}function IL({children:e,source:t}){return e(_L(t))}var LL=Object.create,RL=Object.defineProperty,zL=Object.getOwnPropertyDescriptor,BL=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),VL=e=>{throw TypeError(e)},HL=(e,t,n)=>t in e?RL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,UL=e=>[,,,LL(e?.[BL(`metadata`)]??null)],WL=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],GL=e=>e!==void 0&&typeof e!=`function`?VL(`Function expected`):e,KL=(e,t,n,r,i)=>({kind:WL[e],name:t,metadata:r,addInitializer:e=>n._?VL(`Already initialized`):i.push(GL(e||null))}),qL=(e,t)=>HL(t,BL(`metadata`),e[3]),JL=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)a[i].call(n);return r},YL=(e,t,n,r,i,a)=>{for(var o,s,c,l,u=t&7,d=!1,f=!1,p=2,m=WL[u+5],h=e[p]||(e[p]=[]),g=(i=i.prototype,zL(i,n)),_=r.length-1;_>=0;_--)c=KL(u,n,s={},e[3],h),c.static=d,c.private=f,l=c.access={has:e=>n in e},l.get=e=>e[n],o=(0,r[_])(g[m],c),s._=1,GL(o)&&(g[m]=o);return g&&RL(i,n,g),i},XL=(e,t,n)=>t.has(e)||VL(`Cannot `+n),ZL=(e,t,n)=>(XL(e,t,`read from private field`),t.get(e)),QL=(e,t,n)=>t.has(e)?VL(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),$L=(e,t,n,r)=>(XL(e,t,`write to private field`),t.set(e,n),n),eR=class e{constructor(e,t){this.x=e,this.y=t}static delta(t,n){return new e(t.x-n.x,t.y-n.y)}static distance(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}static equals(e,t){return e.x===t.x&&e.y===t.y}static from({x:t,y:n}){return new e(t,n)}},tR,nR,rR,iR,aR,oR=class extends (rR=qO,nR=[wO],tR=[wO],rR){constructor(e){let t=eR.from(e);super(t,(e,t)=>eR.equals(e,t)),JL(aR,5,this),QL(this,iR,0),this.velocity={x:0,y:0}}get delta(){return eR.delta(this.current,this.initial)}get direction(){let{current:e,previous:t}=this;if(!t)return null;let n={x:e.x-t.x,y:e.y-t.y};return!n.x&&!n.y?null:Math.abs(n.x)>Math.abs(n.y)?n.x>0?`right`:`left`:n.y>0?`down`:`up`}get current(){return super.current}set current(e){let{current:t}=this,n=eR.from(e),r={x:n.x-t.x,y:n.y-t.y},i=Date.now(),a=i-ZL(this,iR),o=e=>Math.round(e/a*100);wD(()=>{$L(this,iR,i),this.velocity={x:o(r.x),y:o(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(eR.from(e)),this.velocity={x:0,y:0}}};aR=UL(rR),iR=new WeakMap,YL(aR,2,`delta`,nR,oR),YL(aR,2,`direction`,tR,oR),qL(aR,oR);var sR=(e=>(e.Horizontal=`x`,e.Vertical=`y`,e))(sR||{});Object.values(sR);function cR(){let e=ML(),t=gL(()=>e?.dragOperation.source,[e]),n=gL(()=>e?.dragOperation.target,[e]);return{get source(){return t.value},get target(){return n.value}}}var lR=Object.create,uR=Object.defineProperty,dR=Object.defineProperties,fR=Object.getOwnPropertyDescriptor,pR=Object.getOwnPropertyDescriptors,mR=Object.getOwnPropertySymbols,hR=Object.prototype.hasOwnProperty,gR=Object.prototype.propertyIsEnumerable,_R=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),vR=e=>{throw TypeError(e)},yR=(e,t,n)=>t in e?uR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bR=(e,t)=>{for(var n in t||={})hR.call(t,n)&&yR(e,n,t[n]);if(mR)for(var n of mR(t))gR.call(t,n)&&yR(e,n,t[n]);return e},xR=(e,t)=>dR(e,pR(t)),SR=(e,t)=>{var n={};for(var r in e)hR.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&mR)for(var r of mR(e))t.indexOf(r)<0&&gR.call(e,r)&&(n[r]=e[r]);return n},CR=e=>[,,,lR(null)],wR=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],TR=e=>e!==void 0&&typeof e!=`function`?vR(`Function expected`):e,ER=(e,t,n,r,i)=>({kind:wR[e],name:t,metadata:r,addInitializer:e=>n._?vR(`Already initialized`):i.push(TR(e||null))}),DR=(e,t)=>yR(t,_R(`metadata`),e[3]),OR=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},kR=(e,t,n,r,i,a)=>{for(var o,s,c,l,u,d=t&7,f=!1,p=!1,m=e.length+1,h=wR[d+5],g=e[m-1]=[],_=e[m]||(e[m]=[]),v=(i=i.prototype,fR({get[n](){return jR(this,a)},set[n](e){return NR(this,a,e)}},n)),y=r.length-1;y>=0;y--)l=ER(d,n,c={},e[3],_),l.static=f,l.private=p,u=l.access={has:e=>n in e},u.get=e=>e[n],u.set=(e,t)=>e[n]=t,s=(0,r[y])({get:v.get,set:v.set},l),c._=1,s===void 0?TR(s)&&(v[h]=s):typeof s!=`object`||!s?vR(`Object expected`):(TR(o=s.get)&&(v.get=o),TR(o=s.set)&&(v.set=o),TR(o=s.init)&&g.unshift(o));return v&&uR(i,n,v),i},AR=(e,t,n)=>t.has(e)||vR(`Cannot `+n),jR=(e,t,n)=>(AR(e,t,`read from private field`),t.get(e)),MR=(e,t,n)=>t.has(e)?vR(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),NR=(e,t,n,r)=>(AR(e,t,`write to private field`),t.set(e,n),n);function PR(e){return e instanceof bz||e instanceof yz}var FR=10,IR=class extends hA{constructor(e){super(e);let t=qD(()=>{let{dragOperation:t}=e;if(aP(t.activatorEvent)&&PR(t.source)&&t.status.initialized){let t=e.registry.plugins.get(pI);if(t)return t.disable(),()=>t.enable()}}),n=e.monitor.addEventListener(`dragmove`,(e,t)=>{queueMicrotask(()=>{if(this.disabled||e.defaultPrevented||!e.nativeEvent)return;let{dragOperation:n}=t;if(!aP(e.nativeEvent)||!PR(n.source)||!n.shape)return;let{actions:r,collisionObserver:i,registry:a}=t,{by:o}=e;if(!o)return;let s=LR(o),{source:c,target:l}=n,{center:u}=n.shape.current,d=[],f=[];wD(()=>{for(let e of a.droppables){let{id:t}=e;if(!e.accepts(c)||t===l?.id&&PR(e)||!e.element)continue;let n=e.shape,r=new eP(e.element,{getBoundingClientRect:e=>bM(e,void 0,.2)});r.height&&r.width&&(s==`down`&&u.y+FR<r.center.y||s==`up`&&u.y-FR>r.center.y||s==`left`&&u.x-FR>r.center.x||s==`right`&&u.x+FR<r.center.x)&&(d.push(e),e.shape=r,f.push(()=>e.shape=n))}}),e.preventDefault(),i.disable();let p=i.computeCollisions(d,mP);wD(()=>f.forEach(e=>e()));let[m]=p;if(!m)return;let{id:h}=m,{index:g,group:_}=c.sortable;r.setDropTarget(h).then(()=>{let{source:e,target:t,shape:a}=n;if(!e||!PR(e)||!a)return;let{index:o,group:s,target:c}=e.sortable,l=g!==o||_!==s,u=l?c:t?.element;if(!u)return;HN(u);let d=new eP(u);if(!d)return;let f=Ck.delta(d,Ck.from(a.current.boundingRectangle),e.alignment);r.move({by:f}),l?r.setDropTarget(e.id).then(()=>i.enable()):i.enable()})})});this.destroy=()=>{n(),t()}}};function LR(e){let{x:t,y:n}=e;if(t>0)return`right`;if(t<0)return`left`;if(n>0)return`down`;if(n<0)return`up`}var RR=Object.defineProperty,zR=Object.defineProperties,BR=Object.getOwnPropertyDescriptors,VR=Object.getOwnPropertySymbols,HR=Object.prototype.hasOwnProperty,UR=Object.prototype.propertyIsEnumerable,WR=(e,t,n)=>t in e?RR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,GR=(e,t)=>{for(var n in t||={})HR.call(t,n)&&WR(e,n,t[n]);if(VR)for(var n of VR(t))UR.call(t,n)&&WR(e,n,t[n]);return e},KR=(e,t)=>zR(e,BR(t));function qR(e,t,n){if(t===n)return e;let r=e.slice();return r.splice(n,0,r.splice(t,1)[0]),r}function JR(e,t){let n=String(t);return Object.prototype.hasOwnProperty.call(e,n)?n:void 0}function YR(e){return`initialIndex`in e&&typeof e.initialIndex==`number`&&`index`in e&&typeof e.index==`number`}function XR(e,t,n){let{source:r,target:i,canceled:a}=t.operation;if(!r||!i||a)return`preventDefault`in t&&t.preventDefault(),e;let o=(e,t)=>e===t||typeof e==`object`&&!!e&&`id`in e&&e.id===t;if(Array.isArray(e)){let s=e.findIndex(e=>o(e,r.id)),c=e.findIndex(e=>o(e,i.id));if(s===-1||c===-1){if(YR(r)){let i=r.initialIndex,a=r.index;return i===a||i<0||i>=e.length?(`preventDefault`in t&&t.preventDefault(),e):n(e,i,a)}return e}if(!a&&`index`in r&&typeof r.index==`number`){let t=r.index;if(t!==s)return n(e,s,t)}return n(e,s,c)}let s=Object.entries(e),c=-1,l,u=-1,d;for(let[e,t]of s)if(c===-1&&(c=t.findIndex(e=>o(e,r.id)),c!==-1&&(l=e)),u===-1&&(u=t.findIndex(e=>o(e,i.id)),u!==-1&&(d=e)),c!==-1&&u!==-1)break;if(c===-1&&YR(r)){let i=r.initialGroup==null?void 0:JR(e,r.initialGroup),a=r.initialIndex,o=r.group==null?void 0:JR(e,r.group),s=r.index;if(i==null||o==null||i===o&&a===s)return`preventDefault`in t&&t.preventDefault(),e;if(i===o)return KR(GR({},e),{[i]:n(e[i],a,s)});let c=e[i][a];return KR(GR({},e),{[i]:[...e[i].slice(0,a),...e[i].slice(a+1)],[o]:[...e[o].slice(0,s),c,...e[o].slice(s)]})}if(!r.manager)return e;let{dragOperation:f}=r.manager,p=f.shape?.current.center??f.position.current;if(d==null){let t=JR(e,i.id);if(t!=null){let n=i.shape&&p.y>i.shape.center.y?e[t].length:0;d=t,u=n}}if(l==null||d==null||l===d&&c===u){if(l!=null&&l===d&&c===u&&YR(r)){let t=r.group==null?void 0:JR(e,r.group),i=r.group!=null&&t!==l,a=r.index!==c;if(i||a){let i=r.group==null?l:t;if(i!=null){if(l===i)return KR(GR({},e),{[l]:n(e[l],c,r.index)});let t=e[l][c];return KR(GR({},e),{[l]:[...e[l].slice(0,c),...e[l].slice(c+1)],[i]:[...e[i].slice(0,r.index),t,...e[i].slice(r.index)]})}}}return`preventDefault`in t&&t.preventDefault(),e}if(l===d)return KR(GR({},e),{[l]:n(e[l],c,u)});let m=i.shape&&Math.round(p.y)>Math.round(i.shape.center.y)?1:0,h=e[l][c];return KR(GR({},e),{[l]:[...e[l].slice(0,c),...e[l].slice(c+1)],[d]:[...e[d].slice(0,u+m),h,...e[d].slice(u+m)]})}function ZR(e,t){return XR(e,t,qR)}function QR(e){let t=new Map;for(let[,n]of e)for(let e of n)t.set(e.id,e.index);return t}function $R(e,t,n){for(let[r,i]of t)for(let t of i){let i=e.get(t.id);if(t.index!==i||t.group!==r||!n.get(r)?.has(t))return!0}return!1}var ez=`__default__`,tz=class extends hA{constructor(e){super(e);let t=()=>{let t=new Map;for(let n of e.registry.droppables)if(n instanceof bz){let{sortable:e}=n,{group:r}=e,i=t.get(r);i||(i=new Set,t.set(r,i)),i.add(e)}return t},n=[e.monitor.addEventListener(`dragover`,(e,n)=>{if(this.disabled)return;let{dragOperation:r}=n,{source:i,target:a}=r;if(!PR(i)||!PR(a)||i.sortable===a.sortable)return;let o=t(),s=QR(o),c=i.sortable.group===a.sortable.group,l=o.get(i.sortable.group),u=c?l:o.get(a.sortable.group);l&&u&&queueMicrotask(()=>{e.defaultPrevented||n.renderer.rendering.then(()=>{let r=t();if($R(s,o,r))return;let d=i.sortable.element,f=a.sortable.element;if(!f||!d||!c&&a.id===i.sortable.group)return;let p=az(l),m=c?p:az(u),h=i.sortable.group??ez,g=a.sortable.group??ez,_={[h]:p,[g]:m},v=ZR(_,e);if(_===v)return;let y=v[g].indexOf(i.sortable),b=v[g].indexOf(a.sortable);n.collisionObserver.disable(),nz(d,y,f,b),wD(()=>{for(let[e,t]of v[h].entries())t.index=e;if(!c)for(let[e,t]of v[g].entries())t.group=a.sortable.group,t.index=e}),n.actions.setDropTarget(i.id).then(()=>n.collisionObserver.enable())})})}),e.monitor.addEventListener(`dragend`,(e,n)=>{if(!e.canceled)return;let{dragOperation:r}=n,{source:i}=r;PR(i)&&(i.sortable.initialIndex!==i.sortable.index||i.sortable.initialGroup!==i.sortable.group)&&queueMicrotask(()=>{let e=t(),r=QR(e),a=e.get(i.sortable.initialGroup);a&&n.renderer.rendering.then(()=>{let n=t();if($R(r,e,n))return;let o=az(a),s=az(a,iz),c=i.sortable.element,l=o[s.indexOf(i.sortable)],u=l?.element;l&&u&&c&&(nz(c,l.index,u,i.index),wD(()=>{for(let t of e.values()){let e=Array.from(t).values();for(let t of e)t.index=t.initialIndex,t.group=t.initialGroup}}))})})})];this.destroy=()=>{for(let e of n)e()}}};function nz(e,t,n,r){let i=r<t?`afterend`:`beforebegin`;n.insertAdjacentElement(i,e)}function rz(e,t){return e.index-t.index}function iz(e,t){return e.initialIndex-t.initialIndex}function az(e,t=rz){return Array.from(e).sort(t)}var oz=[IR,tz],sz={duration:250,easing:`cubic-bezier(0.25, 1, 0.5, 1)`,idle:!1};function cz(e){return typeof e==`boolean`?{draggable:e,droppable:e}:{draggable:e?.draggable??!1,droppable:e?.droppable??!1}}var lz=new XO,uz,dz=[CO],fz,pz,mz,hz,gz,_z;uz=[CO];var vz=class{constructor(e,t){MR(this,pz,OR(fz,8,this)),OR(fz,11,this),MR(this,mz),MR(this,hz),MR(this,gz,OR(fz,12,this)),OR(fz,15,this),MR(this,_z),this.register=()=>(wD(()=>{var e,t;(e=this.manager)==null||e.registry.register(this.droppable),(t=this.manager)==null||t.registry.register(this.draggable)}),()=>this.unregister()),this.unregister=()=>{wD(()=>{var e,t;(e=this.manager)==null||e.registry.unregister(this.droppable),(t=this.manager)==null||t.registry.unregister(this.draggable)})},this.destroy=()=>{wD(()=>{this.droppable.destroy(),this.draggable.destroy()})};var n=e,{effects:r=()=>[],disabled:i,group:a,index:o,sensors:s,type:c,transition:l=sz,plugins:u}=n,d=SR(n,[`effects`,`disabled`,`group`,`index`,`sensors`,`type`,`transition`,`plugins`]);let f=$j(u,oz),p=cz(i);this.droppable=new bz(xR(bR({},d),{disabled:p.droppable}),t,this),this.draggable=new yz(xR(bR({},d),{disabled:p.draggable,plugins:f,effects:()=>[()=>{let e=this.manager?.dragOperation.status;e?.initializing&&this.id===this.manager?.dragOperation.source?.id&&lz.clear(this.manager),e?.dragging&&lz.set(this.manager,this.id,DD(()=>({initialIndex:this.index,initialGroup:this.group})))},()=>{let{index:e,group:t,manager:n}=this,r=jR(this,hz),i=jR(this,mz);(e!==r||t!==i)&&(NR(this,hz,e),NR(this,mz,t),this.animate())},()=>{let{target:e}=this,{isDragSource:t}=this.draggable;(this.draggable.pluginConfig(KF)?.feedback??`default`)===`move`&&t&&(this.droppable.disabled=!e)},...r()],type:c,sensors:s}),t,this),NR(this,_z,d.element),this.manager=t,this.index=o,NR(this,hz,o),this.group=a,NR(this,mz,a),this.type=c,this.transition=l}get initialIndex(){return lz.get(this.manager,this.id)?.initialIndex??this.index}get initialGroup(){return lz.get(this.manager,this.id)?.initialGroup??this.group}animate(){DD(()=>{let{manager:e,transition:t}=this,{shape:n}=this.droppable;if(!e)return;let{idle:r}=e.dragOperation.status;n&&t&&(!r||t.idle)&&e.renderer.rendering.then(()=>{let{element:r}=this;if(!r)return;for(let e of r.getAnimations())`transitionProperty`in e&&(e.transitionProperty===`transform`||e.transitionProperty===`translate`||e.transitionProperty===`scale`)&&e.cancel();let i=this.refreshShape();if(!i)return;let a={x:n.boundingRectangle.left-i.boundingRectangle.left,y:n.boundingRectangle.top-i.boundingRectangle.top},{translate:o}=EN(r),s=JN(r,o,!1),c=JN(r,o);if(a.x||a.y){let n=OM(fM(r))?xR(bR({},t),{duration:0}):t;qN({element:r,keyframes:{translate:[`${s.x+a.x}px ${s.y+a.y}px ${s.z}`,`${c.x}px ${c.y}px ${c.z}`]},options:n}).then(()=>{e.dragOperation.status.dragging||(this.droppable.shape=void 0)})}})})}get manager(){return this.draggable.manager}set manager(e){wD(()=>{this.draggable.manager=e,this.droppable.manager=e})}set element(e){wD(()=>{let t=jR(this,_z),n=this.droppable.element,r=this.draggable.element;(!n||n===t)&&(this.droppable.element=e),(!r||r===t)&&(this.draggable.element=e),NR(this,_z,e)})}get element(){let e=jR(this,_z);if(e)return PM.get(e)??e??this.droppable.element}set target(e){this.droppable.element=e}get target(){return this.droppable.element}set source(e){this.draggable.element=e}get source(){return this.draggable.element}get disabled(){let{disabled:e}=this.draggable,{disabled:t}=this.droppable;return e===t?e:{draggable:e,droppable:t}}set plugins(e){this.draggable.plugins=$j(e,oz)}set disabled(e){let t=cz(e);wD(()=>{this.droppable.disabled=t.droppable,this.draggable.disabled=t.draggable})}set data(e){wD(()=>{this.droppable.data=e,this.draggable.data=e})}set handle(e){this.draggable.handle=e}set id(e){this.droppable.id=e,this.draggable.id=e}get id(){return this.droppable.id}set sensors(e){this.draggable.sensors=e}set modifiers(e){this.draggable.modifiers=e}set collisionPriority(e){this.droppable.collisionPriority=e}set collisionDetector(e){this.droppable.collisionDetector=e??pP}set alignment(e){this.draggable.alignment=e}get alignment(){return this.draggable.alignment}set type(e){wD(()=>{this.droppable.type=e,this.draggable.type=e})}get type(){return this.draggable.type}set accept(e){this.droppable.accept=e}get accept(){return this.droppable.accept}get isDropTarget(){return this.droppable.isDropTarget}get isDragSource(){return this.draggable.isDragSource}get isDragging(){return this.draggable.isDragging}get isDropping(){return this.draggable.isDropping}get status(){return this.draggable.status}refreshShape(){return this.droppable.refreshShape()}accepts(e){return this.droppable.accepts(e)}};fz=CR(),pz=new WeakMap,mz=new WeakMap,hz=new WeakMap,gz=new WeakMap,_z=new WeakMap,kR(fz,4,`index`,dz,vz,pz),kR(fz,4,`group`,uz,vz,gz),DR(fz,vz);var yz=class extends $I{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}get initialIndex(){return this.sortable.initialIndex}get group(){return this.sortable.group}get initialGroup(){return this.sortable.initialGroup}},bz=class extends uL{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}get group(){return this.sortable.group}},xz=Object.defineProperty,Sz=Object.defineProperties,Cz=Object.getOwnPropertyDescriptors,wz=Object.getOwnPropertySymbols,Tz=Object.prototype.hasOwnProperty,Ez=Object.prototype.propertyIsEnumerable,Dz=(e,t,n)=>t in e?xz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oz=(e,t)=>{for(var n in t||={})Tz.call(t,n)&&Dz(e,n,t[n]);if(wz)for(var n of wz(t))Ez.call(t,n)&&Dz(e,n,t[n]);return e},kz=(e,t)=>Sz(e,Cz(t));function Az(e){let{accept:t,collisionDetector:n,collisionPriority:r,id:i,data:a,element:o,handle:s,index:c,group:l,disabled:u,modifiers:d,sensors:f,target:p,type:m,plugins:h}=e,g=Oz(Oz({},sz),e.transition),_=NL(t=>new vz(kz(Oz({},e),{transition:g,register:!1,handle:fL(s),element:fL(o),target:fL(p)}),t)),v=_L(_,jz);return bL(i,()=>_.id=i),pL(()=>{wD(()=>{_.group=l,_.index=c})},[_,l,c]),bL(m,()=>_.type=m),bL(t,()=>_.accept=t,void 0,SO),bL(a,()=>a&&(_.data=a)),bL(c,()=>{_.manager?.dragOperation.status.idle&&g?.idle&&_.refreshShape()},vL),xL(s,e=>_.handle=e),xL(o,e=>_.element=e),xL(p,e=>_.target=e),bL(u,()=>_.disabled=u??!1,void 0,SO),bL(f,()=>_.sensors=f,void 0,SO),bL(n,()=>_.collisionDetector=n),bL(r,()=>_.collisionPriority=r),bL(h,()=>_.plugins=h,void 0,SO),bL(g,()=>_.transition=g,void 0,SO),bL(d,()=>_.modifiers=d,void 0,SO),bL(e.alignment,()=>_.alignment=e.alignment),{sortable:v,get isDragging(){return v.isDragging},get isDropping(){return v.isDropping},get isDragSource(){return v.isDragSource},get isDropTarget(){return v.isDropTarget},handleRef:(0,D.useCallback)(e=>{_.handle=e??void 0},[_]),ref:(0,D.useCallback)(e=>{(e||!_.element?.isConnected||_.manager?.dragOperation.status.idle)&&(_.element=e??void 0)},[_]),sourceRef:(0,D.useCallback)(e=>{(e||!_.source?.isConnected||_.manager?.dragOperation.status.idle)&&(_.source=e??void 0)},[_]),targetRef:(0,D.useCallback)(e=>{(e||!_.target?.isConnected||_.manager?.dragOperation.status.idle)&&(_.target=e??void 0)},[_])}}function jz(e,t,n){return!(e!==`isDragSource`||n||!t)}function Mz({format:e,className:t}){return(0,H.jsx)(e===`html`?te:oe,{className:ab(`size-4 shrink-0`,e===`html`?`text-format-html`:`text-format-markdown`,t),"data-format":e,"aria-hidden":`true`})}var Nz=`Input and generated documents`,Pz=`Outside a repository`,Fz=`Checking repositories`,Iz=`Unknown checkout`;function Lz(){return{directories:new Map,documents:[]}}function Rz(e,t,n,r){let i=e;for(let e of t){let t=i.directories.get(e);t||(t=Lz(),i.directories.set(e,t)),i=t}i.documents.push({document:n,name:r})}function zz(e,t){let n=[];for(let[r,i]of e.directories){let e=r,a=i;for(;a.documents.length===0&&a.directories.size===1;){let[t,n]=[...a.directories.entries()][0];e=`${e}/${t}`,a=n}let o=`${t}/${e}`;n.push({kind:`directory`,key:o,name:e,children:zz(a,o)})}for(let{document:t,name:r}of e.documents)n.push({kind:`document`,key:t.documentId,name:r,document:t});return n}function Bz(e){return e.replace(/[\\/]\.git$/,``)}function Vz(e,t=Je(e)){let n=new Map,r=Lz(),i=Lz(),a=[],o=!1,s=!1;for(let c of e){let e=Ge(c);if(e.kind===`input`){a.push(c);continue}if(e.kind===`pending`||e.kind===`outside`){Rz(e.kind===`pending`?r:i,c.pathSegments.slice(0,-1),c,Xe(c)),e.kind===`pending`?o=!0:s=!0;continue}let l=n.get(e.key);l||(l={key:e.key,name:t.repository.get(e.key)??e.repository.nameSegments.at(-1)??``,location:Bz(e.repository.id),reason:e.kind===`unresolved`?e.repository.reason:null,main:Lz(),unknown:null,worktrees:new Map},n.set(e.key,l));let u=Ye(c),d=Xe(c),f=e.kind===`repository`?e.repository.checkout:void 0;if(f===null)l.unknown??=Lz(),Rz(l.unknown,u,c,d);else if(f?.kind===`linked`){let e=l.worktrees.get(f.id);e||(e={name:t.worktree.get(f.id)??f.name,location:f.id,branch:Lz()},l.worktrees.set(f.id,e)),Rz(e.branch,u,c,d)}else Rz(l.main,u,c,d)}let c=[];for(let e of n.values()){let t=zz(e.main,e.key);if(e.unknown){let n=`${e.key}\0unknown`;t.push({kind:`group`,key:n,name:Iz,children:zz(e.unknown,n)})}let n=e.main.documents.length===0&&e.main.directories.size===0&&e.unknown===null&&e.worktrees.size===1;for(let[r,i]of e.worktrees){let a=`${e.key}\0worktree:${r}`;t.push({kind:`worktree`,key:a,name:i.name,location:i.location,hidden:n,children:zz(i.branch,a)})}c.push({kind:`repository`,key:e.key,name:e.name,location:e.location,reason:e.reason,merged:n?[...e.worktrees.values()][0]?.name??null:null,children:t})}return o&&c.push({kind:`group`,key:`group:pending`,name:Fz,children:zz(r,`group:pending`)}),s&&c.push({kind:`group`,key:`group:outside`,name:Pz,children:zz(i,`group:outside`)}),a.length>0&&c.push({kind:`group`,key:`group:input`,name:Nz,children:a.map(e=>({kind:`document`,key:e.documentId,name:e.title,document:e}))}),c}var Hz={missing:{label:`File missing`,icon:ce},unreadable:{label:`Unreadable`,icon:B},updating:{label:`Updating`,icon:Ne},error:{label:`error`,icon:L}},Uz=`px-0.5 @min-[13rem]/list:px-2 @min-[13rem]/list:row-open:px-0.5`,Wz=`@min-[13rem]/list:hidden @min-[13rem]/list:row-open:inline`,Gz=`sr-only @min-[13rem]/list:not-sr-only @min-[13rem]/list:row-open:sr-only`,Kz={badge:`px-0.5`,icon:``,text:`sr-only`};function qz({document:e}){let t=e.sourceState===`ready`?null:Hz[e.sourceState],n=t?.icon??L,r=e.pendingRequestIds.length>0?Kz:{badge:Uz,icon:Wz,text:Gz};return(0,H.jsxs)(H.Fragment,{children:[e.sourceState!==`ready`&&(0,H.jsxs)(uE,{variant:`outline`,className:ab(`shrink-0`,r.badge),title:t?.label??e.sourceState,children:[(0,H.jsx)(n,{className:r.icon,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:r.text,children:t?.label??e.sourceState})]}),e.pendingRequestIds.length>0&&(0,H.jsxs)(uE,{className:ab(`shrink-0`,Uz),"data-testid":`pending-question`,title:`A question is awaiting your answer`,children:[(0,H.jsx)(xe,{className:Wz,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:Gz,children:`Question`})]})]})}function Jz(e,t,n){let r=[...e],[i]=r.splice(t,1);return i!==void 0&&r.splice(n,0,i),r}function Yz(e,t){let n=Ge(e),r=[We(et(e,t)),Ve[e.format]];return n.kind===`unresolved`&&r.push(He[n.repository.reason]),r.join(`. `)}function Xz(e,t,n=!1){let r=[e.title,We(et(e,t))];return e.canonicalPath!==null&&r.push(e.canonicalPath),n&&(r.push(`Drag to reorder. Space picks up, ↑↓ moves, Space drops, Escape cancels.`),r.push(`Alt+↑ / Alt+↓ moves it in the list`)),[...new Set(r)].join(`
|
|
162
|
+
`)}function Zz({document:e,labels:t,short:n}){let r=Ge(e);if(r.kind===`input`)return(0,H.jsxs)(`span`,{className:`truncate`,children:[e.sourceKind===`stdin`?`Standard input`:`Generated`,` ·`,` `,Ve[e.format]]});let{stem:i,extension:a}=Ke(We(Xe(e))),o=n===void 0||n.shown.length===0?``:`${n.elided?`…/`:``}${n.shown.map(We).join(`/`)}/`,s=(0,H.jsxs)(`span`,{className:`flex min-w-0 shrink`,children:[o!==``&&(0,H.jsx)(`span`,{className:`min-w-3 shrink-[100000] truncate`,children:o}),(0,H.jsx)(`span`,{className:`min-w-0 shrink truncate`,children:i}),(0,H.jsx)(`span`,{className:`shrink-0`,"data-part":`extension`,children:a})]});if(r.kind===`outside`)return s;if(r.kind===`pending`)return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`shrink-0`,children:`Checking repository…`}),s]});let c=We(t.repository.get(r.key)??``),l=r.kind===`repository`?r.repository.checkout:void 0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`flex max-w-[50%] shrink-0 items-center gap-1 font-medium @min-[13rem]/list:max-w-[60%]`,"data-part":`repository`,children:[r.kind===`unresolved`&&(0,H.jsx)(L,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`bdi`,{className:`min-w-0 truncate`,"data-part":`repository-name`,children:c})]}),l?.kind===`linked`&&(0,H.jsxs)(`span`,{className:`flex min-w-3 shrink-[100000] items-center gap-0.5 overflow-hidden`,"data-part":`worktree`,children:[(0,H.jsx)(pe,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`bdi`,{className:`min-w-0 truncate`,children:We(t.worktree.get(l.id)??l.name)})]}),l===null&&(0,H.jsx)(`span`,{className:`min-w-0 shrink-[100000] truncate`,children:`(unknown checkout)`}),s]})}var Qz=`[content-visibility:auto]`,$z=`focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring`,eB=[zI.configure({activatorElements:e=>[e.element],preventActivation:(e,t)=>t.data.canReorder!==!0||e.target instanceof Element&&e.target.closest(`[data-row-action]`)!==null,activationConstraints:e=>e.pointerType===`touch`?[new FI.Delay({value:250,tolerance:5})]:[new FI.Distance({value:8})]}),OI.configure({keyboardCodes:{...OI.defaults.keyboardCodes,start:[`Space`]},preventActivation:(e,t)=>t.data.canReorder!==!0||e.target!==t.handle})];function tB({document:e,index:t,count:n,labels:r,short:i,active:a,pressedOn:o,onSelect:s,onClose:c,onMove:l}){let u=(0,D.useId)(),d=t>0,f=t<n-1,{ref:p,handleRef:m,isDragSource:h}=Az({id:e.documentId,index:t,disabled:{droppable:n<2},data:{canReorder:n>1},sensors:eB,transition:{duration:180,easing:`ease-out`}});return(0,H.jsxs)(`li`,{ref:p,"data-drag-source":h||void 0,className:ab(`group/row relative rounded-md [contain-intrinsic-size:auto_3.125rem]`,Qz,n>1&&`cursor-grab active:cursor-grabbing`,a?`bg-accent text-accent-foreground`:`hover:bg-muted`,h&&`bg-primary/10 outline-2 -outline-offset-2 outline-dashed outline-primary [&>button]:opacity-0 [&>span]:opacity-0`),children:[h&&(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 flex items-center justify-center text-sm font-medium text-primary`,"data-testid":`drop-position`,children:`Drop here`}),(0,H.jsxs)(`button`,{ref:m,type:`button`,className:ab(`group/button flex w-full min-w-0 flex-col gap-0.5 rounded-md py-1.5 pr-2 pl-2 text-left text-sm`,n>1&&`cursor-grab active:cursor-grabbing`,$z),"aria-current":a?`true`:void 0,"aria-describedby":u,"aria-keyshortcuts":n>1?`Alt+ArrowUp Alt+ArrowDown Space`:void 0,title:Xz(e,r,n>1),"data-document-id":e.documentId,onClick:s,onKeyDown:e=>{h||!e.altKey||e.metaKey||e.ctrlKey||(e.key===`ArrowUp`&&d?(e.preventDefault(),l(t-1)):e.key===`ArrowDown`&&f&&(e.preventDefault(),l(t+1)))},children:[(0,H.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-1.5 row-open:pr-6`,children:[(0,H.jsx)(Mz,{format:e.format}),(0,H.jsx)(`span`,{className:`min-w-12 flex-1 truncate`,"data-part":`title`,children:e.title}),(0,H.jsx)(qz,{document:e})]}),(0,H.jsx)(`span`,{className:`flex w-full min-w-0 items-center gap-1.5 overflow-hidden pl-6 text-xs text-muted-foreground group-focus-visible/button:hidden`,"aria-hidden":`true`,"data-part":`location`,children:(0,H.jsx)(Zz,{document:e,labels:r,short:i})}),(0,H.jsx)(`span`,{className:`hidden pl-6 text-xs break-all text-muted-foreground group-focus-visible/button:block`,"aria-hidden":`true`,"data-part":`location-full`,children:We(et(e,r))})]}),(0,H.jsx)(`span`,{id:u,hidden:!0,children:Yz(e,r)}),(0,H.jsx)(`span`,{className:`pointer-events-none absolute top-1 right-1 flex items-center gap-0.5 row-open:pointer-events-auto`,children:(0,H.jsx)(pb,{variant:`ghost`,size:`icon-xs`,className:`opacity-0 row-open:opacity-100`,"aria-label":`Remove ${e.title} from the list`,title:`Remove from the list (the file is not deleted)`,"data-row-action":`remove`,onClick:(e=>t=>{t.detail>0&&o.current!==t.currentTarget||e()})(c),children:(0,H.jsx)(ze,{"aria-hidden":`true`})})})]})}function nB({document:e,name:t,labels:n,active:r,depth:i,onSelect:a,onClose:o}){let s=(0,D.useId)();return(0,H.jsx)(`li`,{role:`treeitem`,className:ab(`[contain-intrinsic-size:auto_2.25rem]`,Qz),style:{paddingLeft:`${String(i*.75)}rem`},children:(0,H.jsxs)(`div`,{className:ab(`group/row flex items-center gap-1 rounded-md pr-1`,r?`bg-accent text-accent-foreground`:`hover:bg-muted`),children:[(0,H.jsxs)(`button`,{type:`button`,className:ab(`flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm`,$z),"aria-current":r?`true`:void 0,"aria-describedby":s,title:Xz(e,n),"data-document-id":e.documentId,onClick:a,children:[(0,H.jsx)(Mz,{format:e.format}),(0,H.jsx)(`bdi`,{className:`min-w-12 flex-1 truncate`,children:We(t)}),(0,H.jsx)(qz,{document:e})]}),(0,H.jsx)(`span`,{id:s,hidden:!0,children:Yz(e,n)}),(0,H.jsx)(pb,{variant:`ghost`,size:`icon-xs`,className:`opacity-0 row-open:opacity-100`,"aria-label":`Remove ${e.title} from the list`,title:`Remove from the list (the file is not deleted)`,onClick:o,children:(0,H.jsx)(ze,{"aria-hidden":`true`})})]})})}var rB=`sticky flex h-7 items-center gap-2 bg-background px-2 text-xs`;function iB({nodes:e,depth:t,labels:n,props:r}){let i=e=>({paddingLeft:`${String(.5+e*.75)}rem`});return(0,H.jsx)(`ul`,{className:`flex flex-col gap-0.5`,role:t===0?`tree`:`group`,children:e.map(e=>{switch(e.kind){case`document`:return(0,H.jsx)(nB,{document:e.document,name:e.name,labels:n,active:e.document.documentId===r.activeId,depth:t,onSelect:()=>r.onSelect(e.document.documentId),onClose:()=>r.onClose(e.document.documentId)},e.key);case`repository`:{let a=e.merged===null?e.name:`${e.name}, worktree ${e.merged}`,o=e.reason===null?null:He[e.reason];return(0,H.jsxs)(`li`,{role:`treeitem`,"aria-expanded":`true`,"aria-label":We(a),"data-node":`repository`,children:[(0,H.jsxs)(`div`,{className:ab(rB,`top-0 z-20 font-medium`),style:i(t),title:[e.location,o].filter(Boolean).join(`
|
|
163
|
+
`),children:[e.reason===null?(0,H.jsx)(V,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}):(0,H.jsx)(L,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,H.jsx)(`bdi`,{className:`max-w-[60%] shrink-0 truncate`,children:We(e.name)}),e.merged!==null&&(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 font-normal text-muted-foreground`,children:[(0,H.jsx)(pe,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`bdi`,{className:`truncate`,children:We(e.merged)})]}),o!==null&&(0,H.jsx)(`span`,{className:`sr-only`,children:o})]}),(0,H.jsx)(iB,{nodes:e.children,depth:t+1,labels:n,props:r})]},e.key)}case`worktree`:return(0,H.jsxs)(`li`,{role:`treeitem`,"aria-expanded":`true`,"aria-label":`Worktree ${We(e.name)}`,"data-node":`worktree`,children:[(0,H.jsxs)(`div`,{className:e.hidden?`sr-only`:ab(rB,`top-7 z-10`),style:e.hidden?void 0:i(t),title:e.location,children:[(0,H.jsx)(pe,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,H.jsx)(`bdi`,{className:`truncate`,children:We(e.name)})]}),(0,H.jsx)(iB,{nodes:e.children,depth:e.hidden?t:t+1,labels:n,props:r})]},e.key);case`group`:case`directory`:return(0,H.jsxs)(`li`,{role:`treeitem`,"aria-expanded":`true`,"aria-label":We(e.name),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 text-xs text-muted-foreground`,style:i(t),children:[(0,H.jsx)(de,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`bdi`,{className:`truncate`,children:We(e.name)})]}),(0,H.jsx)(iB,{nodes:e.children,depth:t+1,labels:n,props:r})]},e.key);default:return null}})})}function aB(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return r.bottom>n.top&&r.top<n.bottom}function oB(e,t){return e.querySelector(`[data-document-id="${CSS.escape(t)}"]`)}function sB(e){let t=(0,D.useRef)(null);(0,D.useEffect)(()=>{let n=e.current;if(!n)return;let r=e=>{let r=e.target.closest(`li`)?.querySelector(`[data-document-id]`),i=r?.dataset.documentId;t.current=r&&i!==void 0?{documentId:i,visible:aB(n,r)}:null},i=e=>{let r=e.target;setTimeout(()=>{r.isConnected&&(n.contains(globalThis.document.activeElement)||(t.current=null))},0)},a=()=>{let e=t.current;if(!e)return;let r=oB(n,e.documentId);e.visible=r!==null&&aB(n,r)};return n.addEventListener(`focusin`,r),n.addEventListener(`focusout`,i),n.addEventListener(`scroll`,a,{passive:!0}),()=>{n.removeEventListener(`focusin`,r),n.removeEventListener(`focusout`,i),n.removeEventListener(`scroll`,a)}},[e]),(0,D.useLayoutEffect)(()=>{let n=e.current,r=t.current;if(!n||!r)return;let i=oB(n,r.documentId);if(!i){t.current=null;return}let a=globalThis.document.activeElement;(a===null||a===globalThis.document.body)&&i.focus({preventScroll:!0}),r.visible&&!aB(n,i)&&i.scrollIntoView({block:`nearest`}),r.visible=aB(n,i)})}function cB({documents:e,snapshot:t,onChanged:n,onFinished:r}){let i=ML(),{source:a}=cR();return(0,D.useEffect)(()=>{t&&(a?!i?.dragOperation.controller?.signal.aborted&&(t.length!==e.length||t.some((t,n)=>t.documentId!==e[n]?.documentId))&&(n(),i?.actions.stop({canceled:!0})):r())},[e,t,a,i,n,r]),null}function lB(e){let{documents:t,activeId:n,view:r,onViewChange:i,onSelect:a,onClose:o,onReorder:s}=e,[c,l]=(0,D.useState)(null),[u,d]=(0,D.useState)(null),f=t.map(e=>e.documentId),p=e.labels,m=(0,D.useMemo)(()=>p??Je(t),[p,t]),h=(0,D.useRef)(null),g=(0,D.useMemo)(()=>Qe(t),[t]),_=(0,D.useMemo)(()=>r===`tree`?Vz(t,m):[],[t,m,r]),v=(0,D.useRef)(null);return sB(v),(0,H.jsxs)(`nav`,{"aria-label":`Open documents`,className:`flex h-full min-h-0 flex-col`,onPointerDownCapture:e=>{h.current=e.target.closest(`button`)},children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-3 py-2`,children:[(0,H.jsxs)(`h2`,{className:`text-sm font-medium`,children:[`Open documents (`,t.length,`)`]}),u&&(0,H.jsx)(vx,{title:`Order not changed`,trigger:(0,H.jsx)(pb,{variant:`ghost`,size:`icon-xs`,"aria-label":`Order not changed`,className:`text-destructive`,children:(0,H.jsx)(L,{"aria-hidden":`true`})}),children:(0,H.jsx)(`p`,{children:u})}),(0,H.jsx)(`span`,{role:`status`,className:`sr-only`,children:u}),(0,H.jsxs)(yE,{value:[r],onValueChange:e=>{let t=e[0];(t===`flat`||t===`tree`)&&i(t)},size:`sm`,"aria-label":`List layout`,children:[(0,H.jsx)(bE,{value:`flat`,children:`Flat`}),(0,H.jsx)(bE,{value:`tree`,children:`Tree`})]})]}),(0,H.jsx)(`div`,{ref:v,className:ab(`@container/list min-h-0 flex-1 overflow-y-auto p-2`,r===`tree`&&`scroll-pt-14`),children:t.length===0?(0,H.jsxs)(`p`,{className:`px-2 py-4 text-sm text-muted-foreground`,children:[`No documents are open. Run `,(0,H.jsx)(`code`,{children:`vo <file>`}),` in the CLI to show them here.`]}):r===`tree`?(0,H.jsx)(iB,{nodes:_,depth:0,labels:m,props:{activeId:n,onSelect:a,onClose:o}}):(0,H.jsxs)(AL,{onDragStart:()=>{l(t),d(null)},onDragEnd:e=>{if(e.canceled||!e.operation.target||!PR(e.operation.source))return;let n=e.operation.source;if(n.initialIndex===n.index)return;let r=(c??t).map(e=>e.documentId);if(r.length!==f.length||r.some((e,t)=>e!==f[t])){d(`The document list changed while dragging. Drag again to reorder the current list.`);return}s(Jz(f,n.initialIndex,n.index))},children:[(0,H.jsx)(cB,{documents:t,snapshot:c,onChanged:()=>d(`The document list changed while dragging. Drag again to reorder the current list.`),onFinished:()=>l(null)}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(c??t).map((e,r)=>(0,H.jsx)(tB,{document:e,index:r,count:(c??t).length,labels:m,short:g.get(e.documentId),active:e.documentId===n,pressedOn:h,onSelect:()=>a(e.documentId),onClose:()=>o(e.documentId),onMove:e=>s(Jz(f,r,e))},e.documentId))}),(0,H.jsx)(PL,{dropAnimation:{duration:180,easing:`ease-out`},children:e=>{let n=(c??t).find(t=>t.documentId===e.id);return n?(0,H.jsxs)(`div`,{"aria-hidden":`true`,"data-testid":`drag-card`,className:`rounded-md border border-primary bg-background p-3 text-sm shadow-lg`,children:[(0,H.jsxs)(`p`,{className:`flex items-center gap-2 font-medium`,children:[(0,H.jsx)(Mz,{format:n.format}),n.title]}),(0,H.jsx)(`p`,{className:`mt-1 truncate text-xs text-muted-foreground`,children:We(et(n,m))})]}):null}})]})})]})}var uB=`document`,dB=`section`,fB=`heading`;function pB(){return new URLSearchParams(window.location.search).get(uB)}function mB(){let e=new URLSearchParams(window.location.search),t=e.get(dB),n=e.get(fB);return t===null||n===null?null:{sectionId:t,title:n}}function hB(e,t){let n=new URL(window.location.href);n.searchParams.get(uB)!==e&&(n.searchParams.delete(dB),n.searchParams.delete(fB)),e===null?n.searchParams.delete(uB):n.searchParams.set(uB,e),n.href!==window.location.href&&(t===`push`?window.history.pushState(null,``,n):window.history.replaceState(null,``,n))}function gB(e,t){let n=new URL(window.location.href);n.searchParams.get(uB)===e&&(t===null?(n.searchParams.delete(dB),n.searchParams.delete(fB)):(n.searchParams.set(dB,t.sectionId),n.searchParams.set(fB,t.title)),n.href!==window.location.href&&window.history.replaceState(null,``,n))}function _B(e){let t=!1,n=null,r=async()=>{let r=!1;for(;t;){t=!1;try{await e(),r=!0}catch{r=!1}}return n=null,r};return()=>(t=!0,n??=r(),n)}var vB=180,yB=480,bB=260;function xB(e,t){if(t===null)return e;let n=new Map(e.map(e=>[e.documentId,e])),r=t.flatMap(e=>n.get(e)??[]),i=new Set(t),a=e.filter(e=>!i.has(e.documentId));return[...r,...a]}var SB=e=>typeof e==`number`&&e>=vB&&e<=yB;function CB(){let[e,t]=jE(`theme`,`system`,ME),[n,r]=jE(`color-palette`,`standard`,PE);return(0,D.useEffect)(()=>{let t=window.matchMedia(`(prefers-color-scheme: dark)`),r=()=>FE(e,n);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e,n]),{theme:e,setTheme:t,palette:n,setPalette:r}}function wB({api:e}){let[t,n]=(0,D.useState)({documents:[],version:0}),[r,i]=(0,D.useState)({activeId:null,initialized:!1,history:`replace`,requestedAt:0,restore:null,restores:0}),[a,o]=(0,D.useState)(null),s=(0,D.useMemo)(()=>xB(t.documents,a),[t.documents,a]),{activeId:c}=r,l=(0,D.useCallback)((e,t=0)=>{i(n=>n.activeId===e?t>n.requestedAt?{...n,requestedAt:t}:n:{...n,activeId:e,history:`push`,requestedAt:t,restore:null})},[]),u=(0,D.useCallback)(e=>{c!==null&&gB(c,e)},[c]),d=(0,D.useRef)(s);(0,D.useEffect)(()=>{d.current=s},[s]);let f=(0,D.useRef)(!1);(0,D.useEffect)(()=>{r.initialized&&(hB(r.activeId,f.current?r.history:`replace`),f.current=!0)},[r]),(0,D.useEffect)(()=>{let e=()=>{let e=pB(),t=mB();i(n=>{if(!n.initialized)return n;if(!(e===n.activeId||d.current.some(t=>t.documentId===e))||e===null)return{...n,history:`replace`};let r=n.restores+1;return{...n,activeId:e,history:`replace`,requestedAt:e===n.activeId?n.requestedAt:0,restore:t===null?null:{...t,id:r},restores:r}})};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);let[p,m]=(0,D.useState)(null),[h,g]=jE(`sidebar-view`,`flat`,IE),[_,v]=jE(`sidebar-width`,bB,SB),{theme:y,setTheme:b,palette:x,setPalette:S}=CB(),C=(0,D.useRef)(null),[w,T]=(0,D.useState)(0),[E,O]=(0,D.useState)(0),[k,A]=(0,D.useState)(!1),[j,M]=(0,D.useState)(!1),[N,P]=(0,D.useState)(null);(0,D.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()===`k`&&(e.preventDefault(),A(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let F=e=>{l(e.documentId),i(e=>e.restore===null?e:{...e,restore:null}),P(t=>({documentId:e.documentId,sectionId:e.sectionId,revision:e.revision,nonce:(t?.nonce??0)+1}))},I=(0,D.useCallback)(async()=>{let[t,r]=await Promise.all([e.documents(),e.status()]);n({documents:t.documents,version:t.catalogVersion}),i(e=>{let n=e=>e!==null&&t.documents.some(t=>t.documentId===e),i=t.catalogVersion<e.requestedAt;if(n(e.activeId)||i&&e.activeId!==null)return e.initialized?e:{...e,initialized:!0,history:`replace`};let a=pB(),o=e.initialized?null:[a,r.activeDocumentId].find(n)??null,s=o!==null&&o===a?mB():null,c=e.restores+1;return{...e,activeId:o??t.documents[0]?.documentId??null,initialized:!0,history:`replace`,requestedAt:0,restore:s===null?null:{...s,id:c},restores:c}})},[e]),L=(0,D.useMemo)(()=>_B(I),[I]),R=(0,D.useRef)({chain:Promise.resolve(),pending:0,drained:0}),z=(0,D.useCallback)(async()=>{let e=R.current,t=e.pending===0,n=e.drained;await L()&&t&&e.pending===0&&e.drained===n&&o(null)},[L]);(0,D.useEffect)(()=>{let t=e.events({onEvent:e=>{let t=C.current;if(C.current={daemonId:e.daemonId,sequence:e.sequence},e.type===`daemon-stopping`){m(`The daemon has stopped. Run the CLI to open it again.`);return}e.type===`focus-requested`&&e.documentId&&l(e.documentId,e.catalogVersion);let n=t!==null&&(t.daemonId!==e.daemonId||e.sequence>t.sequence+1);(e.type===`feedback-changed`||e.type===`resync-required`||n)&&T(e=>e+1),e.type===`render-diagnostics`&&O(e=>e+1),(e.type!==`hello`||n)&&z()},onConnect:()=>{m(null),T(e=>e+1),z()}});return()=>t.close()},[e,z,l]);let ee=(0,D.useMemo)(()=>s.find(e=>e.documentId===c)??null,[s,c]),te=(0,D.useMemo)(()=>Je(s),[s]),ne=(0,D.useRef)(0);return(0,D.useEffect)(()=>{ne.current=Math.max(ne.current,t.version)},[t.version]),(0,H.jsxs)(`div`,{className:`flex h-svh flex-col bg-background text-foreground`,children:[(0,H.jsxs)(`header`,{className:`flex min-w-0 items-center justify-between gap-2 border-b px-4 py-2 sm:gap-3`,children:[(0,H.jsxs)(pb,{variant:`ghost`,size:`sm`,className:`min-[900px]:hidden`,"aria-expanded":j,"aria-controls":`document-list`,onClick:()=>M(e=>!e),children:[j?(0,H.jsx)(ze,{"aria-hidden":`true`}):(0,H.jsx)(ye,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`max-sm:sr-only`,children:`Document list`})]}),(0,H.jsx)(`p`,{className:`shrink-0 text-sm font-semibold`,children:`vde-open`}),(0,H.jsxs)(pb,{variant:`outline`,size:`sm`,className:`ml-auto`,onClick:()=>A(!0),"aria-keyshortcuts":`Meta+K Control+K`,children:[(0,H.jsx)(Fe,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`max-sm:sr-only`,children:`Search open documents`}),(0,H.jsx)(`kbd`,{className:`ml-1 text-xs text-muted-foreground max-sm:hidden`,children:`⌘K`})]}),(0,H.jsxs)(vx,{title:`Color palette`,trigger:(0,H.jsx)(pb,{variant:`outline`,size:`icon-sm`,"aria-label":`Color palette`,title:`Color palette: ${NE.find(e=>e.value===x)?.label}`,children:(0,H.jsx)(De,{"aria-hidden":`true`})}),children:[(0,H.jsx)(`label`,{htmlFor:`color-palette`,className:`font-medium`,children:`Palette`}),(0,H.jsx)(`select`,{id:`color-palette`,value:x,onChange:e=>{PE(e.target.value)&&S(e.target.value)},className:`h-9 w-full rounded-md border border-input bg-background px-3 text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:NE.map(e=>(0,H.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,H.jsxs)(yE,{value:[y],onValueChange:e=>{let t=e[0];ME(t)&&b(t)},size:`sm`,"aria-label":`Color scheme`,children:[(0,H.jsx)(bE,{value:`light`,"aria-label":`Light`,children:(0,H.jsx)(Le,{"aria-hidden":`true`})}),(0,H.jsx)(bE,{value:`dark`,"aria-label":`Dark`,children:(0,H.jsx)(Te,{"aria-hidden":`true`})}),(0,H.jsx)(bE,{value:`system`,"aria-label":`Match OS setting`,children:(0,H.jsx)(Ce,{"aria-hidden":`true`})})]})]}),p&&(0,H.jsx)(`p`,{role:`status`,className:`border-b bg-muted px-4 py-2 text-sm`,children:p}),(0,H.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,children:[(0,H.jsx)(`div`,{id:`document-list`,className:`${j?`block`:`hidden`} absolute inset-y-0 left-0 z-20 w-72 max-w-[85vw] shrink-0 border-r bg-background shadow-lg min-[900px]:static min-[900px]:block min-[900px]:max-w-none min-[900px]:shadow-none`,style:{width:j?void 0:_},children:(0,H.jsx)(lB,{documents:s,labels:te,activeId:c,view:h,onViewChange:g,onSelect:e=>{l(e),M(!1)},onClose:t=>void e.close(t).then(L,L),onReorder:t=>{o(t);let n=R.current;n.pending+=1,n.chain=n.chain.then(async()=>{try{let n=await e.reorder(t,ne.current);ne.current=Math.max(ne.current,n)}catch{}--n.pending,n.pending===0&&(n.drained+=1,z())})}})}),(0,H.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize document list`,className:`hidden w-1 shrink-0 cursor-col-resize hover:bg-border min-[900px]:block`,onPointerDown:e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&v(Math.min(yB,Math.max(vB,e.clientX)))}}),ee?(0,H.jsx)(nt,{value:te,children:(0,H.jsx)(lD,{documents:s,api:e,document:ee,feedbackSignal:w,renderSignal:E,sectionTarget:N?.documentId===ee.documentId?N:null,restoreHeading:r.restore,onHeadingShown:u})}):(0,H.jsx)(`main`,{className:`flex flex-1 items-center justify-center p-8 text-sm text-muted-foreground`,children:`Select a document from the list on the left to show it here.`})]}),(0,H.jsx)(xD,{api:e,open:k,onOpenChange:A,onSelect:F})]})}function TB(){let[e]=(0,D.useState)(US);return(0,H.jsx)(wB,{api:e})}FE(AE(`theme`,`system`,ME),AE(`color-palette`,`standard`,PE));var EB=document.getElementById(`root`);if(!EB)throw Error(`#root not found`);(0,Be.createRoot)(EB).render((0,H.jsx)(D.StrictMode,{children:(0,H.jsx)(TB,{})}));
|