@docling/docling-components 0.0.5 → 0.0.6

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/index.js CHANGED
@@ -27,7 +27,7 @@ ${i.map(f=>`
27
27
  ${l}in ${f}`).join("")}
28
28
  `}),re(e,"component_stack",{value:i});let _=e.stack;if(_){let f=_.split(`
29
29
  `),a=[];for(let c=0;c<f.length;c++){let u=f[c];u.includes("svelte/src/internal")||a.push(u)}re(e,"stack",{value:a.join(`
30
- `)})}if(wo(e,t),Eo(t))throw e}function No(e,t,r=0){var n=e.reactions;if(n!==null)for(var i=0;i<n.length;i++){var o=n[i];o.f&2?No(o,t,r+1):t===o&&(r===0?ce(o,2048):o.f&1024&&ce(o,4096),Lt(o))}}function br(e){var t=Te,r=Se,n=Ze,i=O,o=lt,s=Be,p=C,l=Ve,_=e.f;Te=null,Se=0,Ze=null,O=_&96?null:e,lt=!st&&(_&256)!==0,Be=null,C=e.ctx,Ve=!1,Ar++;try{var f=(0,e.fn)(),a=e.deps;if(Te!==null){var c;if(Tt(e,Se),a!==null&&Se>0)for(a.length=Se+Te.length,c=0;c<Te.length;c++)a[Se+c]=Te[c];else e.deps=a=Te;if(!lt)for(c=Se;c<a.length;c++)(a[c].reactions??=[]).push(e)}else a!==null&&Se<a.length&&(Tt(e,Se),a.length=Se);if(at()&&Ze!==null&&!(e.f&6146))for(c=0;c<Ze.length;c++)No(Ze[c],e);return i!==null&&Ar++,f}finally{Te=t,Se=r,Ze=n,O=i,lt=o,Be=s,C=p,Ve=l}}function bi(e,t){let r=t.reactions;if(r!==null){var n=Fn.call(r,e);if(n!==-1){var i=r.length-1;i===0?r=t.reactions=null:(r[n]=r[i],r.pop())}}r===null&&t.f&2&&(Te===null||!Te.includes(t))&&(ce(t,4096),t.f&768||(t.f^=512),Tt(t,0))}function Tt(e,t){var r=e.deps;if(r!==null)for(var n=t;n<r.length;n++)bi(e,r[n])}function Ot(e){var t=e.f;if(!(t&16384)){ce(e,1024);var r=I,n=C;if(I=e,x){var i=ke;ke=e.component_function}try{t&16?vo(e):mn(e),dn(e),_n(e);var o=br(e);e.teardown=typeof o=="function"?o:null,e.wv=Io;var s=e.deps;if(x&&Ke&&e.f&2048&&s!==null)for(let l=0;l<s.length;l++){var p=s[l];p.trace_need_increase&&(p.wv=tr(),p.trace_need_increase=void 0,p.trace_v=void 0)}x&&lr.push(e)}catch(l){Ht(l,e,r,n||e.ctx)}finally{I=r,x&&(ke=i)}}}function To(){console.error("Last ten effects were: ",lr.slice(-10).map(e=>e.fn)),lr=[]}function Do(){if(Yt>1e3){Yt=0;try{Hn()}catch(e){if(x&&re(e,"stack",{value:""}),Vt!==null)if(x)try{Ht(e,Vt,null,null)}catch(t){throw To(),t}else Ht(e,Vt,null,null);else throw x&&To(),e}}Yt++}function Ro(e){var t=e.length;if(t!==0){Do();var r=st;st=!0;try{for(var n=0;n<t;n++){var i=e[n];i.f&1024||(i.f^=1024);var o=[];Co(i,o),$i(o)}}finally{st=r}}}function $i(e){var t=e.length;if(t!==0)for(var r=0;r<t;r++){var n=e[r];if(!(n.f&24576))try{_t(n)&&(Ot(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?vn(n):n.fn=null))}catch(i){Ht(i,n,null,n.ctx)}}}function wi(){if(ar=!1,Yt>1001)return;let e=At;At=[],Ro(e),ar||(Yt=0,Vt=null,x&&(lr=[]))}function Lt(e){Tr===So&&(ar||(ar=!0,queueMicrotask(wi))),Vt=e;for(var t=e;t.parent!==null;){t=t.parent;var r=t.f;if(r&96){if(!(r&1024))return;t.f^=1024}}At.push(t)}function Co(e,t){var r=e.first,n=[];e:for(;r!==null;){var i=r.f,o=(i&32)!==0,s=o&&(i&1024)!==0,p=r.next;if(!s&&!(i&8192))if(i&8){if(o)r.f^=1024;else try{_t(r)&&Ot(r)}catch(a){Ht(a,r,null,r.ctx)}var l=r.first;if(l!==null){r=l;continue}}else i&4&&n.push(r);if(p===null){let a=r.parent;for(;a!==null;){if(e===a)break e;var _=a.next;if(_!==null){r=_;continue e}a=a.parent}}r=p}for(var f=0;f<n.length;f++)l=n[f],t.push(l),Co(l,t)}function b(e){var t=Tr,r=At;try{Do();let i=[];Tr=yi,At=i,ar=!1,Ro(r);var n=e?.();return bo(),(At.length>0||i.length>0)&&b(),Yt=0,Vt=null,x&&(lr=[]),n}finally{Tr=t,At=r}}function d(e){var t=e.f,r=(t&2)!==0;if(r&&t&16384){var n=ln(e);return sr(e),n}if(er!==null&&er.add(e),O!==null&&!Ve){Be!==null&&Be.includes(e)&&Kn();var i=O.deps;e.rv<Ar&&(e.rv=Ar,Te===null&&i!==null&&i[Se]===e?Se++:Te===null?Te=[e]:Te.push(e))}else if(r&&e.deps===null)for(var o=e,s=o.parent,p=o;s!==null;)if(s.f&2){var l=s;p=l,s=l.parent}else{var _=s;_.deriveds?.includes(p)||(_.deriveds??=[]).push(p);break}if(r&&(o=e,_t(o)&&fn(o)),x&&Ke&&Qt!==null&&O!==null&&Qt.reaction===O){if(e.debug)e.debug();else if(e.created){var f=Qt.entries.get(e);f===void 0&&(f={read:[]},Qt.entries.set(e,f)),f.read.push(nt("TracedAt"))}}return e.v}function J(e){var t=Ve;try{return Ve=!0,e()}finally{Ve=t}}var Ei=-7169;function ce(e,t){e.f=e.f&Ei|t}function Q(e,t=!1,r){C={p:C,c:null,e:null,m:!1,s:e,x:null,l:null},pt&&!t&&(C.l={s:null,u:null,r1:[],r2:z(!1)}),x&&(C.function=r,ke=r)}function ee(e){let t=C;if(t!==null){e!==void 0&&(t.x=e);let s=t.e;if(s!==null){var r=I,n=O;t.e=null;try{for(var i=0;i<s.length;i++){var o=s[i];W(o.effect),ae(o.reaction),tt(o.fn)}}finally{W(r),ae(n)}}C=t.p,x&&(ke=t.p?.function??null),t.m=!0}return e||{}}if(x){let e=function(t){if(!(t in globalThis)){let r;Object.defineProperty(globalThis,t,{configurable:!0,get:()=>{if(r!==void 0)return r;jn(t)},set:n=>{r=n}})}};e("$state"),e("$effect"),e("$derived"),e("$inspect"),e("$props"),e("$bindable")}var Po=new Map;function Oo(e,t){var r=Po.get(e);r||(r=new Set,Po.set(e,r)),r.add(t)}function yn(e){var t=O,r=I;ae(null),W(null);try{return e()}finally{ae(t),W(r)}}var bn=new Set,Nr=new Set;function Lo(e,t,r,n={}){function i(o){if(n.capture||zt.call(t,o),!o.cancelBubble)return yn(()=>r?.call(this,o))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?Ae(()=>{t.addEventListener(e,i,n)}):t.addEventListener(e,i,n),i}function Dr(e,t,r,n,i){var o={capture:n,passive:i},s=Lo(e,t,r,o);(t===document.body||t===window||t===document)&&Fe(()=>{t.removeEventListener(e,s,o)})}function Ut(e){for(var t=0;t<e.length;t++)bn.add(e[t]);for(var r of Nr)r(e)}function zt(e){var t=this,r=t.ownerDocument,n=e.type,i=e.composedPath?.()||[],o=i[0]||e.target,s=0,p=e.__root;if(p){var l=i.indexOf(p);if(l!==-1&&(t===document||t===window)){e.__root=t;return}var _=i.indexOf(t);if(_===-1)return;l<=_&&(s=l)}if(o=i[s]||e.target,o!==t){re(e,"currentTarget",{configurable:!0,get(){return o||r}});var f=O,a=I;ae(null),W(null);try{for(var c,u=[];o!==null;){var g=o.assignedSlot||o.parentNode||o.host||null;try{var m=o["__"+n];if(m!==void 0&&!o.disabled)if(qe(m)){var[$,...h]=m;$.apply(o,[e,...h])}else m.call(o,e)}catch(v){c?u.push(v):c=v}if(e.cancelBubble||g===t||g===null)break;o=g}if(c){for(let v of u)queueMicrotask(()=>{throw v});throw c}}finally{e.__root=t,delete e.currentTarget,ae(f),W(a)}}}var Ai;function Mo(){Ai=void 0}function fr(e){var t=document.createElement("template");return t.innerHTML=e,t.content}function xe(e,t){var r=I;r.nodes_start===null&&(r.nodes_start=e,r.nodes_end=t)}function L(e,t){var r=(t&1)!==0,n=(t&2)!==0,i,o=!e.startsWith("<!>");return()=>{if(T)return xe(S,null),S;i===void 0&&(i=fr(o?e:"<!>"+e),r||(i=G(i)));var s=n?document.importNode(i,!0):i.cloneNode(!0);if(r){var p=G(s),l=s.lastChild;xe(p,l)}else xe(s,s);return s}}function St(e,t,r="svg"){var n=!e.startsWith("<!>"),i=(t&1)!==0,o=`<${r}>${n?e:"<!>"+e}</${r}>`,s;return()=>{if(T)return xe(S,null),S;if(!s){var p=fr(o),l=G(p);if(i)for(s=document.createDocumentFragment();G(l);)s.appendChild(G(l));else s=G(l)}var _=s.cloneNode(!0);if(i){var f=G(_),a=_.lastChild;xe(f,a)}else xe(_,_);return _}}function cr(e=""){if(!T){var t=we(e+"");return xe(t,t),t}var r=S;return r.nodeType!==3&&(r.before(r=we()),Y(r)),xe(r,r),r}function H(){if(T)return xe(S,null),S;var e=document.createDocumentFragment(),t=document.createComment(""),r=we();return e.append(t,r),xe(t,r),e}function k(e,t){if(T){I.nodes_end=S,se();return}e!==null&&e.before(t)}var $n=!0;function Ie(e,t){var r=t==null?"":typeof t=="object"?t+"":t;r!==(e.__t??=e.nodeValue)&&(e.__t=r,e.nodeValue=r==null?"":r+"")}function Rr(e,t){return qo(e,t)}function En(e,t){yr(),t.intro=t.intro??!1;let r=t.target,n=T,i=S;try{for(var o=G(r);o&&(o.nodeType!==8||o.data!==Dt);)o=he(o);if(!o)throw ut;$e(!0),Y(o),se();let s=qo(e,{...t,anchor:o});if(S===null||S.nodeType!==8||S.data!==bt)throw Mt(),ut;return $e(!1),s}catch(s){if(s===ut)return t.recover===!1&&Un(),yr(),or(r),$e(!1),Rr(e,t);throw s}finally{$e(n),Y(i),Mo()}}var jt=new Map;function qo(e,{target:t,anchor:r,props:n={},events:i,context:o,intro:s=!0}){yr();var p=new Set,l=a=>{for(var c=0;c<a.length;c++){var u=a[c];if(!p.has(u)){p.add(u);var g=Ln(u);t.addEventListener(u,zt,{passive:g});var m=jt.get(u);m===void 0?(document.addEventListener(u,zt,{passive:g}),jt.set(u,1)):jt.set(u,m+1)}}};l(Zt(bn)),Nr.add(l);var _=void 0,f=mo(()=>{var a=r??t.appendChild(we());return X(()=>{if(o){Q({});var c=C;c.c=o}i&&(n.$$events=i),T&&xe(a,null),$n=s,_=e(a,n)||{},$n=!0,T&&(I.nodes_end=S),o&&ee()}),()=>{for(var c of p){t.removeEventListener(c,zt);var u=jt.get(c);--u===0?(document.removeEventListener(c,zt),jt.delete(c)):jt.set(c,u)}Nr.delete(l),a!==r&&a.parentNode?.removeChild(a)}});return wn.set(_,f),_}var wn=new WeakMap;function Tn(e,t){let r=wn.get(e);return r?(wn.delete(e),r(t)):(x&&ro(),Promise.resolve())}var kn=0,Cr=1,An=2;function ur(e,t,r,n,i){T&&se();var o=e,s=at(),p=C,l=x?C?.function:null,_=U,f,a,c,u=(s?z:Je)(void 0),g=(s?z:Je)(void 0),m=!1;function $(v,y){m=!0,y&&(W(h),ae(h),Sr(p),x&&Ir(l));try{v===kn&&r&&(f?He(f):f=X(()=>r(o))),v===Cr&&n&&(a?He(a):a=X(()=>n(o,u))),v===An&&i&&(c?He(c):c=X(()=>i(o,g))),v!==kn&&f&&Ee(f,()=>f=null),v!==Cr&&a&&Ee(a,()=>a=null),v!==An&&c&&Ee(c,()=>c=null)}finally{y&&(x&&Ir(null),Sr(null),ae(null),W(null),b())}}var h=ge(()=>{if(_!==(_=t())){if(Bn(_)){var v=_;m=!1,v.then(y=>{v===_&&(it(u,y),$(Cr,!0))},y=>{if(v===_&&(it(g,y),$(An,!0),!i))throw g.v}),T?r&&(f=X(()=>r(o))):Ae(()=>{m||$(kn,!0)})}else it(u,_),$(Cr,!1);return()=>_=U}});T&&(o=S)}function M(e,t,r=!1){T&&se();var n=e,i=null,o=null,s=U,p=r?65536:0,l=!1;let _=(a,c=!0)=>{l=!0,f(c,a)},f=(a,c)=>{if(s===(s=a))return;let u=!1;if(T){let g=n.data===yt;!!s===g&&(n=Ft(),Y(n),$e(!1),u=!0)}s?(i?He(i):c&&(i=X(()=>c(n))),o&&Ee(o,()=>{o=null})):(o?He(o):c&&(o=X(()=>c(n))),i&&Ee(i,()=>{i=null})),u&&$e(!0)};ge(()=>{l=!1,t(_),l||f(null,null)},p),T&&(n=S)}var pr=null;function pe(e,t){return t}function Ri(e,t,r,n){for(var i=[],o=t.length,s=0;s<o;s++)$r(t[s].e,i,!0);var p=o>0&&i.length===0&&r!==null;if(p){var l=r.parentNode;or(l),l.append(r),n.clear(),mt(e,t[0].prev,t[o-1].next)}hn(i,()=>{for(var _=0;_<o;_++){var f=t[_];p||(n.delete(f.k),mt(e,f.prev,f.next)),ue(f.e,!p)}})}function _e(e,t,r,n,i,o=null){var s=e,p={flags:t,items:new Map,first:null},l=(t&4)!==0;if(l){var _=e;s=T?Y(G(_)):_.appendChild(we())}T&&se();var f=null,a=!1,c=ir(()=>{var u=r();return qe(u)?u:u==null?[]:Zt(u)});ge(()=>{var u=d(c),g=u.length;if(a&&g===0)return;a=g===0;let m=!1;if(T){var $=s.data===yt;$!==(g===0)&&(s=Ft(),Y(s),$e(!1),m=!0)}if(T){for(var h=null,v,y=0;y<g;y++){if(S.nodeType===8&&S.data===bt){s=S,m=!0,$e(!1);break}var R=u[y],w=n(R,y);v=Yo(S,p,h,null,R,w,y,i,t,r),p.items.set(w,v),h=v}g>0&&Y(Ft())}if(!T){var N=O;Ci(u,p,s,i,t,(N.f&8192)!==0,n,r)}o!==null&&(g===0?f?He(f):f=X(()=>o(s)):f!==null&&Ee(f,()=>{f=null})),m&&$e(!0),d(c)}),T&&(s=S)}function Ci(e,t,r,n,i,o,s,p){var l=(i&8)!==0,_=(i&3)!==0,f=e.length,a=t.items,c=t.first,u=c,g,m=null,$,h=[],v=[],y,R,w,N;if(l)for(N=0;N<f;N+=1)y=e[N],R=s(y,N),w=a.get(R),w!==void 0&&(w.a?.measure(),($??=new Set).add(w));for(N=0;N<f;N+=1){if(y=e[N],R=s(y,N),w=a.get(R),w===void 0){var F=u?u.e.nodes_start:r;m=Yo(F,t,m,m===null?t.first:m.next,y,R,N,n,i,p),a.set(R,m),h=[],v=[],u=m.next;continue}if(_&&Pi(w,y,N,i),w.e.f&8192&&(He(w.e),l&&(w.a?.unfix(),($??=new Set).delete(w))),w!==u){if(g!==void 0&&g.has(w)){if(h.length<v.length){var de=v[0],K;m=de.prev;var _r=h[0],Nt=h[h.length-1];for(K=0;K<h.length;K+=1)Bo(h[K],de,r);for(K=0;K<v.length;K+=1)g.delete(v[K]);mt(t,_r.prev,Nt.next),mt(t,m,_r),mt(t,Nt,de),u=de,m=Nt,N-=1,h=[],v=[]}else g.delete(w),Bo(w,u,r),mt(t,w.prev,w.next),mt(t,w,m===null?t.first:m.next),mt(t,m,w),m=w;continue}for(h=[],v=[];u!==null&&u.k!==R;)(o||!(u.e.f&8192))&&(g??=new Set).add(u),v.push(u),u=u.next;if(u===null)continue;w=u}h.push(w),m=w,u=w.next}if(u!==null||g!==void 0){for(var gt=g===void 0?[]:Zt(g);u!==null;)(o||!(u.e.f&8192))&&gt.push(u),u=u.next;var Kt=gt.length;if(Kt>0){var jr=i&4&&f===0?r:null;if(l){for(N=0;N<Kt;N+=1)gt[N].a?.measure();for(N=0;N<Kt;N+=1)gt[N].a?.fix()}Ri(t,gt,jr,a)}}l&&Ae(()=>{if($!==void 0)for(w of $)w.a?.apply()}),I.first=t.first&&t.first.e,I.last=m&&m.e}function Pi(e,t,r,n){n&1&&it(e.v,t),n&2?it(e.i,r):e.i=r}function Yo(e,t,r,n,i,o,s,p,l,_){var f=pr,a=(l&1)!==0,c=(l&16)===0,u=a?c?Je(i):z(i):i,g=l&2?z(s):s;x&&a&&(u.debug=()=>{var $=typeof g=="number"?s:g.v;_()[$]});var m={i:g,v:u,k:o,a:null,e:null,prev:r,next:n};pr=m;try{return m.e=X(()=>p(e,u,g,_),T),m.e.prev=r&&r.e,m.e.next=n&&n.e,r===null?t.first=m:(r.next=m,r.e.next=m.e),n!==null&&(n.prev=m,n.e.prev=m.e),m}finally{pr=f}}function Bo(e,t,r){for(var n=e.next?e.next.e.nodes_start:r,i=t?t.e.nodes_start:r,o=e.e.nodes_start;o!==n;){var s=he(o);i.before(o),o=s}}function mt(e,t,r){t===null?e.first=r:(t.next=r,t.e.next=r&&r.e),r!==null&&(r.prev=t,r.e.prev=t&&t.e)}function le(e,t){Ae(()=>{var r=e.getRootNode(),n=r.host?r:r.head??r.ownerDocument.head;if(!n.querySelector("#"+t.hash)){let i=document.createElement("style");i.id=t.hash,i.textContent=t.code,n.appendChild(i),x&&Oo(t.hash,i)}})}function Uo(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=Uo(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function zo(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=Uo(e))&&(n&&(n+=" "),n+=t);return n}function Pr(e){return typeof e=="object"?zo(e):e??""}function A(e,t,r,n){var i=e.__attributes??={};if(T&&(i[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")){n||Fi(e,t,r??"");return}i[t]!==(i[t]=r)&&(t==="style"&&"__styles"in e&&(e.__styles={}),t==="loading"&&(e[Vn]=r),r==null?e.removeAttribute(t):typeof r!="string"&&Mi(e).includes(t)?e[t]=r:e.setAttribute(t,r))}var jo=new Map;function Mi(e){var t=jo.get(e.nodeName);if(t)return t;jo.set(e.nodeName,t=[]);for(var r,n=e,i=Element.prototype;i!==n;){r=Kr(n);for(var o in r)r[o].set&&t.push(o);n=$t(n)}return t}function Fi(e,t,r){x&&(t==="srcset"&&qi(e,r)||Nn(e.getAttribute(t)??"",r)||to(t,e.outerHTML.replace(e.innerHTML,e.innerHTML&&"..."),String(r)))}function Nn(e,t){return e===t?!0:new URL(e,document.baseURI).href===new URL(t,document.baseURI).href}function Go(e){return e.split(",").map(t=>t.trim().split(" ").filter(Boolean))}function qi(e,t){var r=Go(e.srcset),n=Go(t);return n.length===r.length&&n.every(([i,o],s)=>o===r[s][1]&&(Nn(r[s][0],i)||Nn(i,r[s][0])))}function Dn(e,t,r){var n=e.__className,i=Bi(t,r);T&&e.className===i?e.__className=i:(n!==i||T&&e.className!==i)&&(t==null&&!r?e.removeAttribute("class"):e.className=i,e.__className=i)}function Bi(e,t){return(e??"")+(t?" "+t:"")}function Or(e,t,r,n){var i=e.__styles??={};i[t]!==r&&(i[t]=r,r==null?e.style.removeProperty(t):e.style.setProperty(t,r,n?"important":""))}var Mr=!1,nd=Symbol();function Rn(e){var t=Mr;try{return Mr=!1,[e(),Mr]}finally{Mr=t}}function Ko(e){for(var t=I,r=I;t!==null&&!(t.f&96);)t=t.parent;try{return W(t),e()}finally{W(r)}}function E(e,t,r,n){var i=(r&1)!==0,o=!pt||(r&2)!==0,s=(r&8)!==0,p=(r&16)!==0,l=!1,_;s?[_,l]=Rn(()=>e[t]):_=e[t];var f=De in e||dr in e,a=s&&(Ne(e,t)?.set??(f&&t in e&&(F=>e[t]=F)))||void 0,c=n,u=!0,g=!1,m=()=>(g=!0,u&&(u=!1,p?c=J(n):c=n),c);_===void 0&&n!==void 0&&(a&&o&&zn(t),_=m(),a&&a(_));var $;if(o)$=()=>{var F=e[t];return F===void 0?m():(u=!0,g=!1,F)};else{var h=Ko(()=>(i?D:ir)(()=>e[t]));h.f|=131072,$=()=>{var F=d(h);return F!==void 0&&(c=void 0),F===void 0?c:F}}if(!(r&4))return $;if(a){var v=e.$$legacy;return function(F,de){return arguments.length>0?((!o||!de||v||l)&&a(de?$():F),F):$()}}var y=!1,R=!1,w=Je(_),N=Ko(()=>D(()=>{var F=$(),de=d(w);return y?(y=!1,R=!0,de):(R=!1,w.v=F)}));return i||(N.equals=Rt),function(F,de){if(er!==null&&(y=R,$(),d(w)),arguments.length>0){let K=de?d(N):o&&s?Qe(F):F;return N.equals(K)||(y=!0,j(w,K),g&&c!==void 0&&(c=K),J(()=>d(N))),F}return d(N)}}function Zo(e){return new Cn(e)}var Cn=class{#t;#e;constructor(t){var r=new Map,n=(o,s)=>{var p=Je(s);return r.set(o,p),p};let i=new Proxy({...t.props||{},$$events:{}},{get(o,s){return d(r.get(s)??n(s,Reflect.get(o,s)))},has(o,s){return s===dr?!0:(d(r.get(s)??n(s,Reflect.get(o,s))),Reflect.has(o,s))},set(o,s,p){return j(r.get(s)??n(s,p),p),Reflect.set(o,s,p)}});this.#e=(t.hydrate?En:Rr)(t.component,{target:t.target,anchor:t.anchor,props:i,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&b(),this.#t=i.$$events;for(let o of Object.keys(this.#e))o==="$set"||o==="$destroy"||o==="$on"||re(this,o,{get(){return this.#e[o]},set(s){this.#e[o]=s},enumerable:!0});this.#e.$set=o=>{Object.assign(i,o)},this.#e.$destroy=()=>{Tn(this.#e)}}$set(t){this.#e.$set(t)}$on(t,r){this.#t[t]=this.#t[t]||[];let n=(...i)=>r.call(this,...i);return this.#t[t].push(n),()=>{this.#t[t]=this.#t[t].filter(i=>i!==n)}}$destroy(){this.#e.$destroy()}};var Xo;typeof HTMLElement=="function"&&(Xo=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(e,t,r){super(),this.$$ctor=e,this.$$s=t,r&&this.attachShadow({mode:"open"})}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){let n=this.$$c.$on(e,t);this.$$l_u.set(t,n)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){let n=this.$$l_u.get(t);n&&(n(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(n){return i=>{let o=document.createElement("slot");n!=="default"&&(o.name=n),k(i,o)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let t={},r=cs(this);for(let n of this.$$s)n in r&&(n==="default"&&!this.$$d.children?(this.$$d.children=e(n),t.default=!0):t[n]=e(n));for(let n of this.attributes){let i=this.$$g_p(n.name);i in this.$$d||(this.$$d[i]=Fr(i,n.value,this.$$p_d,"toProp"))}for(let n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=Zo({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=pn(()=>{Le(()=>{this.$$r=!0;for(let n of Xt(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];let i=Fr(n,this.$$d[n],this.$$p_d,"toAttribute");i==null?this.removeAttribute(this.$$p_d[n].attribute||n):this.setAttribute(this.$$p_d[n].attribute||n,i)}this.$$r=!1})});for(let n in this.$$l)for(let i of this.$$l[n]){let o=this.$$c.$on(n,i);this.$$l_u.set(i,o)}this.$$l={}}}attributeChangedCallback(e,t,r){this.$$r||(e=this.$$g_p(e),this.$$d[e]=Fr(e,r,this.$$p_d,"toProp"),this.$$c?.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return Xt(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function Fr(e,t,r,n){let i=r[e]?.type;if(t=i==="Boolean"&&typeof t!="boolean"?t!=null:t,!n||!r[e])return t;if(n==="toAttribute")switch(i){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(i){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function cs(e){let t={};return e.childNodes.forEach(r=>{t[r.slot||"default"]=!0}),t}function fe(e,t,r,n,i,o){let s=class extends Xo{constructor(){super(e,r,i),this.$$p_d=t}static get observedAttributes(){return Xt(t).map(p=>(t[p].attribute||p).toLowerCase())}};return Xt(t).forEach(p=>{re(s.prototype,p,{get(){return this.$$c&&p in this.$$c?this.$$c[p]:this.$$d[p]},set(l){l=Fr(p,l,t),this.$$d[p]=l;var _=this.$$c;if(_){var f=Ne(_,p)?.get;f?_[p]=l:_.$set({[p]:l})}}})}),n.forEach(p=>{re(s.prototype,p,{get(){return this.$$c?.[p]}})}),o&&(s=o(s)),e.element=s,s}function Gt(...e){return function(t){return rt.DocItem(t)&&e.includes(t.label)}}var ht={CodeItem:Gt("code"),ListItem:Gt("list_item"),PictureItem:Gt("picture"),SectionHeaderItem:Gt("section_header"),TableItem:Gt("document_index","table"),TextItem:Gt("caption","checkbox_selected","checkbox_unselected","footnote","page_footer","page_header","paragraph","reference","text")},rt={Document(e){return"schema_name"in e&&e.schema_name==="DoclingDocument"},NodeItem(e){return"self_ref"in e},GroupItem(e){return rt.NodeItem(e)&&(e.self_ref.startsWith("#/groups/")||e.self_ref==="#/body")},DocItem(e){return rt.NodeItem(e)&&!rt.GroupItem(e)},...ht};function*Jo(e,t={}){e&&(yield*r(t.root??e.body));function*r(n,i=0){if((!rt.GroupItem(n)||t.withGroups)&&(rt.DocItem(n)?(t.pageNo===void 0||n.prov?.some(o=>o.page_no===t.pageNo))&&(yield[n,i]):yield[n,i]),!(rt.PictureItem(n)&&!t.traversePictures))for(let o of n.children??[]){let s=ps(e,o);rt.NodeItem(s)&&(yield*r(s,i+1))}}}function ps(e,t){return t.$ref.split("/").slice(1).reduce((n,i)=>n[i],e)}function _s(e){return Object.values(e?.pages??{}).sort((t,r)=>t.page_no-r.page_no)}async function qr(e,t={}){let r;typeof e=="string"?r=await(await fetch(e)).json():typeof e=="object"&&rt.Document(e)&&(r=e);let n=_s(r),i=Array.from(Jo(r)).map(([l])=>l),o=i,s=new Set;if(typeof t.items=="string"){let l=new Set(t.items.split(",").map(_=>_.trim()).filter(_=>_.length>0));if(l.size>0){o=[];for(let _ of i){let f=_.self_ref.split("/"),a=[];for(let c=2;c<f.length+1;c++)a.push(f.slice(0,c).join("/"));_.prov?.forEach(c=>a.push(`#/pages/${c.page_no}`)),a.some(c=>l.has(c))?o.push(_):_.prov?.forEach(c=>s.add(c.page_no))}}}else if(Array.isArray(t.items)){o=[];let l=new Set(t.items);for(let _ of i)l.has(_)?o.push(_):_.prov?.forEach(f=>s.add(f.page_no))}let p={};for(let l of n)p[l.page_no]=[];for(let l of o)for(let _ of l.prov??[])p[_.page_no].push(l);return n.map(l=>({page:l,items:p[l.page_no],trimmed:s.has(l.page_no)}))}var ds=L("<td> </td>"),ms=L("<tr></tr>"),vs=L('<div class="container svelte-1c6yx17"><table class="svelte-1c6yx17"><tbody></tbody></table></div>'),hs={hash:"svelte-1c6yx17",code:".container.svelte-1c6yx17 {position:relative;min-width:0;max-width:100%;min-height:0;overflow:auto;}table.svelte-1c6yx17 {border-collapse:collapse;}td.svelte-1c6yx17 {padding:0 0.5rem;background-color:var(--cds-layer);border:1px solid rgb(220, 220, 220);color:black;font-size:0.75rem;line-height:1.5rem;text-decoration:none;word-break:normal;text-align:left;}td.header.svelte-1c6yx17 {font-weight:bold;}td.svelte-1c6yx17:hover {filter:brightness(95%);}td.svelte-1c6yx17:target {outline:3px solid blue;}"};function Br(e,t){Q(t,!0),le(e,hs);let r=E(t,"item",7),n=D(()=>function(){let p=new Set;return function(l){let _=p.has([l.start_col_offset_idx,l.start_row_offset_idx].join());if(!_)for(let f=l.start_col_offset_idx;f<l.end_col_offset_idx;f++)for(let a=l.start_row_offset_idx;a<l.end_row_offset_idx;a++)p.add([f,a].join());return _}}());var i=vs(),o=B(i),s=B(o);return _e(s,21,()=>r().data.grid,pe,(p,l)=>{var _=ms();_e(_,21,()=>d(l),pe,(f,a)=>{var c=H(),u=V(c);{var g=m=>{var $=ds();let h=D(()=>`${r().self_ref}/${d(a).start_col_offset_idx}/${d(a).start_row_offset_idx}`.slice(1));var v=B($,!0);P($),q(()=>{A($,"id",d(h)),Dn($,Pr(d(a).column_header||d(a).row_header?"header":""),"svelte-1c6yx17"),A($,"colspan",d(a).col_span),A($,"rowspan",d(a).row_span),Ie(v,d(a).text)}),k(m,$)};M(u,m=>{d(n)(d(a))||m(g)})}k(f,c)}),P(_),k(p,_)}),P(s),P(o),P(i),k(e,i),ee({get item(){return r()},set item(p){r(p),b()}})}fe(Br,{item:{}},[],[],!0);var gs=L('<p class="svelte-1v2vl7q"> </p>'),xs=L('<h2 class="svelte-1v2vl7q"> </h2>'),ys=L("<div><span> </span></div>"),bs={hash:"svelte-1v2vl7q",code:`p.svelte-1v2vl7q,
30
+ `)})}if(wo(e,t),Eo(t))throw e}function No(e,t,r=0){var n=e.reactions;if(n!==null)for(var i=0;i<n.length;i++){var o=n[i];o.f&2?No(o,t,r+1):t===o&&(r===0?ce(o,2048):o.f&1024&&ce(o,4096),Lt(o))}}function br(e){var t=Te,r=Se,n=Ze,i=O,o=lt,s=Be,p=C,l=Ve,_=e.f;Te=null,Se=0,Ze=null,O=_&96?null:e,lt=!st&&(_&256)!==0,Be=null,C=e.ctx,Ve=!1,Ar++;try{var f=(0,e.fn)(),a=e.deps;if(Te!==null){var c;if(Tt(e,Se),a!==null&&Se>0)for(a.length=Se+Te.length,c=0;c<Te.length;c++)a[Se+c]=Te[c];else e.deps=a=Te;if(!lt)for(c=Se;c<a.length;c++)(a[c].reactions??=[]).push(e)}else a!==null&&Se<a.length&&(Tt(e,Se),a.length=Se);if(at()&&Ze!==null&&!(e.f&6146))for(c=0;c<Ze.length;c++)No(Ze[c],e);return i!==null&&Ar++,f}finally{Te=t,Se=r,Ze=n,O=i,lt=o,Be=s,C=p,Ve=l}}function bi(e,t){let r=t.reactions;if(r!==null){var n=Fn.call(r,e);if(n!==-1){var i=r.length-1;i===0?r=t.reactions=null:(r[n]=r[i],r.pop())}}r===null&&t.f&2&&(Te===null||!Te.includes(t))&&(ce(t,4096),t.f&768||(t.f^=512),Tt(t,0))}function Tt(e,t){var r=e.deps;if(r!==null)for(var n=t;n<r.length;n++)bi(e,r[n])}function Ot(e){var t=e.f;if(!(t&16384)){ce(e,1024);var r=I,n=C;if(I=e,x){var i=ke;ke=e.component_function}try{t&16?vo(e):mn(e),dn(e),_n(e);var o=br(e);e.teardown=typeof o=="function"?o:null,e.wv=Io;var s=e.deps;if(x&&Ke&&e.f&2048&&s!==null)for(let l=0;l<s.length;l++){var p=s[l];p.trace_need_increase&&(p.wv=tr(),p.trace_need_increase=void 0,p.trace_v=void 0)}x&&lr.push(e)}catch(l){Ht(l,e,r,n||e.ctx)}finally{I=r,x&&(ke=i)}}}function To(){console.error("Last ten effects were: ",lr.slice(-10).map(e=>e.fn)),lr=[]}function Do(){if(Yt>1e3){Yt=0;try{Hn()}catch(e){if(x&&re(e,"stack",{value:""}),Vt!==null)if(x)try{Ht(e,Vt,null,null)}catch(t){throw To(),t}else Ht(e,Vt,null,null);else throw x&&To(),e}}Yt++}function Ro(e){var t=e.length;if(t!==0){Do();var r=st;st=!0;try{for(var n=0;n<t;n++){var i=e[n];i.f&1024||(i.f^=1024);var o=[];Co(i,o),$i(o)}}finally{st=r}}}function $i(e){var t=e.length;if(t!==0)for(var r=0;r<t;r++){var n=e[r];if(!(n.f&24576))try{_t(n)&&(Ot(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?vn(n):n.fn=null))}catch(i){Ht(i,n,null,n.ctx)}}}function wi(){if(ar=!1,Yt>1001)return;let e=At;At=[],Ro(e),ar||(Yt=0,Vt=null,x&&(lr=[]))}function Lt(e){Tr===So&&(ar||(ar=!0,queueMicrotask(wi))),Vt=e;for(var t=e;t.parent!==null;){t=t.parent;var r=t.f;if(r&96){if(!(r&1024))return;t.f^=1024}}At.push(t)}function Co(e,t){var r=e.first,n=[];e:for(;r!==null;){var i=r.f,o=(i&32)!==0,s=o&&(i&1024)!==0,p=r.next;if(!s&&!(i&8192))if(i&8){if(o)r.f^=1024;else try{_t(r)&&Ot(r)}catch(a){Ht(a,r,null,r.ctx)}var l=r.first;if(l!==null){r=l;continue}}else i&4&&n.push(r);if(p===null){let a=r.parent;for(;a!==null;){if(e===a)break e;var _=a.next;if(_!==null){r=_;continue e}a=a.parent}}r=p}for(var f=0;f<n.length;f++)l=n[f],t.push(l),Co(l,t)}function b(e){var t=Tr,r=At;try{Do();let i=[];Tr=yi,At=i,ar=!1,Ro(r);var n=e?.();return bo(),(At.length>0||i.length>0)&&b(),Yt=0,Vt=null,x&&(lr=[]),n}finally{Tr=t,At=r}}function d(e){var t=e.f,r=(t&2)!==0;if(r&&t&16384){var n=ln(e);return sr(e),n}if(er!==null&&er.add(e),O!==null&&!Ve){Be!==null&&Be.includes(e)&&Kn();var i=O.deps;e.rv<Ar&&(e.rv=Ar,Te===null&&i!==null&&i[Se]===e?Se++:Te===null?Te=[e]:Te.push(e))}else if(r&&e.deps===null)for(var o=e,s=o.parent,p=o;s!==null;)if(s.f&2){var l=s;p=l,s=l.parent}else{var _=s;_.deriveds?.includes(p)||(_.deriveds??=[]).push(p);break}if(r&&(o=e,_t(o)&&fn(o)),x&&Ke&&Qt!==null&&O!==null&&Qt.reaction===O){if(e.debug)e.debug();else if(e.created){var f=Qt.entries.get(e);f===void 0&&(f={read:[]},Qt.entries.set(e,f)),f.read.push(nt("TracedAt"))}}return e.v}function J(e){var t=Ve;try{return Ve=!0,e()}finally{Ve=t}}var Ei=-7169;function ce(e,t){e.f=e.f&Ei|t}function Q(e,t=!1,r){C={p:C,c:null,e:null,m:!1,s:e,x:null,l:null},pt&&!t&&(C.l={s:null,u:null,r1:[],r2:z(!1)}),x&&(C.function=r,ke=r)}function ee(e){let t=C;if(t!==null){e!==void 0&&(t.x=e);let s=t.e;if(s!==null){var r=I,n=O;t.e=null;try{for(var i=0;i<s.length;i++){var o=s[i];W(o.effect),ae(o.reaction),tt(o.fn)}}finally{W(r),ae(n)}}C=t.p,x&&(ke=t.p?.function??null),t.m=!0}return e||{}}if(x){let e=function(t){if(!(t in globalThis)){let r;Object.defineProperty(globalThis,t,{configurable:!0,get:()=>{if(r!==void 0)return r;jn(t)},set:n=>{r=n}})}};e("$state"),e("$effect"),e("$derived"),e("$inspect"),e("$props"),e("$bindable")}var Po=new Map;function Oo(e,t){var r=Po.get(e);r||(r=new Set,Po.set(e,r)),r.add(t)}function yn(e){var t=O,r=I;ae(null),W(null);try{return e()}finally{ae(t),W(r)}}var bn=new Set,Nr=new Set;function Lo(e,t,r,n={}){function i(o){if(n.capture||zt.call(t,o),!o.cancelBubble)return yn(()=>r?.call(this,o))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?Ae(()=>{t.addEventListener(e,i,n)}):t.addEventListener(e,i,n),i}function Dr(e,t,r,n,i){var o={capture:n,passive:i},s=Lo(e,t,r,o);(t===document.body||t===window||t===document)&&Fe(()=>{t.removeEventListener(e,s,o)})}function Ut(e){for(var t=0;t<e.length;t++)bn.add(e[t]);for(var r of Nr)r(e)}function zt(e){var t=this,r=t.ownerDocument,n=e.type,i=e.composedPath?.()||[],o=i[0]||e.target,s=0,p=e.__root;if(p){var l=i.indexOf(p);if(l!==-1&&(t===document||t===window)){e.__root=t;return}var _=i.indexOf(t);if(_===-1)return;l<=_&&(s=l)}if(o=i[s]||e.target,o!==t){re(e,"currentTarget",{configurable:!0,get(){return o||r}});var f=O,a=I;ae(null),W(null);try{for(var c,u=[];o!==null;){var g=o.assignedSlot||o.parentNode||o.host||null;try{var m=o["__"+n];if(m!==void 0&&!o.disabled)if(qe(m)){var[$,...h]=m;$.apply(o,[e,...h])}else m.call(o,e)}catch(v){c?u.push(v):c=v}if(e.cancelBubble||g===t||g===null)break;o=g}if(c){for(let v of u)queueMicrotask(()=>{throw v});throw c}}finally{e.__root=t,delete e.currentTarget,ae(f),W(a)}}}var Ai;function Mo(){Ai=void 0}function fr(e){var t=document.createElement("template");return t.innerHTML=e,t.content}function xe(e,t){var r=I;r.nodes_start===null&&(r.nodes_start=e,r.nodes_end=t)}function L(e,t){var r=(t&1)!==0,n=(t&2)!==0,i,o=!e.startsWith("<!>");return()=>{if(T)return xe(S,null),S;i===void 0&&(i=fr(o?e:"<!>"+e),r||(i=G(i)));var s=n?document.importNode(i,!0):i.cloneNode(!0);if(r){var p=G(s),l=s.lastChild;xe(p,l)}else xe(s,s);return s}}function St(e,t,r="svg"){var n=!e.startsWith("<!>"),i=(t&1)!==0,o=`<${r}>${n?e:"<!>"+e}</${r}>`,s;return()=>{if(T)return xe(S,null),S;if(!s){var p=fr(o),l=G(p);if(i)for(s=document.createDocumentFragment();G(l);)s.appendChild(G(l));else s=G(l)}var _=s.cloneNode(!0);if(i){var f=G(_),a=_.lastChild;xe(f,a)}else xe(_,_);return _}}function cr(e=""){if(!T){var t=we(e+"");return xe(t,t),t}var r=S;return r.nodeType!==3&&(r.before(r=we()),Y(r)),xe(r,r),r}function H(){if(T)return xe(S,null),S;var e=document.createDocumentFragment(),t=document.createComment(""),r=we();return e.append(t,r),xe(t,r),e}function k(e,t){if(T){I.nodes_end=S,se();return}e!==null&&e.before(t)}var $n=!0;function Ie(e,t){var r=t==null?"":typeof t=="object"?t+"":t;r!==(e.__t??=e.nodeValue)&&(e.__t=r,e.nodeValue=r==null?"":r+"")}function Rr(e,t){return qo(e,t)}function En(e,t){yr(),t.intro=t.intro??!1;let r=t.target,n=T,i=S;try{for(var o=G(r);o&&(o.nodeType!==8||o.data!==Dt);)o=he(o);if(!o)throw ut;$e(!0),Y(o),se();let s=qo(e,{...t,anchor:o});if(S===null||S.nodeType!==8||S.data!==bt)throw Mt(),ut;return $e(!1),s}catch(s){if(s===ut)return t.recover===!1&&Un(),yr(),or(r),$e(!1),Rr(e,t);throw s}finally{$e(n),Y(i),Mo()}}var jt=new Map;function qo(e,{target:t,anchor:r,props:n={},events:i,context:o,intro:s=!0}){yr();var p=new Set,l=a=>{for(var c=0;c<a.length;c++){var u=a[c];if(!p.has(u)){p.add(u);var g=Ln(u);t.addEventListener(u,zt,{passive:g});var m=jt.get(u);m===void 0?(document.addEventListener(u,zt,{passive:g}),jt.set(u,1)):jt.set(u,m+1)}}};l(Zt(bn)),Nr.add(l);var _=void 0,f=mo(()=>{var a=r??t.appendChild(we());return X(()=>{if(o){Q({});var c=C;c.c=o}i&&(n.$$events=i),T&&xe(a,null),$n=s,_=e(a,n)||{},$n=!0,T&&(I.nodes_end=S),o&&ee()}),()=>{for(var c of p){t.removeEventListener(c,zt);var u=jt.get(c);--u===0?(document.removeEventListener(c,zt),jt.delete(c)):jt.set(c,u)}Nr.delete(l),a!==r&&a.parentNode?.removeChild(a)}});return wn.set(_,f),_}var wn=new WeakMap;function Tn(e,t){let r=wn.get(e);return r?(wn.delete(e),r(t)):(x&&ro(),Promise.resolve())}var kn=0,Cr=1,An=2;function ur(e,t,r,n,i){T&&se();var o=e,s=at(),p=C,l=x?C?.function:null,_=U,f,a,c,u=(s?z:Je)(void 0),g=(s?z:Je)(void 0),m=!1;function $(v,y){m=!0,y&&(W(h),ae(h),Sr(p),x&&Ir(l));try{v===kn&&r&&(f?He(f):f=X(()=>r(o))),v===Cr&&n&&(a?He(a):a=X(()=>n(o,u))),v===An&&i&&(c?He(c):c=X(()=>i(o,g))),v!==kn&&f&&Ee(f,()=>f=null),v!==Cr&&a&&Ee(a,()=>a=null),v!==An&&c&&Ee(c,()=>c=null)}finally{y&&(x&&Ir(null),Sr(null),ae(null),W(null),b())}}var h=ge(()=>{if(_!==(_=t())){if(Bn(_)){var v=_;m=!1,v.then(y=>{v===_&&(it(u,y),$(Cr,!0))},y=>{if(v===_&&(it(g,y),$(An,!0),!i))throw g.v}),T?r&&(f=X(()=>r(o))):Ae(()=>{m||$(kn,!0)})}else it(u,_),$(Cr,!1);return()=>_=U}});T&&(o=S)}function M(e,t,r=!1){T&&se();var n=e,i=null,o=null,s=U,p=r?65536:0,l=!1;let _=(a,c=!0)=>{l=!0,f(c,a)},f=(a,c)=>{if(s===(s=a))return;let u=!1;if(T){let g=n.data===yt;!!s===g&&(n=Ft(),Y(n),$e(!1),u=!0)}s?(i?He(i):c&&(i=X(()=>c(n))),o&&Ee(o,()=>{o=null})):(o?He(o):c&&(o=X(()=>c(n))),i&&Ee(i,()=>{i=null})),u&&$e(!0)};ge(()=>{l=!1,t(_),l||f(null,null)},p),T&&(n=S)}var pr=null;function pe(e,t){return t}function Ri(e,t,r,n){for(var i=[],o=t.length,s=0;s<o;s++)$r(t[s].e,i,!0);var p=o>0&&i.length===0&&r!==null;if(p){var l=r.parentNode;or(l),l.append(r),n.clear(),mt(e,t[0].prev,t[o-1].next)}hn(i,()=>{for(var _=0;_<o;_++){var f=t[_];p||(n.delete(f.k),mt(e,f.prev,f.next)),ue(f.e,!p)}})}function _e(e,t,r,n,i,o=null){var s=e,p={flags:t,items:new Map,first:null},l=(t&4)!==0;if(l){var _=e;s=T?Y(G(_)):_.appendChild(we())}T&&se();var f=null,a=!1,c=ir(()=>{var u=r();return qe(u)?u:u==null?[]:Zt(u)});ge(()=>{var u=d(c),g=u.length;if(a&&g===0)return;a=g===0;let m=!1;if(T){var $=s.data===yt;$!==(g===0)&&(s=Ft(),Y(s),$e(!1),m=!0)}if(T){for(var h=null,v,y=0;y<g;y++){if(S.nodeType===8&&S.data===bt){s=S,m=!0,$e(!1);break}var R=u[y],w=n(R,y);v=Yo(S,p,h,null,R,w,y,i,t,r),p.items.set(w,v),h=v}g>0&&Y(Ft())}if(!T){var N=O;Ci(u,p,s,i,t,(N.f&8192)!==0,n,r)}o!==null&&(g===0?f?He(f):f=X(()=>o(s)):f!==null&&Ee(f,()=>{f=null})),m&&$e(!0),d(c)}),T&&(s=S)}function Ci(e,t,r,n,i,o,s,p){var l=(i&8)!==0,_=(i&3)!==0,f=e.length,a=t.items,c=t.first,u=c,g,m=null,$,h=[],v=[],y,R,w,N;if(l)for(N=0;N<f;N+=1)y=e[N],R=s(y,N),w=a.get(R),w!==void 0&&(w.a?.measure(),($??=new Set).add(w));for(N=0;N<f;N+=1){if(y=e[N],R=s(y,N),w=a.get(R),w===void 0){var F=u?u.e.nodes_start:r;m=Yo(F,t,m,m===null?t.first:m.next,y,R,N,n,i,p),a.set(R,m),h=[],v=[],u=m.next;continue}if(_&&Pi(w,y,N,i),w.e.f&8192&&(He(w.e),l&&(w.a?.unfix(),($??=new Set).delete(w))),w!==u){if(g!==void 0&&g.has(w)){if(h.length<v.length){var de=v[0],K;m=de.prev;var _r=h[0],Nt=h[h.length-1];for(K=0;K<h.length;K+=1)Bo(h[K],de,r);for(K=0;K<v.length;K+=1)g.delete(v[K]);mt(t,_r.prev,Nt.next),mt(t,m,_r),mt(t,Nt,de),u=de,m=Nt,N-=1,h=[],v=[]}else g.delete(w),Bo(w,u,r),mt(t,w.prev,w.next),mt(t,w,m===null?t.first:m.next),mt(t,m,w),m=w;continue}for(h=[],v=[];u!==null&&u.k!==R;)(o||!(u.e.f&8192))&&(g??=new Set).add(u),v.push(u),u=u.next;if(u===null)continue;w=u}h.push(w),m=w,u=w.next}if(u!==null||g!==void 0){for(var gt=g===void 0?[]:Zt(g);u!==null;)(o||!(u.e.f&8192))&&gt.push(u),u=u.next;var Kt=gt.length;if(Kt>0){var jr=i&4&&f===0?r:null;if(l){for(N=0;N<Kt;N+=1)gt[N].a?.measure();for(N=0;N<Kt;N+=1)gt[N].a?.fix()}Ri(t,gt,jr,a)}}l&&Ae(()=>{if($!==void 0)for(w of $)w.a?.apply()}),I.first=t.first&&t.first.e,I.last=m&&m.e}function Pi(e,t,r,n){n&1&&it(e.v,t),n&2?it(e.i,r):e.i=r}function Yo(e,t,r,n,i,o,s,p,l,_){var f=pr,a=(l&1)!==0,c=(l&16)===0,u=a?c?Je(i):z(i):i,g=l&2?z(s):s;x&&a&&(u.debug=()=>{var $=typeof g=="number"?s:g.v;_()[$]});var m={i:g,v:u,k:o,a:null,e:null,prev:r,next:n};pr=m;try{return m.e=X(()=>p(e,u,g,_),T),m.e.prev=r&&r.e,m.e.next=n&&n.e,r===null?t.first=m:(r.next=m,r.e.next=m.e),n!==null&&(n.prev=m,n.e.prev=m.e),m}finally{pr=f}}function Bo(e,t,r){for(var n=e.next?e.next.e.nodes_start:r,i=t?t.e.nodes_start:r,o=e.e.nodes_start;o!==n;){var s=he(o);i.before(o),o=s}}function mt(e,t,r){t===null?e.first=r:(t.next=r,t.e.next=r&&r.e),r!==null&&(r.prev=t,r.e.prev=t&&t.e)}function le(e,t){Ae(()=>{var r=e.getRootNode(),n=r.host?r:r.head??r.ownerDocument.head;if(!n.querySelector("#"+t.hash)){let i=document.createElement("style");i.id=t.hash,i.textContent=t.code,n.appendChild(i),x&&Oo(t.hash,i)}})}function Uo(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=Uo(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function zo(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=Uo(e))&&(n&&(n+=" "),n+=t);return n}function Pr(e){return typeof e=="object"?zo(e):e??""}function A(e,t,r,n){var i=e.__attributes??={};if(T&&(i[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")){n||Fi(e,t,r??"");return}i[t]!==(i[t]=r)&&(t==="style"&&"__styles"in e&&(e.__styles={}),t==="loading"&&(e[Vn]=r),r==null?e.removeAttribute(t):typeof r!="string"&&Mi(e).includes(t)?e[t]=r:e.setAttribute(t,r))}var jo=new Map;function Mi(e){var t=jo.get(e.nodeName);if(t)return t;jo.set(e.nodeName,t=[]);for(var r,n=e,i=Element.prototype;i!==n;){r=Kr(n);for(var o in r)r[o].set&&t.push(o);n=$t(n)}return t}function Fi(e,t,r){x&&(t==="srcset"&&qi(e,r)||Nn(e.getAttribute(t)??"",r)||to(t,e.outerHTML.replace(e.innerHTML,e.innerHTML&&"..."),String(r)))}function Nn(e,t){return e===t?!0:new URL(e,document.baseURI).href===new URL(t,document.baseURI).href}function Go(e){return e.split(",").map(t=>t.trim().split(" ").filter(Boolean))}function qi(e,t){var r=Go(e.srcset),n=Go(t);return n.length===r.length&&n.every(([i,o],s)=>o===r[s][1]&&(Nn(r[s][0],i)||Nn(i,r[s][0])))}function Dn(e,t,r){var n=e.__className,i=Bi(t,r);T&&e.className===i?e.__className=i:(n!==i||T&&e.className!==i)&&(t==null&&!r?e.removeAttribute("class"):e.className=i,e.__className=i)}function Bi(e,t){return(e??"")+(t?" "+t:"")}function Or(e,t,r,n){var i=e.__styles??={};i[t]!==r&&(i[t]=r,r==null?e.style.removeProperty(t):e.style.setProperty(t,r,n?"important":""))}var Mr=!1,nd=Symbol();function Rn(e){var t=Mr;try{return Mr=!1,[e(),Mr]}finally{Mr=t}}function Ko(e){for(var t=I,r=I;t!==null&&!(t.f&96);)t=t.parent;try{return W(t),e()}finally{W(r)}}function E(e,t,r,n){var i=(r&1)!==0,o=!pt||(r&2)!==0,s=(r&8)!==0,p=(r&16)!==0,l=!1,_;s?[_,l]=Rn(()=>e[t]):_=e[t];var f=De in e||dr in e,a=s&&(Ne(e,t)?.set??(f&&t in e&&(F=>e[t]=F)))||void 0,c=n,u=!0,g=!1,m=()=>(g=!0,u&&(u=!1,p?c=J(n):c=n),c);_===void 0&&n!==void 0&&(a&&o&&zn(t),_=m(),a&&a(_));var $;if(o)$=()=>{var F=e[t];return F===void 0?m():(u=!0,g=!1,F)};else{var h=Ko(()=>(i?D:ir)(()=>e[t]));h.f|=131072,$=()=>{var F=d(h);return F!==void 0&&(c=void 0),F===void 0?c:F}}if(!(r&4))return $;if(a){var v=e.$$legacy;return function(F,de){return arguments.length>0?((!o||!de||v||l)&&a(de?$():F),F):$()}}var y=!1,R=!1,w=Je(_),N=Ko(()=>D(()=>{var F=$(),de=d(w);return y?(y=!1,R=!0,de):(R=!1,w.v=F)}));return i||(N.equals=Rt),function(F,de){if(er!==null&&(y=R,$(),d(w)),arguments.length>0){let K=de?d(N):o&&s?Qe(F):F;return N.equals(K)||(y=!0,j(w,K),g&&c!==void 0&&(c=K),J(()=>d(N))),F}return d(N)}}function Zo(e){return new Cn(e)}var Cn=class{#t;#e;constructor(t){var r=new Map,n=(o,s)=>{var p=Je(s);return r.set(o,p),p};let i=new Proxy({...t.props||{},$$events:{}},{get(o,s){return d(r.get(s)??n(s,Reflect.get(o,s)))},has(o,s){return s===dr?!0:(d(r.get(s)??n(s,Reflect.get(o,s))),Reflect.has(o,s))},set(o,s,p){return j(r.get(s)??n(s,p),p),Reflect.set(o,s,p)}});this.#e=(t.hydrate?En:Rr)(t.component,{target:t.target,anchor:t.anchor,props:i,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&b(),this.#t=i.$$events;for(let o of Object.keys(this.#e))o==="$set"||o==="$destroy"||o==="$on"||re(this,o,{get(){return this.#e[o]},set(s){this.#e[o]=s},enumerable:!0});this.#e.$set=o=>{Object.assign(i,o)},this.#e.$destroy=()=>{Tn(this.#e)}}$set(t){this.#e.$set(t)}$on(t,r){this.#t[t]=this.#t[t]||[];let n=(...i)=>r.call(this,...i);return this.#t[t].push(n),()=>{this.#t[t]=this.#t[t].filter(i=>i!==n)}}$destroy(){this.#e.$destroy()}};var Xo;typeof HTMLElement=="function"&&(Xo=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(e,t,r){super(),this.$$ctor=e,this.$$s=t,r&&this.attachShadow({mode:"open"})}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){let n=this.$$c.$on(e,t);this.$$l_u.set(t,n)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){let n=this.$$l_u.get(t);n&&(n(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(n){return i=>{let o=document.createElement("slot");n!=="default"&&(o.name=n),k(i,o)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let t={},r=cs(this);for(let n of this.$$s)n in r&&(n==="default"&&!this.$$d.children?(this.$$d.children=e(n),t.default=!0):t[n]=e(n));for(let n of this.attributes){let i=this.$$g_p(n.name);i in this.$$d||(this.$$d[i]=Fr(i,n.value,this.$$p_d,"toProp"))}for(let n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=Zo({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=pn(()=>{Le(()=>{this.$$r=!0;for(let n of Xt(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];let i=Fr(n,this.$$d[n],this.$$p_d,"toAttribute");i==null?this.removeAttribute(this.$$p_d[n].attribute||n):this.setAttribute(this.$$p_d[n].attribute||n,i)}this.$$r=!1})});for(let n in this.$$l)for(let i of this.$$l[n]){let o=this.$$c.$on(n,i);this.$$l_u.set(i,o)}this.$$l={}}}attributeChangedCallback(e,t,r){this.$$r||(e=this.$$g_p(e),this.$$d[e]=Fr(e,r,this.$$p_d,"toProp"),this.$$c?.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return Xt(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function Fr(e,t,r,n){let i=r[e]?.type;if(t=i==="Boolean"&&typeof t!="boolean"?t!=null:t,!n||!r[e])return t;if(n==="toAttribute")switch(i){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(i){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function cs(e){let t={};return e.childNodes.forEach(r=>{t[r.slot||"default"]=!0}),t}function fe(e,t,r,n,i,o){let s=class extends Xo{constructor(){super(e,r,i),this.$$p_d=t}static get observedAttributes(){return Xt(t).map(p=>(t[p].attribute||p).toLowerCase())}};return Xt(t).forEach(p=>{re(s.prototype,p,{get(){return this.$$c&&p in this.$$c?this.$$c[p]:this.$$d[p]},set(l){l=Fr(p,l,t),this.$$d[p]=l;var _=this.$$c;if(_){var f=Ne(_,p)?.get;f?_[p]=l:_.$set({[p]:l})}}})}),n.forEach(p=>{re(s.prototype,p,{get(){return this.$$c?.[p]}})}),o&&(s=o(s)),e.element=s,s}function Gt(...e){return function(t){return rt.DocItem(t)&&e.includes(t.label)}}var ht={CodeItem:Gt("code"),ListItem:Gt("list_item"),PictureItem:Gt("chart","picture"),SectionHeaderItem:Gt("section_header"),TableItem:Gt("document_index","table"),TextItem:Gt("caption","checkbox_selected","checkbox_unselected","footnote","page_footer","page_header","paragraph","reference","text")},rt={Document(e){return"schema_name"in e&&e.schema_name==="DoclingDocument"},NodeItem(e){return"self_ref"in e},GroupItem(e){return rt.NodeItem(e)&&(e.self_ref.startsWith("#/groups/")||e.self_ref==="#/body")},DocItem(e){return rt.NodeItem(e)&&!rt.GroupItem(e)},...ht};function*Jo(e,t={}){e&&(yield*r(t.root??e.body));function*r(n,i=0){if((!rt.GroupItem(n)||t.withGroups)&&(rt.DocItem(n)?(t.pageNo===void 0||n.prov?.some(o=>o.page_no===t.pageNo))&&(yield[n,i]):yield[n,i]),!(rt.PictureItem(n)&&!t.traversePictures))for(let o of n.children??[]){let s=ps(e,o);rt.NodeItem(s)&&(yield*r(s,i+1))}}}function ps(e,t){return t.$ref.split("/").slice(1).reduce((n,i)=>n[i],e)}function _s(e){return Object.values(e?.pages??{}).sort((t,r)=>t.page_no-r.page_no)}async function qr(e,t={}){let r;typeof e=="string"?r=await(await fetch(e)).json():typeof e=="object"&&rt.Document(e)&&(r=e);let n=_s(r),i=Array.from(Jo(r,{traversePictures:!0})).map(([l])=>l),o=i,s=new Set;if(typeof t.items=="string"){let l=new Set(t.items.split(",").map(_=>_.trim()).filter(_=>_.length>0));if(l.size>0){o=[];for(let _ of i){let f=_.self_ref.split("/"),a=[];for(let c=2;c<f.length+1;c++)a.push(f.slice(0,c).join("/"));_.prov?.forEach(c=>a.push(`#/pages/${c.page_no}`)),a.some(c=>l.has(c))?o.push(_):_.prov?.forEach(c=>s.add(c.page_no))}}}else if(Array.isArray(t.items)){o=[];let l=new Set(t.items);for(let _ of i)l.has(_)?o.push(_):_.prov?.forEach(f=>s.add(f.page_no))}let p={};for(let l of n)p[l.page_no]=[];for(let l of o)for(let _ of l.prov??[])p[_.page_no].push(l);return n.map(l=>({page:l,items:p[l.page_no],trimmed:s.has(l.page_no)}))}var ds=L("<td> </td>"),ms=L("<tr></tr>"),vs=L('<div class="container svelte-1c6yx17"><table class="svelte-1c6yx17"><tbody></tbody></table></div>'),hs={hash:"svelte-1c6yx17",code:".container.svelte-1c6yx17 {position:relative;min-width:0;max-width:100%;min-height:0;overflow:auto;}table.svelte-1c6yx17 {border-collapse:collapse;}td.svelte-1c6yx17 {padding:0 0.5rem;background-color:var(--cds-layer);border:1px solid rgb(220, 220, 220);color:black;font-size:0.75rem;line-height:1.5rem;text-decoration:none;word-break:normal;text-align:left;}td.header.svelte-1c6yx17 {font-weight:bold;}td.svelte-1c6yx17:hover {filter:brightness(95%);}td.svelte-1c6yx17:target {outline:3px solid blue;}"};function Br(e,t){Q(t,!0),le(e,hs);let r=E(t,"item",7),n=D(()=>function(){let p=new Set;return function(l){let _=p.has([l.start_col_offset_idx,l.start_row_offset_idx].join());if(!_)for(let f=l.start_col_offset_idx;f<l.end_col_offset_idx;f++)for(let a=l.start_row_offset_idx;a<l.end_row_offset_idx;a++)p.add([f,a].join());return _}}());var i=vs(),o=B(i),s=B(o);return _e(s,21,()=>r().data.grid,pe,(p,l)=>{var _=ms();_e(_,21,()=>d(l),pe,(f,a)=>{var c=H(),u=V(c);{var g=m=>{var $=ds();let h=D(()=>`${r().self_ref}/${d(a).start_col_offset_idx}/${d(a).start_row_offset_idx}`.slice(1));var v=B($,!0);P($),q(()=>{A($,"id",d(h)),Dn($,Pr(d(a).column_header||d(a).row_header?"header":""),"svelte-1c6yx17"),A($,"colspan",d(a).col_span),A($,"rowspan",d(a).row_span),Ie(v,d(a).text)}),k(m,$)};M(u,m=>{d(n)(d(a))||m(g)})}k(f,c)}),P(_),k(p,_)}),P(s),P(o),P(i),k(e,i),ee({get item(){return r()},set item(p){r(p),b()}})}fe(Br,{item:{}},[],[],!0);var gs=L('<p class="svelte-1v2vl7q"> </p>'),xs=L('<h2 class="svelte-1v2vl7q"> </h2>'),ys=L("<div><span> </span></div>"),bs={hash:"svelte-1v2vl7q",code:`p.svelte-1v2vl7q,
31
31
  h2.svelte-1v2vl7q {margin:0;overflow-wrap:anywhere;}p.svelte-1v2vl7q {font-size:1rem;line-height:1.25rem;}h2.svelte-1v2vl7q {font-size:1.5rem;line-height:2rem;}`};function Wt(e,t){Q(t,!0),le(e,bs);let r=E(t,"item",7);var n=H(),i=V(n);{var o=p=>{var l=gs(),_=B(l,!0);P(l),q(()=>Ie(_,r().text)),k(p,l)},s=p=>{var l=H(),_=V(l);{var f=c=>{var u=xs(),g=B(u,!0);P(u),q(()=>Ie(g,r().text)),k(c,u)},a=c=>{var u=H(),g=V(u);{var m=h=>{var v=ys();Or(v,"display","flex"),Or(v,"gap","0.5rem");var y=B(v),R=B(y,!0);P(y),P(v),q(()=>Ie(R,r().text)),k(h,v)},$=h=>{var v=H(),y=V(v);{var R=w=>{Br(w,{get item(){return r()}})};M(y,w=>{ht.TableItem(r())&&w(R)},!0)}k(h,v)};M(g,h=>{ht.ListItem(r())?h(m):h($,!1)},!0)}k(c,u)};M(_,c=>{ht.SectionHeaderItem(r())?c(f):c(a,!1)},!0)}k(p,l)};M(i,p=>{ht.TextItem(r())?p(o):p(s,!1)})}return k(e,n),ee({get item(){return r()},set item(p){r(p),b()}})}fe(Wt,{item:{}},[],[],!0);var $s=["TextItem","SectionHeaderItem","ListItem","TableItem"];function Qo(e){return $s.some(t=>ht[t](e))}function Vr(e,t){let{height:r=1}=t.size;return e.coord_origin==="TOPLEFT"?e:{...e,t:r-e.t,b:r-e.b}}var ws=(e,t)=>d(t)?.(e),Es=St('<rect class="svelte-1fyhyqt"></rect>'),Ts=St('<image class="backdrop svelte-1fyhyqt"></image><clipPath></clipPath>',1),ks=(e,t,r)=>{e.stopPropagation(),d(t)?.(e,d(r))},As=St('<rect vector-effect="non-scaling-stroke" class="svelte-1fyhyqt"></rect>'),Ss=L('<header part="page-number-top" class="page-number-top svelte-1fyhyqt"> </header> <header part="page-number-bottom" class="page-number-bottom svelte-1fyhyqt"> </header>',1),Is=L('<div part="tooltip" class="tooltip svelte-1fyhyqt"></div>'),Ns=L('<div part="page" class="page svelte-1fyhyqt" role="tab"><svg class="svelte-1fyhyqt"><!><image id="image"></image><!></svg> <!> <!></div>'),Ds={hash:"svelte-1fyhyqt",code:`svg.svelte-1fyhyqt {max-width:100%;}.page.svelte-1fyhyqt {position:relative;width:fit-content;max-width:100%;display:flex;flex-direction:column;gap:1px;}.backdrop.svelte-1fyhyqt {opacity:0.3;}.page-number-top.svelte-1fyhyqt,
32
32
  .page-number-bottom.svelte-1fyhyqt {position:absolute;width:fit-content;padding:0 0.25rem;font-size:0.75rem;line-height:1rem;color:rgb(120, 120, 120);mix-blend-mode:difference;}.page-number-top.svelte-1fyhyqt {top:0;}.page-number-bottom.svelte-1fyhyqt {bottom:0;}rect.svelte-1fyhyqt {fill:blue;fill-opacity:0.0001; /* To activate hover. */stroke:grey;stroke-width:1px;stroke-dasharray:1;cursor:pointer;}rect.svelte-1fyhyqt:hover {fill-opacity:0.1;stroke:blue;}rect.svelte-1fyhyqt:target {stroke:blue;stroke-width:3px;stroke-dasharray:none;}.tooltip.svelte-1fyhyqt {position:fixed;z-index:100;padding:1rem;margin:1rem;background:white;border:1px solid rgb(230, 230, 230);box-shadow:0 0.5rem 1rem 0 rgba(0, 0, 0, 0.2);}`};function Yr(e,t){Q(t,!0),le(e,Ds);let r=E(t,"page",7),n=E(t,"items",23,()=>[]),i=E(t,"pagenumbers",7),o=E(t,"backdrop",7),s=E(t,"tooltip",7,""),p=E(t,"itemPart",7),l=E(t,"itemStyle",7),_=E(t,"onclick",7),f=new Set(["parsed"]),a=s().split(",").map(v=>v.trim()).filter(v=>f.has(v)),c=en(void 0),u=D(()=>_()?(v,y)=>_()(v,r(),y):void 0);var g=H(),m=V(g);{var $=v=>{var y=Ns();let R=D(()=>{let{size:ne}=r();return{size:ne}}),w=D(()=>{let{width:ne=1,height:te=1}=d(R).size;return{width:ne,height:te}});y.__click=[ws,u];var N=B(y),F=B(N);{var de=ne=>{var te=Ts(),ye=V(te),Ue=Ye(ye);_e(Ue,21,n,pe,(ze,xt)=>{var je=H();let oe=D(()=>d(xt).prov?.find(me=>me.page_no===r().page_no));var ft=V(je);{var ct=me=>{var Ge=Es();let We=D(()=>{let{l:Gr,r:Wr,t:ri,b:ni}=d(oe).bbox;return{l:Gr,r:Wr,t:ri,b:ni}});q(()=>{A(Ge,"x",d(We).l),A(Ge,"y",d(w).height-d(We).t),A(Ge,"width",d(We).r-d(We).l),A(Ge,"height",d(We).t-d(We).b)}),k(me,Ge)};M(ft,me=>{d(oe)&&me(ct)})}k(ze,je)}),P(Ue),q(()=>{A(ye,"href",r().image.uri),A(ye,"width",d(w).width),A(ye,"height",d(w).height),A(Ue,"id",`clip-page-${r().page_no??""}`)}),k(ne,te)};M(F,ne=>{o()&&ne(de)})}var K=Ye(F),_r=Ye(K);_e(_r,17,n,pe,(ne,te)=>{var ye=H();let Ue=D(()=>d(te).prov?.find(je=>je.page_no===r().page_no));var ze=V(ye);{var xt=je=>{var oe=As();let ft=D(()=>{let{l:ct,r:me,t:Ge,b:We}=Vr(d(Ue).bbox,r());return{l:ct,r:me,t:Ge,b:We}});oe.__click=[ks,u,te],q((ct,me)=>{A(oe,"part",ct),A(oe,"style",me),A(oe,"x",d(ft).l),A(oe,"y",d(ft).t),A(oe,"width",d(ft).r-d(ft).l),A(oe,"height",d(ft).b-d(ft).t)},[()=>"item"+(p()?" "+p()(r(),d(te)):""),()=>l()?.(r(),d(te))]),Dr("mouseenter",oe,ct=>{let me=ct.currentTarget.getBoundingClientRect(),Ge=[me.top*window.innerWidth,(window.innerWidth-me.right)*window.innerHeight,(window.innerHeight-me.bottom)*window.innerWidth,me.left*window.innerHeight],We=Math.max(...Ge),Gr=Ge.findIndex(Wr=>Wr===We);j(c,Qe({item:d(te),bounds:me,quadrant:Gr}))}),Dr("mouseleave",oe,ct=>j(c,void 0)),k(je,oe)};M(ze,je=>{d(Ue)&&je(xt)})}k(ne,ye)}),P(N);var Nt=Ye(N,2);{var gt=ne=>{var te=Ss(),ye=V(te),Ue=B(ye,!0);P(ye);var ze=Ye(ye,2),xt=B(ze,!0);P(ze),q(()=>{A(ye,"title",`Page ${r().page_no??""}`),Ie(Ue,r().page_no),A(ze,"title",`Page ${r().page_no??""}`),Ie(xt,r().page_no)}),k(ne,te)};M(Nt,ne=>{i()&&ne(gt)})}var Kt=Ye(Nt,2);{var jr=ne=>{var te=Is();_e(te,21,()=>a,pe,(ye,Ue)=>{var ze=H(),xt=V(ze);{var je=oe=>{Wt(oe,{get item(){return d(c).item}})};M(xt,oe=>{d(Ue)==="parsed"&&oe(je)})}k(ye,ze)}),P(te),q(()=>A(te,"style",`
33
33
  ${(d(c).quadrant===1?`left: ${d(c).bounds.right}px`:d(c).quadrant===3?`right: ${document.body.clientWidth-d(c).bounds.left}px`:`left: calc(${d(c).bounds.left}px - 2rem)`)??""};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docling/docling-components",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Web components for displaying Docling output.",
5
5
  "main": "./dist/index.js",
6
6
  "files": [
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "homepage": "https://github.com/DS4SD/docling-ts/tree/main/docling-components",
54
54
  "dependencies": {
55
- "@docling/docling-core": "^0.0.5",
55
+ "@docling/docling-core": "^0.0.6",
56
56
  "svelte": "^5.2.0"
57
57
  },
58
58
  "devDependencies": {
package/dist/index.es.js DELETED
@@ -1,996 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- const z = globalThis, Q = z.ShadowRoot && (z.ShadyCSS === void 0 || z.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, X = Symbol(), et = /* @__PURE__ */ new WeakMap();
7
- let dt = class {
8
- constructor(t, e, s) {
9
- if (this._$cssResult$ = !0, s !== X) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
10
- this.cssText = t, this.t = e;
11
- }
12
- get styleSheet() {
13
- let t = this.o;
14
- const e = this.t;
15
- if (Q && t === void 0) {
16
- const s = e !== void 0 && e.length === 1;
17
- s && (t = et.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && et.set(e, t));
18
- }
19
- return t;
20
- }
21
- toString() {
22
- return this.cssText;
23
- }
24
- };
25
- const _t = (r) => new dt(typeof r == "string" ? r : r + "", void 0, X), ut = (r, ...t) => {
26
- const e = r.length === 1 ? r[0] : t.reduce((s, i, o) => s + ((n) => {
27
- if (n._$cssResult$ === !0) return n.cssText;
28
- if (typeof n == "number") return n;
29
- throw Error("Value passed to 'css' function must be a 'css' function result: " + n + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
30
- })(i) + r[o + 1], r[0]);
31
- return new dt(e, r, X);
32
- }, yt = (r, t) => {
33
- if (Q) r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
34
- else for (const e of t) {
35
- const s = document.createElement("style"), i = z.litNonce;
36
- i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, r.appendChild(s);
37
- }
38
- }, st = Q ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
39
- let e = "";
40
- for (const s of t.cssRules) e += s.cssText;
41
- return _t(e);
42
- })(r) : r;
43
- /**
44
- * @license
45
- * Copyright 2017 Google LLC
46
- * SPDX-License-Identifier: BSD-3-Clause
47
- */
48
- const { is: vt, defineProperty: At, getOwnPropertyDescriptor: bt, getOwnPropertyNames: wt, getOwnPropertySymbols: Et, getPrototypeOf: St } = Object, w = globalThis, it = w.trustedTypes, Pt = it ? it.emptyScript : "", F = w.reactiveElementPolyfillSupport, H = (r, t) => r, L = { toAttribute(r, t) {
49
- switch (t) {
50
- case Boolean:
51
- r = r ? Pt : null;
52
- break;
53
- case Object:
54
- case Array:
55
- r = r == null ? r : JSON.stringify(r);
56
- }
57
- return r;
58
- }, fromAttribute(r, t) {
59
- let e = r;
60
- switch (t) {
61
- case Boolean:
62
- e = r !== null;
63
- break;
64
- case Number:
65
- e = r === null ? null : Number(r);
66
- break;
67
- case Object:
68
- case Array:
69
- try {
70
- e = JSON.parse(r);
71
- } catch {
72
- e = null;
73
- }
74
- }
75
- return e;
76
- } }, B = (r, t) => !vt(r, t), rt = { attribute: !0, type: String, converter: L, reflect: !1, hasChanged: B };
77
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), w.litPropertyMetadata ?? (w.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
78
- class C extends HTMLElement {
79
- static addInitializer(t) {
80
- this._$Ei(), (this.l ?? (this.l = [])).push(t);
81
- }
82
- static get observedAttributes() {
83
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
84
- }
85
- static createProperty(t, e = rt) {
86
- if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) {
87
- const s = Symbol(), i = this.getPropertyDescriptor(t, s, e);
88
- i !== void 0 && At(this.prototype, t, i);
89
- }
90
- }
91
- static getPropertyDescriptor(t, e, s) {
92
- const { get: i, set: o } = bt(this.prototype, t) ?? { get() {
93
- return this[e];
94
- }, set(n) {
95
- this[e] = n;
96
- } };
97
- return { get() {
98
- return i == null ? void 0 : i.call(this);
99
- }, set(n) {
100
- const c = i == null ? void 0 : i.call(this);
101
- o.call(this, n), this.requestUpdate(t, c, s);
102
- }, configurable: !0, enumerable: !0 };
103
- }
104
- static getPropertyOptions(t) {
105
- return this.elementProperties.get(t) ?? rt;
106
- }
107
- static _$Ei() {
108
- if (this.hasOwnProperty(H("elementProperties"))) return;
109
- const t = St(this);
110
- t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
111
- }
112
- static finalize() {
113
- if (this.hasOwnProperty(H("finalized"))) return;
114
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(H("properties"))) {
115
- const e = this.properties, s = [...wt(e), ...Et(e)];
116
- for (const i of s) this.createProperty(i, e[i]);
117
- }
118
- const t = this[Symbol.metadata];
119
- if (t !== null) {
120
- const e = litPropertyMetadata.get(t);
121
- if (e !== void 0) for (const [s, i] of e) this.elementProperties.set(s, i);
122
- }
123
- this._$Eh = /* @__PURE__ */ new Map();
124
- for (const [e, s] of this.elementProperties) {
125
- const i = this._$Eu(e, s);
126
- i !== void 0 && this._$Eh.set(i, e);
127
- }
128
- this.elementStyles = this.finalizeStyles(this.styles);
129
- }
130
- static finalizeStyles(t) {
131
- const e = [];
132
- if (Array.isArray(t)) {
133
- const s = new Set(t.flat(1 / 0).reverse());
134
- for (const i of s) e.unshift(st(i));
135
- } else t !== void 0 && e.push(st(t));
136
- return e;
137
- }
138
- static _$Eu(t, e) {
139
- const s = e.attribute;
140
- return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
141
- }
142
- constructor() {
143
- super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
144
- }
145
- _$Ev() {
146
- var t;
147
- this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (t = this.constructor.l) == null || t.forEach((e) => e(this));
148
- }
149
- addController(t) {
150
- var e;
151
- (this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(t), this.renderRoot !== void 0 && this.isConnected && ((e = t.hostConnected) == null || e.call(t));
152
- }
153
- removeController(t) {
154
- var e;
155
- (e = this._$EO) == null || e.delete(t);
156
- }
157
- _$E_() {
158
- const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
159
- for (const s of e.keys()) this.hasOwnProperty(s) && (t.set(s, this[s]), delete this[s]);
160
- t.size > 0 && (this._$Ep = t);
161
- }
162
- createRenderRoot() {
163
- const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
164
- return yt(t, this.constructor.elementStyles), t;
165
- }
166
- connectedCallback() {
167
- var t;
168
- this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$EO) == null || t.forEach((e) => {
169
- var s;
170
- return (s = e.hostConnected) == null ? void 0 : s.call(e);
171
- });
172
- }
173
- enableUpdating(t) {
174
- }
175
- disconnectedCallback() {
176
- var t;
177
- (t = this._$EO) == null || t.forEach((e) => {
178
- var s;
179
- return (s = e.hostDisconnected) == null ? void 0 : s.call(e);
180
- });
181
- }
182
- attributeChangedCallback(t, e, s) {
183
- this._$AK(t, s);
184
- }
185
- _$EC(t, e) {
186
- var o;
187
- const s = this.constructor.elementProperties.get(t), i = this.constructor._$Eu(t, s);
188
- if (i !== void 0 && s.reflect === !0) {
189
- const n = (((o = s.converter) == null ? void 0 : o.toAttribute) !== void 0 ? s.converter : L).toAttribute(e, s.type);
190
- this._$Em = t, n == null ? this.removeAttribute(i) : this.setAttribute(i, n), this._$Em = null;
191
- }
192
- }
193
- _$AK(t, e) {
194
- var o;
195
- const s = this.constructor, i = s._$Eh.get(t);
196
- if (i !== void 0 && this._$Em !== i) {
197
- const n = s.getPropertyOptions(i), c = typeof n.converter == "function" ? { fromAttribute: n.converter } : ((o = n.converter) == null ? void 0 : o.fromAttribute) !== void 0 ? n.converter : L;
198
- this._$Em = i, this[i] = c.fromAttribute(e, n.type), this._$Em = null;
199
- }
200
- }
201
- requestUpdate(t, e, s) {
202
- if (t !== void 0) {
203
- if (s ?? (s = this.constructor.getPropertyOptions(t)), !(s.hasChanged ?? B)(this[t], e)) return;
204
- this.P(t, e, s);
205
- }
206
- this.isUpdatePending === !1 && (this._$ES = this._$ET());
207
- }
208
- P(t, e, s) {
209
- this._$AL.has(t) || this._$AL.set(t, e), s.reflect === !0 && this._$Em !== t && (this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Set())).add(t);
210
- }
211
- async _$ET() {
212
- this.isUpdatePending = !0;
213
- try {
214
- await this._$ES;
215
- } catch (e) {
216
- Promise.reject(e);
217
- }
218
- const t = this.scheduleUpdate();
219
- return t != null && await t, !this.isUpdatePending;
220
- }
221
- scheduleUpdate() {
222
- return this.performUpdate();
223
- }
224
- performUpdate() {
225
- var s;
226
- if (!this.isUpdatePending) return;
227
- if (!this.hasUpdated) {
228
- if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
229
- for (const [o, n] of this._$Ep) this[o] = n;
230
- this._$Ep = void 0;
231
- }
232
- const i = this.constructor.elementProperties;
233
- if (i.size > 0) for (const [o, n] of i) n.wrapped !== !0 || this._$AL.has(o) || this[o] === void 0 || this.P(o, this[o], n);
234
- }
235
- let t = !1;
236
- const e = this._$AL;
237
- try {
238
- t = this.shouldUpdate(e), t ? (this.willUpdate(e), (s = this._$EO) == null || s.forEach((i) => {
239
- var o;
240
- return (o = i.hostUpdate) == null ? void 0 : o.call(i);
241
- }), this.update(e)) : this._$EU();
242
- } catch (i) {
243
- throw t = !1, this._$EU(), i;
244
- }
245
- t && this._$AE(e);
246
- }
247
- willUpdate(t) {
248
- }
249
- _$AE(t) {
250
- var e;
251
- (e = this._$EO) == null || e.forEach((s) => {
252
- var i;
253
- return (i = s.hostUpdated) == null ? void 0 : i.call(s);
254
- }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
255
- }
256
- _$EU() {
257
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
258
- }
259
- get updateComplete() {
260
- return this.getUpdateComplete();
261
- }
262
- getUpdateComplete() {
263
- return this._$ES;
264
- }
265
- shouldUpdate(t) {
266
- return !0;
267
- }
268
- update(t) {
269
- this._$Ej && (this._$Ej = this._$Ej.forEach((e) => this._$EC(e, this[e]))), this._$EU();
270
- }
271
- updated(t) {
272
- }
273
- firstUpdated(t) {
274
- }
275
- }
276
- C.elementStyles = [], C.shadowRootOptions = { mode: "open" }, C[H("elementProperties")] = /* @__PURE__ */ new Map(), C[H("finalized")] = /* @__PURE__ */ new Map(), F == null || F({ ReactiveElement: C }), (w.reactiveElementVersions ?? (w.reactiveElementVersions = [])).push("2.0.4");
277
- /**
278
- * @license
279
- * Copyright 2017 Google LLC
280
- * SPDX-License-Identifier: BSD-3-Clause
281
- */
282
- const N = globalThis, q = N.trustedTypes, ot = q ? q.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, ft = "$lit$", b = `lit$${Math.random().toFixed(9).slice(2)}$`, $t = "?" + b, xt = `<${$t}>`, P = document, k = () => P.createComment(""), M = (r) => r === null || typeof r != "object" && typeof r != "function", Y = Array.isArray, Ct = (r) => Y(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", J = `[
283
- \f\r]`, I = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, nt = /-->/g, ht = />/g, E = RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
284
- \f\r"'\`<>=]|("|')|))|$)`, "g"), at = /'/g, ct = /"/g, mt = /^(?:script|style|textarea|title)$/i, Ut = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), A = Ut(1), U = Symbol.for("lit-noChange"), $ = Symbol.for("lit-nothing"), lt = /* @__PURE__ */ new WeakMap(), S = P.createTreeWalker(P, 129);
285
- function gt(r, t) {
286
- if (!Y(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array");
287
- return ot !== void 0 ? ot.createHTML(t) : t;
288
- }
289
- const Tt = (r, t) => {
290
- const e = r.length - 1, s = [];
291
- let i, o = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", n = I;
292
- for (let c = 0; c < e; c++) {
293
- const a = r[c];
294
- let p, d, h = -1, l = 0;
295
- for (; l < a.length && (n.lastIndex = l, d = n.exec(a), d !== null); ) l = n.lastIndex, n === I ? d[1] === "!--" ? n = nt : d[1] !== void 0 ? n = ht : d[2] !== void 0 ? (mt.test(d[2]) && (i = RegExp("</" + d[2], "g")), n = E) : d[3] !== void 0 && (n = E) : n === E ? d[0] === ">" ? (n = i ?? I, h = -1) : d[1] === void 0 ? h = -2 : (h = n.lastIndex - d[2].length, p = d[1], n = d[3] === void 0 ? E : d[3] === '"' ? ct : at) : n === ct || n === at ? n = E : n === nt || n === ht ? n = I : (n = E, i = void 0);
296
- const u = n === E && r[c + 1].startsWith("/>") ? " " : "";
297
- o += n === I ? a + xt : h >= 0 ? (s.push(p), a.slice(0, h) + ft + a.slice(h) + b + u) : a + b + (h === -2 ? c : u);
298
- }
299
- return [gt(r, o + (r[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
300
- };
301
- class D {
302
- constructor({ strings: t, _$litType$: e }, s) {
303
- let i;
304
- this.parts = [];
305
- let o = 0, n = 0;
306
- const c = t.length - 1, a = this.parts, [p, d] = Tt(t, e);
307
- if (this.el = D.createElement(p, s), S.currentNode = this.el.content, e === 2 || e === 3) {
308
- const h = this.el.content.firstChild;
309
- h.replaceWith(...h.childNodes);
310
- }
311
- for (; (i = S.nextNode()) !== null && a.length < c; ) {
312
- if (i.nodeType === 1) {
313
- if (i.hasAttributes()) for (const h of i.getAttributeNames()) if (h.endsWith(ft)) {
314
- const l = d[n++], u = i.getAttribute(h).split(b), m = /([.?@])?(.*)/.exec(l);
315
- a.push({ type: 1, index: o, name: m[2], strings: u, ctor: m[1] === "." ? It : m[1] === "?" ? Ht : m[1] === "@" ? Nt : W }), i.removeAttribute(h);
316
- } else h.startsWith(b) && (a.push({ type: 6, index: o }), i.removeAttribute(h));
317
- if (mt.test(i.tagName)) {
318
- const h = i.textContent.split(b), l = h.length - 1;
319
- if (l > 0) {
320
- i.textContent = q ? q.emptyScript : "";
321
- for (let u = 0; u < l; u++) i.append(h[u], k()), S.nextNode(), a.push({ type: 2, index: ++o });
322
- i.append(h[l], k());
323
- }
324
- }
325
- } else if (i.nodeType === 8) if (i.data === $t) a.push({ type: 2, index: o });
326
- else {
327
- let h = -1;
328
- for (; (h = i.data.indexOf(b, h + 1)) !== -1; ) a.push({ type: 7, index: o }), h += b.length - 1;
329
- }
330
- o++;
331
- }
332
- }
333
- static createElement(t, e) {
334
- const s = P.createElement("template");
335
- return s.innerHTML = t, s;
336
- }
337
- }
338
- function T(r, t, e = r, s) {
339
- var n, c;
340
- if (t === U) return t;
341
- let i = s !== void 0 ? (n = e._$Co) == null ? void 0 : n[s] : e._$Cl;
342
- const o = M(t) ? void 0 : t._$litDirective$;
343
- return (i == null ? void 0 : i.constructor) !== o && ((c = i == null ? void 0 : i._$AO) == null || c.call(i, !1), o === void 0 ? i = void 0 : (i = new o(r), i._$AT(r, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = i : e._$Cl = i), i !== void 0 && (t = T(r, i._$AS(r, t.values), i, s)), t;
344
- }
345
- class Ot {
346
- constructor(t, e) {
347
- this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
348
- }
349
- get parentNode() {
350
- return this._$AM.parentNode;
351
- }
352
- get _$AU() {
353
- return this._$AM._$AU;
354
- }
355
- u(t) {
356
- const { el: { content: e }, parts: s } = this._$AD, i = ((t == null ? void 0 : t.creationScope) ?? P).importNode(e, !0);
357
- S.currentNode = i;
358
- let o = S.nextNode(), n = 0, c = 0, a = s[0];
359
- for (; a !== void 0; ) {
360
- if (n === a.index) {
361
- let p;
362
- a.type === 2 ? p = new j(o, o.nextSibling, this, t) : a.type === 1 ? p = new a.ctor(o, a.name, a.strings, this, t) : a.type === 6 && (p = new Rt(o, this, t)), this._$AV.push(p), a = s[++c];
363
- }
364
- n !== (a == null ? void 0 : a.index) && (o = S.nextNode(), n++);
365
- }
366
- return S.currentNode = P, i;
367
- }
368
- p(t) {
369
- let e = 0;
370
- for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
371
- }
372
- }
373
- class j {
374
- get _$AU() {
375
- var t;
376
- return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
377
- }
378
- constructor(t, e, s, i) {
379
- this.type = 2, this._$AH = $, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = i, this._$Cv = (i == null ? void 0 : i.isConnected) ?? !0;
380
- }
381
- get parentNode() {
382
- let t = this._$AA.parentNode;
383
- const e = this._$AM;
384
- return e !== void 0 && (t == null ? void 0 : t.nodeType) === 11 && (t = e.parentNode), t;
385
- }
386
- get startNode() {
387
- return this._$AA;
388
- }
389
- get endNode() {
390
- return this._$AB;
391
- }
392
- _$AI(t, e = this) {
393
- t = T(this, t, e), M(t) ? t === $ || t == null || t === "" ? (this._$AH !== $ && this._$AR(), this._$AH = $) : t !== this._$AH && t !== U && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Ct(t) ? this.k(t) : this._(t);
394
- }
395
- O(t) {
396
- return this._$AA.parentNode.insertBefore(t, this._$AB);
397
- }
398
- T(t) {
399
- this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
400
- }
401
- _(t) {
402
- this._$AH !== $ && M(this._$AH) ? this._$AA.nextSibling.data = t : this.T(P.createTextNode(t)), this._$AH = t;
403
- }
404
- $(t) {
405
- var o;
406
- const { values: e, _$litType$: s } = t, i = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = D.createElement(gt(s.h, s.h[0]), this.options)), s);
407
- if (((o = this._$AH) == null ? void 0 : o._$AD) === i) this._$AH.p(e);
408
- else {
409
- const n = new Ot(i, this), c = n.u(this.options);
410
- n.p(e), this.T(c), this._$AH = n;
411
- }
412
- }
413
- _$AC(t) {
414
- let e = lt.get(t.strings);
415
- return e === void 0 && lt.set(t.strings, e = new D(t)), e;
416
- }
417
- k(t) {
418
- Y(this._$AH) || (this._$AH = [], this._$AR());
419
- const e = this._$AH;
420
- let s, i = 0;
421
- for (const o of t) i === e.length ? e.push(s = new j(this.O(k()), this.O(k()), this, this.options)) : s = e[i], s._$AI(o), i++;
422
- i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i);
423
- }
424
- _$AR(t = this._$AA.nextSibling, e) {
425
- var s;
426
- for ((s = this._$AP) == null ? void 0 : s.call(this, !1, !0, e); t && t !== this._$AB; ) {
427
- const i = t.nextSibling;
428
- t.remove(), t = i;
429
- }
430
- }
431
- setConnected(t) {
432
- var e;
433
- this._$AM === void 0 && (this._$Cv = t, (e = this._$AP) == null || e.call(this, t));
434
- }
435
- }
436
- class W {
437
- get tagName() {
438
- return this.element.tagName;
439
- }
440
- get _$AU() {
441
- return this._$AM._$AU;
442
- }
443
- constructor(t, e, s, i, o) {
444
- this.type = 1, this._$AH = $, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = o, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = $;
445
- }
446
- _$AI(t, e = this, s, i) {
447
- const o = this.strings;
448
- let n = !1;
449
- if (o === void 0) t = T(this, t, e, 0), n = !M(t) || t !== this._$AH && t !== U, n && (this._$AH = t);
450
- else {
451
- const c = t;
452
- let a, p;
453
- for (t = o[0], a = 0; a < o.length - 1; a++) p = T(this, c[s + a], e, a), p === U && (p = this._$AH[a]), n || (n = !M(p) || p !== this._$AH[a]), p === $ ? t = $ : t !== $ && (t += (p ?? "") + o[a + 1]), this._$AH[a] = p;
454
- }
455
- n && !i && this.j(t);
456
- }
457
- j(t) {
458
- t === $ ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
459
- }
460
- }
461
- class It extends W {
462
- constructor() {
463
- super(...arguments), this.type = 3;
464
- }
465
- j(t) {
466
- this.element[this.name] = t === $ ? void 0 : t;
467
- }
468
- }
469
- class Ht extends W {
470
- constructor() {
471
- super(...arguments), this.type = 4;
472
- }
473
- j(t) {
474
- this.element.toggleAttribute(this.name, !!t && t !== $);
475
- }
476
- }
477
- class Nt extends W {
478
- constructor(t, e, s, i, o) {
479
- super(t, e, s, i, o), this.type = 5;
480
- }
481
- _$AI(t, e = this) {
482
- if ((t = T(this, t, e, 0) ?? $) === U) return;
483
- const s = this._$AH, i = t === $ && s !== $ || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, o = t !== $ && (s === $ || i);
484
- i && this.element.removeEventListener(this.name, this, s), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
485
- }
486
- handleEvent(t) {
487
- var e;
488
- typeof this._$AH == "function" ? this._$AH.call(((e = this.options) == null ? void 0 : e.host) ?? this.element, t) : this._$AH.handleEvent(t);
489
- }
490
- }
491
- class Rt {
492
- constructor(t, e, s) {
493
- this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
494
- }
495
- get _$AU() {
496
- return this._$AM._$AU;
497
- }
498
- _$AI(t) {
499
- T(this, t);
500
- }
501
- }
502
- const K = N.litHtmlPolyfillSupport;
503
- K == null || K(D, j), (N.litHtmlVersions ?? (N.litHtmlVersions = [])).push("3.2.1");
504
- const kt = (r, t, e) => {
505
- const s = (e == null ? void 0 : e.renderBefore) ?? t;
506
- let i = s._$litPart$;
507
- if (i === void 0) {
508
- const o = (e == null ? void 0 : e.renderBefore) ?? null;
509
- s._$litPart$ = i = new j(t.insertBefore(k(), o), o, void 0, e ?? {});
510
- }
511
- return i._$AI(r), i;
512
- };
513
- /**
514
- * @license
515
- * Copyright 2017 Google LLC
516
- * SPDX-License-Identifier: BSD-3-Clause
517
- */
518
- let R = class extends C {
519
- constructor() {
520
- super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
521
- }
522
- createRenderRoot() {
523
- var e;
524
- const t = super.createRenderRoot();
525
- return (e = this.renderOptions).renderBefore ?? (e.renderBefore = t.firstChild), t;
526
- }
527
- update(t) {
528
- const e = this.render();
529
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = kt(e, this.renderRoot, this.renderOptions);
530
- }
531
- connectedCallback() {
532
- var t;
533
- super.connectedCallback(), (t = this._$Do) == null || t.setConnected(!0);
534
- }
535
- disconnectedCallback() {
536
- var t;
537
- super.disconnectedCallback(), (t = this._$Do) == null || t.setConnected(!1);
538
- }
539
- render() {
540
- return U;
541
- }
542
- };
543
- var pt;
544
- R._$litElement$ = !0, R.finalized = !0, (pt = globalThis.litElementHydrateSupport) == null || pt.call(globalThis, { LitElement: R });
545
- const Z = globalThis.litElementPolyfillSupport;
546
- Z == null || Z({ LitElement: R });
547
- (globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.1.1");
548
- /**
549
- * @license
550
- * Copyright 2017 Google LLC
551
- * SPDX-License-Identifier: BSD-3-Clause
552
- */
553
- const Mt = (r) => (t, e) => {
554
- e !== void 0 ? e.addInitializer(() => {
555
- customElements.define(r, t);
556
- }) : customElements.define(r, t);
557
- };
558
- /**
559
- * @license
560
- * Copyright 2017 Google LLC
561
- * SPDX-License-Identifier: BSD-3-Clause
562
- */
563
- const Dt = { attribute: !0, type: String, converter: L, reflect: !1, hasChanged: B }, jt = (r = Dt, t, e) => {
564
- const { kind: s, metadata: i } = e;
565
- let o = globalThis.litPropertyMetadata.get(i);
566
- if (o === void 0 && globalThis.litPropertyMetadata.set(i, o = /* @__PURE__ */ new Map()), o.set(e.name, r), s === "accessor") {
567
- const { name: n } = e;
568
- return { set(c) {
569
- const a = t.get.call(this);
570
- t.set.call(this, c), this.requestUpdate(n, a, r);
571
- }, init(c) {
572
- return c !== void 0 && this.P(n, void 0, r), c;
573
- } };
574
- }
575
- if (s === "setter") {
576
- const { name: n } = e;
577
- return function(c) {
578
- const a = this[n];
579
- t.call(this, c), this.requestUpdate(n, a, r);
580
- };
581
- }
582
- throw Error("Unsupported decorator location: " + s);
583
- };
584
- function v(r) {
585
- return (t, e) => typeof e == "object" ? jt(r, t, e) : ((s, i, o) => {
586
- const n = i.hasOwnProperty(o);
587
- return i.constructor.createProperty(o, n ? { ...s, wrapped: !0 } : s), n ? Object.getOwnPropertyDescriptor(i, o) : void 0;
588
- })(r, t, e);
589
- }
590
- /**
591
- * @license
592
- * Copyright 2017 Google LLC
593
- * SPDX-License-Identifier: BSD-3-Clause
594
- */
595
- const zt = Symbol();
596
- class Lt {
597
- get taskComplete() {
598
- return this.t || (this.i === 1 ? this.t = new Promise((t, e) => {
599
- this.o = t, this.h = e;
600
- }) : this.i === 3 ? this.t = Promise.reject(this.l) : this.t = Promise.resolve(this.u)), this.t;
601
- }
602
- constructor(t, e, s) {
603
- var o;
604
- this.p = 0, this.i = 0, (this._ = t).addController(this);
605
- const i = typeof e == "object" ? e : { task: e, args: s };
606
- this.v = i.task, this.j = i.args, this.m = i.argsEqual ?? qt, this.k = i.onComplete, this.A = i.onError, this.autoRun = i.autoRun ?? !0, "initialValue" in i && (this.u = i.initialValue, this.i = 2, this.O = (o = this.T) == null ? void 0 : o.call(this));
607
- }
608
- hostUpdate() {
609
- this.autoRun === !0 && this.S();
610
- }
611
- hostUpdated() {
612
- this.autoRun === "afterUpdate" && this.S();
613
- }
614
- T() {
615
- if (this.j === void 0) return;
616
- const t = this.j();
617
- if (!Array.isArray(t)) throw Error("The args function must return an array");
618
- return t;
619
- }
620
- async S() {
621
- const t = this.T(), e = this.O;
622
- this.O = t, t === e || t === void 0 || e !== void 0 && this.m(e, t) || await this.run(t);
623
- }
624
- async run(t) {
625
- var n, c, a, p, d;
626
- let e, s;
627
- t ?? (t = this.T()), this.O = t, this.i === 1 ? (n = this.q) == null || n.abort() : (this.t = void 0, this.o = void 0, this.h = void 0), this.i = 1, this.autoRun === "afterUpdate" ? queueMicrotask(() => this._.requestUpdate()) : this._.requestUpdate();
628
- const i = ++this.p;
629
- this.q = new AbortController();
630
- let o = !1;
631
- try {
632
- e = await this.v(t, { signal: this.q.signal });
633
- } catch (h) {
634
- o = !0, s = h;
635
- }
636
- if (this.p === i) {
637
- if (e === zt) this.i = 0;
638
- else {
639
- if (o === !1) {
640
- try {
641
- (c = this.k) == null || c.call(this, e);
642
- } catch {
643
- }
644
- this.i = 2, (a = this.o) == null || a.call(this, e);
645
- } else {
646
- try {
647
- (p = this.A) == null || p.call(this, s);
648
- } catch {
649
- }
650
- this.i = 3, (d = this.h) == null || d.call(this, s);
651
- }
652
- this.u = e, this.l = s;
653
- }
654
- this._.requestUpdate();
655
- }
656
- }
657
- abort(t) {
658
- var e;
659
- this.i === 1 && ((e = this.q) == null || e.abort(t));
660
- }
661
- get value() {
662
- return this.u;
663
- }
664
- get error() {
665
- return this.l;
666
- }
667
- get status() {
668
- return this.i;
669
- }
670
- render(t) {
671
- var e, s, i, o;
672
- switch (this.i) {
673
- case 0:
674
- return (e = t.initial) == null ? void 0 : e.call(t);
675
- case 1:
676
- return (s = t.pending) == null ? void 0 : s.call(t);
677
- case 2:
678
- return (i = t.complete) == null ? void 0 : i.call(t, this.value);
679
- case 3:
680
- return (o = t.error) == null ? void 0 : o.call(t, this.error);
681
- default:
682
- throw Error("Unexpected status: " + this.i);
683
- }
684
- }
685
- }
686
- const qt = (r, t) => r === t || r.length === t.length && r.every((e, s) => !B(e, t[s]));
687
- function x(...r) {
688
- return function(t) {
689
- return y.DocItem(t) && r.includes(t.label);
690
- };
691
- }
692
- var Bt = {
693
- CodeItem: x("code"),
694
- ListItem: x("list_item"),
695
- PictureItem: x("picture"),
696
- SectionHeaderItem: x("section_header"),
697
- TableItem: x("document_index", "table"),
698
- TextItem: x(
699
- "caption",
700
- "checkbox_selected",
701
- "checkbox_unselected",
702
- "footnote",
703
- "page_footer",
704
- "page_header",
705
- "paragraph",
706
- "reference",
707
- "text"
708
- )
709
- }, y = {
710
- Document(r) {
711
- return "schema_name" in r && r.schema_name === "DoclingDocument";
712
- },
713
- NodeItem(r) {
714
- return "self_ref" in r;
715
- },
716
- GroupItem(r) {
717
- return y.NodeItem(r) && (r.self_ref.startsWith("#/groups/") || r.self_ref === "#/body");
718
- },
719
- DocItem(r) {
720
- return y.NodeItem(r) && !y.GroupItem(r);
721
- },
722
- ...Bt
723
- };
724
- function* Wt(r, t = {}) {
725
- r && (yield* e(t.root ?? r.body));
726
- function* e(s, i = 0) {
727
- var o;
728
- if ((!y.GroupItem(s) || t.withGroups) && (y.DocItem(s) ? (t.pageNo === void 0 || (o = s.prov) != null && o.some((n) => n.page_no === t.pageNo)) && (yield [s, i]) : yield [s, i]), !(y.PictureItem(s) && !t.traversePictures))
729
- for (const n of s.children ?? []) {
730
- const c = Vt(r, n);
731
- y.NodeItem(c) && (yield* e(c, i + 1));
732
- }
733
- }
734
- }
735
- function Vt(r, t) {
736
- return t.$ref.split("/").slice(1).reduce(
737
- (s, i) => s[i],
738
- r
739
- );
740
- }
741
- function Gt(r) {
742
- return Object.values((r == null ? void 0 : r.pages) ?? {}).sort(
743
- (t, e) => t.page_no - e.page_no
744
- );
745
- }
746
- async function Ft(r, t = {}) {
747
- var a, p, d;
748
- let e;
749
- typeof r == "string" ? e = await (await fetch(r)).json() : typeof r == "object" && y.Document(r) && (e = r);
750
- const s = Gt(e), i = Array.from(Wt(e)).map(
751
- ([h]) => h
752
- );
753
- let o = i;
754
- const n = /* @__PURE__ */ new Set();
755
- if (typeof t.items == "string") {
756
- const h = new Set(
757
- t.items.split(",").map((l) => l.trim()).filter((l) => l.length > 0)
758
- );
759
- if (h.size > 0) {
760
- o = [];
761
- for (const l of i) {
762
- const u = l.self_ref.split("/"), m = [];
763
- for (let f = 2; f < u.length + 1; f++)
764
- m.push(u.slice(0, f).join("/"));
765
- (a = l.prov) == null || a.forEach((f) => m.push(`#/pages/${f.page_no}`)), m.some((f) => h.has(f)) ? o.push(l) : (p = l.prov) == null || p.forEach((f) => n.add(f.page_no));
766
- }
767
- }
768
- } else if (Array.isArray(t.items)) {
769
- o = [];
770
- const h = new Set(t.items);
771
- for (const l of i)
772
- h.has(l) ? o.push(l) : (d = l.prov) == null || d.forEach((u) => n.add(u.page_no));
773
- }
774
- const c = {};
775
- for (const h of s)
776
- c[h.page_no] = [];
777
- for (const h of o)
778
- for (const l of h.prov ?? [])
779
- c[l.page_no].push(h);
780
- return s.map((h) => ({
781
- page: h,
782
- items: c[h.page_no],
783
- trimmed: n.has(h.page_no)
784
- }));
785
- }
786
- function Jt({
787
- page: r,
788
- items: t = [],
789
- pagenumbers: e,
790
- backdrop: s,
791
- // tooltip,
792
- itemPart: i,
793
- itemStyle: o,
794
- onclickitem: n
795
- }) {
796
- if (r.image) {
797
- const { size: a } = r, { width: p = 1, height: d = 1 } = a, h = n ? (l, u) => n(l, r, u) : void 0;
798
- return A`
799
- <div part="page" class="page" @onclick=${(l) => h == null ? void 0 : h(l)} role="tab">
800
- <svg width=${r.image.size.width} viewBox="0 0 ${p} ${d}">
801
- <!-- Suppressed backdrop image. -->
802
- ${s ? A`
803
- <image
804
- class="backdrop"
805
- href=${r.image.uri}
806
- width=${p}
807
- height=${d}
808
- />
809
-
810
- <clippath id="clip-page-${r.page_no}">
811
- ${t.map((l) => {
812
- var m;
813
- const u = (m = l.prov) == null ? void 0 : m.find((f) => f.page_no === r.page_no);
814
- if (u) {
815
- const { l: f, r: V, t: O, b: G } = u.bbox;
816
- return A`<rect
817
- x=${f}
818
- y=${d - O}
819
- width=${V - f}
820
- height=${O - G}
821
- />`;
822
- }
823
- })}
824
- </clippath>
825
- ` : ""}
826
-
827
- <!-- Foreground image. -->
828
- <image
829
- id="image"
830
- href=${r.image.uri}
831
- clip-path="url(#clip-page-${r.page_no})"
832
- width=${p}
833
- height${d}
834
- />
835
-
836
- ${t.map((l) => {
837
- var m;
838
- const u = (m = l.prov) == null ? void 0 : m.find((f) => f.page_no === r.page_no);
839
- if (u) {
840
- const { l: f, r: V, t: O, b: G } = u.bbox;
841
- return A`<rect
842
- part=${"item" + (i ? " " + i(r, l) : "")}
843
- style=${o == null ? void 0 : o(r, l)}
844
- x=${f}
845
- y=${d - O}
846
- width=${V - f}
847
- height=${O - G}
848
- vector-effect="non-scaling-stroke"
849
- @onclick=${(tt) => {
850
- tt.stopPropagation(), h == null || h(tt, l);
851
- }}
852
- @onmouseenter={(e: MouseEvent) => {
853
- const bounds = e.currentTarget.getBoundingClientRect();
854
-
855
- // Sizes of surrounding areas: Top, right, bottom, left.
856
- const areas = [
857
- bounds.top * window.innerWidth,
858
- (window.innerWidth - bounds.right) * window.innerHeight,
859
- (window.innerHeight - bounds.bottom) * window.innerWidth,
860
- bounds.left * window.innerHeight,
861
- ];
862
- const maxArea = Math.max(...areas);
863
- const quadrant = areas.findIndex(a => a === maxArea);
864
-
865
- hovered = {
866
- item,
867
- bounds,
868
- quadrant,
869
- };
870
- }}
871
- />`;
872
- }
873
- })}
874
- </svg>
875
-
876
- ${e ? A`<header
877
- part="page-number-top"
878
- class="page-number-top"
879
- title="Page ${r.page_no}"
880
- >
881
- ${r.page_no}
882
- </header>
883
-
884
- <header
885
- part="page-number-bottom"
886
- class="page-number-bottom"
887
- title="Page ${r.page_no}"
888
- >
889
- ${r.page_no}
890
- </header>` : ""}
891
-
892
- <!-- Tooltip. -->
893
- ${c()}
894
- </div>
895
- `;
896
- } else
897
- return A`Invalid page image.`;
898
- function c() {
899
- return "";
900
- }
901
- }
902
- const Kt = ut`
903
- .page {
904
- width: fit-content;
905
- max-width: 100%;
906
-
907
- display: flex;
908
- flex-direction: column;
909
- align-items: center;
910
- gap: 2px;
911
-
912
- color: black;
913
- }
914
- `;
915
- var Zt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, _ = (r, t, e, s) => {
916
- for (var i = s > 1 ? void 0 : s ? Qt(t, e) : t, o = r.length - 1, n; o >= 0; o--)
917
- (n = r[o]) && (i = (s ? n(t, e, i) : n(i)) || i);
918
- return s && i && Zt(t, e, i), i;
919
- };
920
- let g = class extends R {
921
- constructor() {
922
- super(...arguments), this.src = "", this.trim = "pages", this._fetchTask = new Lt(this, {
923
- task: async ([r, t]) => Ft(r, { items: t }),
924
- args: () => [this.src, this.items]
925
- });
926
- }
927
- render() {
928
- return this._fetchTask.render({
929
- pending: () => A`<p>...</p>`,
930
- complete: (r) => A`
931
- <div part="paged">
932
- ${r.filter((t) => !this.trim || t.items.length > 0).map(
933
- ({ page: t, items: e }) => Jt({
934
- page: t,
935
- items: e,
936
- pagenumbers: this.pagenumbers !== void 0,
937
- backdrop: this.backdrop !== void 0,
938
- itemPart: this.itemPart,
939
- itemStyle: this.itemStyle,
940
- onclickitem: this.onclickitem
941
- })
942
- )}
943
- </div>
944
- `
945
- });
946
- }
947
- };
948
- g.styles = [
949
- ut`
950
- div {
951
- width: fit-content;
952
- max-width: 100%;
953
-
954
- display: flex;
955
- flex-direction: column;
956
- align-items: center;
957
- gap: 2px;
958
-
959
- color: black;
960
- }
961
- `,
962
- Kt
963
- ];
964
- _([
965
- v()
966
- ], g.prototype, "alt", 2);
967
- _([
968
- v()
969
- ], g.prototype, "backdrop", 2);
970
- _([
971
- v()
972
- ], g.prototype, "items", 2);
973
- _([
974
- v()
975
- ], g.prototype, "pagenumbers", 2);
976
- _([
977
- v()
978
- ], g.prototype, "src", 2);
979
- _([
980
- v()
981
- ], g.prototype, "trim", 2);
982
- _([
983
- v()
984
- ], g.prototype, "itemPart", 2);
985
- _([
986
- v()
987
- ], g.prototype, "itemStyle", 2);
988
- _([
989
- v()
990
- ], g.prototype, "onclickitem", 2);
991
- g = _([
992
- Mt("docling-img")
993
- ], g);
994
- export {
995
- g as ImgPages
996
- };
package/dist/index.umd.js DELETED
@@ -1,140 +0,0 @@
1
- (function($,A){typeof exports=="object"&&typeof module<"u"?A(exports):typeof define=="function"&&define.amd?define(["exports"],A):($=typeof globalThis<"u"?globalThis:$||self,A($.DoclingComponents={}))})(this,function($){"use strict";/**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */var gt;const A=globalThis,V=A.ShadowRoot&&(A.ShadyCSS===void 0||A.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,G=Symbol(),tt=new WeakMap;let et=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==G)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(V&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=tt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&tt.set(e,t))}return t}toString(){return this.cssText}};const _t=r=>new et(typeof r=="string"?r:r+"",void 0,G),st=(r,...t)=>{const e=r.length===1?r[0]:t.reduce((s,i,o)=>s+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[o+1],r[0]);return new et(e,r,G)},yt=(r,t)=>{if(V)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),i=A.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)}},it=V?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return _t(e)})(r):r;/**
6
- * @license
7
- * Copyright 2017 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:vt,defineProperty:At,getOwnPropertyDescriptor:bt,getOwnPropertyNames:wt,getOwnPropertySymbols:Et,getPrototypeOf:Pt}=Object,b=globalThis,rt=b.trustedTypes,St=rt?rt.emptyScript:"",F=b.reactiveElementPolyfillSupport,O=(r,t)=>r,L={toAttribute(r,t){switch(t){case Boolean:r=r?St:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},q=(r,t)=>!vt(r,t),ot={attribute:!0,type:String,converter:L,reflect:!1,hasChanged:q};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),b.litPropertyMetadata??(b.litPropertyMetadata=new WeakMap);class x extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=ot){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&At(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:o}=bt(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return i==null?void 0:i.call(this)},set(n){const c=i==null?void 0:i.call(this);o.call(this,n),this.requestUpdate(t,c,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??ot}static _$Ei(){if(this.hasOwnProperty(O("elementProperties")))return;const t=Pt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(O("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(O("properties"))){const e=this.properties,s=[...wt(e),...Et(e)];for(const i of s)this.createProperty(i,e[i])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,i]of e)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)e.unshift(it(i))}else t!==void 0&&e.push(it(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return yt(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostConnected)==null?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostDisconnected)==null?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EC(t,e){var o;const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const n=(((o=s.converter)==null?void 0:o.toAttribute)!==void 0?s.converter:L).toAttribute(e,s.type);this._$Em=t,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(t,e){var o;const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const n=s.getPropertyOptions(i),c=typeof n.converter=="function"?{fromAttribute:n.converter}:((o=n.converter)==null?void 0:o.fromAttribute)!==void 0?n.converter:L;this._$Em=i,this[i]=c.fromAttribute(e,n.type),this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){if(s??(s=this.constructor.getPropertyOptions(t)),!(s.hasChanged??q)(this[t],e))return;this.P(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[o,n]of i)n.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],n)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$EO)==null||s.forEach(i=>{var o;return(o=i.hostUpdate)==null?void 0:o.call(i)}),this.update(e)):this._$EU()}catch(i){throw t=!1,this._$EU(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(s=>{var i;return(i=s.hostUpdated)==null?void 0:i.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}}x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[O("elementProperties")]=new Map,x[O("finalized")]=new Map,F==null||F({ReactiveElement:x}),(b.reactiveElementVersions??(b.reactiveElementVersions=[])).push("2.0.4");/**
10
- * @license
11
- * Copyright 2017 Google LLC
12
- * SPDX-License-Identifier: BSD-3-Clause
13
- */const H=globalThis,B=H.trustedTypes,nt=B?B.createPolicy("lit-html",{createHTML:r=>r}):void 0,at="$lit$",w=`lit$${Math.random().toFixed(9).slice(2)}$`,ht="?"+w,Ct=`<${ht}>`,P=document,N=()=>P.createComment(""),R=r=>r===null||typeof r!="object"&&typeof r!="function",J=Array.isArray,xt=r=>J(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",K=`[
14
- \f\r]`,k=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ct=/-->/g,lt=/>/g,S=RegExp(`>|${K}(?:([^\\s"'>=/]+)(${K}*=${K}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),dt=/'/g,pt=/"/g,ut=/^(?:script|style|textarea|title)$/i,It=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),E=It(1),I=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),ft=new WeakMap,C=P.createTreeWalker(P,129);function $t(r,t){if(!J(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return nt!==void 0?nt.createHTML(t):t}const Ut=(r,t)=>{const e=r.length-1,s=[];let i,o=t===2?"<svg>":t===3?"<math>":"",n=k;for(let c=0;c<e;c++){const h=r[c];let d,p,a=-1,l=0;for(;l<h.length&&(n.lastIndex=l,p=n.exec(h),p!==null);)l=n.lastIndex,n===k?p[1]==="!--"?n=ct:p[1]!==void 0?n=lt:p[2]!==void 0?(ut.test(p[2])&&(i=RegExp("</"+p[2],"g")),n=S):p[3]!==void 0&&(n=S):n===S?p[0]===">"?(n=i??k,a=-1):p[1]===void 0?a=-2:(a=n.lastIndex-p[2].length,d=p[1],n=p[3]===void 0?S:p[3]==='"'?pt:dt):n===pt||n===dt?n=S:n===ct||n===lt?n=k:(n=S,i=void 0);const u=n===S&&r[c+1].startsWith("/>")?" ":"";o+=n===k?h+Ct:a>=0?(s.push(d),h.slice(0,a)+at+h.slice(a)+w+u):h+w+(a===-2?c:u)}return[$t(r,o+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class M{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let o=0,n=0;const c=t.length-1,h=this.parts,[d,p]=Ut(t,e);if(this.el=M.createElement(d,s),C.currentNode=this.el.content,e===2||e===3){const a=this.el.content.firstChild;a.replaceWith(...a.childNodes)}for(;(i=C.nextNode())!==null&&h.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(const a of i.getAttributeNames())if(a.endsWith(at)){const l=p[n++],u=i.getAttribute(a).split(w),m=/([.?@])?(.*)/.exec(l);h.push({type:1,index:o,name:m[2],strings:u,ctor:m[1]==="."?Ot:m[1]==="?"?Ht:m[1]==="@"?Nt:W}),i.removeAttribute(a)}else a.startsWith(w)&&(h.push({type:6,index:o}),i.removeAttribute(a));if(ut.test(i.tagName)){const a=i.textContent.split(w),l=a.length-1;if(l>0){i.textContent=B?B.emptyScript:"";for(let u=0;u<l;u++)i.append(a[u],N()),C.nextNode(),h.push({type:2,index:++o});i.append(a[l],N())}}}else if(i.nodeType===8)if(i.data===ht)h.push({type:2,index:o});else{let a=-1;for(;(a=i.data.indexOf(w,a+1))!==-1;)h.push({type:7,index:o}),a+=w.length-1}o++}}static createElement(t,e){const s=P.createElement("template");return s.innerHTML=t,s}}function U(r,t,e=r,s){var n,c;if(t===I)return t;let i=s!==void 0?(n=e._$Co)==null?void 0:n[s]:e._$Cl;const o=R(t)?void 0:t._$litDirective$;return(i==null?void 0:i.constructor)!==o&&((c=i==null?void 0:i._$AO)==null||c.call(i,!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,e,s)),s!==void 0?(e._$Co??(e._$Co=[]))[s]=i:e._$Cl=i),i!==void 0&&(t=U(r,i._$AS(r,t.values),i,s)),t}class Tt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=((t==null?void 0:t.creationScope)??P).importNode(e,!0);C.currentNode=i;let o=C.nextNode(),n=0,c=0,h=s[0];for(;h!==void 0;){if(n===h.index){let d;h.type===2?d=new D(o,o.nextSibling,this,t):h.type===1?d=new h.ctor(o,h.name,h.strings,this,t):h.type===6&&(d=new Rt(o,this,t)),this._$AV.push(d),h=s[++c]}n!==(h==null?void 0:h.index)&&(o=C.nextNode(),n++)}return C.currentNode=P,i}p(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class D{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=g,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=U(this,t,e),R(t)?t===g||t==null||t===""?(this._$AH!==g&&this._$AR(),this._$AH=g):t!==this._$AH&&t!==I&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):xt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==g&&R(this._$AH)?this._$AA.nextSibling.data=t:this.T(P.createTextNode(t)),this._$AH=t}$(t){var o;const{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=M.createElement($t(s.h,s.h[0]),this.options)),s);if(((o=this._$AH)==null?void 0:o._$AD)===i)this._$AH.p(e);else{const n=new Tt(i,this),c=n.u(this.options);n.p(e),this.T(c),this._$AH=n}}_$AC(t){let e=ft.get(t.strings);return e===void 0&&ft.set(t.strings,e=new M(t)),e}k(t){J(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const o of t)i===e.length?e.push(s=new D(this.O(N()),this.O(N()),this,this.options)):s=e[i],s._$AI(o),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,e);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class W{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,o){this.type=1,this._$AH=g,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=g}_$AI(t,e=this,s,i){const o=this.strings;let n=!1;if(o===void 0)t=U(this,t,e,0),n=!R(t)||t!==this._$AH&&t!==I,n&&(this._$AH=t);else{const c=t;let h,d;for(t=o[0],h=0;h<o.length-1;h++)d=U(this,c[s+h],e,h),d===I&&(d=this._$AH[h]),n||(n=!R(d)||d!==this._$AH[h]),d===g?t=g:t!==g&&(t+=(d??"")+o[h+1]),this._$AH[h]=d}n&&!i&&this.j(t)}j(t){t===g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Ot extends W{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===g?void 0:t}}class Ht extends W{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==g)}}class Nt extends W{constructor(t,e,s,i,o){super(t,e,s,i,o),this.type=5}_$AI(t,e=this){if((t=U(this,t,e,0)??g)===I)return;const s=this._$AH,i=t===g&&s!==g||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==g&&(s===g||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class Rt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){U(this,t)}}const Z=H.litHtmlPolyfillSupport;Z==null||Z(M,D),(H.litHtmlVersions??(H.litHtmlVersions=[])).push("3.2.1");const kt=(r,t,e)=>{const s=(e==null?void 0:e.renderBefore)??t;let i=s._$litPart$;if(i===void 0){const o=(e==null?void 0:e.renderBefore)??null;s._$litPart$=i=new D(t.insertBefore(N(),o),o,void 0,e??{})}return i._$AI(r),i};/**
16
- * @license
17
- * Copyright 2017 Google LLC
18
- * SPDX-License-Identifier: BSD-3-Clause
19
- */let j=class extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=kt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return I}};j._$litElement$=!0,j.finalized=!0,(gt=globalThis.litElementHydrateSupport)==null||gt.call(globalThis,{LitElement:j});const Q=globalThis.litElementPolyfillSupport;Q==null||Q({LitElement:j}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");/**
20
- * @license
21
- * Copyright 2017 Google LLC
22
- * SPDX-License-Identifier: BSD-3-Clause
23
- */const Mt=r=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(r,t)}):customElements.define(r,t)};/**
24
- * @license
25
- * Copyright 2017 Google LLC
26
- * SPDX-License-Identifier: BSD-3-Clause
27
- */const Dt={attribute:!0,type:String,converter:L,reflect:!1,hasChanged:q},jt=(r=Dt,t,e)=>{const{kind:s,metadata:i}=e;let o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),o.set(e.name,r),s==="accessor"){const{name:n}=e;return{set(c){const h=t.get.call(this);t.set.call(this,c),this.requestUpdate(n,h,r)},init(c){return c!==void 0&&this.P(n,void 0,r),c}}}if(s==="setter"){const{name:n}=e;return function(c){const h=this[n];t.call(this,c),this.requestUpdate(n,h,r)}}throw Error("Unsupported decorator location: "+s)};function y(r){return(t,e)=>typeof e=="object"?jt(r,t,e):((s,i,o)=>{const n=i.hasOwnProperty(o);return i.constructor.createProperty(o,n?{...s,wrapped:!0}:s),n?Object.getOwnPropertyDescriptor(i,o):void 0})(r,t,e)}/**
28
- * @license
29
- * Copyright 2017 Google LLC
30
- * SPDX-License-Identifier: BSD-3-Clause
31
- */const zt=Symbol();class Lt{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((t,e)=>{this.o=t,this.h=e}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,s){var o;this.p=0,this.i=0,(this._=t).addController(this);const i=typeof e=="object"?e:{task:e,args:s};this.v=i.task,this.j=i.args,this.m=i.argsEqual??qt,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=(o=this.T)==null?void 0:o.call(this))}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;const t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){const t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){var n,c,h,d,p;let e,s;t??(t=this.T()),this.O=t,this.i===1?(n=this.q)==null||n.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();const i=++this.p;this.q=new AbortController;let o=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(a){o=!0,s=a}if(this.p===i){if(e===zt)this.i=0;else{if(o===!1){try{(c=this.k)==null||c.call(this,e)}catch{}this.i=2,(h=this.o)==null||h.call(this,e)}else{try{(d=this.A)==null||d.call(this,s)}catch{}this.i=3,(p=this.h)==null||p.call(this,s)}this.u=e,this.l=s}this._.requestUpdate()}}abort(t){var e;this.i===1&&((e=this.q)==null||e.abort(t))}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){var e,s,i,o;switch(this.i){case 0:return(e=t.initial)==null?void 0:e.call(t);case 1:return(s=t.pending)==null?void 0:s.call(t);case 2:return(i=t.complete)==null?void 0:i.call(t,this.value);case 3:return(o=t.error)==null?void 0:o.call(t,this.error);default:throw Error("Unexpected status: "+this.i)}}}const qt=(r,t)=>r===t||r.length===t.length&&r.every((e,s)=>!q(e,t[s]));function T(...r){return function(t){return v.DocItem(t)&&r.includes(t.label)}}var Bt={CodeItem:T("code"),ListItem:T("list_item"),PictureItem:T("picture"),SectionHeaderItem:T("section_header"),TableItem:T("document_index","table"),TextItem:T("caption","checkbox_selected","checkbox_unselected","footnote","page_footer","page_header","paragraph","reference","text")},v={Document(r){return"schema_name"in r&&r.schema_name==="DoclingDocument"},NodeItem(r){return"self_ref"in r},GroupItem(r){return v.NodeItem(r)&&(r.self_ref.startsWith("#/groups/")||r.self_ref==="#/body")},DocItem(r){return v.NodeItem(r)&&!v.GroupItem(r)},...Bt};function*Wt(r,t={}){r&&(yield*e(t.root??r.body));function*e(s,i=0){var o;if((!v.GroupItem(s)||t.withGroups)&&(v.DocItem(s)?(t.pageNo===void 0||(o=s.prov)!=null&&o.some(n=>n.page_no===t.pageNo))&&(yield[s,i]):yield[s,i]),!(v.PictureItem(s)&&!t.traversePictures))for(const n of s.children??[]){const c=Vt(r,n);v.NodeItem(c)&&(yield*e(c,i+1))}}}function Vt(r,t){return t.$ref.split("/").slice(1).reduce((s,i)=>s[i],r)}function Gt(r){return Object.values((r==null?void 0:r.pages)??{}).sort((t,e)=>t.page_no-e.page_no)}async function Ft(r,t={}){var h,d,p;let e;typeof r=="string"?e=await(await fetch(r)).json():typeof r=="object"&&v.Document(r)&&(e=r);const s=Gt(e),i=Array.from(Wt(e)).map(([a])=>a);let o=i;const n=new Set;if(typeof t.items=="string"){const a=new Set(t.items.split(",").map(l=>l.trim()).filter(l=>l.length>0));if(a.size>0){o=[];for(const l of i){const u=l.self_ref.split("/"),m=[];for(let f=2;f<u.length+1;f++)m.push(u.slice(0,f).join("/"));(h=l.prov)==null||h.forEach(f=>m.push(`#/pages/${f.page_no}`)),m.some(f=>a.has(f))?o.push(l):(d=l.prov)==null||d.forEach(f=>n.add(f.page_no))}}}else if(Array.isArray(t.items)){o=[];const a=new Set(t.items);for(const l of i)a.has(l)?o.push(l):(p=l.prov)==null||p.forEach(u=>n.add(u.page_no))}const c={};for(const a of s)c[a.page_no]=[];for(const a of o)for(const l of a.prov??[])c[l.page_no].push(a);return s.map(a=>({page:a,items:c[a.page_no],trimmed:n.has(a.page_no)}))}function Jt({page:r,items:t=[],pagenumbers:e,backdrop:s,itemPart:i,itemStyle:o,onclickitem:n}){if(r.image){const{size:h}=r,{width:d=1,height:p=1}=h,a=n?(l,u)=>n(l,r,u):void 0;return E`
32
- <div part="page" class="page" @onclick=${l=>a==null?void 0:a(l)} role="tab">
33
- <svg width=${r.image.size.width} viewBox="0 0 ${d} ${p}">
34
- <!-- Suppressed backdrop image. -->
35
- ${s?E`
36
- <image
37
- class="backdrop"
38
- href=${r.image.uri}
39
- width=${d}
40
- height=${p}
41
- />
42
-
43
- <clippath id="clip-page-${r.page_no}">
44
- ${t.map(l=>{var m;const u=(m=l.prov)==null?void 0:m.find(f=>f.page_no===r.page_no);if(u){const{l:f,r:X,t:z,b:Y}=u.bbox;return E`<rect
45
- x=${f}
46
- y=${p-z}
47
- width=${X-f}
48
- height=${z-Y}
49
- />`}})}
50
- </clippath>
51
- `:""}
52
-
53
- <!-- Foreground image. -->
54
- <image
55
- id="image"
56
- href=${r.image.uri}
57
- clip-path="url(#clip-page-${r.page_no})"
58
- width=${d}
59
- height${p}
60
- />
61
-
62
- ${t.map(l=>{var m;const u=(m=l.prov)==null?void 0:m.find(f=>f.page_no===r.page_no);if(u){const{l:f,r:X,t:z,b:Y}=u.bbox;return E`<rect
63
- part=${"item"+(i?" "+i(r,l):"")}
64
- style=${o==null?void 0:o(r,l)}
65
- x=${f}
66
- y=${p-z}
67
- width=${X-f}
68
- height=${z-Y}
69
- vector-effect="non-scaling-stroke"
70
- @onclick=${mt=>{mt.stopPropagation(),a==null||a(mt,l)}}
71
- @onmouseenter={(e: MouseEvent) => {
72
- const bounds = e.currentTarget.getBoundingClientRect();
73
-
74
- // Sizes of surrounding areas: Top, right, bottom, left.
75
- const areas = [
76
- bounds.top * window.innerWidth,
77
- (window.innerWidth - bounds.right) * window.innerHeight,
78
- (window.innerHeight - bounds.bottom) * window.innerWidth,
79
- bounds.left * window.innerHeight,
80
- ];
81
- const maxArea = Math.max(...areas);
82
- const quadrant = areas.findIndex(a => a === maxArea);
83
-
84
- hovered = {
85
- item,
86
- bounds,
87
- quadrant,
88
- };
89
- }}
90
- />`}})}
91
- </svg>
92
-
93
- ${e?E`<header
94
- part="page-number-top"
95
- class="page-number-top"
96
- title="Page ${r.page_no}"
97
- >
98
- ${r.page_no}
99
- </header>
100
-
101
- <header
102
- part="page-number-bottom"
103
- class="page-number-bottom"
104
- title="Page ${r.page_no}"
105
- >
106
- ${r.page_no}
107
- </header>`:""}
108
-
109
- <!-- Tooltip. -->
110
- ${c()}
111
- </div>
112
- `}else return E`Invalid page image.`;function c(){return""}}const Kt=st`
113
- .page {
114
- width: fit-content;
115
- max-width: 100%;
116
-
117
- display: flex;
118
- flex-direction: column;
119
- align-items: center;
120
- gap: 2px;
121
-
122
- color: black;
123
- }
124
- `;var Zt=Object.defineProperty,Qt=Object.getOwnPropertyDescriptor,_=(r,t,e,s)=>{for(var i=s>1?void 0:s?Qt(t,e):t,o=r.length-1,n;o>=0;o--)(n=r[o])&&(i=(s?n(t,e,i):n(i))||i);return s&&i&&Zt(t,e,i),i};$.ImgPages=class extends j{constructor(){super(...arguments),this.src="",this.trim="pages",this._fetchTask=new Lt(this,{task:async([t,e])=>Ft(t,{items:e}),args:()=>[this.src,this.items]})}render(){return this._fetchTask.render({pending:()=>E`<p>...</p>`,complete:t=>E`
125
- <div part="paged">
126
- ${t.filter(e=>!this.trim||e.items.length>0).map(({page:e,items:s})=>Jt({page:e,items:s,pagenumbers:this.pagenumbers!==void 0,backdrop:this.backdrop!==void 0,itemPart:this.itemPart,itemStyle:this.itemStyle,onclickitem:this.onclickitem}))}
127
- </div>
128
- `})}},$.ImgPages.styles=[st`
129
- div {
130
- width: fit-content;
131
- max-width: 100%;
132
-
133
- display: flex;
134
- flex-direction: column;
135
- align-items: center;
136
- gap: 2px;
137
-
138
- color: black;
139
- }
140
- `,Kt],_([y()],$.ImgPages.prototype,"alt",2),_([y()],$.ImgPages.prototype,"backdrop",2),_([y()],$.ImgPages.prototype,"items",2),_([y()],$.ImgPages.prototype,"pagenumbers",2),_([y()],$.ImgPages.prototype,"src",2),_([y()],$.ImgPages.prototype,"trim",2),_([y()],$.ImgPages.prototype,"itemPart",2),_([y()],$.ImgPages.prototype,"itemStyle",2),_([y()],$.ImgPages.prototype,"onclickitem",2),$.ImgPages=_([Mt("docling-img")],$.ImgPages),Object.defineProperty($,Symbol.toStringTag,{value:"Module"})});