PageSourceSearch

https://dapp-beyourahi.vercel.app/build/bundle.js

js dapp-beyourahi.vercel.app collected 2026-10-03 06:31:00 UTC 84,822 bytes, 2 lines download raw bytes

1var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function r(t){t.forEach(e)}function o(t){return"function"==typeof t}function i(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function a(e,n,r){e.$$.on_destroy.push(function(e,...n){if(null==e)return t;const r=e.subscribe(...n);return r.unsubscribe?()=>r.unsubscribe():r}(n,r))}let s,u=!1;function c(t,e,n,r){for(;t<e;){const o=t+(e-t>>1);n(o)<=r?t=o+1:e=o}return t}function f(t,e){u?(!function(t){if(t.hydrate_init)return;t.hydrate_init=!0;const e=t.childNodes,n=new Int32Array(e.length+1),r=new Int32Array(e.length);n[0]=-1;let o=0;for(let t=0;t<e.length;t++){const i=c(1,o+1,(t=>e[n[t]].claim_order),e[t].claim_order)-1;r[t]=n[i]+1;const a=i+1;n[a]=t,o=Math.max(a,o)}const i=[],a=[];let s=e.length-1;for(let t=n[o]+1;0!=t;t=r[t-1]){for(i.push(e[t-1]);s>=t;s--)a.push(e[s]);s--}for(;s>=0;s--)a.push(e[s]);i.reverse(),a.sort(((t,e)=>t.claim_order-e.claim_order));for(let e=0,n=0;e<a.length;e++){for(;n<i.length&&a[e].claim_order>=i[n].claim_order;)n++;const r=n<i.length?i[n]:null;t.insertBefore(a[e],r)}}(t),(void 0===t.actual_end_child||null!==t.actual_end_child&&t.actual_end_child.parentElement!==t)&&(t.actual_end_child=t.firstChild),e!==t.actual_end_child?t.insertBefore(e,t.actual_end_child):t.actual_end_child=e.nextSibling):e.parentNode!==t&&t.appendChild(e)}function l(t,e,n){u&&!n?f(t,e):(e.parentNode!==t||n&&e.nextSibling!==n)&&t.insertBefore(e,n||null)}function p(t){t.parentNode.removeChild(t)}function h(t){return document.createElement(t)}function d(t){return document.createTextNode(t)}function g(){return d(" ")}function y(){return d("")}function v(t,e,n,r){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}function m(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function b(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function w(t,e){t.value=null==e?"":e}function k(t,e,n,r){t.style.setProperty(e,n,r?"important":"")}function x(t,e,n){t.classList[n?"add":"remove"](e)}function _(t){s=t}function S(t){(function(){if(!s)throw new Error("Function called outside component initialization");return s})().$$.on_mount.push(t)}const $=[],A=[],j=[],T=[],O=Promise.resolve();let D=!1;function E(t){j.push(t)}let N=!1;const B=new Set;function C(){if(!N){N=!0;do{for(let t=0;t<$.length;t+=1){const e=$[t];_(e),G(e.$$)}for(_(null),$.length=0;A.length;)A.pop()();for(let t=0;t<j.length;t+=1){const e=j[t];B.has(e)||(B.add(e),e())}j.length=0}while($.length);for(;T.length;)T.pop()();D=!1,N=!1,B.clear()}}function G(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(E)}}const U=new Set;let I;function P(){I={r:0,c:[],p:I}}function J(){I.r||r(I.c),I=I.p}function M(t,e){t&&t.i&&(U.delete(t),t.i(e))}function H(t,e,n,r){if(t&&t.o){if(U.has(t))return;U.add(t),I.c.push((()=>{U.delete(t),r&&(n&&t.d(1),r())})),t.o(e)}}function K(t,e){H(t,1,1,(()=>{e.delete(t.key)}))}function R(t){t&&t.c()}function L(t,n,i,a){const{fragment:s,on_mount:u,on_destroy:c,after_update:f}=t.$$;s&&s.m(n,i),a||E((()=>{const n=u.map(e).filter(o);c?c.push(...n):r(n),t.$$.on_mount=[]})),f.forEach(E)}function F(t,e){const n=t.$$;null!==n.fragment&&(r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function W(t,e){-1===t.$$.dirty[0]&&($.push(t),D||(D=!0,O.then(C)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function q(e,o,i,a,c,f,l=[-1]){const h=s;_(e);const d=e.$$={fragment:null,ctx:null,props:f,update:t,not_equal:c,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(h?h.$$.context:o.context||[]),callbacks:n(),dirty:l,skip_bound:!1};let g=!1;if(d.ctx=i?i(e,o.props||{},((t,n,...r)=>{const o=r.length?r[0]:n;return d.ctx&&c(d.ctx[t],d.ctx[t]=o)&&(!d.skip_bound&&d.bound[t]&&d.bound[t](o),g&&W(e,t)),n})):[],d.update(),g=!0,r(d.before_update),d.fragment=!!a&&a(d.ctx),o.target){if(o.hydrate){u=!0;const t=function(t){return Array.from(t.childNodes)}(o.target);d.fragment&&d.fragment.l(t),t.forEach(p)}else d.fragment&&d.fragment.c();o.intro&&M(e.$$.fragment),L(e,o.target,o.anchor,o.customElement),u=!1,C()}_(h)}class z{$destroy(){F(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}var V="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function X(t){var e={exports:{}};return t(e,e.exports),e.exports}function Y(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.')}var Q=X((function(t){!function(){function e(t,n){return n?Y(t):t.slice?e[r(t)]:function(n,o){t(n={exports:{}}),e[r(o)]=n.exports};function r(t){return t.split("/").slice(-1).toString().replace(".js","")}}var n=t;e((function(t){String.random=function(t,e){var n="";for(t=t||24,e=e||"0123456789ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxyz";t-- >0;)n+=e.charAt(Math.floor(Math.random()*e.length));return n},String.match=function(t,e){var n,r;return"string"==typeof t&&("string"==typeof e&&(e={"=":e}),t===(n=(e=e||{})["="]||e["*"]||e[">"]||e["<"])||r===e["="]&&(n=e["*"]||e[">"],t.slice(0,(n||"").length)===n||r===e["*"]&&(r!==e[">"]&&r!==e["<"]?t>=e[">"]&&t<=e["<"]:r!==e[">"]&&t>=e[">"]||r!==e["<"]&&t<=e["<"])))},String.hash=function(t,e){if("string"==typeof t){if(e=e||0,!t.length)return e;for(var n=0,r=t.length;n<r;++n)e=(e<<5)-e+t.charCodeAt(n),e|=0;return e}};var e,n,r,o,i=Object.prototype.hasOwnProperty;Object.plain=function(t){return!!t&&(t instanceof Object&&t.constructor===Object||"Object"===Object.prototype.toString.call(t).match(/^\[object (\w+)\]$/)[1])}
1,Object.empty=function(t,e){for(var n in t)if(i.call(t,n)&&(!e||-1==e.indexOf(n)))return!1;return!0},Object.keys=Object.keys||function(t){var e=[];for(var n in t)i.call(t,n)&&e.push(n);return e},e=setTimeout,n=0,r=0,o=typeof setImmediate!=""+void 0&&setImmediate||e,e.poll=e.poll||function(t){1>=+new Date-n&&r++<3333?t():o((function(){n=+new Date,t()}),r=0)},function(){var t,e=setTimeout,n=e.turn=e.turn||function(t){1==r.push(t)&&o(a)},r=n.s=[],o=e.poll,i=0,a=function(){(t=r[i++])&&t(),i!=r.length&&99!=i||(r=n.s=r.slice(i),i=0),r.length&&o(a)}}(),function(){var t,e=setTimeout,n=e.turn;(e.each=e.each||function(e,r,o,i){i=i||9,function a(s,u,c){if(u=(s=(e||[]).splice(0,i)).length){for(var f=0;f<u&&t===(c=r(s[f]));f++);if(t===c)return void n(a)}o&&o(c)}()})()}()}))(e,"./shim"),e((function(t){t.exports=function t(e,n,r){if(!e)return{to:t};var o="function"==typeof n;e=(this.tag||(this.tag={}))[e]||o&&(this.tag[e]={tag:e,to:t._={next:function(t){var e;(e=this.to)&&e.next(t)}}});if(o){var i={off:t.off||(t.off=function(){if(this.next===t._.next)return!0;this===this.the.last&&(this.the.last=this.back),this.to.back=this.back,this.next=t._.next,this.back.to=this.to,this.the.last===this.the&&delete this.on.tag[this.the.tag]}),to:t._,next:n,the:e,on:this,as:r};return(i.back=e.last||e).to=i,e.last=i}return(e=e.to)&&undefined!==n&&e.next(n),e}}))(e,"./onto"),e((function(t){e("./shim"),t.exports=function(t){return void 0!==t&&(null===t||t!==1/0&&(t==t&&("string"==typeof t||"boolean"==typeof t||"number"==typeof t||!(!t||"string"!=typeof(t["#"]||0)||!Object.empty(t,["#"]))&&t["#"])))}}))(e,"./valid"),e((function(t){function n(){var t=+new Date;return s<t?(i=0,s=t+n.drift):s=t+(i+=1)/a+n.drift}e("./shim"),n.drift=0;var r,o=-1/0,i=0,a=999,s=o;n.is=function(t,e,n){var r=e&&t&&t._&&t._[">"]||n;if(r)return"number"==typeof(r=r[e])?r:o},n.ify=function(t,e,n,o,i){(t=t||{})._=t._||{},i&&(t._["#"]=i);var a=t._[">"]||(t._[">"]={});return r!==e&&"_"!==e&&("number"==typeof n&&(a[e]=n),r!==o&&(t[e]=o)),t},t.exports=n}))(e,"./state"),e((function(t){e("./shim"),t.exports=function(t){var e={s:{}},n=e.s;t=t||{max:999,age:9e3},e.check=function(t){return!!n[t]&&r(t)};var r=e.track=function(r){var o=n[r]||(n[r]={});return o.was=e.now=+new Date,e.to||(e.to=setTimeout(e.drop,t.age+9)),o};return e.drop=function(r){e.to=null,e.now=+new Date;var o=Object.keys(n);console.STAT&&console.STAT(e.now,+new Date-e.now,"dup drop keys"),setTimeout.each(o,(function(o){var i=n[o];i&&(r||t.age)>e.now-i.was||delete n[o]}),0,99)},e}}))(e,"./dup"),e((function(t){e("./onto"),t.exports=function(t,e){if(this.on){var r=(this.opt||{}).lack||9e3;if("function"!=typeof t){if(!t)return;var o=t["#"]||t,i=(this.tag||"")[o];if(!i)return;return e&&(i=this.on(o,e),clearTimeout(i.err),i.err=setTimeout((function(){i.off()}),r)),!0}o=e&&e["#"]||n(9);if(!t)return o;var a=this.on(o,t,e);return a.err=a.err||setTimeout((function(){a.off(),a.next({err:"Error: No ACK yet.",lack:!0})}),r),o}};var n=String.random||function(){return Math.random().toString(36).slice(2)}}))(e,"./ask"),e((function(t){function r(t){return t instanceof r?(this._={$:this}).$:this instanceof r?r.create(this._={$:this,opt:t}):new r(t)}r.is=function(t){return t instanceof r||t&&t._&&t===t._.$||!1},r.version=.202,r.chain=r.prototype,r.chain.toJSON=function(){},e("./shim"),r.valid=e("./valid"),r.state=e("./state"),r.on=e("./onto"),r.dup=e("./dup"),r.ask=e("./ask"),function(){function t(n){if(n)if(n.out!==t){var o,i=this.as,u=i.at||i,c=u.$,f=u.dup,l=n.DBG;if((o=n["#"])||(o=n["#"]=s(9)),!f.check(o)){if(f.track(o),o=n._,n._="function"==typeof o?o:function(){},n.$&&n.$===(n.$._||"").$||(n.$=c),n["@"]&&!n.put&&function(t){var e,n=t["@"]||"";if(!(e=n._))return;e.acks=(e.acks||0)+1,(e.err=t.err)&&(t["@"]=e["#"],a(e));e.stop||e.crack||(e.crack=e.match&&e.match.push((function(){h(e)})));h(e)}(n),!u.ask(n["@"],n)){if(l&&(l.u=+new Date),n.put)return void e(n);n.get&&r.on.get(n,c)}l&&(l.uc=+new Date),this.to.next(n),l&&(l.ua=+new Date),n.nts||n.NTS||(n.out=t,u.on("out",n),l&&(l.ue=+new Date))}}else this.to.next(n)}function e(e){if(e){var r=e._||"",i=r.root=((r.$=e.$||"")._||"").root;if(e["@"]&&r.faith&&!r.miss)return e.out=t,void i.on("out",e);r.latch=i.hatch,r.match=i.hatch=[];var s=e.put,f=r.DBG=e.DBG,l=+new Date;if(!s["#"]||!s["."]){f&&(f.p=l),r["#"]=e["#"],r.msg=e,r.all=0,r.stun=1;var p=Object.keys(s);console.STAT&&console.STAT(l,((f||r).pk=+new Date)-l,"put sort");var h,y,v,m,b,w,k,x=0;!function t(i){if(h!=x){if(h=x,!(v=p[x]))return console.STAT&&console.STAT(l,((f||r).pd=+new Date)-l,"put"),void a(r);(m=s[v])?(k=m._)?v!==k["#"]?w=d+g(v)+"soul not same.":(b=k[">"])||(w=d+g(v)+"no state."):w=d+g(v)+"no meta.":w=d+g(v)+"no node.",y=Object.keys(m||{})}if(w)return e.err=r.err=w,void a(r);var _,S=0;for(i=i||0;i++<9&&(_=y[S++]);)if("_"!==_){var $=m[_],A=b[_];if(o===A){w=d+g(_)+"on"+g(v)+"no state.";break}if(!c($)){w=d+g(_)+"on"+g(v)+"bad "+typeof $+g($);break}n($,_,v,A,e)}(y=y.slice(S)).length?u(t):(++x,y=null,t(i))}()}}}function n(t,e,r,o,i){var a,s=i._||"",u=s.root,c=u.graph,l=c[r]||p,h=f(l,e,1),d=l[e],g=s.DBG;(a=console.STAT)&&(c[r]&&d||(a.has=(a.has||0)+1));var b=m();if(o>b)return setTimeout((function(){n(t,e,r,o,i)}),(a=o-b)>v?v:a),void(console.STAT&&console.STAT((g||s).Hf=+new Date,a,"future"));if((!(o<h)||s.miss)&&(s.faith||o!==h||!(t===d||y(t)<=y(d))||s.miss)){s.stun++;var w=i["#"]+s.all++,k={toString:function(){return w},_:s};k.toJSON=k.toString,g&&(g.ph=g.ph||+new Date),u.on("put",{"#":k,"@":i["@"],put:{"#":r,".":e,":":t,">":o},_:s})}}function i(t){var e;(e=(t._||"").DBG)&&(e.pa=+new Date,e.pm=e.pm||+new Date);var n,r=this.as,o=r.graph,i=t._,s=t.put,u=s["#"],c=s["."],f=s[":"],p=s[">"];t["#"],(n=i.msg)&&(n=n.put)&&(n=n[u])&&l(n,c,p,f,u),o[u]=l(o[u],c,p,f,u),(n=(r.next||"")[u])&&n.on("in",t),a(i),this.to.next(t)}function a(e,n){var r;if(!e.stop&&(e.err||!(0<--e.stun))&&(e.stop=1,r=e.root)){var o=e.match;o.end=1,o===r.hatch&&(!(o=e.latch)||o.end?delete r.hatch:r.hatch=o),e.hatch&&e.hatch(),setTimeout.each(e.match,(function(t){t&&t()})),!(n=e.msg)||e.err||n.err||(n.out=t,e.root.on("out",n))}}function h(t){t&&t.root&&(t.stun||t.acks!==t.all||t.root.on("in",{"@":t["#"],err:t.err,ok:t.err?o:{"":1}}))}r.create=function(e){e.root=e.root||e,e.graph=e.graph||{},e.on=e.on||r.on,e.ask=e.ask||r.ask,e.dup=e.dup||r.dup();var n=e.$.opt(e.opt);return e.once||(e.on("in",t,e),e.on("out",t,e),e.on("put",i,e),r.on("create",e),e.on("create",e)),e.once=1,n}
1,r.on.put=e,console.log("BEWARE: BETA VERSION OF NEW GUN! NOT ALL FEATURES FINISHED!");var d="Error: Invalid graph!",g=function(t){return" '"+(""+t).slice(0,9)+"...' "},y=JSON.stringify,v=2147483647,m=r.state}(),function(){function t(t,e){var n=+new Date,r=t._||{},i=r.DBG=t.DBG,a=t["#"],u=s(9),c=Object.keys(e||"").sort(),p=((e||"")._||"")["#"];c.length;var h=t.$._.root,d=e===h.graph[p];console.STAT&&console.STAT(n,((i||r).gk=+new Date)-n,"got keys"),e&&function t(){n=+new Date;for(var r,g,y,v=0,m={};v<9&&(r=c[v++]);)l(m,r,f(e,r),e[r],p);c=c.slice(v),(g={})[p]=m,m=g,d&&((y=function(){}).ram=y.faith=!0),g=c.length,console.STAT&&console.STAT(n,-(n-(n=+new Date)),"got copied some"),i&&(i.ga=+new Date),h.on("in",{"@":a,"#":u,put:m,"%":g?u=s(9):o,$:h.$,_:y,DBG:i}),console.STAT&&console.STAT(n,+new Date-n,"got in"),g&&setTimeout.turn(t)}(),e||h.on("in",{"@":t["#"]})}r.on.get=function(e,n){var r=n._,i=e.get,a=i["#"],s=r.graph[a],u=i["."];(r.next||(r.next={}))[a];var c=(e._||{}).DBG=e.DBG;if(c&&(c.g=+new Date),!s)return r.on("get",e);if(u){if("string"!=typeof u||o===s[u])return r.on("get",e);s=l({},u,f(s,u),s[u],a)}s&&t(e,s),r.on("get",e)},r.on.get.ack=t}(),r.chain.opt=function(t){t=t||{};var e=this._,n=t.peers||t;return Object.plain(t)||(t={}),Object.plain(e.opt)||(e.opt=t),"string"==typeof n&&(n=[n]),n instanceof Array&&(Object.plain(e.opt.peers)||(e.opt.peers={}),n.forEach((function(t){var n={};n.id=n.url=t,e.opt.peers[t]=e.opt.peers[t]||n}))),e.opt.peers=e.opt.peers||{},a(t,(function t(e){var n=this[e];this&&this.hasOwnProperty(e)||"string"==typeof n||Object.empty(n)?this[e]=n:(!n||n.constructor===Object||n instanceof Array)&&a(n,t)})),r.on("opt",e),e.opt.uuid=e.opt.uuid||function(t){return r.state().toString(36).replace(".","")+String.random(t||12)},this};var o,i,a=function(t,e){Object.keys(t).forEach(e,t)},s=String.random,u=setTimeout.turn,c=r.valid,f=r.state.is,l=r.state.ify,p={};r.log=function(){return!r.log.off&&i.log.apply(i,arguments),[].slice.call(arguments).join(" ")},r.log.once=function(t,e,n){return(n=r.log.once)[t]=n[t]||0,n[t]++||r.log(e)},"undefined"!=typeof window&&((window.GUN=window.Gun=r).window=window);try{void 0!==n&&(n.exports=r)}catch(t){}t.exports=r,(r.window||{}).console=(r.window||{}).console||{log:function(){}},(i=console).only=function(t,e){return i.only.i&&t===i.only.i&&i.only.i++&&(i.log.apply(i,arguments)||e)},r.log.once("welcome","Hello wonderful person! :) Thanks for using GUN, please ask for help on http://chat.gun.eco if anything takes you longer than 5min to figure out!")}))(e,"./root"),e((function(t){e("./root").chain.back=function(t,e){if(-1===(t=t||1)||1/0===t)return this._.root.$;if(1===t)return(this._.back||this._).$;var o=this._;if("string"==typeof t&&(t=t.split(".")),t instanceof Array){for(var i=0,a=t.length,s=o;i<a;i++)s=(s||r)[t[i]];return n!==s?e?this:s:(s=o.back)?s.$.back(t,e):void 0}if("function"==typeof t){var u;for(s={back:o};(s=s.back)&&n===(u=t(s,e)););return u}return"number"==typeof t?(o.back||o).$.back(t-1):this};var n,r={}}))(e,"./back"),e((function(t){var n=e("./root");function r(t,e){if(e=e||this.as||t.$._,(!t.$$||this===n.on)&&t.put&&!e.soul){var r=t.put||"",o=r["="]||r[":"],i=e.root,a=i.$.get(r["#"]).get(r["."])._;if("string"==typeof(o=c(o))){if(!(a.echo||(a.echo={}))[e.id]||(i.pass||"")[e.id]){if(s=i.pass){if(s[o+e.id])return;s[o+e.id]=1}(a.echo||(a.echo={}))[e.id]=e,e.has&&(e.link=o);var s,u=i.$.get(a.link=o)._;(u.echo||(u.echo={}))[a.id]=a,((s=e.ask||"")[""]||e.lex)&&u.on("out",{get:{"#":o}}),setTimeout.each(Object.keys(s),(function(t,e){t&&(e=s[t])&&e.on("out",{get:{"#":o,".":t}})}),0,99)}}else this===n.on&&((a.echo||(a.echo={}))[e.id]=e)}}function o(t,e){var n,r,i=t.put||"",s=a!==i["="]?i["="]:i[":"],u=e.root;if(a===s){if(e.soul&&a!==e.put)return;if(r=(t.$$||t.$||"")._||"",t["@"]&&(a!==r.put||a!==e.put))return;return(n=e.link||t.linked)&&delete(u.$.get(n)._.echo||"")[e.id],e.has&&(e.link=null),e.put=a,void setTimeout.each(Object.keys(e.next||""),(function(t,r){(r=e.next[t])&&(n&&delete(u.$.get(n).get(t)._.echo||"")[r.id],r.on("in",{get:t,put:a,$:r.$}))}),0,99)}e.soul||t.$$||(n=c(s),r=t.$._||"",(n!==r.link&&(!e.has||r.link)||(u.pass||"")[e.id]&&"string"!=typeof n)&&(delete(r.echo||"")[e.id],o({get:e.get,put:a,$:t.$,linked:t.linked=t.linked||r.link},e)))}function i(t,e){var r=this.as,o=r.$._;o.root;var i=r.get||"",s=(t.put||"")[i["#"]]||"";if(!t.put||"string"==typeof i["."]&&a===s[i["."]]){if(a!==o.put)return;if(!o.soul&&!o.has)return;return o.ack=(o.ack||0)+1,void o.on("in",{get:o.get,put:o.put=a,$:o.$,"@":t["@"]})}(t._||{}).miss=1,n.on.put(t)}n.chain.chain=function(t){var e,r=this,o=r._,i=new(t||r).constructor(r),a=i._;return a.root=e=o.root,a.id=++e.once,a.back=r._,a.on=n.on,a.on("in",n.on.in,a),a.on("out",n.on.out,a),i},n.on.out=function(t){var e,n,r=this.as,o=r.back,s=r.root;if(t.$||(t.$=r.$),this.to.next(t),!r.err){if(e=t.get){if(s.pass&&(s.pass[r.id]=r),r.lex&&Object.keys(r.lex).forEac
1h((function(t){n[t]=r.lex[t]}),n=t.get=t.get||{}),e["#"]||r.soul){if(e["#"]=e["#"]||r.soul,t["#"]||(t["#"]=u(9)),o=s.$.get(e["#"])._,e=e["."]){if(f(o.put,e)&&(n=o.ask&&o.ask[e],(o.ask||(o.ask={}))[e]=o.$.get(e)._,o.on("in",{get:e,put:{"#":o.soul,".":e,":":o.put[e],">":p(s.graph[o.soul],e)}}),n))return}else{if(n=o.ask&&o.ask[""],(o.ask||(o.ask={}))[""]=o,a!==o.put&&(o.on("in",o),n))return;t.$=o.$}return s.ask(i,t),s.on("in",t)}if(e["."])return r.get?(t={get:{".":r.get},$:r.$},(o.ask||(o.ask={}))[r.get]=t.$._,o.on("out",t)):(t={get:r.lex?t.get:{},$:r.$},o.on("out",t));if((r.ask||(r.ask={}))[""]=r,r.get)return e["."]=r.get,(o.ask||(o.ask={}))[r.get]=t.$._,o.on("out",t)}return o.on("out",t)}r.on("in",{put:r.put=a,$:r.$})},n.on.in=function(t,e){var n,i=(e=e||this.as).root,u=t.$||(t.$=e.$),f=(u||"")._||s,l=t.put||"",d=l["#"],g=l["."],y=a!==l["="]?l["="]:l[":"],v=l[">"]||-1/0;if(a!==t.put&&(a===l["#"]||a===l["."]||a===l[":"]&&a===l["="]||a===l[">"]))return c(l)?void e.on("in",{$:f.back.$,put:{"#":d=f.back.soul,".":g=f.has||f.get,"=":l,">":p(f.back.put,g)},via:t}):(d=((l||"")._||"")["#"])?(u=e.root.$.get(d),setTimeout.each(Object.keys(l).sort(),(function(n){"_"!=n&&a!==(v=p(l,n))&&e.on("in",{$:u,put:{"#":d,".":n,"=":l[n],">":v},VIA:t})}))):void console.log("chain not yet supported for",l,"...",t,e);(t.seen||"")[e.id]||((t.seen||(t.seen=function(){}))[e.id]=e,e!==f&&(Object.keys(t).forEach((function(e){l[e]=t[e]}),l={}),l.get=e.get||l.get,e.soul||e.has?f.soul&&(l.$=e.$,l.$$=l.$$||f.$):l.$$$=l.$$$||e.$,t=l),o(t,e),(e.soul||t.$$)&&v>=p(i.graph[d],g)&&((l=i.$.get(d)._).put=h(l.put,g,v,y,d)),!f.soul&&v>=p(i.graph[d],g)&&(n=(i.$.get(d)._.next||"")[g])&&(n.put=y,"string"==typeof(l=c(y))&&(n.put=i.$.get(l)._.put||y)),this.to&&this.to.next(t),e.any&&setTimeout.each(Object.keys(e.any),(function(n){(n=e.any[n])&&n(t)}),0,99),e.echo&&setTimeout.each(Object.keys(e.echo),(function(n){(n=e.echo[n])&&n.on("in",t)}),0,99),((t.$$||"")._||f).soul&&(n=e.next)&&(n=n[g])&&(l={},Object.keys(t).forEach((function(e){l[e]=t[e]})),l.$=(t.$$||t.$).get(l.get=g),delete l.$$,delete l.$$$,n.on("in",l)),r(t,e))},n.on.link=r,n.on.unlink=o;var a,s={},u=String.random,c=n.valid,f=function(t,e){return t&&Object.prototype.hasOwnProperty.call(t,e)},l=n.state,p=l.is,h=l.ify}))(e,"./chain"),e((function(t){var n=e("./root");function r(t){var e=this.at||this.on;if(!t||e.soul||e.has)return this.off();if(t=(t=(t=t.$||t)._||t).id){var n;if(e.map,(n=this.seen||(this.seen={}))[t])return!0;n[t]=!0}}n.chain.get=function(t,e,s){var u,c;if("string"==typeof t){if(0==t.length)return(u=this.chain())._.err={err:n.log("0 length key!",t)},e&&e.call(u,u._.err),u;(u=((l=this._).next||i)[t])||(u=t&&function(t,e){var n=e._,r=n.next,o=e.chain()._;r||(r=n.next={});r[o.get=t]=o,e===n.root.$?o.soul=t:(n.soul||n.has)&&(o.has=t);return o}(t,this)),u=u&&u.$}else{if("function"==typeof t){if(!0===e)return function(t,e,r,i){var a,s=t._,u=0;if(a=s.soul||s.link)return e(a,i,s);if(s.jam)return s.jam.push([e,i]);s.jam=[[e,i]],t.get((function(t,e){if(!(o===t.put&&!s.root.opt.super&&(a=Object.keys(s.root.opt.peers).length)&&++u<=a)){e.rid(t);var r,i=(i=t.$)&&i._||{},c=0;for(a=s.jam,delete s.jam;r=a[c++];){var f=r[0];r=r[1],f&&f(i.link||i.soul||n.valid(t.put)||((t.put||{})._||{})["#"],r,t,e)}}}),{out:{get:{".":!0}}})}(this,t,0,s),this;var f,l=(u=this)._,p=e||{},h=l.root;p.at=l,p.ok=t;var d={};function i(t,e,r){if(!i.stun&&(!(a=h.pass)||a[f])){var a,s=t.$._,u=(t.$$||"")._,c=(u||s).put,g=!s.has&&!s.soul,y={};if((g||o===c)&&(c=o===((a=t.put)||"")["="]?o===(a||"")[":"]?a:a[":"]:a["="]),"string"==typeof(a=n.valid(c))&&(c=o===(a=h.$.get(a)._.put)?p.not?o:c:a),!p.not||o!==c){if(o===p.stun){if((a=h.stun)&&a.on&&(l.$.back((function(t){if(a.on(""+t.id,y={}),(y.run||0)<i.id)return y})),!y.run&&a.on(""+s.id,y={}),!y.run&&u&&a.on(""+u.id,y={}),i.id>y.run&&(y.stun&&!y.stun.end||(y.stun=a.on("stun"),y.stun=y.stun&&y.stun.last),y.stun&&!y.stun.end)))return void((y.stun.add||(y.stun.add={}))[f]=function(){i(t,e,1)});if(o===c&&(r=0),(a=h.hatch)&&!a.end&&o===p.hatch&&!r){if(d[s.$._.id])return;return d[s.$._.id]=1,void a.push((function(){i(t,e,1)}))}d={}}if(h.pass){if(h.pass[f+s.id])return;h.pass[f+s.id]=1}p.on?p.ok.call(s.$,c,s.get,t,e||i):p.v2020?p.ok(t,e||i):(Object.keys(t).forEach((function(e){a[e]=t[e]}),a={}),(t=a).put=c,p.ok.call(p.as,t,e||i))}}}return i.at=l,(l.any||(l.any={}))[f=String.random(7)]=i,i.off=function(){i.stun=1,l.any&&delete l.any[f]},i.rid=r,i.id=p.run||++h.once,c=h.pass,(h.pass={})[f]=1,p.out=p.out||{get:{}},l.on("out",p.out),h.pass=c,u}if("number"==typeof t)return this.get(""+t,e,s);
1if("string"==typeof(c=a(t)))return this.get(c,e,s);(c=this.get.next)&&(u=c(this,t))}return u?(e&&"function"==typeof e&&u.get(e,s),u):((u=this.chain())._.err={err:n.log("Invalid get request!",t)},e&&e.call(u,u._.err),u)};var o,i={},a=n.valid}))(e,"./get"),e((function(t){var n=e("./root");function r(t,e){if(e){e=(e._||"").id||e;var r,o=t.root.stun||(t.root.stun={on:n.on}),i={};t.stun||(t.stun=o.on("stun",(function(){}))),(r=o.on(""+e))&&r.the.last.next(i),i.run>=t.run||o.on(""+e,(function(e){if(t.stun.end)return this.off(),void this.to.next(e);e.run=e.run||t.run,e.stun=e.stun||t.stun}))}}function o(t){if(t.err)o.end(t.stun,t.root);else if(!t.todo.length&&!t.end&&Object.empty(t.wait)){t.end=1;var e,r=t.$.back(-1)._,i=r.root,a=r.ask((function(e){i.on("ack",e),e.err&&n.log(e),++s>(t.acks||0)&&this.off(),t.ack&&t.ack(e,this)}),t.opt),s=0,u=t.stun;(e=function(){u&&(o.end(u,i),setTimeout.each(Object.keys(u=u.add||""),(function(t){(t=u[t])&&t()})))}).hatch=e,t.via._.on("out",{put:t.out=t.graph,opt:t.opt,"#":a,_:e})}}n.chain.put=function(t,e,f){var l=this,p=l._,h=p.root;(f=f||{}).root=p.root,f.run||(f.run=h.once),r(f,p.id),f.ack=f.ack||e,f.via=f.via||l,f.data=f.data||t,f.soul||(f.soul=p.soul||"string"==typeof e&&e);var d=f.state=f.state||n.state();return"function"==typeof t?(t((function(t){f.data=t,l.put(i,i,f)})),l):f.soul?(f.$=h.$.get(f.soul),f.todo=[{it:f.data,ref:f.$}],f.turn=f.turn||s,f.ran=f.ran||o,function t(){var e,o,i,s,l,p=f.todo,h=p.pop(),g=h.it;if(h.ref&&h.ref._.id,r(f,h.ref),(s=h.todo)&&(g=g[o=s.pop()],s.length&&p.push(h)),o&&(p.path||(p.path=[])).push(o),!(e=u(g))&&!(l=n.is(g))){if(!Object.plain(g))return(f.ack||a).call(f,f.out={err:f.err=n.log("Invalid data: "+(g&&(s=g.constructor)&&s.name||typeof g)+" at "+(f.via.back((function(t){t.get&&s.push(t.get)}),s=[])||s.join("."))+"."+(p.path||[]).join("."))}),void f.ran(f);for(var y=f.seen||(f.seen=[]),v=y.length;v--;)if(g===(s=y[v]).it){e=g=s.link;break}}if(o&&e)h.node=c(h.node,o,d,g);else{f.seen.push(i={it:g,link:{},todo:l?[]:Object.keys(g).sort().reverse(),path:(p.path||[]).slice(),up:h}),h.node=c(h.node,o,d,i.link),!l&&i.todo.length&&p.push(i);var m=f.seen.length;function t(e,n){var o=i.link["#"];n&&(n.off(),n.rid(e));var a=o||e.soul||(s=(e.$$||e.$)._||"").soul||s.link||((s=s.put||"")._||"")["#"]||s["#"]||((s=e.put||"")&&e.$$?s["#"]:(s["="]||s[":"]||"")["#"]);!o&&r(f,e.$),a||h.link["#"]?(a||(a=[],(e.$$||e.$).back((function(t){if(s=t.soul||t.link)return a.push(s);a.push(t.get)})),a=a.reverse().join("/")),i.link["#"]=a,!l&&(((f.graph||(f.graph={}))[a]=i.node||(i.node={_:{}}))._["#"]=a),delete f.wait[m],i.wait&&setTimeout.each(i.wait,(function(t){t&&t()})),f.ran(f)):(h.wait||(h.wait=[])).push((function(){t(e,n)}))}(f.wait||(f.wait={}))[m]="",s=(i.ref=l?g:o?h.ref.get(o):h.ref)._,(s=g&&(g._||"")["#"]||s.soul||s.link)?t({soul:s}):i.ref.get(t,{run:f.run,v2020:1,out:{get:{".":" "}}})}if(!p.length)return f.ran(f);f.turn(t)}(),l):(function(t){var e,n=t.via._;t.via=t.via.back((function(n){if(n.soul||!n.get)return n.$;e=t.data,(t.data={})[n.get]=e})),t.via&&t.via._.soul||(t.via=n.root.$.get(((t.data||"")._||"")["#"]||n.$.back("opt.uuid")()));t.via.put(t.data,t.ack,t)}(f),l)},o.end=function(t,e){t.end=a,t.the.to===t&&t===t.the.last&&delete e.stun,t.off()};var i,a=function(){},s=setTimeout.turn,u=n.valid,c=n.state.ify}))(e,"./put"),e((function(t){var n=e("./root");e("./chain"),e("./back"),e("./put"),e("./get"),t.exports=n}))(e,"./index"),e((function(t){var n,r=e("./index");r.chain.on=function(t,e,n,r){var o,i=this,a=i._;if(a.root,"string"==typeof t)return e?(o=a.on(t,e,n||a,r),n&&n.$&&(n.subs||(n.subs=[])).push(o),i):a.on(t);var s=e;return(s=!0===s?{change:!0}:s||{}).not=1,s.on=1,i.get(t,s),i},r.chain.once=function(t,e){if(e=e||{},!t)return function(t,e,n){return r.log.once("valonce","Chainable val is experimental, its behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it."),(n=t.chain())._.nix=t.once((function(t,e){n._.on("in",this._)})),n._.lex=t._.lex,n}(this);var o=this,i=o._,a=i.root;i.put;var s,u=String.random(7);return o.get((function(o,c,f,l){var p=this,h=p._,d=h.one||(h.one={});function g(){h.has||h.soul||(h={put:o,get:c}),n===(s=h.put)&&(s=((f.$$||"")._||"").put),"string"==typeof r.valid(s)&&(s=a.$.get(s)._.put)===n||l.stun||""!==d[u]&&(d[u]="",(i.soul||i.has)&&l.off(),t.call(p,s,h.get))}l.stun||""!==d[u]&&(!0!==(s=r.valid(o))?"string"!=typeof s&&(clearTimeout(d[u]),d[u]=setTimeout(g,e.wait||99)):g())}),{on:1}),o},r.chain.off=function(){var t,e=this._,n=e.back;if(n)return e.ack=0,(t=n.next)&&t[e.get]&&delete t[e.get],(t=n.ask)&&delete t[e.get],(t=n.put)&&delete t[e.get],(t=e.soul)&&delete n.root.graph[t],(t=e.map
1)&&Object.keys(t).forEach((function(e,r){(r=t[e]).link&&n.root.$.get(r.link).off()})),(t=e.next)&&Object.keys(t).forEach((function(e,n){t[e].$.off()})),e.on("off",{}),this}}))(e,"./on"),e((function(t){var n=e("./index"),r=n.chain.get.next;function o(t){this.to.next(t);var e,r=this.as,o=t.$._,i=t.put;(o.soul||t.$$)&&((e=r.lex)&&!String.match(t.get||(i||"")["."],e["."]||e["#"]||e)||n.on.link(t,r))}n.chain.get.next=function(t,e){var n;return Object.plain(e)?(n=((n=e["#"])||"")["="]||n)?t.get(n):((n=t.chain()._).lex=e,t.on("in",(function(t){String.match(t.get||(t.put||"")["."],e["."]||e["#"]||e)&&n.on("in",t),this.to.next(t)})),n.$):(r||a)(t,e)},n.chain.map=function(t,e,r){var s,u,c=this,f=c._;return Object.plain(t)&&(s=t["."]?t:{".":t},t=i),t?(n.log.once("mapfn","Map functions are experimental, their behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it."),u=c.chain(),c.map().on((function(e,r,o,s){var c=(t||a).call(this,e,r,o,s);if(i!==c){if(e===c)return u._.on("in",o);if(n.is(c))return u._.on("in",c._);var f={};Object.keys(o.put).forEach((function(t){f[t]=o.put[t]}),f),f["="]=c,u._.on("in",{get:r,put:f})}})),u):((u=f.each)||((f.each=u=c.chain())._.lex=s||u._.lex||f.lex,u._.nix=c.back("nix"),c.on("in",o,u._)),u)};var i,a=function(){}}))(e,"./map"),e((function(t){var n=e("./index");n.chain.set=function(t,e,r){var o,i,a=this,s=a.back(-1);return e=e||function(){},(r=r||{}).item=r.item||t,(o=((t||"")._||"")["#"])&&((t={})["#"]=o),"string"==typeof(i=n.valid(t))?a.get(o=i).put(t,e,r):n.is(t)?(a.put((function(r){t.get((function(t,o,s){if(!t)return e.call(a,{err:n.log('Only a node can be linked! Not "'+s.put+'"!')});(i={})[t]={"#":t},r(i)}),!0)})),t):(Object.plain(t)&&(t=s.get(o=a.back("opt.uuid")()).put(t)),a.get(o||s.back("opt.uuid")(7)).put(t,e,r))}}))(e,"./set"),e((function(t){var n;e("./shim");try{t.exports=function(t){var e=function(){},r=t.opt||{};r.log=r.log||console.log,r.gap=r.gap||r.wait||0,r.max=r.max||.3*(r.memory?999*r.memory*999:3e8),r.pack=r.pack||.01*r.max*.01,r.puff=r.puff||9;var o=setTimeout.turn||setTimeout,i=JSON.parseAsync||function(t,e,n){try{e(void 0,JSON.parse(t,n))}catch(t){e(t)}},a=JSON.stringifyAsync||function(t,e,n,r){try{e(void 0,JSON.stringify(t,n,r))}catch(t){e(t)}},s=t.dup,u=s.check,c=s.track,f=e.hear=function(t,n){if(t){if(r.max<=t.length)return e.say({dam:"!",err:"Message too big!"},n);e===this&&(f.d+=t.length||0,++f.c);var a,s=n.SH=+new Date,u=t[0];return"["===u?(i(t,(function(t,i){if(t||!i)return e.say({dam:"!",err:"DAM JSON parse error."},n);console.STAT&&console.STAT(+new Date,i.length,"# on hear batch");var a=r.puff;!function t(){for(var e,r=+new Date,s=0;s<a&&(e=i[s++]);)f(e,n);i=i.slice(s),console.STAT&&console.STAT(r,+new Date-r,"hear loop"),l(n),i.length&&o(t,0)}()})),void(t="")):"{"===u||(t["#"]||Object.plain(t))&&(a=t)?a?f.one(a,n,s):void i(t,(function(t,r){if(t||!r)return e.say({dam:"!",err:"DAM JSON parse error."},n);f.one(r,n,s)})):void 0}};function l(t){var e=t.batch,n="string"==typeof e;if(n&&(e+="]"),t.batch=t.tail=null,e&&!(n?3>e.length:!e.length)){if(!n)try{e=1===e.length?e[0]:JSON.stringify(e)}catch(t){return r.log("DAM JSON stringify error",t)}e&&p(e,t)}}function p(t,n){try{var r=n.wire;n.say?n.say(t):r.send&&r.send(t),e.say.d+=t.length||0,++e.say.c}catch(e){(n.queue=n.queue||[]).push(t)}}f.one=function(n,r,o){var i,a,f,l,p;if(n.DBG&&(n.DBG=p={DBG:n.DBG}),p&&(p.h=o),p&&(p.hp=+new Date),(i=n["#"])||(i=n["#"]=String.random(9)),!((f=u(i))||(a=n["##"])&&(f=n["@"]||n.get&&i)&&s.check(l=f+a))){if((n._=function(){}).via=e.leap=r,(f=n["><"])&&"string"==typeof f&&f.slice(0,99).split(",").forEach((function(t){this[t]=1}),n._.yo={}),f=n.dam)return(f=e.hear[f])&&f(n,r,t),void c(i);o=+new Date,p&&(p.is=o),r.SI=i,t.on("in",e.last=n),p&&(p.hd=+new Date),console.STAT&&console.STAT(o,+new Date-o,n.get?"msg get":n.put?"msg put":"msg"),(f=c(i)).via=r,n.get&&(f.it=n),l&&c(l),e.leap=e.last=null}},f.c=f.d=0,function(){var t,i=0;function f(t,e){var n;return e instanceof Object?(Object.keys(e).sort().forEach(h,{to:n={},on:e}),n):e}function h(t){this.to[t]=this.on[t]}e.hash=function(t,e){var n,r,i,s=+new Date;a(t.put,(function a(u,c){var f=(r||(r=i=c||"")).slice(0,32768);n=String.hash(f,n),(r=r.slice(32768))?o(a,0):(console.STAT&&console.STAT(s,+new Date-s,"s
1ay json+hash"),t._.$put=i,t["##"]=n,d(t,e),delete t._.$put)}),f)};var d=e.say=function(a,u){var f;if((f=this)&&(f=f.to)&&f.next&&f.next(a),!a)return!1;var h,g,y=a["@"],v=a._||(a._=function(){}),m=a.DBG,b=+new Date;if(v.y=v.y||b,u||m&&(m.y=b),(h=a["#"])||(h=a["#"]=String.random(9)),!t&&c(h),a.put&&(a.err||(s.s[h]||"").err))return!1;if(a["##"]||n===a.put||v.via||!y){if(!u&&y&&(u=(f=s.s[y])&&(f.via||(f=f.it)&&(f=f._)&&f.via)||(f=e.last)&&y===f["#"]&&e.leap),!u&&y){if(s.s[y])return;return console.STAT&&console.STAT(+new Date,++i,"total no peer to ack to"),!1}if(!u&&e.way)return e.way(a);if(m&&(m.yh=+new Date),g=v.raw){if(m&&(m.yr=+new Date),!u||!u.id){if(!Object.plain(u||r.peers))return!1;b=+new Date,r.puff;var w=r.peers,k=Object.keys(u||r.peers||{});return console.STAT&&console.STAT(b,+new Date-b,"peer keys"),void function e(){var n=+new Date;t=1;var r=v.raw;v.raw=g;for(var i,s=0;s<9&&(i=(k||"")[s++]);)(i=w[i])&&d(a,i);v.raw=r,t=0,k=k.slice(s),console.STAT&&console.STAT(n,+new Date-n,"say loop"),k.length&&(o(e,0),y&&c(y))}()}if(!u.wire&&e.wire&&e.wire(u),h!==u.last){if(u.last=h,u===v.via)return!1;if((f=v.yo)&&(f[u.url]||f[u.pid]||f[u.id]))return!1;if(console.STAT&&console.STAT(b,((m||v).yp=+new Date)-(v.y||b),"say prep"),!t&&y&&c(y),u.batch){if(u.tail=(f=u.tail||0)+g.length,u.tail<=r.pack)return void(u.batch+=(f?",":"")+g);l(u)}u.batch="[";var x=+new Date;setTimeout((function(){console.STAT&&console.STAT(x,+new Date-x,"0ms TO"),l(u)}),r.gap),p(g,u),console.STAT&&y===u.SI&&console.STAT(b,+new Date-u.SH,"say ack")}}else e.raw(a,u)}else e.hash(a,u)};e.say.c=e.say.d=0,e.raw=function(t,o){if(!t)return"";var i,c,f=t._||{};if(c=f.raw)return c;if("string"==typeof t)return t;var l=t["##"],p=t["@"];if(l&&p){if(!f.via&&u(p+l))return!1;if((c=(s.s[p]||"").it)||(c=e.last)&&p===c["#"]){if(l===c["##"])return!1;c["##"]||(c["##"]=l)}}if(!t.dam){var h=0,g=[];for(var y in c=r.peers){var v=c[y];if(g.push(v.url||v.pid||v.id),++h>6)break}h>1&&(t["><"]=g.join())}if(i=f.$put)return c={},Object.keys(t).forEach((function(e){c[e]=t[e]})),c.put=":])([:",void a(c,(function(t,e){if(!t){var r=+new Date;c=e.indexOf('"put":":])([:"'),m(n,e=e.slice(0,c+6)+i+e.slice(c+14)),console.STAT&&console.STAT(r,+new Date-r,"say slice")}}));function m(e,n){e||(f.raw=n,d(t,o))}a(t,m)}}(),e.hi=function(n){var o=n.wire||{};n.id?r.peers[n.url||n.id]=n:(o=n.id=n.id||String.random(9),e.say({dam:"?",pid:t.opt.pid},r.peers[o]=n),delete s.s[n.last]),n.met=n.met||+new Date,o.hied||t.on(o.hied="hi",n),o=n.queue,n.queue=[],setTimeout.each(o||[],(function(t){p(t,n)}),0,9)},e.bye=function(n){t.on("bye",n);var r=+new Date;r-=n.met||r,e.bye.time=((e.bye.time||r)+r)/2},e.hear["!"]=function(t,e){r.log("Error:",t.err)},e.hear["?"]=function(t,n){t.pid&&(n.pid||(n.pid=t.pid),t["@"])||(e.say({dam:"?",pid:r.pid,"@":t["#"]},n),delete s.s[n.last])},t.on("create",(function(t){t.opt.pid=t.opt.pid||String.random(9),this.to.next(t),t.on("out",e.say)})),t.on("bye",(function(t,e){t=r.peers[t.id||t]||t,this.to.next(t),t.bye?t.bye():(e=t.wire)&&e.close&&e.close(),delete r.peers[t.id],t.wire=null}));var h={};return t.on("bye",(function(t,e){this.to.next(t),(e=console.STAT)&&(e.peers=(e.peers||0)-1),(e=t.url)&&(h[e]=!0,setTimeout((function(){delete h[e]}),r.lack||9e3))})),t.on("hi",(function(n,o){this.to.next(n),(o=console.STAT)&&(o.peers=(o.peers||0)+1),(o=n.url)&&h[o]&&(delete h[o],r.super||setTimeout.each(Object.keys(t.next),(function(r){t.next[r],(o={})[r]=t.graph[r],o=String.hash(o),e.say({"##":o,get:{"#":r}},n)})))})),e}}catch(t){}}))(e,"./mesh"),e((function(t){var n=e("../index");n.Mesh=e("./mesh"),n.on("opt",(function(t){if(this.to.next(t),!t.once){var e=t.opt;if(!1!==e.WebSocket){var r=n.window||{},o=e.WebSocket||r.WebSocket||r.webkitWebSocket||r.mozWebSocket;if(o){e.WebSocket=o;var i=e.mesh=e.mesh||n.Mesh(t);i.wire||e.wire,i.wire=e.wire=u,setTimeout((function(){!e.super&&t.on("out",{dam:"hi"})}),1);var a=1998,s=""+undefined!=typeof document&&document}}}function u(t){try{if(!t||!t.url)return r&&r(t);var n=t.url.replace(/^http/,"ws"),r=t.wire=new e.WebSocket(n);return r.onclose=function(){e.mesh.bye(t),c(t)},r.onerror=function(e){c(t)},r.onopen=function(){e.mesh.hi(t)},r.onmessage=function(n){n&&e.mesh.hear(n.data||n,t)},r}catch(t){}}function c(t){clearTimeout(t.defer),s&&t.retry<=0||(t.retry=(t.retry||e.retry+1||60)-(-t.tried+(t.tried=+new Date)<7992?1:0),t.defer=setTimeout((function e(){if(s&&s.hidden)return setTimeout(e,a);u(t)}),a))}}))}))(e,"./websocket"),e((function(t){if("undefined"!=typeof Gun){var e;try{e=(Gun.window||function(){}).localStorage}catch(t){}e||(Gun.log("Warning: No localStorage exists to persist data to!"),e={setItem:function(t,e){this[t]=e},removeItem:function(t){delete this[t]},getItem:function(t){return this[t]}}),Gun.on("create",(function t(n){this.to.next(n);var r=n.opt;n.graph;var o,i,a=[];if(!1!==r.localStorage){r.prefix=r.file||"gun/";try{o=t[r.prefix]=t[r.prefix]||JSON.parse(e.getItem(r.prefix))||{}}catch(e){o=t[r.prefix]={}}n.on("get",(function(t){this.to.next(t);var e,n,r,i=t.get;
1i&&(e=i["#"])&&((n=o[e]||undefined)&&(r=i["."])&&!Object.plain(r)&&(n=Gun.state.ify({},r,Gun.state.is(n,r),n[r],e)),Gun.on.get.ack(t,n))})),n.on("put",(function(t){this.to.next(t);var e=t.put,n=e["#"],u=e["."];o[n]=Gun.state.ify(o[n],u,e[">"],e[":"],n),t["@"]||a.push(t["#"]),i||(i=setTimeout(s,r.wait||1))}))}function s(){var t,s=a;clearTimeout(i),i=!1,a=[];try{e.setItem(r.prefix,JSON.stringify(o))}catch(e){Gun.log((t=e||"localStorage failure")+" Consider using GUN's IndexedDB plugin for RAD for more storage space, https://gun.eco/docs/RAD#install"),n.on("localStorage:error",{err:t,get:r.prefix,put:o})}(t||Object.empty(r.peers))&&setTimeout.each(s,(function(e){n.on("in",{"@":e,err:t,ok:0})}))}}))}}))(e,"./localStorage")}(),function(){if(""+x!=typeof Gun){var t=function(t){console.log("Warning! Deprecated internal utility will break in next version:",t)},e=Gun;e.fn=e.fn||{is:function(e){return t("fn"),!!e&&"function"==typeof e}},e.bi=e.bi||{is:function(e){return t("bi"),e instanceof Boolean||"boolean"==typeof e}},e.num=e.num||{is:function(e){return t("num"),!r(e)&&(e-parseFloat(e)+1>=0||1/0===e||-1/0===e)}},e.text=e.text||{is:function(e){return t("text"),"string"==typeof e}},e.text.ify=e.text.ify||function(n){return t("text.ify"),e.text.is(n)?n:"undefined"!=typeof JSON?JSON.stringify(n):n&&n.toString?n.toString():n},e.text.random=e.text.random||function(e,n){t("text.random");var r="";for(e=e||24,n=n||"0123456789ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxyz";e>0;)r+=n.charAt(Math.floor(Math.random()*n.length)),e--;return r},e.text.match=e.text.match||function(e,n){var r,o;return t("text.match"),"string"==typeof e&&("string"==typeof n&&(n={"=":n}),e===(r=(n=n||{})["="]||n["*"]||n[">"]||n["<"])||o===n["="]&&(r=n["*"]||n[">"]||n["<"],e.slice(0,(r||"").length)===r||o===n["*"]&&(o!==n[">"]&&o!==n["<"]?e>=n[">"]&&e<=n["<"]:o!==n[">"]&&e>=n[">"]||o!==n["<"]&&e<=n["<"])))},e.text.hash=e.text.hash||function(e,n){if(t("text.hash"),"string"==typeof e){if(n=n||0,!e.length)return n;for(var r=0,o=e.length;r<o;++r)n=(n<<5)-n+e.charCodeAt(r),n|=0;return n}},e.list=e.list||{is:function(e){return t("list"),e instanceof Array}},e.list.slit=e.list.slit||Array.prototype.slice,e.list.sort=e.list.sort||function(e){return t("list.sort"),function(t,n){return t&&n?(t=t[e])<(n=n[e])?-1:t>n?1:0:0}},e.list.map=e.list.map||function(e,n,r){return t("list.map"),a(e,n,r)},e.list.index=1,e.obj=e.boj||{is:function(e){return t("obj"),!!e&&(e instanceof Object&&e.constructor===Object||"Object"===Object.prototype.toString.call(e).match(/^\[object (\w+)\]$/)[1])}},e.obj.put=e.obj.put||function(e,n,r){return t("obj.put"),(e||{})[n]=r,e},e.obj.has=e.obj.has||function(e,n){return t("obj.has"),e&&Object.prototype.hasOwnProperty.call(e,n)},e.obj.del=e.obj.del||function(e,n){if(t("obj.del"),e)return e[n]=null,delete e[n],e},e.obj.as=e.obj.as||function(e,n,r,o){return t("obj.as"),e[n]=e[n]||(o===r?{}:r)},e.obj.ify=e.obj.ify||function(e){if(t("obj.ify"),o(e))return e;try{e=JSON.parse(e)}catch(t){e={}}return e},function(){function n(t,e){i(this,e)&&undefined!==this[e]||(this[e]=t)}e.obj.to=e.obj.to||function(e,r){return t("obj.to"),a(e,n,r=r||{}),r}}(),e.obj.copy=e.obj.copy||function(e){return t("obj.copy"),e?JSON.parse(JSON.stringify(e)):e},function(){function n(t,e){var n=this.n;if(!n||!(e===n||o(n)&&i(n,e)))return undefined!==e||void 0}e.obj.empty=e.obj.empty||function(e,r){return t("obj.empty"),!e||!a(e,n,{n:r})}}(),function(){function n(t,e){if(2===arguments.length)return n.r=n.r||{},void(n.r[t]=e);n.r=n.r||[],n.r.push(t)}var a,s=Object.keys;Object.keys=Object.keys||function(t){return a(t,(function(t,e,n){n(e)}))},e.obj.map=a=e.obj.map||function(a,u,c){t("obj.map");var f,l,p,h,d,g=0,y="function"==typeof u;if(n.r=f,s&&o(a)&&(h=s(a),d=!0),c=c||{},r(a)||h)for(l=(h||a).length;g<l;g++){var v=g+e.list.index;if(y){if((p=d?u.call(c,a[h[g]],h[g],n):u.call(c,a[g],v,n))!==f)return p}else if(u===a[d?h[g]:g])return h?h[g]:v}else for(g in a)if(y){if(i(a,g)&&(p=c?u.call(c,a[g],g,n):u(a[g],g,n))!==f)return p}else if(u===a[g])return g;return y?n.r:e.list.index?0:-1}}(),e.time=e.time||{},e.time.is=e.time.is||function(e){return t("time"),e?e instanceof Date:+(new Date).getTime()};var n=e.fn.is,r=e.list.is,o=(k=e.obj).is,i=k.has,a=k.map,s={is:function(e){return t("val.is"),e!==x&&(null===e||e!==1/0&&(!!(l(e)||c(e)||f(e))||(s.link.is(e)||!1)))}};s.link=s.rel={_:"#"},function(){function e(t,e){var n=this;return n.id?n.id=!1:e==u&&l(t)?void(n.id=t):n.id=!1}s.link.is=function(n){if(t("val.link.is"),n&&n[u]&&!n._&&o(n)){var r={};if(a(n,e,r),r.id)return r.id}return!1}}(),s.link.ify=function(e){return t("val.link.ify"),p({},u,e)},e.obj.has._=".";var u=s.link._,c=e.bi.is,f=e.num.is,l=e.text.is,p=(o=(k=e.obj).is,k.put);a=k.map;e.val=e.val||s;var h={_:"_",soul:function(e,n){return t("node.soul"),e&&e._&&e._[n||y]}};h.soul.ify=function(e,n){return t("node.soul.ify"),n="string"==typeof n?{soul:n}:n||{},(e=e||{})._=e._||{},e._[y]=n.soul||e._[y]||g(),e},h.soul._=s.link._,function(){function e(t,e){if(e!==h._)return!s.is(t)||void(this.cb&&this.cb.call(this.as,t,e,this.n,this.s))}h.is=function(n,r,i){var s;return t("node.is"),!!o(n)&&(!!(s=h.soul(n))&&!a(n,e,{as:i,cb:r,s:s,n:n}))}}(),function(){function e(t,e){var n,r=this.o;
1r.map?undefined===(n=r.map.call(this.as,t,""+e,r.node))?d(r.node,e):r.node&&(r.node[e]=n):s.is(t)&&(r.node[e]=t)}h.ify=function(n,r,o){return t("node.ify"),r?"string"==typeof r?r={soul:r}:"function"==typeof r&&(r={map:r}):r={},r.map&&(r.node=r.map.call(o,n,x,r.node||{})),(r.node=h.soul.ify(r.node||{},r))&&a(n,e,{o:r,as:o}),r.node}}();o=(k=e.obj).is;var d=k.del,g=(a=k.map,e.text.random),y=h.soul._;e.node=e.node||h;var v=e.state;v.lex=function(){return t("state.lex"),v().toString(36).replace(".","")},v.to=function(e,n,r){t("state.to");var i=(e||{})[n];return o(i)&&(i=m(i)),v.ify(r,n,v.is(e,n),i,h.soul(e))},function(){function e(t,e){b!==e&&v.ify(this.o,e,this.s)}v.map=function(r,s,u){var c;t("state.map");var l=o(l=r||s)?l:null;return r=n(r=r||s)?r:null,l&&!r?(s=f(s)?s:v(),l[b]=l[b]||{},a(l,e,{o:l,s:s}),l):(u=u||o(s)?s:c,s=f(s)?s:v(),function(t,n,o,a){if(!r)return e.call({o:o,s:s},t,n),t;r.call(u||this||{},t,n,o,a),i(o,n)&&c===o[n]||e.call({o:o,s:s},t,n)})}}(),(k=e.obj).as;i=k.has,o=k.is,a=k.map;var m=k.copy,b=(f=e.num.is,n=e.fn.is,h._),w={};!function(){function e(t,e){if(!t||e!==h.soul(t)||!h.is(t,this.fn,this.as))return!0;this.cb&&(n.n=t,n.as=this.as,this.cb.call(n.as,t,e,n))}function n(t){t&&h.is(n.n,t,n.as)}w.is=function(n,r,i,s){return t("graph.is"),!(!n||!o(n)||_(n))&&!a(n,e,{cb:r,fn:i,as:s})}}(),function(){function n(t,e){var n;return(n=function(t,e){var n,r=t.seen,o=r.length;for(;o--;)if(n=r[o],e.obj===n.obj)return n;r.push(e)}(t,e))?n:(e.env=t,e.soul=a,h.ify(e.obj,r,e)&&(e.link=e.link||s.link.ify(h.soul(e.node)),e.obj!==t.shell&&(t.graph[s.link.is(e.link)]=e.node)),e)}function r(t,e,r){var o,a,c=this,f=c.env;if(h._===e&&i(t,s.link._))return r._;if(o=u(t,e,r,c,f)){if(e||(c.node=c.node||r||{},i(t,h._)&&h.soul(t)&&(c.node._=m(t._)),c.node=h.soul.ify(c.node,s.link.is(c.link)),c.link=c.link||s.link.ify(h.soul(c.node))),(a=f.map)&&(a.call(f.as||{},t,e,r,c),i(r,e))){if(t=r[e],x===t)return void d(r,e);if(!(o=u(t,e,r,c,f)))return}if(!e)return c.node;if(!0===o)return t;if((a=n(f,{obj:t,path:c.path.concat(e)})).node)return a.link}}function a(t){var e=this,n=s.link.is(e.link),r=e.env.graph;e.link=e.link||s.link.ify(t),e.link[s.link._]=t,e.node&&e.node[h._]&&(e.node[h._][s.link._]=t),i(r,n)&&(r[t]=r[n],d(r,n))}function u(t,n,r,i,a){var c;return!!s.is(t)||(o(t)?1:(c=a.invalid)?u(t=c.call(a.as||{},t,n,r),n,r,i,a):(a.err="Invalid value at '"+i.path.concat(n).join(".")+"'!",void(e.list.is(t)&&(a.err+=" Use `.set(item)` instead of an Array."))))}w.ify=function(e,r,o){t("graph.ify");var i={path:[],obj:e};return r?"string"==typeof r?r={soul:r}:"function"==typeof r&&(r.map=r):r={},"string"==typeof o&&(r.soul=r.soul||o,o=x),r.soul&&(i.link=s.link.ify(r.soul)),r.shell=(o||{}).shell,r.graph=r.graph||{},r.seen=r.seen||[],r.as=r.as||o,n(r,i),r.root=i.node,r.graph}}(),w.node=function(e){t("graph.node");var n=h.soul(e);if(n)return p({},n,e)},function(){function e(t,e){var n,r;if(h._!==e)(n=s.link.is(t))?(r=this.opt.seen[n])?this.obj[e]=r:this.obj[e]=this.opt.seen[n]=w.to(this.graph,n,this.opt):this.obj[e]=t;else{if(_(t,s.link._))return;this.obj[e]=m(t)}}w.to=function(n,r,o){if(t("graph.to"),n){var i={};return o=o||{seen:{}},a(n[r],e,{obj:i,graph:n,opt:o}),i}}}();n=e.fn.is,o=(k=e.obj).is,d=k.del,i=k.has;var k,x,_=k.empty;p=k.put,a=k.map,m=k.copy;e.graph=e.graph||w}}()}));X((function(t){!function(){function e(t,n){return n?Y(t):t.slice?e[r(t)]:function(n,o){t(n={exports:{}}),e[r(o)]=n.exports};function r(t){return t.split("/").slice(-1).toString().replace(".js","")}}var n=t;e((function(t){"undefined"!=typeof window&&(t.window=window);var e=(t.window||t).SEA||{};(e.window=t.window)&&(e.window.SEA=e);try{undefined+""!=typeof n&&(n.exports=e)}catch(t){}t.exports=e}))(e,"./root"),e((function(t){var n=e("./root");try{n.window&&location.protocol.indexOf("s")<0&&location.host.indexOf("localhost")<0&&!/^127\.\d+\.\d+\.\d+$/.test(location.hostname)&&location.protocol.indexOf("file:")<0&&(console.warn("HTTPS needed for WebCrypto in SEA, redirecting..."),location.protocol="https:")}catch(t){}}))(e,"./https"),e((function(t){var n;if(n+""==typeof btoa){if(n+""==typeof Buffer)try{V.Buffer=e("buffer",1).Buffer}catch(t){console.log("Please add `buffer` to your package.json!")}V.btoa=function(t){return Buffer.from(t,"binary").toString("base64")},V.atob=function(t){return Buffer.from(t,"base64").toString("binary")}}}))(e,"./base64"),e((function(t){function n(){}e("./base64"),Object.assign(n,{from:Array.from}),n.prototype=Object.create(Array.prototype),n.prototype.toString=function(t,e,n){t=t||"utf8",e=e||0;const r=this.length;if("hex"===t){const t=new Uint8Array(this);return[...Array((n&&n+1||r)-e).keys()].map((n=>t[n+e].toString(16).padStart(2,"0"))).join("")}return"utf8"===t?Array.from({length:(n||r)-e},((t,n)=>String.fromCharCode(this[n+e]))).join(""):"base64"===t?btoa(this):void 0},t.exports=n}))(e,"./array"),e((function(t){e("./base64");var n=e("./array");function r(...t){return console.warn("new SafeBuffer() is depreciated, please use SafeBuffer.from()"),r.from(...t)}r.prototype=Object.create(Array.prototype),Object.assign(r,{from(){if(!Object.keys(arguments).length||null==arguments[0])throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");const t=arguments[0];let e;if("string"==typeof t){const r=arguments[1]||"utf8";if("hex"===r){const r=t.match(/([\da-fA-F]{2})/g).map((t=>
1parseInt(t,16)));if(!r||!r.length)throw new TypeError("Invalid first argument for type 'hex'.");e=n.from(r)}else if("utf8"===r||"binary"===r){const r=t.length,o=new Uint16Array(r);Array.from({length:r},((e,n)=>o[n]=t.charCodeAt(n))),e=n.from(o)}else if("base64"===r){const r=atob(t),o=r.length,i=new Uint8Array(o);Array.from({length:o},((t,e)=>i[e]=r.charCodeAt(e))),e=n.from(i)}else"binary"===r?e=n.from(t):console.info("SafeBuffer.from unknown encoding: "+r);return e}t.byteLength;if(t.byteLength?t.byteLength:t.length){let e;return t instanceof ArrayBuffer&&(e=new Uint8Array(t)),n.from(e||t)}},alloc:(t,e=0)=>n.from(new Uint8Array(Array.from({length:t},(()=>e)))),allocUnsafe:t=>n.from(new Uint8Array(Array.from({length:t}))),concat(t){if(!Array.isArray(t))throw new TypeError("First argument must be Array containing ArrayBuffer or Uint8Array instances.");return n.from(t.reduce(((t,e)=>t.concat(Array.from(e))),[]))}}),r.prototype.from=r.from,r.prototype.toString=n.prototype.toString,t.exports=r}))(e,"./buffer"),e((function(t){const r=e("./root"),o={Buffer:e("./buffer")};var i={};if(JSON.parseAsync=JSON.parseAsync||function(t,e,n){try{e(undefined,JSON.parse(t,n))}catch(t){e(t)}},JSON.stringifyAsync=JSON.stringifyAsync||function(t,e,n,r){try{e(undefined,JSON.stringify(t,n,r))}catch(t){e(t)}},o.parse=function(t,e){return new Promise((function(n,r){JSON.parseAsync(t,(function(t,e){t?r(t):n(e)}),e)}))},o.stringify=function(t,e,n){return new Promise((function(r,o){JSON.stringifyAsync(t,(function(t,e){t?o(t):r(e)}),e,n)}))},r.window&&(o.crypto=window.crypto||window.msCrypto,o.subtle=(o.crypto||i).subtle||(o.crypto||i).webkitSubtle,o.TextEncoder=window.TextEncoder,o.TextDecoder=window.TextDecoder,o.random=t=>o.Buffer.from(o.crypto.getRandomValues(new Uint8Array(o.Buffer.alloc(t))))),!o.TextDecoder){const{TextEncoder:t,TextDecoder:r}=e((undefined+""==typeof n?".":"")+"./lib/text-encoding",1);o.TextDecoder=r,o.TextEncoder=t}if(!o.crypto)try{var a=e("crypto",1);Object.assign(o,{crypto:a,random:t=>o.Buffer.from(a.randomBytes(t))});const{Crypto:t}=e("@peculiar/webcrypto",1);o.ossl=o.subtle=new t({directory:"ossl"}).subtle}catch(t){console.log("Please add `@peculiar/webcrypto` to your package.json!")}t.exports=o}))(e,"./shim"),e((function(t){var n=e("./root"),r=e("./shim"),o={pbkdf2:{hash:{name:"SHA-256"},iter:1e5,ks:64},ecdsa:{pair:{name:"ECDSA",namedCurve:"P-256"},sign:{name:"ECDSA",hash:{name:"SHA-256"}}}
1,ecdh:{name:"ECDH",namedCurve:"P-256"},jwk:function(t,e){var n={kty:"EC",crv:"P-256",x:(t=t.split("."))[0],y:t[1],ext:!0};return n.key_ops=e?["sign"]:["verify"],e&&(n.d=e),n},keyToJwk:function(t){return{kty:"oct",k:t.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,""),ext:!1,alg:"A256GCM"}},recall:{validity:43200,hook:function(t){return t}},check:function(t){return"string"==typeof t&&"SEA{"===t.slice(0,4)},parse:async function(t){try{var e="string"==typeof t;return e&&"SEA{"===t.slice(0,4)&&(t=t.slice(3)),e?await r.parse(t):t}catch(t){}return t}};n.opt=o,t.exports=o}))(e,"./settings"),e((function(t){var n=e("./shim");t.exports=async function(t,e){var r="string"==typeof t?t:await n.stringify(t),o=await n.subtle.digest({name:e||"SHA-256"},(new n.TextEncoder).encode(r));return n.Buffer.from(o)}}))(e,"./sha256"),e((function(t){const n=e("./shim"),r=n.subtle,o=n.ossl?n.ossl:r;t.exports=t=>o.digest({name:"SHA-1"},new ArrayBuffer(t))}))(e,"./sha1"),e((function(t){var n=e("./root"),r=e("./shim"),o=e("./settings"),i=e("./sha256");n.work=n.work||(async(t,e,a,s)=>{try{var u=(e||{}).epub||e;if(s=s||{},u instanceof Function&&(a=u,u=undefined),t="string"==typeof t?t:await r.stringify(t),"sha"===(s.name||"").toLowerCase().slice(0,3)){var c=r.Buffer.from(await i(t,s.name),"binary").toString(s.encode||"base64");if(a)try{a(c)}catch(t){console.log(t)}return c}u=u||r.random(9);var f=await(r.ossl||r.subtle).importKey("raw",(new r.TextEncoder).encode(t),{name:s.name||"PBKDF2"},!1,["deriveBits"]),l=await(r.ossl||r.subtle).deriveBits({name:s.name||"PBKDF2",iterations:s.iterations||o.pbkdf2.iter,salt:(new r.TextEncoder).encode(s.salt||u),hash:s.hash||o.pbkdf2.hash},f,s.length||8*o.pbkdf2.ks);t=r.random(t.length);var p=r.Buffer.from(l,"binary").toString(s.encode||"base64");if(a)try{a(p)}catch(t){console.log(t)}return p}catch(t){if(console.log(t),n.err=t,n.throw)throw t;return void(a&&a())}}),t.exports=n.work}))(e,"./work"),e((function(t){var n=e("./root"),r=e("./shim");e("./settings"),n.name=n.name||(async(t,e)=>{try{if(t)try{t()}catch(t){console.log(t)}return}catch(e){if(console.log(e),n.err=e,n.throw)throw e;return void(t&&t())}}),n.pair=n.pair||(async(t,e)=>{try{var o=r.ossl||r.subtle,i=await r.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!0,["sign","verify"]).then((async t=>{var e={};e.priv=(await r.subtle.exportKey("jwk",t.privateKey)).d;var n=await r.subtle.exportKey("jwk",t.publicKey);return e.pub=n.x+"."+n.y,e}));try{var a=await o.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"]).then((async t=>{var e={};e.epriv=(await o.exportKey("jwk",t.privateKey)).d;var n=await o.exportKey("jwk",t.publicKey);return e.epub=n.x+"."+n.y,e}))}catch(t){if(n.window)throw t;if("Error: ECDH is not a supported algorithm"!=t)throw t;console.log("Ignoring ECDH...")}a=a||{};var s={pub:i.pub,priv:i.priv,epub:a.epub,epriv:a.epriv};if(t)try{t(s)}catch(t){console.log(t)}return s}catch(e){if(console.log(e),n.err=e,n.throw)throw e;return void(t&&t())}}),t.exports=n.pair}))(e,"./pair"),e((function(t){var n,r=e("./root"),o=e("./shim"),i=e("./settings"),a=e("./sha256");r.sign=r.sign||(async(t,e,s,u)=>{try{if(u=u||{},!(e||u).priv){if(!r.I)throw"No signing key.";e=await r.I(null,{what:t,how:"sign",why:u.why})}if(n===t)throw"`undefined` not allowed.";var c=await i.parse(t),f=u.check=u.check||c;if(r.verify&&(r.opt.check(f)||f&&f.s&&f.m)&&n!==await r.verify(f,e)){var l=await i.parse(f);if(u.raw||(l="SEA"+await o.stringify(l)),s)try{s(l)}catch(t){console.log(t)}return l}var p=e.pub,h=e.priv,d=i.jwk(p,h),g=await a(c),y=await(o.ossl||o.subtle).importKey("jwk",d,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"]).then((t=>(o.ossl||o.subtle).sign({name:"ECDSA",hash:{name:"SHA-256"}},t,new Uint8Array(g))));l={m:c,s:o.Buffer.from(y,"binary").toString(u.encode||"base64")};if(u.raw||(l="SEA"+await o.stringify(l)),s)try{s(l)}catch(t){console.log(t)}return l}catch(t){if(console.log(t),r.err=t,r.throw)throw t;return void(s&&s())}}),t.exports=r.sign}))(e,"./sign"),e((function(t){var n,r=e("./root"),o=e("./shim"),i=e("./settings"),a=e("./sha256");r.verify=r.verify||(async(t,e,s,u)=>{try{var c=await i.parse(t);if(!1===e){var f=await i.parse(c.m);if(s)try{s(f)}catch(t){console.log(t)}return f}u=u||{};var l,p,h,d=e.pub||e,g=r.opt.slow_leak?await r.opt.slow_leak(d):await(o.ossl||o.subtle).importKey("jwk",i.jwk(d),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]),y=await a(c.m);try{if(l=o.Buffer.from(c.s,u.encode||"base64"),p=new Uint8Array(l),!(h=await(o.ossl||o.subtle).verify({name:"ECDSA",hash:{name:"SHA-256"}},g,p,new Uint8Array(y))))throw"Signature did not match."}catch(n){if(r.opt.fallback)return await r.opt.fall_verify(t,e,s,u)}var v=h?await i.parse(c.m):n;if(s)try{s(v)}catch(t){console.log(t)}return v}catch(t){if(console.log(t),r.err=t,r.throw)throw t;return void(s&&s())}}),t.exports=r.verify;var s={};r.opt.slow_leak=t=>{if(s[t])return s[t];var e=i.jwk(t);return s[t]=(o.ossl||o.subtle).importKey("jwk",e,{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]),s[t]};var u=r.opt;r.opt.fall_verify=async function(t,e,s,c,f){if(f===r.opt.fallback)throw"Signature did not match";f=f||1;var l=t||"";t=r.opt.unpack(t)||t;var p,h,d,g=await i.parse(t),y=e.pub||e,v=await r.opt.slow_leak(y),m=f<=r.opt.fallback?o.Buffer.from(await o.subtle.digest({name:"SHA-256"},(new o.TextEncoder).encode(await i.parse(g.m)))):await a(g.m);try{if(p=o.Buffer.from(g.s,c.encode||"base64"),h=new Uint8Array(p),!(d=await(o.ossl||o.subtle).verify({name:"ECDSA",hash:{name:"SHA-256"}},v,h,new Uint8Array(m))))throw"Signature did not match."}catch(t){try{p=o.Buffer.from(g.s,"utf8"),h=new Uint8Array(p),d=await(o.ossl||o.subtle).verify({name:"ECDSA",hash:{name:"SHA-256"}},v,h,new Uint8Array(m))}catch(t){if(!d)throw"Signature did not match."}}var b=d?await i.parse(g.m):n;if(u.fall_soul=l["#"],u.fall_key=l["."],u.fall_val=t,u.fall_state=l[">"],s)try{s(b)}catch(t){console.log(t)}return b},r.opt.fallback=2}))(e,"./verify"),e((function(t){var n=e("./shim"),r=e("./settings"),o=e("./sha256");t.exports=async(t,e,i)=>{const a=t+(e||n.random(8)).toString("utf8"),s=n.Buffer.from(await o(a),"binary"),u=r.keyToJwk(s);return await n.subtle.importKey("jwk",u,{name:"AES-GCM"},!1,["encrypt","decrypt"])}}))(e,"./aeskey"),e((function(t){var n=e("./root"),r=e("./shim");e("./settings");var o=e("./aeskey");n.encrypt=n.encrypt||(async(t,e,i,a)=>{try{a=a||{};var s=(e||a).epriv||e;if(undefined===t)throw"`undefined` not allowed.";
1if(!s){if(!n.I)throw"No encryption key.";s=(e=await n.I(null,{what:t,how:"encrypt",why:a.why})).epriv||e}var u="string"==typeof t?t:await r.stringify(t),c={s:r.random(9),iv:r.random(15)},f=await o(s,c.s,a).then((t=>r.subtle.encrypt({name:a.name||"AES-GCM",iv:new Uint8Array(c.iv)},t,(new r.TextEncoder).encode(u)))),l={ct:r.Buffer.from(f,"binary").toString(a.encode||"base64"),iv:c.iv.toString(a.encode||"base64"),s:c.s.toString(a.encode||"base64")};if(a.raw||(l="SEA"+await r.stringify(l)),i)try{i(l)}catch(t){console.log(t)}return l}catch(t){if(console.log(t),n.err=t,n.throw)throw t;return void(i&&i())}}),t.exports=n.encrypt}))(e,"./encrypt"),e((function(t){var n=e("./root"),r=e("./shim"),o=e("./settings"),i=e("./aeskey");n.decrypt=n.decrypt||(async(t,e,a,s)=>{try{s=s||{};var u=(e||s).epriv||e;if(!u){if(!n.I)throw"No decryption key.";u=(e=await n.I(null,{what:t,how:"decrypt",why:s.why})).epriv||e}var c,f,l,p=await o.parse(t);try{c=r.Buffer.from(p.s,s.encode||"base64"),f=r.Buffer.from(p.iv,s.encode||"base64"),l=r.Buffer.from(p.ct,s.encode||"base64");var h=await i(u,c,s).then((t=>r.subtle.decrypt({name:s.name||"AES-GCM",iv:new Uint8Array(f),tagLength:128},t,new Uint8Array(l))))}catch(r){if("utf8"===s.encode)throw"Could not decrypt";if(n.opt.fallback)return s.encode="utf8",await n.decrypt(t,e,a,s)}var d=await o.parse(new r.TextDecoder("utf8").decode(h));if(a)try{a(d)}catch(t){console.log(t)}return d}catch(t){if(console.log(t),n.err=t,n.throw)throw t;return void(a&&a())}}),t.exports=n.decrypt}))(e,"./decrypt"),e((function(t){var n=e("./root"),r=e("./shim");e("./settings"),n.secret=n.secret||(async(t,e,i,a)=>{try{if(a=a||{},!e||!e.epriv||!e.epub){if(!n.I)throw"No secret mix.";e=await n.I(null,{what:t,how:"secret",why:a.why})}var s=t.epub||t,u=e.epub,c=e.epriv,f=r.ossl||r.subtle,l=o(s),p=Object.assign({public:await f.importKey(...l,!0,[])},{name:"ECDH",namedCurve:"P-256"}),h=o(u,c),d=await f.importKey(...h,!1,["deriveBits"]).then((async t=>{var e=await f.deriveBits(p,t,256),n=new Uint8Array(e),r=await f.importKey("raw",n,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]);return f.exportKey("jwk",r).then((({k:t})=>t))}));if(i)try{i(d)}catch(t){console.log(t)}return d}catch(t){if(console.log(t),n.err=t,n.throw)throw t;return void(i&&i())}});var o=(t,e)=>{var[n,r]=t.split("."),o=e?{d:e}:{};return["jwk",Object.assign(o,{x:n,y:r,kty:"EC",crv:"P-256",ext:!0}),{name:"ECDH",namedCurve:"P-256"}]};t.exports=n.secret}))(e,"./secret"),e((function(t){var n=e("./root");n.certify=n.certify||(async(t,e={},r,o,i={})=>{try{if(console.log("SEA.certify() is an early experimental community supported method that may change API behavior without warning in any future version."),!(t=(()=>{var e=[];if(t){if(("string"==typeof t||Array.isArray(t))&&-1!==t.indexOf("*"))return"*";if("string"==typeof t)return t;if(Array.isArray(t)){if(1===t.length&&t[0])return"object"==typeof t[0]&&t[0].pub?t[0].pub:"string"==typeof t[0]?t[0]:null;t.map((t=>{"string"==typeof t?e.push(t):"object"==typeof t&&t.pub&&e.push(t.pub)}))}return"object"==typeof t&&t.pub?t.pub:e.length>0?e:null}return null})()))return console.log("No certificant found.");const s=!i.expiry||"number"!=typeof i.expiry&&"string"!=typeof i.expiry?null:parseFloat(i.expiry),u=(e||{}).read?e.read:null,c=(e||{}).write?e.write:"string"==typeof e||Array.isArray(e)||e["+"]||e["#"]||e["."]||e["="]||e["*"]||e[">"]||e["<"]?e:null,f=((i||{}).blacklist||{}).read&&("string"==typeof i.blacklist.read||i.blacklist.read["#"])?i.blacklist.read:null,l="string"==typeof(i||{}).blacklist||(((i||{}).blacklist||{}).write||{})["#"]?i.blacklist:((i||{}).blacklist||{}).write&&("string"==typeof i.blacklist.write||i.blacklist.write["#"])?i.blacklist.write:null;if(!u&&!c)return console.log("No policy found.");const p=JSON.stringify({c:t,...s?{e:s}:{},...u?{r:u}:{},...c?{w:c}:{},...f?{rb:f}:{},...l?{wb:l}:{}});var a=await n.sign(p,r,null,{raw:1});if(i.raw||(a="SEA"+JSON.stringify(a)),o)try{o(a)}catch(t){console.log(t)}return a}catch(t){if(n.err=t,n.throw)throw t;return void(o&&o())}}),t.exports=n.certify}))(e,"./certify"),e((function(t){var n=e("./shim"),r=e("./root");r.work=e("./work"),r.sign=e("./sign"),r.verify=e("./verify"),r.encrypt=e("./encrypt"),r.decrypt=e("./decrypt"),r.certify=e("./certify"),r.random=r.random||n.random,r.Buffer=r.Buffer||e("./buffer"),r.keyid=r.keyid||(async t=>{try{const e=n.Buffer.concat(t.replace(/-/g,"+").replace(/_/g,"/").split(".").map((t=>n.Buffer.from(t,"base64")))),r=n.Buffer.concat([n.Buffer.from([153,e.length/256,e.length%256]
1),e]),o=await sha1hash(r),i=n.Buffer.from(o,"binary");return i.toString("hex",i.length-8)}catch(t){throw console.log(t),t}}),((r.window||{}).GUN||{}).SEA=r,t.exports=r}))(e,"./sea"),e((function(t){var r,o=e("./sea");function i(t){this._={$:this}}function a(){return r.state().toString(36).replace(".","")}r=o.window?o.window.GUN||{chain:{}}:e((undefined+""==typeof n?".":"")+"./gun",1),o.GUN=r,i.prototype=function(){function t(){}return t.prototype=r.chain,new t}(),i.prototype.constructor=i,r.chain.user=function(t){var e,n=this.back(-1);if(t)return t=o.opt.pub((t._||"")["#"])||t,n.get("~"+t);if(e=n.back("user"))return e;var r=n=n._,s=r.opt.uuid||a;return(r=(e=r.user=this.chain(new i))._).opt={},r.opt.uuid=function(t){var e=s(),r=n.user;return r&&(r=r.is)&&(r=r.pub)?(e="~"+r+"/"+e,t&&t.call&&t(null,e),e):e},e},r.User=i,i.GUN=r,i.SEA=r.SEA=o,t.exports=i}))(e,"./user"),e((function(t){var r;(""+r!=typeof window?window.Gun||{chain:{}}:e((""+r==typeof n?".":"")+"./gun",1)).chain.then=function(t,e){var n=this,r=new Promise((function(t,r){n.once(t,e)}));return t?r.then(t):r}}))(e,"./then"),e((function(t){var n=e("./user"),r=n.SEA,o=n.GUN,i=function(){};n.prototype.create=function(...t){var e,n="object"==typeof t[0]&&(t[0].pub||t[0].epub)?t[0]:"object"==typeof t[1]&&(t[1].pub||t[1].epub)?t[1]:null,a=n&&(n.pub||n.epub)?n.pub:"string"==typeof t[0]?t[0]:null,s=n&&(n.pub||n.epub)?n:a&&"string"==typeof t[1]?t[1]:null,u=t.filter((t=>"function"==typeof t))[0]||null,c=t&&t.length>1&&"object"==typeof t[t.length-1]?t[t.length-1]:{},f=this,l=f._,p=f.back(-1);if((u=u||i,!1!==(c=c||{}).check)&&(a||(e="No user."),(s||"").length<8&&(e="Password too short!"),e))return u({err:o.log(e)}),f;if(l.ing)return(u||i)({err:o.log("User is already being created or authenticated!"),wait:!0}),f;l.ing=!0;var h={a:function(t){if(h.pubs=t,t&&!c.already){var e={err:o.log("User already created!")};return l.ing=!1,(u||i)(e),void f.leave()}h.salt=String.random(64),r.work(s,h.salt,h.b)},b:function(t){h.proof=t,n?h.c(n):r.pair(h.c)},c:function(t){var e;h.pair=t||{},(e=l.root.user)&&(e._.sea=t,e.is={pub:t.pub,epub:t.epub,alias:a}),h.data={pub:t.pub},h.d()},d:function(){h.data.alias=a,h.e()},e:function(){h.data.epub=h.pair.epub,r.encrypt({priv:h.pair.priv,epriv:h.pair.epriv},h.proof,h.f,{raw:1})},f:function(t){h.data.auth=JSON.stringify({ek:t,s:h.salt}),h.g(h.data.auth)},g:function(t){var e;h.data.auth=h.data.auth||t,p.get(e="~"+h.pair.pub).put(h.data).on(h.h);var n={};n[e]={"#":e},p.get("~@"+a).put(n).get(e).on(h.i)},h:function(t,e,n,r){r.off(),h.h.ok=1,h.i()},i:function(t,e,r,o){o&&(h.i.ok=1,o.off()),h.h.ok&&h.i.ok&&(l.ing=!1,u({ok:0,pub:h.pair.pub}),i===u&&(n?f.auth(n):f.auth(a,s)))}};return p.get("~@"+a).once(h.a),f},n.prototype.leave=function(t,e){var n=this.back(-1)._.user;if(n&&(delete n.is,delete n._.is,delete n._.sea),r.window)try{var o={};delete(o=window.sessionStorage).recall,delete o.pair}catch(t){}return this}}))(e,"./create"),e((function(t){var n=e("./user"),r=n.SEA,o=n.GUN,i=function(){};function a(t){if("string"!=typeof t)return t;try{t=JSON.parse(t)}catch(e){t={}}return t}n.prototype.auth=function(...t){var e="object"==typeof t[0]&&(t[0].pub||t[0].epub)?t[0]:"object"==typeof t[1]&&(t[1].pub||t[1].epub)?t[1]:null,n=e||"string"!=typeof t[0]?null:t[0],s=n&&"string"==typeof t[1]?t[1]:null,u=t.filter((t=>"function"==typeof t))[0]||null,c=t&&t.length>1&&"object"==typeof t[t.length-1]?t[t.length-1]:{},f=this,l=f._,p=f.back(-1);if(l.ing)return(u||i)({err:o.log("User is already being created or authenticated!"),wait:!0}),f;l.ing=!0;var h,d={};return d.a=function(t){if(!t)return d.b();if(!t.pub){var e=[];return Object.keys(t).forEach((function(n){"_"!=n&&e.push(t[n])})),d.b(e)}if(d.name)return d.f(t);d.c((d.data=t).auth)},d.b=function(t){var e=(d.list=(d.list||[]).concat(t||[])).shift();if(h===e)return d.name?d.err("Your user account is not published for dApps to access, please consider syncing it online, or allowing local access by adding your device as a peer."):d.err("Wrong user or password.");p.get(e).once(d.a)},d.c=function(t){return h===t?d.b():"string"==typeof t?d.c(a(t)):void r.work(s,(d.auth=t).s,d.d,d.enc)},d.d=function(t){r.decrypt(d.auth.ek,t,d.e,d.enc)},d.e=function(t){if(h===t)return d.enc?(d.enc=null,d.b()):(d.enc={encode:"utf8"},d.c(d.auth));d.half=t,d.f(d.data)},d.f=function(t){var e=d.half||{},n=d.data||{};d.g(d.lol={pub:t.pub||n.pub,epub:t.epub||n.epub,priv:t.priv||e.priv,epriv:t.epriv||e.epriv})},d.g=function(t){if(!t||!t.pub||!t.epub)return d.b();d.pair=t;var e=p._.user,g=e._;g.tag;var y=g.opt;(g=e._=p.get("~"+t.pub)._).opt=y,e.is={pub:t.pub,epub:t.epub,alias:n||t},g.sea=d.pair,l.ing=!1;try{s&&h==(a(l.root.graph["~"+t.pub].auth)||"")[":"]&&(c.shuffle=c.change=s)}catch(t){}if(c.change?d.z():(u||i)(g),r.window&&(f.back("user")._.opt||c).remember)try{var v={};(v=window.sessionStorage).recall=!0,v.pair=JSON.stringify(t)}catch(t){}try{p._.tag.auth?p._.on("auth",g):setTimeout((function(){p._.on("auth",g)}),1)}catch(t){o.log("Your 'auth' callback crashed with:",t)}},d.z=function(){d.salt=String.random(64),r.work(c.change,d.salt,d.y)},d.y=function(t){r.encrypt({priv:d.pair.priv,epriv:d.pair.epriv},t,d.x,{raw:1})},d.x=function(t){d.w(JSON.stringify({ek:t,s:d.salt}))},d.w=function(t){if(c.shuffle){console.log("migrate core account from UTF8 & shuffle");var e={};
1Object.keys(d.data).forEach((function(t){e[t]=d.data[t]})),delete e._,e.auth=t,p.get("~"+d.pair.pub).put(e)}p.get("~"+d.pair.pub).get("auth").put(t,u||i)},d.err=function(t){var e={err:o.log(t||"User cannot be found!")};l.ing=!1,(u||i)(e)},d.plugin=function(t){if(!(d.name=t))return d.err();var e=[t];"~"!==t[0]&&(e[1]="~"+t,e[2]="~@"+t),d.b(e)},e?d.g(e):n?p.get("~@"+n).once(d.a):n||s||r.name(d.plugin),f}}))(e,"./auth"),e((function(t){var n=e("./user"),r=n.SEA;n.GUN,n.prototype.recall=function(t,e){var n=this,o=n.back(-1);if((t=t||{})&&t.sessionStorage){if(r.window)try{var i;(i=window.sessionStorage)&&(o._.opt.remember=!0,(n.back("user")._.opt||t).remember=!0,(i.recall||i.pair)&&o.user().auth(JSON.parse(i.pair),e))}catch(t){}return n}return n}}))(e,"./recall"),e((function(t){var n=e("./user"),r=n.SEA,o=n.GUN,i=function(){};n.prototype.pair=function(){var t,e=this;try{t=new Proxy({DANGER:"☠"},{get:function(t,n,r){if(e.is&&(e._||"").sea)return e._.sea[n]}})}catch(t){}return t},n.prototype.delete=async function(t,e,n){console.log("user.delete() IS DEPRECATED AND WILL BE MOVED TO A MODULE!!!");var r=this;r.back(-1);var a=r.back("user");try{a.auth(t,e,(function(t){(a.is||{}).pub;a.map().once((function(){this.put(null)})),a.leave(),(n||i)({ok:0})}))}catch(t){o.log("User.delete failed! Error:",t)}return r},n.prototype.alive=async function(){console.log("user.alive() IS DEPRECATED!!!");const t=this.back(-1);try{return await authRecall(t),t._.user._}catch(t){const e="No session!";throw o.log(e),{err:e}}},n.prototype.trust=async function(t){console.log("`.trust` API MAY BE DELETED OR CHANGED OR RENAMED, DO NOT USE!"),o.is(t)&&t.get("pub").get(((t,e)=>{console.log(t,e)})),t.get("trust").get(path).put(theirPubkey)},n.prototype.grant=function(t,e){console.log("`.grant` API MAY BE DELETED OR CHANGED OR RENAMED, DO NOT USE!");var n=this,o=n.back(-1).user(),i=o._.sea,a="";return n.back((function(t){t.is||(a+=t.get||"")})),async function(){var n,s=await o.get("grant").get(i.pub).get(a).then();(s=await r.decrypt(s,i))||(s=r.random(16).toString(),n=await r.encrypt(s,i),o.get("grant").get(i.pub).get(a).put(n));var u=t.get("pub").then(),c=t.get("epub").then();u=await u,c=await c;var f=await r.secret(c,i);n=await r.encrypt(s,f),o.get("grant").get(u).get(a).put(n,e)}(),n},n.prototype.secret=function(t,e){console.log("`.secret` API MAY BE DELETED OR CHANGED OR RENAMED, DO NOT USE!");var n=this,o=n.back(-1).user(),i=o.pair(),a="";return n.back((function(t){t.is||(a+=t.get||"")})),async function(){var s,u=await o.get("trust").get(i.pub).get(a).then();(u=await r.decrypt(u,i))||(u=r.random(16).toString(),s=await r.encrypt(u,i),o.get("trust").get(i.pub).get(a).put(s)),s=await r.encrypt(t,u),n.put(s,e)}(),n},t.exports=n}))(e,"./share"),e((function(t){var r,o=e("./sea"),i=e("./settings"),a=""+r!=typeof window?window.Gun||{on:function(){}}:e((""+r==typeof n?".":"")+"./gun",1);function s(t){var e,n=this,r=n.as,i=t.put,u=i["#"],c=i["."],f=i[":"],l=i[">"],p=t["#"];if(u&&c)if((t._||"").faith&&(r.opt||"").faith&&"function"==typeof t._)o.opt.pack(i,(function(e){o.verify(e,!1,(function(e){i["="]=o.opt.unpack(e),n.to.next(t)}))}));else{var h=function(e){r.on("in",{"@":p,err:t.err=e})};(t._||"").DBG&&((t._||"").DBG.c=+new Date),0<=u.indexOf("<?")&&(e=parseFloat(u.split("<?")[1]||""))&&l<a.state()-1e3*e?(e=t._)&&e.stun&&e.stun--:"~@"!==u?"~@"!==u.slice(0,2)?(e=o.opt.pub(u))?s.pub(n,t,f,c,u,r,h,r.user||"",e):0<=u.indexOf("#")?s.hash(n,t,f,c,u,r,h):s.any(n,t,f,c,u,r,h,r.user||""):s.pubs(n,t,f,c,u,r,h):s.alias(n,t,f,c,u,r,h)}}a.on("opt",(function(t){t.sea||(t.sea={own:{}},t.on("put",s,t)),this.to.next(t)})),s.hash=function(t,e,n,r,i,a,s){o.work(n,null,(function(n){if(n&&n===r.split("#").slice(-1)[0])return t.to.next(e);s("Data hash not same as hash!")}),{name:"SHA-256"})},s.alias=function(t,e,n,r,o,i,a){return n?"~@"+r===c(n)?t.to.next(e):void a("Alias not same!"):a("Data must exist!")},s.pubs=function(t,e,n,r,o,i,a){return n?r===c(n)?t.to.next(e):void a("Alias not same!"):a("Alias must exist!")},s.pub=async function(t,e,n,s,u,f,l,p,h){var d;const g=await i.parse(n)||{},y=(t,n,i)=>{if(t.m&&t.s&&n&&h)return o.verify(t,h,(t=>{if(r!==t&&r!==t.e&&e.put[">"]&&e.put[">"]>parseFloat(t.e))return l("Certificate expired.");
1if(r!==t&&t.c&&t.w&&(t.c===n||t.c.indexOf("*")>-1)){let e=u.indexOf("/")>-1?u.replace(u.substring(0,u.indexOf("/")+1),""):"";String.match=String.match||a.text.match;const r=Array.isArray(t.w)?t.w:"object"==typeof t.w||"string"==typeof t.w?[t.w]:[];for(const a of r)if(String.match(e,a["#"])&&String.match(s,a["."])||!a["."]&&String.match(e,a["#"])||!a["#"]&&String.match(s,a["."])||String.match(e?e+"/"+s:s,a["#"]||a)){if(a["+"]&&a["+"].indexOf("*")>-1&&e&&-1==e.indexOf(n)&&-1==s.indexOf(n))return l(`Path "${e}" or key "${s}" must contain string "${n}".`);if(t.wb&&("string"==typeof t.wb||(t.wb||{})["#"])){var o=f.$.back(-1);return"string"==typeof t.wb&&"~"!==t.wb.slice(0,1)&&(o=o.get("~"+h)),o.get(t.wb).get(n).once((e=>!e||1!==e&&!0!==e?i(t):l("Certificant blacklisted.")))}return i(t)}return l("Certificate verification fail.")}}))};if("pub"===s&&"~"+h===u)return n===h?t.to.next(e):l("Account not same!");(d=p.is)&&d.pub&&!g["*"]&&!g["+"]&&(h===d.pub||h!==d.pub&&((e._.msg||{}).opt||{}).cert)?o.opt.pack(e.put,(a=>{o.sign(a,p._.sea,(async function(a){if(r===a)return l(o.err||"Signature fail.");if(e.put[":"]={":":d=o.opt.unpack(a.m),"~":a.s},e.put["="]=d,h===p.is.pub)return(d=c(n))&&((f.sea.own[d]=f.sea.own[d]||{})[h]=1),void JSON.stringifyAsync(e.put[":"],(function(n,r){return n?l(n||"Stringify error."):(e.put[":"]=r,t.to.next(e))}));if(h!==p.is.pub&&((e._.msg||{}).opt||{}).cert){const n=await i.parse(e._.msg.opt.cert);n&&n.m&&n.s&&y(n,p.is.pub,(r=>{e.put[":"]["+"]=n,e.put[":"]["*"]=p.is.pub,JSON.stringifyAsync(e.put[":"],(function(n,r){return n?l(n||"Stringify error."):(e.put[":"]=r,t.to.next(e))}))}))}}),{raw:1})})):o.opt.pack(e.put,(n=>{o.verify(n,g["*"]||h,(function(n){var i;return n=o.opt.unpack(n),r===n?l("Unverified data."):((i=c(n))&&h===o.opt.pub(i)&&((f.sea.own[i]=f.sea.own[i]||{})[h]=1),g["+"]&&g["+"].m&&g["+"].s&&g["*"]?void y(g["+"],g["*"],(r=>(e.put["="]=n,t.to.next(e)))):(e.put["="]=n,t.to.next(e)))}))}))},s.any=function(t,e,n,r,o,i,a,s){if(i.opt.secure)return a("Soul missing public key at '"+r+"'.");i.on("secure",(function(e){if(this.off(),!i.opt.secure)return t.to.next(e);a("Data cannot be changed.")})).on.on("secure",e)};var u=a.valid,c=function(t,e){return"string"==typeof(e=u(t))&&e};(a.state||"").ify;var f=/[^\w_-]/;o.opt.pub=function(t){if(t&&(t=t.split("~"))&&(t=t[1])&&(t=t.split(f).slice(0,2))&&2==t.length&&"@"!==(t[0]||"")[0])return t=t.slice(0,2).join(".")},o.opt.stringy=function(t){},o.opt.pack=function(t,e,n,i,s){var u,c;if(o.opt.check(t))return e(t);t&&t["#"]&&t["."]&&t[">"]&&(u=t[":"],c=1),JSON.parseAsync(c?u:t,(function(o,u){var c=r!==(u||"")[":"]&&(u||"")["~"];e(c?{m:{"#":s||t["#"],".":n||t["."],":":(u||"")[":"],">":t[">"]||a.state.is(i,n)},s:c}:t)}))};var l=o.opt;o.opt.unpack=function(t,e,n){var i;if(r!==t){if(t&&r!==(i=t[":"]))return i;if(e=e||l.fall_key,!n&&l.fall_val&&((n={})[e]=l.fall_val),e&&n){if(t===n[e])return t;if(!o.opt.check(n[e]))return t;var s=n&&n._&&n._["#"]||l.fall_soul,u=a.state.is(n,e)||l.fall_state;return t&&4===t.length&&s===t[0]&&e===t[1]&&p(u)===p(t[3])?t[2]:u<o.opt.shuffle_attack?t:void 0}}},o.opt.shuffle_attack=15463296e5;var p=Math.floor}))(e,"./index")}()})),X((function(t){!function(){function e(t,n){return n?Y(t):t.slice?e[r(t)]:function(n,o){t(n={exports:{}}),e[r(o)]=n.exports};function r(t){return t.split("/").slice(-1).toString().replace(".js","")}}var n=t;e((function(t){"undefined"!=typeof window&&(t.window=window);var e=(t.window||t).AXE||function(){};(e.window=t.window)&&(e.window.AXE=e);try{void 0!==n&&(n.exports=e)}catch(t){}t.exports=e}))(e,"./root"),e((function(t){var n=e("./root"),r=(n.window||"").Gun||e("./gun",1);if((r.AXE=n).GUN=n.Gun=r,!r.window)try{e("./lib/axe",1)}catch(t){}r.on("opt",(function(t){!function(t){if(t.axe)return;var e,n,o=t.opt,i=o.peers;if(!1===o.axe)return;if("undefined"!=typeof process&&"false"==""+(process.env||"").AXE)return;if(!r.window)return;t.axe={},(e=i[n="http://localhost:8765/gun"]=i[n]||{}).id=e.url=n,e.retry=e.retry||0,console.log("AXE enabled: Trying to find network via (1) local peer (2) last used peers (3) hard coded peers.");var a=JSON.parse((localStorage||"")[(o.file||"")+"axe/"]||null)||{};Object.keys(a.peers||"").forEach((function(t){(e=i[n=t]=i[n]||{}).id=e.url=n})),(e=i[n="https://gun-manhattan.herokuapp.com/gun"]=i[n]||{}).id=e.url=n;
1var s=o.mesh=o.mesh||r.Mesh(t);s.way=function(e){if(t.$===e.$||(e._||"").via)s.say(e,o.peers);else{var n=(e.$||"")._;if(n){if(e.get){if(n.axe)return;n.axe={}}s.say(e,o.peers)}else s.say(e,o.peers)}}}(t),this.to.next(t)})),t.exports=n}))(e,"./axe")}()}));const Z=[];const tt=Q(),et=tt.user().recall({sessionStorage:!0}),nt=function(e,n=t){let r;const o=[];function a(t){if(i(e,t)&&(e=t,r)){const t=!Z.length;for(let t=0;t<o.length;t+=1){const n=o[t];n[1](),Z.push(n,e)}if(t){for(let t=0;t<Z.length;t+=2)Z[t][0](Z[t+1]);Z.length=0}}}return{set:a,update:function(t){a(t(e))},subscribe:function(i,s=t){const u=[i,s];return o.push(u),1===o.length&&(r=n(a)||t),i(e),()=>{const t=o.indexOf(u);-1!==t&&o.splice(t,1),0===o.length&&(r(),r=null)}}}}("");function rt(e){let n,o,i,a,s,u,c,d,y,b,x,_,S;return{c(){n=h("div"),o=h("h1"),o.textContent="DAPP 💬",i=g(),a=h("input"),s=g(),u=h("input"),c=g(),d=h("div"),y=h("button"),y.textContent="Login",b=g(),x=h("button"),x.textContent="Sign Up",k(o,"color","white"),k(o,"font-size","3.5rem"),m(a,"name","username"),m(a,"minlength","3"),m(a,"maxlength","16"),m(a,"placeholder","Username"),k(a,"margin","1rem 0"),k(a,"padding","1rem 1.5rem"),k(a,"border-radius","0.7rem"),m(u,"name","password"),m(u,"type","password"),m(u,"placeholder","Password"),k(u,"margin","1rem 0"),k(u,"padding","1rem 1.5rem"),k(u,"border-radius","0.7rem"),m(y,"class","login"),k(y,"border-radius","0.7rem"),k(y,"margin-right","1.5rem"),k(y,"padding","1rem 2.3rem"),m(x,"class","login"),k(x,"border-radius","0.7rem"),k(x,"padding","1rem 2.3rem"),k(n,"height","100%"),k(n,"display","flex"),k(n,"flex-direction","column"),k(n,"justify-content","center"),k(n,"align-items","center"),k(n,"padding","0 7rem")},m(t,r){l(t,n,r),f(n,o),f(n,i),f(n,a),w(a,e[0]),f(n,s),f(n,u),w(u,e[1]),f(n,c),f(n,d),f(d,y),f(d,b),f(d,x),_||(S=[v(a,"input",e[4]),v(u,"input",e[5]),v(y,"click",e[2]),v(x,"click",e[3])],_=!0)},p(t,[e]){1&e&&a.value!==t[0]&&w(a,t[0]),2&e&&u.value!==t[1]&&w(u,t[1])},i:t,o:t,d(t){t&&p(n),_=!1,r(S)}}}function ot(t,e,n){let r,o;function i(){et.auth(r,o,(({err:t})=>t&&alert(t)))}return[r,o,i,function(){et.create(r,o,(({err:t})=>{t?alert(t):i()}))},function(){r=this.value,n(0,r)},function(){o=this.value,n(1,o)}]}et.get("alias").on((t=>nt.set(t))),tt.on("auth",(async t=>{const e=await et.get("alias");nt.set(e),console.log(`signed in as ${e}`)}));class it extends z{constructor(t){super(),q(this,t,ot,rt,i,{})}}function at(e){let n,r,o,i,a,s,u,c,y,v=e[0].what+"";return{c(){n=h("div"),r=h("img"),i=g(),a=h("div"),s=h("p"),u=d(v),c=g(),y=h("time"),y.textContent=`${e[3].toLocaleTimeString()}`,r.src!==(o=e[2])&&m(r,"src",o),m(r,"alt","avatar"),k(r,"padding","0.5rem"),k(s,"margin-bottom","0.5rem"),k(s,"border-radius","1rem"),m(a,"class","message-text"),m(n,"class",`message ${e[1]}`)},m(t,e){l(t,n,e),f(n,r),f(n,i),f(n,a),f(a,s),f(s,u),f(a,c),f(a,y)},p(t,[e]){1&e&&v!==(v=t[0].what+"")&&b(u,v)},i:t,o:t,d(t){t&&p(n)}}}function st(t,e,n){let{message:r}=e,{sender:o}=e;const i=r.who===o?"sent":"received",a=`https://avatars.dicebear.com/api/initials/${r.who}.svg`,s=new Date(r.when);return t.$$set=t=>{"message"in t&&n(0,r=t.message),"sender"in t&&n(4,o=t.sender)},[r,i,a,s,o]}class ut extends z{constructor(t){super(),q(this,t,st,at,i,{message:0,sender:4})}}var ct=/^\s+|\s+$/g,ft=/^[-+]0x[0-9a-f]+$/i,lt=/^0b[01]+$/i,pt=/^0o[0-7]+$/i,ht=parseInt,dt="object"==typeof V&&V&&V.Object===Object&&V,gt="object"==typeof self&&self&&self.Object===Object&&self,yt=dt||gt||Function("return this")(),vt=Object.prototype.toString,mt=Math.max,bt=Math.min,wt=function(){return yt.Date.now()};function kt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function xt(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==vt.call(t)}(t))return NaN;if(kt(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=kt(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(ct,"");var n=lt.test(t);return n||pt.test(t)?ht(t.slice(2),n?2:8):ft.test(t)?NaN:+t}var _t=function(t,e,n){var r,o,i,a,s,u,c=0,f=!1,l=!1,p=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function h(e){var n=r,i=o;return r=o=void 0,c=e,a=t.apply(i,n)}function d(t){return c=t,s=setTimeout(y,e),f?h(t):a}function g(t){var n=t-u;return void 0===u||n>=e||n<0||l&&t-c>=i}function y(){var t=wt();if(g(t))return v(t);s=setTimeout(y,function(t){var n=e-(t-u);return l?bt(n,i-(t-c)):n}(t))}function v(t){return s=void 0,p&&r?h(t):(r=o=void 0,a)}function m(){var t=wt(),n=g(t);if(r=arguments,o=this,u=t,n){if(void 0===s)return d(u);if(l)return s=setTimeout(y,e),h(u)}return void 0===s&&(s=setTimeout(y,e)),a}return e=xt(e)||0,kt(n)&&(f=!!n.leading,i=(l="maxWait"in n)?mt(xt(n.maxWait)||0,e):i,p="trailing"in n?!!n.trailing:p),m.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=u=o=s=void 0},m.flush=function(){return void 0===s?a:v(wt())},m};function St(t,e,n){const r=t.slice();return r[14]=e[n],r}function $t(e){let n,r,o;return r=new it({}),{c(){n=h("main"),R(r.$$.fragment)},m(t,e){l(t,n,e),L(r,n,null),o=!0},p:t,i(t){o||(M(r.$$.fragment,t),o=!0)},o(t){H(r.$$.fragment,t),o=!1},d(t){t&&p(n),F(r)}}}function At(t){let e,n,i,a,s,u,c,b,x,_,S,$,A,j,T,O=[],D=new Map,E=t[1];const N=t=>t[14].when;for(let e=0;e<E.length;e+=1){let n=St(t,E,e),r=N(n);D.set(r,O[e]=jt(r,n))}let B=!t[3]&&Tt(t);return{c(){e=h("main");for(let t=0;t<O.length;t+=1)O[t].c();n=g(),i=h("div"),a=g(),s=h("form"),u=h("input"),c=g(),b=h("button"),x=d("Send"),S=g(),B&&B.c(),$=y(),m(i,"class","dummy"),k(e,"padding","0 1rem"),m(u,"type","text"),m(u,"placeholder","Message..."),m(u,"maxlength","100"),k(u,"padding","0 1.5rem"),m(b,"type","submit"),b.disabled=_=!t[0],k(b,"color","black"),k(b,"font-weight","700"),k(b,"font-size","1.4rem")},m(r,p){l(r,e,p);for(let t=0;t<O.length;t+=1)O[t].m(e,null);var h;f(e,n),f(e,i),t[9](i),l(r,a,p),l(r,s,p),f(s,u),w(u,t[0]),f(s,c),f(s,b),f(b,x),l(r,S,p),B&&B.m(r,p),l(r,$,p),A=!0,j||(T=[v(e,"scroll",(function(){o(t[5])&&t[5].apply(this,arguments)})),v(u,"input",t[10]),v(s,"submit",(h=t[8],function(t){return t.preventDefault(),h.call(this,t)}))],j=!0)},p(r,o){t=r,66&o&&(E=t[1],P(),O=function(t,e,n,r,o,i,a,s,u,c,f,l){let p=t.length,h=i.length,d=p;const g={};for(;d--;)g[t[d].key]=d;const y=[],v=new Map,m=new Map;for(d=h;d--;){const t=l(o,i,d),s=n(t);let u=a.get(s);u?r&&u.p(t,e):(u=c(s,t),u.c()),v.set(s,y[d]=u),s in g&&m.set(s,Math.abs(d-g[s]))}const b=new Set,w=new Set;function k(t){M(t,1),t.m(s,f),a.set(t.key,t),f=t.first,h--}for(;p&&h;){const e=y[h-1],n=t[p-1],r=e.key,o=n.key;e===n?(f=e.first,p--,h--):v.has(o)?!a.has(r)||b.has(r)?k(e):w.has(o)?p--:m.get(r)>m.get(o)?(w.add(r),k(e)):(b.add(o),p--):(u(n,a),p--)}for(;p--;){const e=t[p];v.has(e.key)||u(e,a)}for(;h;)k(y[h-1]);return y}(O,o,N,1,t,E,D,e,K,jt,n,St),J()),1&o&&u.value!==t[0]&&w(u,t[0]),(!A||1&o&&_!==(_=!t[0]))&&(b.disabled=_),t[3]?B&&(B.d(1),B=null):B?B.p(t,o):(B=Tt(t),B.c(),B.m($.parentNode,$))},i(t){if(!A){for(let t=0;t<E.length;t+=1)M(O[t]);A=!0}},o(t){for(let t=0;t<O.length;t+=1)H(O[t]);A=!1},d(n){n&&p(e);for(let t=0;t<O.length;t+=1)O[t].d();t[9](null),n&&p(a),n&&p(s),n&&p(S),B&&B.d(n),n&&p($),j=!1,r(T)}}}function jt(t,e){let n,r,o;return r=new ut({props:{message:e[14],sender:e[6]}}),{key:t,first:null,c(){n=y(),R(r.$$.fragment),this.first=n},m(t,e){l(t,n,e),L(r,t,e),o=!0},p(t,n){e=t;
1const o={};2&n&&(o.message=e[14]),64&n&&(o.sender=e[6]),r.$set(o)},i(t){o||(M(r.$$.fragment,t),o=!0)},o(t){H(r.$$.fragment,t),o=!1},d(t){t&&p(n),F(r,t)}}}function Tt(t){let e,n,r,o,i,a=t[4]&&Ot();return{c(){e=h("div"),n=h("button"),a&&a.c(),r=d("\n\n                    👇"),x(n,"red",t[4]),m(e,"class","scroll-button")},m(s,u){l(s,e,u),f(e,n),a&&a.m(n,null),f(n,r),o||(i=v(n,"click",t[7]),o=!0)},p(t,e){t[4]?a||(a=Ot(),a.c(),a.m(n,r)):a&&(a.d(1),a=null),16&e&&x(n,"red",t[4])},d(t){t&&p(e),a&&a.d(),o=!1,i()}}}function Ot(t){let e;return{c(){e=d("💬")},m(t,n){l(t,e,n)},d(t){t&&p(e)}}}function Dt(t){let e,n,r,o;const i=[At,$t],a=[];function s(t,e){return t[6]?0:1}return n=s(t),r=a[n]=i[n](t),{c(){e=h("div"),r.c(),m(e,"class","container")},m(t,r){l(t,e,r),a[n].m(e,null),o=!0},p(t,[o]){let u=n;n=s(t),n===u?a[n].p(t,o):(P(),H(a[u],1,1,(()=>{a[u]=null})),J(),r=a[n],r?r.p(t,o):(r=a[n]=i[n](t),r.c()),M(r,1),r.m(e,null))},i(t){o||(M(r),o=!0)},o(t){H(r),o=!1},d(t){t&&p(e),a[n].d()}}}function Et(t,e,n){let r,o;a(t,nt,(t=>n(6,o=t)));const i=Q();let s,u,c,f=[],l=!0,p=!1;function h(){setTimeout((()=>u?.scrollIntoView({behavior:"auto"})),50),n(4,p=!1)}return S((()=>{var t={".":{">":new Date(+new Date-108e5).toISOString()},"-":1};i.get("chat").map(t).once((async(t,e)=>{if(t){const e="#foo";var r={who:await i.user(t).get("alias"),what:await SEA.decrypt(t.what,e)+"",when:Q.state.is(t,"what")};r.what&&(n(1,f=[...f.slice(-100),r].sort(((t,e)=>t.when-e.when))),l?h():n(4,p=!0))}}))})),n(5,r=_t((function(t){n(3,l=(t.target.scrollTop||1/0)>c),c=t.target.scrollTop}),1e3)),[s,f,u,l,p,r,o,h,async function(){const t=await SEA.encrypt(s,"#foo"),e=et.get("all").set({what:t}),r=(new Date).toISOString();i.get("chat").get(r).put(e),n(0,s=""),n(3,l=!0),h()},function(t){A[t?"unshift":"push"]((()=>{u=t,n(2,u)}))},function(){s=this.value,n(0,s)}]}class Nt extends z{constructor(t){super(),q(this,t,Et,Dt,i,{})}}function Bt(t){let e,n,r,o,i,a,s,u,c,y;return{c(){e=h("div"),n=h("span"),r=d(t[0]),o=g(),i=h("img"),s=g(),u=h("button"),u.textContent="Sign Out",k(n,"font-size","1.5rem"),k(n,"font-weight","700"),i.src!==(a=`https://avatars.dicebear.com/api/initials/${t[0]}.svg`)&&m(i,"src",a),m(i,"alt","avatar"),m(e,"class","user-bio"),m(u,"class","signout-button"),k(u,"font-weight","700"),k(u,"font-size","1rem"),k(u,"padding","1rem 1.8rem"),k(u,"border-radius","0.5rem"),k(u,"letter-spacing","0.05em")},m(a,p){l(a,e,p),f(e,n),f(n,r),f(e,o),f(e,i),l(a,s,p),l(a,u,p),c||(y=v(u,"click",t[1]),c=!0)},p(t,e){1&e&&b(r,t[0]),1&e&&i.src!==(a=`https://avatars.dicebear.com/api/initials/${t[0]}.svg`)&&m(i,"src",a)},d(t){t&&p(e),t&&p(s),t&&p(u),c=!1,y()}}}function Ct(e){let n,r=e[0]&&Bt(e);return{c(){n=h("header"),r&&r.c()},m(t,e){l(t,n,e),r&&r.m(n,null)},p(t,[e]){t[0]?r?r.p(t,e):(r=Bt(t),r.c(),r.m(n,null)):r&&(r.d(1),r=null)},i:t,o:t,d(t){t&&p(n),r&&r.d()}}}function Gt(t,e,n){let r;return a(t,nt,(t=>n(0,r=t))),[r,function(){et.leave(),nt.set("")}]}class Ut extends z{constructor(t){super(),q(this,t,Gt,Ct,i,{})}}function It(e){let n,r,o,i,a;return r=new Ut({}),i=new Nt({}),{c(){n=h("div"),R(r.$$.fragment),o=g(),R(i.$$.fragment),m(n,"class","app")},m(t,e){l(t,n,e),L(r,n,null),f(n,o),L(i,n,null),a=!0},p:t,i(t){a||(M(r.$$.fragment,t),M(i.$$.fragment,t),a=!0)},o(t){H(r.$$.fragment,t),H(i.$$.fragment,t),a=!1},d(t){t&&p(n),F(r),F(i)}}}return new class extends z{constructor(t){super(),q(this,t,null,It,i,{})}}({target:document.body})}();
2//# sourceMappingURL=bundle.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.