mongoku
Version:
[](https://github.com/huggingface/Mongoku/actions/workflows/ci.yml)
3 lines (2 loc) • 6.59 kB
JavaScript
import{aB as ee,g as X,y as z,Q as te,P as re,al as P,w as S,Z as v,j as y,as as E,aC as V,h as se,k as ie,H as ne,aD as W,Y as p,X as J,V as x,l as g,_ as ae,aE as fe,aF as A,aG as D,aH as $,B as he,aI as oe,aJ as Q,$ as U,x as le,T as C,o as O,n as de,q as ce,aK as R,R as ue,aL as _e,aM as pe,aN as ge,F as ve,aO as ye,aP as me,aQ as q,aR as H,aS as be,aT as Z,aU as Ee,aV as Te,aW as L,v as N,aX as we,aY as Se,aZ as Re,a_ as Ne,p as ke,a$ as Ae,b0 as De,a as Oe}from"./IwGwbOe7.js";import{d as Fe}from"./DaMh_eeB.js";function xe(t){let e=0,r=z(0),i;return()=>{ee()&&(X(r),te(()=>(e===0&&(i=re(()=>t(()=>P(r)))),e+=1,()=>{S(()=>{e-=1,e===0&&(i?.(),i=void 0,P(r))})})))}}var Ce=ue|_e;function He(t,e,r,i){new Le(t,e,r,i)}class Le{parent;is_pending=!1;transform_error;#r;#_=y?v:null;#i;#o;#t;#n=null;#e=null;#s=null;#a=null;#l=0;#h=0;#d=!1;#p=new Set;#g=new Set;#f=null;#b=xe(()=>(this.#f=z(this.#l),()=>{this.#f=null}));constructor(e,r,i,n){this.#r=e,this.#i=r,this.#o=s=>{var a=E;a.b=this,a.f|=V,i(s)},this.parent=E.b,this.transform_error=n??this.parent?.transform_error??(s=>s),this.#t=se(()=>{if(y){const s=this.#_;ie();const a=s.data===ne;if(s.data.startsWith(W)){const f=JSON.parse(s.data.slice(W.length));this.#T(f)}else a?this.#w():this.#E()}else this.#v()},Ce),y&&(this.#r=v)}#E(){try{this.#n=p(()=>this.#o(this.#r))}catch(e){this.error(e)}}#T(e){const r=this.#i.failed;r&&(this.#s=p(()=>{r(this.#r,()=>e,()=>()=>{})}))}#w(){const e=this.#i.pending;e&&(this.is_pending=!0,this.#e=p(()=>e(this.#r)),S(()=>{var r=this.#a=document.createDocumentFragment(),i=J();r.append(i),this.#n=this.#u(()=>p(()=>this.#o(i))),this.#h===0&&(this.#r.before(r),this.#a=null,x(this.#e,()=>{this.#e=null}),this.#c(g))}))}#v(){try{if(this.is_pending=this.has_pending_snippet(),this.#h=0,this.#l=0,this.#n=p(()=>{this.#o(this.#r)}),this.#h>0){var e=this.#a=document.createDocumentFragment();ae(this.#n,e);const r=this.#i.pending;this.#e=p(()=>r(this.#r))}else this.#c(g)}catch(r){this.error(r)}}#c(e){this.is_pending=!1,e.transfer_effects(this.#p,this.#g)}defer_effect(e){fe(e,this.#p,this.#g)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#i.pending}#u(e){var r=E,i=Q,n=U;A(this.#t),D(this.#t),$(this.#t.ctx);try{return he.ensure(),e()}catch(s){return oe(s),null}finally{A(r),D(i),$(n)}}#y(e,r){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(e,r);return}this.#h+=e,this.#h===0&&(this.#c(r),this.#e&&x(this.#e,()=>{this.#e=null}),this.#a&&(this.#r.before(this.#a),this.#a=null))}update_pending_count(e,r){this.#y(e,r),this.#l+=e,!(!this.#f||this.#d)&&(this.#d=!0,S(()=>{this.#d=!1,this.#f&&le(this.#f,this.#l)}))}get_effect_pending(){return this.#b(),X(this.#f)}error(e){if(!this.#i.onerror&&!this.#i.failed)throw e;g?.is_fork?(this.#n&&g.skip_effect(this.#n),this.#e&&g.skip_effect(this.#e),this.#s&&g.skip_effect(this.#s),g.on_fork_commit(()=>{this.#m(e)})):this.#m(e)}#m(e){this.#n&&(C(this.#n),this.#n=null),this.#e&&(C(this.#e),this.#e=null),this.#s&&(C(this.#s),this.#s=null),y&&(O(this.#_),de(),O(ce()));var r=this.#i.onerror;let i=this.#i.failed;var n=!1,s=!1;const a=()=>{if(n){ge();return}n=!0,s&&pe(),this.#s!==null&&x(this.#s,()=>{this.#s=null}),this.#u(()=>{this.#v()})},c=f=>{try{s=!0,r?.(f,a),s=!1}catch(h){R(h,this.#t&&this.#t.parent)}i&&(this.#s=this.#u(()=>{try{return p(()=>{var h=E;h.b=this,h.f|=V,i(this.#r,()=>f,()=>a)})}catch(h){return R(h,this.#t.parent),null}}))};S(()=>{var f;try{f=this.transform_error(e)}catch(h){R(h,this.#t&&this.#t.parent);return}f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(c,h=>R(h,this.#t&&this.#t.parent)):c(f)})}}const Me=["touchstart","touchmove"];function Ie(t){return Me.includes(t)}const w=Symbol("events"),G=new Set,M=new Set;function Ye(t,e,r,i={}){function n(s){if(i.capture||I.call(e,s),!s.cancelBubble)return ye(()=>r?.call(this,s))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?S(()=>{e.addEventListener(t,n,i)}):e.addEventListener(t,n,i),n}function We(t,e,r,i,n){var s={capture:i,passive:n},a=Ye(t,e,r,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&ve(()=>{e.removeEventListener(t,a,s)})}function $e(t,e,r){(e[w]??={})[t]=r}function qe(t){for(var e=0;e<t.length;e++)G.add(t[e]);for(var r of M)r(t)}let j=null;function I(t){var e=this,r=e.ownerDocument,i=t.type,n=t.composedPath?.()||[],s=n[0]||t.target;j=t;var a=0,c=j===t&&t[w];if(c){var f=n.indexOf(c);if(f!==-1&&(e===document||e===window)){t[w]=e;return}var h=n.indexOf(e);if(h===-1)return;f<=h&&(a=f)}if(s=n[a]||t.target,s!==e){me(t,"currentTarget",{configurable:!0,get(){return s||r}});var m=Q,T=E;D(null),A(null);try{for(var _,l=[];s!==null;){var o=s.assignedSlot||s.parentNode||s.host||null;try{var d=s[w]?.[i];d!=null&&(!s.disabled||t.target===s)&&d.call(s,t)}catch(u){_?l.push(u):_=u}if(t.cancelBubble||o===e||o===null)break;s=o}if(_){for(let u of l)queueMicrotask(()=>{throw u});throw _}}finally{t[w]=e,delete t.currentTarget,D(m),A(T)}}}function je(t,e){var r=e==null?"":typeof e=="object"?`${e}`:e;r!==(t[q]??=t.nodeValue)&&(t[q]=r,t.nodeValue=`${r}`)}function Be(t,e){return K(t,e)}function Xe(t,e){H(),e.intro=e.intro??!1;const r=e.target,i=y,n=v;try{for(var s=be(r);s&&(s.nodeType!==Z||s.data!==Ee);)s=Te(s);if(!s)throw L;N(!0),O(s);const a=K(t,{...e,anchor:s});return N(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
`).some(c=>c.startsWith("https://svelte.dev/e/")))throw a;return a!==L&&console.warn("Failed to hydrate: ",a),e.recover===!1&&we(),H(),Se(r),N(!1),Be(t,e)}finally{N(i),O(n)}}const k=new Map;function K(t,{target:e,anchor:r,props:i={},events:n,context:s,intro:a=!0,transformError:c}){H();var f=void 0,h=Re(()=>{var m=r??e.appendChild(J());He(m,{pending:()=>{}},l=>{ke({});var o=U;if(s&&(o.c=s),n&&(i.$$events=n),y&&Fe(l,null),f=t(l,i)||{},y&&(E.nodes.end=v,v===null||v.nodeType!==Z||v.data!==Ae))throw De(),L;Oe()},c);var T=new Set,_=l=>{for(var o=0;o<l.length;o++){var d=l[o];if(!T.has(d)){T.add(d);var u=Ie(d);for(const F of[e,document]){var b=k.get(F);b===void 0&&(b=new Map,k.set(F,b));var B=b.get(d);B===void 0?(F.addEventListener(d,I,{passive:u}),b.set(d,1)):b.set(d,B+1)}}}};return _(Ne(G)),M.add(_),()=>{for(var l of T)for(const u of[e,document]){var o=k.get(u),d=o.get(l);--d==0?(u.removeEventListener(l,I),o.delete(l),o.size===0&&k.delete(u)):o.set(l,d)}M.delete(_),m!==r&&m.parentNode?.removeChild(m)}});return Y.set(f,h),f}let Y=new WeakMap;function ze(t,e){const r=Y.get(t);return r?(Y.delete(t),r(e)):Promise.resolve()}export{$e as a,qe as d,We as e,Xe as h,Be as m,je as s,ze as u};