@dxos/shell 0.4.4-main.2a45fa8 → 0.4.4-main.385c016

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.
@@ -212,5 +212,5 @@ Event: `).concat(JSON.stringify(event)));else if(this.status!==$t.Running)throw
212
212
  `).concat($.message))}if(E&&w){h.target!==void 0&&(l=h.target),s.push.apply(s,bt([],rt(h.actions),!1)),u=h;break}}}catch($){n={error:$}}finally{try{p&&!p.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}if(u){if(!l.length)return{transitions:[u],exitSet:[],configuration:t.value?[this]:[],source:t,actions:s};var _=xt(l.map(function($){return o.getRelativeStateNodes($,t.historyValue)})),S=!!u.internal;return{transitions:[u],exitSet:S?[]:xt(l.map(function($){return o.getPotentiallyReenteringNodes($)})),configuration:_,source:t,actions:s}}},e.prototype.getPotentiallyReenteringNodes=function(t){if(this.order<t.order)return[this];for(var r=[],n=this,i=t;n&&n!==i;)r.push(n),n=n.parent;return n!==i?[]:(r.push(i),r)},e.prototype.getActions=function(t,r,n,i,o,a,s){var l,u,d,p,h=this,m=a?fa([],this.getStateNodes(a.value)):[],v=new Set;try{for(var y=Ze(Array.from(t).sort(function(F,M){return F.order-M.order})),w=y.next();!w.done;w=y.next()){var E=w.value;(!da(m,E)||da(n.exitSet,E)||E.parent&&v.has(E.parent))&&v.add(E)}}catch(F){l={error:F}}finally{try{w&&!w.done&&(u=y.return)&&u.call(y)}finally{if(l)throw l.error}}try{for(var _=Ze(m),S=_.next();!S.done;S=_.next()){var E=S.value;(!da(t,E)||da(n.exitSet,E.parent))&&n.exitSet.push(E)}}catch(F){d={error:F}}finally{try{S&&!S.done&&(p=_.return)&&p.call(_)}finally{if(d)throw d.error}}n.exitSet.sort(function(F,M){return M.order-F.order});var $=Array.from(v).sort(function(F,M){return F.order-M.order}),k=new Set(n.exitSet),P=xt($.map(function(F){var M=[];if(F.type!=="final")return M;var Z=F.parent;if(!Z.parent)return M;M.push(ml(F.id,F.doneData),ml(Z.id,F.doneData?dl(F.doneData,i,o):void 0));var Y=Z.parent;return Y.type==="parallel"&&ua(Y).every(function(X){return wl(n.configuration,X)})&&M.push(ml(Y.id)),M})),C=$.map(function(F){var M=F.onEntry,Z=F.activities.map(function(Y){return HF(Y)});return{type:"entry",actions:Pn(s?bt(bt([],rt(M),!1),rt(Z),!1):bt(bt([],rt(Z),!1),rt(M),!1),h.machine.options.actions)}}).concat({type:"state_done",actions:P.map(function(F){return BF(F)})}),T=Array.from(k).map(function(F){return{type:"exit",actions:Pn(bt(bt([],rt(F.onExit),!1),rt(F.activities.map(function(M){return VF(M)})),!1),h.machine.options.actions)}}),D=T.concat({type:"transition",actions:Pn(n.actions,this.machine.options.actions)}).concat(C);if(r){var j=Pn(xt(bt([],rt(t),!1).sort(function(F,M){return M.order-F.order}).map(function(F){return F.onExit})),this.machine.options.actions).filter(function(F){return!id(F)});return D.concat({type:"stop",actions:j})}return D},e.prototype.transition=function(t,r,n,i){t===void 0&&(t=this.initialState);var o=Bt(r),a;if(t instanceof dr)a=n===void 0?t:this.resolveState(dr.from(t,n));else{var s=nt(t)?this.resolve(ul(this.getResolvedPath(t))):this.resolve(t),l=n??this.machine.context;a=this.resolveState(dr.from(s,l))}if(!At&&o.name===ha)throw new Error("An event cannot have the wildcard type ('".concat(ha,"')"));if(this.strict&&!this.events.includes(o.name)&&!IF(o.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(o.name,"'"));var u=this._transition(a.value,a,o)||{transitions:[],configuration:[],exitSet:[],source:a,actions:[]},d=fa([],this.getStateNodes(a.value)),p=u.configuration.length?fa(d,u.configuration):d;return u.configuration=bt([],rt(p),!1),this.resolveTransition(u,a,a.context,i,o)},e.prototype.resolveRaisedTransition=function(t,r,n,i){var o,a=t.actions;return t=this.transition(t,r,void 0,i),t._event=n,t.event=n.data,(o=t.actions).unshift.apply(o,bt([],rt(a),!1)),t},e.prototype.resolveTransition=function(t,r,n,i,o){var a,s,l,u,d=this;o===void 0&&(o=Zi);var p=t.configuration,h=!r||t.transitions.length>0,m=h?t.configuration:r?r.configuration:[],v=wl(m,this),y=h?e9(this.machine,p):void 0,w=r?r.historyValue?r.historyValue:t.source?this.machine.historyValue(r.value):void 0:void 0,E=this.getActions(new Set(m),v,t,n,o,r,i),_=r?be({},r.activities):{};try{for(var S=Ze(E),$=S.next();!$.done;$=S.next()){var k=$.value;try{for(var P=(l=void 0,Ze(k.actions)),C=P.next();!C.done;C=P.next()){var T=C.value;T.type===Xf?_[T.activity.id||T.activity.type]=T:T.type===Zf&&(_[T.activity.id||T.activity.type]=!1)}}catch(re){l={error:re}}finally{try{C&&!C.done&&(u=P.return)&&u.call(P)}finally{if(l)throw l.error}}}}catch(re){a={error:re}}finally{try{$&&!$.done&&(s=S.return)&&s.call(S)}finally{if(a)throw a.error}}var D=rt(yl(this,r,n,o,E,i,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),j=D[0],F=D[1],M=rt(kF(j,id),2),Z=M[0],Y=M[1],X=j.filter(function(re){var de;return re.type===Xf&&((de=re.activity)===null||de===void 0?void 0:de.type)===ed}),ne=X.reduce(function(re,de){return re[de.activity.id]=JF(de.activity,d.machine,F,o),re},r?be({},r.children):{}),oe=new dr({value:y||r.value,context:F,_event:o,_sessionid:r?r._sessionid:null,historyValue:y?w?NF(w,y):void 0:r?r.historyValue:void 0,history:!y||t.source?r:void 0,actions:y?Y:[],activities:y?_:r?r.activities:{},events:[],configuration:m,transitions:t.transitions,children:ne,done:v,tags:P1(m),machine:this}),ce=n!==F;oe.changed=o.name===h1||ce;var se=oe.history;se&&delete se.history;var ge=!v&&(this._transient||p.some(function(re){return re._transient}));if(!h&&(!ge||o.name===eo))return oe;var le=oe;if(!v)for(ge&&(le=this.resolveRaisedTransition(le,{type:EF},o,i));Z.length;){var V=Z.shift();le=this.resolveRaisedTransition(le,V._event,o,i)}var J=le.changed||(se?!!le.actions.length||ce||typeof se.value!=typeof le.value||!k1(le.value,se.value):void 0);return le.changed=J,le.history=se,le},e.prototype.getStateNode=function(t){if(ro(t))return this.machine.getStateNodeById(t);if(!this.states)throw new Error("Unable to retrieve child state '".concat(t,"' from '").concat(this.id,"'; no child states exist."));var r=this.states[t];if(!r)throw new Error("Child state '".concat(t,"' does not exist on '").concat(this.id,"'"));return r},e.prototype.getStateNodeById=function(t){var r=ro(t)?t.slice(ud.length):t;if(r===this.id)return this;var n=this.machine.idMap[r];if(!n)throw new Error("Child state node '#".concat(r,"' does not exist on machine '").concat(this.id,"'"));return n},e.prototype.getStateNodeByPath=function(t){if(typeof t=="string"&&ro(t))try{return this.getStateNodeById(t.slice(1))}catch{}for(var r=nd(t,this.delimiter).slice(),n=this;r.length;){var i=r.shift();if(!i.length)break;n=n.getStateNode(i)}return n},e.prototype.resolve=function(t){var r,n=this;if(!t)return this.initialStateValue||to;switch(this.type){case"parallel":return sa(this.initialStateValue,function(o,a){return o?n.getStateNode(a).resolve(t[a]||o):to});case"compound":if(nt(t)){var i=this.getStateNode(t);return i.type==="parallel"||i.type==="compound"?(r={},r[t]=i.initialStateValue,r):t}return Object.keys(t).length?sa(t,function(o,a){return o?n.getStateNode(a).resolve(o):to}):this.initialStateValue||{};default:return t||to}},e.prototype.getResolvedPath=function(t){if(ro(t)){var r=this.machine.idMap[t.slice(ud.length)];if(!r)throw new Error("Unable to find state node '".concat(t,"'"));return r.path}return nd(t,this.delimiter)},Object.defineProperty(e.prototype,"initialStateValue",{get:function(){var t;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var r;if(this.type==="parallel")r=y1(this.states,function(n){return n.initialStateValue||to},function(n){return n.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));r=bl(this.states[this.initial])?this.initial:(t={},t[this.initial]=this.states[this.initial].initialStateValue,t)}else r={};return this.__cache.initialStateValue=r,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),e.prototype.getInitialState=function(t,r){this._init();var n=this.getStateNodes(t);return this.resolveTransition({configuration:n,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,r??this.machine.context,void 0)},Object.defineProperty(e.prototype,"initialState",{get:function(){var t=this.initialStateValue;if(!t)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){var t;if(this.type==="history"){var r=this.config;nt(r.target)?t=ro(r.target)?ul(this.machine.getStateNodeById(r.target).path.slice(this.path.length-1)):r.target:t=r.target}return t},enumerable:!1,configurable:!0}),e.prototype.getRelativeStateNodes=function(t,r,n){return n===void 0&&(n=!0),n?t.type==="history"?t.resolveHistory(r):t.initialStateNodes:[t]},Object.defineProperty(e.prototype,"initialStateNodes",{get:function(){var t=this;if(bl(this))return[this];if(this.type==="compound"&&!this.initial)return At||Ft(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var r=fl(this.initialStateValue);return xt(r.map(function(n){return t.getFromRelativePath(n)}))},enumerable:!1,configurable:!0}),e.prototype.getFromRelativePath=function(t){if(!t.length)return[this];var r=rt(t),n=r[0],i=r.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(n,"' from node with no states"));var o=this.getStateNode(n);if(o.type==="history")return o.resolveHistory();if(!this.states[n])throw new Error("Child state '".concat(n,"' does not exist on '").concat(this.id,"'"));return this.states[n].getFromRelativePath(i)},e.prototype.historyValue=function(t){if(Object.keys(this.states).length)return{current:t||this.initialStateValue,states:y1(this.states,function(r,n){if(!t)return r.historyValue();var i=nt(t)?void 0:t[n];return r.historyValue(i||r.initialStateValue)},function(r){return!r.history})}},e.prototype.resolveHistory=function(t){var r=this;if(this.type!=="history")return[this];var n=this.parent;if(!t){var i=this.target;return i?xt(fl(i).map(function(a){return n.getFromRelativePath(a)})):n.initialStateNodes}var o=TF(n.path,"states")(t).current;return nt(o)?[n.getStateNode(o)]:xt(fl(o).map(function(a){return r.history==="deep"?n.getFromRelativePath(a):[n.states[a[0]]]}))},Object.defineProperty(e.prototype,"stateIds",{get:function(){var t=this,r=xt(Object.keys(this.states).map(function(n){return t.states[n].stateIds}));return[this.id].concat(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"events",{get:function(){var t,r,n,i;if(this.__cache.events)return this.__cache.events;var o=this.states,a=new Set(this.ownEvents);if(o)try{for(var s=Ze(Object.keys(o)),l=s.next();!l.done;l=s.next()){var u=l.value,d=o[u];if(d.states)try{for(var p=(n=void 0,Ze(d.events)),h=p.next();!h.done;h=p.next()){var m=h.value;a.add("".concat(m))}}catch(v){n={error:v}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}}}catch(v){t={error:v}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return this.__cache.events=Array.from(a)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ownEvents",{get:function(){var t=new Set(this.transitions.filter(function(r){return!(!r.target&&!r.actions.length&&r.internal)}).map(function(r){return r.eventType}));return Array.from(t)},enumerable:!1,configurable:!0}),e.prototype.resolveTarget=function(t){var r=this;if(t!==void 0)return t.map(function(n){if(!nt(n))return n;var i=n[0]===r.delimiter;if(i&&!r.parent)return r.getStateNodeByPath(n.slice(1));var o=i?r.key+n:n;if(r.parent)try{var a=r.parent.getStateNodeByPath(o);return a}catch(s){throw new Error("Invalid transition definition for state node '".concat(r.id,`':
213
213
  `).concat(s.message))}else return r.getStateNodeByPath(o)})},e.prototype.formatTransition=function(t){var r=this,n=MF(t.target),i="internal"in t?t.internal:n?n.some(function(l){return nt(l)&&l[0]===r.delimiter}):!0,o=this.machine.options.guards,a=this.resolveTarget(n),s=be(be({},t),{actions:Pn(Sr(t.actions)),cond:x1(t.cond,o),target:a,source:this,internal:i,eventType:t.event,toJSON:function(){return be(be({},s),{target:s.target?s.target.map(function(l){return"#".concat(l.id)}):void 0,source:"#".concat(r.id)})}});return s},e.prototype.formatTransitions=function(){var t,r,n=this,i;if(!this.config.on)i=[];else if(Array.isArray(this.config.on))i=this.config.on;else{var o=this.config.on,a=ha,s=o[a],l=s===void 0?[]:s,u=Jf(o,[typeof a=="symbol"?a:a+""]);i=xt(Object.keys(u).map(function(_){!At&&_===eo&&Ft(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(n.id,'".'));var S=Xi(_,u[_]);return At||h9(n,_,S),S}).concat(Xi(ha,l)))}var d=this.config.always?Xi("",this.config.always):[],p=this.config.onDone?Xi(String(ml(this.id)),this.config.onDone):[];At||Ft(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var h=xt(this.invoke.map(function(_){var S=[];return _.onDone&&S.push.apply(S,bt([],rt(Xi(String(vl(_.id)),_.onDone)),!1)),_.onError&&S.push.apply(S,bt([],rt(Xi(String(ca(_.id)),_.onError)),!1)),S})),m=this.after,v=xt(bt(bt(bt(bt([],rt(p),!1),rt(h),!1),rt(i),!1),rt(d),!1).map(function(_){return Sr(_).map(function(S){return n.formatTransition(S)})}));try{for(var y=Ze(m),w=y.next();!w.done;w=y.next()){var E=w.value;v.push(E)}}catch(_){t={error:_}}finally{try{w&&!w.done&&(r=y.return)&&r.call(y)}finally{if(t)throw t.error}}return v},e}(),L1=!1;function fd(e,t){return!At&&!("predictableActionArguments"in e)&&!L1&&(L1=!0,console.warn("It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html")),new g9(e,t)}var Yt=KF,m9=c.useLayoutEffect;function M1(e){var t=ve.useRef();return t.current||(t.current={v:e()}),t.current.v}var _l=function(){return _l=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},_l.apply(this,arguments)},v9=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},y9=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o};function b9(e,t){var r=M1(function(){return typeof e=="function"?e():e});if(process.env.NODE_ENV!=="production"&&typeof e!="function"){var n=y9(c.useState(r),1),i=n[0];e!==i&&console.warn("Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\nPlease make sure that you pass the same Machine as argument each time.")}var o=t.context,a=t.guards,s=t.actions,l=t.activities,u=t.services,d=t.delays;t.state;var p=v9(t,["context","guards","actions","activities","services","delays","state"]),h=M1(function(){var m={context:o,guards:a,actions:s,activities:l,services:u,delays:d},v=r.withConfig(m,function(){return _l(_l({},r.context),o)});return D1(v,p)});return m9(function(){Object.assign(h.machine.options.actions,s),Object.assign(h.machine.options.guards,a),Object.assign(h.machine.options.activities,l),Object.assign(h.machine.options.services,u),Object.assign(h.machine.options.delays,d)},[s,a,l,u,d]),h}function w9(e,t,r){if(e.status===$t.NotStarted)return!0;var n=r.changed===void 0&&(Object.keys(r.children).length>0||typeof t.changed=="boolean");return!(r.changed||n)}var E9=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o};function _9(e){return e}function dd(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=E9(t,1),i=n[0],o=i===void 0?{}:i,a=b9(e,o),s=c.useCallback(function(){return a.status===$t.NotStarted?o.state?dr.create(o.state):a.machine.initialState:a.getSnapshot()},[a]),l=c.useCallback(function(p,h){return w9(a,p,h)},[a]),u=c.useCallback(function(p){var h=a.subscribe(p).unsubscribe;return h},[a]),d=wF.useSyncExternalStoreWithSelector(u,s,s,_9,l);return c.useEffect(function(){var p=o.state;return a.start(p?dr.create(p):void 0),function(){a.stop(),a.status=$t.NotStarted}},[]),[d,a.send,a]}const x9=fd({id:"identity",predictableActionArguments:!0,context:{identity:null,identitySubscribable:null},initial:"choosingAction",invoke:{src:e=>e.identitySubscribable},states:{choosingAction:{},managingDeviceInvitation:{},managingAgent:{initial:"idle",states:{idle:{},pending:{}}},managingDevices:{},managingProfile:{initial:"idle",states:{idle:{},pending:{}},on:{setIdentity:{target:"choosingAction",actions:["setIdentity","log"]},updateProfile:{target:".pending",actions:"log"}}},signingOut:{}},on:{unchooseAction:{target:".choosingAction",actions:["unsetInvitation","log"]},deselectInvitation:{target:".choosingAction",actions:["unsetInvitation","log"]},selectInvitation:{target:".managingDeviceInvitation",actions:["setInvitation","log"]},chooseDevices:{target:".managingDevices",actions:"log"},chooseProfile:{target:".managingProfile",actions:"log"},chooseSignOut:{target:".signingOut",actions:"log"},chooseAgent:{target:".managingAgent",actions:"log"}}},{actions:{setIdentity:Yt({identity:(e,t)=>(t==null?void 0:t.identity)??null}),setInvitation:Yt({invitation:(e,t)=>(t==null?void 0:t.invitation)??null}),unsetInvitation:Yt({invitation:()=>{}}),log:(e,t)=>{tt("[transition]",{event:t,context:e})}}}),S9=(e,t)=>dd(x9,{...t,context:{...t==null?void 0:t.context,identity:e.halo.identity.get(),identitySubscribable:e.halo.identity.map(r=>({type:"setIdentity",identity:r}))}}),$9=e=>{const{active:t,onAgentCreate:r,onAgentDestroy:n,send:i,validationMessage:o,agentStatus:a,agentActive:s,agentProviderDisabled:l}=e,u=!t,{t:d}=it("os");return c.createElement(c.Fragment,null,c.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},c.createElement(ra,{validationMessage:o,label:c.createElement(xr,null,"Agent Status"),disabled:u,"data-testid":"agent-status",value:a})),c.createElement(qt,null,c.createElement(lt,{disabled:s||l,onClick:()=>r==null?void 0:r(),"data-testid":"create-agent"},"Create Agent"),c.createElement(lt,{disabled:!s||l,onClick:()=>n==null?void 0:n(),"data-testid":"destroy-agent"},"Destroy Agent"),c.createElement(lt,{disabled:u,onClick:()=>i==null?void 0:i({type:"unchooseAction"}),"data-testid":"update-profile-form-back"},d("back label"))))},C9=({devices:e,active:t,send:r})=>{const{t:n}=it("os"),i=!t;return c.createElement(c.Fragment,null,c.createElement("div",{role:"none",className:"grow"},c.createElement(w4,{devices:e})),c.createElement(qt,null,c.createElement(lt,{variant:"ghost",disabled:i,onClick:()=>r==null?void 0:r({type:"unchooseAction"}),"data-testid":"manage-devices-back"},n("back label"))))},A9=e=>{const{send:t}=e,r=qe.useClient(),n=vo.useHaloInvitations(),i=c.useCallback(a=>{const s=ln.InvitationEncoder.encode(a);a.state===we.State.CONNECTING&&console.log(JSON.stringify({invitationCode:s,authCode:a.authCode}))},[]),o=a=>{const s=a.altKey&&a.shiftKey;n.forEach(u=>u.cancel());const l=r.halo.share(s?{type:we.Type.MULTIUSE,authMethod:we.AuthMethod.NONE}:void 0);process.env.NODE_ENV!=="production"&&l.subscribe(i),t==null||t({type:"selectInvitation",invitation:l})};return c.createElement(O9,{...e,onCreateInvitationClick:a=>o(a)})},O9=({onCreateInvitationClick:e,active:t,send:r,onDone:n,doneActionParent:i})=>{const{t:o}=it("os");return c.createElement("div",{role:"none",className:"grow flex flex-col gap-1"},c.createElement(Oi,{density:"coarse"},c.createElement("div",{className:"grow justify-center flex flex-col gap-1"},c.createElement(lt,{"data-testid":"manage-agent",onClick:()=>r==null?void 0:r({type:"chooseAgent"}),classNames:"plb-4"},c.createElement(Ye.HardDrive,{className:Ve(6)}),c.createElement("span",{className:"grow mli-3"},"Manage Agent"),c.createElement(Ye.CaretRight,{weight:"bold",className:Ve(4)})),c.createElement(lt,{disabled:!t,"data-testid":"devices-panel.create-invitation",onClick:e,classNames:"plb-4"},c.createElement(Ye.Plus,{className:Ve(6)}),c.createElement("span",{className:"grow mli-3"},o("choose add device label")),c.createElement(Ye.CaretRight,{weight:"bold",className:Ve(4)})),c.createElement(lt,{"data-testid":"manage-devices",onClick:()=>r==null?void 0:r({type:"chooseDevices"}),classNames:"plb-4"},c.createElement(Ye.Devices,{className:Ve(6)}),c.createElement("span",{className:"grow mli-3"},o("choose devices label")),c.createElement(Ye.CaretRight,{weight:"bold",className:Ve(4)})),c.createElement(lt,{"data-testid":"manage-profile",onClick:()=>r==null?void 0:r({type:"chooseProfile"}),classNames:"plb-4"},c.createElement(Ye.UserGear,{className:Ve(6)}),c.createElement("span",{className:"grow mli-3"},o("choose profile label")),c.createElement(Ye.CaretRight,{weight:"bold",className:Ve(4)})),c.createElement(lt,{"data-testid":"devices-panel.sign-out",onClick:()=>r==null?void 0:r({type:"chooseSignOut"}),classNames:"plb-4"},c.createElement(Ye.Power,{className:Ve(6)}),c.createElement("span",{className:"grow mli-3"},o("choose sign out label")),c.createElement(Ye.CaretRight,{weight:"bold",className:Ve(4)})))))},T9=e=>{const{onUpdateProfile:t}=e,{t:r}=it("os"),[n,i]=c.useState(""),o=async a=>{await(t==null?void 0:t(a).catch(s=>{tt.catch(s),i(r("failed to update profile message"))}))};return c.createElement(I9,{...e,onUpdateProfile:o,validationMessage:n})},I9=e=>{const{active:t,profile:r,send:n,onUpdateProfile:i,validationMessage:o}=e,a=!t,{t:s}=it("os"),[l,u]=c.useState((r==null?void 0:r.displayName)??"");return c.createElement(c.Fragment,null,c.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},c.createElement(ra,{validationMessage:o,label:c.createElement(xr,null,s("display name input label")),disabled:a,"data-testid":"display-name-input",placeholder:s("display name input placeholder"),value:l,onChange:({target:{value:d}})=>u(d),onKeyDown:({key:d})=>d==="Enter"&&(i==null?void 0:i({displayName:l}))})),c.createElement(qt,null,c.createElement(lt,{variant:"ghost",disabled:a,onClick:()=>n==null?void 0:n({type:"unchooseAction"}),"data-testid":"update-profile-form-back"},s("back label")),c.createElement(lt,{variant:"primary",disabled:a,onClick:()=>i==null?void 0:i({displayName:l}),"data-testid":"update-profile-form-continue"},s("done label"))))},P9=e=>{const{t}=it("os"),r=()=>{var n;window.confirm(t("reset device confirm message"))&&((n=e.onResetDevice)==null||n.call(e))};return c.createElement(k9,{disabled:!e.active,onBack:()=>{var n;return(n=e.send)==null?void 0:n.call(e,{type:"unchooseAction"})},onResetDevice:r,onJoinNewIdentity:e.onJoinNewIdentity})},k9=({disabled:e,onResetDevice:t,onJoinNewIdentity:r,onBack:n})=>{const{t:i}=it("os");return c.createElement(c.Fragment,null,c.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},c.createElement(eu.Root,{valence:"error"},c.createElement(eu.Title,null,c.createElement(Ye.Warning,{className:ue(Ve(6),"inline mie-2")}),i("sign out chooser title")),c.createElement(eu.Body,null,i("sign out chooser message")))),c.createElement(qt,null,c.createElement(lt,{disabled:e,onClick:n},i("back label")),c.createElement(lt,{variant:"primary","data-testid":"sign-out.join-new-identity",classNames:"!bg-error-500 hover:!bg-error-550",disabled:e,onClick:r},i("join new identity label")),c.createElement(lt,{variant:"primary","data-testid":"sign-out.reset-device",classNames:"!bg-error-500 hover:!bg-error-550",disabled:e,onClick:t},i("reset device label"))))},N9=({client:e,invitations:t,identity:r})=>{const[n,i]=c.useState(""),[o,a]=c.useState(""),[s,l]=c.useState(!1),u=qe.useAgentHostingProviderClient(e.config);c.useEffect(()=>{(async()=>{if(u){const v=await(u==null?void 0:u.getAgent((r==null?void 0:r.identityKey.truncate())??"foo"));v?(l(!0),a(v)):(l(!1),i("No agent deployed via provider."))}else i("No agent provider configured.")})()},[]);const d=c.useCallback(async m=>{const v=ln.InvitationEncoder.encode(m);if(m.state===we.State.CONNECTING&&(console.log(JSON.stringify({invitationCode:v,authCode:m.authCode})),Ko(r,"Identity not found"),u))try{const y=await(u==null?void 0:u.createAgent(v,r.identityKey.truncate()));a(y),l(!0),i("")}catch(y){i(`error creating agent: ${y.message}`)}},[]);return{onAgentCreate:async()=>{t.forEach(v=>v.cancel()),e.halo.share({type:we.Type.MULTIUSE,authMethod:we.AuthMethod.NONE}).subscribe(d)},onAgentDestroy:async()=>{const m=e.halo.identity.get();Ko(m,"Identity not found");try{await(u==null?void 0:u.destroyAgent(m.identityKey.truncate())),i("No agent deployed via provider."),a(""),l(!1)}catch(v){i(`error destroying agent: ${v.message}`)}},validationMessage:n,agentStatus:o,agentActive:s}};var F1={exports:{}};(function(e,t){var r=function(){var n=function(k,P){var C=236,T=17,D=k,j=o[P],F=null,M=0,Z=null,Y=[],X={},ne=function(B,z){M=D*4+17,F=function(K){for(var I=new Array(K),N=0;N<K;N+=1){I[N]=new Array(K);for(var Q=0;Q<K;Q+=1)I[N][Q]=null}return I}(M),oe(0,0),oe(M-7,0),oe(0,M-7),ge(),se(),V(B,z),D>=7&&le(B),Z==null&&(Z=de(D,j,Y)),J(Z,z)},oe=function(B,z){for(var K=-1;K<=7;K+=1)if(!(B+K<=-1||M<=B+K))for(var I=-1;I<=7;I+=1)z+I<=-1||M<=z+I||(0<=K&&K<=6&&(I==0||I==6)||0<=I&&I<=6&&(K==0||K==6)||2<=K&&K<=4&&2<=I&&I<=4?F[B+K][z+I]=!0:F[B+K][z+I]=!1)},ce=function(){for(var B=0,z=0,K=0;K<8;K+=1){ne(!0,K);var I=s.getLostPoint(X);(K==0||B>I)&&(B=I,z=K)}return z},se=function(){for(var B=8;B<M-8;B+=1)F[B][6]==null&&(F[B][6]=B%2==0);for(var z=8;z<M-8;z+=1)F[6][z]==null&&(F[6][z]=z%2==0)},ge=function(){for(var B=s.getPatternPosition(D),z=0;z<B.length;z+=1)for(var K=0;K<B.length;K+=1){var I=B[z],N=B[K];if(F[I][N]==null)for(var Q=-2;Q<=2;Q+=1)for(var ie=-2;ie<=2;ie+=1)Q==-2||Q==2||ie==-2||ie==2||Q==0&&ie==0?F[I+Q][N+ie]=!0:F[I+Q][N+ie]=!1}},le=function(B){for(var z=s.getBCHTypeNumber(D),K=0;K<18;K+=1){var I=!B&&(z>>K&1)==1;F[Math.floor(K/3)][K%3+M-8-3]=I}for(var K=0;K<18;K+=1){var I=!B&&(z>>K&1)==1;F[K%3+M-8-3][Math.floor(K/3)]=I}},V=function(B,z){for(var K=j<<3|z,I=s.getBCHTypeInfo(K),N=0;N<15;N+=1){var Q=!B&&(I>>N&1)==1;N<6?F[N][8]=Q:N<8?F[N+1][8]=Q:F[M-15+N][8]=Q}for(var N=0;N<15;N+=1){var Q=!B&&(I>>N&1)==1;N<8?F[8][M-N-1]=Q:N<9?F[8][15-N-1+1]=Q:F[8][15-N-1]=Q}F[M-8][8]=!B},J=function(B,z){for(var K=-1,I=M-1,N=7,Q=0,ie=s.getMaskFunction(z),pe=M-1;pe>0;pe-=2)for(pe==6&&(pe-=1);;){for(var ye=0;ye<2;ye+=1)if(F[I][pe-ye]==null){var _e=!1;Q<B.length&&(_e=(B[Q]>>>N&1)==1);var xe=ie(I,pe-ye);xe&&(_e=!_e),F[I][pe-ye]=_e,N-=1,N==-1&&(Q+=1,N=7)}if(I+=K,I<0||M<=I){I-=K,K=-K;break}}},re=function(B,z){for(var K=0,I=0,N=0,Q=new Array(z.length),ie=new Array(z.length),pe=0;pe<z.length;pe+=1){var ye=z[pe].dataCount,_e=z[pe].totalCount-ye;I=Math.max(I,ye),N=Math.max(N,_e),Q[pe]=new Array(ye);for(var xe=0;xe<Q[pe].length;xe+=1)Q[pe][xe]=255&B.getBuffer()[xe+K];K+=ye;var ae=s.getErrorCorrectPolynomial(_e),Me=u(Q[pe],ae.getLength()-1),at=Me.mod(ae);ie[pe]=new Array(ae.getLength()-1);for(var xe=0;xe<ie[pe].length;xe+=1){var Oe=xe+at.getLength()-ie[pe].length;ie[pe][xe]=Oe>=0?at.getAt(Oe):0}}for(var Re=0,xe=0;xe<z.length;xe+=1)Re+=z[xe].totalCount;for(var gt=new Array(Re),Se=0,xe=0;xe<I;xe+=1)for(var pe=0;pe<z.length;pe+=1)xe<Q[pe].length&&(gt[Se]=Q[pe][xe],Se+=1);for(var xe=0;xe<N;xe+=1)for(var pe=0;pe<z.length;pe+=1)xe<ie[pe].length&&(gt[Se]=ie[pe][xe],Se+=1);return gt},de=function(B,z,K){for(var I=d.getRSBlocks(B,z),N=p(),Q=0;Q<K.length;Q+=1){var ie=K[Q];N.put(ie.getMode(),4),N.put(ie.getLength(),s.getLengthInBits(ie.getMode(),B)),ie.write(N)}for(var pe=0,Q=0;Q<I.length;Q+=1)pe+=I[Q].dataCount;if(N.getLengthInBits()>pe*8)throw"code length overflow. ("+N.getLengthInBits()+">"+pe*8+")";for(N.getLengthInBits()+4<=pe*8&&N.put(0,4);N.getLengthInBits()%8!=0;)N.putBit(!1);for(;!(N.getLengthInBits()>=pe*8||(N.put(C,8),N.getLengthInBits()>=pe*8));)N.put(T,8);return re(N,I)};X.addData=function(B,z){z=z||"Byte";var K=null;switch(z){case"Numeric":K=h(B);break;case"Alphanumeric":K=m(B);break;case"Byte":K=v(B);break;case"Kanji":K=y(B);break;default:throw"mode:"+z}Y.push(K),Z=null},X.isDark=function(B,z){if(B<0||M<=B||z<0||M<=z)throw B+","+z;return F[B][z]},X.getModuleCount=function(){return M},X.make=function(){if(D<1){for(var B=1;B<40;B++){for(var z=d.getRSBlocks(B,j),K=p(),I=0;I<Y.length;I++){var N=Y[I];K.put(N.getMode(),4),K.put(N.getLength(),s.getLengthInBits(N.getMode(),B)),N.write(K)}for(var Q=0,I=0;I<z.length;I++)Q+=z[I].dataCount;if(K.getLengthInBits()<=Q*8)break}D=B}ne(!1,ce())},X.createTableTag=function(B,z){B=B||2,z=typeof z>"u"?B*4:z;var K="";K+='<table style="',K+=" border-width: 0px; border-style: none;",K+=" border-collapse: collapse;",K+=" padding: 0px; margin: "+z+"px;",K+='">',K+="<tbody>";for(var I=0;I<X.getModuleCount();I+=1){K+="<tr>";for(var N=0;N<X.getModuleCount();N+=1)K+='<td style="',K+=" border-width: 0px; border-style: none;",K+=" border-collapse: collapse;",K+=" padding: 0px; margin: 0px;",K+=" width: "+B+"px;",K+=" height: "+B+"px;",K+=" background-color: ",K+=X.isDark(I,N)?"#000000":"#ffffff",K+=";",K+='"/>';K+="</tr>"}return K+="</tbody>",K+="</table>",K},X.createSvgTag=function(B,z,K,I){var N={};typeof arguments[0]=="object"&&(N=arguments[0],B=N.cellSize,z=N.margin,K=N.alt,I=N.title),B=B||2,z=typeof z>"u"?B*4:z,K=typeof K=="string"?{text:K}:K||{},K.text=K.text||null,K.id=K.text?K.id||"qrcode-description":null,I=typeof I=="string"?{text:I}:I||{},I.text=I.text||null,I.id=I.text?I.id||"qrcode-title":null;var Q=X.getModuleCount()*B+z*2,ie,pe,ye,_e,xe="",ae;for(ae="l"+B+",0 0,"+B+" -"+B+",0 0,-"+B+"z ",xe+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',xe+=N.scalable?"":' width="'+Q+'px" height="'+Q+'px"',xe+=' viewBox="0 0 '+Q+" "+Q+'" ',xe+=' preserveAspectRatio="xMinYMin meet"',xe+=I.text||K.text?' role="img" aria-labelledby="'+H([I.id,K.id].join(" ").trim())+'"':"",xe+=">",xe+=I.text?'<title id="'+H(I.id)+'">'+H(I.text)+"</title>":"",xe+=K.text?'<description id="'+H(K.id)+'">'+H(K.text)+"</description>":"",xe+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',xe+='<path d="',ye=0;ye<X.getModuleCount();ye+=1)for(_e=ye*B+z,ie=0;ie<X.getModuleCount();ie+=1)X.isDark(ye,ie)&&(pe=ie*B+z,xe+="M"+pe+","+_e+ae);return xe+='" stroke="transparent" fill="black"/>',xe+="</svg>",xe},X.createDataURL=function(B,z){B=B||2,z=typeof z>"u"?B*4:z;var K=X.getModuleCount()*B+z*2,I=z,N=K-z;return $(K,K,function(Q,ie){if(I<=Q&&Q<N&&I<=ie&&ie<N){var pe=Math.floor((Q-I)/B),ye=Math.floor((ie-I)/B);return X.isDark(ye,pe)?0:1}else return 1})},X.createImgTag=function(B,z,K){B=B||2,z=typeof z>"u"?B*4:z;var I=X.getModuleCount()*B+z*2,N="";return N+="<img",N+=' src="',N+=X.createDataURL(B,z),N+='"',N+=' width="',N+=I,N+='"',N+=' height="',N+=I,N+='"',K&&(N+=' alt="',N+=H(K),N+='"'),N+="/>",N};var H=function(B){for(var z="",K=0;K<B.length;K+=1){var I=B.charAt(K);switch(I){case"<":z+="&lt;";break;case">":z+="&gt;";break;case"&":z+="&amp;";break;case'"':z+="&quot;";break;default:z+=I;break}}return z},G=function(B){var z=1;B=typeof B>"u"?z*2:B;var K=X.getModuleCount()*z+B*2,I=B,N=K-B,Q,ie,pe,ye,_e,xe={"██":"█","█ ":"▀"," █":"▄"," ":" "},ae={"██":"▀","█ ":"▀"," █":" "," ":" "},Me="";for(Q=0;Q<K;Q+=2){for(pe=Math.floor((Q-I)/z),ye=Math.floor((Q+1-I)/z),ie=0;ie<K;ie+=1)_e="█",I<=ie&&ie<N&&I<=Q&&Q<N&&X.isDark(pe,Math.floor((ie-I)/z))&&(_e=" "),I<=ie&&ie<N&&I<=Q+1&&Q+1<N&&X.isDark(ye,Math.floor((ie-I)/z))?_e+=" ":_e+="█",Me+=B<1&&Q+1>=N?ae[_e]:xe[_e];Me+=`
214
214
  `}return K%2&&B>0?Me.substring(0,Me.length-K-1)+Array(K+1).join("▀"):Me.substring(0,Me.length-1)};return X.createASCII=function(B,z){if(B=B||1,B<2)return G(z);B-=1,z=typeof z>"u"?B*2:z;var K=X.getModuleCount()*B+z*2,I=z,N=K-z,Q,ie,pe,ye,_e=Array(B+1).join("██"),xe=Array(B+1).join(" "),ae="",Me="";for(Q=0;Q<K;Q+=1){for(pe=Math.floor((Q-I)/B),Me="",ie=0;ie<K;ie+=1)ye=1,I<=ie&&ie<N&&I<=Q&&Q<N&&X.isDark(pe,Math.floor((ie-I)/B))&&(ye=0),Me+=ye?_e:xe;for(pe=0;pe<B;pe+=1)ae+=Me+`
215
- `}return ae.substring(0,ae.length-1)},X.renderTo2dContext=function(B,z){z=z||2;for(var K=X.getModuleCount(),I=0;I<K;I++)for(var N=0;N<K;N++)B.fillStyle=X.isDark(I,N)?"black":"white",B.fillRect(I*z,N*z,z,z)},X};n.stringToBytesFuncs={default:function(k){for(var P=[],C=0;C<k.length;C+=1){var T=k.charCodeAt(C);P.push(T&255)}return P}},n.stringToBytes=n.stringToBytesFuncs.default,n.createStringToBytes=function(k,P){var C=function(){for(var D=_(k),j=function(){var se=D.read();if(se==-1)throw"eof";return se},F=0,M={};;){var Z=D.read();if(Z==-1)break;var Y=j(),X=j(),ne=j(),oe=String.fromCharCode(Z<<8|Y),ce=X<<8|ne;M[oe]=ce,F+=1}if(F!=P)throw F+" != "+P;return M}(),T=63;return function(D){for(var j=[],F=0;F<D.length;F+=1){var M=D.charCodeAt(F);if(M<128)j.push(M);else{var Z=C[D.charAt(F)];typeof Z=="number"?(Z&255)==Z?j.push(Z):(j.push(Z>>>8),j.push(Z&255)):j.push(T)}}return j}};var i={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},o={L:1,M:0,Q:3,H:2},a={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},s=function(){var k=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],P=1335,C=7973,T=21522,D={},j=function(F){for(var M=0;F!=0;)M+=1,F>>>=1;return M};return D.getBCHTypeInfo=function(F){for(var M=F<<10;j(M)-j(P)>=0;)M^=P<<j(M)-j(P);return(F<<10|M)^T},D.getBCHTypeNumber=function(F){for(var M=F<<12;j(M)-j(C)>=0;)M^=C<<j(M)-j(C);return F<<12|M},D.getPatternPosition=function(F){return k[F-1]},D.getMaskFunction=function(F){switch(F){case a.PATTERN000:return function(M,Z){return(M+Z)%2==0};case a.PATTERN001:return function(M,Z){return M%2==0};case a.PATTERN010:return function(M,Z){return Z%3==0};case a.PATTERN011:return function(M,Z){return(M+Z)%3==0};case a.PATTERN100:return function(M,Z){return(Math.floor(M/2)+Math.floor(Z/3))%2==0};case a.PATTERN101:return function(M,Z){return M*Z%2+M*Z%3==0};case a.PATTERN110:return function(M,Z){return(M*Z%2+M*Z%3)%2==0};case a.PATTERN111:return function(M,Z){return(M*Z%3+(M+Z)%2)%2==0};default:throw"bad maskPattern:"+F}},D.getErrorCorrectPolynomial=function(F){for(var M=u([1],0),Z=0;Z<F;Z+=1)M=M.multiply(u([1,l.gexp(Z)],0));return M},D.getLengthInBits=function(F,M){if(1<=M&&M<10)switch(F){case i.MODE_NUMBER:return 10;case i.MODE_ALPHA_NUM:return 9;case i.MODE_8BIT_BYTE:return 8;case i.MODE_KANJI:return 8;default:throw"mode:"+F}else if(M<27)switch(F){case i.MODE_NUMBER:return 12;case i.MODE_ALPHA_NUM:return 11;case i.MODE_8BIT_BYTE:return 16;case i.MODE_KANJI:return 10;default:throw"mode:"+F}else if(M<41)switch(F){case i.MODE_NUMBER:return 14;case i.MODE_ALPHA_NUM:return 13;case i.MODE_8BIT_BYTE:return 16;case i.MODE_KANJI:return 12;default:throw"mode:"+F}else throw"type:"+M},D.getLostPoint=function(F){for(var M=F.getModuleCount(),Z=0,Y=0;Y<M;Y+=1)for(var X=0;X<M;X+=1){for(var ne=0,oe=F.isDark(Y,X),ce=-1;ce<=1;ce+=1)if(!(Y+ce<0||M<=Y+ce))for(var se=-1;se<=1;se+=1)X+se<0||M<=X+se||ce==0&&se==0||oe==F.isDark(Y+ce,X+se)&&(ne+=1);ne>5&&(Z+=3+ne-5)}for(var Y=0;Y<M-1;Y+=1)for(var X=0;X<M-1;X+=1){var ge=0;F.isDark(Y,X)&&(ge+=1),F.isDark(Y+1,X)&&(ge+=1),F.isDark(Y,X+1)&&(ge+=1),F.isDark(Y+1,X+1)&&(ge+=1),(ge==0||ge==4)&&(Z+=3)}for(var Y=0;Y<M;Y+=1)for(var X=0;X<M-6;X+=1)F.isDark(Y,X)&&!F.isDark(Y,X+1)&&F.isDark(Y,X+2)&&F.isDark(Y,X+3)&&F.isDark(Y,X+4)&&!F.isDark(Y,X+5)&&F.isDark(Y,X+6)&&(Z+=40);for(var X=0;X<M;X+=1)for(var Y=0;Y<M-6;Y+=1)F.isDark(Y,X)&&!F.isDark(Y+1,X)&&F.isDark(Y+2,X)&&F.isDark(Y+3,X)&&F.isDark(Y+4,X)&&!F.isDark(Y+5,X)&&F.isDark(Y+6,X)&&(Z+=40);for(var le=0,X=0;X<M;X+=1)for(var Y=0;Y<M;Y+=1)F.isDark(Y,X)&&(le+=1);var V=Math.abs(100*le/M/M-50)/5;return Z+=V*10,Z},D}(),l=function(){for(var k=new Array(256),P=new Array(256),C=0;C<8;C+=1)k[C]=1<<C;for(var C=8;C<256;C+=1)k[C]=k[C-4]^k[C-5]^k[C-6]^k[C-8];for(var C=0;C<255;C+=1)P[k[C]]=C;var T={};return T.glog=function(D){if(D<1)throw"glog("+D+")";return P[D]},T.gexp=function(D){for(;D<0;)D+=255;for(;D>=256;)D-=255;return k[D]},T}();function u(k,P){if(typeof k.length>"u")throw k.length+"/"+P;var C=function(){for(var D=0;D<k.length&&k[D]==0;)D+=1;for(var j=new Array(k.length-D+P),F=0;F<k.length-D;F+=1)j[F]=k[F+D];return j}(),T={};return T.getAt=function(D){return C[D]},T.getLength=function(){return C.length},T.multiply=function(D){for(var j=new Array(T.getLength()+D.getLength()-1),F=0;F<T.getLength();F+=1)for(var M=0;M<D.getLength();M+=1)j[F+M]^=l.gexp(l.glog(T.getAt(F))+l.glog(D.getAt(M)));return u(j,0)},T.mod=function(D){if(T.getLength()-D.getLength()<0)return T;for(var j=l.glog(T.getAt(0))-l.glog(D.getAt(0)),F=new Array(T.getLength()),M=0;M<T.getLength();M+=1)F[M]=T.getAt(M);for(var M=0;M<D.getLength();M+=1)F[M]^=l.gexp(l.glog(D.getAt(M))+j);return u(F,0).mod(D)},T}var d=function(){var k=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],P=function(D,j){var F={};return F.totalCount=D,F.dataCount=j,F},C={},T=function(D,j){switch(j){case o.L:return k[(D-1)*4+0];case o.M:return k[(D-1)*4+1];case o.Q:return k[(D-1)*4+2];case o.H:return k[(D-1)*4+3];default:return}};return C.getRSBlocks=function(D,j){var F=T(D,j);if(typeof F>"u")throw"bad rs block @ typeNumber:"+D+"/errorCorrectionLevel:"+j;for(var M=F.length/3,Z=[],Y=0;Y<M;Y+=1)for(var X=F[Y*3+0],ne=F[Y*3+1],oe=F[Y*3+2],ce=0;ce<X;ce+=1)Z.push(P(ne,oe));return Z},C}(),p=function(){var k=[],P=0,C={};return C.getBuffer=function(){return k},C.getAt=function(T){var D=Math.floor(T/8);return(k[D]>>>7-T%8&1)==1},C.put=function(T,D){for(var j=0;j<D;j+=1)C.putBit((T>>>D-j-1&1)==1)},C.getLengthInBits=function(){return P},C.putBit=function(T){var D=Math.floor(P/8);k.length<=D&&k.push(0),T&&(k[D]|=128>>>P%8),P+=1},C},h=function(k){var P=i.MODE_NUMBER,C=k,T={};T.getMode=function(){return P},T.getLength=function(F){return C.length},T.write=function(F){for(var M=C,Z=0;Z+2<M.length;)F.put(D(M.substring(Z,Z+3)),10),Z+=3;Z<M.length&&(M.length-Z==1?F.put(D(M.substring(Z,Z+1)),4):M.length-Z==2&&F.put(D(M.substring(Z,Z+2)),7))};var D=function(F){for(var M=0,Z=0;Z<F.length;Z+=1)M=M*10+j(F.charAt(Z));return M},j=function(F){if("0"<=F&&F<="9")return F.charCodeAt(0)-48;throw"illegal char :"+F};return T},m=function(k){var P=i.MODE_ALPHA_NUM,C=k,T={};T.getMode=function(){return P},T.getLength=function(j){return C.length},T.write=function(j){for(var F=C,M=0;M+1<F.length;)j.put(D(F.charAt(M))*45+D(F.charAt(M+1)),11),M+=2;M<F.length&&j.put(D(F.charAt(M)),6)};var D=function(j){if("0"<=j&&j<="9")return j.charCodeAt(0)-48;if("A"<=j&&j<="Z")return j.charCodeAt(0)-65+10;switch(j){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+j}};return T},v=function(k){var P=i.MODE_8BIT_BYTE,C=n.stringToBytes(k),T={};return T.getMode=function(){return P},T.getLength=function(D){return C.length},T.write=function(D){for(var j=0;j<C.length;j+=1)D.put(C[j],8)},T},y=function(k){var P=i.MODE_KANJI,C=n.stringToBytesFuncs.SJIS;if(!C)throw"sjis not supported.";(function(j,F){var M=C(j);if(M.length!=2||(M[0]<<8|M[1])!=F)throw"sjis not supported."})("友",38726);var T=C(k),D={};return D.getMode=function(){return P},D.getLength=function(j){return~~(T.length/2)},D.write=function(j){for(var F=T,M=0;M+1<F.length;){var Z=(255&F[M])<<8|255&F[M+1];if(33088<=Z&&Z<=40956)Z-=33088;else if(57408<=Z&&Z<=60351)Z-=49472;else throw"illegal char at "+(M+1)+"/"+Z;Z=(Z>>>8&255)*192+(Z&255),j.put(Z,13),M+=2}if(M<F.length)throw"illegal char at "+(M+1)},D},w=function(){var k=[],P={};return P.writeByte=function(C){k.push(C&255)},P.writeShort=function(C){P.writeByte(C),P.writeByte(C>>>8)},P.writeBytes=function(C,T,D){T=T||0,D=D||C.length;for(var j=0;j<D;j+=1)P.writeByte(C[j+T])},P.writeString=function(C){for(var T=0;T<C.length;T+=1)P.writeByte(C.charCodeAt(T))},P.toByteArray=function(){return k},P.toString=function(){var C="";C+="[";for(var T=0;T<k.length;T+=1)T>0&&(C+=","),C+=k[T];return C+="]",C},P},E=function(){var k=0,P=0,C=0,T="",D={},j=function(M){T+=String.fromCharCode(F(M&63))},F=function(M){if(!(M<0)){if(M<26)return 65+M;if(M<52)return 97+(M-26);if(M<62)return 48+(M-52);if(M==62)return 43;if(M==63)return 47}throw"n:"+M};return D.writeByte=function(M){for(k=k<<8|M&255,P+=8,C+=1;P>=6;)j(k>>>P-6),P-=6},D.flush=function(){if(P>0&&(j(k<<6-P),k=0,P=0),C%3!=0)for(var M=3-C%3,Z=0;Z<M;Z+=1)T+="="},D.toString=function(){return T},D},_=function(k){var P=k,C=0,T=0,D=0,j={};j.read=function(){for(;D<8;){if(C>=P.length){if(D==0)return-1;throw"unexpected end of file./"+D}var M=P.charAt(C);if(C+=1,M=="=")return D=0,-1;if(M.match(/^\s$/))continue;T=T<<6|F(M.charCodeAt(0)),D+=6}var Z=T>>>D-8&255;return D-=8,Z};var F=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return j},S=function(k,P){var C=k,T=P,D=new Array(k*P),j={};j.setPixel=function(Y,X,ne){D[X*C+Y]=ne},j.write=function(Y){Y.writeString("GIF87a"),Y.writeShort(C),Y.writeShort(T),Y.writeByte(128),Y.writeByte(0),Y.writeByte(0),Y.writeByte(0),Y.writeByte(0),Y.writeByte(0),Y.writeByte(255),Y.writeByte(255),Y.writeByte(255),Y.writeString(","),Y.writeShort(0),Y.writeShort(0),Y.writeShort(C),Y.writeShort(T),Y.writeByte(0);var X=2,ne=M(X);Y.writeByte(X);for(var oe=0;ne.length-oe>255;)Y.writeByte(255),Y.writeBytes(ne,oe,255),oe+=255;Y.writeByte(ne.length-oe),Y.writeBytes(ne,oe,ne.length-oe),Y.writeByte(0),Y.writeString(";")};var F=function(Y){var X=Y,ne=0,oe=0,ce={};return ce.write=function(se,ge){if(se>>>ge)throw"length over";for(;ne+ge>=8;)X.writeByte(255&(se<<ne|oe)),ge-=8-ne,se>>>=8-ne,oe=0,ne=0;oe=se<<ne|oe,ne=ne+ge},ce.flush=function(){ne>0&&X.writeByte(oe)},ce},M=function(Y){for(var X=1<<Y,ne=(1<<Y)+1,oe=Y+1,ce=Z(),se=0;se<X;se+=1)ce.add(String.fromCharCode(se));ce.add(String.fromCharCode(X)),ce.add(String.fromCharCode(ne));var ge=w(),le=F(ge);le.write(X,oe);var V=0,J=String.fromCharCode(D[V]);for(V+=1;V<D.length;){var re=String.fromCharCode(D[V]);V+=1,ce.contains(J+re)?J=J+re:(le.write(ce.indexOf(J),oe),ce.size()<4095&&(ce.size()==1<<oe&&(oe+=1),ce.add(J+re)),J=re)}return le.write(ce.indexOf(J),oe),le.write(ne,oe),le.flush(),ge.toByteArray()},Z=function(){var Y={},X=0,ne={};return ne.add=function(oe){if(ne.contains(oe))throw"dup key:"+oe;Y[oe]=X,X+=1},ne.size=function(){return X},ne.indexOf=function(oe){return Y[oe]},ne.contains=function(oe){return typeof Y[oe]<"u"},ne};return j},$=function(k,P,C){for(var T=S(k,P),D=0;D<P;D+=1)for(var j=0;j<k;j+=1)T.setPixel(j,D,C(j,D));var F=w();T.write(F);for(var M=E(),Z=F.toByteArray(),Y=0;Y<Z.length;Y+=1)M.writeByte(Z[Y]);return M.flush(),"data:image/gif;base64,"+M};return n}();(function(){r.stringToBytesFuncs["UTF-8"]=function(n){function i(o){for(var a=[],s=0;s<o.length;s++){var l=o.charCodeAt(s);l<128?a.push(l):l<2048?a.push(192|l>>6,128|l&63):l<55296||l>=57344?a.push(224|l>>12,128|l>>6&63,128|l&63):(s++,l=65536+((l&1023)<<10|o.charCodeAt(s)&1023),a.push(240|l>>18,128|l>>12&63,128|l>>6&63,128|l&63))}return a}return i(n)}})(),function(n){e.exports=n()}(function(){return r})})(F1);var D9=F1.exports;const pd=cn(D9);var L9=Object.defineProperty,xl=Object.getOwnPropertySymbols,B1=Object.prototype.hasOwnProperty,j1=Object.prototype.propertyIsEnumerable,R1=(e,t,r)=>t in e?L9(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,M9=(e,t)=>{for(var r in t||(t={}))B1.call(t,r)&&R1(e,r,t[r]);if(xl)for(var r of xl(t))j1.call(t,r)&&R1(e,r,t[r]);return e},F9=(e,t)=>{var r={};for(var n in e)B1.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&xl)for(var n of xl(e))t.indexOf(n)<0&&j1.call(e,n)&&(r[n]=e[n]);return r},rn=1e3,B9=/code length overflow/i;pd.stringToBytes=pd.stringToBytesFuncs["UTF-8"];var j9=(e,t,r)=>{r=Math.max(1,r);for(let n=r;n<=40;n+=1)try{const i=pd(n,t);i.addData(e),i.make();const o=i.getModuleCount();return{text:e,level:t,version:n,moduleCount:o,isDark:(s,l)=>s>=0&&s<o&&l>=0&&l<o&&i.isDark(s,l)}}catch(i){if(!(n<40&&B9.test(String(i))))throw i}return null},kn=Math.round,no=(e,t)=>`M ${kn(e)} ${kn(t)}`,zt=(e,t)=>`L ${kn(e)} ${kn(t)}`,Nn=(e,t,r)=>`A ${kn(r)} ${kn(r)} 0 0 1 ${kn(e)} ${kn(t)}`,R9=(e,t,r,n,i,o,a,s,l)=>{const u=[];return o?u.push(no(e+i,t)):u.push(no(e,t)),a?u.push(zt(r-i,t),Nn(r,t+i,i)):u.push(zt(r,t)),s?u.push(zt(r,n-i),Nn(r-i,n,i)):u.push(zt(r,n)),l?u.push(zt(e+i,n),Nn(e,n-i,i)):u.push(zt(e,n)),o?u.push(zt(e,t+i),Nn(e+i,t,i)):u.push(zt(e,t)),u.join(" ")},U9=(e,t,r,n,i,o,a,s,l)=>{const u=[];return o&&u.push(no(e+i,t),zt(e,t),zt(e,t+i),Nn(e+i,t,i)),a&&u.push(no(r,t+i),zt(r,t),zt(r-i,t),Nn(r,t+i,i)),s&&u.push(no(r-i,n),zt(r,n),zt(r,n-i),Nn(r-i,n,i)),l&&u.push(no(e,n-i),zt(e,n),zt(e+i,n),Nn(e,n-i,i)),u.join(" ")},W9=(e,t,r,n,i)=>{const o=i*r,a=n*r,s=o+r,l=a+r,u=t*.005*r,d=e.isDark,p=n-1,h=n+1,m=i-1,v=i+1,y=d(n,i),w=d(p,m),E=d(p,i),_=d(p,v),S=d(n,v),$=d(h,v),k=d(h,i),P=d(h,m),C=d(n,m);return y?R9(o,a,s,l,u,!E&&!C,!E&&!S,!k&&!S,!k&&!C):U9(o,a,s,l,u,E&&C&&w,E&&S&&_,k&&S&&$,k&&C&&P)},z9=(e,t)=>{if(!e)return"";const r=e.moduleCount,n=rn/r,i=[];for(let o=0;o<r;o+=1)for(let a=0;a<r;a+=1)i.push(W9(e,t,n,o,a));return i.join(" ")},H9=e=>{var t=e,{color:r="#000",backgroundColor:n,cutout:i=!1,cutoutElement:o,errorCorrectionLevel:a="Q",rounding:s=0,children:l}=t,u=F9(t,["color","backgroundColor","cutout","cutoutElement","errorCorrectionLevel","rounding","children"]),d,p;const h=c.useMemo(()=>j9(l,a,1),[l,a]);if(!h)return null;const m=(d=h==null?void 0:h.moduleCount)!=null?d:1,y=rn/((p=h==null?void 0:h.moduleCount)!=null?p:1)*(Math.floor(m*.18)*2-1)+2,w=(rn-y)/2;return ve.createElement("svg",M9({xmlns:"http://www.w3.org/2000/svg",viewBox:`0 0 ${rn} ${rn}`},u),i?ve.createElement("mask",{id:"react-qr-rounded__mask"},ve.createElement("rect",{x:"0",y:"0",width:rn,height:rn,fill:"#fff"}),ve.createElement("rect",{x:w,y:w,width:y,height:y,rx:s,ry:s,fill:"#000"})):null,n?ve.createElement("rect",{x:"0",y:"0",width:rn,height:rn,fill:n}):null,ve.createElement("path",{fill:r,d:z9(h,s),mask:i?"url(#react-qr-rounded__mask)":void 0}),o?ve.createElement("foreignObject",{x:w,y:w,width:y,height:y},ve.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",width:"100%",overflow:"hidden",borderRadius:s}},o)):null)};const hd=({children:e,...t})=>c.createElement(ct.View,{...t,classNames:"grow flex flex-col justify-around items-center"},e),U1=({invitationUrl:e,active:t,send:r,status:n,type:i,authCode:o,id:a})=>{const{t:s}=it("os"),l=St("invitation-manager__qr-code"),u=i===we.Type.MULTIUSE?0:p7.get(n)??0,d=u===3,p=Ff(a??""),h=c.useMemo(()=>{switch(!0){case u===5:case u<0:return"showing final";case u===3:return"showing auth code";default:return"showing qr"}},[u]);return c.createElement(c.Fragment,null,c.createElement(ct.Root,{activeView:h,classNames:"grow plb-1"},c.createElement(ct.Views,null,c.createElement(hd,{id:"showing qr",emoji:p},c.createElement("p",{className:"text-sm mlb-1 font-normal text-center"},s(i===we.Type.MULTIUSE?"invite many qr label":"invite one qr label")),c.createElement("div",{role:"none",className:ue(It,"is-full max-is-[14rem] relative")},c.createElement(H9,{rounding:100,backgroundColor:"transparent",color:"currentColor",className:ue("is-full bs-full p-2",d&&"invisible"),"aria-labelledby":l,errorCorrectionLevel:"Q",cutout:!0},e??"never"),c.createElement(EM,null,c.createElement(Bf,{text:p}))),c.createElement("span",{id:l,className:"sr-only"},s("qr label")),c.createElement(y4,{variant:"ghost",value:e??"never"})),c.createElement(hd,{id:"showing auth code"},c.createElement(jb,null,s("auth code message")),c.createElement(Fb,{code:o,large:!0,classNames:"text-black dark:text-white"}),c.createElement(jb,null,"Be sure the other device is showing this symbol:"),p&&c.createElement(Bf,{text:p})),c.createElement(hd,{id:"showing final"},u>0?c.createElement(Ye.Check,{className:ue("m-1.5",Ve(6))}):c.createElement(Ye.X,{className:ue("m-1.5",Ve(6))})))),c.createElement(qt,{classNames:"mbs-4"},c.createElement(lt,{disabled:!t,onClick:()=>r==null?void 0:r({type:"deselectInvitation"})},s("back label"))))},io="pbs-1 pbe-3 pli-3",V9=({titleId:e,title:t,identity:r,onDone:n})=>{var o;const i=vs(r.identityKey.toHex(),12);return c.createElement(jf,{titleId:e,title:t,corner:c.createElement(Bb,{onDone:n})},c.createElement(Pt.Root,{size:12,variant:"circle",status:"active"},c.createElement(Pt.Frame,{classNames:"block mbs-4 mbe-2 mli-auto chromatic-ignore"},c.createElement(Pt.Fallback,{href:i})),c.createElement(Pt.Label,{classNames:"block text-center font-light text-xl","data-testid":"identityHeading.displayName"},((o=r.profile)==null?void 0:o.displayName)??Fs(r.identityKey.toHex()))))},W1=e=>{const{identity:t,titleId:r,activeView:n,onUpdateProfile:i,onResetDevice:o,onJoinNewIdentity:a,IdentityActionChooser:s=A9,InvitationManager:l=U1,onDone:u,...d}=e,{t:p}=it("os"),h=c.useMemo(()=>{switch(n){case"agent manager":return"Manage Agent";case"device invitation manager":return p("choose add device label");default:return p("identity heading")}},[n,p]);return c.createElement(Oi,{density:"fine"},c.createElement(V9,{identity:t,titleId:r,title:h,onDone:u}),c.createElement(ct.Root,{activeView:n},c.createElement(ct.Views,null,c.createElement(ct.View,{id:"identity action chooser",classNames:io},c.createElement(s,{active:n==="identity action chooser",...d})),c.createElement(ct.View,{id:"device invitation manager",classNames:io},c.createElement(l,{active:n==="device invitation manager",...d,invitationUrl:d.createInvitationUrl(d.invitationCode)})),c.createElement(ct.View,{id:"device manager",classNames:io},c.createElement(C9,{active:n==="device manager",...d})),c.createElement(ct.View,{classNames:io,id:"update profile form"},c.createElement(T9,{send:d.send,active:n==="update profile form",profile:t.profile,onUpdateProfile:i})),c.createElement(ct.View,{classNames:io,id:"signing out"},c.createElement(P9,{send:d.send,active:n==="signing out",onResetDevice:o,onJoinNewIdentity:a})),c.createElement(ct.View,{classNames:io,id:"agent manager"},c.createElement($9,{send:d.send,active:n==="agent manager",...d})))))},G9=({invitation:e,...t})=>{const r=xf(e);return c.createElement(W1,{...t,...r})},K9=({titleId:e,createInvitationUrl:t=n=>n,...r})=>{const n=St("identityPanel__heading",e),i=qe.useClient(),o=vo.useDevices(),a=vo.useIdentity(),s=vo.useHaloInvitations(),l=N9({client:i,identity:a,invitations:s});if(!a)return console.error("IdentityPanel rendered with no active identity."),null;const[u,d,p]=S9(i);c.useEffect(()=>p.subscribe(w=>{tt("[state]",w)}).unsubscribe,[p]);const h=c.useMemo(()=>{switch(!0){case u.matches("choosingAction"):return"identity action chooser";case u.matches("managingDeviceInvitation"):return"device invitation manager";case u.matches("managingDevices"):return"device manager";case[{managingProfile:"idle"},{managingProfile:"pending"}].some(u.matches):return"update profile form";case u.matches("signingOut"):return"signing out";case[{managingAgent:"idle"},{managingAgent:"pending"}].some(u.matches):return"agent manager";default:return"identity action chooser"}},[u]),v={...r,identity:a,devices:o,activeView:h,send:d,titleId:n,createInvitationUrl:t,onUpdateProfile:async y=>{d({type:"updateProfile"}),await i.halo.updateProfile(y)},...l};return u.context.invitation?c.createElement(G9,{...v,invitation:u.context.invitation}):c.createElement(W1,{...v})},q9=c.forwardRef(({mode:e,titleId:t,onExit:r,exitActionParent:n},i)=>{const{t:o}=it("os"),a=c.createElement(wr,{variant:"ghost",...r&&{onClick:r},classNames:ue(It,"plb-0 pli-2 absolute block-start-0 inline-end-0 z-[1]"),"data-testid":"join-exit"},c.createElement(Ye.X,{weight:"bold",className:Ve(4)}),c.createElement("span",{className:"sr-only"},o("exit label")));return c.createElement(jf,{ref:i,titleId:t,title:o(e==="halo-only"?"selecting identity heading":"joining space heading"),...e==="halo-only"?{titleSrOnly:!0}:{corner:n?c.cloneElement(n,{},a):a},titleSrOnly:e==="halo-only"})}),z1=(e,t)=>(tt("[subscribing to invitation]",t),{subscribe:(r,n,i)=>t.subscribe(o=>{switch(o.state){case we.State.CONNECTING:return tt("[invitation connecting]",{Kind:e,invitation:o}),r({type:`connecting${e}Invitation`,invitation:o});case we.State.CONNECTED:return tt("[invitation connected]",{Kind:e,invitation:o}),r({type:`connected${e}Invitation`,invitation:o});case we.State.READY_FOR_AUTHENTICATION:return tt("[invitation ready for authentication]",{Kind:e,invitation:o}),r({type:`readyForAuthentication${e}Invitation`,invitation:o});case we.State.AUTHENTICATING:return tt("[invitation authenticating]",{Kind:e,invitation:o}),r({type:`authenticating${e}Invitation`,invitation:o});case we.State.SUCCESS:return tt("[invitation success]",{Kind:e,invitation:o}),r({type:`success${e}Invitation`,invitation:o}),i==null?void 0:i();case we.State.CANCELLED:return tt.warn("[invitation cancelled]",{Kind:e}),r({type:`fail${e}Invitation`,reason:"cancelled"});case we.State.TIMEOUT:return tt.error("[invitation timeout]",{Kind:e}),r({type:`fail${e}Invitation`,reason:"timeout"})}},o=>o instanceof qe.AlreadyJoinedError?(tt("[already joined]",{Kind:e,error:o}),r({type:`success${e}Invitation`,invitation:t.get()}),i==null?void 0:i()):(tt.error("[invitation errored]",{Kind:e,error:o}),r({type:`fail${e}Invitation`,reason:"error"}),n==null?void 0:n(o)))}),H1=(e,t)=>({initial:`unknown${e}`,states:{[`unknown${e}`]:{always:[{cond:({mode:n})=>n==="halo-only"&&e==="Space",target:"#join.finishingJoiningHalo"},{cond:n=>!!n[e.toLowerCase()].unredeemedCode,target:`acceptingRedeemed${e}Invitation`,actions:[`redeem${e}InvitationCode`,`invalidate${e}InvitationCode`,"log"]},{target:`inputting${e}InvitationCode`,actions:"log"}]},[`inputting${e}InvitationCode`]:{},[`acceptingRedeemed${e}Invitation`]:{invoke:{src:n=>n[e.toLowerCase()].invitationSubscribable},initial:`unknown${e}Invitation`,states:{[`unknown${e}Invitation`]:{always:[{cond:n=>{var i,o;if(e!=="Space")return!1;{const a=(o=(i=n.space.invitation)==null?void 0:i.spaceKey)==null?void 0:o.toHex(),s=n.space.succeededKeys;return a?!!(s!=null&&s.has(a)):!1}},target:t,actions:"log"},{cond:n=>{const i=n[e.toLowerCase()].invitation;return!i||(i==null?void 0:i.state)===we.State.CONNECTING},target:`connecting${e}Invitation`,actions:"log"},{target:`inputting${e}VerificationCode`,actions:"log"}]},[`connecting${e}Invitation`]:{},[`inputting${e}VerificationCode`]:{},[`authenticating${e}VerificationCode`]:{on:{[`readyForAuthentication${e}Invitation`]:{target:`authenticationFailing${e}VerificationCode`,actions:["setInvitation","log"]}}},[`authenticationFailing${e}VerificationCode`]:{},[`failing${e}Invitation`]:{},[`success${e}Invitation`]:{}},on:{[`reset${e}Invitation`]:{target:`#join${e==="Halo"?".choosingIdentity":""}.accepting${e}Invitation.unknown${e}`,actions:["resetInvitation","log"]},[`connecting${e}Invitation`]:{target:`.connecting${e}Invitation`,actions:["setInvitation","log"]},[`connected${e}Invitation`]:{target:`.connecting${e}Invitation`,actions:["setInvitation","log"]},[`readyForAuthentication${e}Invitation`]:{target:`.inputting${e}VerificationCode`,actions:["setInvitation","log"]},[`authenticating${e}Invitation`]:{target:`.authenticating${e}VerificationCode`,actions:["setInvitation","log"]},[`success${e}Invitation`]:{target:t,actions:["setInvitation","log"]},[`fail${e}Invitation`]:{target:`.failing${e}Invitation`,actions:[Yt({[e.toLowerCase()]:(n,i)=>({...n[e.toLowerCase()],failReason:i.reason})}),"log"]}}}},on:{[`set${e}InvitationCode`]:{target:`.acceptingRedeemed${e}Invitation`,actions:[Yt({[e.toLowerCase()]:(n,i)=>({...n[e.toLowerCase()],unredeemedCode:i.code,succeededKeys:i.succeededKeys})}),`redeem${e}InvitationCode`,`invalidate${e}InvitationCode`,"log"]}}}),Y9=fd({id:"join",predictableActionArguments:!0,context:{mode:"default",identity:null,halo:{},space:{}},initial:"unknown",states:{unknown:{always:[{cond:"existingIdentity",target:"resettingIdentity",actions:"log"},{cond:"noSelectedIdentity",target:"choosingIdentity",actions:"log"},{target:"acceptingSpaceInvitation",actions:"log"}]},choosingIdentity:{initial:"unknownAuthMethod",states:{unknownAuthMethod:{always:[{cond:"hasHaloUnredeemedCode",target:"acceptingHaloInvitation",actions:"log"},{target:"choosingAuthMethod",actions:"log"}]},choosingAuthMethod:{},recoveringIdentity:{},creatingIdentity:{},acceptingHaloInvitation:H1("Halo","#join.acceptingSpaceInvitation"),confirmingAddedIdentity:{}},on:{recoverIdentity:{target:".recoveringIdentity",actions:"log"},createIdentity:{target:".creatingIdentity",actions:"log"},acceptHaloInvitation:{target:".acceptingHaloInvitation",actions:"log"},addIdentity:{target:".confirmingAddedIdentity",actions:"log"},selectIdentity:{target:"acceptingSpaceInvitation",actions:["setIdentity","log"]},deselectAuthMethod:{target:".choosingAuthMethod",actions:"log"}}},resettingIdentity:{},acceptingSpaceInvitation:H1("Space","#join.finishingJoiningSpace"),finishingJoiningSpace:{type:"final"},finishingJoiningHalo:{type:"final"}},on:{resetIdentity:{target:"choosingIdentity",actions:"unsetIdentity"}}},{guards:{existingIdentity:({identity:e,mode:t},r)=>t==="halo-only"&&!!e,noSelectedIdentity:({identity:e},t)=>!e,hasHaloUnredeemedCode:({halo:e},t)=>!!e.unredeemedCode,noSpaceInvitation:({space:e},t)=>!e.invitation&&!e.unredeemedCode},actions:{setIdentity:Yt({identity:(e,t)=>t.identity}),unsetIdentity:Yt({identity:()=>null}),resetInvitation:Yt({halo:(e,t)=>t.type!=="resetHaloInvitation"?e.halo:(e.halo.invitationObservable&&e.halo.invitationObservable.cancel(),{...e.halo,invitation:void 0,invitationObservable:void 0,invitationSubscribable:void 0}),space:(e,t)=>t.type!=="resetSpaceInvitation"?e.space:(e.space.invitationObservable&&e.space.invitationObservable.cancel(),{...e.space,invitation:void 0,invitationObservable:void 0,invitationSubscribable:void 0})}),setInvitation:Yt({halo:(e,t)=>t.type.includes("Halo")?{...e.halo,invitation:t.invitation}:e.halo,space:(e,t)=>t.type.includes("Space")?{...e.space,invitation:t.invitation}:e.space}),log:(e,t)=>{tt("[transition]",{event:t,haloInvitation:e.halo.invitation,spaceInvitation:e.space.invitation})}}}),V1=(e,t)=>{try{const r=new URLSearchParams(t.substring(t.lastIndexOf("?")));return r.get(`${e}InvitationCode`)??r.get(`${e}Invitation`)??r.get("invitationCode")??r.get("invitation")??t}catch(r){return tt.catch(r),t}},J9=(e,t)=>{const r=c.useCallback(({halo:a})=>{if(a.unredeemedCode)try{const s=ln.InvitationEncoder.decode(V1("halo",a.unredeemedCode)),l=e.halo.join(s);return{...a,invitationObservable:l,invitationSubscribable:z1("Halo",l)}}catch(s){return tt.error("Could not redeem device invitation code",s),a}else return a},[e]),n=c.useCallback(({space:a})=>{if(a.unredeemedCode)try{const s=ln.InvitationEncoder.decode(V1("space",a.unredeemedCode)),l=e.spaces.join(s);return{...a,invitationObservable:l,invitationSubscribable:z1("Space",l)}}catch(s){return tt.error("Could not redeem space invitation code",s),a}else return a},[e]),i=c.useCallback(({halo:a})=>{var s;return a.unredeemedCode?((s=t==null?void 0:t.onInvalidateInvitationCode)==null||s.call(t,a.unredeemedCode),{...a,unredeemedCode:void 0}):a},[t==null?void 0:t.onInvalidateInvitationCode]),o=c.useCallback(({space:a})=>{var s;return a.unredeemedCode?((s=t==null?void 0:t.onInvalidateInvitationCode)==null||s.call(t,a.unredeemedCode),{...a,unredeemedCode:void 0}):a},[t==null?void 0:t.onInvalidateInvitationCode]);return dd(Y9,{...t,actions:{...t==null?void 0:t.actions,redeemHaloInvitationCode:Yt({halo:r}),redeemSpaceInvitationCode:Yt({space:n}),invalidateHaloInvitationCode:Yt({halo:i}),invalidateSpaceInvitationCode:Yt({space:o})}})},X9=e=>{const t=!e.active,{send:r}=e,{t:n}=it("os"),i={disabled:t,after:c.createElement(Ye.CaretRight,{className:Ve(4),weight:"bold"}),slots:{label:{className:"text-sm"}}};return c.createElement(c.Fragment,null,c.createElement(xr,null,n("addition method chooser title")),c.createElement("div",{role:"none",className:"flex flex-col gap-1 grow"},c.createElement(Au,{...i,description:n("create identity description"),before:c.createElement(Ye.Plus,{className:Ve(6)}),onClick:()=>r({type:"createIdentity"}),"data-autofocus":"choosingAuthMethod","data-testid":"identity-chooser.create-identity"},n("create identity label")),c.createElement(Au,{...i,description:n("join identity description"),before:c.createElement(Ye.QrCode,{className:Ve(6)}),onClick:()=>r({type:"acceptHaloInvitation"}),"data-testid":"identity-chooser.join-identity"},n("join identity label")),c.createElement(Au,{...i,disabled:!0,description:n("recover identity description"),before:c.createElement(Ye.Textbox,{className:Ve(6)}),onClick:()=>r({type:"recoverIdentity"}),"data-testid":"identity-chooser.recover-identity"},n("recover identity label"))))},Z9=e=>{var v,y;const{mode:t,addedIdentity:r,active:n,send:i,onDone:o,doneActionParent:a}=e,s=!n,{t:l}=it("os"),u=r==null?void 0:r.identityKey.toHex(),d=St("identityListItem__label"),p=vs(u??"",12),h=((v=r==null?void 0:r.profile)==null?void 0:v.displayName)??(r&&Fs(r==null?void 0:r.identityKey.toHex())),m=c.createElement(lt,{...o&&{onClick:()=>o(null)},disabled:s,"data-autofocus":"confirmingAddedIdentity","data-testid":"identity-added-done"},c.createElement("span",null,l("done label")));return c.createElement(c.Fragment,null,c.createElement(xr,null,l("identity added label")),c.createElement("div",{role:"none",className:"grow flex flex-col items-center justify-center text-center gap-2"},c.createElement(Pt.Root,{status:"active",labelId:d},c.createElement(Pt.Frame,null,c.createElement(Pt.Fallback,{href:p})),c.createElement(Pt.Label,{classNames:ue("text-lg truncate",!((y=r==null?void 0:r.profile)!=null&&y.displayName)&&"font-mono")},h))),c.createElement(qt,null,t==="halo-only"?a?c.cloneElement(a,{},m):m:c.createElement(lt,{variant:"primary",disabled:s||!r,onClick:()=>r&&i({type:"selectIdentity",identity:r}),"data-autofocus":"confirmingAddedIdentity"},l("continue label"))))},Q9=e=>{const{send:t,method:r}=e,n=r==="recover identity",i=qe.useClient(),{t:o}=it("os"),[a,s]=c.useState(""),l=u=>{i.halo.createIdentity({[n?"seedphrase":"displayName"]:u}).then(d=>{t==null||t({type:"selectIdentity",identity:d})},d=>{tt.catch(d),s(o(n?"failed to recover identity message":"failed to create identity message"))})};return c.createElement(eB,{...e,onDisplayNameConfirm:l,validationMessage:a})},eB=e=>{const{method:t,send:r,active:n,onDisplayNameConfirm:i,validationMessage:o}=e,a=!n,{t:s}=it("os"),[l,u]=c.useState(""),d=t==="recover identity";return c.createElement(c.Fragment,null,c.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},c.createElement(ra,{validationMessage:o,label:c.createElement(xr,null,s(d?"recover identity input label":"new identity input label")),disabled:a,"data-testid":"identity-input",placeholder:d?"Type your recovery phrase":"Type a display name",onChange:({target:{value:p}})=>u(p)})),c.createElement(qt,null,c.createElement(lt,{variant:"ghost",disabled:a,onClick:()=>r==null?void 0:r({type:"deselectAuthMethod"}),"data-testid":`${t==="recover identity"?"recover":"create"}-identity-input-back`},s("back label")),c.createElement(lt,{variant:"primary",disabled:a,onClick:()=>i==null?void 0:i(l),"data-testid":`${t==="recover identity"?"recover":"create"}-identity-input-continue`},s("continue label"))))},G1=e=>{const{active:t,Kind:r,doneActionParent:n,onDone:i}=e,o=!t,{t:a}=it("os"),s=c.createElement(lt,{variant:"primary",onClick:i,disabled:o,"data-autofocus":`success${r}Invitation finishingJoining${r}`,"data-testid":`${r.toLowerCase()}-invitation-accepted-done`},a("done label"));return c.createElement(c.Fragment,null,c.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},c.createElement("p",{className:"text-center text-sm font-normal"},a("welcome message"))),c.createElement(qt,null,n?c.cloneElement(n,{},s):s))},tB=e=>{try{const t=new URLSearchParams(e.substring(e.lastIndexOf("?")));return t.get("spaceInvitationCode")??t.get("deviceInvitationCode")??e}catch(t){return tt.catch(t),e}},K1=e=>{const{Kind:t,active:r,send:n,unredeemedCode:i,onExit:o,exitActionParent:a,onDone:s,doneActionParent:l,succeededKeys:u}=e,d=!r,{t:p}=it("os"),[h,m]=c.useState(i??"");c.useEffect(()=>{i&&m(i??"")},[i]);const v=()=>{h.trim().length!==0&&n({type:`set${t}InvitationCode`,code:tB(h),...t==="Space"&&{succeededKeys:u}})},y=c.createElement(lt,{variant:"ghost",disabled:d,...o?{onClick:()=>o()}:{onClick:()=>s==null?void 0:s(null)},"data-testid":"join-exit"},p("cancel label"));return c.createElement(c.Fragment,null,c.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},c.createElement(ra,{label:c.createElement(xr,null,p("invitation input label")),placeholder:"Type an invitation code",disabled:d,value:h,onChange:({target:{value:w}})=>m(w),"data-autofocus":`inputting${t}InvitationCode`,"data-testid":`${t.toLowerCase()}-invitation-input`,onKeyUp:({key:w})=>w==="Enter"&&v()})),c.createElement(qt,null,t==="Halo"?c.createElement(lt,{variant:"ghost",disabled:d,onClick:()=>n({type:"deselectAuthMethod"}),"data-testid":`${t.toLowerCase()}-invitation-input-back`},p("back label")):a?c.cloneElement(a,{},y):l?c.cloneElement(l,{},y):y,c.createElement(lt,{variant:"primary",disabled:d,onClick:v,"data-testid":`${t.toLowerCase()}-invitation-input-continue`},p("continue label"))))},rB=({invitationState:e,onInvitationCancel:t,active:r,send:n,Kind:i,failReason:o})=>{const{t:a}=it("os");return o?c.createElement(c.Fragment,null,c.createElement(xr,{className:It},a(o==="timeout"?"timeout status label":o==="cancelled"?"cancelled status label":"error status label")),c.createElement("div",{role:"none",className:"grow"}),c.createElement(qt,null,c.createElement(lt,{disabled:!r,onClick:()=>n({type:`reset${i}Invitation`}),"data-testid":"invitation-rescuer-reset"},a("reset label")))):c.createElement(c.Fragment,null,c.createElement(xr,{className:It},a("connecting status label")),c.createElement("div",{role:"none",className:"grow"}),c.createElement(qt,null,c.createElement(lt,{disabled:!0,classNames:"order-2","data-testid":"next"},a("next label")),c.createElement(lt,{disabled:!r,onClick:t,"data-testid":"invitation-rescuer-cancel"},a("cancel label"))))},q1=e=>{const{Kind:t,invitationState:r,active:n,send:i}=e,{t:o}=it("os");return c.createElement(c.Fragment,null,typeof r>"u"?c.createElement(c.Fragment,null,c.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},c.createElement(xr,{className:It},"There was a problem joining the space")),c.createElement(qt,null,c.createElement(lt,{disabled:!n,"data-testid":"invitation-rescuer-blank-reset",onClick:()=>i({type:`reset${t}Invitation`})},o("reset label")))):c.createElement(rB,{...e}))},Y1=6,J1=({failed:e,Kind:t,active:r,pending:n,invitationId:i,onInvitationAuthenticate:o,onInvitationCancel:a})=>{const s=!r||n,{t:l}=it("os"),u=t.toLowerCase(),[d,p]=c.useState(""),h=({target:{value:m}})=>{var v;p(m),m.length===Y1&&((v=document.querySelector(`[data-autofocus-pinlength="${u}"]`))==null||v.focus())};return c.createElement(c.Fragment,null,c.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},i&&c.createElement(Bf,{text:Ff(i)}),c.createElement(Br.Root,{...e&&{validationValence:"error"}},c.createElement(Br.Label,{asChild:!0},c.createElement(xr,null,l("auth code input label"))),c.createElement(Br.PinInput,{disabled:s,length:Y1,onChange:h,inputMode:"numeric",autoComplete:"off",pattern:"\\d*","data-autofocus":`connecting${t}Invitation inputting${t}VerificationCode authenticationFailing${t}VerificationCode authenticating${t}VerificationCode`,"data-prevent-ios-autofocus":!0,"data-testid":`${u}-auth-code-input`,"data-1p-ignore":!0}),e&&c.createElement(Br.DescriptionAndValidation,{classNames:"text-center"},c.createElement(Br.Validation,null,l("failed to authenticate message"))))),c.createElement(qt,null,c.createElement(lt,{variant:"ghost",disabled:s,onClick:()=>a==null?void 0:a(),"data-testid":`${u}-invitation-authenticator-cancel`},l("cancel label")),c.createElement(lt,{variant:"primary",disabled:s,onClick:()=>o==null?void 0:o(d),"data-autofocus-pinlength":u,"data-testid":`${u}-invitation-authenticator-next`},l("next label"))))},nB=({send:e,active:t})=>{const r=qe.useClient(),{t:n}=it("os"),[i,o]=c.useState(""),a=()=>{r.reset().then(()=>e==null?void 0:e({type:"resetIdentity"}),s=>{tt.catch(s),o(n("failed to reset identity message"))})};return c.createElement(iB,{disabled:!t,validationMessage:i,onConfirm:()=>a()})},iB=({disabled:e,validationMessage:t,onConfirm:r})=>{const{t:n}=it("os"),i=n("confirmation value"),[o,a]=c.useState("");return c.createElement(c.Fragment,null,c.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},c.createElement(ra,{validationMessage:t,label:c.createElement(xr,null,n("reset identity input label",{confirmationValue:i})),disabled:e,"data-testid":"reset-identity-input",placeholder:i,onChange:({target:{value:s}})=>a(s)})),c.createElement(qt,null,c.createElement(lt,{variant:"primary",disabled:e||o!==i,onClick:()=>r==null?void 0:r(),"data-testid":"reset-identity-input-confirm"},n("confirm label"))))},Jt="pbs-1 pbe-3 pli-3",oB=e=>{const{titleId:t,send:r,activeView:n,failed:i,mode:o,unredeemedCodes:a,invitationStates:s,succeededKeys:l,failReasons:u,onExit:d,onHaloDone:p,onSpaceDone:h,exitActionParent:m,doneActionParent:v,onHaloInvitationCancel:y,onSpaceInvitationCancel:w,onHaloInvitationAuthenticate:E,onSpaceInvitationAuthenticate:_,IdentityInput:S=Q9,ResetIdentity:$=nB}=e;return c.createElement(Oi,{density:"fine"},o!=="halo-only"&&c.createElement(q9,{titleId:t,mode:o,onExit:d,exitActionParent:m}),c.createElement(ct.Root,{focusManaged:!0,activeView:n},c.createElement(ct.Views,null,c.createElement(ct.View,{classNames:Jt,id:"addition method chooser"},c.createElement(X9,{send:r,active:n==="addition method chooser"})),c.createElement(ct.View,{classNames:Jt,id:"reset identity confirmation"},c.createElement($,{send:r,method:"reset identity",active:n==="reset identity confirmation"})),c.createElement(ct.View,{classNames:Jt,id:"create identity input"},c.createElement(S,{send:r,method:"create identity",active:n==="create identity input"})),c.createElement(ct.View,{classNames:Jt,id:"recover identity input"},c.createElement(S,{send:r,method:"recover identity",active:n==="recover identity input"})),c.createElement(ct.View,{classNames:Jt,id:"halo invitation input"},c.createElement(K1,{send:r,Kind:"Halo",active:n==="halo invitation input",...(a==null?void 0:a.Halo)&&{unredeemedCode:a.Halo},...(l==null?void 0:l.Halo)&&{succeededKeys:l.Halo}})),c.createElement(ct.View,{classNames:Jt,id:"halo invitation rescuer"},c.createElement(q1,{send:r,Kind:"Halo",active:n==="halo invitation rescuer",invitationState:s==null?void 0:s.Halo,onInvitationCancel:y,failReason:u==null?void 0:u.Halo})),c.createElement(ct.View,{classNames:Jt,id:"halo invitation authenticator"},c.createElement(J1,{send:r,Kind:"Halo",active:n==="halo invitation authenticator",onInvitationCancel:y,onInvitationAuthenticate:E,...i.has("Halo")&&{failed:!0}})),c.createElement(ct.View,{classNames:Jt,id:"halo invitation accepted"},c.createElement(G1,{send:r,Kind:"Halo",active:n==="halo invitation accepted",doneActionParent:v,onDone:p})),c.createElement(ct.View,{classNames:Jt,id:"identity added"},c.createElement(Z9,{send:r,mode:o,active:n==="identity added",doneActionParent:v,onDone:p})),c.createElement(ct.View,{classNames:Jt,id:"space invitation input"},c.createElement(K1,{send:r,Kind:"Space",active:n==="space invitation input",...(a==null?void 0:a.Space)&&{unredeemedCode:a.Space},...(l==null?void 0:l.Space)&&{succeededKeys:l.Space},onExit:d,exitActionParent:m})),c.createElement(ct.View,{classNames:Jt,id:"space invitation rescuer"},c.createElement(q1,{send:r,Kind:"Space",active:n==="space invitation rescuer",invitationState:s==null?void 0:s.Space,onInvitationCancel:w,failReason:u==null?void 0:u.Space})),c.createElement(ct.View,{classNames:Jt,id:"space invitation authenticator"},c.createElement(J1,{send:r,Kind:"Space",active:n==="space invitation authenticator",onInvitationCancel:w,onInvitationAuthenticate:_,...i.has("Space")&&{failed:!0}})),c.createElement(ct.View,{classNames:Jt,id:"space invitation accepted"},c.createElement(G1,{send:r,Kind:"Space",active:n==="space invitation accepted",doneActionParent:v,onDone:h})))))},aB=({titleId:e,mode:t="default",initialInvitationCode:r,exitActionParent:n,onExit:i,doneActionParent:o,onDone:a})=>{const s=qe.useClient(),l=vo.useIdentity(),{hasIosKeyboard:u}=Pe(),d=St("joinPanel__heading",e),[p,h,m]=J9(s,{context:{mode:t,identity:l,...r&&{[t==="halo-only"?"halo":"space"]:{unredeemedCode:r}}}});c.useEffect(()=>m.subscribe(T=>{tt("[state]",T)}).unsubscribe,[m]),c.useEffect(()=>{const C=p.configuration[0].id.split("."),T=C[C.length-1],D=T==="finishingJoining"?"successSpaceInvitation":T,j=document.querySelector(`[data-autofocus~="${D}"]`);j&&!(u&&j.hasAttribute("data-prevent-ios-autofocus"))&&j.focus()},[p.value,u]);const v=c.useMemo(()=>{switch(!0){case p.matches({choosingIdentity:"choosingAuthMethod"}):return"addition method chooser";case p.matches("resettingIdentity"):return"reset identity confirmation";case p.matches({choosingIdentity:"creatingIdentity"}):return"create identity input";case p.matches({choosingIdentity:"recoveringIdentity"}):return"recover identity input";case p.matches({choosingIdentity:{acceptingHaloInvitation:"inputtingHaloInvitationCode"}}):return"halo invitation input";case[{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"connectingHaloInvitation"}}},{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"failingHaloInvitation"}}}].some(p.matches):return"halo invitation rescuer";case[{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"inputtingHaloVerificationCode"}}},{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"authenticatingHaloVerificationCode"}}},{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"authenticationFailingHaloVerificationCode"}}}].some(p.matches):return"halo invitation authenticator";case[{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"successHaloInvitation"}}},"finishingJoiningHalo"].some(p.matches):return"halo invitation accepted";case p.matches({choosingIdentity:"confirmingAddedIdentity"}):return"identity added";case p.matches({acceptingSpaceInvitation:"inputtingSpaceInvitationCode"}):return"space invitation input";case[{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"connectingSpaceInvitation"}},{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"failingSpaceInvitation"}}].some(p.matches):return"space invitation rescuer";case[{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"inputtingSpaceVerificationCode"}},{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"authenticatingSpaceVerificationCode"}},{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"authenticationFailingSpaceVerificationCode"}}].some(p.matches):return"space invitation authenticator";case p.matches("finishingJoiningSpace"):return"space invitation accepted";default:return"never"}},[p]),y=c.useMemo(()=>{const C=new Set;switch(!0){case p.matches({choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"authenticationFailingHaloVerificationCode"}}}):C.add("Halo");break;case p.matches({acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"authenticationFailingSpaceVerificationCode"}}):C.add("Space");break}return C},[p]),w=c.useMemo(()=>({Halo:p.context.halo.unredeemedCode,Space:p.context.space.unredeemedCode}),[p]),E=qe.useMulticastObservable(s.spaces),_=c.useMemo(()=>({Space:E?new Set(E.map(({key:C})=>C.toHex())):void 0}),[E]),S=c.useMemo(()=>{var C,T;return{Halo:(C=p.context.halo.invitationObservable)==null?void 0:C.get().state,Space:(T=p.context.space.invitationObservable)==null?void 0:T.get().state}},[p]),$=c.useMemo(()=>({Halo:p.context.halo.failReason,Space:p.context.space.failReason}),[p]),k=c.useCallback(()=>{var C,T,D,j;a==null||a({identityKey:((C=p.context.halo.invitation)==null?void 0:C.identityKey)??null,swarmKey:((T=p.context.halo.invitation)==null?void 0:T.swarmKey)??null,spaceKey:((D=p.context.halo.invitation)==null?void 0:D.spaceKey)??null,target:((j=p.context.halo.invitation)==null?void 0:j.target)??null})},[p,a]),P=c.useCallback(()=>{var C,T,D,j;a==null||a({identityKey:((C=p.context.space.invitation)==null?void 0:C.identityKey)??null,swarmKey:((T=p.context.space.invitation)==null?void 0:T.swarmKey)??null,spaceKey:((D=p.context.space.invitation)==null?void 0:D.spaceKey)??null,target:((j=p.context.space.invitation)==null?void 0:j.target)??null})},[p,a]);return c.createElement(oB,{titleId:d,mode:t,send:h,activeView:v,failed:y,failReasons:$,pending:["connecting","authenticating"].some(C=>p==null?void 0:p.configuration[0].id.includes(C)),unredeemedCodes:w,invitationStates:S,succeededKeys:_,identity:l,onExit:i,exitActionParent:n,doneActionParent:o,onHaloDone:k,onSpaceDone:P,onHaloInvitationCancel:()=>{var C;return(C=p.context.halo.invitationObservable)==null?void 0:C.cancel()},onSpaceInvitationCancel:()=>{var C;return(C=p.context.space.invitationObservable)==null?void 0:C.cancel()},onHaloInvitationAuthenticate:C=>{var T;return h({type:"authenticateHaloVerificationCode"}),(T=p.context.halo.invitationObservable)==null?void 0:T.authenticate(C)},onSpaceInvitationAuthenticate:C=>{var T;return h({type:"authenticateSpaceVerificationCode"}),(T=p.context.space.invitationObservable)==null?void 0:T.authenticate(C)}})},sB=fd({id:"space",predictableActionArguments:!0,context:{space:null},initial:"managingSpace",states:{managingSpace:{},managingSpaceInvitation:{}},on:{deselectInvitation:{target:".managingSpace",actions:["unsetInvitation","log"]},selectInvitation:{target:".managingSpaceInvitation",actions:["setInvitation","log"]}}},{actions:{setInvitation:Yt({invitation:(e,t)=>(t==null?void 0:t.invitation)??null}),unsetInvitation:Yt({invitation:()=>{}}),log:(e,t)=>{tt("[transition]",{event:t,context:e})}}}),lB=e=>dd(sB,{...e,context:{...e==null?void 0:e.context}}),X1="dxos:react-shell/space-manager/active-action",cB=e=>{const{space:t,target:r}=e,{t:n}=it("os"),i=qe.useConfig(),o=Ca.useSpaceInvitations(t==null?void 0:t.key),a=c.useCallback(l=>{const u=ln.InvitationEncoder.encode(l);l.state===we.State.CONNECTING&&console.log(JSON.stringify({invitationCode:u,authCode:l.authCode}))},[]),s={inviteOne:{label:n("invite one label"),description:n("invite one description"),icon:Ye.UserPlus,onClick:c.useCallback(()=>{var u,d,p,h;const l=(u=t.share)==null?void 0:u.call(t,{type:we.Type.INTERACTIVE,authMethod:we.AuthMethod.SHARED_SECRET,target:r});l&&((h=(p=(d=i.values.runtime)==null?void 0:d.app)==null?void 0:p.env)==null?void 0:h.DX_ENVIRONMENT)!=="production"&&l.subscribe(a)},[t])},inviteMany:{label:n("invite many label"),description:n("invite many description"),icon:Ye.UsersThree,onClick:c.useCallback(()=>{var u,d,p,h;const l=(u=t.share)==null?void 0:u.call(t,{type:we.Type.MULTIUSE,authMethod:we.AuthMethod.NONE,target:r});l&&((h=(p=(d=i.values.runtime)==null?void 0:d.app)==null?void 0:p.env)==null?void 0:h.DX_ENVIRONMENT)!=="production"&&l.subscribe(a)},[t])}};return c.createElement(uB,{...e,invitations:o,inviteActions:s})},Z1="pis-3 pie-1 plb-1 mbe-1 font-medium",uB=e=>{const{active:t,space:r,createInvitationUrl:n,send:i,inviteActions:o,invitations:a,showInactiveInvitations:s,SpaceMemberList:l=E4,InvitationList:u=yM}=e,{t:d}=it("os"),p=o??{noopInvite:{label:d("create space invitation label"),description:"",icon:Ye.Placeholder,onClick:()=>{}}},[h,m]=c.useState(localStorage.getItem(X1)??"inviteOne"),v=w=>{m(w),localStorage.setItem(X1,w)},y=s?a:a==null?void 0:a.filter(w=>![we.State.CANCELLED].includes(w.get().state));return c.createElement(c.Fragment,null,c.createElement(ys.Root,{classNames:"grow shrink basis-28 -mli-2"},c.createElement(ys.Viewport,{classNames:"is-full pie-2"},!!(y!=null&&y.length)&&c.createElement(c.Fragment,null,c.createElement("h3",{className:ue(Z1,It)},d("invitation list heading")),c.createElement(u,{className:"mb-2",send:i,invitations:y??[],onClickRemove:w=>w.cancel(),createInvitationUrl:n}),c.createElement("h3",{className:ue(Z1,It,"mbs-2")},d("space member list heading"))),c.createElement(l,{spaceKey:r.key,includeSelf:!0})),c.createElement(ys.Scrollbar,{orientation:"vertical"},c.createElement(ys.Thumb,null))),c.createElement(qt,null,c.createElement(wM,{disabled:!t,actions:p,activeAction:h,onChangeActiveAction:v,"data-testid":"spaces-panel.create-invitation"})))},fB=({titleId:e,space:t,onDone:r})=>{const{t:n}=it("os"),i=t.properties.name;return c.createElement(jf,{titleId:e,title:n("space panel heading"),corner:c.createElement(Bb,{"data-testid":"identity-panel-done",onDone:r})},c.createElement("div",{role:"none",className:"flex gap-4 items-center justify-center mlb-4"},c.createElement(Ye.Planet,{size:32}),c.createElement("div",{className:"block text-start font-light text-xl"},i??t.key.truncate())))},Q1=e=>{const{titleId:t,activeView:r,space:n,target:i,SpaceManager:o=cB,InvitationManager:a=U1,...s}=e;return c.createElement(Oi,{density:"fine"},c.createElement(fB,{...s,titleId:t,space:n}),c.createElement(ct.Root,{activeView:r},c.createElement(ct.Views,null,c.createElement(ct.View,{id:"space manager",classNames:Jt},c.createElement(o,{active:r==="space manager",space:n,target:i,...s})),c.createElement(ct.View,{id:"space invitation manager",classNames:Jt},c.createElement(a,{active:r==="space invitation manager",...s,invitationUrl:e.invitationUrl})))))},dB=({invitation:e,...t})=>{const r=xf(e);return c.createElement(Q1,{...t,...r,invitationUrl:t.createInvitationUrl(r.invitationCode)})},pB=({titleId:e,createInvitationUrl:t=n=>n,...r})=>{const n=St("spacePanel__heading",e),[i,o,a]=lB({context:{space:r.space}});c.useEffect(()=>a.subscribe(d=>{tt("[state]",d)}).unsubscribe,[a]);const s=c.useMemo(()=>{switch(!0){case i.matches("managingSpace"):return"space manager";case i.matches("managingSpaceInvitation"):return"space invitation manager";default:return"never"}},[i]),l={...r,activeView:s,send:o,titleId:n,createInvitationUrl:t};return i.context.invitation?c.createElement(dB,{...l,invitation:i.context.invitation}):c.createElement(Q1,{...l})},hB=e=>{const t=St("spaceDialog__title");return c.createElement(Fr.Root,{defaultOpen:!0,onOpenChange:r=>{var n;return r||((n=e.onDone)==null?void 0:n.call(e))}},c.createElement(Fr.Portal,null,c.createElement(Fr.Overlay,null,c.createElement(Fr.Content,{"aria-labelledby":t,onOpenAutoFocus:r=>r.preventDefault()},c.createElement(Cu,null,c.createElement(K9,{...e,titleId:t,doneActionParent:c.createElement(Fr.Close,{asChild:!0})}))))))},ew=e=>{const t=St("joinDialog__title"),{height:r}=WO();return c.createElement(Ai.Root,{defaultOpen:!0,onOpenChange:n=>{var i;return n||(e.onExit?e.onExit():(i=e.onDone)==null?void 0:i.call(e,null))}},c.createElement(Ai.Portal,null,c.createElement(Ai.Overlay,{classNames:"backdrop-blur",...r&&{style:{blockSize:`${r}px`}}},c.createElement(Ai.Content,{"aria-labelledby":t},c.createElement(aB,{...e,titleId:t,exitActionParent:c.createElement(Ai.Cancel,{asChild:!0}),doneActionParent:c.createElement(Ai.Action,{asChild:!0})})))))};var gd,Sl=sn;if(process.env.NODE_ENV==="production")gd=Sl.createRoot,Sl.hydrateRoot;else{var tw=Sl.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;gd=function(e,t){tw.usingClientEntryPoint=!0;try{return Sl.createRoot(e,t)}finally{tw.usingClientEntryPoint=!1}}}var md={exports:{}};(function(e,t){(function(r,n){var i="1.0.35",o="",a="?",s="function",l="undefined",u="object",d="string",p="major",h="model",m="name",v="type",y="vendor",w="version",E="architecture",_="console",S="mobile",$="tablet",k="smarttv",P="wearable",C="embedded",T=350,D="Amazon",j="Apple",F="ASUS",M="BlackBerry",Z="Browser",Y="Chrome",X="Edge",ne="Firefox",oe="Google",ce="Huawei",se="LG",ge="Microsoft",le="Motorola",V="Opera",J="Samsung",re="Sharp",de="Sony",H="Xiaomi",G="Zebra",B="Facebook",z="Chromium OS",K="Mac OS",I=function(Se,je){var b={};for(var f in Se)je[f]&&je[f].length%2===0?b[f]=je[f].concat(Se[f]):b[f]=Se[f];return b},N=function(Se){for(var je={},b=0;b<Se.length;b++)je[Se[b].toUpperCase()]=Se[b];return je},Q=function(Se,je){return typeof Se===d?ie(je).indexOf(ie(Se))!==-1:!1},ie=function(Se){return Se.toLowerCase()},pe=function(Se){return typeof Se===d?Se.replace(/[^\d\.]/g,o).split(".")[0]:n},ye=function(Se,je){if(typeof Se===d)return Se=Se.replace(/^\s\s*/,o),typeof je===l?Se:Se.substring(0,T)},_e=function(Se,je){for(var b=0,f,g,x,O,L,W;b<je.length&&!L;){var me=je[b],ke=je[b+1];for(f=g=0;f<me.length&&!L&&me[f];)if(L=me[f++].exec(Se),L)for(x=0;x<ke.length;x++)W=L[++g],O=ke[x],typeof O===u&&O.length>0?O.length===2?typeof O[1]==s?this[O[0]]=O[1].call(this,W):this[O[0]]=O[1]:O.length===3?typeof O[1]===s&&!(O[1].exec&&O[1].test)?this[O[0]]=W?O[1].call(this,W,O[2]):n:this[O[0]]=W?W.replace(O[1],O[2]):n:O.length===4&&(this[O[0]]=W?O[3].call(this,W.replace(O[1],O[2])):n):this[O]=W||n;b+=2}},xe=function(Se,je){for(var b in je)if(typeof je[b]===u&&je[b].length>0){for(var f=0;f<je[b].length;f++)if(Q(je[b][f],Se))return b===a?n:b}else if(Q(je[b],Se))return b===a?n:b;return Se},ae={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},Me={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},at={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[w,[m,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[w,[m,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[m,w],[/opios[\/ ]+([\w\.]+)/i],[w,[m,V+" Mini"]],[/\bopr\/([\w\.]+)/i],[w,[m,V]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[m,w],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[w,[m,"UC"+Z]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[w,[m,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[w,[m,"WeChat"]],[/konqueror\/([\w\.]+)/i],[w,[m,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[w,[m,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[w,[m,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[m,/(.+)/,"$1 Secure "+Z],w],[/\bfocus\/([\w\.]+)/i],[w,[m,ne+" Focus"]],[/\bopt\/([\w\.]+)/i],[w,[m,V+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[w,[m,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[w,[m,"Dolphin"]],[/coast\/([\w\.]+)/i],[w,[m,V+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[w,[m,"MIUI "+Z]],[/fxios\/([-\w\.]+)/i],[w,[m,ne]],[/\bqihu|(qi?ho?o?|360)browser/i],[[m,"360 "+Z]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[m,/(.+)/,"$1 "+Z],w],[/(comodo_dragon)\/([\w\.]+)/i],[[m,/_/g," "],w],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[m,w],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[m],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[m,B],w],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[m,w],[/\bgsa\/([\w\.]+) .*safari\//i],[w,[m,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[w,[m,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[w,[m,Y+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[m,Y+" WebView"],w],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[w,[m,"Android "+Z]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[m,w],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[w,[m,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[w,m],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[m,[w,xe,ae]],[/(webkit|khtml)\/([\w\.]+)/i],[m,w],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[m,"Netscape"],w],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[w,[m,ne+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[m,w],[/(cobalt)\/([\w\.]+)/i],[m,[w,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[E,"amd64"]],[/(ia32(?=;))/i],[[E,ie]],[/((?:i[346]|x)86)[;\)]/i],[[E,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[E,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[E,"armhf"]],[/windows (ce|mobile); ppc;/i],[[E,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[E,/ower/,o,ie]],[/(sun4\w)[;\)]/i],[[E,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[E,ie]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[h,[y,J],[v,$]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[h,[y,J],[v,S]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[h,[y,j],[v,S]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[h,[y,j],[v,$]],[/(macintosh);/i],[h,[y,j]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[h,[y,re],[v,S]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[h,[y,ce],[v,$]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[h,[y,ce],[v,S]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[h,/_/g," "],[y,H],[v,S]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[h,/_/g," "],[y,H],[v,$]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[h,[y,"OPPO"],[v,S]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[h,[y,"Vivo"],[v,S]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[h,[y,"Realme"],[v,S]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[h,[y,le],[v,S]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[h,[y,le],[v,$]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[h,[y,se],[v,$]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[h,[y,se],[v,S]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[h,[y,"Lenovo"],[v,$]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[h,/_/g," "],[y,"Nokia"],[v,S]],[/(pixel c)\b/i],[h,[y,oe],[v,$]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[h,[y,oe],[v,S]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[h,[y,de],[v,S]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[h,"Xperia Tablet"],[y,de],[v,$]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[h,[y,"OnePlus"],[v,S]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[h,[y,D],[v,$]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[h,/(.+)/g,"Fire Phone $1"],[y,D],[v,S]],[/(playbook);[-\w\),; ]+(rim)/i],[h,y,[v,$]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[h,[y,M],[v,S]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[h,[y,F],[v,$]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[h,[y,F],[v,S]],[/(nexus 9)/i],[h,[y,"HTC"],[v,$]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[y,[h,/_/g," "],[v,S]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[h,[y,"Acer"],[v,$]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[h,[y,"Meizu"],[v,S]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[y,h,[v,S]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[y,h,[v,$]],[/(surface duo)/i],[h,[y,ge],[v,$]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[h,[y,"Fairphone"],[v,S]],[/(u304aa)/i],[h,[y,"AT&T"],[v,S]],[/\bsie-(\w*)/i],[h,[y,"Siemens"],[v,S]],[/\b(rct\w+) b/i],[h,[y,"RCA"],[v,$]],[/\b(venue[\d ]{2,7}) b/i],[h,[y,"Dell"],[v,$]],[/\b(q(?:mv|ta)\w+) b/i],[h,[y,"Verizon"],[v,$]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[h,[y,"Barnes & Noble"],[v,$]],[/\b(tm\d{3}\w+) b/i],[h,[y,"NuVision"],[v,$]],[/\b(k88) b/i],[h,[y,"ZTE"],[v,$]],[/\b(nx\d{3}j) b/i],[h,[y,"ZTE"],[v,S]],[/\b(gen\d{3}) b.+49h/i],[h,[y,"Swiss"],[v,S]],[/\b(zur\d{3}) b/i],[h,[y,"Swiss"],[v,$]],[/\b((zeki)?tb.*\b) b/i],[h,[y,"Zeki"],[v,$]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[y,"Dragon Touch"],h,[v,$]],[/\b(ns-?\w{0,9}) b/i],[h,[y,"Insignia"],[v,$]],[/\b((nxa|next)-?\w{0,9}) b/i],[h,[y,"NextBook"],[v,$]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[y,"Voice"],h,[v,S]],[/\b(lvtel\-)?(v1[12]) b/i],[[y,"LvTel"],h,[v,S]],[/\b(ph-1) /i],[h,[y,"Essential"],[v,S]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[h,[y,"Envizen"],[v,$]],[/\b(trio[-\w\. ]+) b/i],[h,[y,"MachSpeed"],[v,$]],[/\btu_(1491) b/i],[h,[y,"Rotor"],[v,$]],[/(shield[\w ]+) b/i],[h,[y,"Nvidia"],[v,$]],[/(sprint) (\w+)/i],[y,h,[v,S]],[/(kin\.[onetw]{3})/i],[[h,/\./g," "],[y,ge],[v,S]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[h,[y,G],[v,$]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[h,[y,G],[v,S]],[/smart-tv.+(samsung)/i],[y,[v,k]],[/hbbtv.+maple;(\d+)/i],[[h,/^/,"SmartTV"],[y,J],[v,k]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[y,se],[v,k]],[/(apple) ?tv/i],[y,[h,j+" TV"],[v,k]],[/crkey/i],[[h,Y+"cast"],[y,oe],[v,k]],[/droid.+aft(\w)( bui|\))/i],[h,[y,D],[v,k]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[h,[y,re],[v,k]],[/(bravia[\w ]+)( bui|\))/i],[h,[y,de],[v,k]],[/(mitv-\w{5}) bui/i],[h,[y,H],[v,k]],[/Hbbtv.*(technisat) (.*);/i],[y,h,[v,k]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[y,ye],[h,ye],[v,k]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[v,k]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[y,h,[v,_]],[/droid.+; (shield) bui/i],[h,[y,"Nvidia"],[v,_]],[/(playstation [345portablevi]+)/i],[h,[y,de],[v,_]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[h,[y,ge],[v,_]],[/((pebble))app/i],[y,h,[v,P]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[h,[y,j],[v,P]],[/droid.+; (glass) \d/i],[h,[y,oe],[v,P]],[/droid.+; (wt63?0{2,3})\)/i],[h,[y,G],[v,P]],[/(quest( 2| pro)?)/i],[h,[y,B],[v,P]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[y,[v,C]],[/(aeobc)\b/i],[h,[y,D],[v,C]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[h,[v,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[h,[v,$]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[v,$]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[v,S]],[/(android[-\w\. ]{0,9});.+buil/i],[h,[y,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[w,[m,X+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[w,[m,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[m,w],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[w,m]],os:[[/microsoft (windows) (vista|xp)/i],[m,w],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[m,[w,xe,Me]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[m,"Windows"],[w,xe,Me]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/ios;fbsv\/([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[w,/_/g,"."],[m,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[m,K],[w,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[w,m],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[m,w],[/\(bb(10);/i],[w,[m,M]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[w,[m,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[w,[m,ne+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[w,[m,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[w,[m,"watchOS"]],[/crkey\/([\d\.]+)/i],[w,[m,Y+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[m,z],w],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[m,w],[/(sunos) ?([\w\.\d]*)/i],[[m,"Solaris"],w],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[m,w]]},Oe=function(Se,je){if(typeof Se===u&&(je=Se,Se=n),!(this instanceof Oe))return new Oe(Se,je).getResult();var b=typeof r!==l&&r.navigator?r.navigator:n,f=Se||(b&&b.userAgent?b.userAgent:o),g=b&&b.userAgentData?b.userAgentData:n,x=je?I(at,je):at,O=b&&b.userAgent==f;return this.getBrowser=function(){var L={};return L[m]=n,L[w]=n,_e.call(L,f,x.browser),L[p]=pe(L[w]),O&&b&&b.brave&&typeof b.brave.isBrave==s&&(L[m]="Brave"),L},this.getCPU=function(){var L={};return L[E]=n,_e.call(L,f,x.cpu),L},this.getDevice=function(){var L={};return L[y]=n,L[h]=n,L[v]=n,_e.call(L,f,x.device),O&&!L[v]&&g&&g.mobile&&(L[v]=S),O&&L[h]=="Macintosh"&&b&&typeof b.standalone!==l&&b.maxTouchPoints&&b.maxTouchPoints>2&&(L[h]="iPad",L[v]=$),L},this.getEngine=function(){var L={};return L[m]=n,L[w]=n,_e.call(L,f,x.engine),L},this.getOS=function(){var L={};return L[m]=n,L[w]=n,_e.call(L,f,x.os),O&&!L[m]&&g&&g.platform!="Unknown"&&(L[m]=g.platform.replace(/chrome os/i,z).replace(/macos/i,K)),L},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return f},this.setUA=function(L){return f=typeof L===d&&L.length>T?ye(L,T):L,this},this.setUA(f),this};Oe.VERSION=i,Oe.BROWSER=N([m,w,p]),Oe.CPU=N([E]),Oe.DEVICE=N([h,y,v,_,S,k,$,P,C]),Oe.ENGINE=Oe.OS=N([m,w]),e.exports&&(t=e.exports=Oe),t.UAParser=Oe;var Re=typeof r!==l&&(r.jQuery||r.Zepto);if(Re&&!Re.ua){var gt=new Oe;Re.ua=gt.getResult(),Re.ua.get=function(){return gt.getUA()},Re.ua.set=function(Se){gt.setUA(Se);var je=gt.getResult();for(var b in je)Re.ua[b]=je[b]}}})(typeof window=="object"?window:et)})(md,md.exports);var gB=md.exports,$l="/home/runner/work/dxos/dxos/packages/core/mesh/rpc-tunnel/src/ports/iframe.ts",vd,yd;if(typeof navigator<"u"){const e=new gB.UAParser(navigator.userAgent);vd=e.getBrowser().name,yd=e.getOS().name}var mB=(e,t,r)=>{if(!e.contentWindow){tt("IFrame content window missing",{origin:t},{F:$l,L:24,S:void 0,C:(n,i)=>n(...i)});return}vd==="Chrome"&&yd==="iOS"?e.contentWindow.postMessage(r,t):e.contentWindow.postMessage(r,t,[r.payload])},vB=(e,t)=>{vd==="Chrome"&&yd==="iOS"?window.parent.postMessage(t,e):window.parent.postMessage(t,e,[t.payload])},rw=({channel:e,iframe:t,origin:r,onOrigin:n})=>({send:async i=>{if(!r){tt("no origin set",{channel:e},{F:$l,L:62,S:void 0,C:(s,l)=>s(...l)});return}tt("sending",{channel:e,data:i.length},{F:$l,L:66,S:void 0,C:(s,l)=>s(...l)});const o=i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),a={channel:e,payload:o};t?mB(t,r,a):vB(r,a)},subscribe:i=>{const o=a=>{if(!t&&a.source!==window.parent)return;if(t&&a.source!==t.contentWindow)return;const l=a.data&&typeof a.data=="object"&&"channel"in a.data&&"payload"in a.data?a.data:void 0;(l==null?void 0:l.channel)===e&&(r||(r=a.origin,n==null||n(r)),tt("received",l,{F:$l,L:98,S:void 0,C:(u,d)=>u(...d)}),i(new Uint8Array(l.payload)))};return window.addEventListener("message",o),()=>window.removeEventListener("message",o)}});const yB=e=>{const t=St("spaceDialog__title");return c.createElement(Fr.Root,{defaultOpen:!0,onOpenChange:r=>{var n;return r||((n=e.onDone)==null?void 0:n.call(e))}},c.createElement(Fr.Portal,null,c.createElement(Fr.Overlay,null,c.createElement(Fr.Content,{"aria-labelledby":t},c.createElement(Cu,null,c.createElement(pB,{...e,titleId:t,doneActionParent:c.createElement(Fr.Close,{asChild:!0})}))))))},bB=({runtime:e,origin:t})=>{const[{layout:r,invitationCode:n,spaceKey:i,target:o},a]=c.useState({layout:e.layout,invitationCode:e.invitationCode,spaceKey:e.spaceKey,target:e.target}),s=qe.useClient(),l=Ca.useSpace(i);switch(c.useEffect(()=>e.layoutUpdate.on(u=>a(u)),[e]),c.useEffect(()=>{if(r===qe.ShellLayout.SPACE&&!l){tt.warn("No space found for shell space invitations.");const u=setTimeout(async()=>{await e.setAppContext({display:qe.ShellDisplay.NONE}),e.setLayout({layout:qe.ShellLayout.DEFAULT})});return()=>clearTimeout(u)}},[e,r,l]),r){case qe.ShellLayout.INITIALIZE_IDENTITY:return c.createElement(ew,{mode:"halo-only",initialInvitationCode:n,onDone:()=>{e.setAppContext({display:qe.ShellDisplay.NONE}),e.setLayout({layout:qe.ShellLayout.DEFAULT})}});case qe.ShellLayout.IDENTITY:case qe.ShellLayout.SHARE_IDENTITY:case qe.ShellLayout.EDIT_PROFILE:return c.createElement(hB,{createInvitationUrl:u=>`${t}?deviceInvitationCode=${u}`,onResetDevice:async()=>{await s.reset(),await e.setAppContext({display:qe.ShellDisplay.NONE,reload:!0})},onJoinNewIdentity:()=>e.setLayout({layout:qe.ShellLayout.INITIALIZE_IDENTITY}),onDone:async()=>{await e.setAppContext({display:qe.ShellDisplay.NONE}),e.setLayout({layout:qe.ShellLayout.DEFAULT})}});case qe.ShellLayout.SPACE:return l?c.createElement(yB,{space:l,target:o,createInvitationUrl:u=>`${t}?spaceInvitationCode=${u}`,onDone:async()=>{await e.setAppContext({display:qe.ShellDisplay.NONE}),e.setLayout({layout:qe.ShellLayout.DEFAULT})}}):null;case qe.ShellLayout.JOIN_SPACE:return c.createElement(ew,{initialInvitationCode:n,onDone:async u=>{const d=(u==null?void 0:u.target)??void 0;await e.setAppContext({display:qe.ShellDisplay.NONE,spaceKey:(u==null?void 0:u.spaceKey)??void 0,target:d}),e.setLayout({layout:qe.ShellLayout.DEFAULT})},onExit:async()=>{await e.setAppContext({display:qe.ShellDisplay.NONE}),e.setLayout({layout:qe.ShellLayout.DEFAULT})}});default:return null}},wB={"en-US":Object.freeze(Object.defineProperty({__proto__:null,os:{"manage profile label":"Manage identity","identity offline description":"Offline","sidebar label":"DXOS sidebar","copy invitation code label":"Copy URL","copy invitation code success label":"Copied","open share panel label":"View QR code","joining space heading":"Joining space","join space heading":"Enter space invitation","halo heading":"Initialize device identity","exit label":"Exit","identity selector title":"Join as","identity radio group title":"Select an identity you’ve associated with this device already","add identity label":"Add","continue label":"Continue","back label":"Back","next label":"Next","close label":"Close","auth choices label":"Choose an identity","create identity label":"Create an identity","create identity description":"Create a new identity.","recover identity label":"Use a seed phrase","recover identity description":"Enter your seed phrase to log in manually.","join identity label":"Use another device","join identity description":"Add this device to an identity you’re already logged into on another device.","deselect identity label":"Back to identities","addition method chooser title":"An identity is required to continue","new identity input label":"Set display name","recover identity input label":"Type or paste your seed phrase","failed to create identity message":"Failed to create an identity.","failed to recover identity message":"Failed to recover an identity from the provided seed phrase.","failed to authenticate message":"Incorrect PIN.","identity added label":"Created identity & added to this device:","join space as identity heading":"<part>as </part><part><icon/><label>{{labelValue}}</label></part>","error status label":"Failed","timeout status label":"Timed out","cancelled status label":"Cancelled","init status label":"Ready to connect","connecting status label":"Connecting…","connected status label":"Enter confirmation PIN","authenticating status label":"Enter confirmation PIN","success status label":"Success","connect label":"Connect","reconnect label":"Reconnect","cancel label":"Cancel","done label":"Done","reset label":"Start over","auth code input label":"Enter the verification code","invitation input label":"Paste an invitation code or URL","create device invitation label":"Add device","create space invitation label":"Invite","qr label":"Scan to accept invitation","empty invitations message":"No pending invitations","empty device list message":"No devices authenticated other than this device.","show all spaces label":"All spaces","all spaces label":"All spaces","create space label":"Create a new space","join space label":"Join a space","show current space label":"Current space","view space invitations label":"View space invitations","toggle sidebar label":"Open/close sidebar","open sidebar label":"Open sidebar","close sidebar label":"Close sidebar","welcome message":"Welcome","selecting identity heading":"Selecting identity","devices heading":"Devices","identity heading":"Profile settings","choose add device label":"Add device","choose devices label":"Manage devices","choose profile label":"Edit profile","choose sign out label":"Sign out","empty space members message":"There is nobody in this space yet.","back to all invitations label":"Back to all invitations","invitation heading":"Invitation","invitation list heading":"Invitations","device invitation list heading":"Pending device invitations","space invitation list heading":"Pending invitations","device list heading":"Devices","space member list heading":"Members","space panel heading":"Space membership","auth code message":"Enter the following auth code on the joining device.","display name input label":"Display name","display name input placeholder":"Enter a display name","invite one label":"Invite one","invite one description":"Only one user may join.","invite one qr label":"Single-use","invite one list item label":"Active single-use invitation","invite many label":"Invite many","invite many description":"Anyone with the link can join.","invite many qr label":"Multiple-use","invite many list item label":"Active multiple-use invitation","invite options label":"Change the active invite option.","confirm label":"Confirm","reset identity input label":"This will clear this device and all associated data. Type {{confirmationValue}} and confirm to continue.","failed to reset identity message":"Failed to reset identity.","confirmation value":"CONFIRM","sign out chooser title":"DANGER ZONE","sign out chooser message":"Proceeding with either action below will erase all data on this device.","join new identity label":"Join a new identity","reset device label":"Reset device","reset device confirm message":"Are you sure you want to reset your device? All data will be lost."}},Symbol.toStringTag,{value:"Module"}))},EB=async(e=new qe.Config)=>{const t=new qe.ClientServicesProxy(rw({channel:ln.DEFAULT_CLIENT_CHANNEL})),r=new qe.Client({config:e,services:t}),n=new aw.ShellRuntimeImpl(rw({channel:ln.DEFAULT_SHELL_CHANNEL}));await Promise.all([n.open(),r.initialize()]),gd(document.getElementById("root")).render(c.createElement(c.StrictMode,null,c.createElement(lT,{tx:v4,resourceExtensions:[wB]},c.createElement(qe.ClientContext.Provider,{value:{client:r,status:qe.SystemStatus.ACTIVE}},c.createElement(Cu,null,c.createElement(Er.Provider,null,c.createElement(bB,{runtime:n,origin:location.origin})))))))};c.createContext({}),er.runShell=EB,Object.defineProperty(er,Symbol.toStringTag,{value:"Module"})});
215
+ `}return ae.substring(0,ae.length-1)},X.renderTo2dContext=function(B,z){z=z||2;for(var K=X.getModuleCount(),I=0;I<K;I++)for(var N=0;N<K;N++)B.fillStyle=X.isDark(I,N)?"black":"white",B.fillRect(I*z,N*z,z,z)},X};n.stringToBytesFuncs={default:function(k){for(var P=[],C=0;C<k.length;C+=1){var T=k.charCodeAt(C);P.push(T&255)}return P}},n.stringToBytes=n.stringToBytesFuncs.default,n.createStringToBytes=function(k,P){var C=function(){for(var D=_(k),j=function(){var se=D.read();if(se==-1)throw"eof";return se},F=0,M={};;){var Z=D.read();if(Z==-1)break;var Y=j(),X=j(),ne=j(),oe=String.fromCharCode(Z<<8|Y),ce=X<<8|ne;M[oe]=ce,F+=1}if(F!=P)throw F+" != "+P;return M}(),T=63;return function(D){for(var j=[],F=0;F<D.length;F+=1){var M=D.charCodeAt(F);if(M<128)j.push(M);else{var Z=C[D.charAt(F)];typeof Z=="number"?(Z&255)==Z?j.push(Z):(j.push(Z>>>8),j.push(Z&255)):j.push(T)}}return j}};var i={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},o={L:1,M:0,Q:3,H:2},a={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},s=function(){var k=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],P=1335,C=7973,T=21522,D={},j=function(F){for(var M=0;F!=0;)M+=1,F>>>=1;return M};return D.getBCHTypeInfo=function(F){for(var M=F<<10;j(M)-j(P)>=0;)M^=P<<j(M)-j(P);return(F<<10|M)^T},D.getBCHTypeNumber=function(F){for(var M=F<<12;j(M)-j(C)>=0;)M^=C<<j(M)-j(C);return F<<12|M},D.getPatternPosition=function(F){return k[F-1]},D.getMaskFunction=function(F){switch(F){case a.PATTERN000:return function(M,Z){return(M+Z)%2==0};case a.PATTERN001:return function(M,Z){return M%2==0};case a.PATTERN010:return function(M,Z){return Z%3==0};case a.PATTERN011:return function(M,Z){return(M+Z)%3==0};case a.PATTERN100:return function(M,Z){return(Math.floor(M/2)+Math.floor(Z/3))%2==0};case a.PATTERN101:return function(M,Z){return M*Z%2+M*Z%3==0};case a.PATTERN110:return function(M,Z){return(M*Z%2+M*Z%3)%2==0};case a.PATTERN111:return function(M,Z){return(M*Z%3+(M+Z)%2)%2==0};default:throw"bad maskPattern:"+F}},D.getErrorCorrectPolynomial=function(F){for(var M=u([1],0),Z=0;Z<F;Z+=1)M=M.multiply(u([1,l.gexp(Z)],0));return M},D.getLengthInBits=function(F,M){if(1<=M&&M<10)switch(F){case i.MODE_NUMBER:return 10;case i.MODE_ALPHA_NUM:return 9;case i.MODE_8BIT_BYTE:return 8;case i.MODE_KANJI:return 8;default:throw"mode:"+F}else if(M<27)switch(F){case i.MODE_NUMBER:return 12;case i.MODE_ALPHA_NUM:return 11;case i.MODE_8BIT_BYTE:return 16;case i.MODE_KANJI:return 10;default:throw"mode:"+F}else if(M<41)switch(F){case i.MODE_NUMBER:return 14;case i.MODE_ALPHA_NUM:return 13;case i.MODE_8BIT_BYTE:return 16;case i.MODE_KANJI:return 12;default:throw"mode:"+F}else throw"type:"+M},D.getLostPoint=function(F){for(var M=F.getModuleCount(),Z=0,Y=0;Y<M;Y+=1)for(var X=0;X<M;X+=1){for(var ne=0,oe=F.isDark(Y,X),ce=-1;ce<=1;ce+=1)if(!(Y+ce<0||M<=Y+ce))for(var se=-1;se<=1;se+=1)X+se<0||M<=X+se||ce==0&&se==0||oe==F.isDark(Y+ce,X+se)&&(ne+=1);ne>5&&(Z+=3+ne-5)}for(var Y=0;Y<M-1;Y+=1)for(var X=0;X<M-1;X+=1){var ge=0;F.isDark(Y,X)&&(ge+=1),F.isDark(Y+1,X)&&(ge+=1),F.isDark(Y,X+1)&&(ge+=1),F.isDark(Y+1,X+1)&&(ge+=1),(ge==0||ge==4)&&(Z+=3)}for(var Y=0;Y<M;Y+=1)for(var X=0;X<M-6;X+=1)F.isDark(Y,X)&&!F.isDark(Y,X+1)&&F.isDark(Y,X+2)&&F.isDark(Y,X+3)&&F.isDark(Y,X+4)&&!F.isDark(Y,X+5)&&F.isDark(Y,X+6)&&(Z+=40);for(var X=0;X<M;X+=1)for(var Y=0;Y<M-6;Y+=1)F.isDark(Y,X)&&!F.isDark(Y+1,X)&&F.isDark(Y+2,X)&&F.isDark(Y+3,X)&&F.isDark(Y+4,X)&&!F.isDark(Y+5,X)&&F.isDark(Y+6,X)&&(Z+=40);for(var le=0,X=0;X<M;X+=1)for(var Y=0;Y<M;Y+=1)F.isDark(Y,X)&&(le+=1);var V=Math.abs(100*le/M/M-50)/5;return Z+=V*10,Z},D}(),l=function(){for(var k=new Array(256),P=new Array(256),C=0;C<8;C+=1)k[C]=1<<C;for(var C=8;C<256;C+=1)k[C]=k[C-4]^k[C-5]^k[C-6]^k[C-8];for(var C=0;C<255;C+=1)P[k[C]]=C;var T={};return T.glog=function(D){if(D<1)throw"glog("+D+")";return P[D]},T.gexp=function(D){for(;D<0;)D+=255;for(;D>=256;)D-=255;return k[D]},T}();function u(k,P){if(typeof k.length>"u")throw k.length+"/"+P;var C=function(){for(var D=0;D<k.length&&k[D]==0;)D+=1;for(var j=new Array(k.length-D+P),F=0;F<k.length-D;F+=1)j[F]=k[F+D];return j}(),T={};return T.getAt=function(D){return C[D]},T.getLength=function(){return C.length},T.multiply=function(D){for(var j=new Array(T.getLength()+D.getLength()-1),F=0;F<T.getLength();F+=1)for(var M=0;M<D.getLength();M+=1)j[F+M]^=l.gexp(l.glog(T.getAt(F))+l.glog(D.getAt(M)));return u(j,0)},T.mod=function(D){if(T.getLength()-D.getLength()<0)return T;for(var j=l.glog(T.getAt(0))-l.glog(D.getAt(0)),F=new Array(T.getLength()),M=0;M<T.getLength();M+=1)F[M]=T.getAt(M);for(var M=0;M<D.getLength();M+=1)F[M]^=l.gexp(l.glog(D.getAt(M))+j);return u(F,0).mod(D)},T}var d=function(){var k=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],P=function(D,j){var F={};return F.totalCount=D,F.dataCount=j,F},C={},T=function(D,j){switch(j){case o.L:return k[(D-1)*4+0];case o.M:return k[(D-1)*4+1];case o.Q:return k[(D-1)*4+2];case o.H:return k[(D-1)*4+3];default:return}};return C.getRSBlocks=function(D,j){var F=T(D,j);if(typeof F>"u")throw"bad rs block @ typeNumber:"+D+"/errorCorrectionLevel:"+j;for(var M=F.length/3,Z=[],Y=0;Y<M;Y+=1)for(var X=F[Y*3+0],ne=F[Y*3+1],oe=F[Y*3+2],ce=0;ce<X;ce+=1)Z.push(P(ne,oe));return Z},C}(),p=function(){var k=[],P=0,C={};return C.getBuffer=function(){return k},C.getAt=function(T){var D=Math.floor(T/8);return(k[D]>>>7-T%8&1)==1},C.put=function(T,D){for(var j=0;j<D;j+=1)C.putBit((T>>>D-j-1&1)==1)},C.getLengthInBits=function(){return P},C.putBit=function(T){var D=Math.floor(P/8);k.length<=D&&k.push(0),T&&(k[D]|=128>>>P%8),P+=1},C},h=function(k){var P=i.MODE_NUMBER,C=k,T={};T.getMode=function(){return P},T.getLength=function(F){return C.length},T.write=function(F){for(var M=C,Z=0;Z+2<M.length;)F.put(D(M.substring(Z,Z+3)),10),Z+=3;Z<M.length&&(M.length-Z==1?F.put(D(M.substring(Z,Z+1)),4):M.length-Z==2&&F.put(D(M.substring(Z,Z+2)),7))};var D=function(F){for(var M=0,Z=0;Z<F.length;Z+=1)M=M*10+j(F.charAt(Z));return M},j=function(F){if("0"<=F&&F<="9")return F.charCodeAt(0)-48;throw"illegal char :"+F};return T},m=function(k){var P=i.MODE_ALPHA_NUM,C=k,T={};T.getMode=function(){return P},T.getLength=function(j){return C.length},T.write=function(j){for(var F=C,M=0;M+1<F.length;)j.put(D(F.charAt(M))*45+D(F.charAt(M+1)),11),M+=2;M<F.length&&j.put(D(F.charAt(M)),6)};var D=function(j){if("0"<=j&&j<="9")return j.charCodeAt(0)-48;if("A"<=j&&j<="Z")return j.charCodeAt(0)-65+10;switch(j){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+j}};return T},v=function(k){var P=i.MODE_8BIT_BYTE,C=n.stringToBytes(k),T={};return T.getMode=function(){return P},T.getLength=function(D){return C.length},T.write=function(D){for(var j=0;j<C.length;j+=1)D.put(C[j],8)},T},y=function(k){var P=i.MODE_KANJI,C=n.stringToBytesFuncs.SJIS;if(!C)throw"sjis not supported.";(function(j,F){var M=C(j);if(M.length!=2||(M[0]<<8|M[1])!=F)throw"sjis not supported."})("友",38726);var T=C(k),D={};return D.getMode=function(){return P},D.getLength=function(j){return~~(T.length/2)},D.write=function(j){for(var F=T,M=0;M+1<F.length;){var Z=(255&F[M])<<8|255&F[M+1];if(33088<=Z&&Z<=40956)Z-=33088;else if(57408<=Z&&Z<=60351)Z-=49472;else throw"illegal char at "+(M+1)+"/"+Z;Z=(Z>>>8&255)*192+(Z&255),j.put(Z,13),M+=2}if(M<F.length)throw"illegal char at "+(M+1)},D},w=function(){var k=[],P={};return P.writeByte=function(C){k.push(C&255)},P.writeShort=function(C){P.writeByte(C),P.writeByte(C>>>8)},P.writeBytes=function(C,T,D){T=T||0,D=D||C.length;for(var j=0;j<D;j+=1)P.writeByte(C[j+T])},P.writeString=function(C){for(var T=0;T<C.length;T+=1)P.writeByte(C.charCodeAt(T))},P.toByteArray=function(){return k},P.toString=function(){var C="";C+="[";for(var T=0;T<k.length;T+=1)T>0&&(C+=","),C+=k[T];return C+="]",C},P},E=function(){var k=0,P=0,C=0,T="",D={},j=function(M){T+=String.fromCharCode(F(M&63))},F=function(M){if(!(M<0)){if(M<26)return 65+M;if(M<52)return 97+(M-26);if(M<62)return 48+(M-52);if(M==62)return 43;if(M==63)return 47}throw"n:"+M};return D.writeByte=function(M){for(k=k<<8|M&255,P+=8,C+=1;P>=6;)j(k>>>P-6),P-=6},D.flush=function(){if(P>0&&(j(k<<6-P),k=0,P=0),C%3!=0)for(var M=3-C%3,Z=0;Z<M;Z+=1)T+="="},D.toString=function(){return T},D},_=function(k){var P=k,C=0,T=0,D=0,j={};j.read=function(){for(;D<8;){if(C>=P.length){if(D==0)return-1;throw"unexpected end of file./"+D}var M=P.charAt(C);if(C+=1,M=="=")return D=0,-1;if(M.match(/^\s$/))continue;T=T<<6|F(M.charCodeAt(0)),D+=6}var Z=T>>>D-8&255;return D-=8,Z};var F=function(M){if(65<=M&&M<=90)return M-65;if(97<=M&&M<=122)return M-97+26;if(48<=M&&M<=57)return M-48+52;if(M==43)return 62;if(M==47)return 63;throw"c:"+M};return j},S=function(k,P){var C=k,T=P,D=new Array(k*P),j={};j.setPixel=function(Y,X,ne){D[X*C+Y]=ne},j.write=function(Y){Y.writeString("GIF87a"),Y.writeShort(C),Y.writeShort(T),Y.writeByte(128),Y.writeByte(0),Y.writeByte(0),Y.writeByte(0),Y.writeByte(0),Y.writeByte(0),Y.writeByte(255),Y.writeByte(255),Y.writeByte(255),Y.writeString(","),Y.writeShort(0),Y.writeShort(0),Y.writeShort(C),Y.writeShort(T),Y.writeByte(0);var X=2,ne=M(X);Y.writeByte(X);for(var oe=0;ne.length-oe>255;)Y.writeByte(255),Y.writeBytes(ne,oe,255),oe+=255;Y.writeByte(ne.length-oe),Y.writeBytes(ne,oe,ne.length-oe),Y.writeByte(0),Y.writeString(";")};var F=function(Y){var X=Y,ne=0,oe=0,ce={};return ce.write=function(se,ge){if(se>>>ge)throw"length over";for(;ne+ge>=8;)X.writeByte(255&(se<<ne|oe)),ge-=8-ne,se>>>=8-ne,oe=0,ne=0;oe=se<<ne|oe,ne=ne+ge},ce.flush=function(){ne>0&&X.writeByte(oe)},ce},M=function(Y){for(var X=1<<Y,ne=(1<<Y)+1,oe=Y+1,ce=Z(),se=0;se<X;se+=1)ce.add(String.fromCharCode(se));ce.add(String.fromCharCode(X)),ce.add(String.fromCharCode(ne));var ge=w(),le=F(ge);le.write(X,oe);var V=0,J=String.fromCharCode(D[V]);for(V+=1;V<D.length;){var re=String.fromCharCode(D[V]);V+=1,ce.contains(J+re)?J=J+re:(le.write(ce.indexOf(J),oe),ce.size()<4095&&(ce.size()==1<<oe&&(oe+=1),ce.add(J+re)),J=re)}return le.write(ce.indexOf(J),oe),le.write(ne,oe),le.flush(),ge.toByteArray()},Z=function(){var Y={},X=0,ne={};return ne.add=function(oe){if(ne.contains(oe))throw"dup key:"+oe;Y[oe]=X,X+=1},ne.size=function(){return X},ne.indexOf=function(oe){return Y[oe]},ne.contains=function(oe){return typeof Y[oe]<"u"},ne};return j},$=function(k,P,C){for(var T=S(k,P),D=0;D<P;D+=1)for(var j=0;j<k;j+=1)T.setPixel(j,D,C(j,D));var F=w();T.write(F);for(var M=E(),Z=F.toByteArray(),Y=0;Y<Z.length;Y+=1)M.writeByte(Z[Y]);return M.flush(),"data:image/gif;base64,"+M};return n}();(function(){r.stringToBytesFuncs["UTF-8"]=function(n){function i(o){for(var a=[],s=0;s<o.length;s++){var l=o.charCodeAt(s);l<128?a.push(l):l<2048?a.push(192|l>>6,128|l&63):l<55296||l>=57344?a.push(224|l>>12,128|l>>6&63,128|l&63):(s++,l=65536+((l&1023)<<10|o.charCodeAt(s)&1023),a.push(240|l>>18,128|l>>12&63,128|l>>6&63,128|l&63))}return a}return i(n)}})(),function(n){e.exports=n()}(function(){return r})})(F1);var D9=F1.exports;const pd=cn(D9);var L9=Object.defineProperty,xl=Object.getOwnPropertySymbols,B1=Object.prototype.hasOwnProperty,j1=Object.prototype.propertyIsEnumerable,R1=(e,t,r)=>t in e?L9(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,M9=(e,t)=>{for(var r in t||(t={}))B1.call(t,r)&&R1(e,r,t[r]);if(xl)for(var r of xl(t))j1.call(t,r)&&R1(e,r,t[r]);return e},F9=(e,t)=>{var r={};for(var n in e)B1.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&xl)for(var n of xl(e))t.indexOf(n)<0&&j1.call(e,n)&&(r[n]=e[n]);return r},rn=1e3,B9=/code length overflow/i;pd.stringToBytes=pd.stringToBytesFuncs["UTF-8"];var j9=(e,t,r)=>{r=Math.max(1,r);for(let n=r;n<=40;n+=1)try{const i=pd(n,t);i.addData(e),i.make();const o=i.getModuleCount();return{text:e,level:t,version:n,moduleCount:o,isDark:(s,l)=>s>=0&&s<o&&l>=0&&l<o&&i.isDark(s,l)}}catch(i){if(!(n<40&&B9.test(String(i))))throw i}return null},kn=Math.round,no=(e,t)=>`M ${kn(e)} ${kn(t)}`,zt=(e,t)=>`L ${kn(e)} ${kn(t)}`,Nn=(e,t,r)=>`A ${kn(r)} ${kn(r)} 0 0 1 ${kn(e)} ${kn(t)}`,R9=(e,t,r,n,i,o,a,s,l)=>{const u=[];return o?u.push(no(e+i,t)):u.push(no(e,t)),a?u.push(zt(r-i,t),Nn(r,t+i,i)):u.push(zt(r,t)),s?u.push(zt(r,n-i),Nn(r-i,n,i)):u.push(zt(r,n)),l?u.push(zt(e+i,n),Nn(e,n-i,i)):u.push(zt(e,n)),o?u.push(zt(e,t+i),Nn(e+i,t,i)):u.push(zt(e,t)),u.join(" ")},U9=(e,t,r,n,i,o,a,s,l)=>{const u=[];return o&&u.push(no(e+i,t),zt(e,t),zt(e,t+i),Nn(e+i,t,i)),a&&u.push(no(r,t+i),zt(r,t),zt(r-i,t),Nn(r,t+i,i)),s&&u.push(no(r-i,n),zt(r,n),zt(r,n-i),Nn(r-i,n,i)),l&&u.push(no(e,n-i),zt(e,n),zt(e+i,n),Nn(e,n-i,i)),u.join(" ")},W9=(e,t,r,n,i)=>{const o=i*r,a=n*r,s=o+r,l=a+r,u=t*.005*r,d=e.isDark,p=n-1,h=n+1,m=i-1,v=i+1,y=d(n,i),w=d(p,m),E=d(p,i),_=d(p,v),S=d(n,v),$=d(h,v),k=d(h,i),P=d(h,m),C=d(n,m);return y?R9(o,a,s,l,u,!E&&!C,!E&&!S,!k&&!S,!k&&!C):U9(o,a,s,l,u,E&&C&&w,E&&S&&_,k&&S&&$,k&&C&&P)},z9=(e,t)=>{if(!e)return"";const r=e.moduleCount,n=rn/r,i=[];for(let o=0;o<r;o+=1)for(let a=0;a<r;a+=1)i.push(W9(e,t,n,o,a));return i.join(" ")},H9=e=>{var t=e,{color:r="#000",backgroundColor:n,cutout:i=!1,cutoutElement:o,errorCorrectionLevel:a="Q",rounding:s=0,children:l}=t,u=F9(t,["color","backgroundColor","cutout","cutoutElement","errorCorrectionLevel","rounding","children"]),d,p;const h=c.useMemo(()=>j9(l,a,1),[l,a]);if(!h)return null;const m=(d=h==null?void 0:h.moduleCount)!=null?d:1,y=rn/((p=h==null?void 0:h.moduleCount)!=null?p:1)*(Math.floor(m*.18)*2-1)+2,w=(rn-y)/2;return ve.createElement("svg",M9({xmlns:"http://www.w3.org/2000/svg",viewBox:`0 0 ${rn} ${rn}`},u),i?ve.createElement("mask",{id:"react-qr-rounded__mask"},ve.createElement("rect",{x:"0",y:"0",width:rn,height:rn,fill:"#fff"}),ve.createElement("rect",{x:w,y:w,width:y,height:y,rx:s,ry:s,fill:"#000"})):null,n?ve.createElement("rect",{x:"0",y:"0",width:rn,height:rn,fill:n}):null,ve.createElement("path",{fill:r,d:z9(h,s),mask:i?"url(#react-qr-rounded__mask)":void 0}),o?ve.createElement("foreignObject",{x:w,y:w,width:y,height:y},ve.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",width:"100%",overflow:"hidden",borderRadius:s}},o)):null)};const hd=({children:e,...t})=>c.createElement(ct.View,{...t,classNames:"grow flex flex-col justify-around items-center"},e),U1=({invitationUrl:e,active:t,send:r,status:n,type:i,authCode:o,id:a})=>{const{t:s}=it("os"),l=St("invitation-manager__qr-code"),u=i===we.Type.MULTIUSE?0:p7.get(n)??0,d=u===3,p=Ff(a??""),h=c.useMemo(()=>{switch(!0){case u===5:case u<0:return"showing final";case u===3:return"showing auth code";default:return"showing qr"}},[u]);return c.createElement(c.Fragment,null,c.createElement(ct.Root,{activeView:h,classNames:"grow plb-1"},c.createElement(ct.Views,null,c.createElement(hd,{id:"showing qr",emoji:p},c.createElement("p",{className:"text-sm mlb-1 font-normal text-center"},s(i===we.Type.MULTIUSE?"invite many qr label":"invite one qr label")),c.createElement("div",{role:"none",className:ue(It,"is-full max-is-[14rem] relative")},c.createElement(H9,{rounding:100,backgroundColor:"transparent",color:"currentColor",className:ue("is-full bs-full p-2",d&&"invisible"),"aria-labelledby":l,errorCorrectionLevel:"Q",cutout:!0},e??"never"),c.createElement(EM,null,c.createElement(Bf,{text:p}))),c.createElement("span",{id:l,className:"sr-only"},s("qr label")),c.createElement(y4,{variant:"ghost",value:e??"never"})),c.createElement(hd,{id:"showing auth code"},c.createElement(jb,null,s("auth code message")),c.createElement(Fb,{code:o,large:!0,classNames:"text-black dark:text-white"}),c.createElement(jb,null,"Be sure the other device is showing this symbol:"),p&&c.createElement(Bf,{text:p})),c.createElement(hd,{id:"showing final"},u>0?c.createElement(Ye.Check,{className:ue("m-1.5",Ve(6))}):c.createElement(Ye.X,{className:ue("m-1.5",Ve(6))})))),c.createElement(qt,{classNames:"mbs-4"},c.createElement(lt,{disabled:!t,onClick:()=>r==null?void 0:r({type:"deselectInvitation"})},s("back label"))))},io="pbs-1 pbe-3 pli-3",V9=({titleId:e,title:t,identity:r,onDone:n})=>{var o;const i=vs(r.identityKey.toHex(),12);return c.createElement(jf,{titleId:e,title:t,corner:c.createElement(Bb,{onDone:n})},c.createElement(Pt.Root,{size:12,variant:"circle",status:"active"},c.createElement(Pt.Frame,{classNames:"block mbs-4 mbe-2 mli-auto chromatic-ignore"},c.createElement(Pt.Fallback,{href:i})),c.createElement(Pt.Label,{classNames:"block text-center font-light text-xl","data-testid":"identityHeading.displayName"},((o=r.profile)==null?void 0:o.displayName)??Fs(r.identityKey.toHex()))))},W1=e=>{const{identity:t,titleId:r,activeView:n,onUpdateProfile:i,onResetDevice:o,onJoinNewIdentity:a,IdentityActionChooser:s=A9,InvitationManager:l=U1,onDone:u,...d}=e,{t:p}=it("os"),h=c.useMemo(()=>{switch(n){case"agent manager":return"Manage Agent";case"device invitation manager":return p("choose add device label");default:return p("identity heading")}},[n,p]);return c.createElement(Oi,{density:"fine"},c.createElement(V9,{identity:t,titleId:r,title:h,onDone:u}),c.createElement(ct.Root,{activeView:n},c.createElement(ct.Views,null,c.createElement(ct.View,{id:"identity action chooser",classNames:io},c.createElement(s,{active:n==="identity action chooser",...d})),c.createElement(ct.View,{id:"device invitation manager",classNames:io},c.createElement(l,{active:n==="device invitation manager",...d,invitationUrl:d.createInvitationUrl(d.invitationCode)})),c.createElement(ct.View,{id:"device manager",classNames:io},c.createElement(C9,{active:n==="device manager",...d})),c.createElement(ct.View,{classNames:io,id:"update profile form"},c.createElement(T9,{send:d.send,active:n==="update profile form",profile:t.profile,onUpdateProfile:i})),c.createElement(ct.View,{classNames:io,id:"signing out"},c.createElement(P9,{send:d.send,active:n==="signing out",onResetDevice:o,onJoinNewIdentity:a})),c.createElement(ct.View,{classNames:io,id:"agent manager"},c.createElement($9,{send:d.send,active:n==="agent manager",...d})))))},G9=({invitation:e,...t})=>{const r=xf(e);return c.createElement(W1,{...t,...r})},K9=({titleId:e,createInvitationUrl:t=n=>n,...r})=>{const n=St("identityPanel__heading",e),i=qe.useClient(),o=vo.useDevices(),a=vo.useIdentity(),s=vo.useHaloInvitations(),l=N9({client:i,identity:a,invitations:s});if(!a)return console.error("IdentityPanel rendered with no active identity."),null;const[u,d,p]=S9(i);c.useEffect(()=>p.subscribe(w=>{tt("[state]",w)}).unsubscribe,[p]);const h=c.useMemo(()=>{switch(!0){case u.matches("choosingAction"):return"identity action chooser";case u.matches("managingDeviceInvitation"):return"device invitation manager";case u.matches("managingDevices"):return"device manager";case[{managingProfile:"idle"},{managingProfile:"pending"}].some(u.matches):return"update profile form";case u.matches("signingOut"):return"signing out";case[{managingAgent:"idle"},{managingAgent:"pending"}].some(u.matches):return"agent manager";default:return"identity action chooser"}},[u]),v={...r,identity:a,devices:o,activeView:h,send:d,titleId:n,createInvitationUrl:t,onUpdateProfile:async y=>{d({type:"updateProfile"}),await i.halo.updateProfile(y)},...l};return u.context.invitation?c.createElement(G9,{...v,invitation:u.context.invitation}):c.createElement(W1,{...v})},q9=c.forwardRef(({mode:e,titleId:t,onExit:r,exitActionParent:n},i)=>{const{t:o}=it("os"),a=c.createElement(wr,{variant:"ghost",...r&&{onClick:r},classNames:ue(It,"plb-0 pli-2 absolute block-start-0 inline-end-0 z-[1]"),"data-testid":"join-exit"},c.createElement(Ye.X,{weight:"bold",className:Ve(4)}),c.createElement("span",{className:"sr-only"},o("exit label")));return c.createElement(jf,{ref:i,titleId:t,title:o(e==="halo-only"?"selecting identity heading":"joining space heading"),...e==="halo-only"?{titleSrOnly:!0}:{corner:n?c.cloneElement(n,{},a):a},titleSrOnly:e==="halo-only"})}),z1=(e,t)=>(tt("[subscribing to invitation]",t),{subscribe:(r,n,i)=>t.subscribe(o=>{switch(o.state){case we.State.CONNECTING:return tt("[invitation connecting]",{Kind:e,invitation:o}),r({type:`connecting${e}Invitation`,invitation:o});case we.State.CONNECTED:return tt("[invitation connected]",{Kind:e,invitation:o}),r({type:`connected${e}Invitation`,invitation:o});case we.State.READY_FOR_AUTHENTICATION:return tt("[invitation ready for authentication]",{Kind:e,invitation:o}),r({type:`readyForAuthentication${e}Invitation`,invitation:o});case we.State.AUTHENTICATING:return tt("[invitation authenticating]",{Kind:e,invitation:o}),r({type:`authenticating${e}Invitation`,invitation:o});case we.State.SUCCESS:return tt("[invitation success]",{Kind:e,invitation:o}),r({type:`success${e}Invitation`,invitation:o}),i==null?void 0:i();case we.State.CANCELLED:return tt.warn("[invitation cancelled]",{Kind:e}),r({type:`fail${e}Invitation`,reason:"cancelled"});case we.State.TIMEOUT:return tt.error("[invitation timeout]",{Kind:e}),r({type:`fail${e}Invitation`,reason:"timeout"})}},o=>o instanceof qe.AlreadyJoinedError?(tt("[already joined]",{Kind:e,error:o}),r({type:`success${e}Invitation`,invitation:t.get()}),i==null?void 0:i()):(tt.error("[invitation errored]",{Kind:e,error:o}),r({type:`fail${e}Invitation`,reason:"error"}),n==null?void 0:n(o)))}),H1=(e,t)=>({initial:`unknown${e}`,states:{[`unknown${e}`]:{always:[{cond:({mode:n})=>n==="halo-only"&&e==="Space",target:"#join.finishingJoiningHalo"},{cond:n=>!!n[e.toLowerCase()].unredeemedCode,target:`acceptingRedeemed${e}Invitation`,actions:[`redeem${e}InvitationCode`,`invalidate${e}InvitationCode`,"log"]},{target:`inputting${e}InvitationCode`,actions:"log"}]},[`inputting${e}InvitationCode`]:{},[`acceptingRedeemed${e}Invitation`]:{invoke:{src:n=>n[e.toLowerCase()].invitationSubscribable},initial:`unknown${e}Invitation`,states:{[`unknown${e}Invitation`]:{always:[{cond:n=>{var i,o;if(e!=="Space")return!1;{const a=(o=(i=n.space.invitation)==null?void 0:i.spaceKey)==null?void 0:o.toHex(),s=n.space.succeededKeys;return a?!!(s!=null&&s.has(a)):!1}},target:t,actions:"log"},{cond:n=>{const i=n[e.toLowerCase()].invitation;return!i||(i==null?void 0:i.state)===we.State.CONNECTING},target:`connecting${e}Invitation`,actions:"log"},{target:`inputting${e}VerificationCode`,actions:"log"}]},[`connecting${e}Invitation`]:{},[`inputting${e}VerificationCode`]:{},[`authenticating${e}VerificationCode`]:{on:{[`readyForAuthentication${e}Invitation`]:{target:`authenticationFailing${e}VerificationCode`,actions:["setInvitation","log"]}}},[`authenticationFailing${e}VerificationCode`]:{},[`failing${e}Invitation`]:{},[`success${e}Invitation`]:{}},on:{[`reset${e}Invitation`]:{target:`#join${e==="Halo"?".choosingIdentity":""}.accepting${e}Invitation.unknown${e}`,actions:["resetInvitation","log"]},[`connecting${e}Invitation`]:{target:`.connecting${e}Invitation`,actions:["setInvitation","log"]},[`connected${e}Invitation`]:{target:`.connecting${e}Invitation`,actions:["setInvitation","log"]},[`readyForAuthentication${e}Invitation`]:{target:`.inputting${e}VerificationCode`,actions:["setInvitation","log"]},[`authenticating${e}Invitation`]:{target:`.authenticating${e}VerificationCode`,actions:["setInvitation","log"]},[`success${e}Invitation`]:{target:t,actions:["setInvitation","log"]},[`fail${e}Invitation`]:{target:`.failing${e}Invitation`,actions:[Yt({[e.toLowerCase()]:(n,i)=>({...n[e.toLowerCase()],failReason:i.reason})}),"log"]}}}},on:{[`set${e}InvitationCode`]:{target:`.acceptingRedeemed${e}Invitation`,actions:[Yt({[e.toLowerCase()]:(n,i)=>({...n[e.toLowerCase()],unredeemedCode:i.code,succeededKeys:i.succeededKeys})}),`redeem${e}InvitationCode`,`invalidate${e}InvitationCode`,"log"]}}}),Y9=fd({id:"join",predictableActionArguments:!0,context:{mode:"default",identity:null,halo:{},space:{}},initial:"unknown",states:{unknown:{always:[{cond:"existingIdentity",target:"resettingIdentity",actions:"log"},{cond:"noSelectedIdentity",target:"choosingIdentity",actions:"log"},{target:"acceptingSpaceInvitation",actions:"log"}]},choosingIdentity:{initial:"unknownAuthMethod",states:{unknownAuthMethod:{always:[{cond:"hasHaloUnredeemedCode",target:"acceptingHaloInvitation",actions:"log"},{target:"choosingAuthMethod",actions:"log"}]},choosingAuthMethod:{},recoveringIdentity:{},creatingIdentity:{},acceptingHaloInvitation:H1("Halo","#join.acceptingSpaceInvitation"),confirmingAddedIdentity:{}},on:{recoverIdentity:{target:".recoveringIdentity",actions:"log"},createIdentity:{target:".creatingIdentity",actions:"log"},acceptHaloInvitation:{target:".acceptingHaloInvitation",actions:"log"},addIdentity:{target:".confirmingAddedIdentity",actions:"log"},selectIdentity:{target:"acceptingSpaceInvitation",actions:["setIdentity","log"]},deselectAuthMethod:{target:".choosingAuthMethod",actions:"log"}}},resettingIdentity:{},acceptingSpaceInvitation:H1("Space","#join.finishingJoiningSpace"),finishingJoiningSpace:{type:"final"},finishingJoiningHalo:{type:"final"}},on:{resetIdentity:{target:"choosingIdentity",actions:"unsetIdentity"}}},{guards:{existingIdentity:({identity:e,mode:t},r)=>t==="halo-only"&&!!e,noSelectedIdentity:({identity:e},t)=>!e,hasHaloUnredeemedCode:({halo:e},t)=>!!e.unredeemedCode,noSpaceInvitation:({space:e},t)=>!e.invitation&&!e.unredeemedCode},actions:{setIdentity:Yt({identity:(e,t)=>t.identity}),unsetIdentity:Yt({identity:()=>null}),resetInvitation:Yt({halo:(e,t)=>t.type!=="resetHaloInvitation"?e.halo:(e.halo.invitationObservable&&e.halo.invitationObservable.cancel(),{...e.halo,invitation:void 0,invitationObservable:void 0,invitationSubscribable:void 0}),space:(e,t)=>t.type!=="resetSpaceInvitation"?e.space:(e.space.invitationObservable&&e.space.invitationObservable.cancel(),{...e.space,invitation:void 0,invitationObservable:void 0,invitationSubscribable:void 0})}),setInvitation:Yt({halo:(e,t)=>t.type.includes("Halo")?{...e.halo,invitation:t.invitation}:e.halo,space:(e,t)=>t.type.includes("Space")?{...e.space,invitation:t.invitation}:e.space}),log:(e,t)=>{tt("[transition]",{event:t,haloInvitation:e.halo.invitation,spaceInvitation:e.space.invitation})}}}),V1=(e,t)=>{try{const r=new URLSearchParams(t.substring(t.lastIndexOf("?")));return r.get(`${e}InvitationCode`)??r.get(`${e}Invitation`)??r.get("invitationCode")??r.get("invitation")??t}catch(r){return tt.catch(r),t}},J9=(e,t)=>{const r=c.useCallback(({halo:a})=>{if(a.unredeemedCode)try{const s=ln.InvitationEncoder.decode(V1("halo",a.unredeemedCode)),l=e.halo.join(s);return{...a,invitationObservable:l,invitationSubscribable:z1("Halo",l)}}catch(s){return tt.error("Could not redeem device invitation code",s),a}else return a},[e]),n=c.useCallback(({space:a})=>{if(a.unredeemedCode)try{const s=ln.InvitationEncoder.decode(V1("space",a.unredeemedCode)),l=e.spaces.join(s);return{...a,invitationObservable:l,invitationSubscribable:z1("Space",l)}}catch(s){return tt.error("Could not redeem space invitation code",s),a}else return a},[e]),i=c.useCallback(({halo:a})=>{var s;return a.unredeemedCode?((s=t==null?void 0:t.onInvalidateInvitationCode)==null||s.call(t,a.unredeemedCode),{...a,unredeemedCode:void 0}):a},[t==null?void 0:t.onInvalidateInvitationCode]),o=c.useCallback(({space:a})=>{var s;return a.unredeemedCode?((s=t==null?void 0:t.onInvalidateInvitationCode)==null||s.call(t,a.unredeemedCode),{...a,unredeemedCode:void 0}):a},[t==null?void 0:t.onInvalidateInvitationCode]);return dd(Y9,{...t,actions:{...t==null?void 0:t.actions,redeemHaloInvitationCode:Yt({halo:r}),redeemSpaceInvitationCode:Yt({space:n}),invalidateHaloInvitationCode:Yt({halo:i}),invalidateSpaceInvitationCode:Yt({space:o})}})},X9=e=>{const t=!e.active,{send:r}=e,{t:n}=it("os"),i={disabled:t,after:c.createElement(Ye.CaretRight,{className:Ve(4),weight:"bold"}),slots:{label:{className:"text-sm"}}};return c.createElement(c.Fragment,null,c.createElement(xr,null,n("addition method chooser title")),c.createElement("div",{role:"none",className:"flex flex-col gap-1 grow"},c.createElement(Au,{...i,description:n("create identity description"),before:c.createElement(Ye.Plus,{className:Ve(6)}),onClick:()=>r({type:"createIdentity"}),"data-autofocus":"choosingAuthMethod","data-testid":"identity-chooser.create-identity"},n("create identity label")),c.createElement(Au,{...i,description:n("join identity description"),before:c.createElement(Ye.QrCode,{className:Ve(6)}),onClick:()=>r({type:"acceptHaloInvitation"}),"data-testid":"identity-chooser.join-identity"},n("join identity label")),c.createElement(Au,{...i,disabled:!0,description:n("recover identity description"),before:c.createElement(Ye.Textbox,{className:Ve(6)}),onClick:()=>r({type:"recoverIdentity"}),"data-testid":"identity-chooser.recover-identity"},n("recover identity label"))))},Z9=e=>{var v,y;const{mode:t,addedIdentity:r,active:n,send:i,onDone:o,doneActionParent:a}=e,s=!n,{t:l}=it("os"),u=r==null?void 0:r.identityKey.toHex(),d=St("identityListItem__label"),p=vs(u??"",12),h=((v=r==null?void 0:r.profile)==null?void 0:v.displayName)??(r&&Fs(r==null?void 0:r.identityKey.toHex())),m=c.createElement(lt,{...o&&{onClick:()=>o(null)},disabled:s,"data-autofocus":"confirmingAddedIdentity","data-testid":"identity-added-done"},c.createElement("span",null,l("done label")));return c.createElement(c.Fragment,null,c.createElement(xr,null,l("identity added label")),c.createElement("div",{role:"none",className:"grow flex flex-col items-center justify-center text-center gap-2"},c.createElement(Pt.Root,{status:"active",labelId:d},c.createElement(Pt.Frame,null,c.createElement(Pt.Fallback,{href:p})),c.createElement(Pt.Label,{classNames:ue("text-lg truncate",!((y=r==null?void 0:r.profile)!=null&&y.displayName)&&"font-mono")},h))),c.createElement(qt,null,t==="halo-only"?a?c.cloneElement(a,{},m):m:c.createElement(lt,{variant:"primary",disabled:s||!r,onClick:()=>r&&i({type:"selectIdentity",identity:r}),"data-autofocus":"confirmingAddedIdentity"},l("continue label"))))},Q9=e=>{const{send:t,method:r}=e,n=r==="recover identity",i=qe.useClient(),{t:o}=it("os"),[a,s]=c.useState(""),l=u=>{i.halo.createIdentity({[n?"seedphrase":"displayName"]:u}).then(d=>{t==null||t({type:"selectIdentity",identity:d})},d=>{tt.catch(d),s(o(n?"failed to recover identity message":"failed to create identity message"))})};return c.createElement(eB,{...e,onDisplayNameConfirm:l,validationMessage:a})},eB=e=>{const{method:t,send:r,active:n,onDisplayNameConfirm:i,validationMessage:o}=e,a=!n,{t:s}=it("os"),[l,u]=c.useState(""),d=t==="recover identity";return c.createElement(c.Fragment,null,c.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},c.createElement(ra,{validationMessage:o,label:c.createElement(xr,null,s(d?"recover identity input label":"new identity input label")),disabled:a,"data-testid":"identity-input",placeholder:d?"Type your recovery phrase":"Type a display name",onChange:({target:{value:p}})=>u(p)})),c.createElement(qt,null,c.createElement(lt,{variant:"ghost",disabled:a,onClick:()=>r==null?void 0:r({type:"deselectAuthMethod"}),"data-testid":`${t==="recover identity"?"recover":"create"}-identity-input-back`},s("back label")),c.createElement(lt,{variant:"primary",disabled:a,onClick:()=>i==null?void 0:i(l),"data-testid":`${t==="recover identity"?"recover":"create"}-identity-input-continue`},s("continue label"))))},G1=e=>{const{active:t,Kind:r,doneActionParent:n,onDone:i}=e,o=!t,{t:a}=it("os"),s=c.createElement(lt,{variant:"primary",onClick:i,disabled:o,"data-autofocus":`success${r}Invitation finishingJoining${r}`,"data-testid":`${r.toLowerCase()}-invitation-accepted-done`},a("done label"));return c.createElement(c.Fragment,null,c.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},c.createElement("p",{className:"text-center text-sm font-normal"},a("welcome message"))),c.createElement(qt,null,n?c.cloneElement(n,{},s):s))},tB=e=>{try{const t=new URLSearchParams(e.substring(e.lastIndexOf("?")));return t.get("spaceInvitationCode")??t.get("deviceInvitationCode")??e}catch(t){return tt.catch(t),e}},K1=e=>{const{Kind:t,active:r,send:n,unredeemedCode:i,onExit:o,exitActionParent:a,onDone:s,doneActionParent:l,succeededKeys:u}=e,d=!r,{t:p}=it("os"),[h,m]=c.useState(i??"");c.useEffect(()=>{i&&m(i??"")},[i]);const v=()=>{h.trim().length!==0&&n({type:`set${t}InvitationCode`,code:tB(h),...t==="Space"&&{succeededKeys:u}})},y=c.createElement(lt,{variant:"ghost",disabled:d,...o?{onClick:()=>o()}:{onClick:()=>s==null?void 0:s(null)},"data-testid":"join-exit"},p("cancel label"));return c.createElement(c.Fragment,null,c.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},c.createElement(ra,{label:c.createElement(xr,null,p("invitation input label")),placeholder:"Type an invitation code",disabled:d,value:h,onChange:({target:{value:w}})=>m(w),"data-autofocus":`inputting${t}InvitationCode`,"data-testid":`${t.toLowerCase()}-invitation-input`,onKeyUp:({key:w})=>w==="Enter"&&v()})),c.createElement(qt,null,t==="Halo"?c.createElement(lt,{variant:"ghost",disabled:d,onClick:()=>n({type:"deselectAuthMethod"}),"data-testid":`${t.toLowerCase()}-invitation-input-back`},p("back label")):a?c.cloneElement(a,{},y):l?c.cloneElement(l,{},y):y,c.createElement(lt,{variant:"primary",disabled:d,onClick:v,"data-testid":`${t.toLowerCase()}-invitation-input-continue`},p("continue label"))))},rB=({invitationState:e,onInvitationCancel:t,active:r,send:n,Kind:i,failReason:o})=>{const{t:a}=it("os");return o?c.createElement(c.Fragment,null,c.createElement(xr,{className:It},a(o==="timeout"?"timeout status label":o==="cancelled"?"cancelled status label":"error status label")),c.createElement("div",{role:"none",className:"grow"}),c.createElement(qt,null,c.createElement(lt,{disabled:!r,onClick:()=>n({type:`reset${i}Invitation`}),"data-testid":"invitation-rescuer-reset"},a("reset label")))):c.createElement(c.Fragment,null,c.createElement(xr,{className:It},a("connecting status label")),c.createElement("div",{role:"none",className:"grow"}),c.createElement(qt,null,c.createElement(lt,{disabled:!0,classNames:"order-2","data-testid":"next"},a("next label")),c.createElement(lt,{disabled:!r,onClick:t,"data-testid":"invitation-rescuer-cancel"},a("cancel label"))))},q1=e=>{const{Kind:t,invitationState:r,active:n,send:i}=e,{t:o}=it("os");return c.createElement(c.Fragment,null,typeof r>"u"?c.createElement(c.Fragment,null,c.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},c.createElement(xr,{className:It},"There was a problem joining the space")),c.createElement(qt,null,c.createElement(lt,{disabled:!n,"data-testid":"invitation-rescuer-blank-reset",onClick:()=>i({type:`reset${t}Invitation`})},o("reset label")))):c.createElement(rB,{...e}))},Y1=6,J1=({failed:e,Kind:t,active:r,pending:n,invitationId:i,onInvitationAuthenticate:o,onInvitationCancel:a})=>{const s=!r||n,{t:l}=it("os"),u=t.toLowerCase(),[d,p]=c.useState(""),h=({target:{value:m}})=>{var v;p(m),m.length===Y1&&((v=document.querySelector(`[data-autofocus-pinlength="${u}"]`))==null||v.focus())};return c.createElement(c.Fragment,null,c.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},i&&c.createElement(Bf,{text:Ff(i)}),c.createElement(Br.Root,{...e&&{validationValence:"error"}},c.createElement(Br.Label,{asChild:!0},c.createElement(xr,null,l("auth code input label"))),c.createElement(Br.PinInput,{disabled:s,length:Y1,onChange:h,inputMode:"numeric",autoComplete:"off",pattern:"\\d*","data-autofocus":`connecting${t}Invitation inputting${t}VerificationCode authenticationFailing${t}VerificationCode authenticating${t}VerificationCode`,"data-prevent-ios-autofocus":!0,"data-testid":`${u}-auth-code-input`,"data-1p-ignore":!0}),e&&c.createElement(Br.DescriptionAndValidation,{classNames:"text-center"},c.createElement(Br.Validation,null,l("failed to authenticate message"))))),c.createElement(qt,null,c.createElement(lt,{variant:"ghost",disabled:s,onClick:()=>a==null?void 0:a(),"data-testid":`${u}-invitation-authenticator-cancel`},l("cancel label")),c.createElement(lt,{variant:"primary",disabled:s,onClick:()=>o==null?void 0:o(d),"data-autofocus-pinlength":u,"data-testid":`${u}-invitation-authenticator-next`},l("next label"))))},nB=({send:e,active:t})=>{const r=qe.useClient(),{t:n}=it("os"),[i,o]=c.useState(""),[a,s]=c.useState(!1),l=()=>{s(!0),r.reset().then(()=>e==null?void 0:e({type:"resetIdentity"}),u=>{tt.catch(u),o(n("failed to reset identity message")),s(!1)})};return c.createElement(iB,{disabled:!t,pending:a,validationMessage:i,onConfirm:()=>l()})},iB=({disabled:e,pending:t,validationMessage:r,onConfirm:n})=>{const{t:i}=it("os"),o=i("confirmation value"),[a,s]=c.useState("");return c.createElement(c.Fragment,null,c.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},c.createElement(ra,{validationMessage:r,label:c.createElement(xr,null,i("reset identity input label",{confirmationValue:o})),disabled:e,"data-testid":"reset-identity-input",placeholder:o,onChange:({target:{value:l}})=>s(l)})),c.createElement(qt,null,c.createElement(lt,{variant:"primary",disabled:e||t||a!==o,onClick:()=>n==null?void 0:n(),"data-testid":"reset-identity-input-confirm"},i(t?"reset in progress label":"confirm label"))))},Jt="pbs-1 pbe-3 pli-3",oB=e=>{const{titleId:t,send:r,activeView:n,failed:i,mode:o,unredeemedCodes:a,invitationStates:s,succeededKeys:l,failReasons:u,onExit:d,onHaloDone:p,onSpaceDone:h,exitActionParent:m,doneActionParent:v,onHaloInvitationCancel:y,onSpaceInvitationCancel:w,onHaloInvitationAuthenticate:E,onSpaceInvitationAuthenticate:_,IdentityInput:S=Q9,ResetIdentity:$=nB}=e;return c.createElement(Oi,{density:"fine"},o!=="halo-only"&&c.createElement(q9,{titleId:t,mode:o,onExit:d,exitActionParent:m}),c.createElement(ct.Root,{focusManaged:!0,activeView:n},c.createElement(ct.Views,null,c.createElement(ct.View,{classNames:Jt,id:"addition method chooser"},c.createElement(X9,{send:r,active:n==="addition method chooser"})),c.createElement(ct.View,{classNames:Jt,id:"reset identity confirmation"},c.createElement($,{send:r,method:"reset identity",active:n==="reset identity confirmation"})),c.createElement(ct.View,{classNames:Jt,id:"create identity input"},c.createElement(S,{send:r,method:"create identity",active:n==="create identity input"})),c.createElement(ct.View,{classNames:Jt,id:"recover identity input"},c.createElement(S,{send:r,method:"recover identity",active:n==="recover identity input"})),c.createElement(ct.View,{classNames:Jt,id:"halo invitation input"},c.createElement(K1,{send:r,Kind:"Halo",active:n==="halo invitation input",...(a==null?void 0:a.Halo)&&{unredeemedCode:a.Halo},...(l==null?void 0:l.Halo)&&{succeededKeys:l.Halo}})),c.createElement(ct.View,{classNames:Jt,id:"halo invitation rescuer"},c.createElement(q1,{send:r,Kind:"Halo",active:n==="halo invitation rescuer",invitationState:s==null?void 0:s.Halo,onInvitationCancel:y,failReason:u==null?void 0:u.Halo})),c.createElement(ct.View,{classNames:Jt,id:"halo invitation authenticator"},c.createElement(J1,{send:r,Kind:"Halo",active:n==="halo invitation authenticator",onInvitationCancel:y,onInvitationAuthenticate:E,...i.has("Halo")&&{failed:!0}})),c.createElement(ct.View,{classNames:Jt,id:"halo invitation accepted"},c.createElement(G1,{send:r,Kind:"Halo",active:n==="halo invitation accepted",doneActionParent:v,onDone:p})),c.createElement(ct.View,{classNames:Jt,id:"identity added"},c.createElement(Z9,{send:r,mode:o,active:n==="identity added",doneActionParent:v,onDone:p})),c.createElement(ct.View,{classNames:Jt,id:"space invitation input"},c.createElement(K1,{send:r,Kind:"Space",active:n==="space invitation input",...(a==null?void 0:a.Space)&&{unredeemedCode:a.Space},...(l==null?void 0:l.Space)&&{succeededKeys:l.Space},onExit:d,exitActionParent:m})),c.createElement(ct.View,{classNames:Jt,id:"space invitation rescuer"},c.createElement(q1,{send:r,Kind:"Space",active:n==="space invitation rescuer",invitationState:s==null?void 0:s.Space,onInvitationCancel:w,failReason:u==null?void 0:u.Space})),c.createElement(ct.View,{classNames:Jt,id:"space invitation authenticator"},c.createElement(J1,{send:r,Kind:"Space",active:n==="space invitation authenticator",onInvitationCancel:w,onInvitationAuthenticate:_,...i.has("Space")&&{failed:!0}})),c.createElement(ct.View,{classNames:Jt,id:"space invitation accepted"},c.createElement(G1,{send:r,Kind:"Space",active:n==="space invitation accepted",doneActionParent:v,onDone:h})))))},aB=({titleId:e,mode:t="default",initialInvitationCode:r,exitActionParent:n,onExit:i,doneActionParent:o,onDone:a})=>{const s=qe.useClient(),l=vo.useIdentity(),{hasIosKeyboard:u}=Pe(),d=St("joinPanel__heading",e),[p,h,m]=J9(s,{context:{mode:t,identity:l,...r&&{[t==="halo-only"?"halo":"space"]:{unredeemedCode:r}}}});c.useEffect(()=>m.subscribe(T=>{tt("[state]",T)}).unsubscribe,[m]),c.useEffect(()=>{const C=p.configuration[0].id.split("."),T=C[C.length-1],D=T==="finishingJoining"?"successSpaceInvitation":T,j=document.querySelector(`[data-autofocus~="${D}"]`);j&&!(u&&j.hasAttribute("data-prevent-ios-autofocus"))&&j.focus()},[p.value,u]);const v=c.useMemo(()=>{switch(!0){case p.matches({choosingIdentity:"choosingAuthMethod"}):return"addition method chooser";case p.matches("resettingIdentity"):return"reset identity confirmation";case p.matches({choosingIdentity:"creatingIdentity"}):return"create identity input";case p.matches({choosingIdentity:"recoveringIdentity"}):return"recover identity input";case p.matches({choosingIdentity:{acceptingHaloInvitation:"inputtingHaloInvitationCode"}}):return"halo invitation input";case[{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"connectingHaloInvitation"}}},{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"failingHaloInvitation"}}}].some(p.matches):return"halo invitation rescuer";case[{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"inputtingHaloVerificationCode"}}},{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"authenticatingHaloVerificationCode"}}},{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"authenticationFailingHaloVerificationCode"}}}].some(p.matches):return"halo invitation authenticator";case[{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"successHaloInvitation"}}},"finishingJoiningHalo"].some(p.matches):return"halo invitation accepted";case p.matches({choosingIdentity:"confirmingAddedIdentity"}):return"identity added";case p.matches({acceptingSpaceInvitation:"inputtingSpaceInvitationCode"}):return"space invitation input";case[{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"connectingSpaceInvitation"}},{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"failingSpaceInvitation"}}].some(p.matches):return"space invitation rescuer";case[{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"inputtingSpaceVerificationCode"}},{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"authenticatingSpaceVerificationCode"}},{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"authenticationFailingSpaceVerificationCode"}}].some(p.matches):return"space invitation authenticator";case p.matches("finishingJoiningSpace"):return"space invitation accepted";default:return"never"}},[p]),y=c.useMemo(()=>{const C=new Set;switch(!0){case p.matches({choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"authenticationFailingHaloVerificationCode"}}}):C.add("Halo");break;case p.matches({acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"authenticationFailingSpaceVerificationCode"}}):C.add("Space");break}return C},[p]),w=c.useMemo(()=>({Halo:p.context.halo.unredeemedCode,Space:p.context.space.unredeemedCode}),[p]),E=qe.useMulticastObservable(s.spaces),_=c.useMemo(()=>({Space:E?new Set(E.map(({key:C})=>C.toHex())):void 0}),[E]),S=c.useMemo(()=>{var C,T;return{Halo:(C=p.context.halo.invitationObservable)==null?void 0:C.get().state,Space:(T=p.context.space.invitationObservable)==null?void 0:T.get().state}},[p]),$=c.useMemo(()=>({Halo:p.context.halo.failReason,Space:p.context.space.failReason}),[p]),k=c.useCallback(()=>{var C,T,D,j;a==null||a({identityKey:((C=p.context.halo.invitation)==null?void 0:C.identityKey)??null,swarmKey:((T=p.context.halo.invitation)==null?void 0:T.swarmKey)??null,spaceKey:((D=p.context.halo.invitation)==null?void 0:D.spaceKey)??null,target:((j=p.context.halo.invitation)==null?void 0:j.target)??null})},[p,a]),P=c.useCallback(()=>{var C,T,D,j;a==null||a({identityKey:((C=p.context.space.invitation)==null?void 0:C.identityKey)??null,swarmKey:((T=p.context.space.invitation)==null?void 0:T.swarmKey)??null,spaceKey:((D=p.context.space.invitation)==null?void 0:D.spaceKey)??null,target:((j=p.context.space.invitation)==null?void 0:j.target)??null})},[p,a]);return c.createElement(oB,{titleId:d,mode:t,send:h,activeView:v,failed:y,failReasons:$,pending:["connecting","authenticating"].some(C=>p==null?void 0:p.configuration[0].id.includes(C)),unredeemedCodes:w,invitationStates:S,succeededKeys:_,identity:l,onExit:i,exitActionParent:n,doneActionParent:o,onHaloDone:k,onSpaceDone:P,onHaloInvitationCancel:()=>{var C;return(C=p.context.halo.invitationObservable)==null?void 0:C.cancel()},onSpaceInvitationCancel:()=>{var C;return(C=p.context.space.invitationObservable)==null?void 0:C.cancel()},onHaloInvitationAuthenticate:C=>{var T;return h({type:"authenticateHaloVerificationCode"}),(T=p.context.halo.invitationObservable)==null?void 0:T.authenticate(C)},onSpaceInvitationAuthenticate:C=>{var T;return h({type:"authenticateSpaceVerificationCode"}),(T=p.context.space.invitationObservable)==null?void 0:T.authenticate(C)}})},sB=fd({id:"space",predictableActionArguments:!0,context:{space:null},initial:"managingSpace",states:{managingSpace:{},managingSpaceInvitation:{}},on:{deselectInvitation:{target:".managingSpace",actions:["unsetInvitation","log"]},selectInvitation:{target:".managingSpaceInvitation",actions:["setInvitation","log"]}}},{actions:{setInvitation:Yt({invitation:(e,t)=>(t==null?void 0:t.invitation)??null}),unsetInvitation:Yt({invitation:()=>{}}),log:(e,t)=>{tt("[transition]",{event:t,context:e})}}}),lB=e=>dd(sB,{...e,context:{...e==null?void 0:e.context}}),X1="dxos:react-shell/space-manager/active-action",cB=e=>{const{space:t,target:r}=e,{t:n}=it("os"),i=qe.useConfig(),o=Ca.useSpaceInvitations(t==null?void 0:t.key),a=c.useCallback(l=>{const u=ln.InvitationEncoder.encode(l);l.state===we.State.CONNECTING&&console.log(JSON.stringify({invitationCode:u,authCode:l.authCode}))},[]),s={inviteOne:{label:n("invite one label"),description:n("invite one description"),icon:Ye.UserPlus,onClick:c.useCallback(()=>{var u,d,p,h;const l=(u=t.share)==null?void 0:u.call(t,{type:we.Type.INTERACTIVE,authMethod:we.AuthMethod.SHARED_SECRET,target:r});l&&((h=(p=(d=i.values.runtime)==null?void 0:d.app)==null?void 0:p.env)==null?void 0:h.DX_ENVIRONMENT)!=="production"&&l.subscribe(a)},[t])},inviteMany:{label:n("invite many label"),description:n("invite many description"),icon:Ye.UsersThree,onClick:c.useCallback(()=>{var u,d,p,h;const l=(u=t.share)==null?void 0:u.call(t,{type:we.Type.MULTIUSE,authMethod:we.AuthMethod.NONE,target:r});l&&((h=(p=(d=i.values.runtime)==null?void 0:d.app)==null?void 0:p.env)==null?void 0:h.DX_ENVIRONMENT)!=="production"&&l.subscribe(a)},[t])}};return c.createElement(uB,{...e,invitations:o,inviteActions:s})},Z1="pis-3 pie-1 plb-1 mbe-1 font-medium",uB=e=>{const{active:t,space:r,createInvitationUrl:n,send:i,inviteActions:o,invitations:a,showInactiveInvitations:s,SpaceMemberList:l=E4,InvitationList:u=yM}=e,{t:d}=it("os"),p=o??{noopInvite:{label:d("create space invitation label"),description:"",icon:Ye.Placeholder,onClick:()=>{}}},[h,m]=c.useState(localStorage.getItem(X1)??"inviteOne"),v=w=>{m(w),localStorage.setItem(X1,w)},y=s?a:a==null?void 0:a.filter(w=>![we.State.CANCELLED].includes(w.get().state));return c.createElement(c.Fragment,null,c.createElement(ys.Root,{classNames:"grow shrink basis-28 -mli-2"},c.createElement(ys.Viewport,{classNames:"is-full pie-2"},!!(y!=null&&y.length)&&c.createElement(c.Fragment,null,c.createElement("h3",{className:ue(Z1,It)},d("invitation list heading")),c.createElement(u,{className:"mb-2",send:i,invitations:y??[],onClickRemove:w=>w.cancel(),createInvitationUrl:n}),c.createElement("h3",{className:ue(Z1,It,"mbs-2")},d("space member list heading"))),c.createElement(l,{spaceKey:r.key,includeSelf:!0})),c.createElement(ys.Scrollbar,{orientation:"vertical"},c.createElement(ys.Thumb,null))),c.createElement(qt,null,c.createElement(wM,{disabled:!t,actions:p,activeAction:h,onChangeActiveAction:v,"data-testid":"spaces-panel.create-invitation"})))},fB=({titleId:e,space:t,onDone:r})=>{const{t:n}=it("os"),i=t.properties.name;return c.createElement(jf,{titleId:e,title:n("space panel heading"),corner:c.createElement(Bb,{"data-testid":"identity-panel-done",onDone:r})},c.createElement("div",{role:"none",className:"flex gap-4 items-center justify-center mlb-4"},c.createElement(Ye.Planet,{size:32}),c.createElement("div",{className:"block text-start font-light text-xl"},i??t.key.truncate())))},Q1=e=>{const{titleId:t,activeView:r,space:n,target:i,SpaceManager:o=cB,InvitationManager:a=U1,...s}=e;return c.createElement(Oi,{density:"fine"},c.createElement(fB,{...s,titleId:t,space:n}),c.createElement(ct.Root,{activeView:r},c.createElement(ct.Views,null,c.createElement(ct.View,{id:"space manager",classNames:Jt},c.createElement(o,{active:r==="space manager",space:n,target:i,...s})),c.createElement(ct.View,{id:"space invitation manager",classNames:Jt},c.createElement(a,{active:r==="space invitation manager",...s,invitationUrl:e.invitationUrl})))))},dB=({invitation:e,...t})=>{const r=xf(e);return c.createElement(Q1,{...t,...r,invitationUrl:t.createInvitationUrl(r.invitationCode)})},pB=({titleId:e,createInvitationUrl:t=n=>n,...r})=>{const n=St("spacePanel__heading",e),[i,o,a]=lB({context:{space:r.space}});c.useEffect(()=>a.subscribe(d=>{tt("[state]",d)}).unsubscribe,[a]);const s=c.useMemo(()=>{switch(!0){case i.matches("managingSpace"):return"space manager";case i.matches("managingSpaceInvitation"):return"space invitation manager";default:return"never"}},[i]),l={...r,activeView:s,send:o,titleId:n,createInvitationUrl:t};return i.context.invitation?c.createElement(dB,{...l,invitation:i.context.invitation}):c.createElement(Q1,{...l})},hB=e=>{const t=St("spaceDialog__title");return c.createElement(Fr.Root,{defaultOpen:!0,onOpenChange:r=>{var n;return r||((n=e.onDone)==null?void 0:n.call(e))}},c.createElement(Fr.Portal,null,c.createElement(Fr.Overlay,null,c.createElement(Fr.Content,{"aria-labelledby":t,onOpenAutoFocus:r=>r.preventDefault()},c.createElement(Cu,null,c.createElement(K9,{...e,titleId:t,doneActionParent:c.createElement(Fr.Close,{asChild:!0})}))))))},ew=e=>{const t=St("joinDialog__title"),{height:r}=WO();return c.createElement(Ai.Root,{defaultOpen:!0,onOpenChange:n=>{var i;return n||(e.onExit?e.onExit():(i=e.onDone)==null?void 0:i.call(e,null))}},c.createElement(Ai.Portal,null,c.createElement(Ai.Overlay,{classNames:"backdrop-blur",...r&&{style:{blockSize:`${r}px`}}},c.createElement(Ai.Content,{"aria-labelledby":t},c.createElement(aB,{...e,titleId:t,exitActionParent:c.createElement(Ai.Cancel,{asChild:!0}),doneActionParent:c.createElement(Ai.Action,{asChild:!0})})))))};var gd,Sl=sn;if(process.env.NODE_ENV==="production")gd=Sl.createRoot,Sl.hydrateRoot;else{var tw=Sl.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;gd=function(e,t){tw.usingClientEntryPoint=!0;try{return Sl.createRoot(e,t)}finally{tw.usingClientEntryPoint=!1}}}var md={exports:{}};(function(e,t){(function(r,n){var i="1.0.35",o="",a="?",s="function",l="undefined",u="object",d="string",p="major",h="model",m="name",v="type",y="vendor",w="version",E="architecture",_="console",S="mobile",$="tablet",k="smarttv",P="wearable",C="embedded",T=350,D="Amazon",j="Apple",F="ASUS",M="BlackBerry",Z="Browser",Y="Chrome",X="Edge",ne="Firefox",oe="Google",ce="Huawei",se="LG",ge="Microsoft",le="Motorola",V="Opera",J="Samsung",re="Sharp",de="Sony",H="Xiaomi",G="Zebra",B="Facebook",z="Chromium OS",K="Mac OS",I=function(Se,je){var b={};for(var f in Se)je[f]&&je[f].length%2===0?b[f]=je[f].concat(Se[f]):b[f]=Se[f];return b},N=function(Se){for(var je={},b=0;b<Se.length;b++)je[Se[b].toUpperCase()]=Se[b];return je},Q=function(Se,je){return typeof Se===d?ie(je).indexOf(ie(Se))!==-1:!1},ie=function(Se){return Se.toLowerCase()},pe=function(Se){return typeof Se===d?Se.replace(/[^\d\.]/g,o).split(".")[0]:n},ye=function(Se,je){if(typeof Se===d)return Se=Se.replace(/^\s\s*/,o),typeof je===l?Se:Se.substring(0,T)},_e=function(Se,je){for(var b=0,f,g,x,O,L,W;b<je.length&&!L;){var me=je[b],ke=je[b+1];for(f=g=0;f<me.length&&!L&&me[f];)if(L=me[f++].exec(Se),L)for(x=0;x<ke.length;x++)W=L[++g],O=ke[x],typeof O===u&&O.length>0?O.length===2?typeof O[1]==s?this[O[0]]=O[1].call(this,W):this[O[0]]=O[1]:O.length===3?typeof O[1]===s&&!(O[1].exec&&O[1].test)?this[O[0]]=W?O[1].call(this,W,O[2]):n:this[O[0]]=W?W.replace(O[1],O[2]):n:O.length===4&&(this[O[0]]=W?O[3].call(this,W.replace(O[1],O[2])):n):this[O]=W||n;b+=2}},xe=function(Se,je){for(var b in je)if(typeof je[b]===u&&je[b].length>0){for(var f=0;f<je[b].length;f++)if(Q(je[b][f],Se))return b===a?n:b}else if(Q(je[b],Se))return b===a?n:b;return Se},ae={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},Me={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},at={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[w,[m,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[w,[m,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[m,w],[/opios[\/ ]+([\w\.]+)/i],[w,[m,V+" Mini"]],[/\bopr\/([\w\.]+)/i],[w,[m,V]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[m,w],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[w,[m,"UC"+Z]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[w,[m,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[w,[m,"WeChat"]],[/konqueror\/([\w\.]+)/i],[w,[m,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[w,[m,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[w,[m,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[m,/(.+)/,"$1 Secure "+Z],w],[/\bfocus\/([\w\.]+)/i],[w,[m,ne+" Focus"]],[/\bopt\/([\w\.]+)/i],[w,[m,V+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[w,[m,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[w,[m,"Dolphin"]],[/coast\/([\w\.]+)/i],[w,[m,V+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[w,[m,"MIUI "+Z]],[/fxios\/([-\w\.]+)/i],[w,[m,ne]],[/\bqihu|(qi?ho?o?|360)browser/i],[[m,"360 "+Z]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[m,/(.+)/,"$1 "+Z],w],[/(comodo_dragon)\/([\w\.]+)/i],[[m,/_/g," "],w],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[m,w],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[m],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[m,B],w],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[m,w],[/\bgsa\/([\w\.]+) .*safari\//i],[w,[m,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[w,[m,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[w,[m,Y+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[m,Y+" WebView"],w],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[w,[m,"Android "+Z]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[m,w],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[w,[m,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[w,m],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[m,[w,xe,ae]],[/(webkit|khtml)\/([\w\.]+)/i],[m,w],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[m,"Netscape"],w],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[w,[m,ne+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[m,w],[/(cobalt)\/([\w\.]+)/i],[m,[w,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[E,"amd64"]],[/(ia32(?=;))/i],[[E,ie]],[/((?:i[346]|x)86)[;\)]/i],[[E,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[E,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[E,"armhf"]],[/windows (ce|mobile); ppc;/i],[[E,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[E,/ower/,o,ie]],[/(sun4\w)[;\)]/i],[[E,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[E,ie]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[h,[y,J],[v,$]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[h,[y,J],[v,S]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[h,[y,j],[v,S]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[h,[y,j],[v,$]],[/(macintosh);/i],[h,[y,j]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[h,[y,re],[v,S]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[h,[y,ce],[v,$]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[h,[y,ce],[v,S]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[h,/_/g," "],[y,H],[v,S]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[h,/_/g," "],[y,H],[v,$]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[h,[y,"OPPO"],[v,S]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[h,[y,"Vivo"],[v,S]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[h,[y,"Realme"],[v,S]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[h,[y,le],[v,S]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[h,[y,le],[v,$]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[h,[y,se],[v,$]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[h,[y,se],[v,S]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[h,[y,"Lenovo"],[v,$]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[h,/_/g," "],[y,"Nokia"],[v,S]],[/(pixel c)\b/i],[h,[y,oe],[v,$]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[h,[y,oe],[v,S]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[h,[y,de],[v,S]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[h,"Xperia Tablet"],[y,de],[v,$]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[h,[y,"OnePlus"],[v,S]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[h,[y,D],[v,$]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[h,/(.+)/g,"Fire Phone $1"],[y,D],[v,S]],[/(playbook);[-\w\),; ]+(rim)/i],[h,y,[v,$]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[h,[y,M],[v,S]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[h,[y,F],[v,$]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[h,[y,F],[v,S]],[/(nexus 9)/i],[h,[y,"HTC"],[v,$]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[y,[h,/_/g," "],[v,S]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[h,[y,"Acer"],[v,$]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[h,[y,"Meizu"],[v,S]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[y,h,[v,S]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[y,h,[v,$]],[/(surface duo)/i],[h,[y,ge],[v,$]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[h,[y,"Fairphone"],[v,S]],[/(u304aa)/i],[h,[y,"AT&T"],[v,S]],[/\bsie-(\w*)/i],[h,[y,"Siemens"],[v,S]],[/\b(rct\w+) b/i],[h,[y,"RCA"],[v,$]],[/\b(venue[\d ]{2,7}) b/i],[h,[y,"Dell"],[v,$]],[/\b(q(?:mv|ta)\w+) b/i],[h,[y,"Verizon"],[v,$]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[h,[y,"Barnes & Noble"],[v,$]],[/\b(tm\d{3}\w+) b/i],[h,[y,"NuVision"],[v,$]],[/\b(k88) b/i],[h,[y,"ZTE"],[v,$]],[/\b(nx\d{3}j) b/i],[h,[y,"ZTE"],[v,S]],[/\b(gen\d{3}) b.+49h/i],[h,[y,"Swiss"],[v,S]],[/\b(zur\d{3}) b/i],[h,[y,"Swiss"],[v,$]],[/\b((zeki)?tb.*\b) b/i],[h,[y,"Zeki"],[v,$]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[y,"Dragon Touch"],h,[v,$]],[/\b(ns-?\w{0,9}) b/i],[h,[y,"Insignia"],[v,$]],[/\b((nxa|next)-?\w{0,9}) b/i],[h,[y,"NextBook"],[v,$]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[y,"Voice"],h,[v,S]],[/\b(lvtel\-)?(v1[12]) b/i],[[y,"LvTel"],h,[v,S]],[/\b(ph-1) /i],[h,[y,"Essential"],[v,S]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[h,[y,"Envizen"],[v,$]],[/\b(trio[-\w\. ]+) b/i],[h,[y,"MachSpeed"],[v,$]],[/\btu_(1491) b/i],[h,[y,"Rotor"],[v,$]],[/(shield[\w ]+) b/i],[h,[y,"Nvidia"],[v,$]],[/(sprint) (\w+)/i],[y,h,[v,S]],[/(kin\.[onetw]{3})/i],[[h,/\./g," "],[y,ge],[v,S]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[h,[y,G],[v,$]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[h,[y,G],[v,S]],[/smart-tv.+(samsung)/i],[y,[v,k]],[/hbbtv.+maple;(\d+)/i],[[h,/^/,"SmartTV"],[y,J],[v,k]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[y,se],[v,k]],[/(apple) ?tv/i],[y,[h,j+" TV"],[v,k]],[/crkey/i],[[h,Y+"cast"],[y,oe],[v,k]],[/droid.+aft(\w)( bui|\))/i],[h,[y,D],[v,k]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[h,[y,re],[v,k]],[/(bravia[\w ]+)( bui|\))/i],[h,[y,de],[v,k]],[/(mitv-\w{5}) bui/i],[h,[y,H],[v,k]],[/Hbbtv.*(technisat) (.*);/i],[y,h,[v,k]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[y,ye],[h,ye],[v,k]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[v,k]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[y,h,[v,_]],[/droid.+; (shield) bui/i],[h,[y,"Nvidia"],[v,_]],[/(playstation [345portablevi]+)/i],[h,[y,de],[v,_]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[h,[y,ge],[v,_]],[/((pebble))app/i],[y,h,[v,P]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[h,[y,j],[v,P]],[/droid.+; (glass) \d/i],[h,[y,oe],[v,P]],[/droid.+; (wt63?0{2,3})\)/i],[h,[y,G],[v,P]],[/(quest( 2| pro)?)/i],[h,[y,B],[v,P]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[y,[v,C]],[/(aeobc)\b/i],[h,[y,D],[v,C]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[h,[v,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[h,[v,$]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[v,$]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[v,S]],[/(android[-\w\. ]{0,9});.+buil/i],[h,[y,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[w,[m,X+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[w,[m,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[m,w],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[w,m]],os:[[/microsoft (windows) (vista|xp)/i],[m,w],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[m,[w,xe,Me]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[m,"Windows"],[w,xe,Me]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/ios;fbsv\/([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[w,/_/g,"."],[m,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[m,K],[w,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[w,m],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[m,w],[/\(bb(10);/i],[w,[m,M]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[w,[m,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[w,[m,ne+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[w,[m,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[w,[m,"watchOS"]],[/crkey\/([\d\.]+)/i],[w,[m,Y+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[m,z],w],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[m,w],[/(sunos) ?([\w\.\d]*)/i],[[m,"Solaris"],w],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[m,w]]},Oe=function(Se,je){if(typeof Se===u&&(je=Se,Se=n),!(this instanceof Oe))return new Oe(Se,je).getResult();var b=typeof r!==l&&r.navigator?r.navigator:n,f=Se||(b&&b.userAgent?b.userAgent:o),g=b&&b.userAgentData?b.userAgentData:n,x=je?I(at,je):at,O=b&&b.userAgent==f;return this.getBrowser=function(){var L={};return L[m]=n,L[w]=n,_e.call(L,f,x.browser),L[p]=pe(L[w]),O&&b&&b.brave&&typeof b.brave.isBrave==s&&(L[m]="Brave"),L},this.getCPU=function(){var L={};return L[E]=n,_e.call(L,f,x.cpu),L},this.getDevice=function(){var L={};return L[y]=n,L[h]=n,L[v]=n,_e.call(L,f,x.device),O&&!L[v]&&g&&g.mobile&&(L[v]=S),O&&L[h]=="Macintosh"&&b&&typeof b.standalone!==l&&b.maxTouchPoints&&b.maxTouchPoints>2&&(L[h]="iPad",L[v]=$),L},this.getEngine=function(){var L={};return L[m]=n,L[w]=n,_e.call(L,f,x.engine),L},this.getOS=function(){var L={};return L[m]=n,L[w]=n,_e.call(L,f,x.os),O&&!L[m]&&g&&g.platform!="Unknown"&&(L[m]=g.platform.replace(/chrome os/i,z).replace(/macos/i,K)),L},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return f},this.setUA=function(L){return f=typeof L===d&&L.length>T?ye(L,T):L,this},this.setUA(f),this};Oe.VERSION=i,Oe.BROWSER=N([m,w,p]),Oe.CPU=N([E]),Oe.DEVICE=N([h,y,v,_,S,k,$,P,C]),Oe.ENGINE=Oe.OS=N([m,w]),e.exports&&(t=e.exports=Oe),t.UAParser=Oe;var Re=typeof r!==l&&(r.jQuery||r.Zepto);if(Re&&!Re.ua){var gt=new Oe;Re.ua=gt.getResult(),Re.ua.get=function(){return gt.getUA()},Re.ua.set=function(Se){gt.setUA(Se);var je=gt.getResult();for(var b in je)Re.ua[b]=je[b]}}})(typeof window=="object"?window:et)})(md,md.exports);var gB=md.exports,$l="/home/runner/work/dxos/dxos/packages/core/mesh/rpc-tunnel/src/ports/iframe.ts",vd,yd;if(typeof navigator<"u"){const e=new gB.UAParser(navigator.userAgent);vd=e.getBrowser().name,yd=e.getOS().name}var mB=(e,t,r)=>{if(!e.contentWindow){tt("IFrame content window missing",{origin:t},{F:$l,L:24,S:void 0,C:(n,i)=>n(...i)});return}vd==="Chrome"&&yd==="iOS"?e.contentWindow.postMessage(r,t):e.contentWindow.postMessage(r,t,[r.payload])},vB=(e,t)=>{vd==="Chrome"&&yd==="iOS"?window.parent.postMessage(t,e):window.parent.postMessage(t,e,[t.payload])},rw=({channel:e,iframe:t,origin:r,onOrigin:n})=>({send:async i=>{if(!r){tt("no origin set",{channel:e},{F:$l,L:62,S:void 0,C:(s,l)=>s(...l)});return}tt("sending",{channel:e,data:i.length},{F:$l,L:66,S:void 0,C:(s,l)=>s(...l)});const o=i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),a={channel:e,payload:o};t?mB(t,r,a):vB(r,a)},subscribe:i=>{const o=a=>{if(!t&&a.source!==window.parent)return;if(t&&a.source!==t.contentWindow)return;const l=a.data&&typeof a.data=="object"&&"channel"in a.data&&"payload"in a.data?a.data:void 0;(l==null?void 0:l.channel)===e&&(r||(r=a.origin,n==null||n(r)),tt("received",l,{F:$l,L:98,S:void 0,C:(u,d)=>u(...d)}),i(new Uint8Array(l.payload)))};return window.addEventListener("message",o),()=>window.removeEventListener("message",o)}});const yB=e=>{const t=St("spaceDialog__title");return c.createElement(Fr.Root,{defaultOpen:!0,onOpenChange:r=>{var n;return r||((n=e.onDone)==null?void 0:n.call(e))}},c.createElement(Fr.Portal,null,c.createElement(Fr.Overlay,null,c.createElement(Fr.Content,{"aria-labelledby":t},c.createElement(Cu,null,c.createElement(pB,{...e,titleId:t,doneActionParent:c.createElement(Fr.Close,{asChild:!0})}))))))},bB=({runtime:e,origin:t})=>{const[{layout:r,invitationCode:n,spaceKey:i,target:o},a]=c.useState({layout:e.layout,invitationCode:e.invitationCode,spaceKey:e.spaceKey,target:e.target}),s=qe.useClient(),l=Ca.useSpace(i);switch(c.useEffect(()=>e.layoutUpdate.on(u=>a(u)),[e]),c.useEffect(()=>{if(r===qe.ShellLayout.SPACE&&!l){tt.warn("No space found for shell space invitations.");const u=setTimeout(async()=>{await e.setAppContext({display:qe.ShellDisplay.NONE}),e.setLayout({layout:qe.ShellLayout.DEFAULT})});return()=>clearTimeout(u)}},[e,r,l]),r){case qe.ShellLayout.INITIALIZE_IDENTITY:return c.createElement(ew,{mode:"halo-only",initialInvitationCode:n,onDone:()=>{e.setAppContext({display:qe.ShellDisplay.NONE}),e.setLayout({layout:qe.ShellLayout.DEFAULT})}});case qe.ShellLayout.IDENTITY:case qe.ShellLayout.SHARE_IDENTITY:case qe.ShellLayout.EDIT_PROFILE:return c.createElement(hB,{createInvitationUrl:u=>`${t}?deviceInvitationCode=${u}`,onResetDevice:async()=>{await s.reset(),await e.setAppContext({display:qe.ShellDisplay.NONE,reload:!0})},onJoinNewIdentity:()=>e.setLayout({layout:qe.ShellLayout.INITIALIZE_IDENTITY}),onDone:async()=>{await e.setAppContext({display:qe.ShellDisplay.NONE}),e.setLayout({layout:qe.ShellLayout.DEFAULT})}});case qe.ShellLayout.SPACE:return l?c.createElement(yB,{space:l,target:o,createInvitationUrl:u=>`${t}?spaceInvitationCode=${u}`,onDone:async()=>{await e.setAppContext({display:qe.ShellDisplay.NONE}),e.setLayout({layout:qe.ShellLayout.DEFAULT})}}):null;case qe.ShellLayout.JOIN_SPACE:return c.createElement(ew,{initialInvitationCode:n,onDone:async u=>{const d=(u==null?void 0:u.target)??void 0;await e.setAppContext({display:qe.ShellDisplay.NONE,spaceKey:(u==null?void 0:u.spaceKey)??void 0,target:d}),e.setLayout({layout:qe.ShellLayout.DEFAULT})},onExit:async()=>{await e.setAppContext({display:qe.ShellDisplay.NONE}),e.setLayout({layout:qe.ShellLayout.DEFAULT})}});default:return null}},wB={"en-US":Object.freeze(Object.defineProperty({__proto__:null,os:{"manage profile label":"Manage identity","identity offline description":"Offline","sidebar label":"DXOS sidebar","copy invitation code label":"Copy URL","copy invitation code success label":"Copied","open share panel label":"View QR code","joining space heading":"Joining space","join space heading":"Enter space invitation","halo heading":"Initialize device identity","exit label":"Exit","identity selector title":"Join as","identity radio group title":"Select an identity you’ve associated with this device already","add identity label":"Add","continue label":"Continue","back label":"Back","next label":"Next","close label":"Close","auth choices label":"Choose an identity","create identity label":"Create an identity","create identity description":"Create a new identity.","recover identity label":"Use a seed phrase","recover identity description":"Enter your seed phrase to log in manually.","join identity label":"Use another device","join identity description":"Add this device to an identity you’re already logged into on another device.","deselect identity label":"Back to identities","addition method chooser title":"An identity is required to continue","new identity input label":"Set display name","recover identity input label":"Type or paste your seed phrase","failed to create identity message":"Failed to create an identity.","failed to recover identity message":"Failed to recover an identity from the provided seed phrase.","failed to authenticate message":"Incorrect PIN.","identity added label":"Created identity & added to this device:","join space as identity heading":"<part>as </part><part><icon/><label>{{labelValue}}</label></part>","error status label":"Failed","timeout status label":"Timed out","cancelled status label":"Cancelled","init status label":"Ready to connect","connecting status label":"Connecting…","connected status label":"Enter confirmation PIN","authenticating status label":"Enter confirmation PIN","success status label":"Success","connect label":"Connect","reconnect label":"Reconnect","cancel label":"Cancel","done label":"Done","reset label":"Start over","auth code input label":"Enter the verification code","invitation input label":"Paste an invitation code or URL","create device invitation label":"Add device","create space invitation label":"Invite","qr label":"Scan to accept invitation","empty invitations message":"No pending invitations","empty device list message":"No devices authenticated other than this device.","show all spaces label":"All spaces","all spaces label":"All spaces","create space label":"Create a new space","join space label":"Join a space","show current space label":"Current space","view space invitations label":"View space invitations","toggle sidebar label":"Open/close sidebar","open sidebar label":"Open sidebar","close sidebar label":"Close sidebar","welcome message":"Welcome","selecting identity heading":"Selecting identity","devices heading":"Devices","identity heading":"Profile settings","choose add device label":"Add device","choose devices label":"Manage devices","choose profile label":"Edit profile","choose sign out label":"Sign out","empty space members message":"There is nobody in this space yet.","back to all invitations label":"Back to all invitations","invitation heading":"Invitation","invitation list heading":"Invitations","device invitation list heading":"Pending device invitations","space invitation list heading":"Pending invitations","device list heading":"Devices","space member list heading":"Members","space panel heading":"Space membership","auth code message":"Enter the following auth code on the joining device.","display name input label":"Display name","display name input placeholder":"Enter a display name","invite one label":"Invite one","invite one description":"Only one user may join.","invite one qr label":"Single-use","invite one list item label":"Active single-use invitation","invite many label":"Invite many","invite many description":"Anyone with the link can join.","invite many qr label":"Multiple-use","invite many list item label":"Active multiple-use invitation","invite options label":"Change the active invite option.","reset in progress label":"Resetting...","confirm label":"Confirm","reset identity input label":"This will clear this device and all associated data. Type {{confirmationValue}} and confirm to continue.","failed to reset identity message":"Failed to reset identity.","confirmation value":"CONFIRM","sign out chooser title":"DANGER ZONE","sign out chooser message":"Proceeding with either action below will erase all data on this device.","join new identity label":"Join a new identity","reset device label":"Reset device","reset device confirm message":"Are you sure you want to reset your device? All data will be lost."}},Symbol.toStringTag,{value:"Module"}))},EB=async(e=new qe.Config)=>{const t=new qe.ClientServicesProxy(rw({channel:ln.DEFAULT_CLIENT_CHANNEL})),r=new qe.Client({config:e,services:t}),n=new aw.ShellRuntimeImpl(rw({channel:ln.DEFAULT_SHELL_CHANNEL}));await Promise.all([n.open(),r.initialize()]),gd(document.getElementById("root")).render(c.createElement(c.StrictMode,null,c.createElement(lT,{tx:v4,resourceExtensions:[wB]},c.createElement(qe.ClientContext.Provider,{value:{client:r,status:qe.SystemStatus.ACTIVE}},c.createElement(Cu,null,c.createElement(Er.Provider,null,c.createElement(bB,{runtime:n,origin:location.origin})))))))};c.createContext({}),er.runShell=EB,Object.defineProperty(er,Symbol.toStringTag,{value:"Module"})});
216
216
  //# sourceMappingURL=shell.umd.js.map