@pie-players/pie-section-player 1.0.0-beta.1 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
- import{t as Or}from"./attribute-coercion-b93b482c.js";import{t as Hr}from"./versioned-tag-54a76be9.js";import{i as xr,r as Nr}from"./tool-host-contract-fae1c415.js";if(typeof window<"u"){var un,hn;((un=(hn=window).__svelte??(hn.__svelte={})).v??(un.v=new Set)).add("5")}var me={},R=Symbol("uninitialized"),Kr=Array.isArray,Wr=Array.prototype.indexOf,Pe=Array.prototype.includes,Gr=Array.from,ge=Object.keys,Vt=Object.defineProperty,wt=Object.getOwnPropertyDescriptor,Pr=Object.prototype,Fr=Array.prototype,Br=Object.getPrototypeOf,fn=Object.isExtensible,Dr=()=>{};function qr(e){for(var t=0;t<e.length;t++)e[t]()}function jr(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Yt(e){"@babel/helpers - typeof";return Yt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yt(e)}function Xr(e,t){if(Yt(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Yt(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function zr(e){var t=Xr(e,"string");return Yt(t)=="symbol"?t:t+""}function u(e,t,n){return(t=zr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var et=1024,ot=2048,kt=4096,On=8192,Vr=16384,Hn=32768,dn=1<<25,xn=65536,te=1<<19,Yr=1<<20,vn=1<<21,Nn=1<<23,jt=Symbol("$state"),Kn=Symbol("component"),Wn=Symbol("legacy props"),Ur=Symbol("attributes"),Jr=Symbol("class"),Qr=Symbol("style"),Zr=Symbol("text"),Ce=new class extends Error{constructor(...e){super(...e),u(this,"name","StaleReactionError"),u(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};globalThis.document?.contentType;function ti(){console.warn("https://svelte.dev/e/derived_inert")}function Gn(e){console.warn("https://svelte.dev/e/hydration_mismatch")}function ei(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}var U=!1;function re(e){U=e}var W;function Ut(e){if(e===null)throw Gn(),me;return W=e}function Pn(){return Ut(Bt(W))}function ni(e=1){if(U){for(var t=e,n=W;t--;)n=Bt(n);W=n}}function ri(e=!0){for(var t=0,n=W;;){if(n.nodeType===8){var r=n.data;if(r==="]"){if(t===0)return n;t-=1}else(r==="["||r==="[!"||r[0]==="["&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=Bt(n);e&&n.remove(),n=i}}function Fn(e){return e===this.v}function ii(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Bn(e){return!ii(e,this.v)}function si(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function ai(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function oi(e){throw new Error("https://svelte.dev/e/effect_orphan")}function li(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function ci(){throw new Error("https://svelte.dev/e/hydration_failed")}function ui(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function hi(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function fi(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function di(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function vi(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}var Qe=!1,ke=!1,L=null;function ye(e){L=e}function Dn(e,t=!1,n){L={p:L,i:!1,c:null,e:null,s:e,x:null,r:T,l:ke&&!t?{s:null,u:null,$:[]}:null}}function qn(e){var t=L,n=t.e;if(n!==null){t.e=null;for(var r of n)ur(r)}return e!==void 0&&(t.x=e),t.i=!0,L=t.p,Ze(e)}function Ze(e={}){return Vt(e,Kn,{value:!0}),e}function Ie(){return!ke||L!==null&&L.l===null}var St=[];function jn(){var e=St;St=[],qr(e)}function Tt(e){if(St.length===0&&!Xt){var t=St;queueMicrotask(()=>{t===St&&jn()})}St.push(e)}function pi(){for(;St.length>0;)jn()}var mi=~(ot|kt|et);function M(e,t){e.f=e.f&mi|t}function tn(e){(e.f&512)!==0||e.deps===null?M(e,et):M(e,kt)}function Xn(e,t,n){(e.f&2048)!==0?t.add(e):e.f&4096&&n.add(e),M(e,et)}function Le(e){var t=w,n=T;at(null),pt(null);try{return e()}finally{at(t),pt(n)}}function be(e){var t=2|ot;return T!==null&&(T.f|=te),{ctx:L,deps:null,effects:null,equals:Fn,f:t,fn:e,reactions:null,rv:0,v:R,wv:0,parent:T,ac:null}}var gi=Symbol("obsolete");function pn(e){const t=be(e);return vr(t),t}function yi(e){const t=be(e);return t.equals=Bn,t}function bi(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)J(t[n])}}function en(e){var t,n=T,r=e.parent;if(!ht&&r!==null&&e.v!==R&&(r.f&24576)!==0)return ti(),e.v;pt(r);try{bi(e),t=yr(e)}finally{pt(n)}return t}function zn(e){var t=en(e);if(!e.equals(t)&&(e.wv=mr(),(!$?.is_fork||e.deps===null)&&($!==null?($.capture(e,t,!0),Be?.capture(e,t,!0)):e.v=t,e.deps===null))){M(e,et);return}ht||(K!==null?(rn()||$?.is_fork)&&K.set(e,t):tn(e))}function Si(e){if(e.effects!==null)for(const t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac!==null&&Le(()=>{t.ac.abort(Ce),t.ac=null}),t.fn!==null&&(t.teardown=Dr),Qt(t,0),an(t))}function Vn(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&t.fn!==null&&Pt(t)}function Yn(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function nn(e,t){Yn(e,t),t.add(e)}function S(e,t,n){Yn(e,t),t.set(e,n)}function g(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function v(e,t,n){return e.set(g(e,t),n),n}function a(e,t){return e.get(g(e,t))}var Un,Fe=null,Mt=null,$=null,Be=null,K=null,De=null,Xt=!1,He=!1,Jt=null,Se=null,Jn=0,Ai=1,qe=new WeakMap,Et=new WeakMap,Kt=new WeakMap,Ae=new WeakMap,ie=new WeakMap,Ot=new WeakMap,yt=new WeakMap,qt=new WeakMap,rt=new WeakMap,mn=new WeakMap,Gt=new WeakMap,ut=new WeakMap,ft=new WeakMap,xe=new WeakMap,se=new WeakMap,k=new WeakSet,Ft=class Qn{constructor(){nn(this,k),u(this,"id",Ai++),S(this,qe,!1),u(this,"linked",!0),S(this,Et,null),S(this,Kt,null),u(this,"async_deriveds",new Map),u(this,"current",new Map),u(this,"previous",new Map),S(this,Ae,new Set),S(this,ie,new Set),S(this,Ot,0),S(this,yt,new Map),S(this,qt,null),S(this,rt,[]),S(this,mn,[]),S(this,Gt,new Set),S(this,ut,new Set),S(this,ft,new Map),S(this,xe,new Set),u(this,"is_fork",!1),S(this,se,!1),Mt===null?Fe=Mt=this:(v(Kt,Mt,this),v(Et,this,Mt)),Mt=this}skip_effect(t){a(ft,this).has(t)||a(ft,this).set(t,{d:[],m:[]}),a(xe,this).delete(t)}unskip_effect(t,n=r=>this.schedule(r)){var r=a(ft,this).get(t);if(r){a(ft,this).delete(t);for(var i of r.d)M(i,ot),n(i);for(i of r.m)M(i,kt),n(i)}a(xe,this).add(t)}capture(t,n,r=!1){t.v!==R&&!this.previous.has(t)&&this.previous.set(t,t.v),!(t.f&8388608)&&(this.current.set(t,[n,r]),K?.set(t,n)),this.is_fork||(t.v=n)}activate(){$=this}deactivate(){$=null,K=null}flush(){try{He=!0,$=this,g(k,this,we).call(this)}finally{Jn=0,De=null,Jt=null,Se=null,He=!1,$=null,K=null,st.clear()}}discard(){for(const t of a(ie,this))t(this);a(ie,this).clear();for(const t of this.async_deriveds.values())t.reject(gi);g(k,this,Ee).call(this),a(qt,this)?.resolve()}register_created_effect(t){a(mn,this).push(t)}increment(t,n){if(v(Ot,this,a(Ot,this)+1),t){let r=a(yt,this).get(n)??0;a(yt,this).set(n,r+1)}}decrement(t,n){if(v(Ot,this,a(Ot,this)-1),t){let r=a(yt,this).get(n)??0;r===1?a(yt,this).delete(n):a(yt,this).set(n,r-1)}a(se,this)||(v(se,this,!0),Tt(()=>{v(se,this,!1),this.linked&&this.flush()}))}transfer_effects(t,n){for(const r of t)a(Gt,this).add(r);for(const r of n)a(ut,this).add(r);t.clear(),n.clear()}oncommit(t){a(Ae,this).add(t)}ondiscard(t){a(ie,this).add(t)}settled(){return(a(qt,this)??v(qt,this,jr())).promise}static ensure(){if($===null){const t=$=new Qn;!He&&!Xt&&Tt(()=>{a(qe,t)||t.flush()})}return $}apply(){if(!Qe||!this.is_fork&&a(Et,this)===null&&a(Kt,this)===null){K=null;return}K=new Map;for(const[n,[r]]of this.current)K.set(n,r);for(let n=Fe;n!==null;n=a(Kt,n))if(!(n===this||n.is_fork)){var t=!1;if(n.id<this.id){for(const[r,[,i]]of n.current)if(!i&&this.current.has(r)){t=!0;break}}if(!t)for(const[r,i]of n.previous)K.has(r)||K.set(r,i)}}schedule(t){if(De=t,t.b?.is_pending&&(t.f&16777228)!==0&&(t.f&32768)===0){t.b.defer_effect(t);return}a(rt,this).push(t)}};Un=Ft;function gn(){if(this.is_fork)return!0;for(const n of a(yt,this).keys()){for(var e=n,t=!1;e.parent!==null;){if(a(ft,this).has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}function wi(){var e=[];for(const i of a(rt,this))if(!((i.f&16384)!==0||(i.f&6144)===0)){for(var t=i,n=!1;t.parent!==null;){t=t.parent;var r=t.f;if((r&96)!==0){if((r&1024)===0){n=!0;break}t.f^=et}}n||e.push(t)}return v(rt,this,[]),e}function we(){v(qe,this,!0);for(const o of a(Gt,this))a(ut,this).delete(o),M(o,ot),this.schedule(o);for(const o of a(ut,this))M(o,kt),this.schedule(o);this.apply();for(var e=Jt=[],t=[],n=Se=[];a(rt,this).length>0;){Jn++>1e3&&(g(k,this,Ee).call(this),Ti());for(const o of g(k,this,wi).call(this))try{g(k,this,Ei).call(this,o,e,t)}catch(l){throw er(o),g(k,this,gn).call(this)||this.discard(),l}}if($=null,n.length>0){var r=Un.ensure();for(const o of n)r.schedule(o)}if(Jt=null,Se=null,g(k,this,gn).call(this)){g(k,this,ae).call(this,t),g(k,this,ae).call(this,e);for(const[o,l]of a(ft,this))tr(o,l);n.length>0&&g(k,$,we).call($);return}const i=g(k,this,$i).call(this);if(i){g(k,this,ae).call(this,t),g(k,this,ae).call(this,e),g(k,i,_i).call(i,this);return}a(Gt,this).clear(),a(ut,this).clear();for(const o of a(Ae,this))o(this);a(Ae,this).clear(),Be=this,yn(t),yn(e),Be=null,a(qt,this)?.resolve();var s=$;if(a(Ot,this)===0&&(a(rt,this).length===0||s!==null)&&g(k,this,Ee).call(this),a(rt,this).length>0)if(s!==null){for(const o of a(rt,this))a(rt,s).push(o);v(rt,this,[])}else s=this;s!==null&&(st.clear(),g(k,s,we).call(s))}function Ei(e,t,n){e.f^=et;for(var r=e.first;r!==null;){var i=r.f,s=(i&96)!==0;if(!(s&&(i&1024)!==0||(i&8192)!==0||a(ft,this).has(r))&&r.fn!==null){s?r.f^=et:(i&4)!==0?t.push(r):Qe&&(i&16777224)!==0?n.push(r):ee(r)&&(i&16&&a(ut,this).add(r),Pt(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var l=r.next;if(l!==null){r=l;break}r=r.parent}}}function $i(){for(var e=a(Et,this);e!==null;){if(!e.is_fork){for(const[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=a(Et,e)}return null}function _i(e){for(const[n,r]of e.current)!this.previous.has(n)&&e.previous.has(n)&&this.previous.set(n,e.previous.get(n)),this.current.set(n,r);for(const[n,r]of e.async_deriveds){const i=this.async_deriveds.get(n);i&&r.promise.then(i.resolve).catch(i.reject)}e.async_deriveds.clear(),this.transfer_effects(a(Gt,e),a(ut,e));const t=n=>{var r=n.reactions;if(r!==null&&!((n.f&2)!==0&&(n.f&6144)===0))for(const o of r){var i=o.f;if((i&2)!==0)t(o);else{var s=o;i&4194320&&!this.async_deriveds.has(s)&&(a(ut,this).delete(s),M(s,ot),this.schedule(s))}}};for(const n of this.current.keys())t(n);this.oncommit(()=>e.discard()),g(k,e,Ee).call(e),$=this,g(k,this,we).call(this)}function ae(e){for(var t=0;t<e.length;t+=1)Xn(e[t],a(Gt,this),a(ut,this))}function Ee(){if(this.linked){var e=a(Et,this),t=a(Kt,this);e===null?Fe=t:v(Kt,e,t),t===null?Mt=e:v(Et,t,e),this.linked=!1}}function Ht(e){var t=Xt;Xt=!0;try{var n;for(e&&($!==null&&!$.is_fork&&$.flush(),n=e());;){if(pi(),$===null)return n;$.flush()}}finally{Xt=t}}function Ti(){try{li()}catch(e){dt(e,De)}}var ct=null;function yn(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if((r.f&24576)===0&&ee(r)&&(ct=new Set,Pt(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&fr(r),ct?.size>0)){st.clear();for(const i of ct){if((i.f&24576)!==0)continue;const s=[i];let o=i.parent;for(;o!==null;)ct.has(o)&&(ct.delete(o),s.push(o)),o=o.parent;for(let l=s.length-1;l>=0;l--){const c=s[l];!(c.f&24576)&&Pt(c)}}ct.clear()}}ct=null}}function Zn(e){$.schedule(e)}function tr(e,t){if(!((e.f&32)!==0&&(e.f&1024)!==0)){(e.f&2048)!==0?t.d.push(e):e.f&4096&&t.m.push(e),M(e,et);for(var n=e.first;n!==null;)tr(n,t),n=n.next}}function er(e){M(e,et);for(var t=e.first;t!==null;)er(t),t=t.next}var $e=new Set,st=new Map,nr=!1;function Re(e,t){return{f:0,v:e,reactions:null,equals:Fn,rv:0,wv:0}}function B(e,t){const n=Re(e,t);return vr(n),n}function Ci(e,t=!1,n=!0){const r=Re(e);if(t||(r.equals=Bn),ke&&n&&L!==null&&L.l!==null){var i;((i=L.l).s??(i.s=[])).push(r)}return r}function O(e,t,n=!1){return w!==null&&(!V||w.f&131072)&&Ie()&&w.f&4325394&&(Q===null||!Q.has(e))&&di(),rr(e,n?Wt(t):t,Se)}var bt=null,je=0;function rr(e,t,n=null){if(!e.equals(t)){ht?st.set(e,t):st.has(e)||st.set(e,e.v);var r=Ft.ensure();if(r.capture(e,t),(e.f&2)!==0){const i=e;e.f&2048&&en(i),K===null&&tn(i)}e.wv=mr(),bt=null,je=0,ir(e,ot,n),bt=null,Ie()&&T!==null&&T.f&1024&&!(T.f&96)&&(X===null?Fi([e]):X.push(e)),!r.is_fork&&$e.size>0&&!nr&&ki()}return t}function ki(){nr=!1;for(const e of $e){e.f&1024&&M(e,kt);let t;try{t=ee(e)}catch{t=!0}t&&Pt(e)}$e.clear()}function zt(e){O(e,e.v+1)}function ir(e,t,n){var r=e.reactions;if(r!==null){var i=Ie(),s=r.length;if(je+=s,je>1e5&&bt===null&&(bt=new Set),bt!==null){if(bt.has(e))return;bt.add(e)}for(var o=0;o<s;o++){var l=r[o],c=l.f;if(!(!i&&l===T)){var h=(c&ot)===0;if(h&&M(l,t),(c&131072)!==0)$e.add(l);else if((c&2)!==0){var f=l;K?.delete(f),ir(f,kt,n)}else if(h){var d=l;c&16&&ct!==null&&ct.add(d),n!==null?n.push(d):Zn(d)}}}}}function Wt(e){if(typeof e!="object"||e===null||jt in e||Kn in e)return e;const t=Br(e);if(t!==Pr&&t!==Fr)return e;var n=new Map,r=Kr(e),i=B(0),s=null,o=$t,l=c=>{if($t===o)return c();var h=w,f=$t;at(null),An(o);var d=c();return at(h),An(f),d};return r&&n.set("length",B(e.length,s)),new Proxy(e,{defineProperty(c,h,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&hi();var d=n.get(h);return d===void 0?l(()=>{var y=B(f.value,s);return n.set(h,y),y}):O(d,f.value,!0),!0},deleteProperty(c,h){var f=n.get(h);if(f===void 0){if(h in c){const d=l(()=>B(R,s));n.set(h,d),zt(i)}}else O(f,R),zt(i);return!0},get(c,h,f){if(h===jt)return e;var d=n.get(h),y=h in c;if(d===void 0&&(!y||wt(c,h)?.writable)&&(d=l(()=>B(Wt(y?c[h]:R),s)),n.set(h,d)),d!==void 0){var b=A(d);return b===R?void 0:b}return Reflect.get(c,h,f)},getOwnPropertyDescriptor(c,h){this.has?.(c,h);var f=Reflect.getOwnPropertyDescriptor(c,h),d=n.get(h);if(d!==void 0){var y=A(d);if(y===R)return;if(f&&"value"in f)f.value=y;else return{enumerable:!0,configurable:!0,value:y,writable:!0}}return f},has(c,h){if(h===jt)return!0;var f=n.get(h),d=f!==void 0&&f.v!==R||Reflect.has(c,h);return(f!==void 0||T!==null&&(!d||wt(c,h)?.writable))&&(f===void 0&&(f=l(()=>B(d?Wt(c[h]):R,s)),n.set(h,f)),A(f)===R)?!1:d},set(c,h,f,d){var y=n.get(h),b=h in c;if(r&&h==="length")for(var E=f;E<y.v;E+=1){var _=n.get(E+"");_!==void 0?O(_,R):E in c&&(_=l(()=>B(R,s)),n.set(E+"",_))}if(y===void 0)(!b||wt(c,h)?.writable)&&(y=l(()=>B(void 0,s)),O(y,Wt(f)),n.set(h,y));else{b=y.v!==R;var z=l(()=>Wt(f));O(y,z)}var H=Reflect.getOwnPropertyDescriptor(c,h);if(H?.set&&H.set.call(d,f),!b){if(r&&typeof h=="string"){var G=n.get("length"),m=Number(h);Number.isInteger(m)&&m>=G.v&&O(G,m+1)}zt(i)}return!0},ownKeys(c){A(i);var h=Reflect.ownKeys(c).filter(y=>{var b=n.get(y);return b===void 0||b.v!==R});for(var[f,d]of n)d.v!==R&&!(f in c)&&h.push(f);return h},setPrototypeOf(){fi()}})}var bn,sr,ar,or;function Xe(){if(bn===void 0){bn=window,sr=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;ar=wt(t,"firstChild").get,or=wt(t,"nextSibling").get,fn(e)&&(e[Jr]=void 0,e[Ur]=null,e[Qr]=void 0,e.__e=void 0),fn(n)&&(n[Zr]=void 0)}}function lr(e=""){return document.createTextNode(e)}function ze(e){return ar.call(e)}function Bt(e){return or.call(e)}function Ii(e){e.textContent=""}function cr(e,t,n){return t==null||t==="http://www.w3.org/1999/xhtml"?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function Li(e){var t=T;if(t===null)return w.f|=Nn,e;if((t.f&32768)===0&&(t.f&4)===0)throw e;dt(e,t)}function dt(e,t){if(!(t!==null&&(t.f&16384)!==0)){for(;t!==null;){if((t.f&128)!==0&&(t.f&33570816)===0){if((t.f&32768)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}}function Ri(e){T===null&&(w===null&&oi(e),ai()),ht&&si(e)}function Mi(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function It(e,t){var n=T;n!==null&&n.f&8192&&(e|=On);var r={ctx:L,deps:null,nodes:null,f:e|ot|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};$?.register_created_effect(r);var i=r;if((e&4)!==0)Jt!==null?Jt.push(r):Ft.ensure().schedule(r);else if(t!==null){try{Pt(r)}catch(o){throw J(r),o}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=xn))}if(i!==null&&(i.parent=n,n!==null&&Mi(i,n),w!==null&&(w.f&2)!==0&&(e&64)===0)){var s=w;(s.effects??(s.effects=[])).push(i)}return r}function rn(){return w!==null&&!V}function Rt(e){Ri("$effect");var t=T.f;if(!w&&(t&32)!==0&&L!==null&&!L.i){var n=L;(n.e??(n.e=[])).push(e)}else return ur(e)}function ur(e){return It(4|Yr,e)}function Oi(e){Ft.ensure();const t=It(64|te,e);return()=>{J(t)}}function Hi(e){Ft.ensure();const t=It(64|te,e);return(n={})=>new Promise(r=>{n.outro?Me(t,()=>{J(t),r(void 0)}):(J(t),r(void 0))})}function xi(e){return It(4,e)}function sn(e,t=0){return It(8|t,e)}function Ni(e,t=0){return It(16|t,e)}function Ct(e){return It(32|te,e)}function hr(e){var t=e.teardown;if(t!==null){const n=ht,r=w;Sn(!0),at(null);try{t.call(null)}catch(i){dt(i,e.parent)}finally{Sn(n),at(r)}}}function an(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const i=n.ac;i!==null&&Le(()=>{i.abort(Ce)});var r=n.next;(n.f&64)!==0?n.parent=null:J(n,t),n=r}}function Ki(e){for(var t=e.first;t!==null;){var n=t.next;!(t.f&32)&&J(t),t=n}}function J(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Wi(e.nodes.start,e.nodes.end),n=!0),e.f|=dn,an(e,t&&!n),Qt(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(const s of r)s.stop();hr(e),e.f^=dn,e.f|=Vr;var i=e.parent;i!==null&&i.first!==null&&fr(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Wi(e,t){for(;e!==null;){var n=e===t?null:Bt(e);e.remove(),e=n}}function fr(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Me(e,t,n=!0){var r=[];e.f|=256,dr(e,r,!0);var i=()=>{n&&J(e),t&&t()},s=r.length;if(s>0){var o=()=>--s||i();for(var l of r)l.out(o)}else i()}function dr(e,t,n){if((e.f&8192)===0){e.f^=On;var r=e.nodes&&e.nodes.t;if(r!==null)for(const l of r)(l.is_global||n)&&t.push(l);for(var i=e.first;i!==null;){var s=i.next;if((i.f&64)===0){var o=(i.f&65536)!==0||(i.f&32)!==0&&(e.f&16)!==0;dr(i,t,o?n:!1)}i=s}}}function Gi(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:Bt(n);t.append(n),n=i}}var Pi=null,he=!1,ht=!1;function Sn(e){ht=e}var w=null,V=!1;function at(e){w=e}var T=null;function pt(e){T=e}var Q=null;function vr(e){w!==null&&(w.f&2097152||w.f&2)&&(Q??(Q=new Set)).add(e)}var P=null,D=0,X=null;function Fi(e){X=e}var pr=1,At=0,$t=At;function An(e){$t=e}function mr(){return++pr}function ee(e){var t=e.f;if((t&2048)!==0)return!0;if((t&4096)!==0){for(var n=e.deps,r=n.length,i=0;i<r;i++){var s=n[i];if(ee(s)&&zn(s),s.wv>e.wv)return!0}t&512&&K===null&&M(e,et)}return!1}function gr(e,t,n=!0){var r=e.reactions;if(r!==null&&!(!Qe&&Q!==null&&Q.has(e)))for(var i=0;i<r.length;i++){var s=r[i];(s.f&2)!==0?gr(s,t,!1):t===s&&(n?M(s,ot):s.f&1024&&M(s,kt),Zn(s))}}function yr(e){var t=P,n=D,r=X,i=w,s=Q,o=L,l=V,c=$t,h=e.f;P=null,D=0,X=null,w=(h&96)===0?e:null,Q=null,ye(e.ctx),V=!1,$t=++At,e.ac!==null&&(Le(()=>{e.ac.abort(Ce)}),e.ac=null);try{e.f|=vn;var f=e.fn,d=f();e.f|=Hn;var y=wn(e);if(Ie()&&X!==null&&!V&&y!==null&&(e.f&6146)===0)for(var b=0;b<X.length;b++)gr(X[b],e);if(i!==null&&i!==e){if(At++,i.deps!==null)for(let E=0;E<n;E+=1)i.deps[E].rv=At;if(t!==null)for(const E of t)E.rv=At;X!==null&&(r===null?r=X:r.push(...X))}return e.f&8388608&&(e.f^=Nn),d}catch(E){return wn(e),Li(E)}finally{e.f^=vn,P=t,D=n,X=r,w=i,Q=s,ye(o),V=l,$t=c}}function wn(e){var t=e.deps,n=$?.is_fork;if(P!==null){var r;if(n||Qt(e,D),t!==null&&D>0)for(t.length=D+P.length,r=0;r<P.length;r++)t[D+r]=P[r];else e.deps=t=P;if(rn()&&(e.f&512)!==0)for(r=D;r<t.length;r++){var i;((i=t[r]).reactions??(i.reactions=[])).push(e)}}else!n&&t!==null&&D<t.length&&(Qt(e,D),t.length=D);return t}function Bi(e,t){let n=t.reactions;if(n!==null){var r=Wr.call(n,e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&(t.f&2)!==0&&(P===null||!Pe.call(P,t))){var s=t;s.f&512&&(s.f^=512),s.v!==R&&tn(s),s.ac!==null&&Le(()=>{s.ac.abort(Ce),s.ac=null,M(s,ot)}),Si(s),Qt(s,0)}}function Qt(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Bi(e,n[r])}function Pt(e){var t=e.f;if((t&16384)===0){M(e,et);var n=T,r=he;T=e,he=(t&96)===0;try{(t&16777232)!==0?Ki(e):an(e),hr(e);var i=yr(e);e.teardown=typeof i=="function"?i:null,e.wv=pr}finally{he=r,T=n}}}function A(e){var t=(e.f&2)!==0;if(Pi?.add(e),w!==null&&!V&&!(T!==null&&(T.f&16384)!==0)&&(Q===null||!Q.has(e))){var n=w.deps;if((w.f&2097152)!==0)e.rv<At&&(e.rv=At,P===null&&n!==null&&n[D]===e?D++:P===null?P=[e]:P.push(e));else{var r;(r=w).deps??(r.deps=[]),Pe.call(w.deps,e)||w.deps.push(e);var i=e.reactions;i===null?e.reactions=[w]:Pe.call(i,w)||i.push(w)}}if(ht&&st.has(e))return st.get(e);if(t){var s=e;if(ht){var o=s.v;return(!(s.f&1024)&&s.reactions!==null||Sr(s))&&(o=en(s)),st.set(s,o),o}var l=(s.f&512)===0&&!V&&w!==null&&(he||(w.f&512)!==0),c=(s.f&Hn)===0;ee(s)&&(l&&(s.f|=512),zn(s)),l&&!c&&(Vn(s),br(s))}if(K?.has(e))return K.get(e);if((e.f&8388608)!==0)throw e.v;return e.v}function br(e){if(e.f|=512,e.deps!==null)for(const t of e.deps)(t.reactions??(t.reactions=[])).push(e),t.f&2&&!(t.f&512)&&(Vn(t),br(t))}function Sr(e){if(e.v===R)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(st.has(t)||(t.f&2)!==0&&Sr(t))return!0;return!1}function Oe(e){var t=V;try{return V=!0,e()}finally{V=t}}var oe=Symbol("events"),Di=new Set,En=new Set,Ne=null,Ke=!1;function $n(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],s=i[0]||e.target;Ne=e,Ke||(Ke=!0,setTimeout(()=>{Ke=!1,Ne=null}));var o=0,l=Ne===e&&e[oe];if(l){var c=i.indexOf(l);if(c!==-1&&(t===document||t===window)){e[oe]=t;return}var h=i.indexOf(t);if(h===-1)return;c<=h&&(o=c)}if(s=i[o]||e.target,s!==t){Vt(e,"currentTarget",{configurable:!0,get(){return s||n}});var f=w,d=T;at(null),pt(null);try{for(var y,b=[];s!==null&&s!==t;){try{var E=s[oe]?.[r];E!=null&&(!s.disabled||e.target===s)&&E.call(s,e)}catch(_){y?b.push(_):y=_}if(e.cancelBubble)break;o++,s=o<i.length?i[o]:null}if(y){for(let _ of b)queueMicrotask(()=>{throw _});throw y}}finally{e[oe]=t,delete e.currentTarget,at(f),pt(d)}}}var qi=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function ji(e){return qi?.createHTML(e)??e}function Xi(e){var t=cr("template");return t.innerHTML=ji(e.replaceAll("<!>","<!---->")),t.content}function fe(e,t){var n=T;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function zi(e,t){var n=(t&1)!==0,r=(t&2)!==0,i,s=!e.startsWith("<!>");return()=>{if(U)return fe(W,null),W;i===void 0&&(i=Xi(s?e:"<!>"+e),n||(i=ze(i)));var o=r||sr?document.importNode(i,!0):i.cloneNode(!0);if(n){var l=ze(o),c=o.lastChild;fe(l,c)}else fe(o,o);return o}}function Ar(e,t){if(U){var n=T;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=W),Pn();return}e!==null&&e.before(t)}var Vi=["touchstart","touchmove"];function Yi(e){return Vi.includes(e)}function Ui(e){let t=0,n=Re(0),r;return()=>{rn()&&(A(n),sn(()=>(t===0&&(r=Oe(()=>e(()=>zt(n)))),t+=1,()=>{Tt(()=>{t-=1,t===0&&(r?.(),r=void 0,zt(n))})})))}}var Ji=xn|te;function Qi(e,t,n,r){new Zi(e,t,n,r)}var Z=new WeakMap,Ve=new WeakMap,it=new WeakMap,Zt=new WeakMap,q=new WeakMap,tt=new WeakMap,j=new WeakMap,Y=new WeakMap,vt=new WeakMap,xt=new WeakMap,_t=new WeakMap,le=new WeakMap,Ye=new WeakMap,Ue=new WeakMap,mt=new WeakMap,_n=new WeakMap,I=new WeakSet,Zi=class{constructor(e,t,n,r){nn(this,I),u(this,"parent",void 0),u(this,"is_pending",!1),u(this,"transform_error",void 0),S(this,Z,void 0),S(this,Ve,U?W:null),S(this,it,void 0),S(this,Zt,void 0),S(this,q,void 0),S(this,tt,null),S(this,j,null),S(this,Y,null),S(this,vt,null),S(this,xt,0),S(this,_t,0),S(this,le,!1),S(this,Ye,new Set),S(this,Ue,new Set),S(this,mt,null),S(this,_n,Ui(()=>(v(mt,this,Re(a(xt,this))),()=>{v(mt,this,null)}))),v(Z,this,e),v(it,this,t),v(Zt,this,i=>{var s=T;s.b=this,s.f|=128,n(i)}),this.parent=T.b,this.transform_error=r??this.parent?.transform_error??(i=>i),v(q,this,Ni(()=>{if(U){const i=a(Ve,this);Pn();const s=i.data==="[!";if(i.data.startsWith("[?")){const o=JSON.parse(i.data.slice(2));g(I,this,es).call(this,o)}else s?g(I,this,ns).call(this):g(I,this,ts).call(this)}else g(I,this,Er).call(this)},Ji)),U&&v(Z,this,W)}defer_effect(e){Xn(e,a(Ye,this),a(Ue,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!a(it,this).pending}update_pending_count(e,t){g(I,this,$r).call(this,e,t),v(xt,this,a(xt,this)+e),a(mt,this)&&!a(le,this)&&(v(le,this,!0),Tt(()=>{v(le,this,!1),a(mt,this)&&rr(a(mt,this),a(xt,this))}))}get_effect_pending(){return a(_n,this).call(this),A(a(mt,this))}error(e){if(!a(it,this).onerror&&!a(it,this).failed)throw e;$?.is_fork?(a(tt,this)&&$.skip_effect(a(tt,this)),a(j,this)&&$.skip_effect(a(j,this)),a(Y,this)&&$.skip_effect(a(Y,this)),$.oncommit(()=>{g(I,this,Tn).call(this,e)})):g(I,this,Tn).call(this,e)}};function ts(){try{v(tt,this,Ct(()=>a(Zt,this).call(this,a(Z,this))))}catch(e){this.error(e)}}function es(e){const t=a(it,this).failed,{reset:n,invoke_onerror:r}=g(I,this,wr).call(this,e);Tt(r),t&&v(Y,this,Ct(()=>{t(a(Z,this),()=>e,()=>n)}))}function wr(e){var t=!1,n=!1;const r=()=>{if(t){ei();return}t=!0,n&&vi(),a(Y,this)!==null&&Me(a(Y,this),()=>{v(Y,this,null)}),g(I,this,on).call(this,()=>{g(I,this,Er).call(this)})};return{reset:r,invoke_onerror:()=>{try{n=!0,a(it,this).onerror?.(e,r),n=!1}catch(i){dt(i,a(q,this)&&a(q,this).parent)}}}}function ns(){const e=a(it,this).pending;e&&(this.is_pending=!0,v(j,this,Ct(()=>e(a(Z,this)))),Tt(()=>{var t=v(vt,this,document.createDocumentFragment()),n=lr(),r=!1;if(t.append(n),v(tt,this,g(I,this,on).call(this,()=>{try{return Ct(()=>a(Zt,this).call(this,n))}catch(i){try{this.error(i),r=!0}catch(s){dt(s,a(q,this).parent)}return null}})),a(tt,this)===null){v(vt,this,null),r&&g(I,this,_e).call(this,$);return}a(_t,this)===0&&(a(Z,this).before(t),v(vt,this,null),Me(a(j,this),()=>{v(j,this,null)}),g(I,this,_e).call(this,$))}))}function Er(){try{if(this.is_pending=this.has_pending_snippet(),v(_t,this,0),v(xt,this,0),v(tt,this,Ct(()=>{a(Zt,this).call(this,a(Z,this))})),a(_t,this)>0){var e=v(vt,this,document.createDocumentFragment());Gi(a(tt,this),e);const t=a(it,this).pending;v(j,this,Ct(()=>t(a(Z,this))))}else g(I,this,_e).call(this,$)}catch(t){this.error(t)}}function _e(e){this.is_pending=!1,e.transfer_effects(a(Ye,this),a(Ue,this))}function on(e){var t=T,n=w,r=L;pt(a(q,this)),at(a(q,this)),ye(a(q,this).ctx);try{return Ft.ensure(),e()}finally{pt(t),at(n),ye(r)}}function $r(e,t){if(!this.has_pending_snippet()){if(this.parent){var n;g(I,n=this.parent,$r).call(n,e,t)}return}v(_t,this,a(_t,this)+e),a(_t,this)===0&&(g(I,this,_e).call(this,t),a(j,this)&&Me(a(j,this),()=>{v(j,this,null)}),a(vt,this)&&(a(Z,this).before(a(vt,this)),v(vt,this,null)))}function Tn(e){a(tt,this)&&(J(a(tt,this)),v(tt,this,null)),a(j,this)&&(J(a(j,this)),v(j,this,null)),a(Y,this)&&(J(a(Y,this)),v(Y,this,null)),U&&(Ut(a(Ve,this)),ni(),Ut(ri()));let t=a(it,this).failed;const n=r=>{const{reset:i,invoke_onerror:s}=g(I,this,wr).call(this,r);s(),t&&v(Y,this,g(I,this,on).call(this,()=>{try{return Ct(()=>{var o=T;o.b=this,o.f|=128,t(a(Z,this),()=>r,()=>i)})}catch(o){return dt(o,a(q,this).parent),null}}))};Tt(()=>{var r;try{r=this.transform_error(e)}catch(i){dt(i,a(q,this)&&a(q,this).parent);return}r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(n,i=>dt(i,a(q,this)&&a(q,this).parent)):n(r)})}function _r(e,t){return Tr(e,t)}function rs(e,t){Xe(),t.intro=t.intro??!1;const n=t.target,r=U,i=W;try{for(var s=ze(n);s&&(s.nodeType!==8||s.data!=="[");)s=Bt(s);if(!s)throw me;re(!0),Ut(s);const o=Tr(e,{...t,anchor:s});return re(!1),o}catch(o){if(o instanceof Error&&o.message.split(`
2
- `).some(l=>l.startsWith("https://svelte.dev/e/")))throw o;return o!==me&&console.warn("Failed to hydrate: ",o),t.recover===!1&&ci(),Xe(),Ii(n),re(!1),_r(e,t)}finally{re(r),Ut(i)}}var ce=new Map;function Tr(e,{target:t,anchor:n,props:r={},events:i,context:s,intro:o=!0,transformError:l}){Xe();var c=void 0,h=Hi(()=>{var f=n??t.appendChild(lr());Qi(f,{pending:()=>{}},b=>{Dn({});var E=L;if(s&&(E.c=s),i&&(r.$$events=i),U&&fe(b,null),c=e(b,r)||Ze(),U&&(T.nodes.end=W,W===null||W.nodeType!==8||W.data!=="]"))throw Gn(),me;qn()},l);var d=new Set,y=b=>{for(var E=0;E<b.length;E++){var _=b[E];if(!d.has(_)){d.add(_);var z=Yi(_);for(const m of[t,document]){var H=ce.get(m);H===void 0&&(H=new Map,ce.set(m,H));var G=H.get(_);G===void 0?(m.addEventListener(_,$n,{passive:z}),H.set(_,1)):H.set(_,G+1)}}}};return y(Gr(Di)),En.add(y),()=>{for(var b of d)for(const z of[t,document]){var E=ce.get(z),_=E.get(b);--_==0?(z.removeEventListener(b,$n),E.delete(b),E.size===0&&ce.delete(z)):E.set(b,_)}En.delete(y),f!==n&&f.parentNode?.removeChild(f)}});return Je.set(c,h),c}var Je=new WeakMap;function is(e,t){const n=Je.get(e);return n?(Je.delete(e),n(t)):Promise.resolve()}var Cr,Nt=new WeakMap,Te=new WeakMap,We=new WeakMap,Cn=new WeakSet,kr=class{constructor(e){nn(this,Cn),S(this,Nt,new WeakMap),S(this,Te,void 0),S(this,We,void 0),v(We,this,e)}observe(e,t){var n=a(Nt,this).get(e)||new Set;return n.add(t),a(Nt,this).set(e,n),g(Cn,this,ss).call(this).observe(e,a(We,this)),()=>{var r=a(Nt,this).get(e);r.delete(t),r.size===0&&(a(Nt,this).delete(e),a(Te,this).unobserve(e))}}};Cr=kr;function ss(){return a(Te,this)??v(Te,this,new ResizeObserver(e=>{for(var t of e){Cr.entries.set(t.target,t);for(var n of a(Nt,this).get(t.target)||[])n(t)}}))}u(kr,"entries",new WeakMap);function Ge(e,t){return e===t||e?.[jt]===t}function as(e=Ze(),t,n,r){var i=L.r,s=T;return xi(()=>{var o,l;return sn(()=>{o=l,l=r?.()||[],Oe(()=>{Ge(n(...l),e)||(t(e,...l),o&&Ge(n(...o),e)&&t(null,...o))})}),()=>{let c=s;for(;c!==i&&c.parent!==null&&c.parent.f&33554432;)c=c.parent;const h=()=>{l&&Ge(n(...l),e)&&t(null,...l)},f=c.teardown;c.teardown=()=>{h(),f?.()}}}),e}var ue=!1;function os(e){var t=ue;try{return ue=!1,[e(),ue]}finally{ue=t}}function Dt(e,t,n,r){var i=!ke||(n&2)!==0,s=(n&8)!==0,o=(n&16)!==0,l=r,c=!0,h=void 0,f=()=>o&&i?(h??(h=be(r)),A(h)):(c&&(c=!1,l=o?Oe(r):r),l);let d;if(s){var y=jt in e||Wn in e;d=wt(e,t)?.set??(y&&t in e?x=>e[t]=x:void 0)}var b,E=!1;s?[b,E]=os(()=>e[t]):b=e[t],b===void 0&&r!==void 0&&(b=f(),d&&(i&&ui(t),d(b)));var _;if(i?_=()=>{var x=e[t];return x===void 0?f():(c=!0,x)}:_=()=>{var x=e[t];return x!==void 0&&(l=void 0),x===void 0?l:x},i&&(n&4)===0)return _;if(d){var z=e.$$legacy;return(function(x,ne){return arguments.length>0?((!i||!ne||z||E)&&d(ne?_():x),x):_()})}var H=!1,G=((n&1)!==0?be:yi)(()=>(H=!1,_()));s&&A(G);var m=T;return(function(x,ne){if(arguments.length>0){const cn=ne?A(G):i&&s?Wt(x):x;return O(G,cn),H=!0,l!==void 0&&(l=cn),x}return ht&&H||(m.f&16384)!==0?G.v:A(G)})}function ls(e){return new cs(e)}var gt=new WeakMap,nt=new WeakMap,cs=class{constructor(e){S(this,gt,void 0),S(this,nt,void 0);var t=new Map,n=(i,s)=>{var o=Ci(s,!1,!1);return t.set(i,o),o};const r=new Proxy({...e.props||{},$$events:{}},{get(i,s){return A(t.get(s)??n(s,Reflect.get(i,s)))},has(i,s){return s===Wn?!0:(A(t.get(s)??n(s,Reflect.get(i,s))),Reflect.has(i,s))},set(i,s,o){return O(t.get(s)??n(s,o),o),Reflect.set(i,s,o)}});v(nt,this,(e.hydrate?rs:_r)(e.component,{target:e.target,anchor:e.anchor,props:r,context:e.context,intro:e.intro??!1,recover:e.recover,transformError:e.transformError})),(!e?.props?.$$host||e.sync===!1)&&Ht(),v(gt,this,r.$$events);for(const i of Object.keys(a(nt,this)))i==="$set"||i==="$destroy"||i==="$on"||Vt(this,i,{get(){return a(nt,this)[i]},set(s){a(nt,this)[i]=s},enumerable:!0});a(nt,this).$set=i=>{Object.assign(r,i)},a(nt,this).$destroy=()=>{is(a(nt,this))}}$set(e){a(nt,this).$set(e)}$on(e,t){a(gt,this)[e]=a(gt,this)[e]||[];const n=(...r)=>t.call(this,...r);return a(gt,this)[e].push(n),()=>{a(gt,this)[e]=a(gt,this)[e].filter(r=>r!==n)}}$destroy(){a(nt,this).$destroy()}},Ir;typeof HTMLElement=="function"&&(Ir=class extends HTMLElement{constructor(e,t,n){super(),u(this,"$$ctor",void 0),u(this,"$$s",void 0),u(this,"$$c",void 0),u(this,"$$cn",!1),u(this,"$$d",{}),u(this,"$$r",!1),u(this,"$$p_d",{}),u(this,"$$l",{}),u(this,"$$l_u",new Map),u(this,"$$me",void 0),u(this,"$$shadowRoot",null),this.$$ctor=e,this.$$s=t,n&&(this.$$shadowRoot=this.attachShadow(n))}addEventListener(e,t,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const r=this.$$c.$on(e,t);this.$$l_u.set(t,r)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){if(super.removeEventListener(e,t,n),this.$$c){const r=this.$$l_u.get(t);r&&(r(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(r){return i=>{const s=cr("slot");r!=="default"&&(s.name=r),Ar(i,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},n=us(this);for(const r of this.$$s)r in n&&(r==="default"&&!this.$$d.children?(this.$$d.children=e(r),t.default=!0):t[r]=e(r));for(const r of this.attributes){const i=this.$$g_p(r.name);i in this.$$d||(this.$$d[i]=de(i,r.value,this.$$p_d,"toProp"))}for(const r in this.$$p_d)!(r in this.$$d)&&this[r]!==void 0&&(this.$$d[r]=this[r],delete this[r]);this.$$c=ls({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=Oi(()=>{sn(()=>{this.$$r=!0;for(const r of ge(this.$$c)){if(!this.$$p_d[r]?.reflect)continue;this.$$d[r]=this.$$c[r];const i=de(r,this.$$d[r],this.$$p_d,"toAttribute");i==null?this.removeAttribute(this.$$p_d[r].attribute||r):this.setAttribute(this.$$p_d[r].attribute||r,i)}this.$$r=!1})});for(const r in this.$$l)for(const i of this.$$l[r]){const s=this.$$c.$on(r,i);this.$$l_u.set(i,s)}this.$$l={}}}attributeChangedCallback(e,t,n){this.$$r||(e=this.$$g_p(e),this.$$d[e]=de(e,n,this.$$p_d,"toProp"),this.$$c?.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return ge(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function de(e,t,n,r){const i=n[e]?.type;if(t=i==="Boolean"&&typeof t!="boolean"?t!=null:t,!r||!n[e])return t;if(r==="toAttribute")switch(i){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(i){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function us(e){const t={};return e.childNodes.forEach(n=>{t[n.slot||"default"]=!0}),t}function hs(e,t,n,r,i,s){let o=class extends Ir{constructor(){super(e,n,i),this.$$p_d=t}static get observedAttributes(){return ge(t).map(l=>(t[l].attribute||l).toLowerCase())}};return ge(t).forEach(l=>{Vt(o.prototype,l,{get(){return this.$$c&&l in this.$$c?this.$$c[l]:this.$$d[l]},set(c){c=de(l,c,t),this.$$d[l]=c;var h=this.$$c;h&&(wt(h,l)?.get?h[l]=c:h.$set({[l]:c}))}})}),r.forEach(l=>{Vt(o.prototype,l,{get(){return this.$$c?.[l]}})}),s&&(o=s(o)),e.element=o,o}var Lr,lt=class F{findChoices(t){t.setAttribute(F.ROOT_HOOK_ATTR,"true");const n=Array.from(t.querySelectorAll(F.CHOICE_SELECTOR));for(const r of n)this.annotateChoice(r);return this.annotateFeedbackTicks(t),n}createChoiceRange(t){const n=this.resolveLabelElement(t);if(!n)return null;const r=document.createRange();return r.selectNodeContents(n),r}getChoiceId(t){const n=t.querySelector('input[type="checkbox"], input[type="radio"]');return n?.getAttribute("value")||n?.id||this.generateFallbackId(t)}getChoiceLabel(t){return this.resolveLabelElement(t)?.textContent?.trim()||"Unlabeled choice"}isSelected(t){const n=t.querySelector('input[type="checkbox"], input[type="radio"]');return n?n.checked||n.getAttribute("aria-checked")==="true":!1}canEliminate(t){const n=t.querySelector('input[type="checkbox"], input[type="radio"]');return!(!n||this.isSelected(t)||n.disabled||(t.closest(`[${F.ROOT_HOOK_ATTR}="true"]`)||t.closest("multiple-choice"))?.querySelector(`[${F.FEEDBACK_HOOK_ATTR}="true"]`))}setSelectable(t,n){const r=t.querySelector('input[type="checkbox"], input[type="radio"]');if(!r)return;r.disabled=!n,n?r.removeAttribute("aria-disabled"):r.setAttribute("aria-disabled","true");const i=r.closest(F.MUI_BUTTON_SELECTOR);i&&i.classList.toggle(F.MUI_DISABLED_CLASS,!n)}generateFallbackId(t){const n=(t.closest(`[${F.ROOT_HOOK_ATTR}="true"]`)||t.closest("multiple-choice"))?.querySelectorAll(`[${F.CHOICE_HOOK_ATTR}="true"]`)||[];return`choice-${Array.from(n).indexOf(t)}`}annotateChoice(t){t.setAttribute(F.CHOICE_HOOK_ATTR,"true");const n=this.resolveLabelElement(t);n&&n.setAttribute(F.LABEL_HOOK_ATTR,"true")}resolveLabelElement(t){return t.querySelector(`[${F.LABEL_HOOK_ATTR}="true"]`)||t.querySelector("label")||t.querySelector("span")}annotateFeedbackTicks(t){for(const n of t.querySelectorAll(".feedback-tick"))n.setAttribute(F.FEEDBACK_HOOK_ATTR,"true")}};Lr=lt;u(lt,"CHOICE_HOOK_ATTR","data-pie-answer-eliminator-choice");u(lt,"LABEL_HOOK_ATTR","data-pie-answer-eliminator-label");u(lt,"ROOT_HOOK_ATTR","data-pie-answer-eliminator-root");u(lt,"FEEDBACK_HOOK_ATTR","data-pie-answer-eliminator-feedback-tick");u(lt,"CHOICE_SELECTOR",`[${Lr.CHOICE_HOOK_ATTR}="true"], .corespring-checkbox, .corespring-radio-button`);u(lt,"MUI_BUTTON_SELECTOR",".MuiButtonBase-root, .MuiRadio-root, .MuiCheckbox-root");u(lt,"MUI_DISABLED_CLASS","Mui-disabled");var fs="ebsr-multiple-choice",Rr=e=>e instanceof HTMLElement&&Hr(e.tagName.toLowerCase()).baseName===fs,kn=(e,t)=>Array.from(e.querySelectorAll(`[id="${t}"]`)).find(Rr)??null,ds=e=>{let t=e.parentElement;for(;t!==null;){if(Rr(t))return t;t=t.parentElement}return null},vs=class{constructor(){u(this,"mcAdapter",new lt)}findChoices(e){const t=kn(e,"a"),n=kn(e,"b"),r=[];return t&&r.push(...this.mcAdapter.findChoices(t)),n&&r.push(...this.mcAdapter.findChoices(n)),r}createChoiceRange(e){return this.mcAdapter.createChoiceRange(e)}getChoiceId(e){return`${ds(e)?.id||"unknown"}-${this.mcAdapter.getChoiceId(e)}`}getChoiceLabel(e){return this.mcAdapter.getChoiceLabel(e)}isSelected(e){return this.mcAdapter.isSelected(e)}canEliminate(e){return this.mcAdapter.canEliminate(e)}setSelectable(e,t){this.mcAdapter.setSelectable(e,t)}},In="answer-masking",ps="data-pie-answer-eliminator-choice",ms="data-pie-answer-eliminator-label";function Mr(e){if(!e.localName.includes("-"))return null;try{const t=e.constructor.pieSupports;return Array.isArray(t)?t:null}catch{return null}}function gs(e){const t=[];for(const n of[e,...e.querySelectorAll("*")])Mr(n)&&(t.some(r=>r.contains(n))||t.push(n));return t}function ve(e,t,n){try{return e()}catch(r){return console.error(`[AnswerEliminator] ${n} threw:`,r),t}}function ys(e){if(!e||typeof e!="object")return null;const t=e,{id:n,label:r,container:i,content:s}=t,{isSelected:o,isEliminable:l,setEliminated:c}=t;return typeof n!="string"||!n||typeof r!="string"||!(i instanceof HTMLElement)||!(s instanceof Element)||!i.contains(s)||typeof o!="function"||typeof l!="function"||typeof c!="function"?null:{target:{id:n,label:r.trim()||s.textContent?.trim()||"Unlabeled choice",container:i,createRange(){const h=document.createRange();return h.selectNodeContents(s),h},isSelected:()=>ve(()=>o.call(e)===!0,!1,"isSelected"),canEliminate:()=>ve(()=>l.call(e)===!0,!1,"isEliminable"),setEliminated:h=>ve(()=>c.call(e,h),void 0,"setEliminated")},content:s}}function Ln(e,t){e.getAttribute(t)!=="true"&&e.setAttribute(t,"true")}function bs(e){if(!Mr(e)?.includes("answer-masking"))return[];const t=e.pieSupportTargets;if(typeof t!="function")return console.warn(`[AnswerEliminator] <${e.localName}> declares ${In} but has no pieSupportTargets()`),[];const n=ve(()=>t.call(e,In),[],`<${e.localName}>.pieSupportTargets`);if(!Array.isArray(n))return[];const r=[],i=new Set;for(const s of n){const o=ys(s);if(!o||i.has(o.target.id)){console.warn(`[AnswerEliminator] <${e.localName}> supplied a choice that is malformed or repeats an id`,s);continue}const{target:l,content:c}=o;i.add(l.id),Ln(l.container,ps),Ln(c,ms),r.push({target:l,owner:e})}return r}var Ss=[new vs,new lt];function As(e,t){return{id:t.getChoiceId(e),label:t.getChoiceLabel(e),container:e,createRange:()=>t.createChoiceRange(e),isSelected:()=>t.isSelected(e),canEliminate:()=>t.canEliminate(e),setEliminated:n=>t.setSelectable(e,!n)}}function ws(e,t,n){const r=[],i=new Set(n.map(({target:s})=>s.container));for(const s of Ss)for(const o of s.findChoices(e))i.has(o)||(i.add(o),!t.some(l=>l.contains(o))&&r.push({target:As(o,s),owner:null}));return r}function Rn(e){const t=gs(e),n=t.flatMap(bs);return[...n,...ws(e,t,n)]}var Lt=class N{constructor(){u(this,"name","mask"),u(this,"highlights",new Map),u(this,"ranges",new Map),u(this,"fallbackContainers",new Map)}initialize(){}destroy(){this.clearAll()}apply(t,n){if(!this.isSupported()){this.applyFallback(t,n);return}this.injectHighlightCSS(t);const r=new Highlight(n);CSS.highlights.set(`${N.HIGHLIGHT_NAME_PREFIX}${t}`,r),this.highlights.set(t,r),this.ranges.set(t,n),this.addAriaAttributes(n)}remove(t){if(!this.isSupported()){this.removeFallback(t);return}CSS.highlights.delete(`${N.HIGHLIGHT_NAME_PREFIX}${t}`),this.removeHighlightCSS(t);const n=this.ranges.get(t);n&&this.removeAriaAttributes(n),this.highlights.delete(t),this.ranges.delete(t),this.fallbackContainers.delete(t)}isEliminated(t){return this.highlights.has(t)||this.fallbackContainers.has(t)}clearAll(){for(const t of this.getEliminatedIds())this.remove(t);this.fallbackContainers.clear()}getEliminatedIds(){return Array.from(new Set([...this.highlights.keys(),...this.fallbackContainers.keys()]))}isSupported(){return typeof CSS<"u"&&"highlights"in CSS}injectHighlightCSS(t){const n=`${N.HIGHLIGHT_STYLE_PREFIX}${t}`;if(document.getElementById(n))return;const r=document.createElement("style");r.id=n,r.textContent=`
1
+ import{t as Hr}from"./attribute-coercion-b93b482c.js";import{t as xr}from"./versioned-tag-54a76be9.js";import{i as Nr,r as Kr}from"./tool-host-contract-fae1c415.js";if(typeof window<"u"){var fn,dn;((fn=(dn=window).__svelte??(dn.__svelte={})).v??(fn.v=new Set)).add("5")}var kt={},R=Symbol("uninitialized"),Gr=Array.isArray,Wr=Array.prototype.indexOf,ye=Array.prototype.includes,Pr=Array.from,be=Object.keys,Jt=Object.defineProperty,Et=Object.getOwnPropertyDescriptor,Fr=Object.prototype,Br=Array.prototype,Dr=Object.getPrototypeOf,vn=Object.isExtensible,qr=()=>{};function jr(e){for(var t=0;t<e.length;t++)e[t]()}function Xr(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Qt(e){"@babel/helpers - typeof";return Qt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qt(e)}function zr(e,t){if(Qt(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Qt(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vr(e){var t=zr(e,"string");return Qt(t)=="symbol"?t:t+""}function u(e,t,n){return(t=Vr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var et=1024,ot=2048,Rt=4096,Hn=8192,xn=16384,Nn=32768,Be=1<<25,Kn=65536,re=1<<19,Yr=1<<20,pn=1<<21,Gn=1<<23,Vt=Symbol("$state"),Wn=Symbol("component"),Pn=Symbol("legacy props"),Ur=Symbol("attributes"),Jr=Symbol("class"),Qr=Symbol("style"),Zr=Symbol("text"),Le=new class extends Error{constructor(...e){super(...e),u(this,"name","StaleReactionError"),u(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};globalThis.document?.contentType;function ti(){console.warn("https://svelte.dev/e/derived_inert")}function Ze(e){console.warn("https://svelte.dev/e/hydration_mismatch")}function ei(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}var U=!1;function ae(e){U=e}var G;function Zt(e){if(e===null)throw Ze(),kt;return G=e}function Fn(){return Zt(jt(G))}function ni(e=1){if(U){for(var t=e,n=G;t--;)n=jt(n);G=n}}function ri(e=!0){for(var t=0,n=G;;){if(n.nodeType===8){var r=n.data;if(r==="]"){if(t===0)return n;t-=1}else(r==="["||r==="[!"||r[0]==="["&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=jt(n);e&&n.remove(),n=i}}function ii(e){if(!e||e.nodeType!==8)throw Ze(),kt;return e.data}function Bn(e){return e===this.v}function si(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Dn(e){return!si(e,this.v)}function ai(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function oi(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function li(e){throw new Error("https://svelte.dev/e/effect_orphan")}function ci(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function ui(){throw new Error("https://svelte.dev/e/hydration_failed")}function hi(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function fi(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function di(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function vi(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function pi(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}var tn=!1,Ie=!1,I=null;function Se(e){I=e}function qn(e,t=!1,n){I={p:I,i:!1,c:null,e:null,s:e,x:null,r:T,l:Ie&&!t?{s:null,u:null,$:[]}:null}}function jn(e){var t=I,n=t.e;if(n!==null){t.e=null;for(var r of n)hr(r)}return e!==void 0&&(t.x=e),t.i=!0,I=t.p,en(e)}function en(e={}){return Jt(e,Wn,{value:!0}),e}function Re(){return!Ie||I!==null&&I.l===null}var At=[];function Xn(){var e=At;At=[],jr(e)}function Lt(e){if(At.length===0&&!Yt){var t=At;queueMicrotask(()=>{t===At&&Xn()})}At.push(e)}function mi(){for(;At.length>0;)Xn()}var gi=~(ot|Rt|et);function M(e,t){e.f=e.f&gi|t}function nn(e){(e.f&512)!==0||e.deps===null?M(e,et):M(e,Rt)}function zn(e,t,n){(e.f&2048)!==0?t.add(e):e.f&4096&&n.add(e),M(e,et)}function Me(e){var t=w,n=T;at(null),pt(null);try{return e()}finally{at(t),pt(n)}}function Ae(e){var t=2|ot;return T!==null&&(T.f|=re),{ctx:I,deps:null,effects:null,equals:Bn,f:t,fn:e,reactions:null,rv:0,v:R,wv:0,parent:T,ac:null}}var yi=Symbol("obsolete");function mn(e){const t=Ae(e);return pr(t),t}function bi(e){const t=Ae(e);return t.equals=Dn,t}function Si(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)J(t[n])}}function rn(e){var t,n=T,r=e.parent;if(!ht&&r!==null&&e.v!==R&&(r.f&24576)!==0)return ti(),e.v;pt(r);try{Si(e),t=br(e)}finally{pt(n)}return t}function Vn(e){var t=rn(e);if(!e.equals(t)&&(e.wv=gr(),(!_?.is_fork||e.deps===null)&&(_!==null?(_.capture(e,t,!0),Ft?.capture(e,t,!0)):e.v=t,e.deps===null))){M(e,et);return}ht||(K!==null?(an()||_?.is_fork)&&K.set(e,t):nn(e))}function Ai(e){if(e.effects!==null)for(const t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac!==null&&Me(()=>{t.ac.abort(Le),t.ac=null}),t.fn!==null&&(t.teardown=qr),ee(t,0),ln(t))}function Yn(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&t.fn!==null&&Dt(t)}function Un(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function sn(e,t){Un(e,t),t.add(e)}function S(e,t,n){Un(e,t),t.set(e,n)}function p(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function v(e,t,n){return e.set(p(e,t),n),n}function a(e,t){return e.get(p(e,t))}var Jn,De=null,xt=null,_=null,Ft=null,K=null,qe=null,Yt=!1,Ne=!1,te=null,we=null,Qn=0,wi=1,je=new WeakMap,$t=new WeakMap,Wt=new WeakMap,Ee=new WeakMap,oe=new WeakMap,Nt=new WeakMap,yt=new WeakMap,zt=new WeakMap,rt=new WeakMap,gn=new WeakMap,Bt=new WeakMap,ut=new WeakMap,ft=new WeakMap,Ke=new WeakMap,le=new WeakMap,L=new WeakSet,qt=class Zn{constructor(){sn(this,L),u(this,"id",wi++),S(this,je,!1),u(this,"linked",!0),S(this,$t,null),S(this,Wt,null),u(this,"async_deriveds",new Map),u(this,"current",new Map),u(this,"previous",new Map),S(this,Ee,new Set),S(this,oe,new Set),S(this,Nt,0),S(this,yt,new Map),S(this,zt,null),S(this,rt,[]),S(this,gn,[]),S(this,Bt,new Set),S(this,ut,new Set),S(this,ft,new Map),S(this,Ke,new Set),u(this,"is_fork",!1),S(this,le,!1),xt===null?De=xt=this:(v(Wt,xt,this),v($t,this,xt)),xt=this}skip_effect(t){a(ft,this).has(t)||a(ft,this).set(t,{d:[],m:[]}),a(Ke,this).delete(t)}unskip_effect(t,n=r=>this.schedule(r)){var r=a(ft,this).get(t);if(r){a(ft,this).delete(t);for(var i of r.d)M(i,ot),n(i);for(i of r.m)M(i,Rt),n(i)}a(Ke,this).add(t)}capture(t,n,r=!1){t.v!==R&&!this.previous.has(t)&&this.previous.set(t,t.v),!(t.f&8388608)&&(this.current.set(t,[n,r]),K?.set(t,n)),this.is_fork||(t.v=n)}activate(){_=this}deactivate(){_=null,K=null}flush(){try{Ne=!0,_=this,p(L,this,$e).call(this)}finally{Qn=0,qe=null,te=null,we=null,Ne=!1,_=null,K=null,st.clear()}}discard(){for(const t of a(oe,this))t(this);a(oe,this).clear();for(const t of this.async_deriveds.values())t.reject(yi);p(L,this,Te).call(this),a(zt,this)?.resolve()}register_created_effect(t){a(gn,this).push(t)}increment(t,n){if(v(Nt,this,a(Nt,this)+1),t){let r=a(yt,this).get(n)??0;a(yt,this).set(n,r+1)}}decrement(t,n){if(v(Nt,this,a(Nt,this)-1),t){let r=a(yt,this).get(n)??0;r===1?a(yt,this).delete(n):a(yt,this).set(n,r-1)}a(le,this)||(v(le,this,!0),Lt(()=>{v(le,this,!1),this.linked&&this.flush()}))}transfer_effects(t,n){for(const r of t)a(Bt,this).add(r);for(const r of n)a(ut,this).add(r);t.clear(),n.clear()}oncommit(t){a(Ee,this).add(t)}ondiscard(t){a(oe,this).add(t)}settled(){return(a(zt,this)??v(zt,this,Xr())).promise}static ensure(){if(_===null){const t=_=new Zn;!Ne&&!Yt&&Lt(()=>{a(je,t)||t.flush()})}return _}apply(){if(!tn||!this.is_fork&&a($t,this)===null&&a(Wt,this)===null){K=null;return}K=new Map;for(const[n,[r]]of this.current)K.set(n,r);for(let n=De;n!==null;n=a(Wt,n))if(!(n===this||n.is_fork)){var t=!1;if(n.id<this.id){for(const[r,[,i]]of n.current)if(!i&&this.current.has(r)){t=!0;break}}if(!t)for(const[r,i]of n.previous)K.has(r)||K.set(r,i)}}schedule(t){if(qe=t,t.b?.is_pending&&(t.f&16777228)!==0&&(t.f&32768)===0){t.b.defer_effect(t);return}a(rt,this).push(t)}};Jn=qt;function yn(){if(this.is_fork)return!0;for(const n of a(yt,this).keys()){for(var e=n,t=!1;e.parent!==null;){if(a(ft,this).has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}function Ei(){var e=[];for(const i of a(rt,this))if(!((i.f&16384)!==0||(i.f&6144)===0)){for(var t=i,n=!1;t.parent!==null;){t=t.parent;var r=t.f;if((r&96)!==0){if((r&1024)===0){n=!0;break}t.f^=et}}n||e.push(t)}return v(rt,this,[]),e}function $e(){v(je,this,!0);for(const o of a(Bt,this))a(ut,this).delete(o),M(o,ot),this.schedule(o);for(const o of a(ut,this))M(o,Rt),this.schedule(o);this.apply();for(var e=te=[],t=[],n=we=[];a(rt,this).length>0;){Qn++>1e3&&(p(L,this,Te).call(this),Ci());for(const o of p(L,this,Ei).call(this))try{p(L,this,$i).call(this,o,e,t)}catch(l){throw nr(o),p(L,this,yn).call(this)||this.discard(),l}}if(_=null,n.length>0){var r=Jn.ensure();for(const o of n)r.schedule(o)}if(te=null,we=null,p(L,this,yn).call(this)){p(L,this,ce).call(this,t),p(L,this,ce).call(this,e);for(const[o,l]of a(ft,this))er(o,l);n.length>0&&p(L,_,$e).call(_);return}const i=p(L,this,Ti).call(this);if(i){p(L,this,ce).call(this,t),p(L,this,ce).call(this,e),p(L,i,_i).call(i,this);return}a(Bt,this).clear(),a(ut,this).clear();for(const o of a(Ee,this))o(this);a(Ee,this).clear(),Ft=this,bn(t),bn(e),Ft=null,a(zt,this)?.resolve();var s=_;if(a(Nt,this)===0&&(a(rt,this).length===0||s!==null)&&p(L,this,Te).call(this),a(rt,this).length>0)if(s!==null){for(const o of a(rt,this))a(rt,s).push(o);v(rt,this,[])}else s=this;s!==null&&(st.clear(),p(L,s,$e).call(s))}function $i(e,t,n){e.f^=et;for(var r=e.first;r!==null;){var i=r.f,s=(i&96)!==0;if(!(s&&(i&1024)!==0||(i&8192)!==0||a(ft,this).has(r))&&r.fn!==null){s?r.f^=et:(i&4)!==0?t.push(r):tn&&(i&16777224)!==0?n.push(r):ie(r)&&(i&16&&a(ut,this).add(r),Dt(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var l=r.next;if(l!==null){r=l;break}r=r.parent}}}function Ti(){for(var e=a($t,this);e!==null;){if(!e.is_fork){for(const[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=a($t,e)}return null}function _i(e){for(const[n,r]of e.current)!this.previous.has(n)&&e.previous.has(n)&&this.previous.set(n,e.previous.get(n)),this.current.set(n,r);for(const[n,r]of e.async_deriveds){const i=this.async_deriveds.get(n);i&&r.promise.then(i.resolve).catch(i.reject)}e.async_deriveds.clear(),this.transfer_effects(a(Bt,e),a(ut,e));const t=n=>{var r=n.reactions;if(r!==null&&!((n.f&2)!==0&&(n.f&6144)===0))for(const o of r){var i=o.f;if((i&2)!==0)t(o);else{var s=o;i&4194320&&!this.async_deriveds.has(s)&&(a(ut,this).delete(s),M(s,ot),this.schedule(s))}}};for(const n of this.current.keys())t(n);this.oncommit(()=>e.discard()),p(L,e,Te).call(e),_=this,p(L,this,$e).call(this)}function ce(e){for(var t=0;t<e.length;t+=1)zn(e[t],a(Bt,this),a(ut,this))}function Te(){if(this.linked){var e=a($t,this),t=a(Wt,this);e===null?De=t:v(Wt,e,t),t===null?xt=e:v($t,t,e),this.linked=!1}}function bt(e){var t=Yt,n=Ft;Ft=null,Yt=!0;try{var r;for(e&&(bt(),r=e());;){if(mi(),_===null)return r;_.flush()}}finally{Yt=t,Ft=n}}function Ci(){try{ci()}catch(e){dt(e,qe)}}var ct=null;function bn(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if((r.f&24576)===0&&ie(r)&&(ct=new Set,Dt(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&dr(r),ct?.size>0)){st.clear();for(const i of ct){if((i.f&24576)!==0)continue;const s=[i];let o=i.parent;for(;o!==null;)ct.has(o)&&(ct.delete(o),s.push(o)),o=o.parent;for(let l=s.length-1;l>=0;l--){const c=s[l];!(c.f&24576)&&Dt(c)}}ct.clear()}}ct=null}}function tr(e){_.schedule(e)}function er(e,t){if(!((e.f&32)!==0&&(e.f&1024)!==0)){(e.f&2048)!==0?t.d.push(e):e.f&4096&&t.m.push(e),M(e,et);for(var n=e.first;n!==null;)er(n,t),n=n.next}}function nr(e){M(e,et);for(var t=e.first;t!==null;)nr(t),t=t.next}var _e=new Set,st=new Map,rr=!1;function Oe(e,t){return{f:0,v:e,reactions:null,equals:Bn,rv:0,wv:0}}function D(e,t){const n=Oe(e,t);return pr(n),n}function ki(e,t=!1,n=!0){const r=Oe(e);if(t||(r.equals=Dn),Ie&&n&&I!==null&&I.l!==null){var i;((i=I.l).s??(i.s=[])).push(r)}return r}function O(e,t,n=!1){return w!==null&&(!V||w.f&131072)&&Re()&&w.f&4325394&&(Q===null||!Q.has(e))&&vi(),ir(e,n?Pt(t):t,we)}var St=null,Xe=0;function ir(e,t,n=null){if(!e.equals(t)){ht?st.set(e,t):st.has(e)||st.set(e,e.v);var r=qt.ensure();if(r.capture(e,t),(e.f&2)!==0){const i=e;e.f&2048&&rn(i),K===null&&nn(i)}e.wv=gr(),St=null,Xe=0,sr(e,ot,n),St=null,Re()&&T!==null&&T.f&1024&&!(T.f&96)&&(X===null?Bi([e]):X.push(e)),!r.is_fork&&_e.size>0&&!rr&&Li()}return t}function Li(){rr=!1;for(const e of _e){e.f&1024&&M(e,Rt);let t;try{t=ie(e)}catch{t=!0}t&&Dt(e)}_e.clear()}function Ut(e){O(e,e.v+1)}function sr(e,t,n){var r=e.reactions;if(r!==null){var i=Re(),s=r.length;if(Xe+=s,Xe>1e5&&St===null&&(St=new Set),St!==null){if(St.has(e))return;St.add(e)}for(var o=0;o<s;o++){var l=r[o],c=l.f;if(!(!i&&l===T)){var h=(c&ot)===0;if(h&&M(l,t),(c&131072)!==0)_e.add(l);else if((c&2)!==0){var f=l;K?.delete(f),sr(f,Rt,n)}else if(h){var d=l;c&16&&ct!==null&&ct.add(d),n!==null?n.push(d):tr(d)}}}}}function Pt(e){if(typeof e!="object"||e===null||Vt in e||Wn in e)return e;const t=Dr(e);if(t!==Fr&&t!==Br)return e;var n=new Map,r=Gr(e),i=D(0),s=null,o=Tt,l=c=>{if(Tt===o)return c();var h=w,f=Tt;at(null),wn(o);var d=c();return at(h),wn(f),d};return r&&n.set("length",D(e.length,s)),new Proxy(e,{defineProperty(c,h,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&fi();var d=n.get(h);return d===void 0?l(()=>{var y=D(f.value,s);return n.set(h,y),y}):O(d,f.value,!0),!0},deleteProperty(c,h){var f=n.get(h);if(f===void 0){if(h in c){const d=l(()=>D(R,s));n.set(h,d),Ut(i)}}else O(f,R),Ut(i);return!0},get(c,h,f){if(h===Vt)return e;var d=n.get(h),y=h in c;if(d===void 0&&(!y||Et(c,h)?.writable)&&(d=l(()=>D(Pt(y?c[h]:R),s)),n.set(h,d)),d!==void 0){var b=A(d);return b===R?void 0:b}return Reflect.get(c,h,f)},getOwnPropertyDescriptor(c,h){this.has?.(c,h);var f=Reflect.getOwnPropertyDescriptor(c,h),d=n.get(h);if(d!==void 0){var y=A(d);if(y===R)return;if(f&&"value"in f)f.value=y;else return{enumerable:!0,configurable:!0,value:y,writable:!0}}return f},has(c,h){if(h===Vt)return!0;var f=n.get(h),d=f!==void 0&&f.v!==R||Reflect.has(c,h);return(f!==void 0||T!==null&&(!d||Et(c,h)?.writable))&&(f===void 0&&(f=l(()=>D(d?Pt(c[h]):R,s)),n.set(h,f)),A(f)===R)?!1:d},set(c,h,f,d){var y=n.get(h),b=h in c;if(r&&h==="length")for(var E=f;E<y.v;E+=1){var $=n.get(E+"");$!==void 0?O($,R):E in c&&($=l(()=>D(R,s)),n.set(E+"",$))}if(y===void 0)(!b||Et(c,h)?.writable)&&(y=l(()=>D(void 0,s)),O(y,Pt(f)),n.set(h,y));else{b=y.v!==R;var z=l(()=>Pt(f));O(y,z)}var H=Reflect.getOwnPropertyDescriptor(c,h);if(H?.set&&H.set.call(d,f),!b){if(r&&typeof h=="string"){var W=n.get("length"),g=Number(h);Number.isInteger(g)&&g>=W.v&&O(W,g+1)}Ut(i)}return!0},ownKeys(c){A(i);var h=Reflect.ownKeys(c).filter(y=>{var b=n.get(y);return b===void 0||b.v!==R});for(var[f,d]of n)d.v!==R&&!(f in c)&&h.push(f);return h},setPrototypeOf(){di()}})}var Sn,ar,or,lr;function ze(){if(Sn===void 0){Sn=window,ar=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;or=Et(t,"firstChild").get,lr=Et(t,"nextSibling").get,vn(e)&&(e[Jr]=void 0,e[Ur]=null,e[Qr]=void 0,e.__e=void 0),vn(n)&&(n[Zr]=void 0)}}function cr(e=""){return document.createTextNode(e)}function Ve(e){return or.call(e)}function jt(e){return lr.call(e)}function Ii(e){e.textContent=""}function ur(e,t,n){return t==null||t==="http://www.w3.org/1999/xhtml"?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function Ri(e){var t=T;if(t===null)return w.f|=Gn,e;if((t.f&32768)===0&&(t.f&4)===0)throw e;dt(e,t)}function dt(e,t){if(e===kt)throw e;if(!(t!==null&&(t.f&16384)!==0)){for(;t!==null;){if((t.f&128)!==0&&(t.f&33570816)===0){if((t.f&32768)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}}function Mi(e){T===null&&(w===null&&li(e),oi()),ht&&ai(e)}function Oi(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Mt(e,t){var n=T;n!==null&&n.f&8192&&(e|=Hn);var r={ctx:I,deps:null,nodes:null,f:e|ot|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};_?.register_created_effect(r);var i=r;if((e&4)!==0)te!==null?te.push(r):qt.ensure().schedule(r);else if(t!==null){try{Dt(r)}catch(o){throw J(r),o}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=Kn))}if(i!==null&&(i.parent=n,n!==null&&Oi(i,n),w!==null&&(w.f&2)!==0&&(e&64)===0)){var s=w;(s.effects??(s.effects=[])).push(i)}return r}function an(){return w!==null&&!V}function Ht(e){Mi("$effect");var t=T.f;if(!w&&(t&32)!==0&&I!==null&&!I.i){var n=I;(n.e??(n.e=[])).push(e)}else return hr(e)}function hr(e){return Mt(4|Yr,e)}function Hi(e){qt.ensure();const t=Mt(64|re,e);return()=>{J(t)}}function xi(e){qt.ensure();const t=Mt(64|re,e);return(n={})=>new Promise(r=>{n.outro?He(t,()=>{J(t),r(void 0)}):(J(t),r(void 0))})}function Ni(e){return Mt(4,e)}function on(e,t=0){return Mt(8|t,e)}function Ki(e,t=0){return Mt(16|t,e)}function It(e){return Mt(32|re,e)}function fr(e){var t=e.teardown;if(t!==null){const n=ht,r=w;An(!0),at(null);try{t.call(null)}catch(i){dt(i,e.parent)}finally{An(n),at(r)}}}function ln(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const i=n.ac;i!==null&&Me(()=>{i.abort(Le)});var r=n.next;(n.f&64)!==0?n.parent=null:J(n,t),n=r}}function Gi(e){for(var t=e.first;t!==null;){var n=t.next;!(t.f&32)&&J(t),t=n}}function J(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Wi(e.nodes.start,e.nodes.end),n=!0),e.f|=Be,ln(e,t&&!n),ee(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(const s of r)s.stop();fr(e),e.f^=Be,e.f|=xn;var i=e.parent;i!==null&&i.first!==null&&dr(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Wi(e,t){for(;e!==null;){var n=e===t?null:jt(e);e.remove(),e=n}}function dr(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function He(e,t,n=!0){var r=[];e.f|=256,vr(e,r,!0);var i=()=>{n&&J(e),t&&t()},s=r.length;if(s>0){var o=()=>--s||i();for(var l of r)l.out(o)}else i()}function vr(e,t,n){if((e.f&8192)===0){e.f^=Hn;var r=e.nodes&&e.nodes.t;if(r!==null)for(const l of r)(l.is_global||n)&&t.push(l);for(var i=e.first;i!==null;){var s=i.next;if((i.f&64)===0){var o=(i.f&65536)!==0||(i.f&32)!==0&&(e.f&16)!==0;vr(i,t,o?n:!1)}i=s}}}function Pi(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:jt(n);t.append(n),n=i}}var Fi=null,ht=!1;function An(e){ht=e}var w=null,V=!1;function at(e){w=e}var T=null;function pt(e){T=e}var Q=null;function pr(e){w!==null&&(w.f&2097152||w.f&2)&&(Q??(Q=new Set)).add(e)}var P=null,q=0,X=null;function Bi(e){X=e}var mr=1,wt=0,Tt=wt;function wn(e){Tt=e}function gr(){return++mr}function ie(e){var t=e.f;if((t&2048)!==0)return!0;if((t&4096)!==0){for(var n=e.deps,r=n.length,i=0;i<r;i++){var s=n[i];if(ie(s)&&Vn(s),s.wv>e.wv)return!0}t&512&&K===null&&M(e,et)}return!1}function yr(e,t,n=!0){var r=e.reactions;if(r!==null&&!(!tn&&Q!==null&&Q.has(e)))for(var i=0;i<r.length;i++){var s=r[i];(s.f&2)!==0?yr(s,t,!1):t===s&&(n?M(s,ot):s.f&1024&&M(s,Rt),tr(s))}}function br(e){var t=P,n=q,r=X,i=w,s=Q,o=I,l=V,c=Tt,h=e.f;P=null,q=0,X=null,w=(h&96)===0?e:null,Q=null,Se(e.ctx),V=!1,Tt=++wt,e.ac!==null&&(Me(()=>{e.ac.abort(Le)}),e.ac=null);try{e.f|=pn;var f=e.fn,d=f();e.f|=Nn;var y=En(e);if(Re()&&X!==null&&!V&&y!==null&&(e.f&6146)===0)for(var b=0;b<X.length;b++)yr(X[b],e);if(i!==null&&i!==e){if(wt++,i.deps!==null)for(let E=0;E<n;E+=1)i.deps[E].rv=wt;if(t!==null)for(const E of t)E.rv=wt;X!==null&&(r===null?r=X:r.push(...X))}return e.f&8388608&&(e.f^=Gn),d}catch(E){return En(e),Ri(E)}finally{e.f^=pn,P=t,q=n,X=r,w=i,Q=s,Se(o),V=l,Tt=c}}function En(e){var t=e.deps,n=_?.is_fork;if(P!==null){var r;if(n||ee(e,q),t!==null&&q>0)for(t.length=q+P.length,r=0;r<P.length;r++)t[q+r]=P[r];else e.deps=t=P;if(an()&&(e.f&512)!==0)for(r=q;r<t.length;r++){var i;((i=t[r]).reactions??(i.reactions=[])).push(e)}}else!n&&t!==null&&q<t.length&&(ee(e,q),t.length=q);return t}function Di(e,t){let n=t.reactions;if(n!==null){var r=Wr.call(n,e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&(t.f&2)!==0&&(P===null||!ye.call(P,t))){var s=t;s.f&512&&(s.f^=512),s.v!==R&&nn(s),s.ac!==null&&Me(()=>{s.ac.abort(Le),s.ac=null,M(s,ot)}),Ai(s),ee(s,0)}}function ee(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Di(e,n[r])}function Dt(e){var t=e.f;if((t&16384)===0){M(e,et);var n=T;T=e;try{(t&16777232)!==0?Gi(e):ln(e),fr(e);var r=br(e);e.teardown=typeof r=="function"?r:null,e.wv=mr}finally{T=n}}}function A(e){var t=(e.f&2)!==0;if(Fi?.add(e),w!==null&&!V&&!(T!==null&&(T.f&16384)!==0)&&(Q===null||!Q.has(e))){var n=w.deps;if((w.f&2097152)!==0)e.rv<wt&&(e.rv=wt,P===null&&n!==null&&n[q]===e?q++:P===null?P=[e]:P.push(e));else{var r;(r=w).deps??(r.deps=[]),ye.call(w.deps,e)||w.deps.push(e);var i=e.reactions;i===null?e.reactions=[w]:ye.call(i,w)||i.push(w)}}if(ht&&st.has(e))return st.get(e);if(t){var s=e;if(ht){var o=s.v;return(!(s.f&1024)&&s.reactions!==null||Ar(s))&&(o=rn(s)),st.set(s,o),o}var l=(s.f&512)===0&&!V&&w!==null&&(w.f&512)!==0,c=(s.f&Nn)===0;ie(s)&&(l&&(s.f|=512),Vn(s)),l&&!c&&(Yn(s),Sr(s))}if(K?.has(e))return K.get(e);if((e.f&8388608)!==0)throw e.v;return e.v}function Sr(e){if(e.f|=512,e.deps!==null)for(const n of e.deps){var t=n.reactions;t===null?n.reactions=[e]:ye.call(t,e)||t.push(e),n.f&2&&!(n.f&512)&&(Yn(n),Sr(n))}}function Ar(e){if(e.v===R)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(st.has(t)||(t.f&2)!==0&&Ar(t))return!0;return!1}function xe(e){var t=V;try{return V=!0,e()}finally{V=t}}var ue=Symbol("events"),qi=new Set,$n=new Set,Ge=null,We=!1;function Tn(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],s=i[0]||e.target;Ge=e,We||(We=!0,setTimeout(()=>{We=!1,Ge=null}));var o=0,l=Ge===e&&e[ue];if(l){var c=i.indexOf(l);if(c!==-1&&(t===document||t===window)){e[ue]=t;return}var h=i.indexOf(t);if(h===-1)return;c<=h&&(o=c)}if(s=i[o]||e.target,s!==t){Jt(e,"currentTarget",{configurable:!0,get(){return s||n}});var f=w,d=T;at(null),pt(null);try{for(var y,b=[];s!==null&&s!==t;){try{var E=s[ue]?.[r];E!=null&&(!s.disabled||e.target===s)&&E.call(s,e)}catch($){y?b.push($):y=$}if(e.cancelBubble)break;o++,s=o<i.length?i[o]:null}if(y){for(let $ of b)queueMicrotask(()=>{throw $});throw y}}finally{e[ue]=t,delete e.currentTarget,at(f),pt(d)}}}var ji=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function Xi(e){return ji?.createHTML(e)??e}function zi(e){var t=ur("template");return t.innerHTML=Xi(e.replaceAll("<!>","<!---->")),t.content}function ve(e,t){var n=T;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function Vi(e,t){var n=(t&1)!==0,r=(t&2)!==0,i,s=!e.startsWith("<!>");return()=>{if(U)return ve(G,null),G;i===void 0&&(i=zi(s?e:"<!>"+e),n||(i=Ve(i)));var o=r||ar?document.importNode(i,!0):i.cloneNode(!0);if(n){var l=Ve(o),c=o.lastChild;ve(l,c)}else ve(o,o);return o}}function wr(e,t){if(U){var n=T;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=G),Fn();return}e!==null&&e.before(t)}var Yi=["touchstart","touchmove"];function Ui(e){return Yi.includes(e)}function Ji(e){let t=0,n=Oe(0),r;return()=>{an()&&(A(n),on(()=>(t===0&&(r=xe(()=>e(()=>Ut(n)))),t+=1,()=>{Lt(()=>{t-=1,t===0&&(r?.(),r=void 0,Ut(n))})})))}}var Qi=Kn|re;function Zi(e,t,n,r){new ts(e,t,n,r)}var Z=new WeakMap,Ye=new WeakMap,it=new WeakMap,ne=new WeakMap,F=new WeakMap,tt=new WeakMap,j=new WeakMap,Y=new WeakMap,vt=new WeakMap,Kt=new WeakMap,_t=new WeakMap,he=new WeakMap,Ue=new WeakMap,Je=new WeakMap,mt=new WeakMap,_n=new WeakMap,C=new WeakSet,ts=class{constructor(e,t,n,r){sn(this,C),u(this,"parent",void 0),u(this,"is_pending",!1),u(this,"transform_error",void 0),S(this,Z,void 0),S(this,Ye,U?G:null),S(this,it,void 0),S(this,ne,void 0),S(this,F,void 0),S(this,tt,null),S(this,j,null),S(this,Y,null),S(this,vt,null),S(this,Kt,0),S(this,_t,0),S(this,he,!1),S(this,Ue,new Set),S(this,Je,new Set),S(this,mt,null),S(this,_n,Ji(()=>(v(mt,this,Oe(a(Kt,this))),()=>{v(mt,this,null)}))),v(Z,this,e),v(it,this,t),v(ne,this,i=>{var s=T;s.b=this,s.f|=128,n(i)}),this.parent=T.b,this.transform_error=r??this.parent?.transform_error??(i=>i),v(F,this,Ki(()=>{if(U){const i=ii(a(Ye,this));Fn();const s=i==="[!";if(i.startsWith("[?")){const o=JSON.parse(i.slice(2));p(C,this,ns).call(this,o)}else s?p(C,this,rs).call(this):p(C,this,es).call(this)}else p(C,this,$r).call(this)},Qi)),U&&v(Z,this,G)}defer_effect(e){zn(e,a(Ue,this),a(Je,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!a(it,this).pending}update_pending_count(e,t){p(C,this,Tr).call(this,e,t),v(Kt,this,a(Kt,this)+e),a(mt,this)&&!a(he,this)&&(v(he,this,!0),Lt(()=>{v(he,this,!1),a(mt,this)&&ir(a(mt,this),a(Kt,this))}))}get_effect_pending(){return a(_n,this).call(this),A(a(mt,this))}error(e){if(e===kt||!a(it,this).onerror&&!a(it,this).failed)throw e;_?.is_fork?(a(tt,this)&&_.skip_effect(a(tt,this)),a(j,this)&&_.skip_effect(a(j,this)),a(Y,this)&&_.skip_effect(a(Y,this)),_.oncommit(()=>{p(C,this,Ct).call(this)||p(C,this,Cn).call(this,e)})):p(C,this,Cn).call(this,e)}};function es(){try{v(tt,this,It(()=>a(ne,this).call(this,a(Z,this))))}catch(e){this.error(e)}}function ns(e){const t=a(it,this).failed,{reset:n,invoke_onerror:r}=p(C,this,Er).call(this,e);Lt(r),t&&v(Y,this,It(()=>{t(a(Z,this),()=>e,()=>n)}))}function Er(e){var t=!1,n=!1;const r=()=>{if(!p(C,this,Ct).call(this)){if(t){ei();return}t=!0,n&&pi(),a(Y,this)!==null&&He(a(Y,this),()=>{v(Y,this,null)}),p(C,this,cn).call(this,()=>{p(C,this,$r).call(this)})}};return{reset:r,invoke_onerror:()=>{if(!p(C,this,Ct).call(this))try{n=!0,a(it,this).onerror?.(e,r),n=!1}catch(i){dt(i,a(F,this)&&a(F,this).parent)}}}}function Ct(){return(a(F,this).f&(xn|Be))!==0}function rs(){const e=a(it,this).pending;e&&(this.is_pending=!0,v(j,this,It(()=>e(a(Z,this)))),Lt(()=>{if(!p(C,this,Ct).call(this)){var t=v(vt,this,document.createDocumentFragment()),n=cr(),r=!1;if(t.append(n),v(tt,this,p(C,this,cn).call(this,()=>{try{return It(()=>a(ne,this).call(this,n))}catch(i){try{this.error(i),r=!0}catch(s){dt(s,a(F,this).parent)}return null}})),a(tt,this)===null){v(vt,this,null),r&&p(C,this,Ce).call(this,_);return}a(_t,this)===0&&(a(Z,this).before(t),v(vt,this,null),He(a(j,this),()=>{v(j,this,null)}),p(C,this,Ce).call(this,_))}}))}function $r(){try{if(this.is_pending=this.has_pending_snippet(),v(_t,this,0),v(Kt,this,0),v(tt,this,It(()=>{a(ne,this).call(this,a(Z,this))})),a(_t,this)>0){var e=v(vt,this,document.createDocumentFragment());Pi(a(tt,this),e);const t=a(it,this).pending;v(j,this,It(()=>t(a(Z,this))))}else p(C,this,Ce).call(this,_)}catch(t){this.error(t)}}function Ce(e){this.is_pending=!1,e.transfer_effects(a(Ue,this),a(Je,this))}function cn(e){var t=T,n=w,r=I;pt(a(F,this)),at(a(F,this)),Se(a(F,this).ctx);try{return qt.ensure(),e()}finally{pt(t),at(n),Se(r)}}function Tr(e,t){if(!this.has_pending_snippet()){if(this.parent){var n;p(C,n=this.parent,Tr).call(n,e,t)}return}v(_t,this,a(_t,this)+e),a(_t,this)===0&&(p(C,this,Ce).call(this,t),a(j,this)&&He(a(j,this),()=>{v(j,this,null)}),a(vt,this)&&(a(Z,this).before(a(vt,this)),v(vt,this,null)))}function Cn(e){a(tt,this)&&(J(a(tt,this)),v(tt,this,null)),a(j,this)&&(J(a(j,this)),v(j,this,null)),a(Y,this)&&(J(a(Y,this)),v(Y,this,null)),U&&(Zt(a(Ye,this)),ni(),Zt(ri()));let t=a(it,this).failed;const n=r=>{if(p(C,this,Ct).call(this))return;const{reset:i,invoke_onerror:s}=p(C,this,Er).call(this,r);s(),t&&!p(C,this,Ct).call(this)&&v(Y,this,p(C,this,cn).call(this,()=>{try{return It(()=>{var o=T;o.b=this,o.f|=128,t(a(Z,this),()=>r,()=>i)})}catch(o){return dt(o,a(F,this).parent),null}}))};Lt(()=>{if(!p(C,this,Ct).call(this)){var r;try{r=this.transform_error(e)}catch(i){dt(i,a(F,this)&&a(F,this).parent);return}r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(n,i=>dt(i,a(F,this)&&a(F,this).parent)):n(r)}})}function _r(e,t){return Cr(e,t)}function is(e,t){ze(),t.intro=t.intro??!1;const n=t.target,r=U,i=G;try{for(var s=Ve(n);s&&(s.nodeType!==8||s.data!=="[");)s=jt(s);if(!s)throw kt;ae(!0),Zt(s);const o=Cr(e,{...t,anchor:s});return ae(!1),o}catch(o){if(o instanceof Error&&o.message.split(`
2
+ `).some(l=>l.startsWith("https://svelte.dev/e/")))throw o;return o!==kt&&console.warn("Failed to hydrate: ",o),t.recover===!1&&ui(),ze(),Ii(n),ae(!1),_r(e,t)}finally{ae(r),Zt(i)}}var fe=new Map;function Cr(e,{target:t,anchor:n,props:r={},events:i,context:s,intro:o=!0,transformError:l}){ze();var c=void 0,h=xi(()=>{var f=n??t.appendChild(cr());Zi(f,{pending:()=>{}},b=>{qn({});var E=I;if(s&&(E.c=s),i&&(r.$$events=i),U&&ve(b,null),c=e(b,r)||en(),U&&(T.nodes.end=G,G===null||G.nodeType!==8||G.data!=="]"))throw Ze(),kt;jn()},l);var d=new Set,y=b=>{for(var E=0;E<b.length;E++){var $=b[E];if(!d.has($)){d.add($);var z=Ui($);for(const g of[t,document]){var H=fe.get(g);H===void 0&&(H=new Map,fe.set(g,H));var W=H.get($);W===void 0?(g.addEventListener($,Tn,{passive:z}),H.set($,1)):H.set($,W+1)}}}};return y(Pr(qi)),$n.add(y),()=>{for(var b of d)for(const z of[t,document]){var E=fe.get(z),$=E.get(b);--$==0?(z.removeEventListener(b,Tn),E.delete(b),E.size===0&&fe.delete(z)):E.set(b,$)}$n.delete(y),f!==n&&f.parentNode?.removeChild(f)}});return Qe.set(c,h),c}var Qe=new WeakMap;function ss(e,t){const n=Qe.get(e);return n?(Qe.delete(e),n(t)):Promise.resolve()}var kr,Gt=new WeakMap,ke=new WeakMap,Pe=new WeakMap,kn=new WeakSet,Lr=class{constructor(e){sn(this,kn),S(this,Gt,new WeakMap),S(this,ke,void 0),S(this,Pe,void 0),v(Pe,this,e)}observe(e,t){var n=a(Gt,this).get(e)||new Set;return n.add(t),a(Gt,this).set(e,n),p(kn,this,as).call(this).observe(e,a(Pe,this)),()=>{var r=a(Gt,this).get(e);r.delete(t),r.size===0&&(a(Gt,this).delete(e),a(ke,this).unobserve(e))}}};kr=Lr;function as(){return a(ke,this)??v(ke,this,new ResizeObserver(e=>{for(var t of e){kr.entries.set(t.target,t);for(var n of a(Gt,this).get(t.target)||[])n(t)}}))}u(Lr,"entries",new WeakMap);function Fe(e,t){return e===t||e?.[Vt]===t}function os(e=en(),t,n,r){var i=I.r,s=T;return Ni(()=>{var o,l;return on(()=>{o=l,l=r?.()||[],xe(()=>{Fe(n(...l),e)||(t(e,...l),o&&Fe(n(...o),e)&&t(null,...o))})}),()=>{let c=s;for(;c!==i&&c.parent!==null&&c.parent.f&33554432;)c=c.parent;const h=()=>{l&&Fe(n(...l),e)&&t(null,...l)},f=c.teardown;c.teardown=()=>{h(),f?.()}}}),e}var de=!1;function ls(e){var t=de;try{return de=!1,[e(),de]}finally{de=t}}function Xt(e,t,n,r){var i=!Ie||(n&2)!==0,s=(n&8)!==0,o=(n&16)!==0,l=r,c=!0,h=void 0,f=()=>o&&i?(h??(h=Ae(r)),A(h)):(c&&(c=!1,l=o?xe(r):r),l);let d;if(s){var y=Vt in e||Pn in e;d=Et(e,t)?.set??(y&&t in e?x=>e[t]=x:void 0)}var b,E=!1;s?[b,E]=ls(()=>e[t]):b=e[t],b===void 0&&r!==void 0&&(b=f(),d&&(i&&hi(t),d(b)));var $;if(i?$=()=>{var x=e[t];return x===void 0?f():(c=!0,x)}:$=()=>{var x=e[t];return x!==void 0&&(l=void 0),x===void 0?l:x},i&&(n&4)===0)return $;if(d){var z=e.$$legacy;return(function(x,se){return arguments.length>0?((!i||!se||z||E)&&d(se?$():x),x):$()})}var H=!1,W=((n&1)!==0?Ae:bi)(()=>(H=!1,$()));s&&A(W);var g=T;return(function(x,se){if(arguments.length>0){const hn=se?A(W):i&&s?Pt(x):x;return O(W,hn),H=!0,l!==void 0&&(l=hn),x}return ht&&H||(g.f&16384)!==0?W.v:A(W)})}function cs(e){return new us(e)}var gt=new WeakMap,nt=new WeakMap,us=class{constructor(e){S(this,gt,void 0),S(this,nt,void 0);var t=new Map,n=(i,s)=>{var o=ki(s,!1,!1);return t.set(i,o),o};const r=new Proxy({...e.props||{},$$events:{}},{get(i,s){return A(t.get(s)??n(s,Reflect.get(i,s)))},has(i,s){return s===Pn?!0:(A(t.get(s)??n(s,Reflect.get(i,s))),Reflect.has(i,s))},set(i,s,o){return O(t.get(s)??n(s,o),o),Reflect.set(i,s,o)}});v(nt,this,(e.hydrate?is:_r)(e.component,{target:e.target,anchor:e.anchor,props:r,context:e.context,intro:e.intro??!1,recover:e.recover,transformError:e.transformError})),(!e?.props?.$$host||e.sync===!1)&&bt(),v(gt,this,r.$$events);for(const i of Object.keys(a(nt,this)))i==="$set"||i==="$destroy"||i==="$on"||Jt(this,i,{get(){return a(nt,this)[i]},set(s){a(nt,this)[i]=s},enumerable:!0});a(nt,this).$set=i=>{Object.assign(r,i)},a(nt,this).$destroy=()=>{ss(a(nt,this))}}$set(e){a(nt,this).$set(e)}$on(e,t){a(gt,this)[e]=a(gt,this)[e]||[];const n=(...r)=>t.call(this,...r);return a(gt,this)[e].push(n),()=>{a(gt,this)[e]=a(gt,this)[e].filter(r=>r!==n)}}$destroy(){a(nt,this).$destroy()}},Ir;typeof HTMLElement=="function"&&(Ir=class extends HTMLElement{constructor(e,t,n){super(),u(this,"$$ctor",void 0),u(this,"$$s",void 0),u(this,"$$c",void 0),u(this,"$$cn",!1),u(this,"$$d",{}),u(this,"$$r",!1),u(this,"$$p_d",{}),u(this,"$$l",{}),u(this,"$$l_u",new Map),u(this,"$$me",void 0),u(this,"$$shadowRoot",null),this.$$ctor=e,this.$$s=t,n&&(this.$$shadowRoot=this.attachShadow(n))}addEventListener(e,t,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const r=this.$$c.$on(e,t);this.$$l_u.set(t,r)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){if(super.removeEventListener(e,t,n),this.$$c){const r=this.$$l_u.get(t);r&&(r(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(r){return i=>{const s=ur("slot");r!=="default"&&(s.name=r),wr(i,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},n=hs(this);for(const r of this.$$s)r in n&&(r==="default"&&!this.$$d.children?(this.$$d.children=e(r),t.default=!0):t[r]=e(r));for(const r of this.attributes){const i=this.$$g_p(r.name);i in this.$$d||(this.$$d[i]=pe(i,r.value,this.$$p_d,"toProp"))}for(const r in this.$$p_d)!(r in this.$$d)&&this[r]!==void 0&&(this.$$d[r]=this[r],delete this[r]);this.$$c=cs({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=Hi(()=>{on(()=>{this.$$r=!0;for(const r of be(this.$$c)){if(!this.$$p_d[r]?.reflect)continue;this.$$d[r]=this.$$c[r];const i=pe(r,this.$$d[r],this.$$p_d,"toAttribute");i==null?this.removeAttribute(this.$$p_d[r].attribute||r):this.setAttribute(this.$$p_d[r].attribute||r,i)}this.$$r=!1})});for(const r in this.$$l)for(const i of this.$$l[r]){const s=this.$$c.$on(r,i);this.$$l_u.set(i,s)}this.$$l={}}}attributeChangedCallback(e,t,n){this.$$r||(e=this.$$g_p(e),this.$$d[e]=pe(e,n,this.$$p_d,"toProp"),this.$$c?.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return be(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function pe(e,t,n,r){const i=n[e]?.type;if(t=i==="Boolean"&&typeof t!="boolean"?t!=null:t,!r||!n[e])return t;if(r==="toAttribute")switch(i){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(i){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function hs(e){const t={};return e.childNodes.forEach(n=>{t[n.slot||"default"]=!0}),t}function fs(e,t,n,r,i,s){let o=class extends Ir{constructor(){super(e,n,i),this.$$p_d=t}static get observedAttributes(){return be(t).map(l=>(t[l].attribute||l).toLowerCase())}};return be(t).forEach(l=>{Jt(o.prototype,l,{get(){return this.$$c&&l in this.$$c?this.$$c[l]:this.$$d[l]},set(c){c=pe(l,c,t),this.$$d[l]=c;var h=this.$$c;h&&(Et(h,l)?.get?h[l]=c:h.$set({[l]:c}))}})}),r.forEach(l=>{Jt(o.prototype,l,{get(){return this.$$c?.[l]}})}),s&&(o=s(o)),e.element=o,o}var Rr,lt=class B{findChoices(t){t.setAttribute(B.ROOT_HOOK_ATTR,"true");const n=Array.from(t.querySelectorAll(B.CHOICE_SELECTOR));for(const r of n)this.annotateChoice(r);return this.annotateFeedbackTicks(t),n}createChoiceRange(t){const n=this.resolveLabelElement(t);if(!n)return null;const r=document.createRange();return r.selectNodeContents(n),r}getChoiceId(t){const n=t.querySelector('input[type="checkbox"], input[type="radio"]');return n?.getAttribute("value")||n?.id||this.generateFallbackId(t)}getChoiceLabel(t){return this.resolveLabelElement(t)?.textContent?.trim()||"Unlabeled choice"}isSelected(t){const n=t.querySelector('input[type="checkbox"], input[type="radio"]');return n?n.checked||n.getAttribute("aria-checked")==="true":!1}canEliminate(t){const n=t.querySelector('input[type="checkbox"], input[type="radio"]');return!(!n||this.isSelected(t)||n.disabled||(t.closest(`[${B.ROOT_HOOK_ATTR}="true"]`)||t.closest("multiple-choice"))?.querySelector(`[${B.FEEDBACK_HOOK_ATTR}="true"]`))}setSelectable(t,n){const r=t.querySelector('input[type="checkbox"], input[type="radio"]');if(!r)return;r.disabled=!n,n?r.removeAttribute("aria-disabled"):r.setAttribute("aria-disabled","true");const i=r.closest(B.MUI_BUTTON_SELECTOR);i&&i.classList.toggle(B.MUI_DISABLED_CLASS,!n)}generateFallbackId(t){const n=(t.closest(`[${B.ROOT_HOOK_ATTR}="true"]`)||t.closest("multiple-choice"))?.querySelectorAll(`[${B.CHOICE_HOOK_ATTR}="true"]`)||[];return`choice-${Array.from(n).indexOf(t)}`}annotateChoice(t){t.setAttribute(B.CHOICE_HOOK_ATTR,"true");const n=this.resolveLabelElement(t);n&&n.setAttribute(B.LABEL_HOOK_ATTR,"true")}resolveLabelElement(t){return t.querySelector(`[${B.LABEL_HOOK_ATTR}="true"]`)||t.querySelector("label")||t.querySelector("span")}annotateFeedbackTicks(t){for(const n of t.querySelectorAll(".feedback-tick"))n.setAttribute(B.FEEDBACK_HOOK_ATTR,"true")}};Rr=lt;u(lt,"CHOICE_HOOK_ATTR","data-pie-answer-eliminator-choice");u(lt,"LABEL_HOOK_ATTR","data-pie-answer-eliminator-label");u(lt,"ROOT_HOOK_ATTR","data-pie-answer-eliminator-root");u(lt,"FEEDBACK_HOOK_ATTR","data-pie-answer-eliminator-feedback-tick");u(lt,"CHOICE_SELECTOR",`[${Rr.CHOICE_HOOK_ATTR}="true"], .corespring-checkbox, .corespring-radio-button`);u(lt,"MUI_BUTTON_SELECTOR",".MuiButtonBase-root, .MuiRadio-root, .MuiCheckbox-root");u(lt,"MUI_DISABLED_CLASS","Mui-disabled");var ds="ebsr-multiple-choice",Mr=e=>e instanceof HTMLElement&&xr(e.tagName.toLowerCase()).baseName===ds,Ln=(e,t)=>Array.from(e.querySelectorAll(`[id="${t}"]`)).find(Mr)??null,vs=e=>{let t=e.parentElement;for(;t!==null;){if(Mr(t))return t;t=t.parentElement}return null},ps=class{constructor(){u(this,"mcAdapter",new lt)}findChoices(e){const t=Ln(e,"a"),n=Ln(e,"b"),r=[];return t&&r.push(...this.mcAdapter.findChoices(t)),n&&r.push(...this.mcAdapter.findChoices(n)),r}createChoiceRange(e){return this.mcAdapter.createChoiceRange(e)}getChoiceId(e){return`${vs(e)?.id||"unknown"}-${this.mcAdapter.getChoiceId(e)}`}getChoiceLabel(e){return this.mcAdapter.getChoiceLabel(e)}isSelected(e){return this.mcAdapter.isSelected(e)}canEliminate(e){return this.mcAdapter.canEliminate(e)}setSelectable(e,t){this.mcAdapter.setSelectable(e,t)}},In="answer-masking",ms="data-pie-answer-eliminator-choice",gs="data-pie-answer-eliminator-label";function Or(e){if(!e.localName.includes("-"))return null;try{const t=e.constructor.pieSupports;return Array.isArray(t)?t:null}catch{return null}}function ys(e){const t=[];for(const n of[e,...e.querySelectorAll("*")])Or(n)&&(t.some(r=>r.contains(n))||t.push(n));return t}function me(e,t,n){try{return e()}catch(r){return console.error(`[AnswerEliminator] ${n} threw:`,r),t}}function bs(e){if(!e||typeof e!="object")return null;const t=e,{id:n,label:r,container:i,content:s}=t,{isSelected:o,isEliminable:l,setEliminated:c}=t;return typeof n!="string"||!n||typeof r!="string"||!(i instanceof HTMLElement)||!(s instanceof Element)||!i.contains(s)||typeof o!="function"||typeof l!="function"||typeof c!="function"?null:{target:{id:n,label:r.trim()||s.textContent?.trim()||"Unlabeled choice",container:i,createRange(){const h=document.createRange();return h.selectNodeContents(s),h},isSelected:()=>me(()=>o.call(e)===!0,!1,"isSelected"),canEliminate:()=>me(()=>l.call(e)===!0,!1,"isEliminable"),setEliminated:h=>me(()=>c.call(e,h),void 0,"setEliminated")},content:s}}function Rn(e,t){e.getAttribute(t)!=="true"&&e.setAttribute(t,"true")}function Ss(e){if(!Or(e)?.includes("answer-masking"))return[];const t=e.pieSupportTargets;if(typeof t!="function")return console.warn(`[AnswerEliminator] <${e.localName}> declares ${In} but has no pieSupportTargets()`),[];const n=me(()=>t.call(e,In),[],`<${e.localName}>.pieSupportTargets`);if(!Array.isArray(n))return[];const r=[],i=new Set;for(const s of n){const o=bs(s);if(!o||i.has(o.target.id)){console.warn(`[AnswerEliminator] <${e.localName}> supplied a choice that is malformed or repeats an id`,s);continue}const{target:l,content:c}=o;i.add(l.id),Rn(l.container,ms),Rn(c,gs),r.push({target:l,owner:e})}return r}var As=[new ps,new lt];function ws(e,t){return{id:t.getChoiceId(e),label:t.getChoiceLabel(e),container:e,createRange:()=>t.createChoiceRange(e),isSelected:()=>t.isSelected(e),canEliminate:()=>t.canEliminate(e),setEliminated:n=>t.setSelectable(e,!n)}}function Es(e,t,n){const r=[],i=new Set(n.map(({target:s})=>s.container));for(const s of As)for(const o of s.findChoices(e))i.has(o)||(i.add(o),!t.some(l=>l.contains(o))&&r.push({target:ws(o,s),owner:null}));return r}function Mn(e){const t=ys(e),n=t.flatMap(Ss);return[...n,...Es(e,t,n)]}var Ot=class N{constructor(){u(this,"name","mask"),u(this,"highlights",new Map),u(this,"ranges",new Map),u(this,"fallbackContainers",new Map)}initialize(){}destroy(){this.clearAll()}apply(t,n){if(!this.isSupported()){this.applyFallback(t,n);return}this.injectHighlightCSS(t);const r=new Highlight(n);CSS.highlights.set(`${N.HIGHLIGHT_NAME_PREFIX}${t}`,r),this.highlights.set(t,r),this.ranges.set(t,n),this.addAriaAttributes(n)}remove(t){if(!this.isSupported()){this.removeFallback(t);return}CSS.highlights.delete(`${N.HIGHLIGHT_NAME_PREFIX}${t}`),this.removeHighlightCSS(t);const n=this.ranges.get(t);n&&this.removeAriaAttributes(n),this.highlights.delete(t),this.ranges.delete(t),this.fallbackContainers.delete(t)}isEliminated(t){return this.highlights.has(t)||this.fallbackContainers.has(t)}clearAll(){for(const t of this.getEliminatedIds())this.remove(t);this.fallbackContainers.clear()}getEliminatedIds(){return Array.from(new Set([...this.highlights.keys(),...this.fallbackContainers.keys()]))}isSupported(){return typeof CSS<"u"&&"highlights"in CSS}injectHighlightCSS(t){const n=`${N.HIGHLIGHT_STYLE_PREFIX}${t}`;if(document.getElementById(n))return;const r=document.createElement("style");r.id=n,r.textContent=`
3
3
  ::highlight(${N.HIGHLIGHT_NAME_PREFIX}${t}) {
4
4
  opacity: 0.2;
5
5
  filter: blur(2px);
6
6
  }
7
- `,document.head.appendChild(r)}removeHighlightCSS(t){document.getElementById(`${N.HIGHLIGHT_STYLE_PREFIX}${t}`)?.remove()}addAriaAttributes(t){const n=this.findChoiceContainer(t);n&&(n.setAttribute(N.ELIMINATED_ATTR,"true"),n.setAttribute("aria-hidden","true"))}removeAriaAttributes(t){const n=this.findChoiceContainer(t);n&&(n.removeAttribute(N.ELIMINATED_ATTR),n.removeAttribute("aria-hidden"))}findChoiceContainer(t){let n=t.startContainer;for(n.nodeType===Node.TEXT_NODE&&(n=n.parentElement);n&&n!==document.body;){if(n.getAttribute(N.CHOICE_HOOK_ATTR)==="true")return n;n=n.parentElement}return null}applyFallback(t,n){const r=this.findChoiceContainer(n);r&&(r.classList.add(N.FALLBACK_CLASS),r.setAttribute(N.ELIMINATED_ATTR,"true"),r.setAttribute(N.ELIMINATED_ID_ATTR,t),this.fallbackContainers.set(t,r),this.addAriaAttributes(n))}removeFallback(t){const n=this.fallbackContainers.get(t);if(!n)return;n.classList.remove(N.FALLBACK_CLASS),n.removeAttribute(N.ELIMINATED_ATTR),n.removeAttribute(N.ELIMINATED_ID_ATTR);const r=document.createRange();r.selectNodeContents(n),this.removeAriaAttributes(r),this.fallbackContainers.delete(t)}};u(Lt,"HIGHLIGHT_STYLE_PREFIX","pie-answer-eliminator-mask-highlight-");u(Lt,"HIGHLIGHT_NAME_PREFIX","pie-answer-masked-");u(Lt,"FALLBACK_CLASS","pie-answer-masked-fallback");u(Lt,"CHOICE_HOOK_ATTR","data-pie-answer-eliminator-choice");u(Lt,"ELIMINATED_ATTR","data-pie-answer-eliminated");u(Lt,"ELIMINATED_ID_ATTR","data-pie-answer-eliminated-id");var C=class p{constructor(){u(this,"name","strikethrough"),u(this,"highlights",new Map),u(this,"ranges",new Map),u(this,"fallbackContainers",new Map),u(this,"imageWrappers",new Map),u(this,"mathTargets",new Map)}initialize(){this.isSupported()||console.warn("CSS Custom Highlight API not supported, using fallback")}destroy(){this.clearAll()}apply(t,n){if(this.isSupported()){this.injectHighlightCSS(t);const r=new Highlight(n);CSS.highlights.set(`${p.HIGHLIGHT_NAME_PREFIX}${t}`,r),this.highlights.set(t,r),this.ranges.set(t,n),this.addAriaAttributes(n)}else this.applyFallback(t,n);this.strikeImages(t,n),this.strikeMath(t,n)}remove(t){if(this.unstrikeImages(t),this.unstrikeMath(t),!this.isSupported()){this.removeFallback(t);return}CSS.highlights.delete(`${p.HIGHLIGHT_NAME_PREFIX}${t}`),this.removeHighlightCSS(t);const n=this.ranges.get(t);n&&this.removeAriaAttributes(n),this.highlights.delete(t),this.ranges.delete(t),this.fallbackContainers.delete(t)}isEliminated(t){return this.highlights.has(t)||this.fallbackContainers.has(t)}clearAll(){const t=new Set([...this.highlights.keys(),...this.fallbackContainers.keys(),...this.imageWrappers.keys(),...this.mathTargets.keys()]);for(const n of t)this.remove(n);this.fallbackContainers.clear(),this.imageWrappers.clear(),this.mathTargets.clear()}getEliminatedIds(){return Array.from(new Set([...this.highlights.keys(),...this.fallbackContainers.keys()]))}isSupported(){return typeof CSS<"u"&&"highlights"in CSS}injectHighlightCSS(t){const n=`${p.HIGHLIGHT_STYLE_PREFIX}${t}`;if(document.getElementById(n))return;const r=document.createElement("style");r.id=n,r.textContent=`
8
- ::highlight(${p.HIGHLIGHT_NAME_PREFIX}${t}) {
7
+ `,document.head.appendChild(r)}removeHighlightCSS(t){document.getElementById(`${N.HIGHLIGHT_STYLE_PREFIX}${t}`)?.remove()}addAriaAttributes(t){const n=this.findChoiceContainer(t);n&&(n.setAttribute(N.ELIMINATED_ATTR,"true"),n.setAttribute("aria-hidden","true"))}removeAriaAttributes(t){const n=this.findChoiceContainer(t);n&&(n.removeAttribute(N.ELIMINATED_ATTR),n.removeAttribute("aria-hidden"))}findChoiceContainer(t){let n=t.startContainer;for(n.nodeType===Node.TEXT_NODE&&(n=n.parentElement);n&&n!==document.body;){if(n.getAttribute(N.CHOICE_HOOK_ATTR)==="true")return n;n=n.parentElement}return null}applyFallback(t,n){const r=this.findChoiceContainer(n);r&&(r.classList.add(N.FALLBACK_CLASS),r.setAttribute(N.ELIMINATED_ATTR,"true"),r.setAttribute(N.ELIMINATED_ID_ATTR,t),this.fallbackContainers.set(t,r),this.addAriaAttributes(n))}removeFallback(t){const n=this.fallbackContainers.get(t);if(!n)return;n.classList.remove(N.FALLBACK_CLASS),n.removeAttribute(N.ELIMINATED_ATTR),n.removeAttribute(N.ELIMINATED_ID_ATTR);const r=document.createRange();r.selectNodeContents(n),this.removeAriaAttributes(r),this.fallbackContainers.delete(t)}};u(Ot,"HIGHLIGHT_STYLE_PREFIX","pie-answer-eliminator-mask-highlight-");u(Ot,"HIGHLIGHT_NAME_PREFIX","pie-answer-masked-");u(Ot,"FALLBACK_CLASS","pie-answer-masked-fallback");u(Ot,"CHOICE_HOOK_ATTR","data-pie-answer-eliminator-choice");u(Ot,"ELIMINATED_ATTR","data-pie-answer-eliminated");u(Ot,"ELIMINATED_ID_ATTR","data-pie-answer-eliminated-id");var k=class m{constructor(){u(this,"name","strikethrough"),u(this,"highlights",new Map),u(this,"ranges",new Map),u(this,"fallbackContainers",new Map),u(this,"imageWrappers",new Map),u(this,"mathTargets",new Map)}initialize(){this.isSupported()||console.warn("CSS Custom Highlight API not supported, using fallback")}destroy(){this.clearAll()}apply(t,n){if(this.isSupported()){this.injectHighlightCSS(t);const r=new Highlight(n);CSS.highlights.set(`${m.HIGHLIGHT_NAME_PREFIX}${t}`,r),this.highlights.set(t,r),this.ranges.set(t,n),this.addAriaAttributes(n)}else this.applyFallback(t,n);this.strikeImages(t,n),this.strikeMath(t,n)}remove(t){if(this.unstrikeImages(t),this.unstrikeMath(t),!this.isSupported()){this.removeFallback(t);return}CSS.highlights.delete(`${m.HIGHLIGHT_NAME_PREFIX}${t}`),this.removeHighlightCSS(t);const n=this.ranges.get(t);n&&this.removeAriaAttributes(n),this.highlights.delete(t),this.ranges.delete(t),this.fallbackContainers.delete(t)}isEliminated(t){return this.highlights.has(t)||this.fallbackContainers.has(t)}clearAll(){const t=new Set([...this.highlights.keys(),...this.fallbackContainers.keys(),...this.imageWrappers.keys(),...this.mathTargets.keys()]);for(const n of t)this.remove(n);this.fallbackContainers.clear(),this.imageWrappers.clear(),this.mathTargets.clear()}getEliminatedIds(){return Array.from(new Set([...this.highlights.keys(),...this.fallbackContainers.keys()]))}isSupported(){return typeof CSS<"u"&&"highlights"in CSS}injectHighlightCSS(t){const n=`${m.HIGHLIGHT_STYLE_PREFIX}${t}`;if(document.getElementById(n))return;const r=document.createElement("style");r.id=n,r.textContent=`
8
+ ::highlight(${m.HIGHLIGHT_NAME_PREFIX}${t}) {
9
9
  text-decoration: line-through;
10
10
  text-decoration-thickness: 2px;
11
11
  text-decoration-color: var(--pie-answer-eliminator-strike-color, var(--pie-incorrect, #ff9800));
12
12
  }
13
- `,document.head.appendChild(r)}removeHighlightCSS(t){document.getElementById(`${p.HIGHLIGHT_STYLE_PREFIX}${t}`)?.remove()}addAriaAttributes(t){const n=this.findChoiceContainer(t);if(!n)return;n.setAttribute(p.ELIMINATED_ATTR,"true"),n.setAttribute("aria-disabled","true");const r=this.resolveLabelElement(n);if(r&&!r.querySelector(`.${p.SR_CLASS}`)){const i=document.createElement("span");i.className=p.SR_CLASS,i.textContent=" (eliminated)",r.appendChild(i)}}removeAriaAttributes(t){const n=this.findChoiceContainer(t);n&&(n.removeAttribute(p.ELIMINATED_ATTR),n.removeAttribute("aria-disabled"),n.querySelector(`.${p.SR_CLASS}`)?.remove())}findChoiceContainer(t){let n=t.startContainer;for(n.nodeType===Node.TEXT_NODE&&(n=n.parentElement);n&&n!==document.body;){if(n.getAttribute(p.CHOICE_HOOK_ATTR)==="true")return n;n=n.parentElement}return null}applyFallback(t,n){const r=this.findChoiceContainer(n);r&&(r.classList.add(p.FALLBACK_CLASS),r.setAttribute(p.ELIMINATED_ATTR,"true"),r.setAttribute(p.ELIMINATED_ID_ATTR,t),this.fallbackContainers.set(t,r),this.addAriaAttributes(n))}removeFallback(t){const n=this.fallbackContainers.get(t);if(!n)return;n.classList.remove(p.FALLBACK_CLASS),n.removeAttribute(p.ELIMINATED_ATTR),n.removeAttribute(p.ELIMINATED_ID_ATTR);const r=document.createRange();r.selectNodeContents(n),this.removeAriaAttributes(r),this.fallbackContainers.delete(t)}strikeImages(t,n){const r=this.resolveImageScope(n);if(!r)return;const i=[];for(const s of Array.from(r.querySelectorAll("img"))){const o=this.wrapImage(s);o&&i.push(o)}i.length>0&&this.imageWrappers.set(t,i)}unstrikeImages(t){const n=this.imageWrappers.get(t);if(n){for(const r of n)this.unwrapImage(r);this.imageWrappers.delete(t)}}strikeMath(t,n){const r=this.resolveImageScope(n);if(!r)return;const i=[];for(const s of r.querySelectorAll(p.MATH_SELECTOR)){const o=s.querySelector(p.MATH_BOX_SELECTOR)??s,l=!!o.querySelector(p.MATH_STACKED_SELECTOR);o.classList.add(p.MATH_STRIKE_CLASS,l?p.MATH_STRIKE_CROSS_CLASS:p.MATH_STRIKE_LINE_CLASS),o.setAttribute(p.MATH_STRIKE_ATTR,l?"cross":"line"),i.push(o)}i.length>0&&this.mathTargets.set(t,i)}unstrikeMath(t){const n=this.mathTargets.get(t);if(n){for(const r of n)r.classList.remove(p.MATH_STRIKE_CLASS,p.MATH_STRIKE_LINE_CLASS,p.MATH_STRIKE_CROSS_CLASS),r.removeAttribute(p.MATH_STRIKE_ATTR);this.mathTargets.delete(t)}}resolveImageScope(t){const n=t.commonAncestorContainer;return(n.nodeType===Node.TEXT_NODE?n.parentElement:n)??this.findChoiceContainer(t)}wrapImage(t){const n=t.parentElement;if(!n)return null;if(n.classList.contains(p.IMAGE_WRAPPER_CLASS)||n.hasAttribute(p.IMAGE_WRAPPER_ATTR))return n;const r=document.createElement("span");return r.className=p.IMAGE_WRAPPER_CLASS,r.setAttribute(p.IMAGE_WRAPPER_ATTR,"true"),this.fillsParentWidth(t,n)?r.style.display="block":p.BLOCK_DISPLAYS.has(getComputedStyle(t).display)&&(r.style.display="block",r.style.width="fit-content"),n.insertBefore(r,t),r.appendChild(t),r.appendChild(this.createImageStrikeOverlay()),r}fillsParentWidth(t,n){const r=t.getBoundingClientRect().width,i=n.clientWidth;return r===0||i===0?!1:r>=i-1}unwrapImage(t){t.querySelector(`.${p.IMAGE_OVERLAY_CLASS}`)?.remove();const n=t.parentElement;if(n){for(;t.firstChild;)n.insertBefore(t.firstChild,t);t.remove()}}createImageStrikeOverlay(){const t=document.createElementNS(p.SVG_NS,"svg");t.setAttribute("class",p.IMAGE_OVERLAY_CLASS),t.setAttribute("viewBox","0 0 100 100"),t.setAttribute("preserveAspectRatio","none"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false");const n=[{x1:"0",y1:"0",x2:"100",y2:"100"},{x1:"0",y1:"100",x2:"100",y2:"0"}];for(const r of[p.IMAGE_CASING_CLASS,p.IMAGE_LINE_CLASS])for(const{x1:i,y1:s,x2:o,y2:l}of n){const c=document.createElementNS(p.SVG_NS,"line");c.setAttribute("class",r),c.setAttribute("x1",i),c.setAttribute("y1",s),c.setAttribute("x2",o),c.setAttribute("y2",l),c.setAttribute("vector-effect","non-scaling-stroke"),t.appendChild(c)}return t}resolveLabelElement(t){return t.querySelector(`[${p.LABEL_HOOK_ATTR}="true"]`)||t.querySelector("label")}};u(C,"HIGHLIGHT_STYLE_PREFIX","pie-answer-eliminator-highlight-");u(C,"HIGHLIGHT_NAME_PREFIX","pie-answer-eliminated-");u(C,"FALLBACK_CLASS","pie-answer-eliminator-eliminated-fallback");u(C,"SR_CLASS","pie-answer-eliminator-sr-announcement");u(C,"CHOICE_HOOK_ATTR","data-pie-answer-eliminator-choice");u(C,"LABEL_HOOK_ATTR","data-pie-answer-eliminator-label");u(C,"ELIMINATED_ATTR","data-pie-answer-eliminated");u(C,"ELIMINATED_ID_ATTR","data-pie-answer-eliminated-id");u(C,"IMAGE_WRAPPER_CLASS","pie-answer-eliminator-image-strike");u(C,"IMAGE_WRAPPER_ATTR","data-pie-answer-eliminator-image-strike");u(C,"IMAGE_OVERLAY_CLASS","pie-answer-eliminator-image-strike-overlay");u(C,"IMAGE_LINE_CLASS","pie-answer-eliminator-image-strike-line");u(C,"IMAGE_CASING_CLASS","pie-answer-eliminator-image-strike-casing");u(C,"MATH_STRIKE_CLASS","pie-answer-eliminator-math-strike");u(C,"MATH_STRIKE_LINE_CLASS","pie-answer-eliminator-math-strike--line");u(C,"MATH_STRIKE_CROSS_CLASS","pie-answer-eliminator-math-strike--cross");u(C,"MATH_STRIKE_ATTR","data-pie-answer-eliminator-math-strike");u(C,"MATH_STACKED_SELECTOR","mjx-mfrac, mjx-mtable");u(C,"MATH_BOX_SELECTOR","mjx-math");u(C,"MATH_SELECTOR","mjx-container");u(C,"SVG_NS","http://www.w3.org/2000/svg");u(C,"BLOCK_DISPLAYS",new Set(["block","flex","grid","table","flow-root","list-item"]));var Mn="answerEliminator",ln=class pe{constructor(t="strikethrough",n="right"){u(this,"strategy",void 0),u(this,"choices",new Map),u(this,"eliminated",new Set),u(this,"strategyKeys",new Map),u(this,"anonymousGroups",new WeakMap),u(this,"nextToken",0),u(this,"buttonAlignment","right"),u(this,"shouldRestoreState",!0),u(this,"active",!0),u(this,"questionRoot",null),u(this,"selectionChangeHandler",null),u(this,"selectionObserver",null),u(this,"selectionRefreshFrame",null),u(this,"focusedKey",null),u(this,"store",null),u(this,"elementStateKeys",{}),this.strategy=this.createStrategy(t),this.strategy.initialize(),this.buttonAlignment=n}createStrategy(t){return t==="mask"?new Lt:new C}initializeForQuestion(t){this.active=!0;const n=new Set(this.eliminated);this.restoreAllSelectable(),this.strategy.clearAll(),this.eliminated.clear(),this.cleanupButtons();for(const i of Rn(t))this.initializeChoice(i,t);const r=this.readPersistedEliminations();for(const[i,s]of this.choices)(r.has(s.group)?r.get(s.group)?.has(s.choiceId):n.has(i))&&this.applyElimination(i,s);this.attachSelectionListener(t)}trackingKey(t,n){return`${t}\0${n}`}resolveGroup({target:t,owner:n},r){let i=n;for(let l=n??t.container.parentElement;l!==null;l=l===r?null:l.parentElement){if(l.id&&Object.hasOwn(this.elementStateKeys,l.id))return l.id;i===null&&l.localName.includes("-")&&(i=l)}const s=i??r;let o=this.anonymousGroups.get(s);return o||(o=`\0anonymous-${this.nextToken++}`,this.anonymousGroups.set(s,o)),o}strategyKeyFor(t){let n=this.strategyKeys.get(t);return n||(n=`choice-${this.nextToken++}`,this.strategyKeys.set(t,n)),n}initializeChoice(t,n){const{target:r,owner:i}=t,s=r.id,o=this.resolveGroup(t,n),l=this.trackingKey(o,s),c={choiceId:s,group:o,strategyKey:this.strategyKeyFor(l),target:r,owner:i,button:null};this.choices.set(l,c);const h=this.createToggleButton(l,c,this.alignmentFor(r.container));c.button=h,this.updateButtonVisibility(l),r.container.style.position="relative",r.container.appendChild(h)}alignmentFor(t){return this.buttonAlignment==="inline"||getComputedStyle(t).display==="inline"?"inline":this.buttonAlignment}createToggleButton(t,n,r){const i=n.target.label,s=document.createElement("button");s.type="button",s.className=pe.TOGGLE_CLASS,s.setAttribute("aria-label",`Toggle elimination for ${i}`),s.setAttribute("aria-pressed","false"),s.setAttribute("data-choice-id",n.choiceId);const o=document.createElement("span");return o.setAttribute("aria-hidden","true"),o.textContent="⊗",s.appendChild(o),this.applyButtonAlignment(s,r),s.dataset.pieShownDisplay=s.style.display,s.addEventListener("click",l=>{l.preventDefault(),l.stopPropagation(),this.toggleElimination(t)}),s.addEventListener("focus",()=>{this.focusedKey=t}),s.addEventListener("blur",()=>{queueMicrotask(()=>{s.isConnected&&this.focusedKey===t&&(this.focusedKey=null)})}),s}toggleElimination(t){const n=this.choices.get(t);if(n){if(this.eliminated.has(t))this.restoreChoice(t);else{if(!n.target.canEliminate()){console.warn("Cannot eliminate this choice (already selected or in evaluate mode)");return}if(!this.applyElimination(t,n)){console.error("Failed to create range for choice");return}}this.saveState(n.group)}}applyElimination(t,n,r=!0){if(n.target.isSelected())return!1;const i=n.target.createRange();return i?(this.strategy.apply(n.strategyKey,i),this.eliminated.add(t),r&&n.target.setEliminated(!0),n.button&&(n.button.classList.add(pe.TOGGLE_ACTIVE_CLASS),n.button.setAttribute("aria-pressed","true")),this.updateButtonVisibility(t),!0):!1}restoreChoice(t){const n=this.choices.get(t);this.eliminated.delete(t),n&&(this.strategy.remove(n.strategyKey),n.target.setEliminated(!1),n.button&&(n.button.classList.remove(pe.TOGGLE_ACTIVE_CLASS),n.button.setAttribute("aria-pressed","false")),this.updateButtonVisibility(t))}resetAll(){if(this.eliminated.size===0)return;const t=new Set;for(const n of Array.from(this.eliminated)){const r=this.choices.get(n)?.group;r!==void 0&&t.add(r),this.restoreChoice(n)}for(const n of t)this.saveState(n)}getEliminatedCount(){return this.eliminated.size}setStoreIntegration(t,n){this.store=t,this.elementStateKeys=n}saveState(t){if(!this.store||!Object.hasOwn(this.elementStateKeys,t))return;const n=[];for(const r of this.eliminated){const i=this.choices.get(r);i?.group===t&&n.push(i.choiceId)}this.store.setState(this.elementStateKeys[t],Mn,{eliminatedChoices:n})}readPersistedEliminations(){const t=new Map;if(!this.store||!this.shouldRestoreState)return t;for(const{group:n}of this.choices.values())if(!(t.has(n)||!Object.hasOwn(this.elementStateKeys,n)))try{const r=this.store.getState(this.elementStateKeys[n],Mn),i=Array.isArray(r?.eliminatedChoices)?r.eliminatedChoices.filter(s=>typeof s=="string"):[];t.set(n,new Set(i))}catch(r){console.error("Failed to restore eliminator state:",r)}return t}restoreAllSelectable(){for(const t of this.eliminated)this.choices.get(t)?.target.setEliminated(!1)}setButtonHidden(t,n){const r=n?"none":t.dataset.pieShownDisplay??"";t.style.display!==r&&(t.style.display=r)}shouldHideButton(t,n){return this.eliminated.has(t)?!1:this.active?n.target.isSelected():!0}updateButtonVisibility(t){const n=this.choices.get(t);n?.button&&this.setButtonHidden(n.button,this.shouldHideButton(t,n))}refreshSelectionState(){for(const t of this.choices.keys())this.updateButtonVisibility(t)}hasDetachedChoice(){for(const{target:t}of this.choices.values())if(!t.container.isConnected)return!0;return!1}rescan(){const t=this.questionRoot;if(!t)return;const n=this.focusedKey!==null&&!this.choices.get(this.focusedKey)?.button?.isConnected&&(document.activeElement===null||document.activeElement===document.body)?this.focusedKey:null,r=this.choices,i=new Set(this.eliminated);this.strategy.clearAll(),this.eliminated.clear();for(const{button:s}of r.values())s?.remove();this.choices=new Map;for(const s of Rn(t))this.initializeChoice(s,t);for(const s of i){const o=r.get(s),l=this.choices.get(s),c=!!o?.owner&&l?.owner===o.owner;l&&this.applyElimination(s,l,!c)||(l??o)?.target.setEliminated(!1)}n&&this.choices.get(n)?.button?.focus({preventScroll:!0})}scheduleSelectionRefresh(){this.selectionRefreshFrame===null&&(this.selectionRefreshFrame=requestAnimationFrame(()=>{this.selectionRefreshFrame=null,this.refreshSelectionState()}))}attachSelectionListener(t){this.detachSelectionListener(),this.questionRoot=t,this.selectionChangeHandler=()=>this.scheduleSelectionRefresh(),t.addEventListener("change",this.selectionChangeHandler),typeof MutationObserver<"u"&&(this.selectionObserver=new MutationObserver(n=>{const r=new Set;for(const{button:i}of this.choices.values())i&&r.add(i);n.some(i=>!r.has(i.target))&&(this.hasDetachedChoice()?this.rescan():this.scheduleSelectionRefresh())}),this.selectionObserver.observe(t,{subtree:!0,childList:!0,attributes:!0}))}detachSelectionListener(){this.selectionRefreshFrame!==null&&(cancelAnimationFrame(this.selectionRefreshFrame),this.selectionRefreshFrame=null),this.selectionObserver&&(this.selectionObserver.disconnect(),this.selectionObserver=null),this.questionRoot&&this.selectionChangeHandler&&this.questionRoot.removeEventListener("change",this.selectionChangeHandler),this.questionRoot=null,this.selectionChangeHandler=null}cleanupButtons(){this.detachSelectionListener(),this.focusedKey=null;for(const{button:t}of this.choices.values())t?.remove();this.choices.clear()}applyButtonAlignment(t,n){switch(n){case"right":Object.assign(t.style,{position:"absolute",right:"8px",top:"50%",transform:"translateY(-50%)"});break;case"left":Object.assign(t.style,{position:"absolute",left:"8px",top:"50%",transform:"translateY(-50%)"});break;case"inline":Object.assign(t.style,{position:"relative",marginLeft:"8px",marginRight:"8px",display:"inline-flex",verticalAlign:"middle"})}}enableStateRestoration(){this.shouldRestoreState=!0}disableStateRestoration(){this.shouldRestoreState=!1}cleanup(){this.active=!1,this.refreshSelectionState()}destroy(){this.restoreAllSelectable(),this.eliminated.clear(),this.cleanupButtons(),this.strategy.destroy()}};u(ln,"TOGGLE_CLASS","pie-answer-eliminator-toggle");u(ln,"TOGGLE_ACTIVE_CLASS","pie-answer-eliminator-toggle--active");var Es=zi('<div style="display: none;" aria-hidden="true"></div>');function $s(e,t){Dn(t,!0);let n=Dt(t,"visible",7,!1),r=Dt(t,"strategy",7,"strikethrough"),i=Dt(t,"alwaysOn",7,!1),s=Dt(t,"buttonAlignment",7,"right"),o=Dt(t,"elementStateKeys",23,()=>({})),l=B(null),c=B(null),h=B(null);const f=pn(()=>A(c)?.elementToolStateStore??null);let d=B(null),y=B(null),b=pn(()=>i()||n());Rt(()=>{if(A(l))return Nr(A(l),m=>{O(c,m,!0)})}),Rt(()=>{if(A(l))return xr(A(l),m=>{O(h,m,!0)})});function E(){return A(h)?.scopeElement||null}function _(){if(!A(b)||!A(d))return;const m=E();if(!m){console.warn("[AnswerEliminator] Missing shell scope context for question root");return}A(d).initializeForQuestion(m)}function z(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{_()})})}Rt(()=>{A(d)?.setStoreIntegration(A(f),o()??{})}),Rt(()=>{const m=new ln(r(),s());return Oe(()=>{m.setStoreIntegration(A(f),o()??{}),O(d,m,!0),A(b)?_():m.cleanup()}),()=>{m.destroy(),A(d)===m&&O(d,null)}}),Rt(()=>{const m=A(h)?.contextVersion??null;if(m!==null){if(A(y)===null){O(y,m,!0);return}m!==A(y)&&(O(y,m,!0),z())}}),Rt(()=>{A(d)&&(A(b)?(A(d).enableStateRestoration(),_()):A(d).cleanup())});var H={get visible(){return n()},set visible(m=!1){n(m),Ht()},get strategy(){return r()},set strategy(m="strikethrough"){r(m),Ht()},get alwaysOn(){return i()},set alwaysOn(m=!1){i(m),Ht()},get buttonAlignment(){return s()},set buttonAlignment(m="right"){s(m),Ht()},get elementStateKeys(){return o()},set elementStateKeys(m={}){o(m),Ht()}},G=Es();return as(G,m=>O(l,m),()=>A(l)),Ar(e,G),qn(H)}_s("pie-tool-answer-eliminator",hs($s,{visible:{attribute:"visible",type:"Boolean"},strategy:{attribute:"strategy",type:"String"},alwaysOn:{attribute:"always-on",type:"Boolean"},buttonAlignment:{attribute:"button-alignment",type:"String"},elementStateKeys:{type:"Object"}},[],[],{mode:"open"},Or));function _s(e,t){customElements.get(e)||customElements.define(e,t)}export{$s as default};
13
+ `,document.head.appendChild(r)}removeHighlightCSS(t){document.getElementById(`${m.HIGHLIGHT_STYLE_PREFIX}${t}`)?.remove()}addAriaAttributes(t){const n=this.findChoiceContainer(t);if(!n)return;n.setAttribute(m.ELIMINATED_ATTR,"true"),n.setAttribute("aria-disabled","true");const r=this.resolveLabelElement(n);if(r&&!r.querySelector(`.${m.SR_CLASS}`)){const i=document.createElement("span");i.className=m.SR_CLASS,i.textContent=" (eliminated)",r.appendChild(i)}}removeAriaAttributes(t){const n=this.findChoiceContainer(t);n&&(n.removeAttribute(m.ELIMINATED_ATTR),n.removeAttribute("aria-disabled"),n.querySelector(`.${m.SR_CLASS}`)?.remove())}findChoiceContainer(t){let n=t.startContainer;for(n.nodeType===Node.TEXT_NODE&&(n=n.parentElement);n&&n!==document.body;){if(n.getAttribute(m.CHOICE_HOOK_ATTR)==="true")return n;n=n.parentElement}return null}applyFallback(t,n){const r=this.findChoiceContainer(n);r&&(r.classList.add(m.FALLBACK_CLASS),r.setAttribute(m.ELIMINATED_ATTR,"true"),r.setAttribute(m.ELIMINATED_ID_ATTR,t),this.fallbackContainers.set(t,r),this.addAriaAttributes(n))}removeFallback(t){const n=this.fallbackContainers.get(t);if(!n)return;n.classList.remove(m.FALLBACK_CLASS),n.removeAttribute(m.ELIMINATED_ATTR),n.removeAttribute(m.ELIMINATED_ID_ATTR);const r=document.createRange();r.selectNodeContents(n),this.removeAriaAttributes(r),this.fallbackContainers.delete(t)}strikeImages(t,n){const r=this.resolveImageScope(n);if(!r)return;const i=[];for(const s of Array.from(r.querySelectorAll("img"))){const o=this.wrapImage(s);o&&i.push(o)}i.length>0&&this.imageWrappers.set(t,i)}unstrikeImages(t){const n=this.imageWrappers.get(t);if(n){for(const r of n)this.unwrapImage(r);this.imageWrappers.delete(t)}}strikeMath(t,n){const r=this.resolveImageScope(n);if(!r)return;const i=[];for(const s of r.querySelectorAll(m.MATH_SELECTOR)){const o=s.querySelector(m.MATH_BOX_SELECTOR)??s,l=!!o.querySelector(m.MATH_STACKED_SELECTOR);o.classList.add(m.MATH_STRIKE_CLASS,l?m.MATH_STRIKE_CROSS_CLASS:m.MATH_STRIKE_LINE_CLASS),o.setAttribute(m.MATH_STRIKE_ATTR,l?"cross":"line"),i.push(o)}i.length>0&&this.mathTargets.set(t,i)}unstrikeMath(t){const n=this.mathTargets.get(t);if(n){for(const r of n)r.classList.remove(m.MATH_STRIKE_CLASS,m.MATH_STRIKE_LINE_CLASS,m.MATH_STRIKE_CROSS_CLASS),r.removeAttribute(m.MATH_STRIKE_ATTR);this.mathTargets.delete(t)}}resolveImageScope(t){const n=t.commonAncestorContainer;return(n.nodeType===Node.TEXT_NODE?n.parentElement:n)??this.findChoiceContainer(t)}wrapImage(t){const n=t.parentElement;if(!n)return null;if(n.classList.contains(m.IMAGE_WRAPPER_CLASS)||n.hasAttribute(m.IMAGE_WRAPPER_ATTR))return n;const r=document.createElement("span");return r.className=m.IMAGE_WRAPPER_CLASS,r.setAttribute(m.IMAGE_WRAPPER_ATTR,"true"),this.fillsParentWidth(t,n)?r.style.display="block":m.BLOCK_DISPLAYS.has(getComputedStyle(t).display)&&(r.style.display="block",r.style.width="fit-content"),n.insertBefore(r,t),r.appendChild(t),r.appendChild(this.createImageStrikeOverlay()),r}fillsParentWidth(t,n){const r=t.getBoundingClientRect().width,i=n.clientWidth;return r===0||i===0?!1:r>=i-1}unwrapImage(t){t.querySelector(`.${m.IMAGE_OVERLAY_CLASS}`)?.remove();const n=t.parentElement;if(n){for(;t.firstChild;)n.insertBefore(t.firstChild,t);t.remove()}}createImageStrikeOverlay(){const t=document.createElementNS(m.SVG_NS,"svg");t.setAttribute("class",m.IMAGE_OVERLAY_CLASS),t.setAttribute("viewBox","0 0 100 100"),t.setAttribute("preserveAspectRatio","none"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false");const n=[{x1:"0",y1:"0",x2:"100",y2:"100"},{x1:"0",y1:"100",x2:"100",y2:"0"}];for(const r of[m.IMAGE_CASING_CLASS,m.IMAGE_LINE_CLASS])for(const{x1:i,y1:s,x2:o,y2:l}of n){const c=document.createElementNS(m.SVG_NS,"line");c.setAttribute("class",r),c.setAttribute("x1",i),c.setAttribute("y1",s),c.setAttribute("x2",o),c.setAttribute("y2",l),c.setAttribute("vector-effect","non-scaling-stroke"),t.appendChild(c)}return t}resolveLabelElement(t){return t.querySelector(`[${m.LABEL_HOOK_ATTR}="true"]`)||t.querySelector("label")}};u(k,"HIGHLIGHT_STYLE_PREFIX","pie-answer-eliminator-highlight-");u(k,"HIGHLIGHT_NAME_PREFIX","pie-answer-eliminated-");u(k,"FALLBACK_CLASS","pie-answer-eliminator-eliminated-fallback");u(k,"SR_CLASS","pie-answer-eliminator-sr-announcement");u(k,"CHOICE_HOOK_ATTR","data-pie-answer-eliminator-choice");u(k,"LABEL_HOOK_ATTR","data-pie-answer-eliminator-label");u(k,"ELIMINATED_ATTR","data-pie-answer-eliminated");u(k,"ELIMINATED_ID_ATTR","data-pie-answer-eliminated-id");u(k,"IMAGE_WRAPPER_CLASS","pie-answer-eliminator-image-strike");u(k,"IMAGE_WRAPPER_ATTR","data-pie-answer-eliminator-image-strike");u(k,"IMAGE_OVERLAY_CLASS","pie-answer-eliminator-image-strike-overlay");u(k,"IMAGE_LINE_CLASS","pie-answer-eliminator-image-strike-line");u(k,"IMAGE_CASING_CLASS","pie-answer-eliminator-image-strike-casing");u(k,"MATH_STRIKE_CLASS","pie-answer-eliminator-math-strike");u(k,"MATH_STRIKE_LINE_CLASS","pie-answer-eliminator-math-strike--line");u(k,"MATH_STRIKE_CROSS_CLASS","pie-answer-eliminator-math-strike--cross");u(k,"MATH_STRIKE_ATTR","data-pie-answer-eliminator-math-strike");u(k,"MATH_STACKED_SELECTOR","mjx-mfrac, mjx-mtable");u(k,"MATH_BOX_SELECTOR","mjx-math");u(k,"MATH_SELECTOR","mjx-container");u(k,"SVG_NS","http://www.w3.org/2000/svg");u(k,"BLOCK_DISPLAYS",new Set(["block","flex","grid","table","flow-root","list-item"]));var On="answerEliminator",un=class ge{constructor(t="strikethrough",n="right"){u(this,"strategy",void 0),u(this,"choices",new Map),u(this,"eliminated",new Set),u(this,"strategyKeys",new Map),u(this,"anonymousGroups",new WeakMap),u(this,"nextToken",0),u(this,"buttonAlignment","right"),u(this,"shouldRestoreState",!0),u(this,"active",!0),u(this,"questionRoot",null),u(this,"selectionChangeHandler",null),u(this,"selectionObserver",null),u(this,"selectionRefreshFrame",null),u(this,"focusedKey",null),u(this,"store",null),u(this,"elementStateKeys",{}),this.strategy=this.createStrategy(t),this.strategy.initialize(),this.buttonAlignment=n}createStrategy(t){return t==="mask"?new Ot:new k}initializeForQuestion(t){this.active=!0;const n=new Set(this.eliminated);this.restoreAllSelectable(),this.strategy.clearAll(),this.eliminated.clear(),this.cleanupButtons();for(const i of Mn(t))this.initializeChoice(i,t);const r=this.readPersistedEliminations();for(const[i,s]of this.choices)(r.has(s.group)?r.get(s.group)?.has(s.choiceId):n.has(i))&&this.applyElimination(i,s);this.attachSelectionListener(t)}trackingKey(t,n){return`${t}\0${n}`}resolveGroup({target:t,owner:n},r){let i=n;for(let l=n??t.container.parentElement;l!==null;l=l===r?null:l.parentElement){if(l.id&&Object.hasOwn(this.elementStateKeys,l.id))return l.id;i===null&&l.localName.includes("-")&&(i=l)}const s=i??r;let o=this.anonymousGroups.get(s);return o||(o=`\0anonymous-${this.nextToken++}`,this.anonymousGroups.set(s,o)),o}strategyKeyFor(t){let n=this.strategyKeys.get(t);return n||(n=`choice-${this.nextToken++}`,this.strategyKeys.set(t,n)),n}initializeChoice(t,n){const{target:r,owner:i}=t,s=r.id,o=this.resolveGroup(t,n),l=this.trackingKey(o,s),c={choiceId:s,group:o,strategyKey:this.strategyKeyFor(l),target:r,owner:i,button:null};this.choices.set(l,c);const h=this.createToggleButton(l,c,this.alignmentFor(r.container));c.button=h,this.updateButtonVisibility(l),r.container.style.position="relative",r.container.appendChild(h)}alignmentFor(t){return this.buttonAlignment==="inline"||getComputedStyle(t).display==="inline"?"inline":this.buttonAlignment}createToggleButton(t,n,r){const i=n.target.label,s=document.createElement("button");s.type="button",s.className=ge.TOGGLE_CLASS,s.setAttribute("aria-label",`Toggle elimination for ${i}`),s.setAttribute("aria-pressed","false"),s.setAttribute("data-choice-id",n.choiceId);const o=document.createElement("span");return o.setAttribute("aria-hidden","true"),o.textContent="⊗",s.appendChild(o),this.applyButtonAlignment(s,r),s.dataset.pieShownDisplay=s.style.display,s.addEventListener("click",l=>{l.preventDefault(),l.stopPropagation(),this.toggleElimination(t)}),s.addEventListener("focus",()=>{this.focusedKey=t}),s.addEventListener("blur",()=>{queueMicrotask(()=>{s.isConnected&&this.focusedKey===t&&(this.focusedKey=null)})}),s}toggleElimination(t){const n=this.choices.get(t);if(n){if(this.eliminated.has(t))this.restoreChoice(t);else{if(!n.target.canEliminate()){console.warn("Cannot eliminate this choice (already selected or in evaluate mode)");return}if(!this.applyElimination(t,n)){console.error("Failed to create range for choice");return}}this.saveState(n.group)}}applyElimination(t,n,r=!0){if(n.target.isSelected())return!1;const i=n.target.createRange();return i?(this.strategy.apply(n.strategyKey,i),this.eliminated.add(t),r&&n.target.setEliminated(!0),n.button&&(n.button.classList.add(ge.TOGGLE_ACTIVE_CLASS),n.button.setAttribute("aria-pressed","true")),this.updateButtonVisibility(t),!0):!1}restoreChoice(t){const n=this.choices.get(t);this.eliminated.delete(t),n&&(this.strategy.remove(n.strategyKey),n.target.setEliminated(!1),n.button&&(n.button.classList.remove(ge.TOGGLE_ACTIVE_CLASS),n.button.setAttribute("aria-pressed","false")),this.updateButtonVisibility(t))}resetAll(){if(this.eliminated.size===0)return;const t=new Set;for(const n of Array.from(this.eliminated)){const r=this.choices.get(n)?.group;r!==void 0&&t.add(r),this.restoreChoice(n)}for(const n of t)this.saveState(n)}getEliminatedCount(){return this.eliminated.size}setStoreIntegration(t,n){this.store=t,this.elementStateKeys=n}saveState(t){if(!this.store||!Object.hasOwn(this.elementStateKeys,t))return;const n=[];for(const r of this.eliminated){const i=this.choices.get(r);i?.group===t&&n.push(i.choiceId)}this.store.setState(this.elementStateKeys[t],On,{eliminatedChoices:n})}readPersistedEliminations(){const t=new Map;if(!this.store||!this.shouldRestoreState)return t;for(const{group:n}of this.choices.values())if(!(t.has(n)||!Object.hasOwn(this.elementStateKeys,n)))try{const r=this.store.getState(this.elementStateKeys[n],On),i=Array.isArray(r?.eliminatedChoices)?r.eliminatedChoices.filter(s=>typeof s=="string"):[];t.set(n,new Set(i))}catch(r){console.error("Failed to restore eliminator state:",r)}return t}restoreAllSelectable(){for(const t of this.eliminated)this.choices.get(t)?.target.setEliminated(!1)}setButtonHidden(t,n){const r=n?"none":t.dataset.pieShownDisplay??"";t.style.display!==r&&(t.style.display=r)}shouldHideButton(t,n){return this.eliminated.has(t)?!1:this.active?n.target.isSelected():!0}updateButtonVisibility(t){const n=this.choices.get(t);n?.button&&this.setButtonHidden(n.button,this.shouldHideButton(t,n))}refreshSelectionState(){for(const t of this.choices.keys())this.updateButtonVisibility(t)}hasDetachedChoice(){for(const{target:t}of this.choices.values())if(!t.container.isConnected)return!0;return!1}rescan(){const t=this.questionRoot;if(!t)return;const n=this.focusedKey!==null&&!this.choices.get(this.focusedKey)?.button?.isConnected&&(document.activeElement===null||document.activeElement===document.body)?this.focusedKey:null,r=this.choices,i=new Set(this.eliminated);this.strategy.clearAll(),this.eliminated.clear();for(const{button:s}of r.values())s?.remove();this.choices=new Map;for(const s of Mn(t))this.initializeChoice(s,t);for(const s of i){const o=r.get(s),l=this.choices.get(s),c=!!o?.owner&&l?.owner===o.owner;l&&this.applyElimination(s,l,!c)||(l??o)?.target.setEliminated(!1)}n&&this.choices.get(n)?.button?.focus({preventScroll:!0})}scheduleSelectionRefresh(){this.selectionRefreshFrame===null&&(this.selectionRefreshFrame=requestAnimationFrame(()=>{this.selectionRefreshFrame=null,this.refreshSelectionState()}))}attachSelectionListener(t){this.detachSelectionListener(),this.questionRoot=t,this.selectionChangeHandler=()=>this.scheduleSelectionRefresh(),t.addEventListener("change",this.selectionChangeHandler),typeof MutationObserver<"u"&&(this.selectionObserver=new MutationObserver(n=>{const r=new Set;for(const{button:i}of this.choices.values())i&&r.add(i);n.some(i=>!r.has(i.target))&&(this.hasDetachedChoice()?this.rescan():this.scheduleSelectionRefresh())}),this.selectionObserver.observe(t,{subtree:!0,childList:!0,attributes:!0}))}detachSelectionListener(){this.selectionRefreshFrame!==null&&(cancelAnimationFrame(this.selectionRefreshFrame),this.selectionRefreshFrame=null),this.selectionObserver&&(this.selectionObserver.disconnect(),this.selectionObserver=null),this.questionRoot&&this.selectionChangeHandler&&this.questionRoot.removeEventListener("change",this.selectionChangeHandler),this.questionRoot=null,this.selectionChangeHandler=null}cleanupButtons(){this.detachSelectionListener(),this.focusedKey=null;for(const{button:t}of this.choices.values())t?.remove();this.choices.clear()}applyButtonAlignment(t,n){switch(n){case"right":Object.assign(t.style,{position:"absolute",right:"8px",top:"50%",transform:"translateY(-50%)"});break;case"left":Object.assign(t.style,{position:"absolute",left:"8px",top:"50%",transform:"translateY(-50%)"});break;case"inline":Object.assign(t.style,{position:"relative",marginLeft:"8px",marginRight:"8px",display:"inline-flex",verticalAlign:"middle"})}}enableStateRestoration(){this.shouldRestoreState=!0}disableStateRestoration(){this.shouldRestoreState=!1}cleanup(){this.active=!1,this.refreshSelectionState()}destroy(){this.restoreAllSelectable(),this.eliminated.clear(),this.cleanupButtons(),this.strategy.destroy()}};u(un,"TOGGLE_CLASS","pie-answer-eliminator-toggle");u(un,"TOGGLE_ACTIVE_CLASS","pie-answer-eliminator-toggle--active");var $s=Vi('<div style="display: none;" aria-hidden="true"></div>');function Ts(e,t){qn(t,!0);let n=Xt(t,"visible",7,!1),r=Xt(t,"strategy",7,"strikethrough"),i=Xt(t,"alwaysOn",7,!1),s=Xt(t,"buttonAlignment",7,"right"),o=Xt(t,"elementStateKeys",23,()=>({})),l=D(null),c=D(null),h=D(null);const f=mn(()=>A(c)?.elementToolStateStore??null);let d=D(null),y=D(null),b=mn(()=>i()||n());Ht(()=>{if(A(l))return Kr(A(l),g=>{O(c,g,!0)})}),Ht(()=>{if(A(l))return Nr(A(l),g=>{O(h,g,!0)})});function E(){return A(h)?.scopeElement||null}function $(){if(!A(b)||!A(d))return;const g=E();if(!g){console.warn("[AnswerEliminator] Missing shell scope context for question root");return}A(d).initializeForQuestion(g)}function z(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{$()})})}Ht(()=>{A(d)?.setStoreIntegration(A(f),o()??{})}),Ht(()=>{const g=new un(r(),s());return xe(()=>{g.setStoreIntegration(A(f),o()??{}),O(d,g,!0),A(b)?$():g.cleanup()}),()=>{g.destroy(),A(d)===g&&O(d,null)}}),Ht(()=>{const g=A(h)?.contextVersion??null;if(g!==null){if(A(y)===null){O(y,g,!0);return}g!==A(y)&&(O(y,g,!0),z())}}),Ht(()=>{A(d)&&(A(b)?(A(d).enableStateRestoration(),$()):A(d).cleanup())});var H={get visible(){return n()},set visible(g=!1){n(g),bt()},get strategy(){return r()},set strategy(g="strikethrough"){r(g),bt()},get alwaysOn(){return i()},set alwaysOn(g=!1){i(g),bt()},get buttonAlignment(){return s()},set buttonAlignment(g="right"){s(g),bt()},get elementStateKeys(){return o()},set elementStateKeys(g={}){o(g),bt()}},W=$s();return os(W,g=>O(l,g),()=>A(l)),wr(e,W),jn(H)}_s("pie-tool-answer-eliminator",fs(Ts,{visible:{attribute:"visible",type:"Boolean"},strategy:{attribute:"strategy",type:"String"},alwaysOn:{attribute:"always-on",type:"Boolean"},buttonAlignment:{attribute:"button-alignment",type:"String"},elementStateKeys:{type:"Object"}},[],[],{mode:"open"},Hr));function _s(e,t){customElements.get(e)||customElements.define(e,t)}export{Ts as default};