@triiiceratops/plugin-annotation-editor 1.0.0-rc.4 → 1.0.0-rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/iife.js CHANGED
@@ -1,7 +1,7 @@
1
1
  (function(){"use strict";function My(n,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in n)){const s=Object.getOwnPropertyDescriptor(i,r);s&&Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const Dy=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-.]+))?(?:\+[0-9A-Za-z-.]+)?$/;function Lo(n){const e=Dy.exec(n.trim());if(!e)return null;const[,t,i,r,s]=e,o=s?s.split(".").map(a=>/^\d+$/.test(a)?Number(a):a):[];return{major:Number(t),minor:Number(i),patch:Number(r),prerelease:o}}function Oy(n,e){return n.major-e.major||n.minor-e.minor||n.patch-e.patch}function By(n,e){if(n.prerelease.length===0&&e.prerelease.length===0)return 0;if(n.prerelease.length===0)return 1;if(e.prerelease.length===0)return-1;const t=Math.max(n.prerelease.length,e.prerelease.length);for(let i=0;i<t;i++){const r=n.prerelease[i],s=e.prerelease[i];if(r===void 0)return-1;if(s===void 0)return 1;if(r===s)continue;const o=typeof r=="number",a=typeof s=="number";return o&&a?r<s?-1:1:o?-1:a?1:String(r)<String(s)?-1:1}return 0}function Ly(n,e){return Oy(n,e)||By(n,e)}function Fy(n){return n.major>0?{major:n.major+1,minor:0,patch:0,prerelease:[]}:n.minor>0?{major:0,minor:n.minor+1,patch:0,prerelease:[]}:{major:0,minor:0,patch:n.patch+1,prerelease:[]}}function Ny(n){if(n===""||n==="*"||n==="x"||n==="X")return[];let e;if(e=/^\^\s*(.+)$/.exec(n)){const t=Lo(e[1]??"");return t?[{op:">=",ver:t},{op:"<",ver:Fy(t)}]:null}if(e=/^~\s*(.+)$/.exec(n)){const t=Lo(e[1]??"");return t?[{op:">=",ver:t},{op:"<",ver:{major:t.major,minor:t.minor+1,patch:0,prerelease:[]}}]:null}if(e=/^(>=|<=|>|<|=)?\s*(.+)$/.exec(n)){const t=Lo(e[2]??"");return t?[{op:e[1]??"=",ver:t}]:null}return null}function ky(n,e){const t=Ly(n,e.ver);switch(e.op){case"<":return t<0;case"<=":return t<=0;case">":return t>0;case">=":return t>=0;case"=":return t===0}}function Uy(n,e){const t=e.trim();if(t===""||t==="*"||t==="x")return!0;const i=t.split(/\s+/).filter(Boolean);for(const r of i){const s=Ny(r);if(s===null||!s.every(o=>ky(n,o)))return!1}return!0}function Lc(n,e){const t=Lo(n);if(!t)return!1;const i=e.split("||").map(r=>r.trim()).filter(r=>r.length>0);return i.length===0?!0:i.some(r=>Uy(t,r))}class Pl extends Error{code="PLUGIN_INCOMPATIBLE";pluginName;pluginVersion;reasons;constructor(e,t,i){super(Hy(e,t,i)),this.name="PluginCompatibilityError",this.pluginName=e,this.pluginVersion=t,this.reasons=i,Object.setPrototypeOf(this,Pl.prototype)}}function Hy(n,e,t){const i=t.map(r=>` - ${r.message}`).join(`
2
2
  `);return`Plugin "${n}"@${e} cannot activate — incompatible with this viewer:
3
3
  ${i}
4
- Update the plugin or the core viewer so their declared ranges and capabilities overlap.`}function zy(n,e){const t=[];Lc(e.coreVersion,n.coreRange)||t.push({kind:"core",required:n.coreRange,actual:e.coreVersion,message:`requires core ${n.coreRange} but this viewer is core ${e.coreVersion}`}),Lc(e.pluginApiVersion,n.pluginApiRange)||t.push({kind:"pluginApi",required:n.pluginApiRange,actual:e.pluginApiVersion,message:`requires plugin API ${n.pluginApiRange} but this viewer provides plugin API ${e.pluginApiVersion}`});const i=new Set(e.capabilities);for(const r of n.requiredCapabilities)i.has(r)||t.push({kind:"capability",required:r,actual:e.capabilities.join(", ")||"(none)",message:`requires capability "${r}" which this viewer does not provide (has: ${e.capabilities.join(", ")||"none"})`});return t}function Gy(n,e){const t=zy(n,e);if(t.length>0)throw new Pl(n.name,n.version,t)}function Vy(n,e={}){let t=0,i=!1;const r=new Set,s=n.subscribe(()=>{t++;for(const a of[...r])a()},e.onListenerError);return{selectors:{select(a,l=Object.is){let h=-1,u;const c=()=>(h!==t&&(u=a(n),h=t),u);return{get:c,subscribe(d){if(i)return()=>{};let f=c();const p=()=>{let g;try{g=c()}catch(m){e.onProjectionError?.(m);return}l(f,g)||(f=g,d(g))};return r.add(p),()=>{r.delete(p)}}}}},dispose(){i||(i=!0,r.clear(),s())}}}const Fr=()=>{};function Wy(){return{install(n,e){return Fr}}}function jy(){return{current:"en",t(n,e){return n},subscribe(n){return Fr}}}function Xy(){return{renderIcon(n,e){return Fr}}}function Yy(n){return{id:n??"",isOpen:!0,target:"panel",open:Fr,close:Fr,toggle:Fr}}function qy(n){const e=new Set;return{service:{install(t,i){const r=n.install(t,i);let s=!1;const o=()=>{s||(s=!0,e.delete(o),r())};return e.add(o),o}},releaseAll(){for(const t of[...e])t();e.clear()}}}function Zy(n){const e=new Set;return{service:{get current(){return n.current},t(t,i){return n.t(t,i)},subscribe(t){const i=n.subscribe(t);let r=!1;const s=()=>{r||(r=!0,e.delete(s),i())};return e.add(s),s}},releaseAll(){for(const t of[...e])t();e.clear()}}}const Ky={deactivate(){}};function Qy(n,e){const t=e.reportError;let i,r,s,o;try{Gy(n,e),i=Vy(e.viewerState,{onProjectionError:t?d=>t({phase:"command",error:d}):void 0,onListenerError:t?d=>t({phase:"subscription",error:d}):void 0}),r=qy(e.styles??Wy()),s=Zy(e.locale??jy()),o={viewerState:e.viewerState,selectors:i.selectors,surface:e.surface??Yy(n.uiId??n.name),styles:r.service,locale:s.service,ui:e.ui??Xy()}}catch(d){if(i?.dispose(),r?.releaseAll(),s?.releaseAll(),t)return t({phase:"setup",error:d}),Ky;throw d}const a=[],l=r,h=s,u=i;try{const d=n.view.mount(e.container,o);typeof d=="function"&&a.push(d)}catch(d){if(!t)throw l.releaseAll(),h.releaseAll(),u.dispose(),d;t({phase:"mount",error:d})}a.push(()=>l.releaseAll()),a.push(()=>h.releaseAll()),a.push(()=>u.dispose());let c=!1;return{deactivate(){if(!c){c=!0;for(let d=a.length-1;d>=0;d--)try{a[d]?.()}catch(f){t?t({phase:"cleanup",error:f}):console.error(`[triiiceratops] Plugin "${n.name}" cleanup threw during deactivation; teardown continues.`,f)}a.length=0}}}}const Jy="triiiceratops-plugin";function $y(n){const e={name:n.name,uiId:n.uiId,version:n.version,coreRange:n.coreRange,pluginApiRange:n.pluginApiRange,requiredCapabilities:n.requiredCapabilities??[],icon:n.icon,target:n.target??"panel",dismiss:n.dismiss,catalog:n.catalog,view:n.view};return{kind:Jy,...e,activate(t){return Qy(e,t)}}}class e_ extends Error{name="SvgIconError";constructor(e){super(`svgIcon: ${e}`)}}const t_="0 0 24 24";function er(n,e){if(!n)throw new e_(e)}const i_=/<svg\b[^>]*>/i;function n_(n){er(typeof n=="string","expected an SVG string.");const e=n.trim();er(e.length>0,"received an empty string.");const t=i_.exec(e);er(t!==null,"the markup must contain an <svg> root element."),er(!/<script[\s/>]/i.test(e),"<script> elements are not allowed in plugin icons."),er(!/<foreignObject[\s/>]/i.test(e),"<foreignObject> is not allowed in plugin icons."),er(!/\son[a-z]+\s*=/i.test(e),"on* event-handler attributes (e.g. onload, onclick) are not allowed in plugin icons.");for(const a of e.matchAll(/(?:xlink:)?href\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/gi)){const l=(a[1]??a[2]??a[3]??"").trim();er(l.startsWith("#"),`external href/xlink:href URLs are not allowed in plugin icons (found "${l}"); only internal "#id" references are.`)}const i=t[0],r=/\bviewBox\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(i);let s=(r?.[1]??r?.[2])?.trim();if(!s){const a=/\bwidth\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(i),l=/\bheight\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(i),h=parseFloat(a?.[1]??a?.[2]??""),u=parseFloat(l?.[1]??l?.[2]??"");s=Number.isFinite(h)&&Number.isFinite(u)?`0 0 ${h} ${u}`:t_}let o="";if(!/\/\s*>$/.test(i)){const a=t.index+i.length,l=e.lastIndexOf("</svg>");o=(l>=a?e.slice(a,l):e.slice(a)).trim()}return{kind:"svg",inner:o,viewBox:s}}function r_(n,e){return{STYLES:n,STYLE_ID:e}}const Fc={en:{annotation_editor_title:"Annotation Editor",annotation_editor_edit_mode:"Edit",annotation_editor_create_mode:"Create",annotation_editor_instruction_create:"Click to start annotating, click again to set shape",annotation_editor_instruction_edit:"Click on an annotation to select and edit it",annotation_editor_tool_label:"Drawing Tool",annotation_editor_undo:"Undo",annotation_editor_redo:"Redo",annotation_editor_edit_section:"Edit Annotation",annotation_editor_delete_tooltip:"Delete annotation",annotation_editor_tag_placeholder:"Tag value...",annotation_editor_link_placeholder:"https://...",annotation_editor_text_placeholder:"Enter text...",annotation_editor_add_content:"Add Content",annotation_editor_unknown_body_note:"This structured body is shown read-only and will be preserved when you save.",annotation_editor_hydrating:"Loading the full annotation text...",annotation_editor_save:"Save Changes",annotation_editor_delete_title:"Delete Annotation?",annotation_editor_delete_message:"Are you sure you want to delete this annotation? This action cannot be undone.",annotation_editor_cancel:"Cancel",annotation_editor_delete:"Delete",annotation_editor_error_load:"Couldn't load annotations. Please try again.",annotation_editor_error_create:"Couldn't save the new annotation. Please try again.",annotation_editor_error_update:"Couldn't save your changes. Please try again.",annotation_editor_error_delete:"Couldn't delete the annotation. Please try again.",annotation_editor_error_hydrate:"Couldn't load the full annotation. Please try again.",annotation_editor_error_dismiss:"Dismiss",annotation_tool_rectangle:"Rectangle",annotation_tool_polygon:"Polygon",annotation_tool_point:"Point"},de:{annotation_editor_title:"Anmerkungs-Editor",annotation_editor_edit_mode:"Bearbeiten",annotation_editor_create_mode:"Erstellen",annotation_editor_instruction_create:"Klicken zum Annotieren, erneut klicken zum Abschließen",annotation_editor_instruction_edit:"Anmerkung klicken zum Bearbeiten",annotation_editor_tool_label:"Zeichenwerkzeug",annotation_editor_undo:"Rückgängig",annotation_editor_redo:"Wiederholen",annotation_editor_edit_section:"Anmerkung bearbeiten",annotation_editor_delete_tooltip:"Anmerkung löschen",annotation_editor_tag_placeholder:"Tag eingeben...",annotation_editor_link_placeholder:"https://...",annotation_editor_text_placeholder:"Text eingeben...",annotation_editor_add_content:"Inhalt hinzufügen",annotation_editor_unknown_body_note:"Dieser strukturierte Inhalt wird schreibgeschützt angezeigt und beim Speichern beibehalten.",annotation_editor_hydrating:"Vollständiger Anmerkungstext wird geladen...",annotation_editor_save:"Speichern",annotation_editor_delete_title:"Anmerkung löschen?",annotation_editor_delete_message:"Anmerkung wirklich löschen? Dies kann nicht rückgängig gemacht werden.",annotation_editor_cancel:"Abbrechen",annotation_editor_delete:"Löschen",annotation_editor_error_load:"Anmerkungen konnten nicht geladen werden. Bitte erneut versuchen.",annotation_editor_error_create:"Neue Anmerkung konnte nicht gespeichert werden. Bitte erneut versuchen.",annotation_editor_error_update:"Änderungen konnten nicht gespeichert werden. Bitte erneut versuchen.",annotation_editor_error_delete:"Anmerkung konnte nicht gelöscht werden. Bitte erneut versuchen.",annotation_editor_error_hydrate:"Vollständige Anmerkung konnte nicht geladen werden. Bitte erneut versuchen.",annotation_editor_error_dismiss:"Schließen",annotation_tool_rectangle:"Rechteck",annotation_tool_polygon:"Polygon",annotation_tool_point:"Punkt"}},Il="0 0 256 256",Ml={PencilSimple:'<path d="M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"/>',Warning:'<path d="M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"/>',X:'<path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"/>',Rectangle:'<path d="M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,160H40V56H216V200Z"/>',Polygon:'<path d="M230.64,49.36a32,32,0,0,0-45.26,0h0a31.9,31.9,0,0,0-5.16,6.76L152,48.42A32,32,0,0,0,97.37,25.36h0a32.06,32.06,0,0,0-5.76,37.41L57.67,93.32a32.05,32.05,0,0,0-40.31,4.05h0a32,32,0,0,0,42.89,47.41l70,51.36a32,32,0,1,0,47.57-14.69l27.39-77.59q1.38.12,2.76.12a32,32,0,0,0,22.63-54.62Zm-122-12.69h0a16,16,0,1,1,0,22.64A16,16,0,0,1,108.68,36.67Zm-80,94.65a16,16,0,0,1,0-22.64h0a16,16,0,1,1,0,22.64Zm142.65,88a16,16,0,0,1-22.63-22.63h0a16,16,0,1,1,22.63,22.63Zm-8.55-43.18a32,32,0,0,0-23,7.08l-70-51.36a32.17,32.17,0,0,0-1.34-26.65l33.95-30.55a32,32,0,0,0,45.47-10.81L176,71.56a32,32,0,0,0,14.12,27Zm56.56-92.84A16,16,0,1,1,196.7,60.68h0a16,16,0,0,1,22.63,22.63Z"/>',Target:'<path d="M221.87,83.16A104.1,104.1,0,1,1,195.67,49l22.67-22.68a8,8,0,0,1,11.32,11.32l-96,96a8,8,0,0,1-11.32-11.32l27.72-27.72a40,40,0,1,0,17.87,31.09,8,8,0,1,1,16-.9,56,56,0,1,1-22.38-41.65L184.3,60.39a87.88,87.88,0,1,0,23.13,29.67,8,8,0,0,1,14.44-6.9Z"/>',ArrowCounterClockwise:'<path d="M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"/>',ArrowClockwise:'<path d="M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"/>',Trash:'<path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"/>',Plus:'<path d="M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"/>',Check:'<path d="M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"/>'},s_=n_(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Il}">${Ml.PencilSimple}</svg>`),o_=1,a_=2,Nc=4,l_=8,h_=16,u_=1,c_=4,d_=8,f_=16,p_=1,g_=2,Dt=Symbol(),m_="http://www.w3.org/1999/xhtml",v_="@attach",Dl=!1;var Ol=Array.isArray,y_=Array.prototype.indexOf,Fo=Array.from,__=Object.defineProperty,Nr=Object.getOwnPropertyDescriptor,x_=Object.getOwnPropertyDescriptors,w_=Object.prototype,T_=Array.prototype,kc=Object.getPrototypeOf,Uc=Object.isExtensible;const tr=()=>{};function E_(n){for(var e=0;e<n.length;e++)n[e]()}function Hc(){var n,e,t=new Promise((i,r)=>{n=i,e=r});return{promise:t,resolve:n,reject:e}}const Ot=2,Bl=4,Ll=8,zc=1<<24,un=16,cn=32,Cn=64,No=128,Pi=512,Wt=1024,ri=2048,dn=4096,hi=8192,fn=16384,Fl=32768,Pn=65536,Gc=1<<17,Vc=1<<18,ir=1<<19,b_=1<<20,pn=1<<25,nr=32768,Nl=1<<21,kl=1<<22,In=1<<23,rr=Symbol("$state"),S_=Symbol("legacy props"),A_=Symbol(""),kr=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"};function Ul(n){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function R_(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function C_(n){throw new Error("https://svelte.dev/e/effect_in_teardown")}function P_(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function I_(n){throw new Error("https://svelte.dev/e/effect_orphan")}function M_(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function D_(n){throw new Error("https://svelte.dev/e/props_invalid_value")}function O_(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function B_(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function L_(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function F_(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function N_(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function k_(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Wc(n){return n===this.v}function U_(n,e){return n!=n?e==e:n!==e||n!==null&&typeof n=="object"||typeof n=="function"}function jc(n){return!U_(n,this.v)}let H_=!1,Bt=null;function Ur(n){Bt=n}function Xc(n){return z_().get(n)}function Hr(n,e=!1,t){Bt={p:Bt,i:!1,c:null,e:null,s:n,x:null,l:null}}function zr(n){var e=Bt,t=e.e;if(t!==null){e.e=null;for(var i of t)gd(i)}return e.i=!0,Bt=e.p,{}}function Yc(){return!0}function z_(n){return Bt===null&&Ul(),Bt.c??=new Map(G_(Bt)||void 0)}function G_(n){let e=n.p;for(;e!==null;){const t=e.c;if(t!==null)return t;e=e.p}return null}let sr=[];function qc(){var n=sr;sr=[],E_(n)}function or(n){if(sr.length===0&&!ks){var e=sr;queueMicrotask(()=>{e===sr&&qc()})}sr.push(n)}function V_(){for(;sr.length>0;)qc()}function Zc(n){var e=it;if(e===null)return Ke.f|=In,n;if((e.f&Fl)===0){if((e.f&No)===0)throw n;e.b.error(n)}else Gr(n,e)}function Gr(n,e){for(;e!==null;){if((e.f&No)!==0)try{e.b.error(n);return}catch(t){n=t}e=e.parent}throw n}const ko=new Set;let Je=null,Ns=null,vi=null,yi=[],Uo=null,Hl=!1,ks=!1;class Ii{committed=!1;current=new Map;previous=new Map;#e=new Set;#t=new Set;#i=0;#n=0;#r=null;#s=[];#o=[];skipped_effects=new Set;is_fork=!1;is_deferred(){return this.is_fork||this.#n>0}process(e){yi=[],Ns=null,this.apply();var t={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const i of e)this.#a(i,t);this.is_fork||this.#u(),this.is_deferred()?(this.#l(t.effects),this.#l(t.render_effects),this.#l(t.block_effects)):(Ns=this,Je=null,Qc(t.render_effects),Qc(t.effects),Ns=null,this.#r?.resolve()),vi=null}#a(e,t){e.f^=Wt;for(var i=e.first;i!==null;){var r=i.f,s=(r&(cn|Cn))!==0,o=s&&(r&Wt)!==0,a=o||(r&hi)!==0||this.skipped_effects.has(i);if((i.f&No)!==0&&i.b?.is_pending()&&(t={parent:t,effect:i,effects:[],render_effects:[],block_effects:[]}),!a&&i.fn!==null){s?i.f^=Wt:(r&Bl)!==0?t.effects.push(i):Vs(i)&&((i.f&un)!==0&&t.block_effects.push(i),Ws(i));var l=i.first;if(l!==null){i=l;continue}}var h=i.parent;for(i=i.next;i===null&&h!==null;)h===t.effect&&(this.#l(t.effects),this.#l(t.render_effects),this.#l(t.block_effects),t=t.parent),i=h.next,h=h.parent}}#l(e){for(const t of e)((t.f&ri)!==0?this.#s:this.#o).push(t),this.#h(t.deps),jt(t,Wt)}#h(e){if(e!==null)for(const t of e)(t.f&Ot)===0||(t.f&nr)===0||(t.f^=nr,this.#h(t.deps))}capture(e,t){this.previous.has(e)||this.previous.set(e,t),(e.f&In)===0&&(this.current.set(e,e.v),vi?.set(e,e.v))}activate(){Je=this,this.apply()}deactivate(){Je===this&&(Je=null,vi=null)}flush(){if(this.activate(),yi.length>0){if(Kc(),Je!==null&&Je!==this)return}else this.#i===0&&this.process([]);this.deactivate()}discard(){for(const e of this.#t)e(this);this.#t.clear()}#u(){if(this.#n===0){for(const e of this.#e)e();this.#e.clear()}this.#i===0&&this.#c()}#c(){if(ko.size>1){this.previous.clear();var e=vi,t=!0,i={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const s of ko){if(s===this){t=!1;continue}const o=[];for(const[l,h]of this.current){if(s.current.has(l))if(t&&h!==s.current.get(l))s.current.set(l,h);else continue;o.push(l)}if(o.length===0)continue;const a=[...s.current.keys()].filter(l=>!this.current.has(l));if(a.length>0){var r=yi;yi=[];const l=new Set,h=new Map;for(const u of o)Jc(u,a,l,h);if(yi.length>0){Je=s,s.apply();for(const u of yi)s.#a(u,i);s.deactivate()}yi=r}}Je=null,vi=e}this.committed=!0,ko.delete(this)}increment(e){this.#i+=1,e&&(this.#n+=1)}decrement(e){this.#i-=1,e&&(this.#n-=1),this.revive()}revive(){for(const e of this.#s)jt(e,ri),ar(e);for(const e of this.#o)jt(e,dn),ar(e);this.#s=[],this.#o=[],this.flush()}oncommit(e){this.#e.add(e)}ondiscard(e){this.#t.add(e)}settled(){return(this.#r??=Hc()).promise}static ensure(){if(Je===null){const e=Je=new Ii;ko.add(Je),ks||Ii.enqueue(()=>{Je===e&&e.flush()})}return Je}static enqueue(e){or(e)}apply(){}}function W_(n){var e=ks;ks=!0;try{for(var t;;){if(V_(),yi.length===0&&(Je?.flush(),yi.length===0))return Uo=null,t;Kc()}}finally{ks=e}}function Kc(){var n=hr;Hl=!0;var e=null;try{var t=0;for(Wo(!0);yi.length>0;){var i=Ii.ensure();if(t++>1e3){var r,s;j_()}i.process(yi),Mn.clear()}}finally{Hl=!1,Wo(n),Uo=null}}function j_(){try{M_()}catch(n){Gr(n,Uo)}}let gn=null;function Qc(n){var e=n.length;if(e!==0){for(var t=0;t<e;){var i=n[t++];if((i.f&(fn|hi))===0&&Vs(i)&&(gn=new Set,Ws(i),i.deps===null&&i.first===null&&i.nodes===null&&(i.teardown===null&&i.ac===null?xd(i):i.fn=null),gn?.size>0)){Mn.clear();for(const r of gn){if((r.f&(fn|hi))!==0)continue;const s=[r];let o=r.parent;for(;o!==null;)gn.has(o)&&(gn.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){const l=s[a];(l.f&(fn|hi))===0&&Ws(l)}}gn.clear()}}gn=null}}function Jc(n,e,t,i){if(!t.has(n)&&(t.add(n),n.reactions!==null))for(const r of n.reactions){const s=r.f;(s&Ot)!==0?Jc(r,e,t,i):(s&(kl|un))!==0&&(s&ri)===0&&$c(r,e,i)&&(jt(r,ri),ar(r))}}function $c(n,e,t){const i=t.get(n);if(i!==void 0)return i;if(n.deps!==null)for(const r of n.deps){if(e.includes(r))return!0;if((r.f&Ot)!==0&&$c(r,e,t))return t.set(r,!0),!0}return t.set(n,!1),!1}function ar(n){for(var e=Uo=n;e.parent!==null;){e=e.parent;var t=e.f;if(Hl&&e===it&&(t&un)!==0&&(t&Vc)===0)return;if((t&(Cn|cn))!==0){if((t&Wt)===0)return;e.f^=Wt}}yi.push(e)}function X_(n){let e=0,t=mn(0),i;return()=>{Hs()&&(F(t),Vl(()=>(e===0&&(i=Dn(()=>n(()=>ui(t)))),e+=1,()=>{or(()=>{e-=1,e===0&&(i?.(),i=void 0,ui(t))})})))}}var Y_=Pn|ir|No;function q_(n,e,t){new Z_(n,e,t)}class Z_{parent;#e=!1;#t;#i=null;#n;#r;#s;#o=null;#a=null;#l=null;#h=null;#u=null;#c=0;#d=0;#p=!1;#f=null;#_=X_(()=>(this.#f=mn(this.#c),()=>{this.#f=null}));constructor(e,t,i){this.#t=e,this.#n=t,this.#r=i,this.parent=it.b,this.#e=!!this.#n.pending,this.#s=zs(()=>{it.b=this;{var r=this.#v();try{this.#o=si(()=>i(r))}catch(s){this.error(s)}this.#d>0?this.#m():this.#e=!1}return()=>{this.#u?.remove()}},Y_)}#x(){try{this.#o=si(()=>this.#r(this.#t))}catch(e){this.error(e)}this.#e=!1}#w(){const e=this.#n.pending;e&&(this.#a=si(()=>e(this.#t)),Ii.enqueue(()=>{var t=this.#v();this.#o=this.#g(()=>(Ii.ensure(),si(()=>this.#r(t)))),this.#d>0?this.#m():(lr(this.#a,()=>{this.#a=null}),this.#e=!1)}))}#v(){var e=this.#t;return this.#e&&(this.#u=vn(),this.#t.before(this.#u),e=this.#u),e}is_pending(){return this.#e||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#n.pending}#g(e){var t=it,i=Ke,r=Bt;qi(this.#s),oi(this.#s),Ur(this.#s.ctx);try{return e()}catch(s){return Zc(s),null}finally{qi(t),oi(i),Ur(r)}}#m(){const e=this.#n.pending;this.#o!==null&&(this.#h=document.createDocumentFragment(),this.#h.append(this.#u),Ed(this.#o,this.#h)),this.#a===null&&(this.#a=si(()=>e(this.#t)))}#y(e){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(e);return}this.#d+=e,this.#d===0&&(this.#e=!1,this.#a&&lr(this.#a,()=>{this.#a=null}),this.#h&&(this.#t.before(this.#h),this.#h=null))}update_pending_count(e){this.#y(e),this.#c+=e,this.#f&&Vr(this.#f,this.#c)}get_effect_pending(){return this.#_(),F(this.#f)}error(e){var t=this.#n.onerror;let i=this.#n.failed;if(this.#p||!t&&!i)throw e;this.#o&&(St(this.#o),this.#o=null),this.#a&&(St(this.#a),this.#a=null),this.#l&&(St(this.#l),this.#l=null);var r=!1,s=!1;const o=()=>{if(r){k_();return}r=!0,s&&F_(),Ii.ensure(),this.#c=0,this.#l!==null&&lr(this.#l,()=>{this.#l=null}),this.#e=this.has_pending_snippet(),this.#o=this.#g(()=>(this.#p=!1,si(()=>this.#r(this.#t)))),this.#d>0?this.#m():this.#e=!1};var a=Ke;try{oi(null),s=!0,t?.(e,o),s=!1}catch(l){Gr(l,this.#s&&this.#s.parent)}finally{oi(a)}i&&or(()=>{this.#l=this.#g(()=>{Ii.ensure(),this.#p=!0;try{return si(()=>{i(this.#t,()=>e,()=>o)})}catch(l){return Gr(l,this.#s.parent),null}finally{this.#p=!1}})})}}function ed(n,e,t,i){const r=zo;if(t.length===0&&n.length===0){i(e.map(r));return}var s=Je,o=it,a=K_();function l(){Promise.all(t.map(h=>Q_(h))).then(h=>{a();try{i([...e.map(r),...h])}catch(u){(o.f&fn)===0&&Gr(u,o)}s?.deactivate(),Ho()}).catch(h=>{Gr(h,o)})}n.length>0?Promise.all(n).then(()=>{a();try{return l()}finally{s?.deactivate(),Ho()}}):l()}function K_(){var n=it,e=Ke,t=Bt,i=Je;return function(s=!0){qi(n),oi(e),Ur(t),s&&i?.activate()}}function Ho(){qi(null),oi(null),Ur(null)}function zo(n){var e=Ot|ri,t=Ke!==null&&(Ke.f&Ot)!==0?Ke:null;return it!==null&&(it.f|=ir),{ctx:Bt,deps:null,effects:null,equals:Wc,f:e,fn:n,reactions:null,rv:0,v:Dt,wv:0,parent:t??it,ac:null}}function Q_(n,e){let t=it;t===null&&R_();var i=t.b,r=void 0,s=mn(Dt),o=!Ke,a=new Map;return c0(()=>{var l=Hc();r=l.promise;try{Promise.resolve(n()).then(l.resolve,l.reject).then(()=>{h===Je&&h.committed&&h.deactivate(),Ho()})}catch(d){l.reject(d),Ho()}var h=Je;if(o){var u=!i.is_pending();i.update_pending_count(1),h.increment(u),a.get(h)?.reject(kr),a.delete(h),a.set(h,l)}const c=(d,f=void 0)=>{if(h.activate(),f)f!==kr&&(s.f|=In,Vr(s,f));else{(s.f&In)!==0&&(s.f^=In),Vr(s,d);for(const[p,g]of a){if(a.delete(p),p===h)break;g.reject(kr)}}o&&(i.update_pending_count(-1),h.decrement(u))};l.promise.then(c,d=>c(null,d||"unknown"))}),pd(()=>{for(const l of a.values())l.reject(kr)}),new Promise(l=>{function h(u){function c(){u===r?l(s):h(r)}u.then(c,c)}h(r)})}function $e(n){const e=zo(n);return Sd(e),e}function td(n){const e=zo(n);return e.equals=jc,e}function id(n){var e=n.effects;if(e!==null){n.effects=null;for(var t=0;t<e.length;t+=1)St(e[t])}}function J_(n){for(var e=n.parent;e!==null;){if((e.f&Ot)===0)return(e.f&fn)===0?e:null;e=e.parent}return null}function zl(n){var e,t=it;qi(J_(n));try{n.f&=~nr,id(n),e=Id(n)}finally{qi(t)}return e}function nd(n){var e=zl(n);if(n.equals(e)||(Je?.is_fork||(n.v=e),n.wv=Cd()),!ur)if(vi!==null)(Hs()||Je?.is_fork)&&vi.set(n,e);else{var t=(n.f&Pi)===0?dn:Wt;jt(n,t)}}let Gl=new Set;const Mn=new Map;let rd=!1;function mn(n,e){var t={f:0,v:n,reactions:null,equals:Wc,rv:0,wv:0};return t}function Ge(n,e){const t=mn(n);return Sd(t),t}function $_(n,e=!1,t=!0){const i=mn(n);return e||(i.equals=jc),i}function _e(n,e,t=!1){Ke!==null&&(!Yi||(Ke.f&Gc)!==0)&&Yc()&&(Ke.f&(Ot|un|kl|Gc))!==0&&!yn?.includes(n)&&L_();let i=t?Wi(e):e;return Vr(n,i)}function Vr(n,e){if(!n.equals(e)){var t=n.v;ur?Mn.set(n,e):Mn.set(n,t),n.v=e;var i=Ii.ensure();i.capture(n,t),(n.f&Ot)!==0&&((n.f&ri)!==0&&zl(n),jt(n,(n.f&Pi)!==0?Wt:dn)),n.wv=Cd(),sd(n,ri),it!==null&&(it.f&Wt)!==0&&(it.f&(cn|Cn))===0&&(xi===null?f0([n]):xi.push(n)),!i.is_fork&&Gl.size>0&&!rd&&e0()}return e}function e0(){rd=!1;var n=hr;Wo(!0);const e=Array.from(Gl);try{for(const t of e)(t.f&Wt)!==0&&jt(t,dn),Vs(t)&&Ws(t)}finally{Wo(n)}Gl.clear()}function t0(n,e=1){var t=F(n),i=e===1?t++:t--;return _e(n,t),i}function ui(n){_e(n,n.v+1)}function sd(n,e){var t=n.reactions;if(t!==null)for(var i=t.length,r=0;r<i;r++){var s=t[r],o=s.f,a=(o&ri)===0;if(a&&jt(s,e),(o&Ot)!==0){var l=s;vi?.delete(l),(o&nr)===0&&(o&Pi&&(s.f|=nr),sd(l,dn))}else a&&((o&un)!==0&&gn!==null&&gn.add(s),ar(s))}}function Wi(n){if(typeof n!="object"||n===null||rr in n)return n;const e=kc(n);if(e!==w_&&e!==T_)return n;var t=new Map,i=Ol(n),r=Ge(0),s=Di,o=a=>{if(Di===s)return a();var l=Ke,h=Di;oi(null),Rd(s);var u=a();return oi(l),Rd(h),u};return i&&t.set("length",Ge(n.length)),new Proxy(n,{defineProperty(a,l,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&O_();var u=t.get(l);return u===void 0?u=o(()=>{var c=Ge(h.value);return t.set(l,c),c}):_e(u,h.value,!0),!0},deleteProperty(a,l){var h=t.get(l);if(h===void 0){if(l in a){const u=o(()=>Ge(Dt));t.set(l,u),ui(r)}}else _e(h,Dt),ui(r);return!0},get(a,l,h){if(l===rr)return n;var u=t.get(l),c=l in a;if(u===void 0&&(!c||Nr(a,l)?.writable)&&(u=o(()=>{var f=Wi(c?a[l]:Dt),p=Ge(f);return p}),t.set(l,u)),u!==void 0){var d=F(u);return d===Dt?void 0:d}return Reflect.get(a,l,h)},getOwnPropertyDescriptor(a,l){var h=Reflect.getOwnPropertyDescriptor(a,l);if(h&&"value"in h){var u=t.get(l);u&&(h.value=F(u))}else if(h===void 0){var c=t.get(l),d=c?.v;if(c!==void 0&&d!==Dt)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return h},has(a,l){if(l===rr)return!0;var h=t.get(l),u=h!==void 0&&h.v!==Dt||Reflect.has(a,l);if(h!==void 0||it!==null&&(!u||Nr(a,l)?.writable)){h===void 0&&(h=o(()=>{var d=u?Wi(a[l]):Dt,f=Ge(d);return f}),t.set(l,h));var c=F(h);if(c===Dt)return!1}return u},set(a,l,h,u){var c=t.get(l),d=l in a;if(i&&l==="length")for(var f=h;f<c.v;f+=1){var p=t.get(f+"");p!==void 0?_e(p,Dt):f in a&&(p=o(()=>Ge(Dt)),t.set(f+"",p))}if(c===void 0)(!d||Nr(a,l)?.writable)&&(c=o(()=>Ge(void 0)),_e(c,Wi(h)),t.set(l,c));else{d=c.v!==Dt;var g=o(()=>Wi(h));_e(c,g)}var m=Reflect.getOwnPropertyDescriptor(a,l);if(m?.set&&m.set.call(u,h),!d){if(i&&typeof l=="string"){var v=t.get("length"),_=Number(l);Number.isInteger(_)&&_>=v.v&&_e(v,_+1)}ui(r)}return!0},ownKeys(a){F(r);var l=Reflect.ownKeys(a).filter(c=>{var d=t.get(c);return d===void 0||d.v!==Dt});for(var[h,u]of t)u.v!==Dt&&!(h in a)&&l.push(h);return l},setPrototypeOf(){B_()}})}function od(n){try{if(n!==null&&typeof n=="object"&&rr in n)return n[rr]}catch{}return n}function i0(n,e){return Object.is(od(n),od(e))}var ad,ld,hd,ud;function n0(){if(ad===void 0){ad=window,ld=/Firefox/.test(navigator.userAgent);var n=Element.prototype,e=Node.prototype,t=Text.prototype;hd=Nr(e,"firstChild").get,ud=Nr(e,"nextSibling").get,Uc(n)&&(n.__click=void 0,n.__className=void 0,n.__attributes=null,n.__style=void 0,n.__e=void 0),Uc(t)&&(t.__t=void 0)}}function vn(n=""){return document.createTextNode(n)}function ji(n){return hd.call(n)}function Us(n){return ud.call(n)}function Ne(n,e){return ji(n)}function _i(n,e=!1){{var t=ji(n);return t instanceof Comment&&t.data===""?Us(t):t}}function Ze(n,e=1,t=!1){let i=n;for(;e--;)i=Us(i);return i}function r0(n){n.textContent=""}function cd(){return!1}function s0(n,e){if(e){const t=document.body;n.autofocus=!0,or(()=>{document.activeElement===t&&n.focus()})}}let dd=!1;function o0(){dd||(dd=!0,document.addEventListener("reset",n=>{Promise.resolve().then(()=>{if(!n.defaultPrevented)for(const e of n.target.elements)e.__on_r?.()})},{capture:!0}))}function Go(n){var e=Ke,t=it;oi(null),qi(null);try{return n()}finally{oi(e),qi(t)}}function fd(n,e,t,i=t){n.addEventListener(e,()=>Go(t));const r=n.__on_r;r?n.__on_r=()=>{r(),i(!0)}:n.__on_r=()=>i(!0),o0()}function a0(n){it===null&&(Ke===null&&I_(),P_()),ur&&C_()}function l0(n,e){var t=e.last;t===null?e.last=e.first=n:(t.next=n,n.prev=t,e.last=n)}function Mi(n,e,t){var i=it;i!==null&&(i.f&hi)!==0&&(n|=hi);var r={ctx:Bt,deps:null,nodes:null,f:n|ri|Pi,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(t)try{Ws(r),r.f|=Fl}catch(a){throw St(r),a}else e!==null&&ar(r);var s=r;if(t&&s.deps===null&&s.teardown===null&&s.nodes===null&&s.first===s.last&&(s.f&ir)===0&&(s=s.first,(n&un)!==0&&(n&Pn)!==0&&s!==null&&(s.f|=Pn)),s!==null&&(s.parent=i,i!==null&&l0(s,i),Ke!==null&&(Ke.f&Ot)!==0&&(n&Cn)===0)){var o=Ke;(o.effects??=[]).push(s)}return r}function Hs(){return Ke!==null&&!Yi}function pd(n){const e=Mi(Ll,null,!1);return jt(e,Wt),e.teardown=n,e}function Xi(n){a0();var e=it.f,t=!Ke&&(e&cn)!==0&&(e&Fl)===0;if(t){var i=Bt;(i.e??=[]).push(n)}else return gd(n)}function gd(n){return Mi(Bl|b_,n,!1)}function h0(n){Ii.ensure();const e=Mi(Cn|ir,n,!0);return()=>{St(e)}}function u0(n){Ii.ensure();const e=Mi(Cn|ir,n,!0);return(t={})=>new Promise(i=>{t.outro?lr(e,()=>{St(e),i(void 0)}):(St(e),i(void 0))})}function Vo(n){return Mi(Bl,n,!1)}function c0(n){return Mi(kl|ir,n,!0)}function Vl(n,e=0){return Mi(Ll|e,n,!0)}function st(n,e=[],t=[],i=[]){ed(i,e,t,r=>{Mi(Ll,()=>n(...r.map(F)),!0)})}function zs(n,e=0){var t=Mi(un|e,n,!0);return t}function md(n,e=0){var t=Mi(zc|e,n,!0);return t}function si(n){return Mi(cn|ir,n,!0)}function vd(n){var e=n.teardown;if(e!==null){const t=ur,i=Ke;bd(!0),oi(null);try{e.call(null)}finally{bd(t),oi(i)}}}function yd(n,e=!1){var t=n.first;for(n.first=n.last=null;t!==null;){const r=t.ac;r!==null&&Go(()=>{r.abort(kr)});var i=t.next;(t.f&Cn)!==0?t.parent=null:St(t,e),t=i}}function d0(n){for(var e=n.first;e!==null;){var t=e.next;(e.f&cn)===0&&St(e),e=t}}function St(n,e=!0){var t=!1;(e||(n.f&Vc)!==0)&&n.nodes!==null&&n.nodes.end!==null&&(_d(n.nodes.start,n.nodes.end),t=!0),yd(n,e&&!t),jo(n,0),jt(n,fn);var i=n.nodes&&n.nodes.t;if(i!==null)for(const s of i)s.stop();vd(n);var r=n.parent;r!==null&&r.first!==null&&xd(n),n.next=n.prev=n.teardown=n.ctx=n.deps=n.fn=n.nodes=n.ac=null}function _d(n,e){for(;n!==null;){var t=n===e?null:Us(n);n.remove(),n=t}}function xd(n){var e=n.parent,t=n.prev,i=n.next;t!==null&&(t.next=i),i!==null&&(i.prev=t),e!==null&&(e.first===n&&(e.first=i),e.last===n&&(e.last=t))}function lr(n,e,t=!0){var i=[];wd(n,i,!0);var r=()=>{t&&St(n),e&&e()},s=i.length;if(s>0){var o=()=>--s||r();for(var a of i)a.out(o)}else r()}function wd(n,e,t){if((n.f&hi)===0){n.f^=hi;var i=n.nodes&&n.nodes.t;if(i!==null)for(const a of i)(a.is_global||t)&&e.push(a);for(var r=n.first;r!==null;){var s=r.next,o=(r.f&Pn)!==0||(r.f&cn)!==0&&(n.f&un)!==0;wd(r,e,o?t:!1),r=s}}}function Wl(n){Td(n,!0)}function Td(n,e){if((n.f&hi)!==0){n.f^=hi,(n.f&Wt)===0&&(jt(n,ri),ar(n));for(var t=n.first;t!==null;){var i=t.next,r=(t.f&Pn)!==0||(t.f&cn)!==0;Td(t,r?e:!1),t=i}var s=n.nodes&&n.nodes.t;if(s!==null)for(const o of s)(o.is_global||e)&&o.in()}}function Ed(n,e){if(n.nodes)for(var t=n.nodes.start,i=n.nodes.end;t!==null;){var r=t===i?null:Us(t);e.append(t),t=r}}let hr=!1;function Wo(n){hr=n}let ur=!1;function bd(n){ur=n}let Ke=null,Yi=!1;function oi(n){Ke=n}let it=null;function qi(n){it=n}let yn=null;function Sd(n){Ke!==null&&(yn===null?yn=[n]:yn.push(n))}let Qt=null,ci=0,xi=null;function f0(n){xi=n}let Ad=1,Gs=0,Di=Gs;function Rd(n){Di=n}function Cd(){return++Ad}function Vs(n){var e=n.f;if((e&ri)!==0)return!0;if(e&Ot&&(n.f&=~nr),(e&dn)!==0){var t=n.deps;if(t!==null)for(var i=t.length,r=0;r<i;r++){var s=t[r];if(Vs(s)&&nd(s),s.wv>n.wv)return!0}(e&Pi)!==0&&vi===null&&jt(n,Wt)}return!1}function Pd(n,e,t=!0){var i=n.reactions;if(i!==null&&!yn?.includes(n))for(var r=0;r<i.length;r++){var s=i[r];(s.f&Ot)!==0?Pd(s,e,!1):e===s&&(t?jt(s,ri):(s.f&Wt)!==0&&jt(s,dn),ar(s))}}function Id(n){var e=Qt,t=ci,i=xi,r=Ke,s=yn,o=Bt,a=Yi,l=Di,h=n.f;Qt=null,ci=0,xi=null,Ke=(h&(cn|Cn))===0?n:null,yn=null,Ur(n.ctx),Yi=!1,Di=++Gs,n.ac!==null&&(Go(()=>{n.ac.abort(kr)}),n.ac=null);try{n.f|=Nl;var u=n.fn,c=u(),d=n.deps;if(Qt!==null){var f;if(jo(n,ci),d!==null&&ci>0)for(d.length=ci+Qt.length,f=0;f<Qt.length;f++)d[ci+f]=Qt[f];else n.deps=d=Qt;if(Hs()&&(n.f&Pi)!==0)for(f=ci;f<d.length;f++)(d[f].reactions??=[]).push(n)}else d!==null&&ci<d.length&&(jo(n,ci),d.length=ci);if(Yc()&&xi!==null&&!Yi&&d!==null&&(n.f&(Ot|dn|ri))===0)for(f=0;f<xi.length;f++)Pd(xi[f],n);return r!==null&&r!==n&&(Gs++,xi!==null&&(i===null?i=xi:i.push(...xi))),(n.f&In)!==0&&(n.f^=In),c}catch(p){return Zc(p)}finally{n.f^=Nl,Qt=e,ci=t,xi=i,Ke=r,yn=s,Ur(o),Yi=a,Di=l}}function p0(n,e){let t=e.reactions;if(t!==null){var i=y_.call(t,n);if(i!==-1){var r=t.length-1;r===0?t=e.reactions=null:(t[i]=t[r],t.pop())}}t===null&&(e.f&Ot)!==0&&(Qt===null||!Qt.includes(e))&&(jt(e,dn),(e.f&Pi)!==0&&(e.f^=Pi,e.f&=~nr),id(e),jo(e,0))}function jo(n,e){var t=n.deps;if(t!==null)for(var i=e;i<t.length;i++)p0(n,t[i])}function Ws(n){var e=n.f;if((e&fn)===0){jt(n,Wt);var t=it,i=hr;it=n,hr=!0;try{(e&(un|zc))!==0?d0(n):yd(n),vd(n);var r=Id(n);n.teardown=typeof r=="function"?r:null,n.wv=Ad;var s;Dl&&H_&&(n.f&ri)!==0&&n.deps}finally{hr=i,it=t}}}async function g0(){await Promise.resolve(),W_()}function F(n){var e=n.f,t=(e&Ot)!==0;if(Ke!==null&&!Yi){var i=it!==null&&(it.f&fn)!==0;if(!i&&!yn?.includes(n)){var r=Ke.deps;if((Ke.f&Nl)!==0)n.rv<Gs&&(n.rv=Gs,Qt===null&&r!==null&&r[ci]===n?ci++:Qt===null?Qt=[n]:Qt.includes(n)||Qt.push(n));else{(Ke.deps??=[]).push(n);var s=n.reactions;s===null?n.reactions=[Ke]:s.includes(Ke)||s.push(Ke)}}}if(ur){if(Mn.has(n))return Mn.get(n);if(t){var o=n,a=o.v;return((o.f&Wt)===0&&o.reactions!==null||Dd(o))&&(a=zl(o)),Mn.set(o,a),a}}else t&&(!vi?.has(n)||Je?.is_fork&&!Hs())&&(o=n,Vs(o)&&nd(o),hr&&Hs()&&(o.f&Pi)===0&&Md(o));if(vi?.has(n))return vi.get(n);if((n.f&In)!==0)throw n.v;return n.v}function Md(n){if(n.deps!==null){n.f^=Pi;for(const e of n.deps)(e.reactions??=[]).push(n),(e.f&Ot)!==0&&(e.f&Pi)===0&&Md(e)}}function Dd(n){if(n.v===Dt)return!0;if(n.deps===null)return!1;for(const e of n.deps)if(Mn.has(e)||(e.f&Ot)!==0&&Dd(e))return!0;return!1}function Dn(n){var e=Yi;try{return Yi=!0,n()}finally{Yi=e}}const m0=-7169;function jt(n,e){n.f=n.f&m0|e}const Od=new Set,jl=new Set;function v0(n,e,t,i={}){function r(s){if(i.capture||js.call(e,s),!s.cancelBubble)return Go(()=>t?.call(this,s))}return n.startsWith("pointer")||n.startsWith("touch")||n==="wheel"?or(()=>{e.addEventListener(n,r,i)}):e.addEventListener(n,r,i),r}function Xl(n){for(var e=0;e<n.length;e++)Od.add(n[e]);for(var t of jl)t(n)}let Bd=null;function js(n){var e=this,t=e.ownerDocument,i=n.type,r=n.composedPath?.()||[],s=r[0]||n.target;Bd=n;var o=0,a=Bd===n&&n.__root;if(a){var l=r.indexOf(a);if(l!==-1&&(e===document||e===window)){n.__root=e;return}var h=r.indexOf(e);if(h===-1)return;l<=h&&(o=l)}if(s=r[o]||n.target,s!==e){__(n,"currentTarget",{configurable:!0,get(){return s||t}});var u=Ke,c=it;oi(null),qi(null);try{for(var d,f=[];s!==null;){var p=s.assignedSlot||s.parentNode||s.host||null;try{var g=s["__"+i];g!=null&&(!s.disabled||n.target===s)&&g.call(s,n)}catch(m){d?f.push(m):d=m}if(n.cancelBubble||p===e||p===null)break;s=p}if(d){for(let m of f)queueMicrotask(()=>{throw m});throw d}}finally{n.__root=e,delete n.currentTarget,oi(u),qi(c)}}}function Yl(n){var e=document.createElement("template");return e.innerHTML=n.replaceAll("<!>","<!---->"),e.content}function Wr(n,e){var t=it;t.nodes===null&&(t.nodes={start:n,end:e,a:null,t:null})}function rt(n,e){var t=(e&p_)!==0,i=(e&g_)!==0,r,s=!n.startsWith("<!>");return()=>{r===void 0&&(r=Yl(s?n:"<!>"+n),t||(r=ji(r)));var o=i||ld?document.importNode(r,!0):r.cloneNode(!0);if(t){var a=ji(o),l=o.lastChild;Wr(a,l)}else Wr(o,o);return o}}function y0(n,e,t="svg"){var i=!n.startsWith("<!>"),r=`<${t}>${i?n:"<!>"+n}</${t}>`,s;return()=>{if(!s){var o=Yl(r),a=ji(o);s=ji(a)}var l=s.cloneNode(!0);return Wr(l,l),l}}function Ld(n,e){return y0(n,e,"svg")}function Xo(n=""){{var e=vn(n+"");return Wr(e,e),e}}function Xs(){var n=document.createDocumentFragment(),e=document.createComment(""),t=vn();return n.append(e,t),Wr(e,t),n}function Ve(n,e){n!==null&&n.before(e)}function _0(n){return n.endsWith("capture")&&n!=="gotpointercapture"&&n!=="lostpointercapture"}const x0=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function w0(n){return x0.includes(n)}const T0={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function E0(n){return n=n.toLowerCase(),T0[n]??n}const b0=["touchstart","touchmove"];function S0(n){return b0.includes(n)}function mt(n,e){var t=e==null?"":typeof e=="object"?e+"":e;t!==(n.__t??=n.nodeValue)&&(n.__t=t,n.nodeValue=t+"")}function A0(n,e){return R0(n,e)}const jr=new Map;function R0(n,{target:e,anchor:t,props:i={},events:r,context:s,intro:o=!0}){n0();var a=new Set,l=c=>{for(var d=0;d<c.length;d++){var f=c[d];if(!a.has(f)){a.add(f);var p=S0(f);e.addEventListener(f,js,{passive:p});var g=jr.get(f);g===void 0?(document.addEventListener(f,js,{passive:p}),jr.set(f,1)):jr.set(f,g+1)}}};l(Fo(Od)),jl.add(l);var h=void 0,u=u0(()=>{var c=t??e.appendChild(vn());return q_(c,{pending:()=>{}},d=>{if(s){Hr({});var f=Bt;f.c=s}r&&(i.$$events=r),h=n(d,i)||{},s&&zr()}),()=>{for(var d of a){e.removeEventListener(d,js);var f=jr.get(d);--f===0?(document.removeEventListener(d,js),jr.delete(d)):jr.set(d,f)}jl.delete(l),c!==t&&c.parentNode?.removeChild(c)}});return ql.set(h,u),h}let ql=new WeakMap;function C0(n,e){const t=ql.get(n);return t?(ql.delete(n),t(e)):Promise.resolve()}class Zl{anchor;#e=new Map;#t=new Map;#i=new Map;#n=new Set;#r=!0;constructor(e,t=!0){this.anchor=e,this.#r=t}#s=()=>{var e=Je;if(this.#e.has(e)){var t=this.#e.get(e),i=this.#t.get(t);if(i)Wl(i),this.#n.delete(t);else{var r=this.#i.get(t);r&&(this.#t.set(t,r.effect),this.#i.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),i=r.effect)}for(const[s,o]of this.#e){if(this.#e.delete(s),s===e)break;const a=this.#i.get(o);a&&(St(a.effect),this.#i.delete(o))}for(const[s,o]of this.#t){if(s===t||this.#n.has(s))continue;const a=()=>{if(Array.from(this.#e.values()).includes(s)){var h=document.createDocumentFragment();Ed(o,h),h.append(vn()),this.#i.set(s,{effect:o,fragment:h})}else St(o);this.#n.delete(s),this.#t.delete(s)};this.#r||!i?(this.#n.add(s),lr(o,a,!1)):a()}}};#o=e=>{this.#e.delete(e);const t=Array.from(this.#e.values());for(const[i,r]of this.#i)t.includes(i)||(St(r.effect),this.#i.delete(i))};ensure(e,t){var i=Je,r=cd();if(t&&!this.#t.has(e)&&!this.#i.has(e))if(r){var s=document.createDocumentFragment(),o=vn();s.append(o),this.#i.set(e,{effect:si(()=>t(o)),fragment:s})}else this.#t.set(e,si(()=>t(this.anchor)));if(this.#e.set(i,e),r){for(const[a,l]of this.#t)a===e?i.skipped_effects.delete(l):i.skipped_effects.add(l);for(const[a,l]of this.#i)a===e?i.skipped_effects.delete(l.effect):i.skipped_effects.add(l.effect);i.oncommit(this.#s),i.ondiscard(this.#o)}else this.#s()}}function Kl(n,e,...t){var i=new Zl(n);zs(()=>{const r=e()??null;i.ensure(r,r&&(s=>r(s,...t)))},Pn)}function Fd(n){Bt===null&&Ul(),Xi(()=>{const e=Dn(n);if(typeof e=="function")return e})}function P0(n){Bt===null&&Ul(),Fd(()=>()=>Dn(n))}function Xt(n,e,t=!1){var i=new Zl(n),r=t?Pn:0;function s(o,a){i.ensure(o,a)}zs(()=>{var o=!1;e((a,l=!0)=>{o=!0,s(l,a)}),o||s(!1,null)},r)}function I0(n,e){return e}function M0(n,e,t){for(var i=[],r=e.length,s,o=e.length,a=0;a<r;a++){let c=e[a];lr(c,()=>{if(s){if(s.pending.delete(c),s.done.add(c),s.pending.size===0){var d=n.outrogroups;Ql(Fo(s.done)),d.delete(s),d.size===0&&(n.outrogroups=null)}}else o-=1},!1)}if(o===0){var l=i.length===0&&t!==null;if(l){var h=t,u=h.parentNode;r0(u),u.append(h),n.items.clear()}Ql(e,!l)}else s={pending:new Set(e),done:new Set},(n.outrogroups??=new Set).add(s)}function Ql(n,e=!0){for(var t=0;t<n.length;t++)St(n[t],e)}var Nd;function Yo(n,e,t,i,r,s=null){var o=n,a=new Map,l=(e&Nc)!==0;if(l){var h=n;o=h.appendChild(vn())}var u=null,c=td(()=>{var v=t();return Ol(v)?v:v==null?[]:Fo(v)}),d,f=!0;function p(){m.fallback=u,D0(m,d,o,e,i),u!==null&&(d.length===0?(u.f&pn)===0?Wl(u):(u.f^=pn,Ys(u,null,o)):lr(u,()=>{u=null}))}var g=zs(()=>{d=F(c);for(var v=d.length,_=new Set,y=Je,w=cd(),R=0;R<v;R+=1){var D=d[R],C=i(D,R),O=f?null:a.get(C);O?(O.v&&Vr(O.v,D),O.i&&Vr(O.i,R),w&&y.skipped_effects.delete(O.e)):(O=O0(a,f?o:Nd??=vn(),D,C,R,r,e,t),f||(O.e.f|=pn),a.set(C,O)),_.add(C)}if(v===0&&s&&!u&&(f?u=si(()=>s(o)):(u=si(()=>s(Nd??=vn())),u.f|=pn)),!f)if(w){for(const[N,X]of a)_.has(N)||y.skipped_effects.add(X.e);y.oncommit(p),y.ondiscard(()=>{})}else p();F(c)}),m={effect:g,items:a,outrogroups:null,fallback:u};f=!1}function D0(n,e,t,i,r){var s=(i&l_)!==0,o=e.length,a=n.items,l=n.effect.first,h,u=null,c,d=[],f=[],p,g,m,v;if(s)for(v=0;v<o;v+=1)p=e[v],g=r(p,v),m=a.get(g).e,(m.f&pn)===0&&(m.nodes?.a?.measure(),(c??=new Set).add(m));for(v=0;v<o;v+=1){if(p=e[v],g=r(p,v),m=a.get(g).e,n.outrogroups!==null)for(const X of n.outrogroups)X.pending.delete(m),X.done.delete(m);if((m.f&pn)!==0)if(m.f^=pn,m===l)Ys(m,null,t);else{var _=u?u.next:l;m===n.effect.last&&(n.effect.last=m.prev),m.prev&&(m.prev.next=m.next),m.next&&(m.next.prev=m.prev),On(n,u,m),On(n,m,_),Ys(m,_,t),u=m,d=[],f=[],l=u.next;continue}if((m.f&hi)!==0&&(Wl(m),s&&(m.nodes?.a?.unfix(),(c??=new Set).delete(m))),m!==l){if(h!==void 0&&h.has(m)){if(d.length<f.length){var y=f[0],w;u=y.prev;var R=d[0],D=d[d.length-1];for(w=0;w<d.length;w+=1)Ys(d[w],y,t);for(w=0;w<f.length;w+=1)h.delete(f[w]);On(n,R.prev,D.next),On(n,u,R),On(n,D,y),l=y,u=D,v-=1,d=[],f=[]}else h.delete(m),Ys(m,l,t),On(n,m.prev,m.next),On(n,m,u===null?n.effect.first:u.next),On(n,u,m),u=m;continue}for(d=[],f=[];l!==null&&l!==m;)(h??=new Set).add(l),f.push(l),l=l.next;if(l===null)continue}(m.f&pn)===0&&d.push(m),u=m,l=m.next}if(n.outrogroups!==null){for(const X of n.outrogroups)X.pending.size===0&&(Ql(Fo(X.done)),n.outrogroups?.delete(X));n.outrogroups.size===0&&(n.outrogroups=null)}if(l!==null||h!==void 0){var C=[];if(h!==void 0)for(m of h)(m.f&hi)===0&&C.push(m);for(;l!==null;)(l.f&hi)===0&&l!==n.fallback&&C.push(l),l=l.next;var O=C.length;if(O>0){var N=(i&Nc)!==0&&o===0?t:null;if(s){for(v=0;v<O;v+=1)C[v].nodes?.a?.measure();for(v=0;v<O;v+=1)C[v].nodes?.a?.fix()}M0(n,C,N)}}s&&or(()=>{if(c!==void 0)for(m of c)m.nodes?.a?.apply()})}function O0(n,e,t,i,r,s,o,a){var l=(o&o_)!==0?(o&h_)===0?$_(t,!1,!1):mn(t):null,h=(o&a_)!==0?mn(r):null;return{v:l,i:h,e:si(()=>(s(e,l??t,h??r,a),()=>{n.delete(i)}))}}function Ys(n,e,t){if(n.nodes)for(var i=n.nodes.start,r=n.nodes.end,s=e&&(e.f&pn)===0?e.nodes.start:t;i!==null;){var o=Us(i);if(s.before(i),i===r)return;i=o}}function On(n,e,t){e===null?n.effect.first=t:e.next=t,t===null?n.effect.last=e:t.prev=e}function kd(n,e,t=!1,i=!1,r=!1){var s=n,o="";st(()=>{var a=it;if(o!==(o=e()??"")&&(a.nodes!==null&&(_d(a.nodes.start,a.nodes.end),a.nodes=null),o!=="")){var l=o+"";t?l=`<svg>${l}</svg>`:i&&(l=`<math>${l}</math>`);var h=Yl(l);if((t||i)&&(h=ji(h)),Wr(ji(h),h.lastChild),t||i)for(;ji(h);)s.before(ji(h));else s.before(h)}})}function B0(n,e,t){var i=new Zl(n);zs(()=>{var r=e()??null;i.ensure(r,r&&(s=>t(s,r)))},Pn)}function L0(n,e){var t=void 0,i;md(()=>{t!==(t=e())&&(i&&(St(i),i=null),t&&(i=si(()=>{Vo(()=>t(n))})))})}function Ud(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var r=n.length;for(e=0;e<r;e++)n[e]&&(t=Ud(n[e]))&&(i&&(i+=" "),i+=t)}else for(t in n)n[t]&&(i&&(i+=" "),i+=t);return i}function F0(){for(var n,e,t=0,i="",r=arguments.length;t<r;t++)(n=arguments[t])&&(e=Ud(n))&&(i&&(i+=" "),i+=e);return i}function N0(n){return typeof n=="object"?F0(n):n??""}const Hd=[...`
4
+ Update the plugin or the core viewer so their declared ranges and capabilities overlap.`}function zy(n,e){const t=[];Lc(e.coreVersion,n.coreRange)||t.push({kind:"core",required:n.coreRange,actual:e.coreVersion,message:`requires core ${n.coreRange} but this viewer is core ${e.coreVersion}`}),Lc(e.pluginApiVersion,n.pluginApiRange)||t.push({kind:"pluginApi",required:n.pluginApiRange,actual:e.pluginApiVersion,message:`requires plugin API ${n.pluginApiRange} but this viewer provides plugin API ${e.pluginApiVersion}`});const i=new Set(e.capabilities);for(const r of n.requiredCapabilities)i.has(r)||t.push({kind:"capability",required:r,actual:e.capabilities.join(", ")||"(none)",message:`requires capability "${r}" which this viewer does not provide (has: ${e.capabilities.join(", ")||"none"})`});return t}function Gy(n,e){const t=zy(n,e);if(t.length>0)throw new Pl(n.name,n.version,t)}function Vy(n,e={}){let t=0,i=!1;const r=new Set,s=n.subscribe(()=>{t++;for(const a of[...r])a()},e.onListenerError);return{selectors:{select(a,l=Object.is){let h=-1,u;const c=()=>(h!==t&&(u=a(n),h=t),u);return{get:c,subscribe(d){if(i)return()=>{};let f=c();const p=()=>{let g;try{g=c()}catch(m){e.onProjectionError?.(m);return}l(f,g)||(f=g,d(g))};return r.add(p),()=>{r.delete(p)}}}}},dispose(){i||(i=!0,r.clear(),s())}}}const Fr=()=>{};function Wy(){return{install(n,e){return Fr}}}function jy(){return{current:"en",t(n,e){return n},subscribe(n){return Fr}}}function Xy(){return{renderIcon(n,e){return Fr}}}function Yy(n){return{id:n??"",isOpen:!0,target:"panel",open:Fr,close:Fr,toggle:Fr}}function qy(n){const e=new Set;return{service:{install(t,i){const r=n.install(t,i);let s=!1;const o=()=>{s||(s=!0,e.delete(o),r())};return e.add(o),o}},releaseAll(){for(const t of[...e])t();e.clear()}}}function Zy(n){const e=new Set;return{service:{get current(){return n.current},t(t,i){return n.t(t,i)},subscribe(t){const i=n.subscribe(t);let r=!1;const s=()=>{r||(r=!0,e.delete(s),i())};return e.add(s),s}},releaseAll(){for(const t of[...e])t();e.clear()}}}const Ky={deactivate(){}};function Qy(n,e){const t=e.reportError;let i,r,s,o;try{Gy(n,e),i=Vy(e.viewerState,{onProjectionError:t?d=>t({phase:"command",error:d}):void 0,onListenerError:t?d=>t({phase:"subscription",error:d}):void 0}),r=qy(e.styles??Wy()),s=Zy(e.locale??jy()),o={viewerState:e.viewerState,selectors:i.selectors,surface:e.surface??Yy(n.uiId??n.name),styles:r.service,locale:s.service,ui:e.ui??Xy()}}catch(d){if(i?.dispose(),r?.releaseAll(),s?.releaseAll(),t)return t({phase:"setup",error:d}),Ky;throw d}const a=[],l=r,h=s,u=i;try{const d=n.view.mount(e.container,o);typeof d=="function"&&a.push(d)}catch(d){if(!t)throw l.releaseAll(),h.releaseAll(),u.dispose(),d;t({phase:"mount",error:d})}a.push(()=>l.releaseAll()),a.push(()=>h.releaseAll()),a.push(()=>u.dispose());let c=!1;return{deactivate(){if(!c){c=!0;for(let d=a.length-1;d>=0;d--)try{a[d]?.()}catch(f){t?t({phase:"cleanup",error:f}):console.error(`[triiiceratops] Plugin "${n.name}" cleanup threw during deactivation; teardown continues.`,f)}a.length=0}}}}const Jy="triiiceratops-plugin";function $y(n){const e={name:n.name,title:n.title,uiId:n.uiId,version:n.version,coreRange:n.coreRange,pluginApiRange:n.pluginApiRange,requiredCapabilities:n.requiredCapabilities??[],icon:n.icon,target:n.target??"panel",dismiss:n.dismiss,catalog:n.catalog,view:n.view};return{kind:Jy,...e,activate(t){return Qy(e,t)}}}class e_ extends Error{name="SvgIconError";constructor(e){super(`svgIcon: ${e}`)}}const t_="0 0 24 24";function er(n,e){if(!n)throw new e_(e)}const i_=/<svg\b[^>]*>/i;function n_(n){er(typeof n=="string","expected an SVG string.");const e=n.trim();er(e.length>0,"received an empty string.");const t=i_.exec(e);er(t!==null,"the markup must contain an <svg> root element."),er(!/<script[\s/>]/i.test(e),"<script> elements are not allowed in plugin icons."),er(!/<foreignObject[\s/>]/i.test(e),"<foreignObject> is not allowed in plugin icons."),er(!/\son[a-z]+\s*=/i.test(e),"on* event-handler attributes (e.g. onload, onclick) are not allowed in plugin icons.");for(const a of e.matchAll(/(?:xlink:)?href\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/gi)){const l=(a[1]??a[2]??a[3]??"").trim();er(l.startsWith("#"),`external href/xlink:href URLs are not allowed in plugin icons (found "${l}"); only internal "#id" references are.`)}const i=t[0],r=/\bviewBox\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(i);let s=(r?.[1]??r?.[2])?.trim();if(!s){const a=/\bwidth\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(i),l=/\bheight\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(i),h=parseFloat(a?.[1]??a?.[2]??""),u=parseFloat(l?.[1]??l?.[2]??"");s=Number.isFinite(h)&&Number.isFinite(u)?`0 0 ${h} ${u}`:t_}let o="";if(!/\/\s*>$/.test(i)){const a=t.index+i.length,l=e.lastIndexOf("</svg>");o=(l>=a?e.slice(a,l):e.slice(a)).trim()}return{kind:"svg",inner:o,viewBox:s}}function r_(n,e){return{STYLES:n,STYLE_ID:e}}const Fc={en:{annotation_editor_title:"Annotation Editor",annotation_editor_edit_mode:"Edit",annotation_editor_create_mode:"Create",annotation_editor_instruction_create:"Click to start annotating, click again to set shape",annotation_editor_instruction_edit:"Click on an annotation to select and edit it",annotation_editor_tool_label:"Drawing Tool",annotation_editor_undo:"Undo",annotation_editor_redo:"Redo",annotation_editor_edit_section:"Edit Annotation",annotation_editor_delete_tooltip:"Delete annotation",annotation_editor_tag_placeholder:"Tag value...",annotation_editor_link_placeholder:"https://...",annotation_editor_text_placeholder:"Enter text...",annotation_editor_add_content:"Add Content",annotation_editor_unknown_body_note:"This structured body is shown read-only and will be preserved when you save.",annotation_editor_hydrating:"Loading the full annotation text...",annotation_editor_save:"Save Changes",annotation_editor_delete_title:"Delete Annotation?",annotation_editor_delete_message:"Are you sure you want to delete this annotation? This action cannot be undone.",annotation_editor_cancel:"Cancel",annotation_editor_delete:"Delete",annotation_editor_error_load:"Couldn't load annotations. Please try again.",annotation_editor_error_create:"Couldn't save the new annotation. Please try again.",annotation_editor_error_update:"Couldn't save your changes. Please try again.",annotation_editor_error_delete:"Couldn't delete the annotation. Please try again.",annotation_editor_error_hydrate:"Couldn't load the full annotation. Please try again.",annotation_editor_error_dismiss:"Dismiss",annotation_tool_rectangle:"Rectangle",annotation_tool_polygon:"Polygon",annotation_tool_point:"Point"},de:{annotation_editor_title:"Anmerkungs-Editor",annotation_editor_edit_mode:"Bearbeiten",annotation_editor_create_mode:"Erstellen",annotation_editor_instruction_create:"Klicken zum Annotieren, erneut klicken zum Abschließen",annotation_editor_instruction_edit:"Anmerkung klicken zum Bearbeiten",annotation_editor_tool_label:"Zeichenwerkzeug",annotation_editor_undo:"Rückgängig",annotation_editor_redo:"Wiederholen",annotation_editor_edit_section:"Anmerkung bearbeiten",annotation_editor_delete_tooltip:"Anmerkung löschen",annotation_editor_tag_placeholder:"Tag eingeben...",annotation_editor_link_placeholder:"https://...",annotation_editor_text_placeholder:"Text eingeben...",annotation_editor_add_content:"Inhalt hinzufügen",annotation_editor_unknown_body_note:"Dieser strukturierte Inhalt wird schreibgeschützt angezeigt und beim Speichern beibehalten.",annotation_editor_hydrating:"Vollständiger Anmerkungstext wird geladen...",annotation_editor_save:"Speichern",annotation_editor_delete_title:"Anmerkung löschen?",annotation_editor_delete_message:"Anmerkung wirklich löschen? Dies kann nicht rückgängig gemacht werden.",annotation_editor_cancel:"Abbrechen",annotation_editor_delete:"Löschen",annotation_editor_error_load:"Anmerkungen konnten nicht geladen werden. Bitte erneut versuchen.",annotation_editor_error_create:"Neue Anmerkung konnte nicht gespeichert werden. Bitte erneut versuchen.",annotation_editor_error_update:"Änderungen konnten nicht gespeichert werden. Bitte erneut versuchen.",annotation_editor_error_delete:"Anmerkung konnte nicht gelöscht werden. Bitte erneut versuchen.",annotation_editor_error_hydrate:"Vollständige Anmerkung konnte nicht geladen werden. Bitte erneut versuchen.",annotation_editor_error_dismiss:"Schließen",annotation_tool_rectangle:"Rechteck",annotation_tool_polygon:"Polygon",annotation_tool_point:"Punkt"}},Il="0 0 256 256",Ml={PencilSimple:'<path d="M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"/>',Warning:'<path d="M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"/>',X:'<path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"/>',Rectangle:'<path d="M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,160H40V56H216V200Z"/>',Polygon:'<path d="M230.64,49.36a32,32,0,0,0-45.26,0h0a31.9,31.9,0,0,0-5.16,6.76L152,48.42A32,32,0,0,0,97.37,25.36h0a32.06,32.06,0,0,0-5.76,37.41L57.67,93.32a32.05,32.05,0,0,0-40.31,4.05h0a32,32,0,0,0,42.89,47.41l70,51.36a32,32,0,1,0,47.57-14.69l27.39-77.59q1.38.12,2.76.12a32,32,0,0,0,22.63-54.62Zm-122-12.69h0a16,16,0,1,1,0,22.64A16,16,0,0,1,108.68,36.67Zm-80,94.65a16,16,0,0,1,0-22.64h0a16,16,0,1,1,0,22.64Zm142.65,88a16,16,0,0,1-22.63-22.63h0a16,16,0,1,1,22.63,22.63Zm-8.55-43.18a32,32,0,0,0-23,7.08l-70-51.36a32.17,32.17,0,0,0-1.34-26.65l33.95-30.55a32,32,0,0,0,45.47-10.81L176,71.56a32,32,0,0,0,14.12,27Zm56.56-92.84A16,16,0,1,1,196.7,60.68h0a16,16,0,0,1,22.63,22.63Z"/>',Target:'<path d="M221.87,83.16A104.1,104.1,0,1,1,195.67,49l22.67-22.68a8,8,0,0,1,11.32,11.32l-96,96a8,8,0,0,1-11.32-11.32l27.72-27.72a40,40,0,1,0,17.87,31.09,8,8,0,1,1,16-.9,56,56,0,1,1-22.38-41.65L184.3,60.39a87.88,87.88,0,1,0,23.13,29.67,8,8,0,0,1,14.44-6.9Z"/>',ArrowCounterClockwise:'<path d="M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"/>',ArrowClockwise:'<path d="M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"/>',Trash:'<path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"/>',Plus:'<path d="M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"/>',Check:'<path d="M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"/>'},s_=n_(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Il}">${Ml.PencilSimple}</svg>`),o_=1,a_=2,Nc=4,l_=8,h_=16,u_=1,c_=4,d_=8,f_=16,p_=1,g_=2,Dt=Symbol(),m_="http://www.w3.org/1999/xhtml",v_="@attach",Dl=!1;var Ol=Array.isArray,y_=Array.prototype.indexOf,Fo=Array.from,__=Object.defineProperty,Nr=Object.getOwnPropertyDescriptor,x_=Object.getOwnPropertyDescriptors,w_=Object.prototype,T_=Array.prototype,kc=Object.getPrototypeOf,Uc=Object.isExtensible;const tr=()=>{};function E_(n){for(var e=0;e<n.length;e++)n[e]()}function Hc(){var n,e,t=new Promise((i,r)=>{n=i,e=r});return{promise:t,resolve:n,reject:e}}const Ot=2,Bl=4,Ll=8,zc=1<<24,un=16,cn=32,Cn=64,No=128,Pi=512,Wt=1024,ri=2048,dn=4096,hi=8192,fn=16384,Fl=32768,Pn=65536,Gc=1<<17,Vc=1<<18,ir=1<<19,b_=1<<20,pn=1<<25,nr=32768,Nl=1<<21,kl=1<<22,In=1<<23,rr=Symbol("$state"),S_=Symbol("legacy props"),A_=Symbol(""),kr=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"};function Ul(n){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function R_(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function C_(n){throw new Error("https://svelte.dev/e/effect_in_teardown")}function P_(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function I_(n){throw new Error("https://svelte.dev/e/effect_orphan")}function M_(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function D_(n){throw new Error("https://svelte.dev/e/props_invalid_value")}function O_(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function B_(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function L_(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function F_(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function N_(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function k_(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Wc(n){return n===this.v}function U_(n,e){return n!=n?e==e:n!==e||n!==null&&typeof n=="object"||typeof n=="function"}function jc(n){return!U_(n,this.v)}let H_=!1,Bt=null;function Ur(n){Bt=n}function Xc(n){return z_().get(n)}function Hr(n,e=!1,t){Bt={p:Bt,i:!1,c:null,e:null,s:n,x:null,l:null}}function zr(n){var e=Bt,t=e.e;if(t!==null){e.e=null;for(var i of t)gd(i)}return e.i=!0,Bt=e.p,{}}function Yc(){return!0}function z_(n){return Bt===null&&Ul(),Bt.c??=new Map(G_(Bt)||void 0)}function G_(n){let e=n.p;for(;e!==null;){const t=e.c;if(t!==null)return t;e=e.p}return null}let sr=[];function qc(){var n=sr;sr=[],E_(n)}function or(n){if(sr.length===0&&!ks){var e=sr;queueMicrotask(()=>{e===sr&&qc()})}sr.push(n)}function V_(){for(;sr.length>0;)qc()}function Zc(n){var e=it;if(e===null)return Ke.f|=In,n;if((e.f&Fl)===0){if((e.f&No)===0)throw n;e.b.error(n)}else Gr(n,e)}function Gr(n,e){for(;e!==null;){if((e.f&No)!==0)try{e.b.error(n);return}catch(t){n=t}e=e.parent}throw n}const ko=new Set;let Je=null,Ns=null,vi=null,yi=[],Uo=null,Hl=!1,ks=!1;class Ii{committed=!1;current=new Map;previous=new Map;#e=new Set;#t=new Set;#i=0;#n=0;#r=null;#s=[];#o=[];skipped_effects=new Set;is_fork=!1;is_deferred(){return this.is_fork||this.#n>0}process(e){yi=[],Ns=null,this.apply();var t={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const i of e)this.#a(i,t);this.is_fork||this.#u(),this.is_deferred()?(this.#l(t.effects),this.#l(t.render_effects),this.#l(t.block_effects)):(Ns=this,Je=null,Qc(t.render_effects),Qc(t.effects),Ns=null,this.#r?.resolve()),vi=null}#a(e,t){e.f^=Wt;for(var i=e.first;i!==null;){var r=i.f,s=(r&(cn|Cn))!==0,o=s&&(r&Wt)!==0,a=o||(r&hi)!==0||this.skipped_effects.has(i);if((i.f&No)!==0&&i.b?.is_pending()&&(t={parent:t,effect:i,effects:[],render_effects:[],block_effects:[]}),!a&&i.fn!==null){s?i.f^=Wt:(r&Bl)!==0?t.effects.push(i):Vs(i)&&((i.f&un)!==0&&t.block_effects.push(i),Ws(i));var l=i.first;if(l!==null){i=l;continue}}var h=i.parent;for(i=i.next;i===null&&h!==null;)h===t.effect&&(this.#l(t.effects),this.#l(t.render_effects),this.#l(t.block_effects),t=t.parent),i=h.next,h=h.parent}}#l(e){for(const t of e)((t.f&ri)!==0?this.#s:this.#o).push(t),this.#h(t.deps),jt(t,Wt)}#h(e){if(e!==null)for(const t of e)(t.f&Ot)===0||(t.f&nr)===0||(t.f^=nr,this.#h(t.deps))}capture(e,t){this.previous.has(e)||this.previous.set(e,t),(e.f&In)===0&&(this.current.set(e,e.v),vi?.set(e,e.v))}activate(){Je=this,this.apply()}deactivate(){Je===this&&(Je=null,vi=null)}flush(){if(this.activate(),yi.length>0){if(Kc(),Je!==null&&Je!==this)return}else this.#i===0&&this.process([]);this.deactivate()}discard(){for(const e of this.#t)e(this);this.#t.clear()}#u(){if(this.#n===0){for(const e of this.#e)e();this.#e.clear()}this.#i===0&&this.#c()}#c(){if(ko.size>1){this.previous.clear();var e=vi,t=!0,i={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const s of ko){if(s===this){t=!1;continue}const o=[];for(const[l,h]of this.current){if(s.current.has(l))if(t&&h!==s.current.get(l))s.current.set(l,h);else continue;o.push(l)}if(o.length===0)continue;const a=[...s.current.keys()].filter(l=>!this.current.has(l));if(a.length>0){var r=yi;yi=[];const l=new Set,h=new Map;for(const u of o)Jc(u,a,l,h);if(yi.length>0){Je=s,s.apply();for(const u of yi)s.#a(u,i);s.deactivate()}yi=r}}Je=null,vi=e}this.committed=!0,ko.delete(this)}increment(e){this.#i+=1,e&&(this.#n+=1)}decrement(e){this.#i-=1,e&&(this.#n-=1),this.revive()}revive(){for(const e of this.#s)jt(e,ri),ar(e);for(const e of this.#o)jt(e,dn),ar(e);this.#s=[],this.#o=[],this.flush()}oncommit(e){this.#e.add(e)}ondiscard(e){this.#t.add(e)}settled(){return(this.#r??=Hc()).promise}static ensure(){if(Je===null){const e=Je=new Ii;ko.add(Je),ks||Ii.enqueue(()=>{Je===e&&e.flush()})}return Je}static enqueue(e){or(e)}apply(){}}function W_(n){var e=ks;ks=!0;try{for(var t;;){if(V_(),yi.length===0&&(Je?.flush(),yi.length===0))return Uo=null,t;Kc()}}finally{ks=e}}function Kc(){var n=hr;Hl=!0;var e=null;try{var t=0;for(Wo(!0);yi.length>0;){var i=Ii.ensure();if(t++>1e3){var r,s;j_()}i.process(yi),Mn.clear()}}finally{Hl=!1,Wo(n),Uo=null}}function j_(){try{M_()}catch(n){Gr(n,Uo)}}let gn=null;function Qc(n){var e=n.length;if(e!==0){for(var t=0;t<e;){var i=n[t++];if((i.f&(fn|hi))===0&&Vs(i)&&(gn=new Set,Ws(i),i.deps===null&&i.first===null&&i.nodes===null&&(i.teardown===null&&i.ac===null?xd(i):i.fn=null),gn?.size>0)){Mn.clear();for(const r of gn){if((r.f&(fn|hi))!==0)continue;const s=[r];let o=r.parent;for(;o!==null;)gn.has(o)&&(gn.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){const l=s[a];(l.f&(fn|hi))===0&&Ws(l)}}gn.clear()}}gn=null}}function Jc(n,e,t,i){if(!t.has(n)&&(t.add(n),n.reactions!==null))for(const r of n.reactions){const s=r.f;(s&Ot)!==0?Jc(r,e,t,i):(s&(kl|un))!==0&&(s&ri)===0&&$c(r,e,i)&&(jt(r,ri),ar(r))}}function $c(n,e,t){const i=t.get(n);if(i!==void 0)return i;if(n.deps!==null)for(const r of n.deps){if(e.includes(r))return!0;if((r.f&Ot)!==0&&$c(r,e,t))return t.set(r,!0),!0}return t.set(n,!1),!1}function ar(n){for(var e=Uo=n;e.parent!==null;){e=e.parent;var t=e.f;if(Hl&&e===it&&(t&un)!==0&&(t&Vc)===0)return;if((t&(Cn|cn))!==0){if((t&Wt)===0)return;e.f^=Wt}}yi.push(e)}function X_(n){let e=0,t=mn(0),i;return()=>{Hs()&&(F(t),Vl(()=>(e===0&&(i=Dn(()=>n(()=>ui(t)))),e+=1,()=>{or(()=>{e-=1,e===0&&(i?.(),i=void 0,ui(t))})})))}}var Y_=Pn|ir|No;function q_(n,e,t){new Z_(n,e,t)}class Z_{parent;#e=!1;#t;#i=null;#n;#r;#s;#o=null;#a=null;#l=null;#h=null;#u=null;#c=0;#d=0;#p=!1;#f=null;#_=X_(()=>(this.#f=mn(this.#c),()=>{this.#f=null}));constructor(e,t,i){this.#t=e,this.#n=t,this.#r=i,this.parent=it.b,this.#e=!!this.#n.pending,this.#s=zs(()=>{it.b=this;{var r=this.#v();try{this.#o=si(()=>i(r))}catch(s){this.error(s)}this.#d>0?this.#m():this.#e=!1}return()=>{this.#u?.remove()}},Y_)}#x(){try{this.#o=si(()=>this.#r(this.#t))}catch(e){this.error(e)}this.#e=!1}#w(){const e=this.#n.pending;e&&(this.#a=si(()=>e(this.#t)),Ii.enqueue(()=>{var t=this.#v();this.#o=this.#g(()=>(Ii.ensure(),si(()=>this.#r(t)))),this.#d>0?this.#m():(lr(this.#a,()=>{this.#a=null}),this.#e=!1)}))}#v(){var e=this.#t;return this.#e&&(this.#u=vn(),this.#t.before(this.#u),e=this.#u),e}is_pending(){return this.#e||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#n.pending}#g(e){var t=it,i=Ke,r=Bt;qi(this.#s),oi(this.#s),Ur(this.#s.ctx);try{return e()}catch(s){return Zc(s),null}finally{qi(t),oi(i),Ur(r)}}#m(){const e=this.#n.pending;this.#o!==null&&(this.#h=document.createDocumentFragment(),this.#h.append(this.#u),Ed(this.#o,this.#h)),this.#a===null&&(this.#a=si(()=>e(this.#t)))}#y(e){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(e);return}this.#d+=e,this.#d===0&&(this.#e=!1,this.#a&&lr(this.#a,()=>{this.#a=null}),this.#h&&(this.#t.before(this.#h),this.#h=null))}update_pending_count(e){this.#y(e),this.#c+=e,this.#f&&Vr(this.#f,this.#c)}get_effect_pending(){return this.#_(),F(this.#f)}error(e){var t=this.#n.onerror;let i=this.#n.failed;if(this.#p||!t&&!i)throw e;this.#o&&(St(this.#o),this.#o=null),this.#a&&(St(this.#a),this.#a=null),this.#l&&(St(this.#l),this.#l=null);var r=!1,s=!1;const o=()=>{if(r){k_();return}r=!0,s&&F_(),Ii.ensure(),this.#c=0,this.#l!==null&&lr(this.#l,()=>{this.#l=null}),this.#e=this.has_pending_snippet(),this.#o=this.#g(()=>(this.#p=!1,si(()=>this.#r(this.#t)))),this.#d>0?this.#m():this.#e=!1};var a=Ke;try{oi(null),s=!0,t?.(e,o),s=!1}catch(l){Gr(l,this.#s&&this.#s.parent)}finally{oi(a)}i&&or(()=>{this.#l=this.#g(()=>{Ii.ensure(),this.#p=!0;try{return si(()=>{i(this.#t,()=>e,()=>o)})}catch(l){return Gr(l,this.#s.parent),null}finally{this.#p=!1}})})}}function ed(n,e,t,i){const r=zo;if(t.length===0&&n.length===0){i(e.map(r));return}var s=Je,o=it,a=K_();function l(){Promise.all(t.map(h=>Q_(h))).then(h=>{a();try{i([...e.map(r),...h])}catch(u){(o.f&fn)===0&&Gr(u,o)}s?.deactivate(),Ho()}).catch(h=>{Gr(h,o)})}n.length>0?Promise.all(n).then(()=>{a();try{return l()}finally{s?.deactivate(),Ho()}}):l()}function K_(){var n=it,e=Ke,t=Bt,i=Je;return function(s=!0){qi(n),oi(e),Ur(t),s&&i?.activate()}}function Ho(){qi(null),oi(null),Ur(null)}function zo(n){var e=Ot|ri,t=Ke!==null&&(Ke.f&Ot)!==0?Ke:null;return it!==null&&(it.f|=ir),{ctx:Bt,deps:null,effects:null,equals:Wc,f:e,fn:n,reactions:null,rv:0,v:Dt,wv:0,parent:t??it,ac:null}}function Q_(n,e){let t=it;t===null&&R_();var i=t.b,r=void 0,s=mn(Dt),o=!Ke,a=new Map;return c0(()=>{var l=Hc();r=l.promise;try{Promise.resolve(n()).then(l.resolve,l.reject).then(()=>{h===Je&&h.committed&&h.deactivate(),Ho()})}catch(d){l.reject(d),Ho()}var h=Je;if(o){var u=!i.is_pending();i.update_pending_count(1),h.increment(u),a.get(h)?.reject(kr),a.delete(h),a.set(h,l)}const c=(d,f=void 0)=>{if(h.activate(),f)f!==kr&&(s.f|=In,Vr(s,f));else{(s.f&In)!==0&&(s.f^=In),Vr(s,d);for(const[p,g]of a){if(a.delete(p),p===h)break;g.reject(kr)}}o&&(i.update_pending_count(-1),h.decrement(u))};l.promise.then(c,d=>c(null,d||"unknown"))}),pd(()=>{for(const l of a.values())l.reject(kr)}),new Promise(l=>{function h(u){function c(){u===r?l(s):h(r)}u.then(c,c)}h(r)})}function $e(n){const e=zo(n);return Sd(e),e}function td(n){const e=zo(n);return e.equals=jc,e}function id(n){var e=n.effects;if(e!==null){n.effects=null;for(var t=0;t<e.length;t+=1)St(e[t])}}function J_(n){for(var e=n.parent;e!==null;){if((e.f&Ot)===0)return(e.f&fn)===0?e:null;e=e.parent}return null}function zl(n){var e,t=it;qi(J_(n));try{n.f&=~nr,id(n),e=Id(n)}finally{qi(t)}return e}function nd(n){var e=zl(n);if(n.equals(e)||(Je?.is_fork||(n.v=e),n.wv=Cd()),!ur)if(vi!==null)(Hs()||Je?.is_fork)&&vi.set(n,e);else{var t=(n.f&Pi)===0?dn:Wt;jt(n,t)}}let Gl=new Set;const Mn=new Map;let rd=!1;function mn(n,e){var t={f:0,v:n,reactions:null,equals:Wc,rv:0,wv:0};return t}function Ge(n,e){const t=mn(n);return Sd(t),t}function $_(n,e=!1,t=!0){const i=mn(n);return e||(i.equals=jc),i}function _e(n,e,t=!1){Ke!==null&&(!Yi||(Ke.f&Gc)!==0)&&Yc()&&(Ke.f&(Ot|un|kl|Gc))!==0&&!yn?.includes(n)&&L_();let i=t?Wi(e):e;return Vr(n,i)}function Vr(n,e){if(!n.equals(e)){var t=n.v;ur?Mn.set(n,e):Mn.set(n,t),n.v=e;var i=Ii.ensure();i.capture(n,t),(n.f&Ot)!==0&&((n.f&ri)!==0&&zl(n),jt(n,(n.f&Pi)!==0?Wt:dn)),n.wv=Cd(),sd(n,ri),it!==null&&(it.f&Wt)!==0&&(it.f&(cn|Cn))===0&&(xi===null?f0([n]):xi.push(n)),!i.is_fork&&Gl.size>0&&!rd&&e0()}return e}function e0(){rd=!1;var n=hr;Wo(!0);const e=Array.from(Gl);try{for(const t of e)(t.f&Wt)!==0&&jt(t,dn),Vs(t)&&Ws(t)}finally{Wo(n)}Gl.clear()}function t0(n,e=1){var t=F(n),i=e===1?t++:t--;return _e(n,t),i}function ui(n){_e(n,n.v+1)}function sd(n,e){var t=n.reactions;if(t!==null)for(var i=t.length,r=0;r<i;r++){var s=t[r],o=s.f,a=(o&ri)===0;if(a&&jt(s,e),(o&Ot)!==0){var l=s;vi?.delete(l),(o&nr)===0&&(o&Pi&&(s.f|=nr),sd(l,dn))}else a&&((o&un)!==0&&gn!==null&&gn.add(s),ar(s))}}function Wi(n){if(typeof n!="object"||n===null||rr in n)return n;const e=kc(n);if(e!==w_&&e!==T_)return n;var t=new Map,i=Ol(n),r=Ge(0),s=Di,o=a=>{if(Di===s)return a();var l=Ke,h=Di;oi(null),Rd(s);var u=a();return oi(l),Rd(h),u};return i&&t.set("length",Ge(n.length)),new Proxy(n,{defineProperty(a,l,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&O_();var u=t.get(l);return u===void 0?u=o(()=>{var c=Ge(h.value);return t.set(l,c),c}):_e(u,h.value,!0),!0},deleteProperty(a,l){var h=t.get(l);if(h===void 0){if(l in a){const u=o(()=>Ge(Dt));t.set(l,u),ui(r)}}else _e(h,Dt),ui(r);return!0},get(a,l,h){if(l===rr)return n;var u=t.get(l),c=l in a;if(u===void 0&&(!c||Nr(a,l)?.writable)&&(u=o(()=>{var f=Wi(c?a[l]:Dt),p=Ge(f);return p}),t.set(l,u)),u!==void 0){var d=F(u);return d===Dt?void 0:d}return Reflect.get(a,l,h)},getOwnPropertyDescriptor(a,l){var h=Reflect.getOwnPropertyDescriptor(a,l);if(h&&"value"in h){var u=t.get(l);u&&(h.value=F(u))}else if(h===void 0){var c=t.get(l),d=c?.v;if(c!==void 0&&d!==Dt)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return h},has(a,l){if(l===rr)return!0;var h=t.get(l),u=h!==void 0&&h.v!==Dt||Reflect.has(a,l);if(h!==void 0||it!==null&&(!u||Nr(a,l)?.writable)){h===void 0&&(h=o(()=>{var d=u?Wi(a[l]):Dt,f=Ge(d);return f}),t.set(l,h));var c=F(h);if(c===Dt)return!1}return u},set(a,l,h,u){var c=t.get(l),d=l in a;if(i&&l==="length")for(var f=h;f<c.v;f+=1){var p=t.get(f+"");p!==void 0?_e(p,Dt):f in a&&(p=o(()=>Ge(Dt)),t.set(f+"",p))}if(c===void 0)(!d||Nr(a,l)?.writable)&&(c=o(()=>Ge(void 0)),_e(c,Wi(h)),t.set(l,c));else{d=c.v!==Dt;var g=o(()=>Wi(h));_e(c,g)}var m=Reflect.getOwnPropertyDescriptor(a,l);if(m?.set&&m.set.call(u,h),!d){if(i&&typeof l=="string"){var v=t.get("length"),_=Number(l);Number.isInteger(_)&&_>=v.v&&_e(v,_+1)}ui(r)}return!0},ownKeys(a){F(r);var l=Reflect.ownKeys(a).filter(c=>{var d=t.get(c);return d===void 0||d.v!==Dt});for(var[h,u]of t)u.v!==Dt&&!(h in a)&&l.push(h);return l},setPrototypeOf(){B_()}})}function od(n){try{if(n!==null&&typeof n=="object"&&rr in n)return n[rr]}catch{}return n}function i0(n,e){return Object.is(od(n),od(e))}var ad,ld,hd,ud;function n0(){if(ad===void 0){ad=window,ld=/Firefox/.test(navigator.userAgent);var n=Element.prototype,e=Node.prototype,t=Text.prototype;hd=Nr(e,"firstChild").get,ud=Nr(e,"nextSibling").get,Uc(n)&&(n.__click=void 0,n.__className=void 0,n.__attributes=null,n.__style=void 0,n.__e=void 0),Uc(t)&&(t.__t=void 0)}}function vn(n=""){return document.createTextNode(n)}function ji(n){return hd.call(n)}function Us(n){return ud.call(n)}function Ne(n,e){return ji(n)}function _i(n,e=!1){{var t=ji(n);return t instanceof Comment&&t.data===""?Us(t):t}}function Ze(n,e=1,t=!1){let i=n;for(;e--;)i=Us(i);return i}function r0(n){n.textContent=""}function cd(){return!1}function s0(n,e){if(e){const t=document.body;n.autofocus=!0,or(()=>{document.activeElement===t&&n.focus()})}}let dd=!1;function o0(){dd||(dd=!0,document.addEventListener("reset",n=>{Promise.resolve().then(()=>{if(!n.defaultPrevented)for(const e of n.target.elements)e.__on_r?.()})},{capture:!0}))}function Go(n){var e=Ke,t=it;oi(null),qi(null);try{return n()}finally{oi(e),qi(t)}}function fd(n,e,t,i=t){n.addEventListener(e,()=>Go(t));const r=n.__on_r;r?n.__on_r=()=>{r(),i(!0)}:n.__on_r=()=>i(!0),o0()}function a0(n){it===null&&(Ke===null&&I_(),P_()),ur&&C_()}function l0(n,e){var t=e.last;t===null?e.last=e.first=n:(t.next=n,n.prev=t,e.last=n)}function Mi(n,e,t){var i=it;i!==null&&(i.f&hi)!==0&&(n|=hi);var r={ctx:Bt,deps:null,nodes:null,f:n|ri|Pi,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(t)try{Ws(r),r.f|=Fl}catch(a){throw St(r),a}else e!==null&&ar(r);var s=r;if(t&&s.deps===null&&s.teardown===null&&s.nodes===null&&s.first===s.last&&(s.f&ir)===0&&(s=s.first,(n&un)!==0&&(n&Pn)!==0&&s!==null&&(s.f|=Pn)),s!==null&&(s.parent=i,i!==null&&l0(s,i),Ke!==null&&(Ke.f&Ot)!==0&&(n&Cn)===0)){var o=Ke;(o.effects??=[]).push(s)}return r}function Hs(){return Ke!==null&&!Yi}function pd(n){const e=Mi(Ll,null,!1);return jt(e,Wt),e.teardown=n,e}function Xi(n){a0();var e=it.f,t=!Ke&&(e&cn)!==0&&(e&Fl)===0;if(t){var i=Bt;(i.e??=[]).push(n)}else return gd(n)}function gd(n){return Mi(Bl|b_,n,!1)}function h0(n){Ii.ensure();const e=Mi(Cn|ir,n,!0);return()=>{St(e)}}function u0(n){Ii.ensure();const e=Mi(Cn|ir,n,!0);return(t={})=>new Promise(i=>{t.outro?lr(e,()=>{St(e),i(void 0)}):(St(e),i(void 0))})}function Vo(n){return Mi(Bl,n,!1)}function c0(n){return Mi(kl|ir,n,!0)}function Vl(n,e=0){return Mi(Ll|e,n,!0)}function st(n,e=[],t=[],i=[]){ed(i,e,t,r=>{Mi(Ll,()=>n(...r.map(F)),!0)})}function zs(n,e=0){var t=Mi(un|e,n,!0);return t}function md(n,e=0){var t=Mi(zc|e,n,!0);return t}function si(n){return Mi(cn|ir,n,!0)}function vd(n){var e=n.teardown;if(e!==null){const t=ur,i=Ke;bd(!0),oi(null);try{e.call(null)}finally{bd(t),oi(i)}}}function yd(n,e=!1){var t=n.first;for(n.first=n.last=null;t!==null;){const r=t.ac;r!==null&&Go(()=>{r.abort(kr)});var i=t.next;(t.f&Cn)!==0?t.parent=null:St(t,e),t=i}}function d0(n){for(var e=n.first;e!==null;){var t=e.next;(e.f&cn)===0&&St(e),e=t}}function St(n,e=!0){var t=!1;(e||(n.f&Vc)!==0)&&n.nodes!==null&&n.nodes.end!==null&&(_d(n.nodes.start,n.nodes.end),t=!0),yd(n,e&&!t),jo(n,0),jt(n,fn);var i=n.nodes&&n.nodes.t;if(i!==null)for(const s of i)s.stop();vd(n);var r=n.parent;r!==null&&r.first!==null&&xd(n),n.next=n.prev=n.teardown=n.ctx=n.deps=n.fn=n.nodes=n.ac=null}function _d(n,e){for(;n!==null;){var t=n===e?null:Us(n);n.remove(),n=t}}function xd(n){var e=n.parent,t=n.prev,i=n.next;t!==null&&(t.next=i),i!==null&&(i.prev=t),e!==null&&(e.first===n&&(e.first=i),e.last===n&&(e.last=t))}function lr(n,e,t=!0){var i=[];wd(n,i,!0);var r=()=>{t&&St(n),e&&e()},s=i.length;if(s>0){var o=()=>--s||r();for(var a of i)a.out(o)}else r()}function wd(n,e,t){if((n.f&hi)===0){n.f^=hi;var i=n.nodes&&n.nodes.t;if(i!==null)for(const a of i)(a.is_global||t)&&e.push(a);for(var r=n.first;r!==null;){var s=r.next,o=(r.f&Pn)!==0||(r.f&cn)!==0&&(n.f&un)!==0;wd(r,e,o?t:!1),r=s}}}function Wl(n){Td(n,!0)}function Td(n,e){if((n.f&hi)!==0){n.f^=hi,(n.f&Wt)===0&&(jt(n,ri),ar(n));for(var t=n.first;t!==null;){var i=t.next,r=(t.f&Pn)!==0||(t.f&cn)!==0;Td(t,r?e:!1),t=i}var s=n.nodes&&n.nodes.t;if(s!==null)for(const o of s)(o.is_global||e)&&o.in()}}function Ed(n,e){if(n.nodes)for(var t=n.nodes.start,i=n.nodes.end;t!==null;){var r=t===i?null:Us(t);e.append(t),t=r}}let hr=!1;function Wo(n){hr=n}let ur=!1;function bd(n){ur=n}let Ke=null,Yi=!1;function oi(n){Ke=n}let it=null;function qi(n){it=n}let yn=null;function Sd(n){Ke!==null&&(yn===null?yn=[n]:yn.push(n))}let Qt=null,ci=0,xi=null;function f0(n){xi=n}let Ad=1,Gs=0,Di=Gs;function Rd(n){Di=n}function Cd(){return++Ad}function Vs(n){var e=n.f;if((e&ri)!==0)return!0;if(e&Ot&&(n.f&=~nr),(e&dn)!==0){var t=n.deps;if(t!==null)for(var i=t.length,r=0;r<i;r++){var s=t[r];if(Vs(s)&&nd(s),s.wv>n.wv)return!0}(e&Pi)!==0&&vi===null&&jt(n,Wt)}return!1}function Pd(n,e,t=!0){var i=n.reactions;if(i!==null&&!yn?.includes(n))for(var r=0;r<i.length;r++){var s=i[r];(s.f&Ot)!==0?Pd(s,e,!1):e===s&&(t?jt(s,ri):(s.f&Wt)!==0&&jt(s,dn),ar(s))}}function Id(n){var e=Qt,t=ci,i=xi,r=Ke,s=yn,o=Bt,a=Yi,l=Di,h=n.f;Qt=null,ci=0,xi=null,Ke=(h&(cn|Cn))===0?n:null,yn=null,Ur(n.ctx),Yi=!1,Di=++Gs,n.ac!==null&&(Go(()=>{n.ac.abort(kr)}),n.ac=null);try{n.f|=Nl;var u=n.fn,c=u(),d=n.deps;if(Qt!==null){var f;if(jo(n,ci),d!==null&&ci>0)for(d.length=ci+Qt.length,f=0;f<Qt.length;f++)d[ci+f]=Qt[f];else n.deps=d=Qt;if(Hs()&&(n.f&Pi)!==0)for(f=ci;f<d.length;f++)(d[f].reactions??=[]).push(n)}else d!==null&&ci<d.length&&(jo(n,ci),d.length=ci);if(Yc()&&xi!==null&&!Yi&&d!==null&&(n.f&(Ot|dn|ri))===0)for(f=0;f<xi.length;f++)Pd(xi[f],n);return r!==null&&r!==n&&(Gs++,xi!==null&&(i===null?i=xi:i.push(...xi))),(n.f&In)!==0&&(n.f^=In),c}catch(p){return Zc(p)}finally{n.f^=Nl,Qt=e,ci=t,xi=i,Ke=r,yn=s,Ur(o),Yi=a,Di=l}}function p0(n,e){let t=e.reactions;if(t!==null){var i=y_.call(t,n);if(i!==-1){var r=t.length-1;r===0?t=e.reactions=null:(t[i]=t[r],t.pop())}}t===null&&(e.f&Ot)!==0&&(Qt===null||!Qt.includes(e))&&(jt(e,dn),(e.f&Pi)!==0&&(e.f^=Pi,e.f&=~nr),id(e),jo(e,0))}function jo(n,e){var t=n.deps;if(t!==null)for(var i=e;i<t.length;i++)p0(n,t[i])}function Ws(n){var e=n.f;if((e&fn)===0){jt(n,Wt);var t=it,i=hr;it=n,hr=!0;try{(e&(un|zc))!==0?d0(n):yd(n),vd(n);var r=Id(n);n.teardown=typeof r=="function"?r:null,n.wv=Ad;var s;Dl&&H_&&(n.f&ri)!==0&&n.deps}finally{hr=i,it=t}}}async function g0(){await Promise.resolve(),W_()}function F(n){var e=n.f,t=(e&Ot)!==0;if(Ke!==null&&!Yi){var i=it!==null&&(it.f&fn)!==0;if(!i&&!yn?.includes(n)){var r=Ke.deps;if((Ke.f&Nl)!==0)n.rv<Gs&&(n.rv=Gs,Qt===null&&r!==null&&r[ci]===n?ci++:Qt===null?Qt=[n]:Qt.includes(n)||Qt.push(n));else{(Ke.deps??=[]).push(n);var s=n.reactions;s===null?n.reactions=[Ke]:s.includes(Ke)||s.push(Ke)}}}if(ur){if(Mn.has(n))return Mn.get(n);if(t){var o=n,a=o.v;return((o.f&Wt)===0&&o.reactions!==null||Dd(o))&&(a=zl(o)),Mn.set(o,a),a}}else t&&(!vi?.has(n)||Je?.is_fork&&!Hs())&&(o=n,Vs(o)&&nd(o),hr&&Hs()&&(o.f&Pi)===0&&Md(o));if(vi?.has(n))return vi.get(n);if((n.f&In)!==0)throw n.v;return n.v}function Md(n){if(n.deps!==null){n.f^=Pi;for(const e of n.deps)(e.reactions??=[]).push(n),(e.f&Ot)!==0&&(e.f&Pi)===0&&Md(e)}}function Dd(n){if(n.v===Dt)return!0;if(n.deps===null)return!1;for(const e of n.deps)if(Mn.has(e)||(e.f&Ot)!==0&&Dd(e))return!0;return!1}function Dn(n){var e=Yi;try{return Yi=!0,n()}finally{Yi=e}}const m0=-7169;function jt(n,e){n.f=n.f&m0|e}const Od=new Set,jl=new Set;function v0(n,e,t,i={}){function r(s){if(i.capture||js.call(e,s),!s.cancelBubble)return Go(()=>t?.call(this,s))}return n.startsWith("pointer")||n.startsWith("touch")||n==="wheel"?or(()=>{e.addEventListener(n,r,i)}):e.addEventListener(n,r,i),r}function Xl(n){for(var e=0;e<n.length;e++)Od.add(n[e]);for(var t of jl)t(n)}let Bd=null;function js(n){var e=this,t=e.ownerDocument,i=n.type,r=n.composedPath?.()||[],s=r[0]||n.target;Bd=n;var o=0,a=Bd===n&&n.__root;if(a){var l=r.indexOf(a);if(l!==-1&&(e===document||e===window)){n.__root=e;return}var h=r.indexOf(e);if(h===-1)return;l<=h&&(o=l)}if(s=r[o]||n.target,s!==e){__(n,"currentTarget",{configurable:!0,get(){return s||t}});var u=Ke,c=it;oi(null),qi(null);try{for(var d,f=[];s!==null;){var p=s.assignedSlot||s.parentNode||s.host||null;try{var g=s["__"+i];g!=null&&(!s.disabled||n.target===s)&&g.call(s,n)}catch(m){d?f.push(m):d=m}if(n.cancelBubble||p===e||p===null)break;s=p}if(d){for(let m of f)queueMicrotask(()=>{throw m});throw d}}finally{n.__root=e,delete n.currentTarget,oi(u),qi(c)}}}function Yl(n){var e=document.createElement("template");return e.innerHTML=n.replaceAll("<!>","<!---->"),e.content}function Wr(n,e){var t=it;t.nodes===null&&(t.nodes={start:n,end:e,a:null,t:null})}function rt(n,e){var t=(e&p_)!==0,i=(e&g_)!==0,r,s=!n.startsWith("<!>");return()=>{r===void 0&&(r=Yl(s?n:"<!>"+n),t||(r=ji(r)));var o=i||ld?document.importNode(r,!0):r.cloneNode(!0);if(t){var a=ji(o),l=o.lastChild;Wr(a,l)}else Wr(o,o);return o}}function y0(n,e,t="svg"){var i=!n.startsWith("<!>"),r=`<${t}>${i?n:"<!>"+n}</${t}>`,s;return()=>{if(!s){var o=Yl(r),a=ji(o);s=ji(a)}var l=s.cloneNode(!0);return Wr(l,l),l}}function Ld(n,e){return y0(n,e,"svg")}function Xo(n=""){{var e=vn(n+"");return Wr(e,e),e}}function Xs(){var n=document.createDocumentFragment(),e=document.createComment(""),t=vn();return n.append(e,t),Wr(e,t),n}function Ve(n,e){n!==null&&n.before(e)}function _0(n){return n.endsWith("capture")&&n!=="gotpointercapture"&&n!=="lostpointercapture"}const x0=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function w0(n){return x0.includes(n)}const T0={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function E0(n){return n=n.toLowerCase(),T0[n]??n}const b0=["touchstart","touchmove"];function S0(n){return b0.includes(n)}function mt(n,e){var t=e==null?"":typeof e=="object"?e+"":e;t!==(n.__t??=n.nodeValue)&&(n.__t=t,n.nodeValue=t+"")}function A0(n,e){return R0(n,e)}const jr=new Map;function R0(n,{target:e,anchor:t,props:i={},events:r,context:s,intro:o=!0}){n0();var a=new Set,l=c=>{for(var d=0;d<c.length;d++){var f=c[d];if(!a.has(f)){a.add(f);var p=S0(f);e.addEventListener(f,js,{passive:p});var g=jr.get(f);g===void 0?(document.addEventListener(f,js,{passive:p}),jr.set(f,1)):jr.set(f,g+1)}}};l(Fo(Od)),jl.add(l);var h=void 0,u=u0(()=>{var c=t??e.appendChild(vn());return q_(c,{pending:()=>{}},d=>{if(s){Hr({});var f=Bt;f.c=s}r&&(i.$$events=r),h=n(d,i)||{},s&&zr()}),()=>{for(var d of a){e.removeEventListener(d,js);var f=jr.get(d);--f===0?(document.removeEventListener(d,js),jr.delete(d)):jr.set(d,f)}jl.delete(l),c!==t&&c.parentNode?.removeChild(c)}});return ql.set(h,u),h}let ql=new WeakMap;function C0(n,e){const t=ql.get(n);return t?(ql.delete(n),t(e)):Promise.resolve()}class Zl{anchor;#e=new Map;#t=new Map;#i=new Map;#n=new Set;#r=!0;constructor(e,t=!0){this.anchor=e,this.#r=t}#s=()=>{var e=Je;if(this.#e.has(e)){var t=this.#e.get(e),i=this.#t.get(t);if(i)Wl(i),this.#n.delete(t);else{var r=this.#i.get(t);r&&(this.#t.set(t,r.effect),this.#i.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),i=r.effect)}for(const[s,o]of this.#e){if(this.#e.delete(s),s===e)break;const a=this.#i.get(o);a&&(St(a.effect),this.#i.delete(o))}for(const[s,o]of this.#t){if(s===t||this.#n.has(s))continue;const a=()=>{if(Array.from(this.#e.values()).includes(s)){var h=document.createDocumentFragment();Ed(o,h),h.append(vn()),this.#i.set(s,{effect:o,fragment:h})}else St(o);this.#n.delete(s),this.#t.delete(s)};this.#r||!i?(this.#n.add(s),lr(o,a,!1)):a()}}};#o=e=>{this.#e.delete(e);const t=Array.from(this.#e.values());for(const[i,r]of this.#i)t.includes(i)||(St(r.effect),this.#i.delete(i))};ensure(e,t){var i=Je,r=cd();if(t&&!this.#t.has(e)&&!this.#i.has(e))if(r){var s=document.createDocumentFragment(),o=vn();s.append(o),this.#i.set(e,{effect:si(()=>t(o)),fragment:s})}else this.#t.set(e,si(()=>t(this.anchor)));if(this.#e.set(i,e),r){for(const[a,l]of this.#t)a===e?i.skipped_effects.delete(l):i.skipped_effects.add(l);for(const[a,l]of this.#i)a===e?i.skipped_effects.delete(l.effect):i.skipped_effects.add(l.effect);i.oncommit(this.#s),i.ondiscard(this.#o)}else this.#s()}}function Kl(n,e,...t){var i=new Zl(n);zs(()=>{const r=e()??null;i.ensure(r,r&&(s=>r(s,...t)))},Pn)}function Fd(n){Bt===null&&Ul(),Xi(()=>{const e=Dn(n);if(typeof e=="function")return e})}function P0(n){Bt===null&&Ul(),Fd(()=>()=>Dn(n))}function Xt(n,e,t=!1){var i=new Zl(n),r=t?Pn:0;function s(o,a){i.ensure(o,a)}zs(()=>{var o=!1;e((a,l=!0)=>{o=!0,s(l,a)}),o||s(!1,null)},r)}function I0(n,e){return e}function M0(n,e,t){for(var i=[],r=e.length,s,o=e.length,a=0;a<r;a++){let c=e[a];lr(c,()=>{if(s){if(s.pending.delete(c),s.done.add(c),s.pending.size===0){var d=n.outrogroups;Ql(Fo(s.done)),d.delete(s),d.size===0&&(n.outrogroups=null)}}else o-=1},!1)}if(o===0){var l=i.length===0&&t!==null;if(l){var h=t,u=h.parentNode;r0(u),u.append(h),n.items.clear()}Ql(e,!l)}else s={pending:new Set(e),done:new Set},(n.outrogroups??=new Set).add(s)}function Ql(n,e=!0){for(var t=0;t<n.length;t++)St(n[t],e)}var Nd;function Yo(n,e,t,i,r,s=null){var o=n,a=new Map,l=(e&Nc)!==0;if(l){var h=n;o=h.appendChild(vn())}var u=null,c=td(()=>{var v=t();return Ol(v)?v:v==null?[]:Fo(v)}),d,f=!0;function p(){m.fallback=u,D0(m,d,o,e,i),u!==null&&(d.length===0?(u.f&pn)===0?Wl(u):(u.f^=pn,Ys(u,null,o)):lr(u,()=>{u=null}))}var g=zs(()=>{d=F(c);for(var v=d.length,_=new Set,y=Je,w=cd(),R=0;R<v;R+=1){var D=d[R],C=i(D,R),O=f?null:a.get(C);O?(O.v&&Vr(O.v,D),O.i&&Vr(O.i,R),w&&y.skipped_effects.delete(O.e)):(O=O0(a,f?o:Nd??=vn(),D,C,R,r,e,t),f||(O.e.f|=pn),a.set(C,O)),_.add(C)}if(v===0&&s&&!u&&(f?u=si(()=>s(o)):(u=si(()=>s(Nd??=vn())),u.f|=pn)),!f)if(w){for(const[N,X]of a)_.has(N)||y.skipped_effects.add(X.e);y.oncommit(p),y.ondiscard(()=>{})}else p();F(c)}),m={effect:g,items:a,outrogroups:null,fallback:u};f=!1}function D0(n,e,t,i,r){var s=(i&l_)!==0,o=e.length,a=n.items,l=n.effect.first,h,u=null,c,d=[],f=[],p,g,m,v;if(s)for(v=0;v<o;v+=1)p=e[v],g=r(p,v),m=a.get(g).e,(m.f&pn)===0&&(m.nodes?.a?.measure(),(c??=new Set).add(m));for(v=0;v<o;v+=1){if(p=e[v],g=r(p,v),m=a.get(g).e,n.outrogroups!==null)for(const X of n.outrogroups)X.pending.delete(m),X.done.delete(m);if((m.f&pn)!==0)if(m.f^=pn,m===l)Ys(m,null,t);else{var _=u?u.next:l;m===n.effect.last&&(n.effect.last=m.prev),m.prev&&(m.prev.next=m.next),m.next&&(m.next.prev=m.prev),On(n,u,m),On(n,m,_),Ys(m,_,t),u=m,d=[],f=[],l=u.next;continue}if((m.f&hi)!==0&&(Wl(m),s&&(m.nodes?.a?.unfix(),(c??=new Set).delete(m))),m!==l){if(h!==void 0&&h.has(m)){if(d.length<f.length){var y=f[0],w;u=y.prev;var R=d[0],D=d[d.length-1];for(w=0;w<d.length;w+=1)Ys(d[w],y,t);for(w=0;w<f.length;w+=1)h.delete(f[w]);On(n,R.prev,D.next),On(n,u,R),On(n,D,y),l=y,u=D,v-=1,d=[],f=[]}else h.delete(m),Ys(m,l,t),On(n,m.prev,m.next),On(n,m,u===null?n.effect.first:u.next),On(n,u,m),u=m;continue}for(d=[],f=[];l!==null&&l!==m;)(h??=new Set).add(l),f.push(l),l=l.next;if(l===null)continue}(m.f&pn)===0&&d.push(m),u=m,l=m.next}if(n.outrogroups!==null){for(const X of n.outrogroups)X.pending.size===0&&(Ql(Fo(X.done)),n.outrogroups?.delete(X));n.outrogroups.size===0&&(n.outrogroups=null)}if(l!==null||h!==void 0){var C=[];if(h!==void 0)for(m of h)(m.f&hi)===0&&C.push(m);for(;l!==null;)(l.f&hi)===0&&l!==n.fallback&&C.push(l),l=l.next;var O=C.length;if(O>0){var N=(i&Nc)!==0&&o===0?t:null;if(s){for(v=0;v<O;v+=1)C[v].nodes?.a?.measure();for(v=0;v<O;v+=1)C[v].nodes?.a?.fix()}M0(n,C,N)}}s&&or(()=>{if(c!==void 0)for(m of c)m.nodes?.a?.apply()})}function O0(n,e,t,i,r,s,o,a){var l=(o&o_)!==0?(o&h_)===0?$_(t,!1,!1):mn(t):null,h=(o&a_)!==0?mn(r):null;return{v:l,i:h,e:si(()=>(s(e,l??t,h??r,a),()=>{n.delete(i)}))}}function Ys(n,e,t){if(n.nodes)for(var i=n.nodes.start,r=n.nodes.end,s=e&&(e.f&pn)===0?e.nodes.start:t;i!==null;){var o=Us(i);if(s.before(i),i===r)return;i=o}}function On(n,e,t){e===null?n.effect.first=t:e.next=t,t===null?n.effect.last=e:t.prev=e}function kd(n,e,t=!1,i=!1,r=!1){var s=n,o="";st(()=>{var a=it;if(o!==(o=e()??"")&&(a.nodes!==null&&(_d(a.nodes.start,a.nodes.end),a.nodes=null),o!=="")){var l=o+"";t?l=`<svg>${l}</svg>`:i&&(l=`<math>${l}</math>`);var h=Yl(l);if((t||i)&&(h=ji(h)),Wr(ji(h),h.lastChild),t||i)for(;ji(h);)s.before(ji(h));else s.before(h)}})}function B0(n,e,t){var i=new Zl(n);zs(()=>{var r=e()??null;i.ensure(r,r&&(s=>t(s,r)))},Pn)}function L0(n,e){var t=void 0,i;md(()=>{t!==(t=e())&&(i&&(St(i),i=null),t&&(i=si(()=>{Vo(()=>t(n))})))})}function Ud(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var r=n.length;for(e=0;e<r;e++)n[e]&&(t=Ud(n[e]))&&(i&&(i+=" "),i+=t)}else for(t in n)n[t]&&(i&&(i+=" "),i+=t);return i}function F0(){for(var n,e,t=0,i="",r=arguments.length;t<r;t++)(n=arguments[t])&&(e=Ud(n))&&(i&&(i+=" "),i+=e);return i}function N0(n){return typeof n=="object"?F0(n):n??""}const Hd=[...`
5
5
  \r\f \v\uFEFF`];function k0(n,e,t){var i=n==null?"":""+n;if(e&&(i=i?i+" "+e:e),t){for(var r in t)if(t[r])i=i?i+" "+r:r;else if(i.length)for(var s=r.length,o=0;(o=i.indexOf(r,o))>=0;){var a=o+s;(o===0||Hd.includes(i[o-1]))&&(a===i.length||Hd.includes(i[a]))?i=(o===0?"":i.substring(0,o))+i.substring(a+1):o=a}}return i===""?null:i}function zd(n,e=!1){var t=e?" !important;":";",i="";for(var r in n){var s=n[r];s!=null&&s!==""&&(i+=" "+r+": "+s+t)}return i}function Jl(n){return n[0]!=="-"||n[1]!=="-"?n.toLowerCase():n}function U0(n,e){if(e){var t="",i,r;if(Array.isArray(e)?(i=e[0],r=e[1]):i=e,n){n=String(n).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var s=!1,o=0,a=!1,l=[];i&&l.push(...Object.keys(i).map(Jl)),r&&l.push(...Object.keys(r).map(Jl));var h=0,u=-1;const g=n.length;for(var c=0;c<g;c++){var d=n[c];if(a?d==="/"&&n[c-1]==="*"&&(a=!1):s?s===d&&(s=!1):d==="/"&&n[c+1]==="*"?a=!0:d==='"'||d==="'"?s=d:d==="("?o++:d===")"&&o--,!a&&s===!1&&o===0){if(d===":"&&u===-1)u=c;else if(d===";"||c===g-1){if(u!==-1){var f=Jl(n.substring(h,u).trim());if(!l.includes(f)){d!==";"&&c++;var p=n.substring(h,c).trim();t+=" "+p+";"}}h=c+1,u=-1}}}}return i&&(t+=zd(i)),r&&(t+=zd(r,!0)),t=t.trim(),t===""?null:t}return n==null?null:String(n)}function Bn(n,e,t,i,r,s){var o=n.__className;if(o!==t||o===void 0){var a=k0(t,i,s);a==null?n.removeAttribute("class"):e?n.className=a:n.setAttribute("class",a),n.__className=t}else if(s&&r!==s)for(var l in s){var h=!!s[l];(r==null||h!==!!r[l])&&n.classList.toggle(l,h)}return s}function $l(n,e={},t,i){for(var r in t){var s=t[r];e[r]!==s&&(t[r]==null?n.style.removeProperty(r):n.style.setProperty(r,s,i))}}function eh(n,e,t,i){var r=n.__style;if(r!==e){var s=U0(e,i);s==null?n.removeAttribute("style"):n.style.cssText=s,n.__style=e}else i&&(Array.isArray(i)?($l(n,t?.[0],i[0]),$l(n,t?.[1],i[1],"important")):$l(n,t,i));return i}function qo(n,e,t=!1){if(n.multiple){if(e==null)return;if(!Ol(e))return N_();for(var i of n.options)i.selected=e.includes(qs(i));return}for(i of n.options){var r=qs(i);if(i0(r,e)){i.selected=!0;return}}(!t||e!==void 0)&&(n.selectedIndex=-1)}function Gd(n){var e=new MutationObserver(()=>{qo(n,n.__value)});e.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),pd(()=>{e.disconnect()})}function H0(n,e,t=e){var i=new WeakSet,r=!0;fd(n,"change",s=>{var o=s?"[selected]":":checked",a;if(n.multiple)a=[].map.call(n.querySelectorAll(o),qs);else{var l=n.querySelector(o)??n.querySelector("option:not([disabled])");a=l&&qs(l)}t(a),Je!==null&&i.add(Je)}),Vo(()=>{var s=e();if(n===document.activeElement){var o=Ns??Je;if(i.has(o))return}if(qo(n,s,r),r&&s===void 0){var a=n.querySelector(":checked");a!==null&&(s=qs(a),t(s))}n.__value=s,r=!1}),Gd(n)}function qs(n){return"__value"in n?n.__value:n.value}const Ln=Symbol("class"),Zs=Symbol("style"),Vd=Symbol("is custom element"),Wd=Symbol("is html");function z0(n,e){e?n.hasAttribute("selected")||n.setAttribute("selected",""):n.removeAttribute("selected")}function Lt(n,e,t,i){var r=jd(n);r[e]!==(r[e]=t)&&(e==="loading"&&(n[A_]=t),t==null?n.removeAttribute(e):typeof t!="string"&&Yd(n).includes(e)?n[e]=t:n.setAttribute(e,t))}function G0(n,e,t,i,r=!1,s=!1){var o=jd(n),a=o[Vd],l=!o[Wd],h=e||{},u=n.tagName==="OPTION";for(var c in e)c in t||(t[c]=null);t.class?t.class=N0(t.class):(i||t[Ln])&&(t.class=null),t[Zs]&&(t.style??=null);var d=Yd(n);for(const y in t){let w=t[y];if(u&&y==="value"&&w==null){n.value=n.__value="",h[y]=w;continue}if(y==="class"){var f=n.namespaceURI==="http://www.w3.org/1999/xhtml";Bn(n,f,w,i,e?.[Ln],t[Ln]),h[y]=w,h[Ln]=t[Ln];continue}if(y==="style"){eh(n,w,e?.[Zs],t[Zs]),h[y]=w,h[Zs]=t[Zs];continue}var p=h[y];if(!(w===p&&!(w===void 0&&n.hasAttribute(y)))){h[y]=w;var g=y[0]+y[1];if(g!=="$$")if(g==="on"){const R={},D="$$"+y;let C=y.slice(2);var m=w0(C);if(_0(C)&&(C=C.slice(0,-7),R.capture=!0),!m&&p){if(w!=null)continue;n.removeEventListener(C,h[D],R),h[D]=null}if(w!=null)if(m)n[`__${C}`]=w,Xl([C]);else{let O=function(N){h[y].call(this,N)};h[D]=v0(C,n,O,R)}else m&&(n[`__${C}`]=void 0)}else if(y==="style")Lt(n,y,w);else if(y==="autofocus")s0(n,!!w);else if(!a&&(y==="__value"||y==="value"&&w!=null))n.value=n.__value=w;else if(y==="selected"&&u)z0(n,w);else{var v=y;l||(v=E0(v));var _=v==="defaultValue"||v==="defaultChecked";if(w==null&&!a&&!_)if(o[y]=null,v==="value"||v==="checked"){let R=n;const D=e===void 0;if(v==="value"){let C=R.defaultValue;R.removeAttribute(v),R.defaultValue=C,R.value=R.__value=D?C:null}else{let C=R.defaultChecked;R.removeAttribute(v),R.defaultChecked=C,R.checked=D?C:!1}}else n.removeAttribute(y);else _||d.includes(v)&&(a||typeof w!="string")?(n[v]=w,v in o&&(o[v]=Dt)):typeof w!="function"&&Lt(n,v,w)}}}return h}function Zo(n,e,t=[],i=[],r=[],s,o=!1,a=!1){ed(r,t,i,l=>{var h=void 0,u={},c=n.nodeName==="SELECT",d=!1;if(md(()=>{var p=e(...l.map(F)),g=G0(n,h,p,s,o,a);d&&c&&"value"in p&&qo(n,p.value);for(let v of Object.getOwnPropertySymbols(u))p[v]||St(u[v]);for(let v of Object.getOwnPropertySymbols(p)){var m=p[v];v.description===v_&&(!h||m!==h[v])&&(u[v]&&St(u[v]),u[v]=si(()=>L0(n,()=>m))),g[v]=m}h=g}),c){var f=n;Vo(()=>{qo(f,h.value,!0),Gd(f)})}d=!0})}function jd(n){return n.__attributes??={[Vd]:n.nodeName.includes("-"),[Wd]:n.namespaceURI===m_}}var Xd=new Map;function Yd(n){var e=n.getAttribute("is")||n.nodeName,t=Xd.get(e);if(t)return t;Xd.set(e,t=[]);for(var i,r=n,s=Element.prototype;s!==r;){i=x_(r);for(var o in i)i[o].set&&t.push(o);r=kc(r)}return t}function qd(n,e,t=e){var i=new WeakSet;fd(n,"input",async r=>{var s=r?n.defaultValue:n.value;if(s=th(n)?ih(s):s,t(s),Je!==null&&i.add(Je),await g0(),s!==(s=e())){var o=n.selectionStart,a=n.selectionEnd,l=n.value.length;if(n.value=s??"",a!==null){var h=n.value.length;o===a&&a===l&&h>l?(n.selectionStart=h,n.selectionEnd=h):(n.selectionStart=o,n.selectionEnd=Math.min(a,h))}}}),Dn(e)==null&&n.value&&(t(th(n)?ih(n.value):n.value),Je!==null&&i.add(Je)),Vl(()=>{var r=e();if(n===document.activeElement){var s=Ns??Je;if(i.has(s))return}th(n)&&r===ih(n.value)||n.type==="date"&&!r&&!n.value||r!==n.value&&(n.value=r??"")})}function th(n){var e=n.type;return e==="number"||e==="range"}function ih(n){return n===""?null:+n}function Zd(n,e){return n===e||n?.[rr]===e}function Ko(n={},e,t,i){return Vo(()=>{var r,s;return Vl(()=>{r=s,s=[],Dn(()=>{n!==t(...s)&&(e(n,...s),r&&Zd(t(...r),n)&&e(null,...r))})}),()=>{or(()=>{s&&Zd(t(...s),n)&&e(null,...s)})}}),n}let Qo=!1;function V0(n){var e=Qo;try{return Qo=!1,[n(),Qo]}finally{Qo=e}}const W0={get(n,e){if(!n.exclude.includes(e))return n.props[e]},set(n,e){return!1},getOwnPropertyDescriptor(n,e){if(!n.exclude.includes(e)&&e in n.props)return{enumerable:!0,configurable:!0,value:n.props[e]}},has(n,e){return n.exclude.includes(e)?!1:e in n.props},ownKeys(n){return Reflect.ownKeys(n.props).filter(e=>!n.exclude.includes(e))}};function Jo(n,e,t){return new Proxy({props:n,exclude:e},W0)}function Be(n,e,t,i){var r=(t&d_)!==0,s=(t&f_)!==0,o=i,a=!0,l=()=>(a&&(a=!1,o=s?Dn(i):i),o),h;if(r){var u=rr in n||S_ in n;h=Nr(n,e)?.set??(u&&e in n?_=>n[e]=_:void 0)}var c,d=!1;r?[c,d]=V0(()=>n[e]):c=n[e],c===void 0&&i!==void 0&&(c=l(),h&&(D_(),h(c)));var f;if(f=()=>{var _=n[e];return _===void 0?l():(a=!0,_)},(t&c_)===0)return f;if(h){var p=n.$$legacy;return(function(_,y){return arguments.length>0?((!y||p||d)&&h(y?f():_),_):f()})}var g=!1,m=((t&u_)!==0?zo:td)(()=>(g=!1,f()));r&&F(m);var v=it;return(function(_,y){if(arguments.length>0){const w=y?F(m):r?Wi(_):_;return _e(m,w),g=!0,o!==void 0&&(o=w),_}return ur&&g||(v.f&fn)!==0?m.v:F(m)})}const j0=".btn.svelte-sgoebi{display:inline-flex;flex-wrap:nowrap;flex-shrink:0;justify-content:center;align-items:center;gap:.375rem;cursor:pointer;text-align:center;vertical-align:middle;user-select:none;-webkit-user-select:none;touch-action:manipulation;font-weight:600;height:var(--size);padding-inline:var(--btn-p);font-size:var(--fontsize, .875rem);color:var(--btn-fg);background-color:var(--btn-bg);border-width:var(--tri-border);border-style:solid;border-color:var(--btn-border);border-start-start-radius:var(--join-ss, var(--tri-radius-buttons));border-start-end-radius:var(--join-se, var(--tri-radius-buttons));border-end-end-radius:var(--join-ee, var(--tri-radius-buttons));border-end-start-radius:var(--join-es, var(--tri-radius-buttons));outline-offset:2px;outline-color:var(--btn-color, var(--tri-content));text-shadow:0 .5px oklch(100% 0 0 / calc(var(--tri-depth) * .15));box-shadow:0 .5px 0 .5px oklch(100% 0 0 / calc(var(--tri-depth) * 6%)) inset,var(--btn-shadow);transition-property:color,background-color,border-color,box-shadow;transition-duration:.2s;transition-timing-function:cubic-bezier(0,0,.2,1);--size: calc(var(--tri-size-field, .25rem) * 10);--btn-bg: var(--btn-color, var(--tri-toolbar-bg));--btn-fg: var(--tri-content);--btn-p: 1rem;--btn-border: color-mix( in oklab, var(--btn-bg), #000 calc(var(--tri-depth) * 5%) );--btn-shadow: 0 3px 2px -2px color-mix( in oklab, var(--btn-bg) calc(var(--tri-depth) * 30%), #0000 ), 0 4px 3px -2px color-mix( in oklab, var(--btn-bg) calc(var(--tri-depth) * 30%), #0000 )}@media(hover:hover){.btn.svelte-sgoebi:hover{--btn-bg: color-mix( in oklab, var(--btn-color, var(--tri-toolbar-bg)), #000 7% )}}.btn.svelte-sgoebi:focus-visible{isolation:isolate;outline-width:2px;outline-style:solid}.btn.svelte-sgoebi:active:not(.active){--btn-bg: color-mix( in oklab, var(--btn-color, var(--tri-toolbar-bg)), #000 5% );--btn-border: color-mix( in oklab, var(--btn-color, var(--tri-toolbar-bg)), #000 7% );--btn-shadow: 0 0 0 0 oklch(0% 0 0 / 0), 0 0 0 0 oklch(0% 0 0 / 0);translate:0 .5px}.btn.active.svelte-sgoebi{--btn-bg: color-mix( in oklab, var(--btn-color, var(--tri-toolbar-bg)), #000 7% )}.btn.svelte-sgoebi:disabled,.btn[disabled].svelte-sgoebi{pointer-events:none;--btn-border: #0000;--btn-fg: color-mix(in oklch, var(--tri-content) 20%, #0000)}.btn.svelte-sgoebi:disabled:not(.ghost):not(.outline),.btn[disabled].svelte-sgoebi:not(.ghost):not(.outline){background-color:color-mix(in oklab,var(--tri-content) 10%,transparent);box-shadow:none}.circle.svelte-sgoebi{width:var(--size);height:var(--size);border-radius:3.40282e38px;padding-inline:0}.square.svelte-sgoebi{width:var(--size);height:var(--size);padding-inline:0}.ghost.svelte-sgoebi{--btn-bg: transparent;--btn-border: transparent;--btn-fg: var(--btn-color-text, var(--btn-color, var(--tri-content)));box-shadow:none;text-shadow:none}@media(hover:hover){.ghost.svelte-sgoebi:hover{--btn-bg: color-mix(in oklab, var(--tri-content) 10%, transparent)}}.ghost.svelte-sgoebi:active:not(.active),.ghost.active.svelte-sgoebi{--btn-bg: color-mix(in oklab, var(--tri-content) 10%, transparent);--btn-border: transparent}.outline.svelte-sgoebi:not(:hover):not(:active):not(:focus-visible):not(.active):not(:disabled):not([disabled]){--btn-bg: transparent;--btn-fg: var(--btn-color-text, var(--btn-color, var(--tri-content)));--btn-border: var(--btn-color, var(--tri-content));box-shadow:none;text-shadow:none}.select-wrapper.svelte-1hwvamm{display:inline-flex;width:clamp(3rem,20rem,100%);max-width:100%}.native-select.svelte-1hwvamm{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;pointer-events:none}.select.svelte-1hwvamm{border:var(--tri-border) solid var(--input-color);appearance:none;background-color:var(--tri-input-bg);vertical-align:middle;width:100%;height:var(--size);touch-action:manipulation;white-space:nowrap;box-shadow:0 1px color-mix(in oklab,var(--input-color) calc(var(--tri-depth) * 10%),#0000) inset,0 -1px oklch(100% 0 0 / calc(var(--tri-depth) * .1)) inset;--input-color: color-mix(in oklab, var(--tri-content) 20%, #0000);--size: calc(var(--tri-size-field, .25rem) * 10);background-image:linear-gradient(45deg,#0000 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,#0000 50%);background-position:calc(100% - 20px) calc(1px + 50%),calc(100% - 16.1px) calc(1px + 50%);background-repeat:no-repeat;background-size:4px 4px,4px 4px;border-start-start-radius:var(--join-ss, var(--tri-radius-buttons));border-start-end-radius:var(--join-se, var(--tri-radius-buttons));border-end-end-radius:var(--join-ee, var(--tri-radius-buttons));border-end-start-radius:var(--join-es, var(--tri-radius-buttons));align-items:center;gap:.375rem;padding-inline:.75rem 1.75rem;font-size:.875rem;display:inline-flex;position:relative;cursor:pointer;color:inherit;text-align:start}.select-label.svelte-1hwvamm{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select-label.placeholder.svelte-1hwvamm{color:color-mix(in oklab,var(--tri-content) 55%,transparent)}.select.svelte-1hwvamm:hover:not(:disabled){--input-color: color-mix(in oklab, var(--tri-content) 40%, #0000)}.select.svelte-1hwvamm:focus-visible,.select.open.svelte-1hwvamm{--input-color: var(--tri-content);box-shadow:0 1px color-mix(in oklab,var(--input-color) calc(var(--tri-depth) * 10%),#0000);outline:2px solid var(--input-color);outline-offset:2px;isolation:isolate;z-index:1}.select.svelte-1hwvamm:is(:where(.svelte-1hwvamm):disabled,[disabled]:where(.svelte-1hwvamm)){cursor:not-allowed;border-color:var(--tri-panel-bg);background-color:var(--tri-panel-bg);color:color-mix(in oklab,var(--tri-content) 40%,transparent)}.ghost.svelte-1hwvamm{box-shadow:none;background-color:#0000;border-color:#0000;transition:background-color .2s}.ghost.svelte-1hwvamm:hover:not(:disabled){background-color:color-mix(in oklab,var(--tri-content) 8%,transparent)}.ghost.svelte-1hwvamm:focus-visible,.ghost.open.svelte-1hwvamm{background-color:var(--tri-input-bg);color:var(--tri-content)}.listbox.svelte-1hwvamm{position:fixed;inset:auto;margin:0;padding:.1875rem;border:var(--tri-border) solid color-mix(in oklab,var(--tri-content) 20%,#0000);background-color:var(--tri-input-bg);color:var(--tri-content);border-radius:var(--tri-radius-buttons);box-shadow:0 8px 24px oklch(0 0 0 / calc(.12 + var(--tri-depth) * .06));max-height:16rem;overflow-y:auto;min-width:8rem;z-index:1}.listbox.svelte-1hwvamm:not(:popover-open){display:none}.option.svelte-1hwvamm{padding:.25rem .5rem;border-radius:calc(var(--tri-radius-buttons) * .6);cursor:pointer;font-size:.8125rem;line-height:1.3;white-space:nowrap;color:inherit}.option.active.svelte-1hwvamm{background-color:color-mix(in oklab,var(--tri-content) 12%,#0000)}.option.selected.svelte-1hwvamm{background-color:color-mix(in oklab,var(--tri-color-primary) 90%,#0000);color:var(--tri-color-primary-content)}.option.selected.active.svelte-1hwvamm{background-color:var(--tri-color-primary)}.option[aria-disabled=true].svelte-1hwvamm{opacity:.5;cursor:not-allowed;color:color-mix(in oklab,var(--tri-content) 55%,transparent)}.input.svelte-4x2zrp{cursor:text;border:var(--tri-border) solid var(--input-color);appearance:none;background-color:var(--tri-input-bg);vertical-align:middle;width:clamp(3rem,20rem,100%);height:var(--size);font-size:max(var(--font-size, .875rem),.875rem);touch-action:manipulation;box-shadow:0 1px color-mix(in oklab,var(--input-color) calc(var(--tri-depth) * 10%),#0000) inset,0 -1px oklch(100% 0 0 / calc(var(--tri-depth) * .1)) inset;--size: calc(var(--tri-size-field, .25rem) * 10);--input-color: color-mix(in oklab, var(--tri-content) 20%, #0000);border-start-start-radius:var(--join-ss, var(--tri-radius-buttons));border-start-end-radius:var(--join-se, var(--tri-radius-buttons));border-end-end-radius:var(--join-ee, var(--tri-radius-buttons));border-end-start-radius:var(--join-es, var(--tri-radius-buttons));flex-shrink:1;align-items:center;gap:.5rem;padding-inline:.75rem;display:inline-flex;position:relative;color:inherit}.input.svelte-4x2zrp:focus,.input.svelte-4x2zrp:focus-within{--input-color: var(--tri-content);box-shadow:0 1px color-mix(in oklab,var(--input-color) calc(var(--tri-depth) * 10%),#0000);outline:2px solid var(--input-color);outline-offset:2px;isolation:isolate;z-index:1}.input.svelte-4x2zrp:is(:where(.svelte-4x2zrp):disabled,[disabled]:where(.svelte-4x2zrp)){cursor:not-allowed;border-color:var(--tri-panel-bg);background-color:var(--tri-panel-bg);color:color-mix(in oklab,var(--tri-content) 40%,transparent);box-shadow:none}.input.svelte-4x2zrp:is(:where(.svelte-4x2zrp):disabled,[disabled]:where(.svelte-4x2zrp))::placeholder{color:color-mix(in oklab,var(--tri-content) 20%,transparent)}.ghost.svelte-4x2zrp{box-shadow:none;background-color:#0000;border-color:#0000}.ghost.svelte-4x2zrp:focus,.ghost.svelte-4x2zrp:focus-within{background-color:var(--tri-input-bg);color:var(--tri-content);box-shadow:none;border-color:#0000}.tooltip.svelte-1cfjd3n{--tt-bg: var(--tri-color-neutral);--tt-fg: var(--tri-color-neutral-content);--tt-off: calc(100% + .5rem) ;--tt-tail: calc(100% + 1px + .25rem) ;display:inline-block;position:relative}.tooltip[data-tip].svelte-1cfjd3n:not([data-tip=\"\"]):before{border-radius:var(--tri-radius-buttons);text-align:center;white-space:normal;max-width:20rem;color:var(--tt-fg);opacity:0;background-color:var(--tt-bg);pointer-events:none;z-index:2;content:attr(data-tip);width:max-content;padding-block:.25rem;padding-inline:.5rem;font-size:.875rem;line-height:1.25;position:absolute}.tooltip[data-tip].svelte-1cfjd3n:not([data-tip=\"\"]):after{opacity:0;background-color:var(--tt-bg);content:\"\";pointer-events:none;--mask-tooltip: url(\"data:image/svg+xml,%3Csvg width='10' height='4' viewBox='0 0 8 4' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0.500009 1C3.5 1 3.00001 4 5.00001 4C7 4 6.5 1 9.5 1C10 1 10 0.499897 10 0H0C-1.99338e-08 0.5 0 1 0.500009 1Z' fill='black'/%3E%3C/svg%3E%0A\");width:.625rem;height:.25rem;mask-position:-1px 0;mask-repeat:no-repeat;mask-image:var(--mask-tooltip);display:block;position:absolute}@media(prefers-reduced-motion:no-preference){.tooltip[data-tip].svelte-1cfjd3n:before,.tooltip[data-tip].svelte-1cfjd3n:after{transition:opacity .2s cubic-bezier(.4,0,.2,1) 75ms,transform .2s cubic-bezier(.4,0,.2,1) 75ms}}.tooltip[data-tip].svelte-1cfjd3n:not([data-tip=\"\"]):hover:before,.tooltip[data-tip].svelte-1cfjd3n:not([data-tip=\"\"]):hover:after,.tooltip[data-tip].svelte-1cfjd3n:not([data-tip=\"\"]):has(:focus-visible):before,.tooltip[data-tip].svelte-1cfjd3n:not([data-tip=\"\"]):has(:focus-visible):after,.tooltip-open[data-tip].svelte-1cfjd3n:not([data-tip=\"\"]):before,.tooltip-open[data-tip].svelte-1cfjd3n:not([data-tip=\"\"]):after{opacity:1;--tt-pos: 0rem}@media(prefers-reduced-motion:no-preference){.tooltip[data-tip].svelte-1cfjd3n:not([data-tip=\"\"]):hover:before,.tooltip[data-tip].svelte-1cfjd3n:not([data-tip=\"\"]):hover:after,.tooltip[data-tip].svelte-1cfjd3n:not([data-tip=\"\"]):has(:focus-visible):before,.tooltip[data-tip].svelte-1cfjd3n:not([data-tip=\"\"]):has(:focus-visible):after{transition:opacity .2s cubic-bezier(.4,0,.2,1),transform .2s cubic-bezier(.4,0,.2,1)}}.top.svelte-1cfjd3n:before{transform:translate(-50%) translateY(var(--tt-pos, .25rem));inset:auto auto var(--tt-off) 50%}.top.svelte-1cfjd3n:after{transform:translate(-50%) translateY(var(--tt-pos, .25rem));inset:auto auto var(--tt-tail) 50%}.bottom.svelte-1cfjd3n:before{transform:translate(-50%) translateY(var(--tt-pos, -.25rem));inset:var(--tt-off) auto auto 50%}.bottom.svelte-1cfjd3n:after{transform:translate(-50%) translateY(var(--tt-pos, -.25rem)) rotate(180deg);inset:var(--tt-tail) auto auto 50%}.left.svelte-1cfjd3n:before{transform:translate(calc(var(--tt-pos, .25rem) - .25rem)) translateY(-50%);inset:50% var(--tt-off) auto auto}.left.svelte-1cfjd3n:after{transform:translate(var(--tt-pos, .25rem)) translateY(-50%) rotate(-90deg);inset:50% calc(var(--tt-tail) + 1px) auto auto}.right.svelte-1cfjd3n:before{transform:translate(calc(var(--tt-pos, -.25rem) + .25rem)) translateY(-50%);inset:50% auto auto var(--tt-off)}.right.svelte-1cfjd3n:after{transform:translate(var(--tt-pos, -.25rem)) translateY(-50%) rotate(90deg);inset:50% auto auto calc(var(--tt-tail) + 1px)}.card.svelte-u681vn{position:relative;display:flex;flex-direction:column;border-radius:var(--tri-radius-panels)}.tri-ae-glyph.svelte-u681vn{display:inline-block;vertical-align:middle;flex-shrink:0}.bodies.svelte-u681vn{display:flex;flex-direction:column;gap:.75rem;padding-right:.25rem}.bodies-scroll.svelte-u681vn{max-height:40vh;overflow-y:auto}.body-card.svelte-u681vn{background-color:var(--panel-surface);padding:.5rem;display:flex;flex-direction:column;gap:.5rem}.body-row.svelte-u681vn{display:flex;align-items:center;gap:.5rem}.body-row.svelte-u681vn .body-purpose{flex:1 1 0%}.body-row.svelte-u681vn .body-remove{color:var(--tri-color-error)}.purpose-option.svelte-u681vn{text-transform:capitalize}.body-card.svelte-u681vn .body-input{width:100%}.body-textarea.svelte-u681vn{border:var(--tri-border, 1px) solid #0000;border-color:var(--input-color);min-height:5rem;flex-shrink:1;appearance:none;border-radius:var(--tri-radius-buttons);background-color:var(--tri-input-bg);padding-block:.5rem;vertical-align:middle;width:100%;padding-inline-start:.75rem;padding-inline-end:.75rem;font-size:max(var(--font-size, .6875rem),.6875rem);touch-action:manipulation;color:inherit;--input-color: color-mix(in oklab, var(--panel-fg) 20%, #0000)}.body-textarea.svelte-u681vn:focus,.body-textarea.svelte-u681vn:focus-within{--input-color: var(--panel-fg);outline:2px solid var(--input-color);outline-offset:2px;isolation:isolate}.body-textarea.svelte-u681vn:is(:where(.svelte-u681vn):disabled,[disabled]:where(.svelte-u681vn)){cursor:not-allowed;border-color:var(--panel-surface);background-color:var(--panel-surface);color:color-mix(in oklab,var(--panel-fg) 40%,transparent);box-shadow:none}.unknown-body.svelte-u681vn{display:flex;flex-direction:column;gap:.5rem}.unknown-body-note.svelte-u681vn{font-size:.75rem;line-height:1rem;opacity:.7}.unknown-body-preview.svelte-u681vn{display:block;max-height:8rem;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;border-radius:var(--tri-radius-buttons);background-color:var(--tri-input-bg);padding:.5rem;font-size:.6875rem;line-height:1rem}.add-content{width:100%}.save-row.svelte-u681vn{padding-top:.5rem}.save-row.svelte-u681vn .save-btn{width:100%}.panel.svelte-1mu3tdt{min-height:0;display:flex;flex-direction:column}.panel.floating.svelte-1mu3tdt{height:100%;width:20rem;background-color:var(--panel-surface);border-right-width:1px;border-right-style:solid;border-right-color:var(--tri-surface-border);box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a}.panel.floating.svelte-1mu3tdt .content:where(.svelte-1mu3tdt){width:100%}.tri-ae-glyph.svelte-1mu3tdt{display:inline-block;vertical-align:middle;flex-shrink:0}.header.svelte-1mu3tdt{display:flex;align-items:center;padding:1rem;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:var(--tri-surface-border)}.title.svelte-1mu3tdt{font-size:1.125rem;line-height:1.75rem;font-weight:600;display:flex;align-items:center;gap:.5rem}.content.svelte-1mu3tdt{width:100%;padding:1rem;display:flex;flex-direction:column;gap:1.5rem}.content.scroll.svelte-1mu3tdt{flex:1 1 0%;overflow-y:auto}.error-line.svelte-1mu3tdt{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;border-radius:var(--tri-radius-buttons);background-color:color-mix(in oklab,var(--tri-color-error) 15%,var(--panel-surface));color:var(--tri-color-error);font-size:.75rem;line-height:1rem}.error-icon.svelte-1mu3tdt{flex-shrink:0;display:inline-flex}.error-text.svelte-1mu3tdt{flex:1 1 0%}.error-line.svelte-1mu3tdt .error-dismiss{flex-shrink:0;color:var(--tri-color-error)}.mode-section.svelte-1mu3tdt{display:flex;flex-direction:column;gap:.5rem}.mode-instruction.svelte-1mu3tdt{font-size:.75rem;line-height:1rem;opacity:.6;text-align:center}.mode-disabled-reason.svelte-1mu3tdt{font-size:.75rem;line-height:1rem;text-align:center;color:color-mix(in oklab,var(--panel-fg) 70%,transparent)}.tool-section.svelte-1mu3tdt{display:flex;flex-direction:column;gap:.5rem}.tool-label.svelte-1mu3tdt{font-size:.875rem;line-height:1.25rem;font-weight:500}.tool-section.svelte-1mu3tdt .tool-tip{display:inline-flex}.undo-redo.svelte-1mu3tdt{display:flex;gap:.5rem}.undo-redo.svelte-1mu3tdt .undo-redo-btn{flex:1 1 0%}.card.svelte-1mu3tdt{position:relative;display:flex;flex-direction:column;border-radius:var(--tri-radius-panels)}.editor-card.svelte-1mu3tdt{background-color:var(--tri-input-bg);padding:1rem;display:flex;flex-direction:column;gap:.75rem}.editor-header.svelte-1mu3tdt{display:flex;align-items:center;justify-content:space-between;margin-bottom:.5rem}.editor-title.svelte-1mu3tdt{font-weight:500;font-size:.875rem;line-height:1.25rem}.editor-actions.svelte-1mu3tdt{display:flex;gap:.25rem}.editor-actions.svelte-1mu3tdt .delete-btn{color:var(--tri-color-error)}.custom-body-editor.svelte-1mu3tdt{width:100%}.hydrating-note.svelte-1mu3tdt{font-size:.75rem;line-height:1rem;opacity:.6}.join.svelte-1mu3tdt{display:inline-flex;align-items:stretch;--join-ss: 0;--join-se: 0;--join-es: 0;--join-ee: 0}.join.svelte-1mu3tdt>.join-item:first-child{--join-ss: var(--tri-radius-buttons);--join-es: var(--tri-radius-buttons)}.join.svelte-1mu3tdt>.join-item:last-child{--join-se: var(--tri-radius-buttons);--join-ee: var(--tri-radius-buttons)}.join.svelte-1mu3tdt>.join-item:not(:first-child){margin-inline-start:calc(var(--tri-border, 1px) * -1)}.mode-toggle.svelte-1mu3tdt{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%}.modal.svelte-1mu3tdt{pointer-events:none;visibility:hidden;position:fixed;inset:0;margin:0;display:grid;height:100%;max-height:none;width:100%;max-width:none;align-items:center;justify-items:center;background-color:transparent;padding:0;color:inherit;overflow:clip;overscroll-behavior:contain;z-index:999}.modal.svelte-1mu3tdt::backdrop{display:none}.modal.modal-open.svelte-1mu3tdt{pointer-events:auto;visibility:visible;opacity:100%;background-color:#0006}.modal-box.svelte-1mu3tdt{grid-column-start:1;grid-row-start:1;max-height:100vh;width:calc(11 / 12 * 100%);max-width:32rem;background-color:var(--tri-input-bg);padding:1.5rem;border-radius:var(--tri-radius-panels);box-shadow:#00000040 0 25px 50px -12px;overflow-y:auto;overscroll-behavior:contain}.modal-title.svelte-1mu3tdt{font-weight:700;font-size:1.125rem;line-height:1.75rem;display:flex;align-items:center;gap:.5rem}.modal-warning-icon.svelte-1mu3tdt{color:var(--tri-color-warning);display:inline-flex}.modal-message.svelte-1mu3tdt{padding-block:1rem}.modal-action.svelte-1mu3tdt{margin-top:1.5rem;display:flex;justify-content:flex-end;gap:.5rem}.modal-backdrop.svelte-1mu3tdt{grid-column-start:1;grid-row-start:1;display:grid;align-self:stretch;justify-self:stretch;color:transparent;z-index:-1}.modal-backdrop.svelte-1mu3tdt button:where(.svelte-1mu3tdt){cursor:pointer}\n",X0="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(X0);const Kd=Symbol("triiiceratops:viewer-state");var Y0=["forEach","isDisjointFrom","isSubsetOf","isSupersetOf"],q0=["difference","intersection","symmetricDifference","union"],Qd=!1;class $o extends Set{#e=new Map;#t=Ge(0);#i=Ge(0);#n=Di||-1;constructor(e){if(super(),e){for(var t of e)super.add(t);this.#i.v=super.size}Qd||this.#s()}#r(e){return Di===this.#n?Ge(e):mn(e)}#s(){Qd=!0;var e=$o.prototype,t=Set.prototype;for(const i of Y0)e[i]=function(...r){return F(this.#t),t[i].apply(this,r)};for(const i of q0)e[i]=function(...r){F(this.#t);var s=t[i].apply(this,r);return new $o(s)}}has(e){var t=super.has(e),i=this.#e,r=i.get(e);if(r===void 0){if(!t)return F(this.#t),!1;r=this.#r(!0),i.set(e,r)}return F(r),t}add(e){return super.has(e)||(super.add(e),_e(this.#i,super.size),ui(this.#t)),this}delete(e){var t=super.delete(e),i=this.#e,r=i.get(e);return r!==void 0&&(i.delete(e),_e(r,!1)),t&&(_e(this.#i,super.size),ui(this.#t)),t}clear(){if(super.size!==0){super.clear();var e=this.#e;for(var t of e.values())_e(t,!1);e.clear(),_e(this.#i,0),ui(this.#t)}}keys(){return this.values()}values(){return F(this.#t),super.values()}entries(){return F(this.#t),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return F(this.#i)}}class Xr extends Map{#e=new Map;#t=Ge(0);#i=Ge(0);#n=Di||-1;constructor(e){if(super(),e){for(var[t,i]of e)super.set(t,i);this.#i.v=super.size}}#r(e){return Di===this.#n?Ge(e):mn(e)}has(e){var t=this.#e,i=t.get(e);if(i===void 0){var r=super.get(e);if(r!==void 0)i=this.#r(0),t.set(e,i);else return F(this.#t),!1}return F(i),!0}forEach(e,t){this.#s(),super.forEach(e,t)}get(e){var t=this.#e,i=t.get(e);if(i===void 0){var r=super.get(e);if(r!==void 0)i=this.#r(0),t.set(e,i);else{F(this.#t);return}}return F(i),super.get(e)}set(e,t){var i=this.#e,r=i.get(e),s=super.get(e),o=super.set(e,t),a=this.#t;if(r===void 0)r=this.#r(0),i.set(e,r),_e(this.#i,super.size),ui(a);else if(s!==t){ui(r);var l=a.reactions===null?null:new Set(a.reactions),h=l===null||!r.reactions?.every(u=>l.has(u));h&&ui(a)}return o}delete(e){var t=this.#e,i=t.get(e),r=super.delete(e);return i!==void 0&&(t.delete(e),_e(this.#i,super.size),_e(i,-1),ui(this.#t)),r}clear(){if(super.size!==0){super.clear();var e=this.#e;_e(this.#i,0);for(var t of e.values())_e(t,-1);ui(this.#t),e.clear()}}#s(){F(this.#t);var e=this.#e;if(this.#i.v!==e.size){for(var t of super.keys())if(!e.has(t)){var i=this.#r(0);e.set(t,i)}}for([,i]of this.#e)F(i)}keys(){return F(this.#t),super.keys()}values(){return this.#s(),super.values()}entries(){return this.#s(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return F(this.#i),super.size}}class Ks{id="localStorage";name="Local Storage";static KEY_PREFIX="@triiiceratops/plugin-annotation-editor:v1";storageKey(e,t){return`${Ks.KEY_PREFIX}:${encodeURIComponent(e)}:${encodeURIComponent(t)}`}async load(e,t){const i=await this.loadFromStorage(e,t);for(const r of i)r.__fullBodyLoaded=!0;return i}async hydrate(e,t,i){const s=(await this.loadFromStorage(e,t)).find(o=>o.id===i)??null;return s?(s.__fullBodyLoaded=!0,s):null}async create(e,t,i){const r=await this.loadFromStorage(e,t);r.push(i),this.saveToStorage(e,t,r)}async update(e,t,i){const r=await this.loadFromStorage(e,t),s=r.findIndex(o=>o.id===i.id);s>=0&&(r[s]=i,this.saveToStorage(e,t,r))}async delete(e,t,i){const s=(await this.loadFromStorage(e,t)).filter(o=>o.id!==i);this.saveToStorage(e,t,s)}async loadFromStorage(e,t){const i=this.storageKey(e,t),r=localStorage.getItem(i);return r?JSON.parse(r):[]}saveToStorage(e,t,i){const r=this.storageKey(e,t);localStorage.setItem(r,JSON.stringify(i))}}class Yr{static W3C_CONTEXT="http://www.w3.org/ns/anno.jsonld";static DEFAULT_MOTIVATION="commenting";adapter;config;onReconcileId;onReplay;manifestId=null;canvasId=null;displayState=null;persistedAnnotations=new Xr;hydrationState=new Xr;saveQueue=new Xr;loadSequence=0;injectedCanvases=new $o;static UNDO_DEPTH=50;undoStack=[];redoStack=[];replaying=!1;lastCreateCanonical=null;#e=Ge(!1);get _canUndo(){return F(this.#e)}set _canUndo(e){_e(this.#e,e,!0)}#t=Ge(!1);get _canRedo(){return F(this.#t)}set _canRedo(e){_e(this.#t,e,!0)}#i=Ge(null);get _panelError(){return F(this.#i)}set _panelError(e){_e(this.#i,e,!0)}constructor(e){this.config=e,this.adapter=e.adapter??new Ks}setDisplayState(e){this.displayState=e}get currentManifestId(){return this.manifestId}get currentCanvasId(){return this.canvasId}get ready(){return this.manifestId!==null&&this.canvasId!==null}get hydrateSupported(){return typeof this.adapter.hydrate=="function"}get panelError(){return this._panelError}dismissError(){this._panelError=null}get canUndo(){return this._canUndo}get canRedo(){return this._canRedo}setCanvas(e,t){this.manifestId=e,this.canvasId=t,this.persistedAnnotations.clear(),this.hydrationState.clear(),this._panelError=null,this.clearHistory()}get(e){return this.persistedAnnotations.get(e)??null}has(e){return this.persistedAnnotations.has(e)}isSkeleton(e){return this.hydrationState.get(e)==="skeleton"}async load(){if(!this.ready)return[];const e=++this.loadSequence;let t;try{t=await this.adapter.load(this.manifestId,this.canvasId)}catch(i){return e!==this.loadSequence?[]:(this.reportError("load",void 0,i,()=>this.load().then(()=>{})),[])}return e!==this.loadSequence?[]:(this.cachePersistedAnnotations(t),this.syncDisplay(),this._panelError=null,t)}async persist(e){if(!this.ready)return!1;const t=this.manifestId,i=this.canvasId,r=e.id,s=this.stripInternalMarkers(e);let o=!1;const a=async()=>{if(this.persistedAnnotations.has(r)){const c=this.persistedAnnotations.get(r),d=this.stampForUpdate(s);try{const f=await this.adapter.update(t,i,d),p=f&&typeof f=="object"?this.stripInternalMarkers(f):d;this.persistedAnnotations.set(r,p),this.hydrationState.set(r,"full"),this.syncDisplay(),this._panelError=null,o=!0,this.recordForward({kind:"update",before:c,after:p})}catch(f){this.reportError("update",r,f,()=>this.persist(e).then(()=>{}))}}else{const c=this.stampForCreate(s);try{const d=await this.adapter.create(t,i,c),f=this.reconcileCreate(r,c,d);this.lastCreateCanonical=f,this.syncDisplay(),this._panelError=null,o=!0,this.recordForward({kind:"create",annotation:f})}catch(d){this.reportError("create",r,d,()=>this.persist(e).then(()=>{}))}}},h=(this.saveQueue.get(r)??Promise.resolve()).then(a,a);return this.saveQueue.set(r,h),await h,this.saveQueue.get(r)===h&&this.saveQueue.delete(r),o}async delete(e){if(!this.ready)return!1;const t=this.persistedAnnotations.get(e)??null;try{await this.adapter.delete(this.manifestId,this.canvasId,e)}catch(i){return this.reportError("delete",e,i,()=>this.delete(e).then(()=>{})),!1}return this.persistedAnnotations.delete(e),this.hydrationState.delete(e),this.syncDisplay(),this._panelError=null,t&&this.recordForward({kind:"delete",annotation:t}),!0}async hydrate(e,t){if(!this.ready||!this.adapter.hydrate)return null;const i=this.loadSequence;let r;try{r=await this.adapter.hydrate(this.manifestId,this.canvasId,e)}catch(o){return i!==this.loadSequence||this.reportError("hydrate",e,o,()=>this.hydrate(e,t).then(()=>{})),null}if(!r||i!==this.loadSequence||t&&!t())return null;const s=this.stripInternalMarkers(r);return this.persistedAnnotations.set(e,s),this.hydrationState.set(e,"full"),this._panelError=null,s}async resolve(e){const t=this.persistedAnnotations.get(e);if(t&&this.hydrationState.get(e)!=="skeleton")return t;if(t&&this.hydrateSupported&&this.ready)return await this.hydrate(e)??t;if(!t&&this.ready){const i=await this.adapter.load(this.manifestId,this.canvasId);return this.cachePersistedAnnotations(i),this.syncDisplay(),this.persistedAnnotations.get(e)??null}return t??null}async undo(){const e=this.undoStack.pop();if(this.refreshUndoRedoFlags(),!!e){this.replaying=!0;try{switch(e.kind){case"create":{await this.delete(e.annotation.id)?(this.pushRedo(e),this.onReplay?.(e.annotation.id,null)):this.restoreUndo(e);break}case"update":{await this.persist(e.before)?(this.pushRedo(e),this.onReplay?.(e.before.id,this.get(e.before.id))):this.restoreUndo(e);break}case"delete":{if(await this.persist(e.annotation)){const t=this.lastCreateCanonical??e.annotation;this.pushRedo({kind:"delete",annotation:t}),this.onReplay?.(t.id,this.get(t.id))}else this.restoreUndo(e);break}}}finally{this.replaying=!1}}}async redo(){const e=this.redoStack.pop();if(this.refreshUndoRedoFlags(),!!e){this.replaying=!0;try{switch(e.kind){case"create":{if(await this.persist(e.annotation)){const t=this.lastCreateCanonical??e.annotation;this.pushUndo({kind:"create",annotation:t}),this.onReplay?.(t.id,this.get(t.id))}else this.restoreRedo(e);break}case"update":{await this.persist(e.after)?(this.pushUndo(e),this.onReplay?.(e.after.id,this.get(e.after.id))):this.restoreRedo(e);break}case"delete":{await this.delete(e.annotation.id)?(this.pushUndo(e),this.onReplay?.(e.annotation.id,null)):this.restoreRedo(e);break}}}finally{this.replaying=!1}}}destroy(){this.clearHistory();for(const e of this.injectedCanvases){const[t,i]=e.split("::");this.displayState?.clearUserAnnotations(t,i)}this.injectedCanvases.clear(),this.persistedAnnotations.clear(),this.hydrationState.clear(),this.adapter.destroy?.()}recordForward(e){this.replaying||(this.pushCapped(this.undoStack,e),this.redoStack=[],this.refreshUndoRedoFlags())}pushUndo(e){this.pushCapped(this.undoStack,e),this.refreshUndoRedoFlags()}pushRedo(e){this.pushCapped(this.redoStack,e),this.refreshUndoRedoFlags()}restoreUndo(e){this.undoStack.push(e),this.refreshUndoRedoFlags()}restoreRedo(e){this.redoStack.push(e),this.refreshUndoRedoFlags()}pushCapped(e,t){e.push(t),e.length>Yr.UNDO_DEPTH&&e.shift()}clearHistory(){this.undoStack=[],this.redoStack=[],this.lastCreateCanonical=null,this.refreshUndoRedoFlags()}refreshUndoRedoFlags(){this._canUndo=this.undoStack.length>0,this._canRedo=this.redoStack.length>0}reportError(e,t,i,r){if(this.config.onPersistenceError){this.config.onPersistenceError({op:e,annotationId:t,manifestId:this.manifestId,canvasId:this.canvasId,cause:i,retry:r});return}console.error(`[AnnotationEditor] ${e} failed:`,i),this._panelError={op:e,annotationId:t}}reconcileCreate(e,t,i){let r=t,s=e;typeof i=="string"?(s=i,r={...t,id:i}):i&&typeof i=="object"&&(r=this.stripInternalMarkers(i),s=r.id);const o=s!==e;return o&&(this.persistedAnnotations.delete(e),this.hydrationState.delete(e)),this.persistedAnnotations.set(s,r),this.hydrationState.set(s,"full"),o&&this.onReconcileId?.(e,r),r}stampForCreate(e){const t={...e};return t["@context"]||(t["@context"]=Yr.W3C_CONTEXT),t.type||(t.type="Annotation"),!t.creator&&this.config.user&&(t.creator={id:this.config.user.id,name:this.config.user.name}),t.created||(t.created=new Date().toISOString()),t.motivation||(t.motivation=this.config.defaultMotivation??Yr.DEFAULT_MOTIVATION),t}stampForUpdate(e){return{...e,modified:new Date().toISOString()}}syncDisplay(){if(!this.ready)return;const e=this.manifestId,t=this.canvasId;this.injectedCanvases.add(`${e}::${t}`),this.displayState?.setUserAnnotations(e,t,[...this.persistedAnnotations.values()])}cachePersistedAnnotations(e){this.hydrationState.clear(),this.persistedAnnotations=new Xr(e.map(t=>(this.hydrationState.set(t.id,t.__fullBodyLoaded===!1?"skeleton":"full"),[t.id,this.stripInternalMarkers(t)])))}stripInternalMarkers(e){if(e.__fullBodyLoaded===void 0&&e.__bodyPreview===void 0)return e;const t={...e};return delete t.__fullBodyLoaded,delete t.__bodyPreview,t}}function qr(n){var e,t;return n?.id||n?.["@id"]||((e=n?.__jsonld)==null?void 0:e.id)||((t=n?.__jsonld)==null?void 0:t["@id"])||(typeof n?.getId=="function"?n.getId():null)||null}function Z0(n){return qr(n)||(typeof n?.getCanvasId=="function"?n.getCanvasId():null)||(typeof n?.getId=="function"?n.getId():null)||""}function Jd(n,e){if(!n)return"";if(typeof n=="string")return n;if(typeof n=="object"&&!Array.isArray(n)){const t=n;if("@value"in t){const s=t["@value"];return Array.isArray(s)&&s.length>0?String(s[0]):s===void 0?"":String(s)}const i=Object.keys(t),r=s=>{const o=t[s];if(o!==void 0)return Array.isArray(o)&&o.length>0?String(o[0]):String(o)};for(const s of["en","none"]){const o=r(s);if(o!==void 0)return o}return i.length>0?r(i[0])??"":""}if(Array.isArray(n)&&n.length>0){if(typeof n[0]=="string")return n[0];const t=n,i=o=>o?.value??o?._value,r=(o=>t.find(a=>a.locale===o||a._locale===o||a.language===o))("en");{const o=i(r);if(o)return o}const s=t.find(o=>!o.locale&&!o._locale&&!o.language);{const o=i(s);if(o)return o}return i(t[0])??""}return String(n)}function nh(n){if(!n)return null;const e=n.match(/xywh=(?:pixel:)?([\d.]+),([\d.]+),([\d.]+),([\d.]+)/);return e?[Number(e[1]),Number(e[2]),Number(e[3]),Number(e[4])]:null}function K0(n){const[e]=n.split("#");return e||null}function rh(n){if(!n)return null;if(typeof n=="string")return n;if(Array.isArray(n)){for(const t of n){const i=rh(t);if(i)return i}return null}if(typeof n!="object")return null;const e=n;return typeof e.id=="string"?e.id:typeof e["@id"]=="string"?e["@id"]:e.source?rh(e.source):null}function sh(n){if(!n)return[];if(Array.isArray(n))return n.flatMap(t=>sh(t));if(typeof n!="object")return[];const e=n;return e.item?sh(e.item):[e]}function Q0(n){const e=n.find(i=>i?.type==="FragmentSelector"&&typeof i?.value=="string"&&i.value.includes("xywh="));if(e)return nh(e.value);const t=n.find(i=>typeof i?.value=="string"&&i.value.includes("xywh="));return t?nh(t.value):null}function $d(n){if(!n)return[];if(Array.isArray(n))return n.flatMap(r=>$d(r));const e=rh(n),t=typeof n=="object"&&n&&"selector"in n?sh(n.selector):[],i=Q0(t)||(e?nh(e):null);return[{raw:n,targetId:e,canvasId:e?K0(e):null,selectors:t,xywh:i}]}function J0(n){return n.endsWith("/info.json")?n.slice(0,-10):n}function Zr(n){return typeof n=="number"&&Number.isFinite(n)&&n>0?n:null}function $0(n){const e=n?.__jsonld||n;return{width:Zr(n?.width)||Zr(e?.width)||(typeof n?.getWidth=="function"?Zr(n.getWidth()):null),height:Zr(n?.height)||Zr(e?.height)||(typeof n?.getHeight=="function"?Zr(n.getHeight()):null)}}function ef(n){const e=n?.__jsonld||n;return e?.type==="SpecificResource"&&e!=null&&e.source?e.source:null}function ex(n,e){return e?.type==="Choice"||e?.type==="oa:Choice"||!!n&&!Array.isArray(n)&&(n.type==="Choice"||n.type==="oa:Choice")}function tf(n,e){return e&&(e.items||e.item)?e.items||e.item:Array.isArray(n)?n:n&&(n.items||n.item)?n.items||n.item:[]}function tx({body:n,rawBody:e,canvasId:t,getSelectedChoice:i}){const r=Array.isArray(n)?n:tf(n,null),s=tf(null,e),o=i?.(t);if(o){const a=r.find(h=>qr(h)===o);if(a)return a;const l=s.findIndex(h=>qr(h)===o);if(l>=0)return r[l]||s[l]}return r[0]||s[0]||null}function ix(n){var e;let t=((e=n.getImages)==null?void 0:e.call(n))||[];return(!t||!t.length)&&n.getContent&&(t=n.getContent()),t||[]}function nx(n){var e,t;const i=n?.width||((e=n?.__jsonld)==null?void 0:e.width)||(typeof n?.getWidth=="function"?n.getWidth():null),r=n?.height||((t=n?.__jsonld)==null?void 0:t.height)||(typeof n?.getHeight=="function"?n.getHeight():null);return typeof i!="number"||typeof r!="number"?null:{width:i,height:r}}function rx(n){var e,t;const i=(t=$d(n?.target||((e=n?.__jsonld)==null?void 0:e.target)).find(r=>r.xywh))==null?void 0:t.xywh;return i?{x:i[0],y:i[1],width:i[2],height:i[3]}:null}function sx(n,e){if(typeof n!="string"||!n.trim())return null;const t=n.trim(),i=t.startsWith("pct:"),r=(i?t.slice(4):t).split(",").map(s=>Number(s.trim()));return r.length!==4||r.some(s=>!Number.isFinite(s)||s<0)?null:i?typeof e.width!="number"||typeof e.height!="number"?null:{x:r[0]/100*e.width,y:r[1]/100*e.height,width:r[2]/100*e.width,height:r[3]/100*e.height}:{x:r[0],y:r[1],width:r[2],height:r[3]}}function ox(n,e){var t;const i=n?.__jsonld||n;return sx(((t=i?.selector)==null?void 0:t.type)==="ImageApiSelector"?i.selector.region:null,e)}function ax(n){const e=n?.__jsonld||n,t=ef(n);return!!(n&&(n.id||n["@id"]||e!=null&&e.service||t||e!=null&&e.id||e!=null&&e["@id"]))}function lx(n,e,t){var i;let r=n.getResource?n.getResource():null;if(!r&&n.getBody){const s=n.getBody(),o=((i=n.__jsonld)==null?void 0:i.body)||n.body;ex(s,o)?r=tx({body:s,rawBody:o,canvasId:e,getSelectedChoice:t}):Array.isArray(s)&&s.length>0?r=s[0]:s&&(r=s)}if(r&&!ax(r)&&(r=null),!r){const s=n.__jsonld||n;if(s.body){let o=s.body;if(o.type==="Choice"||o.type==="oa:Choice"){const a=o.items||o.item||[],l=t?.(e);o=(l?a.find(h=>qr(h)===l):null)||a[0]||null}r=Array.isArray(o)?o[0]:o}}return r}function nf(n){return typeof n=="string"?/^https?:\/\/iiif\.io\/api\/image\//.test(n)||n==="level0"||n==="level1"||n==="level2":Array.isArray(n)?n.some(e=>nf(e)):!1}function hx(n){return typeof n=="string"?n||null:Array.isArray(n)&&n.find(e=>typeof e=="string")||null}function ux(n){let e=[];const t=n?.__jsonld||n;return t!=null&&t.service&&(e=Array.isArray(t.service)?t.service:[t.service]),!e.length&&n!=null&&n.getServices&&(e=n.getServices()),e.length&&e.find(i=>{const r=i.getType?i.getType():i.type||i["@type"]||"",s=i.getProfile?i.getProfile():i.profile||"";return r==="ImageService1"||r==="ImageService2"||r==="ImageService3"||nf(s)})||null}function cx(n,e){var t,i;for(const r of[n,e]){if(!r)continue;try{const o=(t=r.getLabel)==null?void 0:t.call(r);if(Array.isArray(o)&&o.length>0){const a=Jd(o);if(a)return a}}catch{}const s=r.label||((i=r.__jsonld)==null?void 0:i.label);if(s){const o=Jd(s);if(o)return o}}return null}function dx(n){const e=ux(n),t=qr(e),i=e?e.getProfile?e.getProfile():e.profile||"":null;return{serviceId:t?J0(t):null,serviceProfile:hx(i)}}function fx(n){if(!n||!n.includes("/iiif/"))return null;const e=n.split("/"),t=e.findIndex(i=>i==="full"||/^\d+,\d+,\d+,\d+$/.test(i));return t>0?e.slice(0,t).join("/"):null}function px(n,e={}){return gx(n,e)[0]||null}function gx(n,e={}){const t=Z0(n);if(!t)return[];const i=nx(n);if(!i)return[];const r=ix(n);return r.length?r.map(s=>{const o=lx(s,t,e.getSelectedChoice),a=ef(o)||o;if(!a)return null;const l=qr(a),h=$0(a),u=dx(a),c=u.serviceId||fx(l),d=rx(s),f=ox(o,h);return{canvasId:t,annotation:s,resource:a,resourceId:l,label:cx(a,s),canvasWidth:i.width,canvasHeight:i.height,resourceWidth:f?.width||h.width,resourceHeight:f?.height||h.height,serviceId:c,serviceProfile:u.serviceProfile,imageApiRegion:f,x:d?d.x/i.width:0,y:d?d.y/i.width:0,width:d?d.width/i.width:1}}).filter(s=>s!==null):[]}function ea(n){return typeof n=="number"&&Number.isFinite(n)&&n>0}function oh(n,e){return!n||!ea(n.canvasWidth)||!ea(n.canvasHeight)||!ea(n.imageWidth)||!ea(n.imageHeight)?null:e==="canvas-to-image"?{scaleX:n.imageWidth/n.canvasWidth,scaleY:n.imageHeight/n.canvasHeight}:{scaleX:n.canvasWidth/n.imageWidth,scaleY:n.canvasHeight/n.imageHeight}}function ah(n,e,t){const i=oh(e,t);return i?{x:n.x*i.scaleX,y:n.y*i.scaleY}:n}function mx(n,e,t){const i=oh(e,t);return i?{x:n.x*i.scaleX,y:n.y*i.scaleY,width:n.width*i.scaleX,height:n.height*i.scaleY}:n}function vx(n,e,t){const i=oh(e,t);if(!i||typeof DOMParser>"u")return n;const r=new DOMParser().parseFromString(n,"image/svg+xml");if(r.documentElement.nodeName==="parsererror")return n;const s=(u,c)=>{const d=Number(u);return Number.isFinite(d)?String(d*(c==="x"?i.scaleX:i.scaleY)):u},o=u=>u&&u.replace(/(-?\d*\.?\d+),(-?\d*\.?\d+)/g,(c,d,f)=>`${s(d,"x")},${s(f,"y")}`),a=(u,c,d)=>{const f=u.getAttribute(c);f!==null&&u.setAttribute(c,s(f,d))};for(const u of Array.from(r.querySelectorAll("polygon, polyline"))){const c=o(u.getAttribute("points"));c!==null&&u.setAttribute("points",c)}for(const u of Array.from(r.querySelectorAll("rect")))a(u,"x","x"),a(u,"y","y"),a(u,"width","x"),a(u,"height","y"),a(u,"rx","x"),a(u,"ry","y");for(const u of Array.from(r.querySelectorAll("circle")))a(u,"cx","x"),a(u,"cy","y"),a(u,"r","x");for(const u of Array.from(r.querySelectorAll("ellipse")))a(u,"cx","x"),a(u,"cy","y"),a(u,"rx","x"),a(u,"ry","y");for(const u of Array.from(r.querySelectorAll("line")))a(u,"x1","x"),a(u,"y1","y"),a(u,"x2","x"),a(u,"y2","y");const l=r.documentElement,h=l.getAttribute("viewBox");if(h){const u=h.trim().split(/\s+/).map(c=>Number(c));u.length===4&&u.every(c=>Number.isFinite(c))&&l.setAttribute("viewBox",[u[0]*i.scaleX,u[1]*i.scaleY,u[2]*i.scaleX,u[3]*i.scaleY].join(" "))}return new XMLSerializer().serializeToString(r.documentElement)}function lh(n,e,t){const i=n.match(/xywh=(pixel:)?(-?\d*\.?\d+),(-?\d*\.?\d+),(-?\d*\.?\d+),(-?\d*\.?\d+)/);if(!i)return n;const r=mx({x:Number(i[2]),y:Number(i[3]),width:Number(i[4]),height:Number(i[5])},e,t);return n.replace(i[0],`xywh=${i[1]||""}${r.x},${r.y},${r.width},${r.height}`)}function ta(n,e,t){if(!n||typeof n!="object")return n;if(Array.isArray(n))return n.map(r=>ta(r,e,t));const i={...n};return i.item&&(i.item=ta(i.item,e,t)),i.selector&&(i.selector=ta(i.selector,e,t)),i.type==="PointSelector"?{...i,...ah({x:Number(i.x),y:Number(i.y)},e,t)}:(typeof i.value=="string"&&i.value.includes("xywh=")&&(i.value=lh(i.value,e,t)),i.type==="SvgSelector"&&typeof i.value=="string"&&(i.value=vx(i.value,e,t)),i)}function Kr(n,e,t){if(!n)return n;if(Array.isArray(n))return n.map(r=>Kr(r,e,t));if(typeof n=="string")return n.includes("xywh=")?lh(n,e,t):n;if(typeof n!="object")return n;const i={...n};return i.source&&(i.source=Kr(i.source,e,t)),i.selector&&(i.selector=ta(i.selector,e,t)),i.id&&typeof i.id=="string"&&i.id.includes("xywh=")&&(i.id=lh(i.id,e,t)),i}function rf(n,e){return ah(n,e,"canvas-to-image")}function sf(n,e){return ah(n,e,"image-to-canvas")}function yx(n,e){return{...n,...n.target?{target:Kr(n.target,e,"canvas-to-image")}:{},...n.on?{on:Kr(n.on,e,"canvas-to-image")}:{}}}function of(n,e){return{...n,...n.target?{target:Kr(n.target,e,"image-to-canvas")}:{},...n.on?{on:Kr(n.on,e,"image-to-canvas")}:{}}}const _x=5;function xx(n){const e=n?.radius;return typeof e=="number"&&Number.isFinite(e)&&e>0?e:_x}const wx=["rectangle","polygon","point"];function af(n){const e=n.tools?.length?n.tools:wx,t=n.defaultTool&&e.includes(n.defaultTool)?n.defaultTool:e[0];return{tools:e,defaultTool:t}}class cr{static ACTIVE_EDIT_ID_EVENT="triiiceratops:annotation-editor:active-edit-id";static DEFAULT_POINT_FILL="#e5484d";static DEFAULT_POINT_STROKE="#e5484d";static DEFAULT_POINT_STROKE_WIDTH=2;static DEFAULT_DRAWING_STYLE={fill:"#1e90ff",fillOpacity:.25,stroke:"#1e90ff",strokeWidth:2};config;store;ownsStore;viewerState;annotorious=null;osdViewer=null;openHandler=null;canvasClickHandler=null;createOSDAnnotator=null;W3CImageFormat=null;OSD=null;editingPointOrigin=new Xr;get currentManifestId(){return this.store.currentManifestId}get currentCanvasId(){return this.store.currentCanvasId}activeEditingAnnotationId=null;lastHandledCanvasKey=null;suppressedEchoIds=new Xr;isDrawingEnabled=!1;activeTool="rectangle";selectedAnnotation=null;resolvedTools;resolvedDefaultTool;onSelectionChange;onAnnotationCreated;onAnnotationHydrationChange;onActiveEditingAnnotationChange;constructor(e,t,i){this.config=e,this.viewerState=i??null,this.ownsStore=!t,this.store=t??new Yr(e),this.viewerState&&this.store.setDisplayState(this.viewerState),this.store.onReconcileId=(o,a)=>this.handleIdReconciled(o,a),this.store.onReplay=(o,a)=>this.handleReplay(o,a);const{tools:r,defaultTool:s}=af(e);this.resolvedTools=r,this.resolvedDefaultTool=s,this.activeTool=s}init(e,t){if(!e)return;this.osdViewer=e,this.store.setCanvas(this.store.currentManifestId,t),(e.world?.getItemCount()??0)>0?this.initAnnotorious(e,t):(this.openHandler=()=>{requestAnimationFrame(()=>{this.initAnnotorious(e,t)})},e.addHandler("open",this.openHandler)),this.canvasClickHandler=r=>{this.isDrawingEnabled&&r.quick&&(r.preventDefaultAction=!0,this.activeTool==="point"&&this.annotorious&&this.handlePointClick(r))},e.addHandler("canvas-click",this.canvasClickHandler)}async initAnnotorious(e,t){if(!this.annotorious)try{if(!this.createOSDAnnotator||!this.W3CImageFormat){const a=await Promise.resolve().then(()=>MM);this.createOSDAnnotator=a.createOSDAnnotator,this.W3CImageFormat=a.W3CImageFormat}if(!this.OSD){const a=await Promise.resolve().then(()=>Tw);this.OSD=a.default||a}const i=t??"",r=this.isDrawingEnabled&&this.activeTool!=="point",s={adapter:this.W3CImageFormat(i),drawingEnabled:r,autoSave:!1,drawingMode:"click",style:a=>this.styleForAnnotation(a)},o=this.createOSDAnnotator(e,s);this.annotorious=o,this.config.user&&o.setUser(this.config.user),this.activeTool!=="point"&&o.setDrawingTool(this.activeTool),this.setupEvents(),this.updateDrawingMode(this.isDrawingEnabled),o.setVisible(!0),this.currentManifestId&&this.currentCanvasId&&this.loadAnnotations()}catch{}}async handlePointClick(e){if(!this.osdViewer||!this.annotorious||this.currentCanvasId===null)return;const t=this.osdViewer.world.getItemAt(0);if(!t)return;const i=this.osdViewer.viewport.pointFromPixel(e.position),r=t.viewportToImageCoordinates(i),s=sf({x:r.x,y:r.y},this.getCurrentCanvasImageDimensions()),o=Math.round(s.x),a=Math.round(s.y),l={"@context":"http://www.w3.org/ns/anno.jsonld",id:`temp-${crypto.randomUUID()}`,type:"Annotation",body:[],target:{type:"SpecificResource",source:this.currentCanvasId,selector:{type:"PointSelector",x:o,y:a}}},h=this.prepareAnnotation(l,{canvasSpace:!0});if(this.onAnnotationCreated?.(h),this.setActiveEditingAnnotationId(h.id),!await this.persistCreate(h)){this.activeEditingAnnotationId===h.id&&this.clearSelectionState();return}await this.selectAnnotationById(this.activeEditingAnnotationId??h.id)}setEditing(e){this.isDrawingEnabled=e,this.annotorious&&(this.updateDrawingMode(e),this.annotorious.setVisible(!0))}updateDrawingMode(e){if(!this.annotorious||!this.osdViewer?.element)return;const t=e&&this.currentCanvasId!==null&&this.resolvedTools.includes(this.activeTool);this.activeTool==="point"?this.annotorious.setDrawingEnabled(!1):this.annotorious.setDrawingEnabled(t),e?this.osdViewer.element.classList.add("annotorious-drawing-mode"):this.osdViewer.element.classList.remove("annotorious-drawing-mode")}isPointAnnotation(e){const t=e?.target?.selector;return(t?.item??t)?.type==="PointSelector"}getPointCoordinates(e){const t=e?.target?.selector;if(t?.type==="PointSelector"&&typeof t.x=="number"&&typeof t.y=="number")return{x:t.x,y:t.y};if(t?.type==="FragmentSelector"&&typeof t.value=="string"){const i=t.value.match(/^xywh=([\d.-]+),([\d.-]+),([\d.-]+),([\d.-]+)$/);if(i){const[,r,s,o,a]=i;return{x:Number(r)+Number(o)/2,y:Number(s)+Number(a)/2}}}return null}toPointSelectorTarget(e){if(e?.target?.selector?.type==="PointSelector"||!this.isPointAnnotation(e))return e;const i=this.getPointCoordinates(e);return i?{...e,target:{type:"SpecificResource",source:e.target?.source??this.currentCanvasId,selector:{type:"PointSelector",x:i.x,y:i.y}}}:e}toAnnotoriousTarget(e){const t=this.getCurrentCanvasImageDimensions(),i=e?.target?.selector;if(i?.type!=="PointSelector")return yx(e,t);const r=rf({x:i.x,y:i.y},t),s=this.pointEditRectImageSize(),o=r.x-s/2,a=r.y-s/2;return{...e,target:{source:e.target?.source??this.currentCanvasId,selector:{type:"FragmentSelector",conformsTo:"http://www.w3.org/TR/media-frags/",value:`xywh=${o},${a},${s},${s}`}}}}pointFromEditingRect(e){const t=this.getCurrentCanvasImageDimensions(),i=this.editingPointOrigin.get(e?.id),r=this.parseFragmentRect(e?.target?.selector?.value);let s=i??null;if(r){const o=sf({x:r.x+r.width/2,y:r.y+r.height/2},t),a={x:Math.round(o.x),y:Math.round(o.y)};(!i||a.x!==i.x||a.y!==i.y)&&(s=a)}return s?{...e,target:{type:"SpecificResource",source:e?.target?.source??this.currentCanvasId,selector:{type:"PointSelector",x:s.x,y:s.y}}}:e}parseFragmentRect(e){if(typeof e!="string")return null;const t=e.match(/xywh=(?:pixel:)?(-?[\d.]+),(-?[\d.]+),(-?[\d.]+),(-?[\d.]+)/);if(!t)return null;const[,i,r,s,o]=t;return{x:Number(i),y:Number(r),width:Number(s),height:Number(o)}}pointEditRectImageSize(){const e=2*xx(this.config.pointStyle),t=this.imageUnitsPerScreenPixel();if(t&&t>0)return t*e;const i=rf({x:e,y:0},this.getCurrentCanvasImageDimensions());return Math.abs(i.x)||e}imageUnitsPerScreenPixel(){const e=this.osdViewer?.viewport,t=this.osdViewer?.world?.getItemAt?.(0);if(!e||!t||!this.OSD?.Point)return null;const i=e.pointFromPixel(new this.OSD.Point(0,0)),r=e.pointFromPixel(new this.OSD.Point(1,0)),s=t.viewportToImageCoordinates(i),o=t.viewportToImageCoordinates(r),a=Math.abs(o.x-s.x);return Number.isFinite(a)&&a>0?a:null}styleForAnnotation(e){if(e?.id&&this.editingPointOrigin.has(e.id)){const t=this.config.pointStyle;return{fill:t?.fill??cr.DEFAULT_POINT_FILL,fillOpacity:1,stroke:t?.stroke??cr.DEFAULT_POINT_STROKE,strokeWidth:t?.strokeWidth??cr.DEFAULT_POINT_STROKE_WIDTH}}return this.config.drawingStyle??cr.DEFAULT_DRAWING_STYLE}getCurrentCanvasImageDimensions(){if(!this.currentManifestId||!this.currentCanvasId)return null;const e=(this.viewerState?.getCanvases(this.currentManifestId)??[]).find(i=>(i?.id||i?.["@id"]||i?.__jsonld?.id||i?.__jsonld?.["@id"]||i?.getCanvasId?.()||i?.getId?.())===this.currentCanvasId),t=e?px(e):null;return!t||typeof t.resourceWidth!="number"||typeof t.resourceHeight!="number"?null:{canvasWidth:t.canvasWidth,canvasHeight:t.canvasHeight,imageWidth:t.resourceWidth,imageHeight:t.resourceHeight}}setTool(e){this.activeTool=e,this.updateDrawingMode(this.isDrawingEnabled),e!=="point"&&this.annotorious?.setDrawingTool(e)}get availableTools(){return this.resolvedTools}get persistenceError(){return this.store.panelError}dismissPersistenceError(){this.store.dismissError()}get canUndo(){return this.store.canUndo}get canRedo(){return this.store.canRedo}async undo(){await this.store.undo()}async redo(){await this.store.redo()}setupEvents(){this.annotorious&&(this.annotorious.on("createAnnotation",e=>{this.handleCreateAnnotation(e)}),this.annotorious.on("updateAnnotation",e=>{this.handleUpdateAnnotation(e)}),this.annotorious.on("deleteAnnotation",e=>{this.handleDeleteAnnotation(e)}),this.annotorious.on("selectionChanged",e=>{const t=e.length>0?this.annotationToCanvasSpace(e[0]):null;this.selectedAnnotation=t,this.setActiveEditingAnnotationId(t?.id??null),this.isPointAnnotation(t)?this.osdViewer.element.classList.add("point-selected"):this.osdViewer.element.classList.remove("point-selected"),this.onSelectionChange?.(t),this.notifyExtensionSelectionChange(t),t?.id?this.hydrateAnnotation(t.id):(this.clearAnnotoriousEditingAnnotation(),this.onAnnotationHydrationChange?.(!1))}))}setActiveEditingAnnotationId(e){this.activeEditingAnnotationId=e,this.onActiveEditingAnnotationChange?.(e),!(typeof window>"u")&&window.dispatchEvent(new CustomEvent(cr.ACTIVE_EDIT_ID_EVENT,{detail:{annotationId:e}}))}resetSelectionFields(){this.selectedAnnotation=null,this.osdViewer?.element?.classList.remove("point-selected"),this.setActiveEditingAnnotationId(null)}clearSelectionState(){this.resetSelectionFields(),this.onSelectionChange?.(null),this.notifyExtensionSelectionChange(null)}clearAnnotoriousEditingAnnotation(){this.resetSelectionFields(),this.clearAnnotationsSuppressed()}clearAnnotationsSuppressed(){if(!this.annotorious)return;const e=this.annotorious.getAnnotations()??[];if(e.length!==0){for(const t of e){const i=t?.id;i&&this.markSuppressedEcho(i)}this.annotorious.clearAnnotations()}}async handleCanvasChange(e,t){const i=`${e}::${t}`;i!==this.lastHandledCanvasKey&&(this.lastHandledCanvasKey=i,this.store.setCanvas(e,t),this.selectedAnnotation=null,this.editingPointOrigin.clear(),this.onSelectionChange?.(null),this.notifyExtensionSelectionChange(null),await this.loadAnnotations())}async loadAnnotations(){if(!(!this.annotorious||!this.store.ready)){this.clearAnnotoriousEditingAnnotation();try{await this.store.load()}catch{}}}async handleCreateAnnotation(e){const t=this.prepareAnnotation(e);if(this.onAnnotationCreated?.(t),await this.persistCreate(t))return;const r=t.id;this.annotorious&&r&&this.withSuppressedEcho(r,()=>{this.annotorious?.removeAnnotation(r)}),this.clearSelectionState()}async handleUpdateAnnotation(e){this.consumeSuppressedEcho(e?.id)||await this.saveAnnotation(e)}async handleDeleteAnnotation(e){const t=e?.id;this.consumeSuppressedEcho(t)||!t||!this.store.ready||!this.store.has(t)||!await this.store.delete(t)||this.activeEditingAnnotationId===t&&this.clearSelectionState()}async saveAnnotation(e){if(!this.store.ready)return!1;const t=await this.applyBeforeSave(this.annotationToCanvasSpace(this.forceTargetSource(e)));return await this.store.persist(t)}annotationToCanvasSpace(e){return this.editingPointOrigin.has(e?.id)?this.pointFromEditingRect(e):of(this.toPointSelectorTarget(e),this.getCurrentCanvasImageDimensions())}async persistCreate(e){if(!this.store.ready)return!1;const t=await this.applyBeforeSave(e);return await this.store.persist(t)}withSuppressedEcho(e,t){this.markSuppressedEcho(e),t()}markSuppressedEcho(e){this.suppressedEchoIds.set(e,(this.suppressedEchoIds.get(e)??0)+1)}consumeSuppressedEcho(e){if(!e)return!1;const t=this.suppressedEchoIds.get(e)??0;return t<=0?!1:(t===1?this.suppressedEchoIds.delete(e):this.suppressedEchoIds.set(e,t-1),!0)}forceTargetSource(e){const t=JSON.parse(JSON.stringify(e));return typeof t.target=="string"||!t.target?t.target={source:this.currentCanvasId}:t.target.source=this.currentCanvasId,t}prepareAnnotation(e,t){const i=this.forceTargetSource(e),r=this.config.extension?.prepareDraft?this.config.extension.prepareDraft(i,this.getRuntimeContext(null)):this.config.prepareAnnotation?this.config.prepareAnnotation(i):i,s=this.toPointSelectorTarget(JSON.parse(JSON.stringify(r)));return t?.canvasSpace?s:of(s,this.getCurrentCanvasImageDimensions())}async applyBeforeSave(e){return this.config.extension?.beforeSave?await this.config.extension.beforeSave(e,this.getRuntimeContext(e)):e}getRuntimeContext(e){return{manifestId:this.currentManifestId,canvasId:this.currentCanvasId,isEditing:this.isDrawingEnabled,selectedAnnotation:e,user:this.config.user,hostContext:this.config.extension?.getContext?.()??null}}notifyExtensionSelectionChange(e){this.config.extension?.onSelectionChange?.(e,this.getRuntimeContext(e))}async hydrateAnnotation(e){if(!(!this.annotorious||!this.store.ready||!this.store.hydrateSupported)){if(!this.store.isSkeleton(e)){this.onAnnotationHydrationChange?.(!1);return}this.onAnnotationHydrationChange?.(!0);try{const t=await this.store.hydrate(e,()=>(this.annotorious?.getAnnotations()??[]).some(r=>r.id===e));t&&this.onSelectionChange?.(t)}catch{}finally{this.onAnnotationHydrationChange?.(!1)}}}async deleteAnnotation(e){return!this.store.ready||!await this.store.delete(e)?!1:(this.annotorious?.removeAnnotation(e),this.activeEditingAnnotationId===e&&(this.clearAnnotoriousEditingAnnotation(),this.onSelectionChange?.(null),this.notifyExtensionSelectionChange(null)),!0)}async updateAnnotationBodies(e,t){const r=(this.annotorious?.getAnnotations()??[]).find(a=>a.id===e);if(!r)return!1;const s={...r,body:t};if(!await this.saveAnnotation(s)){const a=this.store.get(e);return a&&this.onSelectionChange?.(a),!1}return this.annotorious&&this.withSuppressedEcho(e,()=>{this.annotorious?.updateAnnotation(s)}),!0}handleIdReconciled(e,t){this.activeEditingAnnotationId===e&&this.selectAnnotationById(t.id)}handleReplay(e,t){this.activeEditingAnnotationId===e&&(t?this.selectAnnotationById(e):(this.clearAnnotoriousEditingAnnotation(),this.onSelectionChange?.(null),this.notifyExtensionSelectionChange(null)))}async selectAnnotationById(e){if(!this.annotorious||!this.store.ready)return;const t=await this.store.resolve(e);if(!t)return;const i=this.toAnnotoriousTarget(t);this.clearAnnotoriousEditingAnnotation();const r=t?.target?.selector;r?.type==="PointSelector"&&this.editingPointOrigin.set(e,{x:r.x,y:r.y}),this.annotorious.setAnnotations([i],!0),this.setActiveEditingAnnotationId(e),this.annotorious?.setSelected(e)}cancelSelection(){this.selectedAnnotation=null,this.onSelectionChange?.(null),this.notifyExtensionSelectionChange(null),this.onAnnotationHydrationChange?.(!1),this.clearAnnotoriousEditingAnnotation()}destroy(){this.osdViewer&&(this.openHandler&&this.osdViewer.removeHandler("open",this.openHandler),this.canvasClickHandler&&this.osdViewer.removeHandler("canvas-click",this.canvasClickHandler)),this.openHandler=null,this.canvasClickHandler=null,this.clearAnnotoriousEditingAnnotation(),this.editingPointOrigin.clear(),this.annotorious?.destroy(),this.annotorious=null,this.ownsStore&&this.store.destroy(),this.osdViewer=null}}const lf=Symbol("triiiceratops:plugin-annotation-editor:t");function Tx(n,e){return e?n.replace(/\{(\w+)\}/g,(t,i)=>i in e?String(e[i]):t):n}function Ex(n,e){const t=Fc.en??{};return Tx(t[n]??n,e)}function hf(){return Xc(lf)??Ex}function bx(n){let e=Ge(0);const t=n.subscribe(()=>{_e(e,F(e)+1)});return{t:(r,s)=>(F(e),n.t(r,s)),unsubscribe:t}}const Sx=["commenting","tagging","describing","classifying","identifying","linking","bookmarking","highlighting","questioning","replying"];var Ax=rt("<button><!></button>");function wi(n,e){let t=Be(e,"variant",3,"default"),i=Be(e,"size",3,"md"),r=Be(e,"circle",3,!1),s=Be(e,"square",3,!1),o=Be(e,"ghost",3,!1),a=Be(e,"outline",3,!1),l=Be(e,"active",3,!1),h=Be(e,"class",3,""),u=Be(e,"style",3,""),c=Jo(e,["$$slots","$$events","$$legacy","variant","size","circle","square","ghost","outline","active","class","style","children"]);const d={default:"",primary:"--btn-color:var(--tri-color-primary);--btn-color-text:var(--tri-color-primary-text);--btn-fg:var(--tri-color-primary-content);",neutral:"--btn-color:var(--tri-color-neutral);--btn-fg:var(--tri-color-neutral-content);",success:"--btn-color:var(--tri-color-success);--btn-fg:var(--tri-color-success-content);",warning:"--btn-color:var(--tri-color-warning);--btn-fg:var(--tri-color-warning-content);",error:"--btn-color:var(--tri-color-error);--btn-fg:var(--tri-color-error-content);"},f={xs:"--fontsize:0.6875rem;--btn-p:0.5rem;--size:calc(var(--tri-size-field,0.25rem)*6);",sm:"--fontsize:0.75rem;--btn-p:0.75rem;--size:calc(var(--tri-size-field,0.25rem)*8);",md:"--fontsize:0.875rem;--btn-p:1rem;--size:calc(var(--tri-size-field,0.25rem)*10);",lg:"--fontsize:1.125rem;--btn-p:1.25rem;--size:calc(var(--tri-size-field,0.25rem)*12);"};let p=$e(()=>`${f[i()]}${d[t()]}${u()}`);var g=Ax();Zo(g,()=>({class:`btn ${h()??""}`,style:F(p),...c,[Ln]:{circle:r(),square:s(),ghost:o(),outline:a(),active:l()}}),void 0,void 0,void 0,"svelte-sgoebi");var m=Ne(g);Kl(m,()=>e.children??tr),Ve(n,g)}let Rx=0;var Cx=rt('<div role="option"> </div>'),Px=rt('<div><select><!></select> <button type="button" role="combobox" aria-haspopup="listbox"><span> </span></button> <div role="listbox" class="listbox svelte-1hwvamm" popover="manual" tabindex="-1"></div></div>');function Ix(n,e){Hr(e,!0);let t=Be(e,"value",15),i=Be(e,"size",3,"md"),r=Be(e,"ghost",3,!1),s=Be(e,"class",3,""),o=Be(e,"style",3,""),a=Jo(e,["$$slots","$$events","$$legacy","value","size","ghost","class","style","children"]);const l={xs:"calc(var(--tri-size-field,0.25rem)*6)",sm:"calc(var(--tri-size-field,0.25rem)*8)",md:"calc(var(--tri-size-field,0.25rem)*10)",lg:"calc(var(--tri-size-field,0.25rem)*12)"};let h=$e(()=>`--size:${l[i()]};${o()}`);const u=`tri-listbox-${Rx++}`;let c=Ge(null),d=Ge(null),f=Ge(null),p=Ge(Wi([])),g=Ge(!1),m=Ge(-1),v=$e(()=>!!e.disabled),_=$e(()=>t()==null?"":String(t())),y=$e(()=>F(p).find(J=>J.value===F(_))??F(p)[0]);function w(){F(c)&&_e(p,Array.from(F(c).querySelectorAll("option")).map(J=>({value:J.value,label:(J.textContent??"").trim(),disabled:J.disabled})),!0)}Xi(()=>{if(!F(c))return;w();const J=new MutationObserver(()=>w());return J.observe(F(c),{childList:!0,subtree:!0,characterData:!0,attributes:!0}),()=>J.disconnect()});function R(J){const Y=F(p)[J];!F(c)||!Y||Y.disabled||(F(c).value=Y.value,F(c).dispatchEvent(new Event("input",{bubbles:!0})),F(c).dispatchEvent(new Event("change",{bubbles:!0})),X())}function D(){if(!F(d)||!F(f))return;const J=F(d).getBoundingClientRect();F(f).style.minWidth=`${J.width}px`,F(f).style.left=`${J.left}px`;const Y=F(f).offsetHeight,he=window.innerHeight-J.bottom;he<Y&&J.top>he?F(f).style.top=`${Math.max(4,J.top-Y-4)}px`:F(f).style.top=`${J.bottom+4}px`}function C(){F(f)?.children[F(m)]?.scrollIntoView({block:"nearest"})}function O(J){const Y=J.composedPath();F(d)&&Y.includes(F(d))||F(f)&&Y.includes(F(f))||X()}function N(){F(v)||F(g)||!F(f)||(_e(g,!0),F(f).showPopover(),D(),_e(m,F(p).findIndex(J=>J.value===F(_)),!0),F(m)<0&&_e(m,F(p).findIndex(J=>!J.disabled),!0),C(),window.addEventListener("scroll",D,!0),window.addEventListener("resize",D),document.addEventListener("pointerdown",O,!0))}function X(){F(g)&&(_e(g,!1),F(f)?.hidePopover(),window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",D),document.removeEventListener("pointerdown",O,!0),F(d)?.focus())}function q(){F(g)?X():N()}function B(J){if(!F(p).length)return;let Y=F(m);for(let he=0;he<F(p).length;he++)if(Y=(Y+J+F(p).length)%F(p).length,!F(p)[Y]?.disabled){_e(m,Y,!0),C();return}}function S(J){const Y=J==="start"?F(p).map((he,le)=>le):F(p).map((he,le)=>F(p).length-1-le);for(const he of Y)if(!F(p)[he]?.disabled){_e(m,he,!0),C();return}}let I="",L;function j(J){I+=J.toLowerCase(),clearTimeout(L),L=setTimeout(()=>I="",600);const Y=F(p).findIndex(he=>!he.disabled&&he.label.toLowerCase().startsWith(I));Y>=0&&(_e(m,Y,!0),C())}function U(J){if(!F(v)){if(!F(g)){["ArrowDown","ArrowUp","Enter"," "].includes(J.key)&&(J.preventDefault(),N());return}switch(J.key){case"ArrowDown":J.preventDefault(),B(1);break;case"ArrowUp":J.preventDefault(),B(-1);break;case"Home":J.preventDefault(),S("start");break;case"End":J.preventDefault(),S("end");break;case"Enter":case" ":J.preventDefault(),F(m)>=0&&R(F(m));break;case"Escape":J.preventDefault(),X();break;case"Tab":X();break;default:J.key.length===1&&!J.metaKey&&!J.ctrlKey&&j(J.key)}}}var W=Px(),ee=Ne(W);Zo(ee,()=>({class:"native-select",tabindex:"-1","aria-hidden":"true",...a}),void 0,void 0,void 0,"svelte-1hwvamm");var z=Ne(ee);Kl(z,()=>e.children??tr),Ko(ee,J=>_e(c,J),()=>F(c));var H=Ze(ee,2);let K;H.__click=q,H.__keydown=U;var $=Ne(H);let se;var fe=Ne($);Ko(H,J=>_e(d,J),()=>F(d));var te=Ze(H,2);Yo(te,23,()=>F(p),(J,Y)=>J.value+"\0"+Y,(J,Y,he)=>{var le=Cx();let ve;le.__click=()=>R(F(he)),le.__pointermove=()=>_e(m,F(he),!0);var Ce=Ne(le);st(()=>{Lt(le,"id",`${u}-opt-${F(he)??""}`),ve=Bn(le,1,"option svelte-1hwvamm",null,ve,{active:F(he)===F(m),selected:F(Y).value===F(_)}),Lt(le,"aria-selected",F(Y).value===F(_)),Lt(le,"aria-disabled",F(Y).disabled),mt(Ce,F(Y).label)}),Ve(J,le)}),Ko(te,J=>_e(f,J),()=>F(f)),st(()=>{Bn(W,1,`select-wrapper ${s()??""}`,"svelte-1hwvamm"),eh(W,o()),K=Bn(H,1,"select svelte-1hwvamm",null,K,{ghost:r(),open:F(g)}),eh(H,F(h)),H.disabled=F(v),Lt(H,"aria-expanded",F(g)),Lt(H,"aria-controls",u),Lt(H,"aria-activedescendant",F(g)&&F(m)>=0?`${u}-opt-${F(m)}`:void 0),Lt(H,"aria-label",a["aria-label"]),se=Bn($,1,"select-label svelte-1hwvamm",null,se,{placeholder:F(y)?.disabled}),mt(fe,F(y)?.label??""),Lt(te,"id",u)}),H0(ee,t),Ve(n,W),zr()}Xl(["click","keydown","pointermove"]);var Mx=rt("<input/>");function uf(n,e){Hr(e,!0);let t=Be(e,"value",15),i=Be(e,"size",3,"md"),r=Be(e,"ghost",3,!1),s=Be(e,"type",3,"text"),o=Be(e,"class",3,""),a=Be(e,"style",3,""),l=Jo(e,["$$slots","$$events","$$legacy","value","size","ghost","type","class","style"]);const h={xs:"calc(var(--tri-size-field,0.25rem)*6)",sm:"calc(var(--tri-size-field,0.25rem)*8)",md:"calc(var(--tri-size-field,0.25rem)*10)",lg:"calc(var(--tri-size-field,0.25rem)*12)"};let u=$e(()=>`--size:${h[i()]};${a()}`);var c=Mx();Zo(c,()=>({type:s(),class:`input ${o()??""}`,style:F(u),...l,[Ln]:{ghost:r()}}),void 0,void 0,void 0,"svelte-4x2zrp",!0),qd(c,t),Ve(n,c),zr()}var Dx=rt("<span><!></span>");function Ox(n,e){let t=Be(e,"tip",3,""),i=Be(e,"placement",3,"top"),r=Be(e,"open",3,!1),s=Be(e,"class",3,""),o=Be(e,"style",3,""),a=Jo(e,["$$slots","$$events","$$legacy","tip","placement","color","open","class","style","children"]),l=$e(()=>`${e.color?`--tt-bg:var(--color-${e.color});--tt-fg:var(--color-${e.color}-content);`:""}${o()}`);var h=Dx();Zo(h,()=>({class:`tooltip ${i()??""} ${s()??""}`,"data-tip":t(),style:F(l),...a,[Ln]:{"tooltip-open":r()}}),void 0,void 0,void 0,"svelte-1cfjd3n");var u=Ne(h);Kl(u,()=>e.children??tr),Ve(n,h)}const hh=(n,e=tr,t=tr)=>{var i=Bx(),r=Ne(i);kd(r,()=>Ml[e()],!0),st(()=>{Lt(i,"viewBox",Il),Lt(i,"width",t()),Lt(i,"height",t())}),Ve(n,i)};var Bx=Ld('<svg class="tri-ae-glyph svelte-u681vn" fill="currentColor" aria-hidden="true" focusable="false"><!></svg>'),Lx=rt('<div class="unknown-body svelte-u681vn"><p class="unknown-body-note svelte-u681vn"> </p> <code class="unknown-body-preview svelte-u681vn"> </code></div>'),Fx=rt('<option class="purpose-option svelte-u681vn"> </option>'),Nx=rt('<textarea class="body-textarea svelte-u681vn" rows="2"></textarea>'),kx=rt('<div class="body-row svelte-u681vn"><!> <!></div> <!>',1),Ux=rt('<div class="card body-card svelte-u681vn"><!></div>'),Hx=rt("<!> ",1),zx=rt("<!> ",1),Gx=rt('<div></div> <!> <div class="save-row svelte-u681vn"><!></div>',1);function Vx(n,e){Hr(e,!0);const t=hf();let i=Be(e,"embedded",3,!1),r=Be(e,"purposes",3,Sx),s=Be(e,"allowMultipleBodies",3,!0),o=Ge(Wi([]));function a(){return r()[0]??"commenting"}function l(){return{purpose:a(),value:"",__opaque:!1}}Xi(()=>{e.api.annotation;const D=e.api.bodies.map(c);_e(o,!s()&&D.length===0?[l()]:D,!0)});function h(D){return D&&typeof D=="object"?{...D}:D}function u(D){if(!D||typeof D!="object"||Array.isArray(D))return!1;const C=D,O=C.type,N=C.value;return(O===void 0||O==="TextualBody")&&(N===void 0||typeof N=="string")}function c(D){return u(D)?{...h(D),__opaque:!1}:{__opaque:!0,body:h(D)}}function d(){_e(o,[...F(o),l()],!0)}function f(D){_e(o,F(o).filter((C,O)=>O!==D),!0)}async function p(){const D=F(o).flatMap(C=>{if(C.__opaque)return[C.body];const{__opaque:O,...N}=C;return N.value?.trim()?[N]:[]});await e.api.save(D.length===1?D[0]:D)}var g=Gx(),m=_i(g);let v;Yo(m,21,()=>F(o),I0,(D,C,O)=>{var N=Ux(),X=Ne(N);{var q=S=>{var I=Lx(),L=Ne(I),j=Ne(L),U=Ze(L,2),W=Ne(U);st((ee,z)=>{mt(j,ee),mt(W,z)},[()=>t("annotation_editor_unknown_body_note"),()=>JSON.stringify(F(C).body,null,2)]),Ve(S,I)},B=S=>{var I=kx(),L=_i(I),j=Ne(L);Ix(j,{class:"body-purpose",size:"xs",get value(){return F(C).purpose},set value(H){F(C).purpose=H},children:(H,K)=>{var $=Xs(),se=_i($);Yo(se,16,r,fe=>fe,(fe,te)=>{var J=Fx(),Y=Ne(J),he={};st(()=>{mt(Y,te),he!==(he=te)&&(J.value=(J.__value=te)??"")}),Ve(fe,J)}),Ve(H,$)},$$slots:{default:!0}});var U=Ze(j,2);wi(U,{class:"body-remove",size:"xs",ghost:!0,circle:!0,onclick:()=>f(O),children:(H,K)=>{hh(H,()=>"X",()=>14)},$$slots:{default:!0}});var W=Ze(L,2);{var ee=H=>{{let K=$e(()=>t("annotation_editor_tag_placeholder"));uf(H,{class:"body-input",size:"xs",get placeholder(){return F(K)},get disabled(){return e.api.isHydrating},get value(){return F(C).value},set value($){F(C).value=$}})}},z=H=>{var K=Xs(),$=_i(K);{var se=te=>{{let J=$e(()=>t("annotation_editor_link_placeholder"));uf(te,{class:"body-input",type:"url",size:"xs",get placeholder(){return F(J)},get disabled(){return e.api.isHydrating},get value(){return F(C).value},set value(Y){F(C).value=Y}})}},fe=te=>{var J=Nx();st(Y=>{Lt(J,"placeholder",Y),J.disabled=e.api.isHydrating},[()=>t("annotation_editor_text_placeholder")]),qd(J,()=>F(C).value,Y=>F(C).value=Y),Ve(te,J)};Xt($,te=>{F(C).purpose==="linking"?te(se):te(fe,!1)},!0)}Ve(H,K)};Xt(W,H=>{F(C).purpose==="tagging"?H(ee):H(z,!1)})}Ve(S,I)};Xt(X,S=>{F(C).__opaque?S(q):S(B,!1)})}Ve(D,N)});var _=Ze(m,2);{var y=D=>{wi(D,{class:"add-content",size:"xs",ghost:!0,onclick:d,get disabled(){return e.api.isHydrating},children:(C,O)=>{var N=Hx(),X=_i(N);hh(X,()=>"Plus",()=>14);var q=Ze(X);st(B=>mt(q,` ${B??""}`),[()=>t("annotation_editor_add_content")]),Ve(C,N)},$$slots:{default:!0}})};Xt(_,D=>{s()&&D(y)})}var w=Ze(_,2),R=Ne(w);wi(R,{class:"save-btn",size:"sm",variant:"primary",onclick:p,get disabled(){return e.api.isHydrating},children:(D,C)=>{var O=zx(),N=_i(O);hh(N,()=>"Check",()=>16);var X=Ze(N);st(q=>mt(X,` ${q??""}`),[()=>t("annotation_editor_save")]),Ve(D,O)},$$slots:{default:!0}}),st(()=>v=Bn(m,1,"bodies svelte-u681vn",null,v,{"bodies-scroll":!i()})),Ve(n,g),zr()}const Fn=(n,e=tr,t=tr)=>{var i=Wx(),r=Ne(i);kd(r,()=>Ml[e()],!0),st(()=>{Lt(i,"viewBox",Il),Lt(i,"width",t()),Lt(i,"height",t())}),Ve(n,i)};var Wx=Ld('<svg class="tri-ae-glyph svelte-1mu3tdt" fill="currentColor" aria-hidden="true" focusable="false"><!></svg>'),jx=rt('<div class="header svelte-1mu3tdt"><h2 class="title svelte-1mu3tdt"><!> </h2></div>'),Xx=rt('<div class="error-line svelte-1mu3tdt" role="alert"><span class="error-icon svelte-1mu3tdt"><!></span> <span class="error-text svelte-1mu3tdt"> </span> <!></div>'),Yx=rt('<div class="join mode-toggle svelte-1mu3tdt"><!> <!></div>'),qx=rt('<p class="mode-disabled-reason svelte-1mu3tdt"> </p>'),Zx=rt("<!> ",1),Kx=rt("<!> ",1),Qx=rt('<div class="undo-redo svelte-1mu3tdt"><!> <!></div>'),Jx=rt('<div class="tool-section svelte-1mu3tdt"><p class="tool-label svelte-1mu3tdt"> </p> <div class="join svelte-1mu3tdt"></div></div>'),$x=rt('<div class="custom-body-editor svelte-1mu3tdt"></div>'),ew=rt('<p class="hydrating-note svelte-1mu3tdt"> </p>'),tw=rt('<div class="card editor-card svelte-1mu3tdt"><div class="editor-header svelte-1mu3tdt"><h3 class="editor-title svelte-1mu3tdt"> </h3> <div class="editor-actions svelte-1mu3tdt"><!></div></div> <!> <!></div>'),iw=rt('<dialog class="modal modal-open svelte-1mu3tdt"><div class="modal-box svelte-1mu3tdt"><h3 class="modal-title svelte-1mu3tdt"><span class="modal-warning-icon svelte-1mu3tdt"><!></span> </h3> <p class="modal-message svelte-1mu3tdt"> </p> <div class="modal-action svelte-1mu3tdt"><!> <!></div></div> <form method="dialog" class="modal-backdrop svelte-1mu3tdt"><button class="svelte-1mu3tdt">close</button></form></dialog>'),nw=rt('<div data-panel-id="annotation-editor"><!> <div><!> <div class="mode-section svelte-1mu3tdt"><!> <p class="mode-instruction svelte-1mu3tdt"> </p> <!></div> <!> <!> <!></div></div> <!>',1);function rw(n,e){Hr(e,!0);const t=hf();let i=Be(e,"isEditing",3,!1),r=Be(e,"activeTool",3,"rectangle"),s=Be(e,"selectedAnnotation",3,null),o=Be(e,"showDeleteConfirm",3,!1),a=Be(e,"isHydratingSelection",3,!1),l=Be(e,"canCreateAnnotation",3,!0),h=Be(e,"createDisabledReason",3,null),u=Be(e,"persistenceError",3,null),c=Be(e,"bodyEditor",3,null),d=Be(e,"showModeToggle",3,!0),f=Be(e,"showUndoRedo",3,!0),p=Be(e,"purposes",3,void 0),g=Be(e,"allowMultipleBodies",3,!0),m=Be(e,"canUndo",3,!1),v=Be(e,"canRedo",3,!1),_=Be(e,"availableTools",19,()=>["rectangle","polygon","point"]),y=Be(e,"embedded",3,!1);function w(me){switch(me){case"load":return t("annotation_editor_error_load");case"create":return t("annotation_editor_error_create");case"delete":return t("annotation_editor_error_delete");case"hydrate":return t("annotation_editor_error_hydrate");case"update":default:return t("annotation_editor_error_update")}}const R={rectangle:"Rectangle",polygon:"Polygon",point:"Target"},D={rectangle:"annotation_tool_rectangle",polygon:"annotation_tool_polygon",point:"annotation_tool_point"};let C=Ge(null),O=Ge(null),N=Ge(null);function X(me){const Ae=me?.body;return Array.isArray(Ae)?Ae:Ae!=null?[Ae]:[]}Xi(()=>{if(!s()){_e(C,null),_e(O,null);return}const me=X(s());if(!F(C)||F(O)!==s().id){_e(O,s().id,!0),_e(C,{annotation:s(),bodies:me,context:e.runtimeContext,isHydrating:a(),save:async Ae=>{await e.onSaveBodies(Ae)},cancel:e.onCancelSelection,requestDelete:e.onRequestDelete},!0);return}F(C).annotation=s(),F(C).bodies=me,F(C).context=e.runtimeContext,F(C).isHydrating=a()}),Xi(()=>{const me=F(C),Ae=c(),x=F(N);if(!me||!Ae||!("render"in Ae)||!x)return;me.annotation,me.bodies,me.isHydrating;const A=Ae.render(x,me);return()=>{A?.(),x.replaceChildren()}});var q=nw(),B=_i(q);let S;var I=Ne(B);{var L=me=>{var Ae=jx(),x=Ne(Ae),A=Ne(x);Fn(A,()=>"PencilSimple",()=>20);var k=Ze(A);st(G=>mt(k,` ${G??""}`),[()=>t("annotation_editor_title")]),Ve(me,Ae)};Xt(I,me=>{y()||me(L)})}var j=Ze(I,2);let U;var W=Ne(j);{var ee=me=>{var Ae=Xx(),x=Ne(Ae),A=Ne(x);Fn(A,()=>"Warning",()=>16);var k=Ze(x,2),G=Ne(k),V=Ze(k,2);{let oe=$e(()=>t("annotation_editor_error_dismiss"));wi(V,{class:"error-dismiss",size:"xs",ghost:!0,circle:!0,get onclick(){return e.onDismissError},get"aria-label"(){return F(oe)},children:(Q,xe)=>{Fn(Q,()=>"X",()=>14)},$$slots:{default:!0}})}st(oe=>mt(G,oe),[()=>w(u().op)]),Ve(me,Ae)};Xt(W,me=>{u()&&me(ee)})}var z=Ze(W,2),H=Ne(z);{var K=me=>{var Ae=Yx(),x=Ne(Ae);{let k=$e(()=>i()?"default":"primary");wi(x,{class:"join-item",size:"sm",get variant(){return F(k)},onclick:()=>i()&&e.onToggleEditing(),children:(G,V)=>{var oe=Xo();st(Q=>mt(oe,Q),[()=>t("annotation_editor_edit_mode")]),Ve(G,oe)},$$slots:{default:!0}})}var A=Ze(x,2);{let k=$e(()=>i()?"primary":"default"),G=$e(()=>!l());wi(A,{class:"join-item",size:"sm",get variant(){return F(k)},get disabled(){return F(G)},onclick:()=>!i()&&e.onToggleEditing(),children:(V,oe)=>{var Q=Xo();st(xe=>mt(Q,xe),[()=>t("annotation_editor_create_mode")]),Ve(V,Q)},$$slots:{default:!0}})}Ve(me,Ae)};Xt(H,me=>{d()&&me(K)})}var $=Ze(H,2),se=Ne($),fe=Ze($,2);{var te=me=>{var Ae=qx(),x=Ne(Ae);st(()=>mt(x,h())),Ve(me,Ae)};Xt(fe,me=>{!l()&&h()&&me(te)})}var J=Ze(z,2);{var Y=me=>{var Ae=Qx(),x=Ne(Ae);{let k=$e(()=>!m());wi(x,{class:"undo-redo-btn",size:"sm",outline:!0,get disabled(){return F(k)},get onclick(){return e.onUndo},children:(G,V)=>{var oe=Zx(),Q=_i(oe);Fn(Q,()=>"ArrowCounterClockwise",()=>16);var xe=Ze(Q);st(Le=>mt(xe,` ${Le??""}`),[()=>t("annotation_editor_undo")]),Ve(G,oe)},$$slots:{default:!0}})}var A=Ze(x,2);{let k=$e(()=>!v());wi(A,{class:"undo-redo-btn",size:"sm",outline:!0,get disabled(){return F(k)},get onclick(){return e.onRedo},children:(G,V)=>{var oe=Kx(),Q=_i(oe);Fn(Q,()=>"ArrowClockwise",()=>16);var xe=Ze(Q);st(Le=>mt(xe,` ${Le??""}`),[()=>t("annotation_editor_redo")]),Ve(G,oe)},$$slots:{default:!0}})}Ve(me,Ae)};Xt(J,me=>{f()&&me(Y)})}var he=Ze(J,2);{var le=me=>{var Ae=Jx(),x=Ne(Ae),A=Ne(x),k=Ze(x,2);Yo(k,20,_,G=>G,(G,V)=>{const oe=$e(()=>R[V]??"Rectangle"),Q=$e(()=>t(D[V]??"annotation_tool_rectangle"));Ox(G,{get tip(){return F(Q)},placement:"bottom",class:"join-item tool-tip",children:(xe,Le)=>{{let tt=$e(()=>r()===V?"primary":"default");wi(xe,{size:"sm",get variant(){return F(tt)},onclick:()=>e.onSetTool(V),get"aria-label"(){return F(Q)},children:(ye,qe)=>{Fn(ye,()=>F(oe),()=>18)},$$slots:{default:!0}})}},$$slots:{default:!0}})}),st(G=>mt(A,G),[()=>t("annotation_editor_tool_label")]),Ve(me,Ae)};Xt(he,me=>{i()&&me(le)})}var ve=Ze(he,2);{var Ce=me=>{var Ae=tw(),x=Ne(Ae),A=Ne(x),k=Ne(A),G=Ze(A,2),V=Ne(G);{let ye=$e(()=>t("annotation_editor_delete_tooltip"));wi(V,{class:"delete-btn",size:"sm",ghost:!0,circle:!0,get onclick(){return e.onRequestDelete},get"aria-label"(){return F(ye)},children:(qe,E)=>{Fn(qe,()=>"Trash",()=>16)},$$slots:{default:!0}})}var oe=Ze(x,2);{var Q=ye=>{const qe=$e(()=>c().component);var E=Xs(),T=_i(E);B0(T,()=>F(qe),(P,M)=>{M(P,{get api(){return F(C)}})}),Ve(ye,E)},xe=ye=>{var qe=Xs(),E=_i(qe);{var T=M=>{var Z=$x();Ko(Z,ne=>_e(N,ne),()=>F(N)),Ve(M,Z)},P=M=>{var Z=Xs(),ne=_i(Z);{var Re=Qe=>{Vx(Qe,{get api(){return F(C)},get embedded(){return y()},get purposes(){return p()},get allowMultipleBodies(){return g()}})};Xt(ne,Qe=>{F(C)&&Qe(Re)},!0)}Ve(M,Z)};Xt(E,M=>{F(C)&&c()&&"render"in c()?M(T):M(P,!1)},!0)}Ve(ye,qe)};Xt(oe,ye=>{F(C)&&c()&&"component"in c()?ye(Q):ye(xe,!1)})}var Le=Ze(oe,2);{var tt=ye=>{var qe=ew(),E=Ne(qe);st(T=>mt(E,T),[()=>t("annotation_editor_hydrating")]),Ve(ye,qe)};Xt(Le,ye=>{a()&&ye(tt)})}st(ye=>mt(k,ye),[()=>t("annotation_editor_edit_section")]),Ve(me,Ae)};Xt(ve,me=>{s()&&me(Ce)})}var ze=Ze(B,2);{var lt=me=>{var Ae=iw(),x=Ne(Ae),A=Ne(x),k=Ne(A),G=Ne(k);Fn(G,()=>"Warning",()=>24);var V=Ze(k),oe=Ze(A,2),Q=Ne(oe),xe=Ze(oe,2),Le=Ne(xe);wi(Le,{ghost:!0,get onclick(){return e.onCancelDelete},children:(E,T)=>{var P=Xo();st(M=>mt(P,M),[()=>t("annotation_editor_cancel")]),Ve(E,P)},$$slots:{default:!0}});var tt=Ze(Le,2);wi(tt,{variant:"error",get onclick(){return e.onConfirmDelete},children:(E,T)=>{var P=Xo();st(M=>mt(P,M),[()=>t("annotation_editor_delete")]),Ve(E,P)},$$slots:{default:!0}});var ye=Ze(x,2),qe=Ne(ye);qe.__click=function(...E){e.onCancelDelete?.apply(this,E)},st((E,T)=>{mt(V,` ${E??""}`),mt(Q,T)},[()=>t("annotation_editor_delete_title"),()=>t("annotation_editor_delete_message")]),Ve(me,Ae)};Xt(ze,me=>{o()&&me(lt)})}st(me=>{S=Bn(B,1,"panel svelte-1mu3tdt",null,S,{floating:!y()}),U=Bn(j,1,"content svelte-1mu3tdt",null,U,{scroll:!y()}),mt(se,me)},[()=>i()?t("annotation_editor_instruction_create"):t("annotation_editor_instruction_edit")]),Ve(n,q),zr()}Xl(["click"]);function sw(n,e){Hr(e,!0);let t=Be(e,"embedded",3,!1);const i=Xc(Kd);let r=Ge(Wi(Dn(()=>e.config.ui?.startInCreateMode??!1)));const s=Dn(()=>af(e.config));let o=Ge(Wi(s.defaultTool)),a=Ge(null),l=Ge(!1),h=Ge(!1),u=Ge(null),c=Ge(0);function d(){return{manifestId:i?.manifestId??null,canvasId:i?.canvasId??null,isEditing:F(r),selectedAnnotation:F(a),user:e.config.user,hostContext:e.config.extension?.getContext?.()??null}}let f=$e(()=>{F(c);const S=d();return e.config.extension?.canCreate?e.config.extension.canCreate(S):e.config.canCreateAnnotation?e.config.canCreateAnnotation():!0}),p=$e(()=>{F(c);const S=d();return e.config.extension?.getCreateDisabledReason?e.config.extension.getCreateDisabledReason(S):e.config.getCreateDisabledReason?e.config.getCreateDisabledReason():null}),g=Ge(null);Xi(()=>{if(F(g)||!i?.osdViewer)return;const S=new cr(e.config,e.store,i);S.onSelectionChange=I=>{_e(a,I,!0)},S.onAnnotationCreated=I=>{_e(a,I,!0)},S.onAnnotationHydrationChange=I=>{_e(l,I,!0)},S.onActiveEditingAnnotationChange=I=>{i?.annotationEditBus&&(i.annotationEditBus.activeEditAnnotationId=I)},S.init(i.osdViewer,i.canvasId),F(r)&&F(f)&&S.setEditing(!0),i.manifestId&&i.canvasId&&S.handleCanvasChange(i.manifestId,i.canvasId),_e(g,S)}),P0(()=>{i?.annotationEditBus&&(i.annotationEditBus.requestEdit=()=>{},i.annotationEditBus.activeEditAnnotationId=null),F(g)?.destroy()}),Fd(()=>{const S=e.config.extension?.subscribe?.(()=>{t0(c)}),I=i?.annotationEditBus?.requestEdit;return i?.annotationEditBus&&(i.annotationEditBus.requestEdit=L=>{L&&F(g)?.selectAnnotationById(L)}),()=>{S?.(),i?.annotationEditBus&&(i.annotationEditBus.requestEdit=I??(()=>{}))}}),Xi(()=>{const S=i?.manifestId,I=i?.canvasId;F(g)?.handleCanvasChange(S??null,I??null)}),Xi(()=>{F(f)||!F(r)||(_e(r,!1),F(g)?.setEditing(!1))});function m(){!F(r)&&!F(f)||(_e(r,!F(r)),F(g)?.setEditing(F(r)))}function v(S){_e(o,S,!0),F(g)?.setTool(S)}let _=$e(()=>F(g)?.persistenceError??null);function y(){F(g)?.dismissPersistenceError()}let w=$e(()=>F(g)?.canUndo??!1),R=$e(()=>F(g)?.canRedo??!1);function D(){F(g)?.undo()}function C(){F(g)?.redo()}async function O(S){F(a)&&F(g)&&!F(l)&&await F(g).updateAnnotationBodies(F(a).id,S)&&(_e(a,null),F(g).cancelSelection())}function N(){_e(a,null),F(g)?.cancelSelection()}function X(){F(a)&&(_e(u,F(a).id,!0),_e(h,!0))}async function q(){let S=!0;F(u)&&F(g)&&(S=await F(g).deleteAnnotation(F(u))),_e(h,!1),_e(u,null),S&&_e(a,null)}function B(){_e(h,!1),_e(u,null)}{let S=$e(()=>e.config.bodyEditor??null),I=$e(()=>e.config.ui?.showModeToggle??!0),L=$e(()=>e.config.ui?.showUndoRedo??!0),j=$e(()=>e.config.ui?.purposes),U=$e(()=>e.config.ui?.allowMultipleBodies??!0),W=$e(d),ee=$e(()=>F(g)?.availableTools??s.tools);rw(n,{get isEditing(){return F(r)},get activeTool(){return F(o)},get selectedAnnotation(){return F(a)},get showDeleteConfirm(){return F(h)},get isHydratingSelection(){return F(l)},get canCreateAnnotation(){return F(f)},get createDisabledReason(){return F(p)},get persistenceError(){return F(_)},get bodyEditor(){return F(S)},get showModeToggle(){return F(I)},get showUndoRedo(){return F(L)},get purposes(){return F(j)},get allowMultipleBodies(){return F(U)},get runtimeContext(){return F(W)},onDismissError:y,get canUndo(){return F(w)},get canRedo(){return F(R)},onUndo:D,onRedo:C,get availableTools(){return F(ee)},onToggleEditing:m,onSetTool:v,onSaveBodies:O,onCancelSelection:N,onRequestDelete:X,onConfirmDelete:q,onCancelDelete:B,get embedded(){return t()}})}zr()}function ow(n,e){let t=Be(e,"embedded",3,!1);sw(n,{get config(){return e.config},get store(){return e.store},get embedded(){return t()}})}function aw(n){return e=>{n.setDisplayState(e);let t=null;Xi(()=>{const i=e.manifestId,r=e.canvasId;if(!i||!r)return;const s=`${i}::${r}`;s!==t&&(t=s,n.setCanvas(i,r),n.load())}),Xi(()=>()=>n.destroy())}}const lw="canvas.a9s-gl-canvas{height:100%;left:0;position:absolute;top:0;width:100%}canvas.a9s-gl-canvas.hidden{display:none}canvas.a9s-gl-canvas.hover{cursor:pointer!important}svg.svelte-g4ws1v.svelte-g4ws1v{pointer-events:none}svg.drawing.svelte-g4ws1v.svelte-g4ws1v,svg.editing.svelte-g4ws1v .svelte-g4ws1v{pointer-events:all}svg.hover.svelte-g4ws1v.svelte-g4ws1v{cursor:pointer}svg.svelte-g4ws1v .svelte-g4ws1v{pointer-events:all}text.svelte-1rehw2p{fill:#fff;font-family:Arial,Helvetica,sans-serif;font-weight:600}rect.svelte-1rehw2p{stroke-width:1.2;vector-effect:non-scaling-stroke}polygon.svelte-fgq4n0{stroke-width:1.2;vector-effect:non-scaling-stroke}rect.svelte-gze948{stroke-width:1.2;vector-effect:non-scaling-stroke}svg.svelte-1krwc4m{position:absolute;top:0;left:0;width:100%;height:100%;outline:none;pointer-events:none}svg.svelte-jwrce3{overflow:visible;position:absolute;top:0;left:0;width:100%;height:100%;outline:none;pointer-events:none}.a9s-osd-selectionlayer :is(rect,path,polygon,ellipse,line){fill:#3182ed40;stroke:#3182ed;stroke-width:1.5px;vector-effect:non-scaling-stroke}rect.a9s-union-fg.svelte-jwrce3{fill:#3182ed1f;stroke-width:1px}rect.a9s-union-bg.svelte-jwrce3{fill:transparent;stroke:#fff;stroke-width:2px}circle.a9s-handle-buffer.svelte-qtyc7s:focus{outline:none}circle.a9s-handle-buffer.svelte-qtyc7s:focus-visible{stroke:#fffc;stroke-width:3px}.a9s-polygon-midpoint.svelte-12ykj76{cursor:crosshair}.a9s-polygon-midpoint-buffer.svelte-12ykj76{fill:transparent}.a9s-polygon-midpoint-outer.svelte-12ykj76{display:none;fill:transparent;pointer-events:none;stroke:#00000059;stroke-width:1.5px;vector-effect:non-scaling-stroke}.a9s-polygon-midpoint-inner.svelte-12ykj76{fill:#00000040;pointer-events:none;stroke:#fff;stroke-width:1px;vector-effect:non-scaling-stroke}mask.a9s-polygon-editor-mask.svelte-1h2slbm>rect.svelte-1h2slbm{fill:#fff}mask.a9s-polygon-editor-mask.svelte-1h2slbm>circle.svelte-1h2slbm,mask.a9s-polygon-editor-mask.svelte-1h2slbm>polygon.svelte-1h2slbm{fill:#000}mask.a9s-rectangle-editor-mask.svelte-1njczvj>rect.rect-mask-bg.svelte-1njczvj{fill:#fff}mask.a9s-rectangle-editor-mask.svelte-1njczvj>rect.rect-mask-fg.svelte-1njczvj{fill:#000}mask.a9s-multipolygon-editor-mask.svelte-1vxo6dc>rect.svelte-1vxo6dc{fill:#fff}mask.a9s-multipolygon-editor-mask.svelte-1vxo6dc>circle.svelte-1vxo6dc,mask.a9s-multipolygon-editor-mask.svelte-1vxo6dc>path.svelte-1vxo6dc{fill:#000}mask.a9s-rubberband-rectangle-mask.svelte-1a76qe7>rect.rect-mask-bg.svelte-1a76qe7{fill:#fff}mask.a9s-rubberband-rectangle-mask.svelte-1a76qe7>rect.rect-mask-fg.svelte-1a76qe7{fill:#000}mask.a9s-rubberband-polygon-mask.svelte-18wrg3t>rect.svelte-18wrg3t{fill:#fff}mask.a9s-rubberband-polygon-mask.svelte-18wrg3t>polygon.svelte-18wrg3t{fill:#000}circle.a9s-handle.svelte-18wrg3t.svelte-18wrg3t{fill:#fff;pointer-events:none;stroke:#00000059;stroke-width:1px;vector-effect:non-scaling-stroke}path.open.svelte-1w0132l{fill:transparent!important}.a9s-annotationlayer{box-sizing:border-box;height:100%;left:0;outline:none;position:absolute;top:0;touch-action:none;width:100%;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.a9s-annotationlayer.hover{cursor:pointer}.a9s-annotationlayer.hidden{display:none}.a9s-annotationlayer ellipse,.a9s-annotationlayer line,.a9s-annotationlayer path,.a9s-annotationlayer polygon,.a9s-annotationlayer rect{fill:transparent;shape-rendering:geometricPrecision;vector-effect:non-scaling-stroke;-webkit-tap-highlight-color:transparent}.a9s-touch-halo{fill:transparent;pointer-events:none;stroke-width:0;transition:fill .15s}.a9s-touch-halo.touched{fill:#fff6}.a9s-handle-buffer{fill:transparent}.a9s-handle [role=button]{cursor:inherit!important}.a9s-handle-dot{fill:#fff;pointer-events:none;stroke:#00000059;stroke-width:1px;vector-effect:non-scaling-stroke}.a9s-handle-dot.selected{fill:#1a1a1a;stroke:none}.a9s-handle-selected{animation:dash-rotate .35s linear infinite reverse;fill:#ffffff40;stroke:#000000e6;stroke-dasharray:2 2;stroke-width:1px;pointer-events:none;vector-effect:non-scaling-stroke}@keyframes dash-rotate{0%{stroke-dashoffset:0}to{stroke-dashoffset:4}}.a9s-edge-handle{fill:transparent;stroke:transparent;stroke-width:6px}.a9s-shape-handle,.a9s-handle{cursor:move}.a9s-handle.a9s-corner-handle{cursor:crosshair}.a9s-edge-handle-top{cursor:n-resize}.a9s-edge-handle-right{cursor:e-resize}.a9s-edge-handle-bottom{cursor:s-resize}.a9s-edge-handle-left{cursor:w-resize}.a9s-handle.a9s-corner-handle-topleft{cursor:nw-resize}.a9s-handle.a9s-corner-handle-topright{cursor:ne-resize}.a9s-handle.a9s-corner-handle-bottomright{cursor:se-resize}.a9s-handle.a9s-corner-handle-bottomleft{cursor:sw-resize}.a9s-annotationlayer .a9s-outer,div[data-theme=dark] .a9s-annotationlayer .a9s-outer{display:none}.a9s-annotationlayer .a9s-inner,div[data-theme=dark] .a9s-annotationlayer .a9s-inner{fill:#0000001f;stroke:#000;stroke-width:1px}rect.a9s-handle,div[data-theme=dark] rect.a9s-handle{fill:#000;rx:2px}rect.a9s-close-polygon-handle,div[data-theme=dark] rect.a9s-close-polygon-handle{fill:#000;rx:1px}.a9s-annotationlayer .a9s-outer,div[data-theme=light] .a9s-annotationlayer .a9s-outer{display:block;stroke:#00000059;stroke-width:3px}.a9s-annotationlayer .a9s-inner,div[data-theme=light] .a9s-annotationlayer .a9s-inner{fill:#ffffff26;stroke:#fff;stroke-width:1.5px}rect.a9s-handle,div[data-theme=light] rect.a9s-handle{fill:#fff;rx:1px;stroke:#00000073;stroke-width:1px}rect.a9s-close-polygon-handle,div[data-theme=light] rect.a9s-close-polygon-handle{fill:#fff;rx:1px;stroke:#00000073;stroke-width:1px}",hw=`
6
6
  .a9s-annotationlayer, .a9s-osd-drawinglayer {
7
7
  width: 100% !important;
@@ -50,7 +50,7 @@ Update the plugin or the core viewer so their declared ranges and capabilities o
50
50
  pointer-events: none;
51
51
  }
52
52
  `,{STYLES:uw,STYLE_ID:cw}=r_(`${lw}
53
- ${hw}`,"annotorious");class dw{#e;#t;#i=Ge(null);get manifestId(){return F(this.#i)}set manifestId(e){_e(this.#i,e,!0)}#n=Ge(null);get canvasId(){return F(this.#n)}set canvasId(e){_e(this.#n,e,!0)}#r=Ge(null);get osdViewer(){return F(this.#r)}set osdViewer(e){_e(this.#r,e)}constructor(e){this.#e=e,this.manifestId=e.manifestId,this.canvasId=e.canvasId,this.osdViewer=e.osdViewer,this.#t=e.subscribe(()=>{this.manifestId!==e.manifestId&&(this.manifestId=e.manifestId),this.canvasId!==e.canvasId&&(this.canvasId=e.canvasId),this.osdViewer!==e.osdViewer&&(this.osdViewer=e.osdViewer)})}get annotationEditBus(){return this.#e.annotationEditBus}getCanvases(e,t){return this.#e.getCanvases(e,t)}getUserAnnotations(e,t){return this.#e.getUserAnnotations(e,t)}setUserAnnotations(e,t,i){this.#e.setUserAnnotations(e,t,i)}clearUserAnnotations(e,t){this.#e.clearUserAnnotations(e,t)}getStyleRoot(){return this.#e.getStyleRoot()}destroy(){this.#t()}}function fw(n){const e=new dw(n);return{mirror:e,destroy:()=>e.destroy()}}function pw(n,e,t){const i=e.styles.install(uw,cw),r=e.styles.install(j0,"bundled"),{mirror:s,destroy:o}=fw(e.viewerState),{t:a,unsubscribe:l}=bx(e.locale),h=t.adapter??new Ks,u={...t,adapter:h},c=new Yr(u);c.setDisplayState(s);const d=h0(()=>{aw(c)(s)}),f=A0(ow,{target:n,props:{config:u,store:c,embedded:!0},context:new Map([[Kd,s],[lf,a]])});return()=>{C0(f),d(),l(),o(),r(),i()}}function gw(n={}){const e={mount(t,i){return pw(t,i,n)}};return $y({name:"@triiiceratops/plugin-annotation-editor",uiId:"annotation-editor",version:"1.0.0-rc.0",coreRange:">=1.0.0-rc.0",pluginApiRange:"^1.0.0",requiredCapabilities:["osd@5"],icon:s_,target:n.target??"panel",dismiss:"explicit",catalog:Fc,view:e})}const mw=gw({adapter:new Ks,tools:["rectangle","polygon","point"],defaultTool:"rectangle"});function vw(){const n=new Map;return{register(e){const t=n.get(e.name);if(!t){n.set(e.name,e);return}t.version!==e.version&&console.warn(`[triiiceratops] Ignoring plugin "${e.name}" version ${e.version}: version ${t.version} is already registered on this page and wins (first registration wins).`)},get(e){return n.get(e)},has(e){return n.has(e)},list(){return[...n.values()]}}}function yw(n){(window.Triiiceratops??={coreVersion:"",pluginApiVersion:"",capabilities:[],plugins:vw()}).plugins.register(n)}yw(mw);function _w(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ia={exports:{}},xw=ia.exports,cf;function ww(){return cf||(cf=1,(function(n){//! openseadragon 5.0.1
53
+ ${hw}`,"annotorious");class dw{#e;#t;#i=Ge(null);get manifestId(){return F(this.#i)}set manifestId(e){_e(this.#i,e,!0)}#n=Ge(null);get canvasId(){return F(this.#n)}set canvasId(e){_e(this.#n,e,!0)}#r=Ge(null);get osdViewer(){return F(this.#r)}set osdViewer(e){_e(this.#r,e)}constructor(e){this.#e=e,this.manifestId=e.manifestId,this.canvasId=e.canvasId,this.osdViewer=e.osdViewer,this.#t=e.subscribe(()=>{this.manifestId!==e.manifestId&&(this.manifestId=e.manifestId),this.canvasId!==e.canvasId&&(this.canvasId=e.canvasId),this.osdViewer!==e.osdViewer&&(this.osdViewer=e.osdViewer)})}get annotationEditBus(){return this.#e.annotationEditBus}getCanvases(e,t){return this.#e.getCanvases(e,t)}getUserAnnotations(e,t){return this.#e.getUserAnnotations(e,t)}setUserAnnotations(e,t,i){this.#e.setUserAnnotations(e,t,i)}clearUserAnnotations(e,t){this.#e.clearUserAnnotations(e,t)}getStyleRoot(){return this.#e.getStyleRoot()}destroy(){this.#t()}}function fw(n){const e=new dw(n);return{mirror:e,destroy:()=>e.destroy()}}function pw(n,e,t){const i=e.styles.install(uw,cw),r=e.styles.install(j0,"bundled"),{mirror:s,destroy:o}=fw(e.viewerState),{t:a,unsubscribe:l}=bx(e.locale),h=t.adapter??new Ks,u={...t,adapter:h},c=new Yr(u);c.setDisplayState(s);const d=h0(()=>{aw(c)(s)}),f=A0(ow,{target:n,props:{config:u,store:c,embedded:!0},context:new Map([[Kd,s],[lf,a]])});return()=>{C0(f),d(),l(),o(),r(),i()}}function gw(n={}){const e={mount(t,i){return pw(t,i,n)}};return $y({name:"@triiiceratops/plugin-annotation-editor",title:"annotation_editor_title",uiId:"annotation-editor",version:"1.0.0-rc.0",coreRange:">=1.0.0-rc.0",pluginApiRange:"^1.0.0",requiredCapabilities:["osd@5"],icon:s_,target:n.target??"panel",dismiss:"explicit",catalog:Fc,view:e})}const mw=gw({adapter:new Ks,tools:["rectangle","polygon","point"],defaultTool:"rectangle"});function vw(){const n=new Map;return{register(e){const t=n.get(e.name);if(!t){n.set(e.name,e);return}t.version!==e.version&&console.warn(`[triiiceratops] Ignoring plugin "${e.name}" version ${e.version}: version ${t.version} is already registered on this page and wins (first registration wins).`)},get(e){return n.get(e)},has(e){return n.has(e)},list(){return[...n.values()]}}}function yw(n){(window.Triiiceratops??={coreVersion:"",pluginApiVersion:"",capabilities:[],plugins:vw()}).plugins.register(n)}yw(mw);function _w(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ia={exports:{}},xw=ia.exports,cf;function ww(){return cf||(cf=1,(function(n){//! openseadragon 5.0.1
54
54
  //! Built on 2024-12-09
55
55
  //! Git commit: v5.0.1-0-480de92d
56
56
  //! http://openseadragon.github.io
package/dist/index.js CHANGED
@@ -5993,6 +5993,7 @@ function el(t = {}) {
5993
5993
  };
5994
5994
  return Vi({
5995
5995
  name: "@triiiceratops/plugin-annotation-editor",
5996
+ title: "annotation_editor_title",
5996
5997
  uiId: "annotation-editor",
5997
5998
  version: "1.0.0-rc.0",
5998
5999
  coreRange: ">=1.0.0-rc.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triiiceratops/plugin-annotation-editor",
3
- "version": "1.0.0-rc.4",
3
+ "version": "1.0.0-rc.5",
4
4
  "type": "module",
5
5
  "description": "Annotation editor plugin for the triiiceratops IIIF viewer, authored on @triiiceratops/plugin-sdk.",
6
6
  "license": "MIT",
@@ -53,8 +53,8 @@
53
53
  "lint:fix": "eslint . --fix --max-warnings 0"
54
54
  },
55
55
  "peerDependencies": {
56
- "triiiceratops": "^1.0.0-rc.28",
57
- "@triiiceratops/plugin-sdk": "^1.0.0-rc.4"
56
+ "triiiceratops": "^1.0.0-rc.29",
57
+ "@triiiceratops/plugin-sdk": "^1.0.0-rc.5"
58
58
  },
59
59
  "dependencies": {
60
60
  "@annotorious/annotorious": "^3.7.19",
@@ -63,14 +63,14 @@
63
63
  },
64
64
  "devDependencies": {
65
65
  "@sveltejs/vite-plugin-svelte": "^6.2.1",
66
- "@triiiceratops/plugin-sdk": "1.0.0-rc.4",
66
+ "@triiiceratops/plugin-sdk": "1.0.0-rc.5",
67
67
  "@triiiceratops/ui": "0.0.0",
68
68
  "@types/node": "^24.10.1",
69
69
  "@types/openseadragon": "^5.0.1",
70
70
  "@vitest/coverage-v8": "4.0.15",
71
71
  "svelte": "5.45.5",
72
72
  "svelte-check": "^4.3.4",
73
- "triiiceratops": "1.0.0-rc.28",
73
+ "triiiceratops": "1.0.0-rc.29",
74
74
  "typescript": "~5.9.3",
75
75
  "vite": "^6.0.0",
76
76
  "vitest": "^4.0.15"