@dxos/shell 0.6.10-staging.876c400 → 0.6.10-staging.b47eb25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/shell.mjs +10 -10
- package/dist/bundle/shell.mjs.map +1 -1
- package/dist/bundle/shell.umd.js +1 -1
- package/dist/bundle/shell.umd.js.map +1 -1
- package/package.json +23 -23
package/dist/bundle/shell.umd.js
CHANGED
|
@@ -991,7 +991,7 @@ button {
|
|
|
991
991
|
background-color: #61493f;
|
|
992
992
|
}
|
|
993
993
|
|
|
994
|
-
`;function $e5534fc185f7111e$export$2e2bcd8739ae039($){const _=React.useRef(null),I=React.useRef(null);return I.current&&I.current.update($),React.useEffect(()=>(I.current=new $efa000751917694d$export$2e2bcd8739ae039({...$,ref:_}),()=>{I.current=null}),[]),React.createElement("div",{ref:_})}const EmojiPickerToolbarButton=({disabled:$,defaultEmoji:_,emoji:I,onChangeEmoji:j,classNames:U})=>{const{t:q}=useTranslation("os"),{themeMode:G}=useThemeContext(),[K,J]=$71cd76cc60e0454e$export$6f32135080cb4c3({prop:I,onChange:j,defaultProp:_}),[Y,X]=React.useState(!1),Q=React.useRef(!1),[Z,ee]=React.useState(!1);return React.createElement(Tooltip.Root,{open:Z,onOpenChange:te=>{Q.current?(ee(!1),Q.current=!1):ee(te)}},React.createElement(Popover.Root,{open:Y,onOpenChange:te=>{X(te),Q.current=!0}},React.createElement(Tooltip.Trigger,{asChild:!0},React.createElement(Popover.Trigger,{asChild:!0},React.createElement(Toolbar.Button,{classNames:["gap-2 text-2xl plb-1",U],disabled:$},React.createElement("span",{className:"sr-only"},q("select emoji label")),React.createElement(react.UserCircle,{className:getSize(5)})))),React.createElement(Tooltip.Portal,null,React.createElement(Tooltip.Content,{side:"bottom",classNames:"z-50"},q("select emoji label"),React.createElement(Tooltip.Arrow,null))),React.createElement(Popover.Content,{side:"bottom",onKeyDownCapture:te=>{te.key==="Escape"&&(te.stopPropagation(),X(!1),Q.current=!0)}},React.createElement($e5534fc185f7111e$export$2e2bcd8739ae039,{data:emojiData,onEmojiSelect:({native:te})=>{te&&(J(te),X(!1))},autoFocus:!0,maxFrequentRows:0,noCountryFlags:!0,theme:G}),React.createElement(Popover.Arrow,null))))},HuePreview=({hue:$})=>{const{tx:_}=useThemeContext(),I=20;return React.createElement("svg",{width:I,height:I,viewBox:`0 0 ${I} ${I}`},React.createElement("rect",{x:0,y:0,width:I,height:I,className:_("hue.fill","select--hue__preview",{hue:$})}))},hueTokens=Object.keys(hueTokenThemes).slice(0,16),HuePickerToolbarButton=({disabled:$,hue:_,onChangeHue:I,classNames:j,defaultHue:U})=>{const{t:q}=useTranslation("os"),[G,K]=$71cd76cc60e0454e$export$6f32135080cb4c3({prop:_,onChange:I,defaultProp:U}),[J,Y]=React.useState(!1),X=React.useRef(!1),[Q,Z]=React.useState(!1);return React.createElement(Tooltip.Root,{open:Q,onOpenChange:ee=>{X.current?(Z(!1),X.current=!1):Z(ee)}},React.createElement(DropdownMenu2.Root,{modal:!1,open:J,onOpenChange:ee=>{Y(ee),X.current=!0}},React.createElement(Tooltip.Trigger,{asChild:!0},React.createElement(DropdownMenu2.Trigger,{asChild:!0},React.createElement(Toolbar.Button,{classNames:mx("gap-2 plb-1",j),disabled:$},React.createElement("span",{className:"sr-only"},q("select hue label")),React.createElement(react.Palette,{className:getSize(5)})))),React.createElement(Tooltip.Portal,null,React.createElement(Tooltip.Content,{side:"bottom",classNames:"z-50"},q("select hue label"),React.createElement(Tooltip.Arrow,null))),React.createElement(DropdownMenu2.Content,{side:"bottom",classNames:"!w-40"},React.createElement(DropdownMenu2.Viewport,{classNames:"grid grid-cols-4"},hueTokens.map(ee=>React.createElement(DropdownMenu2.CheckboxItem,{key:ee,checked:ee===G,onCheckedChange:()=>K(ee),classNames:"px-0 py-2 items-center justify-center"},React.createElement(HuePreview,{hue:ee})))))))};var data={adjectives:["abundant","accessible","accomplished","accurate","achievable","adaptable","adaptive","adequate","adjustable","admirable","admiring","adorable","adored","adoring","adroit","adulatory","advanced","advantageous","adventurous","affable","affectionate","affirmative","affluent","affordable","agile","agreeable","alluring","altruistic","amazed","amazing","ambitious","amenable","amiable","amicable","ample","amusing","angelic","appealing","appreciable","appreciated","appreciative","appropriate","ardent","articulate","artistic","assuring","astonished","astonishing","astounded","astounding","athletic","attentive","attractive","audible","auspicious","authentic","autonomous","available","avid","awed","awesome","awestruck","beauteous","beautiful","believable","beloved","beneficent","beneficial","benevolent","blameless","blissful","blithe","bonny","booming","boundless","bountiful","brainiest","brainy","brave","breathtaking","bright","brighter","brightest","brilliant","brisk","brotherly","bullish","buoyant","calm","calming","capable","captivating","carefree","catchy","celebrated","celebratory","champion","charismatic","charitable","charming","chaste","cheaper","cheapest","cheerful","cheery","cherished","chivalrous","classic","classy","clean","cleaner","cleanest","cleanly","clear","cleared","clearer","clever","coherent","cohesive","colorful","comely","comfortable","comforting","comfy","commendable","commodious","compact","compatible","competitive","compliant","conciliatory","concise","confident","congenial","considerate","consistent","constructive","consummate","contrasty","convenient","convincing","cool","coolest","cooperative","correct","courageous","courteous","courtly","cozy","creative","credible","crisp","crisper","cushy","cute","daring","darling","dashing","dauntless","dazzled","dazzling","decent","decisive","dedicated","defeated","deft","delectable","delicate","delicious","delighted","delightful","dependable","deserving","desirable","desirous","detachable","devout","dexterous","dextrous","dignified","diligent","diplomatic","distinctive","diversified","divine","dominated","dumbfounded","durable","dynamic","eager","earnest","eased","easy","easygoing","ebullient","economical","ecstatic","educated","effective","efficacious","efficient","effortless","effusive","elated","elegant","elite","eloquent","eminent","enchanted","enchanting","encouraging","endearing","endorsed","energetic","engaging","engrossing","enhanced","enjoyable","enraptured","enterprising","entertaining","enthralled","enthusiastic","enticing","entranced","entrancing","enviable","envious","equitable","erudite","ethical","euphoric","evaluative","eventful","everlasting","evocative","exalted","exalting","exceeding","excellent","exceptional","excited","exciting","exemplary","exhilarating","expansive","exquisite","exuberant","exultant","fabulous","fair","faithful","famed","famous","fancier","fancy","fantastic","fascinating","fashionable","fast","faster","fastest","faultless","favorable","favored","favorite","fearless","feasible","feisty","felicitous","fertile","fervent","fervid","festive","fiery","fine","finer","finest","firmer","flashy","flatter","flattering","flawless","flexible","flourishing","fluent","fond","foolproof","foremost","formidable","fortuitous","fortunate","fragrant","free","freed","fresh","fresher","freshest","friendly","frugal","fruitful","fun","funny","futuristic","gainful","gallant","galore","generous","genial","gentle","gentlest","genuine","gifted","glad","glamorous","gleeful","glimmering","glistening","glorious","glowing","godlike","gold","golden","good","goodly","gorgeous","graceful","gracious","grand","grateful","gratified","gratifying","great","greatest","guiltless","gutsy","halcyon","hale","hallowed","handier","handsome","handy","happier","happy","hardier","hardy","harmless","harmonious","healthful","healthy","heartening","heartfelt","heartwarming","heavenly","helpful","heroic","hilarious","holy","honest","honorable","honored","hopeful","hospitable","hot","hottest","humane","humble","humorous","humourous","ideal","idolized","idyllic","illuminating","illustrious","imaginative","immaculate","immense","impartial","impassioned","impeccable","important","impressed","impressive","improved","improving","incredible","indebted","indulgent","industrious","inestimable","inexpensive","infallible","influential","ingenious","ingenuous","innocuous","innovative","insightful","inspiring","instructive","instrumental","intelligent","intelligible","interesting","intimate","intricate","intriguing","intuitive","invaluable","inventive","invigorating","invincible","inviolable","inviolate","invulnerable","irresistible","jolly","jovial","joyful","joyous","jubilant","judicious","keen","kindly","laudable","lavish","lawful","leading","lean","legendary","lighter","likable","like","liked","lionhearted","lively","logical","lovable","loved","lovely","loving","loyal","lucid","luckier","luckiest","lucky","lucrative","luminous","lush","lustrous","luxuriant","luxurious","luxury","lyrical","magic","magical","magnanimous","magnificent","majestic","manageable","marvellous","marvelous","masterful","matchless","mature","meaningful","memorable","merciful","meritorious","merry","mesmerized","mesmerizing","meticulous","mighty","miraculous","modern","modest","momentous","monumental","motivated","navigable","neat","neatest","nice","nifty","nimble","noble","noiseless","noteworthy","nourishing","observant","obtainable","optimal","optimistic","opulent","orderly","organized","outstanding","overjoyed","painless","palatial","pampered","panoramic","paramount","passionate","patient","patri","peaceable","peaceful","peerless","peppy","perfect","permissible","personalized","phenomenal","picturesque","playful","pleasant","pleased","pleasing","pleasurable","plentiful","plush","poetic","poignant","poised","polished","polite","popular","portable","posh","positive","powerful","praiseworthy","praising","precious","precise","preeminent","preferable","premier","prestigious","pretty","priceless","principled","privileged","prize","proactive","prodigious","productive","proficient","profound","progressive","prolific","prominent","promised","promising","prompt","proper","propitious","prosperous","protective","proud","proven","prudent","punctual","pure","purposeful","quaint","qualified","quicker","quiet","quieter","radiant","rapid","rapt","rapturous","rational","reachable","readable","ready","realistic","realizable","reasonable","reasoned","receptive","recommended","redeeming","refined","reformed","refreshed","refreshing","regal","rejoicing","relaxed","reliable","remarkable","renewed","renowned","replaceable","reputable","resilient","resolute","resounding","resourceful","respectable","respectful","resplendent","responsive","restful","restored","retractable","reverent","rewarding","rich","righteous","rightful","robust","romantic","roomier","rosy","safe","saintly","salutary","sane","satisfactory","satisfied","satisfying","scenic","seamless","seasoned","secure","selective","sensational","sensible","sensitive","serene","sexy","sharp","sharper","sharpest","shiny","significant","silent","simpler","simplest","simplified","sincere","skilled","skillful","sleek","slick","smart","smarter","smartest","smelly","smiling","smitten","smooth","smoother","smoothest","snappy","snazzy","sociable","soft","softer","solid","soulful","spacious","sparkling","spectacular","speedy","spellbinding","spellbound","spirited","spiritual","splendid","spontaneous","sporty","spotless","sprightly","stable","stainless","stately","statuesque","staunch","steadfast","steadiest","steady","stellar","stimulating","stimulative","streamlined","striking","strong","stronger","strongest","stunned","stunning","stupendous","sturdier","sturdy","stylish","stylized","suave","sublime","subsidized","substantive","succeeding","successful","sufficient","suitable","sumptuous","super","superb","superior","supple","supportive","supreme","surreal","sustainable","swankier","swankiest","swanky","sweeping","sweet","sweetheart","swift","talented","tantalizing","tempting","tenacious","tender","terrific","thankful","thinner","thoughtful","thrifty","thrilled","thrilling","thriving","tidy","timely","titillating","tolerable","top","topnotch","tough","tougher","toughest","tranquil","transparent","trendy","triumphal","triumphant","trusted","trusting","trustworthy","trusty","truthful","twinkly","unabashed","unaffected","unassailable","unbeatable","unbiased","unbound","undamaged","undaunted","undisputable","undisputed","unencumbered","unequivocal","unfettered","unlimited","unmatched","unparalleled","unreal","unrestricted","unrivaled","unselfish","unwavering","upbeat","upscale","usable","useful","valiant","valuable","verifiable","veritable","versatile","vibrant","victorious","viewable","vigilant","virtuous","visionary","vivacious","vivid","warm","warmer","warmhearted","wealthy","welcome","wholesome","wieldy","winning","wise","witty","wonderful","wondrous","workable","worth","worthwhile","worthy","young","youthful","zippy"],animals:["aardvark","albatross","alligator","angelfish","angora","ant","anteater","antelope","armadillo","avocet","baboon","badger","bandicoot","barnacle","barracuda","bat","beagle","bear","beaver","bee","beetle","bird","bison","bloodhound","boar","bobcat","bonobo","buffalo","bulldog","bullfrog","butterfly","buzzard","camel","cat","caterpillar","catfish","cattle","centipede","chameleon","cheetah","chicken","chihuahua","chimpanzee","chin","chinchilla","chipmunk","civet","clam","cockroach","coon","coral","corgi","cougar","cow","coyote","crab","crane","cuttlefish","dachshund","dalmatian","dane","deer","devil","dingo","dodo","dog","dogfish","dollar","dolphin","donkey","dormouse","dragon","dragonfly","duck","dugong","eagle","earwig","eel","elephant","emperor","emu","falcon","ferret","fish","flamingo","flounder","fly","forest","fowl","fox","foxhound","frog","gar","gecko","gerbil","gharial","gibbon","giraffe","goat","goose","gopher","gorilla","grasshopper","greyhound","grouse","guppy","hamster","hare","hedgehog","heron","hippopotamus","hornet","horse","hound","hummingbird","husky","hyena","hyrax","ibis","iguana","impala","insect","jackal","jaguar","jellyfish","kangaroo","kingfisher","kiwi","koala","kudu","labradoodle","ladybird","lemming","lemur","leopard","liger","lion","lionfish","lizard","llama","lobster","lynx","macaque","macaw","magpie","malamute","maltese","mammoth","manatee","mandrill","markhor","marmoset","mastiff","mayfly","meerkat","millipede","mole","mongoose","monkey","monster","moorhen","moose","moth","mouse","mule","newt","nightingale","ocelot","octopus","okapi","orangutan","ostrich","otter","owl","oyster","panda","panther","parrot","peacock","pelican","penguin","pheasant","pig","pike","piranha","platypus","pointer","poodle","porcupine","possum","prawn","puffin","pug","puma","quail","rabbit","raccoon","rat","rattlesnake","ray","reindeer","retriever","rhinoceros","robin","rottweiler","russel","salamander","scorpion","seahorse","seal","shark","sheep","sheepdog","shrew","shrimp","skater","skunk","sloth","slug","snail","snake","snowshoe","spaniel","sparrow","spider","sponge","squid","squirrel","squirt","starfish","stingray","stoat","swan","tapir","tarantula","termite","terrier","tiger","toad","tortoise","toucan","tuatara","turkey","turtle","uakari","urchin","vole","vulture","wallaby","walrus","warthog","wasp","weasel","whale","whippet","wildebeest","wolf","wolfhound","wolverine","wombat","woodlouse","woodpecker","worm","yak","zebra","zebu","zonkey","zorse"]},capitalize=$=>$.charAt(0).toUpperCase()+$.slice(1),generateName=$=>{const _=$.length*2/3,I=$.substring(0,_),j=$.substring(_),U=capitalize(data.adjectives[parseInt(I,16)%data.adjectives.length]),q=capitalize(data.animals[parseInt(j,16)%data.animals.length]);return`${U} ${q}`};const IdentityListItem=React.forwardRef(({identity:$,presence:_,onClick:I,classNames:j,...U},q)=>{var Y,X,Q,Z,ee;const G=keyToFallback($.identityKey),K=useId$1("identityListItem__label"),J=((Y=$.profile)==null?void 0:Y.displayName)??generateName($.identityKey.toHex());return React.createElement(ListItem.Root,{...U,classNames:mx("flex gap-2 pis-3 pie-1 items-center",I&&"cursor-pointer",j),onClick:()=>I==null?void 0:I(),"data-testid":"identity-list-item",labelId:K,ref:q},React.createElement(Avatar.Root,{status:_===echo.SpaceMember.PresenceState.ONLINE?"active":"inactive",labelId:K,hue:((Q=(X=$.profile)==null?void 0:X.data)==null?void 0:Q.hue)||G.hue},React.createElement(Avatar.Frame,{classNames:"place-self-center"},React.createElement(Avatar.Fallback,{text:((ee=(Z=$.profile)==null?void 0:Z.data)==null?void 0:ee.emoji)||G.emoji})),React.createElement(Avatar.Label,{classNames:"text-sm truncate pli-2"},J)))}),SpaceMemberList=({spaceKey:$,includeSelf:_,onSelect:I})=>{const j=reactClient.useClient(),U=echo.useMembers($),q=React.useMemo(()=>_?U.sort(G=>G.identity.identityKey.equals(j.halo.identity.get().identityKey)?-1:1):U.filter(G=>!G.identity.identityKey.equals(j.halo.identity.get().identityKey)),[U]);return React.createElement(SpaceMemberListImpl,{members:q,onSelect:I})},SpaceMemberListImpl=({members:$,onSelect:_})=>{const{t:I}=useTranslation("os"),j=$.filter(U=>U.identity);return j.length>0?React.createElement(List,{classNames:"flex flex-col gap-2","data-testid":"space-members-list"},j.map(U=>React.createElement(IdentityListItem,{key:U.identity.identityKey.toHex(),identity:U.identity,presence:U.presence,onClick:_&&(()=>_(U))}))):React.createElement("div",{role:"none",className:"grow flex items-center p-2"},React.createElement("p",{className:mx(descriptionText,"text-center is-full mlb-2")},I("empty space members message")))},iconProps={weight:"duotone",width:24,height:24,x:8,y:8},DeviceListItem=React.forwardRef(({device:$,onClickAdd:_,onClickEdit:I,onClickReset:j,onClickJoinExisting:U,classNames:q,connectionState:G,onAgentDestroy:K,...J},Y)=>{var re,ae;const{t:X}=useTranslation("os"),Q=keyToFallback($.deviceKey),Z=useId$1("identityListItem__label"),ee=$.profile?X("device name placeholder",{os:$.profile.os,platform:$.profile.platform}):generateName($.deviceKey.toHex()),te=$.kind===halo.DeviceKind.CURRENT;return React.createElement(ListItem.Root,{...J,classNames:["flex gap-2 items-center mlb-2",q],"data-testid":`device-list-item${te?"-current":""}`,labelId:Z,ref:Y},React.createElement(Avatar.Root,{status:te&&G===mesh.ConnectionState.OFFLINE?"error":$.presence===halo.Device.PresenceState.ONLINE?"active":"inactive",labelId:Z,hue:Q.hue,variant:"square"},React.createElement(Avatar.Frame,{classNames:"place-self-center"},(re=$.profile)!=null&&re.type?$.profile.type===halo.DeviceType.AGENT_MANAGED?React.createElement(react.Database,{...iconProps}):$.profile.type===halo.DeviceType.BROWSER?React.createElement(react.Compass,{...iconProps}):$.profile.type===halo.DeviceType.NATIVE?React.createElement(react.Desktop,{...iconProps}):[halo.DeviceType.AGENT,halo.DeviceType.AGENT_MANAGED].includes($.profile.type)?React.createElement(react.Robot,{...iconProps}):$.profile.type===halo.DeviceType.MOBILE?React.createElement(react.DeviceMobile,{...iconProps}):React.createElement(react.Devices,{...iconProps}):React.createElement(Avatar.Fallback,{text:Q.emoji})),React.createElement(Avatar.Label,{classNames:"flex-1 text-sm truncate"},ee),te&&React.createElement(Tag,{color:"primary"},X("current device tag label")),((ae=$.profile)==null?void 0:ae.type)===halo.DeviceType.AGENT_MANAGED?React.createElement(Tooltip.Root,null,React.createElement(Tooltip.Trigger,{asChild:!0},React.createElement(Button,{variant:"ghost",classNames:"pli-0 is-[--rail-action] bs-[--rail-action]","data-testid":"agent.destroy",onClick:K},React.createElement("span",{className:"sr-only"},X("destroy agent label")),React.createElement(react.Power,{className:getSize(5)}))),React.createElement(Tooltip.Portal,null,React.createElement(Tooltip.Content,{side:"bottom",classNames:"z-50"},X("destroy agent label")))):$.kind===halo.DeviceKind.CURRENT&&React.createElement(DropdownMenu2.Root,null,React.createElement(DropdownMenu2.Trigger,{asChild:!0},React.createElement(Button,{variant:"ghost",classNames:"pli-0 is-[--rail-action] bs-[--rail-action]","data-testid":`device-list-item${te?"-current":""}.options`},React.createElement("span",{className:"sr-only"},X("more options label")),React.createElement(react.DotsThree,{className:getSize(5)}))),React.createElement(DropdownMenu2.Content,null,React.createElement(DropdownMenu2.Viewport,null,React.createElement(DropdownMenu2.Item,{"data-testid":"device-list-item-current.join-existing",onClick:U},React.createElement(react.ShareFat,{className:getSize(5)}),X("choose join new identity label")),React.createElement(DropdownMenu2.Item,{"data-testid":"device-list-item-current.reset",onClick:j},React.createElement(react.Power,{className:getSize(5)}),X("reset device label")))))))}),DeviceList=({devices:$,connectionState:_,onClickAdd:I,onClickEdit:j,onClickReset:U,onClickJoinExisting:q,onAgentDestroy:G})=>{const{t:K}=useTranslation("os");return React.createElement(React.Fragment,null,React.createElement("h2",{className:mx(descriptionText,"text-center mbs-4")},K("devices heading")),$.length>0&&React.createElement(List,null,$.map(J=>React.createElement(DeviceListItem,{key:J.deviceKey.toHex(),device:J,onClickEdit:()=>j==null?void 0:j(J),onClickReset:U,onClickJoinExisting:q,connectionState:_,onAgentDestroy:G}))),React.createElement(Button,{variant:"ghost",classNames:"justify-start gap-2 !pis-0 !pie-3 is-full","data-testid":"devices-panel.create-invitation",onClick:I},React.createElement("div",{role:"img",className:mx(getSize(8),"m-1 rounded-sm bg-input grid place-items-center")},React.createElement(react.Plus,{weight:"light",className:getSize(6)})),React.createElement("span",{className:"grow font-medium text-start"},K("choose add device label")),React.createElement(react.CaretRight,{weight:"bold",className:getSize(4)})))},minutesInMonth=43200,minutesInDay=1440;function getTimezoneOffsetInMilliseconds($){const _=toDate($),I=new Date(Date.UTC(_.getFullYear(),_.getMonth(),_.getDate(),_.getHours(),_.getMinutes(),_.getSeconds(),_.getMilliseconds()));return I.setUTCFullYear(_.getFullYear()),+$-+I}function compareAsc($,_){const I=toDate($),j=toDate(_),U=I.getTime()-j.getTime();return U<0?-1:U>0?1:U}function differenceInCalendarMonths($,_){const I=toDate($),j=toDate(_),U=I.getFullYear()-j.getFullYear(),q=I.getMonth()-j.getMonth();return U*12+q}function getRoundingMethod($){return _=>{const j=($?Math[$]:Math.trunc)(_);return j===0?0:j}}function differenceInMilliseconds($,_){return+toDate($)-+toDate(_)}function endOfDay($){const _=toDate($);return _.setHours(23,59,59,999),_}function endOfMonth($){const _=toDate($),I=_.getMonth();return _.setFullYear(_.getFullYear(),I+1,0),_.setHours(23,59,59,999),_}function isLastDayOfMonth($){const _=toDate($);return+endOfDay(_)==+endOfMonth(_)}function differenceInMonths($,_){const I=toDate($),j=toDate(_),U=compareAsc(I,j),q=Math.abs(differenceInCalendarMonths(I,j));let G;if(q<1)G=0;else{I.getMonth()===1&&I.getDate()>27&&I.setDate(30),I.setMonth(I.getMonth()-U*q);let K=compareAsc(I,j)===-U;isLastDayOfMonth(toDate($))&&q===1&&compareAsc($,j)===1&&(K=!1),G=U*(q-Number(K))}return G===0?0:G}function differenceInSeconds($,_,I){const j=differenceInMilliseconds($,_)/1e3;return getRoundingMethod(I==null?void 0:I.roundingMethod)(j)}function formatDistance($,_,I){const j=getDefaultOptions(),U=(I==null?void 0:I.locale)??j.locale??enUS$1,q=2520,G=compareAsc($,_);if(isNaN(G))throw new RangeError("Invalid time value");const K=Object.assign({},I,{addSuffix:I==null?void 0:I.addSuffix,comparison:G});let J,Y;G>0?(J=toDate(_),Y=toDate($)):(J=toDate($),Y=toDate(_));const X=differenceInSeconds(Y,J),Q=(getTimezoneOffsetInMilliseconds(Y)-getTimezoneOffsetInMilliseconds(J))/1e3,Z=Math.round((X-Q)/60);let ee;if(Z<2)return I!=null&&I.includeSeconds?X<5?U.formatDistance("lessThanXSeconds",5,K):X<10?U.formatDistance("lessThanXSeconds",10,K):X<20?U.formatDistance("lessThanXSeconds",20,K):X<40?U.formatDistance("halfAMinute",0,K):X<60?U.formatDistance("lessThanXMinutes",1,K):U.formatDistance("xMinutes",1,K):Z===0?U.formatDistance("lessThanXMinutes",1,K):U.formatDistance("xMinutes",Z,K);if(Z<45)return U.formatDistance("xMinutes",Z,K);if(Z<90)return U.formatDistance("aboutXHours",1,K);if(Z<minutesInDay){const te=Math.round(Z/60);return U.formatDistance("aboutXHours",te,K)}else{if(Z<q)return U.formatDistance("xDays",1,K);if(Z<minutesInMonth){const te=Math.round(Z/minutesInDay);return U.formatDistance("xDays",te,K)}else if(Z<minutesInMonth*2)return ee=Math.round(Z/minutesInMonth),U.formatDistance("aboutXMonths",ee,K)}if(ee=differenceInMonths(Y,J),ee<12){const te=Math.round(Z/minutesInMonth);return U.formatDistance("xMonths",te,K)}else{const te=ee%12,re=Math.trunc(ee/12);return te<3?U.formatDistance("aboutXYears",re,K):te<9?U.formatDistance("overXYears",re,K):U.formatDistance("almostXYears",re+1,K)}}function formatDistanceToNow($,_){return formatDistance($,Date.now(),_)}var SpaceState;(function($){$[$.INVALID=0]="INVALID",$[$.SPACE_INACTIVE=2]="SPACE_INACTIVE",$[$.SPACE_ACTIVE=6]="SPACE_ACTIVE",$[$.SPACE_CLOSED=1]="SPACE_CLOSED",$[$.SPACE_CONTROL_ONLY=7]="SPACE_CONTROL_ONLY",$[$.SPACE_INITIALIZING=4]="SPACE_INITIALIZING",$[$.SPACE_READY=3]="SPACE_READY",$[$.SPACE_ERROR=5]="SPACE_ERROR",$[$.SPACE_REQUIRES_MIGRATION=8]="SPACE_REQUIRES_MIGRATION"})(SpaceState||(SpaceState={}));var Invitation;(function($){(function(_){_[_.INTERACTIVE=0]="INTERACTIVE",_[_.DELEGATED=1]="DELEGATED",_[_.MULTIUSE=2]="MULTIUSE"})($.Type||($.Type={})),function(_){_[_.DEVICE=0]="DEVICE",_[_.SPACE=1]="SPACE"}($.Kind||($.Kind={})),function(_){_[_.NONE=0]="NONE",_[_.SHARED_SECRET=1]="SHARED_SECRET",_[_.KNOWN_PUBLIC_KEY=2]="KNOWN_PUBLIC_KEY"}($.AuthMethod||($.AuthMethod={})),function(_){_[_.INIT=0]="INIT",_[_.CONNECTING=1]="CONNECTING",_[_.CONNECTED=2]="CONNECTED",_[_.READY_FOR_AUTHENTICATION=3]="READY_FOR_AUTHENTICATION",_[_.AUTHENTICATING=4]="AUTHENTICATING",_[_.SUCCESS=5]="SUCCESS",_[_.CANCELLED=6]="CANCELLED",_[_.TIMEOUT=7]="TIMEOUT",_[_.ERROR=8]="ERROR",_[_.EXPIRED=9]="EXPIRED"}($.State||($.State={}))})(Invitation||(Invitation={}));var LogLevel;(function($){$[$.NONE=0]="NONE",$[$.TRACE=5]="TRACE",$[$.DEBUG=10]="DEBUG",$[$.INFO=11]="INFO",$[$.WARN=12]="WARN",$[$.ERROR=13]="ERROR"})(LogLevel||(LogLevel={}));var QueryLogsRequest;(function($){(function(_){_[_.NONE=0]="NONE",_[_.INCLUSIVE=1]="INCLUSIVE",_[_.EXPLICIT=2]="EXPLICIT"})($.MatchingOptions||($.MatchingOptions={}))})(QueryLogsRequest||(QueryLogsRequest={}));var SystemStatus;(function($){$[$.ACTIVE=0]="ACTIVE",$[$.INACTIVE=1]="INACTIVE"})(SystemStatus||(SystemStatus={}));var GetDiagnosticsRequest;(function($){(function(_){_[_.NONE=0]="NONE",_[_.TRUNCATE=1]="TRUNCATE",_[_.HUMANIZE=2]="HUMANIZE"})($.KEY_OPTION||($.KEY_OPTION={}))})(GetDiagnosticsRequest||(GetDiagnosticsRequest={}));var Platform;(function($){(function(_){_[_.BROWSER=0]="BROWSER",_[_.SHARED_WORKER=1]="SHARED_WORKER",_[_.NODE=2]="NODE"})($.PLATFORM_TYPE||($.PLATFORM_TYPE={}))})(Platform||(Platform={}));var DeviceKind;(function($){$[$.CURRENT=0]="CURRENT",$[$.TRUSTED=1]="TRUSTED"})(DeviceKind||(DeviceKind={}));var Device;(function($){(function(_){_[_.OFFLINE=0]="OFFLINE",_[_.ONLINE=1]="ONLINE",_[_.REMOVED=2]="REMOVED"})($.PresenceState||($.PresenceState={}))})(Device||(Device={}));var SpaceMember;(function($){(function(_){_[_.OFFLINE=0]="OFFLINE",_[_.ONLINE=1]="ONLINE"})($.PresenceState||($.PresenceState={}))})(SpaceMember||(SpaceMember={}));var CreateEpochRequest;(function($){(function(_){_[_.NONE=0]="NONE",_[_.INIT_AUTOMERGE=1]="INIT_AUTOMERGE",_[_.PRUNE_AUTOMERGE_ROOT_HISTORY=2]="PRUNE_AUTOMERGE_ROOT_HISTORY",_[_.FRAGMENT_AUTOMERGE_ROOT=3]="FRAGMENT_AUTOMERGE_ROOT",_[_.REPLACE_AUTOMERGE_ROOT=4]="REPLACE_AUTOMERGE_ROOT",_[_.MIGRATE_REFERENCES_TO_DXN=5]="MIGRATE_REFERENCES_TO_DXN"})($.Migration||($.Migration={}))})(CreateEpochRequest||(CreateEpochRequest={}));var QueryInvitationsResponse;(function($){(function(_){_[_.ADDED=0]="ADDED",_[_.REMOVED=1]="REMOVED",_[_.SAVED=2]="SAVED",_[_.LOAD_COMPLETE=3]="LOAD_COMPLETE"})($.Action||($.Action={})),function(_){_[_.CREATED=0]="CREATED",_[_.ACCEPTED=1]="ACCEPTED"}($.Type||($.Type={}))})(QueryInvitationsResponse||(QueryInvitationsResponse={}));var ConnectionState;(function($){$[$.OFFLINE=0]="OFFLINE",$[$.ONLINE=1]="ONLINE"})(ConnectionState||(ConnectionState={}));var ContextDisposedError=class extends Error{constructor(){super("Context disposed.")}};function _ts_decorate$1($,_,I,j){var U=arguments.length,q=U<3?_:j===null?j=Object.getOwnPropertyDescriptor(_,I):j,G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate($,_,I,j);else for(var K=$.length-1;K>=0;K--)(G=$[K])&&(q=(U<3?G(q):U>3?G(_,I,q):G(_,I))||q);return U>3&&q&&Object.defineProperty(_,I,q),q}var __dxlog_file$6="/home/runner/work/dxos/dxos/packages/common/context/src/context.ts",MAX_SAFE_DISPOSE_CALLBACKS=300,DEFAULT_ERROR_HANDLER=($,_)=>{if(!($ instanceof ContextDisposedError))throw _.dispose(),$},CONTEXT_FLAG_IS_DISPOSED=1,CONTEXT_FLAG_LEAK_DETECTED=2,_a$1,_b,Context=(dn=class{constructor(_={},I){rn(this,Kt);rn(this,Jt);rn(this,an);rn(this,fn);rn(this,bn);rn(this,Pn);rn(this,Yt);rn(this,ln);Vt(this,Jt,[]),Vt(this,an,void 0),Vt(this,fn,void 0),Vt(this,Yt,0),Vt(this,ln,void 0),this.maxSafeDisposeCallbacks=MAX_SAFE_DISPOSE_CALLBACKS,this[_a$1]="Context",this[_b]=()=>this.toString(),Vt(this,an,getContextName(_,I)),Vt(this,fn,_.parent),Vt(this,bn,_.attributes??{}),Vt(this,Pn,_.onError??DEFAULT_ERROR_HANDLER)}static default(){return new dn}get disposed(){return At(this,Kt,Vn)}get disposeCallbacksLength(){return At(this,Jt).length}onDispose(_){if(At(this,Kt,Vn)&&(async()=>{try{await _()}catch(I){log$2.catch(I,{context:At(this,an)},{F:__dxlog_file$6,L:119,S:this,C:(j,U)=>j(...U)})}})(),At(this,Jt).push(_),At(this,Jt).length>this.maxSafeDisposeCallbacks&&!At(this,Kt,Lr)){Vt(this,Kt,!0,Br);const I=new StackTrace().getStackArray(1)[0].trim();log$2.warn("Context has a large number of dispose callbacks (this might be a memory leak).",{context:At(this,an),callSite:I,count:At(this,Jt).length},{F:__dxlog_file$6,L:128,S:this,C:(j,U)=>j(...U)})}return()=>{const I=At(this,Jt).indexOf(_);I!==-1&&At(this,Jt).splice(I,1)}}async dispose(_=!1){if(At(this,ln))return At(this,ln);Vt(this,Kt,!0,Fr);let I;const j=new Promise(J=>{I=J});Vt(this,ln,j);const U=Array.from(At(this,Jt)).reverse();At(this,Jt).length=0;let q=0,G=!0;const K=[];for(const J of U)try{await J(),q++}catch(Y){G=!1,_?K.push(Y):log$2.catch(Y,{context:At(this,an),callback:q,count:U.length},{F:__dxlog_file$6,L:188,S:this,C:(X,Q)=>X(...Q)})}if(K.length>0)throw new AggregateError(K);return I(G),G}raise(_){if(!At(this,Kt,Vn))try{At(this,Pn).call(this,_,this)}catch(I){Promise.reject(I)}}derive({onError:_,attributes:I}={}){const j=new dn({onError:async q=>{if(!_)this.raise(q);else try{await _(q,this)}catch{this.raise(q)}},attributes:I}),U=this.onDispose(()=>j.dispose());return j.onDispose(U),j}getAttribute(_){if(_ in At(this,bn))return At(this,bn)[_];if(At(this,fn))return At(this,fn).getAttribute(_)}toString(){return`Context(${At(this,Kt,Vn)?"disposed":"active"})`}async[(_a$1=Symbol.toStringTag,_b=export_inspect.custom,Symbol.asyncDispose)](){await this.dispose()}},Jt=new WeakMap,an=new WeakMap,fn=new WeakMap,bn=new WeakMap,Pn=new WeakMap,Yt=new WeakMap,ln=new WeakMap,Kt=new WeakSet,Vn=function(){return!!(At(this,Yt)&CONTEXT_FLAG_IS_DISPOSED)},Fr=function(_){Vt(this,Yt,_?At(this,Yt)|CONTEXT_FLAG_IS_DISPOSED:At(this,Yt)&~CONTEXT_FLAG_IS_DISPOSED)},Lr=function(){return!!(At(this,Yt)&CONTEXT_FLAG_LEAK_DETECTED)},Br=function(_){Vt(this,Yt,_?At(this,Yt)|CONTEXT_FLAG_LEAK_DETECTED:At(this,Yt)&~CONTEXT_FLAG_LEAK_DETECTED)},dn);Context=_ts_decorate$1([safeInstanceof("Context")],Context);var getContextName=($,_)=>{var I;if($.name)return $.name;if((I=_==null?void 0:_.F)!=null&&I.length){const j=_==null?void 0:_.F.split("/");return`${j[j.length-1]}#${(_==null?void 0:_.L)??0}`}},LifecycleState;(function($){$.CLOSED="CLOSED",$.OPEN="OPEN",$.ERROR="ERROR"})(LifecycleState||(LifecycleState={}));var Observable$2={};Object.defineProperty(Observable$2,"__esModule",{value:!0}),Observable$2.Observable=void 0;const hasSymbol=$=>!!Symbol[$],getSymbol=$=>hasSymbol($)?Symbol[$]:"@@"+$,SymbolIterator=getSymbol("iterator"),SymbolObservable=getSymbol("observable"),SymbolSpecies=getSymbol("species");function getMethod($,_){let I=$[_];if(I!=null){if(typeof I!="function")throw new TypeError(I+" is not a function");return I}}function getSpecies($){let _=$.constructor;return _!==void 0&&(_=_[SymbolSpecies],_===null&&(_=void 0)),_!==void 0?_:Observable$1}function isObservable$1($){return $ instanceof Observable$1}function hostReportError($){hostReportError.log?hostReportError.log($):setTimeout(()=>{throw $})}function enqueue($){Promise.resolve().then(()=>{try{$()}catch(_){hostReportError(_)}})}function cleanupSubscription($){let _=$._cleanup;if(_!==void 0&&($._cleanup=void 0,!!_))try{if(typeof _=="function")_();else{let I=getMethod(_,"unsubscribe");I&&I.call(_)}}catch(I){hostReportError(I)}}function closeSubscription($){$._observer=void 0,$._queue=void 0,$._state="closed"}function flushSubscription($){let _=$._queue;if(_){$._queue=void 0,$._state="ready";for(let I=0;I<_.length&&(notifySubscription($,_[I].type,_[I].value),$._state!=="closed");++I);}}function notifySubscription($,_,I){$._state="running";let j=$._observer;try{let U=getMethod(j,_);switch(_){case"next":U&&U.call(j,I);break;case"error":if(closeSubscription($),U)U.call(j,I);else throw I;break;case"complete":closeSubscription($),U&&U.call(j);break}}catch(U){hostReportError(U)}$._state==="closed"?cleanupSubscription($):$._state==="running"&&($._state="ready")}function onNotify($,_,I){if($._state!=="closed"){if($._state==="buffering"){$._queue.push({type:_,value:I});return}if($._state!=="ready"){$._state="buffering",$._queue=[{type:_,value:I}],enqueue(()=>flushSubscription($));return}notifySubscription($,_,I)}}class Subscription{constructor(_,I){this._cleanup=void 0,this._observer=_,this._queue=void 0,this._state="initializing";let j=this,U={get closed(){return j._state==="closed"},next(q){onNotify(j,"next",q)},error(q){onNotify(j,"error",q)},complete(){onNotify(j,"complete")}};try{this._cleanup=I.call(void 0,U)}catch(q){U.error(q)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(closeSubscription(this),cleanupSubscription(this))}}let Observable$1=class rr{constructor(_){if(!(this instanceof rr))throw new TypeError("Observable cannot be called as a function");if(typeof _!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=_}subscribe(_){return(typeof _!="object"||_===null)&&(_={next:_,error:arguments[1],complete:arguments[2]}),new Subscription(_,this._subscriber)}forEach(_){return new Promise((I,j)=>{if(typeof _!="function"){j(new TypeError(_+" is not a function"));return}function U(){q.unsubscribe(),I()}let q=this.subscribe({next(G){try{_(G,U)}catch(K){j(K),q.unsubscribe()}},error:j,complete:I})})}map(_){if(typeof _!="function")throw new TypeError(_+" is not a function");let I=getSpecies(this);return new I(j=>this.subscribe({next(U){try{U=_(U)}catch(q){return j.error(q)}j.next(U)},error(U){j.error(U)},complete(){j.complete()}}))}filter(_){if(typeof _!="function")throw new TypeError(_+" is not a function");let I=getSpecies(this);return new I(j=>this.subscribe({next(U){try{if(!_(U))return}catch(q){return j.error(q)}j.next(U)},error(U){j.error(U)},complete(){j.complete()}}))}reduce(_){if(typeof _!="function")throw new TypeError(_+" is not a function");let I=getSpecies(this),j=arguments.length>1,U=!1,G=arguments[1];return new I(K=>this.subscribe({next(J){let Y=!U;if(U=!0,!Y||j)try{G=_(G,J)}catch(X){return K.error(X)}else G=J},error(J){K.error(J)},complete(){if(!U&&!j)return K.error(new TypeError("Cannot reduce an empty sequence"));K.next(G),K.complete()}}))}async all(){let _=[];return await this.forEach(I=>_.push(I)),_}concat(..._){let I=getSpecies(this);return new I(j=>{let U,q=0;function G(K){U=K.subscribe({next(J){j.next(J)},error(J){j.error(J)},complete(){q===_.length?(U=void 0,j.complete()):G(I.from(_[q++]))}})}return G(this),()=>{U&&(U.unsubscribe(),U=void 0)}})}flatMap(_){if(typeof _!="function")throw new TypeError(_+" is not a function");let I=getSpecies(this);return new I(j=>{let U=[],q=this.subscribe({next(K){if(_)try{K=_(K)}catch(Y){return j.error(Y)}let J=I.from(K).subscribe({next(Y){j.next(Y)},error(Y){j.error(Y)},complete(){let Y=U.indexOf(J);Y>=0&&U.splice(Y,1),G()}});U.push(J)},error(K){j.error(K)},complete(){G()}});function G(){q.closed&&U.length===0&&j.complete()}return()=>{U.forEach(K=>K.unsubscribe()),q.unsubscribe()}})}[SymbolObservable](){return this}static from(_){let I=typeof this=="function"?this:rr;if(_==null)throw new TypeError(_+" is not an object");let j=getMethod(_,SymbolObservable);if(j){let U=j.call(_);if(Object(U)!==U)throw new TypeError(U+" is not an object");return isObservable$1(U)&&U.constructor===I?U:new I(q=>U.subscribe(q))}if(hasSymbol("iterator")&&(j=getMethod(_,SymbolIterator),j))return new I(U=>{enqueue(()=>{if(!U.closed){for(let q of j.call(_))if(U.next(q),U.closed)return;U.complete()}})});if(Array.isArray(_))return new I(U=>{enqueue(()=>{if(!U.closed){for(let q=0;q<_.length;++q)if(U.next(_[q]),U.closed)return;U.complete()}})});throw new TypeError(_+" is not observable")}static of(..._){let I=typeof this=="function"?this:rr;return new I(j=>{enqueue(()=>{if(!j.closed){for(let U=0;U<_.length;++U)if(j.next(_[U]),j.closed)return;j.complete()}})})}static get[SymbolSpecies](){return this}};Observable$2.Observable=Observable$1,Object.defineProperty(Observable$1,Symbol("extensions"),{value:{symbol:SymbolObservable,hostReportError},configurable:!0});var zenObservable=Observable$2.Observable;const Observable=getDefaultExportFromCjs(zenObservable);var readableBrowser={exports:{}},streamBrowser=eventsExports.EventEmitter,buffer={},base64Js={};base64Js.byteLength=byteLength,base64Js.toByteArray=toByteArray,base64Js.fromByteArray=fromByteArray;for(var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i$1=0,len=code.length;i$1<len;++i$1)lookup[i$1]=code[i$1],revLookup[code.charCodeAt(i$1)]=i$1;revLookup[45]=62,revLookup[95]=63;function getLens($){var _=$.length;if(_%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var I=$.indexOf("=");I===-1&&(I=_);var j=I===_?0:4-I%4;return[I,j]}function byteLength($){var _=getLens($),I=_[0],j=_[1];return(I+j)*3/4-j}function _byteLength($,_,I){return(_+I)*3/4-I}function toByteArray($){var _,I=getLens($),j=I[0],U=I[1],q=new Arr(_byteLength($,j,U)),G=0,K=U>0?j-4:j,J;for(J=0;J<K;J+=4)_=revLookup[$.charCodeAt(J)]<<18|revLookup[$.charCodeAt(J+1)]<<12|revLookup[$.charCodeAt(J+2)]<<6|revLookup[$.charCodeAt(J+3)],q[G++]=_>>16&255,q[G++]=_>>8&255,q[G++]=_&255;return U===2&&(_=revLookup[$.charCodeAt(J)]<<2|revLookup[$.charCodeAt(J+1)]>>4,q[G++]=_&255),U===1&&(_=revLookup[$.charCodeAt(J)]<<10|revLookup[$.charCodeAt(J+1)]<<4|revLookup[$.charCodeAt(J+2)]>>2,q[G++]=_>>8&255,q[G++]=_&255),q}function tripletToBase64($){return lookup[$>>18&63]+lookup[$>>12&63]+lookup[$>>6&63]+lookup[$&63]}function encodeChunk($,_,I){for(var j,U=[],q=_;q<I;q+=3)j=($[q]<<16&16711680)+($[q+1]<<8&65280)+($[q+2]&255),U.push(tripletToBase64(j));return U.join("")}function fromByteArray($){for(var _,I=$.length,j=I%3,U=[],q=16383,G=0,K=I-j;G<K;G+=q)U.push(encodeChunk($,G,G+q>K?K:G+q));return j===1?(_=$[I-1],U.push(lookup[_>>2]+lookup[_<<4&63]+"==")):j===2&&(_=($[I-2]<<8)+$[I-1],U.push(lookup[_>>10]+lookup[_>>4&63]+lookup[_<<2&63]+"=")),U.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ieee754.read=function($,_,I,j,U){var q,G,K=U*8-j-1,J=(1<<K)-1,Y=J>>1,X=-7,Q=I?U-1:0,Z=I?-1:1,ee=$[_+Q];for(Q+=Z,q=ee&(1<<-X)-1,ee>>=-X,X+=K;X>0;q=q*256+$[_+Q],Q+=Z,X-=8);for(G=q&(1<<-X)-1,q>>=-X,X+=j;X>0;G=G*256+$[_+Q],Q+=Z,X-=8);if(q===0)q=1-Y;else{if(q===J)return G?NaN:(ee?-1:1)*(1/0);G=G+Math.pow(2,j),q=q-Y}return(ee?-1:1)*G*Math.pow(2,q-j)},ieee754.write=function($,_,I,j,U,q){var G,K,J,Y=q*8-U-1,X=(1<<Y)-1,Q=X>>1,Z=U===23?Math.pow(2,-24)-Math.pow(2,-77):0,ee=j?0:q-1,te=j?1:-1,re=_<0||_===0&&1/_<0?1:0;for(_=Math.abs(_),isNaN(_)||_===1/0?(K=isNaN(_)?1:0,G=X):(G=Math.floor(Math.log(_)/Math.LN2),_*(J=Math.pow(2,-G))<1&&(G--,J*=2),G+Q>=1?_+=Z/J:_+=Z*Math.pow(2,1-Q),_*J>=2&&(G++,J/=2),G+Q>=X?(K=0,G=X):G+Q>=1?(K=(_*J-1)*Math.pow(2,U),G=G+Q):(K=_*Math.pow(2,Q-1)*Math.pow(2,U),G=0));U>=8;$[I+ee]=K&255,ee+=te,K/=256,U-=8);for(G=G<<U|K,Y+=U;Y>0;$[I+ee]=G&255,ee+=te,G/=256,Y-=8);$[I+ee-te]|=re*128};/*!
|
|
994
|
+
`;function $e5534fc185f7111e$export$2e2bcd8739ae039($){const _=React.useRef(null),I=React.useRef(null);return I.current&&I.current.update($),React.useEffect(()=>(I.current=new $efa000751917694d$export$2e2bcd8739ae039({...$,ref:_}),()=>{I.current=null}),[]),React.createElement("div",{ref:_})}const EmojiPickerToolbarButton=({disabled:$,defaultEmoji:_,emoji:I,onChangeEmoji:j,classNames:U})=>{const{t:q}=useTranslation("os"),{themeMode:G}=useThemeContext(),[K,J]=$71cd76cc60e0454e$export$6f32135080cb4c3({prop:I,onChange:j,defaultProp:_}),[Y,X]=React.useState(!1),Q=React.useRef(!1),[Z,ee]=React.useState(!1);return React.createElement(Tooltip.Root,{open:Z,onOpenChange:te=>{Q.current?(ee(!1),Q.current=!1):ee(te)}},React.createElement(Popover.Root,{open:Y,onOpenChange:te=>{X(te),Q.current=!0}},React.createElement(Tooltip.Trigger,{asChild:!0},React.createElement(Popover.Trigger,{asChild:!0},React.createElement(Toolbar.Button,{classNames:["gap-2 text-2xl plb-1",U],disabled:$},React.createElement("span",{className:"sr-only"},q("select emoji label")),React.createElement(react.UserCircle,{className:getSize(5)})))),React.createElement(Tooltip.Portal,null,React.createElement(Tooltip.Content,{side:"bottom",classNames:"z-50"},q("select emoji label"),React.createElement(Tooltip.Arrow,null))),React.createElement(Popover.Content,{side:"bottom",onKeyDownCapture:te=>{te.key==="Escape"&&(te.stopPropagation(),X(!1),Q.current=!0)}},React.createElement($e5534fc185f7111e$export$2e2bcd8739ae039,{data:emojiData,onEmojiSelect:({native:te})=>{te&&(J(te),X(!1))},autoFocus:!0,maxFrequentRows:0,noCountryFlags:!0,theme:G}),React.createElement(Popover.Arrow,null))))},HuePreview=({hue:$})=>{const{tx:_}=useThemeContext(),I=20;return React.createElement("svg",{width:I,height:I,viewBox:`0 0 ${I} ${I}`},React.createElement("rect",{x:0,y:0,width:I,height:I,className:_("hue.fill","select--hue__preview",{hue:$})}))},hueTokens=Object.keys(hueTokenThemes).slice(0,16),HuePickerToolbarButton=({disabled:$,hue:_,onChangeHue:I,classNames:j,defaultHue:U})=>{const{t:q}=useTranslation("os"),[G,K]=$71cd76cc60e0454e$export$6f32135080cb4c3({prop:_,onChange:I,defaultProp:U}),[J,Y]=React.useState(!1),X=React.useRef(!1),[Q,Z]=React.useState(!1);return React.createElement(Tooltip.Root,{open:Q,onOpenChange:ee=>{X.current?(Z(!1),X.current=!1):Z(ee)}},React.createElement(DropdownMenu2.Root,{modal:!1,open:J,onOpenChange:ee=>{Y(ee),X.current=!0}},React.createElement(Tooltip.Trigger,{asChild:!0},React.createElement(DropdownMenu2.Trigger,{asChild:!0},React.createElement(Toolbar.Button,{classNames:mx("gap-2 plb-1",j),disabled:$},React.createElement("span",{className:"sr-only"},q("select hue label")),React.createElement(react.Palette,{className:getSize(5)})))),React.createElement(Tooltip.Portal,null,React.createElement(Tooltip.Content,{side:"bottom",classNames:"z-50"},q("select hue label"),React.createElement(Tooltip.Arrow,null))),React.createElement(DropdownMenu2.Content,{side:"bottom",classNames:"!w-40"},React.createElement(DropdownMenu2.Viewport,{classNames:"grid grid-cols-4"},hueTokens.map(ee=>React.createElement(DropdownMenu2.CheckboxItem,{key:ee,checked:ee===G,onCheckedChange:()=>K(ee),classNames:"px-0 py-2 items-center justify-center"},React.createElement(HuePreview,{hue:ee})))))))};var data={adjectives:["abundant","accessible","accomplished","accurate","achievable","adaptable","adaptive","adequate","adjustable","admirable","admiring","adorable","adored","adoring","adroit","adulatory","advanced","advantageous","adventurous","affable","affectionate","affirmative","affluent","affordable","agile","agreeable","alluring","altruistic","amazed","amazing","ambitious","amenable","amiable","amicable","ample","amusing","angelic","appealing","appreciable","appreciated","appreciative","appropriate","ardent","articulate","artistic","assuring","astonished","astonishing","astounded","astounding","athletic","attentive","attractive","audible","auspicious","authentic","autonomous","available","avid","awed","awesome","awestruck","beauteous","beautiful","believable","beloved","beneficent","beneficial","benevolent","blameless","blissful","blithe","bonny","booming","boundless","bountiful","brainiest","brainy","brave","breathtaking","bright","brighter","brightest","brilliant","brisk","brotherly","bullish","buoyant","calm","calming","capable","captivating","carefree","catchy","celebrated","celebratory","champion","charismatic","charitable","charming","chaste","cheaper","cheapest","cheerful","cheery","cherished","chivalrous","classic","classy","clean","cleaner","cleanest","cleanly","clear","cleared","clearer","clever","coherent","cohesive","colorful","comely","comfortable","comforting","comfy","commendable","commodious","compact","compatible","competitive","compliant","conciliatory","concise","confident","congenial","considerate","consistent","constructive","consummate","contrasty","convenient","convincing","cool","coolest","cooperative","correct","courageous","courteous","courtly","cozy","creative","credible","crisp","crisper","cushy","cute","daring","darling","dashing","dauntless","dazzled","dazzling","decent","decisive","dedicated","defeated","deft","delectable","delicate","delicious","delighted","delightful","dependable","deserving","desirable","desirous","detachable","devout","dexterous","dextrous","dignified","diligent","diplomatic","distinctive","diversified","divine","dominated","dumbfounded","durable","dynamic","eager","earnest","eased","easy","easygoing","ebullient","economical","ecstatic","educated","effective","efficacious","efficient","effortless","effusive","elated","elegant","elite","eloquent","eminent","enchanted","enchanting","encouraging","endearing","endorsed","energetic","engaging","engrossing","enhanced","enjoyable","enraptured","enterprising","entertaining","enthralled","enthusiastic","enticing","entranced","entrancing","enviable","envious","equitable","erudite","ethical","euphoric","evaluative","eventful","everlasting","evocative","exalted","exalting","exceeding","excellent","exceptional","excited","exciting","exemplary","exhilarating","expansive","exquisite","exuberant","exultant","fabulous","fair","faithful","famed","famous","fancier","fancy","fantastic","fascinating","fashionable","fast","faster","fastest","faultless","favorable","favored","favorite","fearless","feasible","feisty","felicitous","fertile","fervent","fervid","festive","fiery","fine","finer","finest","firmer","flashy","flatter","flattering","flawless","flexible","flourishing","fluent","fond","foolproof","foremost","formidable","fortuitous","fortunate","fragrant","free","freed","fresh","fresher","freshest","friendly","frugal","fruitful","fun","funny","futuristic","gainful","gallant","galore","generous","genial","gentle","gentlest","genuine","gifted","glad","glamorous","gleeful","glimmering","glistening","glorious","glowing","godlike","gold","golden","good","goodly","gorgeous","graceful","gracious","grand","grateful","gratified","gratifying","great","greatest","guiltless","gutsy","halcyon","hale","hallowed","handier","handsome","handy","happier","happy","hardier","hardy","harmless","harmonious","healthful","healthy","heartening","heartfelt","heartwarming","heavenly","helpful","heroic","hilarious","holy","honest","honorable","honored","hopeful","hospitable","hot","hottest","humane","humble","humorous","humourous","ideal","idolized","idyllic","illuminating","illustrious","imaginative","immaculate","immense","impartial","impassioned","impeccable","important","impressed","impressive","improved","improving","incredible","indebted","indulgent","industrious","inestimable","inexpensive","infallible","influential","ingenious","ingenuous","innocuous","innovative","insightful","inspiring","instructive","instrumental","intelligent","intelligible","interesting","intimate","intricate","intriguing","intuitive","invaluable","inventive","invigorating","invincible","inviolable","inviolate","invulnerable","irresistible","jolly","jovial","joyful","joyous","jubilant","judicious","keen","kindly","laudable","lavish","lawful","leading","lean","legendary","lighter","likable","like","liked","lionhearted","lively","logical","lovable","loved","lovely","loving","loyal","lucid","luckier","luckiest","lucky","lucrative","luminous","lush","lustrous","luxuriant","luxurious","luxury","lyrical","magic","magical","magnanimous","magnificent","majestic","manageable","marvellous","marvelous","masterful","matchless","mature","meaningful","memorable","merciful","meritorious","merry","mesmerized","mesmerizing","meticulous","mighty","miraculous","modern","modest","momentous","monumental","motivated","navigable","neat","neatest","nice","nifty","nimble","noble","noiseless","noteworthy","nourishing","observant","obtainable","optimal","optimistic","opulent","orderly","organized","outstanding","overjoyed","painless","palatial","pampered","panoramic","paramount","passionate","patient","patri","peaceable","peaceful","peerless","peppy","perfect","permissible","personalized","phenomenal","picturesque","playful","pleasant","pleased","pleasing","pleasurable","plentiful","plush","poetic","poignant","poised","polished","polite","popular","portable","posh","positive","powerful","praiseworthy","praising","precious","precise","preeminent","preferable","premier","prestigious","pretty","priceless","principled","privileged","prize","proactive","prodigious","productive","proficient","profound","progressive","prolific","prominent","promised","promising","prompt","proper","propitious","prosperous","protective","proud","proven","prudent","punctual","pure","purposeful","quaint","qualified","quicker","quiet","quieter","radiant","rapid","rapt","rapturous","rational","reachable","readable","ready","realistic","realizable","reasonable","reasoned","receptive","recommended","redeeming","refined","reformed","refreshed","refreshing","regal","rejoicing","relaxed","reliable","remarkable","renewed","renowned","replaceable","reputable","resilient","resolute","resounding","resourceful","respectable","respectful","resplendent","responsive","restful","restored","retractable","reverent","rewarding","rich","righteous","rightful","robust","romantic","roomier","rosy","safe","saintly","salutary","sane","satisfactory","satisfied","satisfying","scenic","seamless","seasoned","secure","selective","sensational","sensible","sensitive","serene","sexy","sharp","sharper","sharpest","shiny","significant","silent","simpler","simplest","simplified","sincere","skilled","skillful","sleek","slick","smart","smarter","smartest","smelly","smiling","smitten","smooth","smoother","smoothest","snappy","snazzy","sociable","soft","softer","solid","soulful","spacious","sparkling","spectacular","speedy","spellbinding","spellbound","spirited","spiritual","splendid","spontaneous","sporty","spotless","sprightly","stable","stainless","stately","statuesque","staunch","steadfast","steadiest","steady","stellar","stimulating","stimulative","streamlined","striking","strong","stronger","strongest","stunned","stunning","stupendous","sturdier","sturdy","stylish","stylized","suave","sublime","subsidized","substantive","succeeding","successful","sufficient","suitable","sumptuous","super","superb","superior","supple","supportive","supreme","surreal","sustainable","swankier","swankiest","swanky","sweeping","sweet","sweetheart","swift","talented","tantalizing","tempting","tenacious","tender","terrific","thankful","thinner","thoughtful","thrifty","thrilled","thrilling","thriving","tidy","timely","titillating","tolerable","top","topnotch","tough","tougher","toughest","tranquil","transparent","trendy","triumphal","triumphant","trusted","trusting","trustworthy","trusty","truthful","twinkly","unabashed","unaffected","unassailable","unbeatable","unbiased","unbound","undamaged","undaunted","undisputable","undisputed","unencumbered","unequivocal","unfettered","unlimited","unmatched","unparalleled","unreal","unrestricted","unrivaled","unselfish","unwavering","upbeat","upscale","usable","useful","valiant","valuable","verifiable","veritable","versatile","vibrant","victorious","viewable","vigilant","virtuous","visionary","vivacious","vivid","warm","warmer","warmhearted","wealthy","welcome","wholesome","wieldy","winning","wise","witty","wonderful","wondrous","workable","worth","worthwhile","worthy","young","youthful","zippy"],animals:["aardvark","albatross","alligator","angelfish","angora","ant","anteater","antelope","armadillo","avocet","baboon","badger","bandicoot","barnacle","barracuda","bat","beagle","bear","beaver","bee","beetle","bird","bison","bloodhound","boar","bobcat","bonobo","buffalo","bulldog","bullfrog","butterfly","buzzard","camel","cat","caterpillar","catfish","cattle","centipede","chameleon","cheetah","chicken","chihuahua","chimpanzee","chin","chinchilla","chipmunk","civet","clam","cockroach","coon","coral","corgi","cougar","cow","coyote","crab","crane","cuttlefish","dachshund","dalmatian","dane","deer","devil","dingo","dodo","dog","dogfish","dollar","dolphin","donkey","dormouse","dragon","dragonfly","duck","dugong","eagle","earwig","eel","elephant","emperor","emu","falcon","ferret","fish","flamingo","flounder","fly","forest","fowl","fox","foxhound","frog","gar","gecko","gerbil","gharial","gibbon","giraffe","goat","goose","gopher","gorilla","grasshopper","greyhound","grouse","guppy","hamster","hare","hedgehog","heron","hippopotamus","hornet","horse","hound","hummingbird","husky","hyena","hyrax","ibis","iguana","impala","insect","jackal","jaguar","jellyfish","kangaroo","kingfisher","kiwi","koala","kudu","labradoodle","ladybird","lemming","lemur","leopard","liger","lion","lionfish","lizard","llama","lobster","lynx","macaque","macaw","magpie","malamute","maltese","mammoth","manatee","mandrill","markhor","marmoset","mastiff","mayfly","meerkat","millipede","mole","mongoose","monkey","monster","moorhen","moose","moth","mouse","mule","newt","nightingale","ocelot","octopus","okapi","orangutan","ostrich","otter","owl","oyster","panda","panther","parrot","peacock","pelican","penguin","pheasant","pig","pike","piranha","platypus","pointer","poodle","porcupine","possum","prawn","puffin","pug","puma","quail","rabbit","raccoon","rat","rattlesnake","ray","reindeer","retriever","rhinoceros","robin","rottweiler","russel","salamander","scorpion","seahorse","seal","shark","sheep","sheepdog","shrew","shrimp","skater","skunk","sloth","slug","snail","snake","snowshoe","spaniel","sparrow","spider","sponge","squid","squirrel","squirt","starfish","stingray","stoat","swan","tapir","tarantula","termite","terrier","tiger","toad","tortoise","toucan","tuatara","turkey","turtle","uakari","urchin","vole","vulture","wallaby","walrus","warthog","wasp","weasel","whale","whippet","wildebeest","wolf","wolfhound","wolverine","wombat","woodlouse","woodpecker","worm","yak","zebra","zebu","zonkey","zorse"]},capitalize=$=>$.charAt(0).toUpperCase()+$.slice(1),generateName=$=>{const _=$.length*2/3,I=$.substring(0,_),j=$.substring(_),U=capitalize(data.adjectives[parseInt(I,16)%data.adjectives.length]),q=capitalize(data.animals[parseInt(j,16)%data.animals.length]);return`${U} ${q}`};const IdentityListItem=React.forwardRef(({identity:$,presence:_,onClick:I,classNames:j,...U},q)=>{var Y,X,Q,Z,ee;const G=keyToFallback($.identityKey),K=useId$1("identityListItem__label"),J=((Y=$.profile)==null?void 0:Y.displayName)??generateName($.identityKey.toHex());return React.createElement(ListItem.Root,{...U,classNames:mx("flex gap-2 pis-3 pie-1 items-center",I&&"cursor-pointer",j),onClick:()=>I==null?void 0:I(),"data-testid":"identity-list-item",labelId:K,ref:q},React.createElement(Avatar.Root,{status:_===echo.SpaceMember.PresenceState.ONLINE?"active":"inactive",labelId:K,hue:((Q=(X=$.profile)==null?void 0:X.data)==null?void 0:Q.hue)||G.hue},React.createElement(Avatar.Frame,{classNames:"place-self-center"},React.createElement(Avatar.Fallback,{text:((ee=(Z=$.profile)==null?void 0:Z.data)==null?void 0:ee.emoji)||G.emoji})),React.createElement(Avatar.Label,{classNames:"text-sm truncate pli-2"},J)))}),SpaceMemberList=({spaceKey:$,includeSelf:_,onSelect:I})=>{const j=reactClient.useClient(),U=echo.useMembers($),q=React.useMemo(()=>_?U.sort(G=>G.identity.identityKey.equals(j.halo.identity.get().identityKey)?-1:1):U.filter(G=>!G.identity.identityKey.equals(j.halo.identity.get().identityKey)),[U]);return React.createElement(SpaceMemberListImpl,{members:q,onSelect:I})},SpaceMemberListImpl=({members:$,onSelect:_})=>{const{t:I}=useTranslation("os"),j=$.filter(U=>U.identity);return j.length>0?React.createElement(List,{classNames:"flex flex-col gap-2","data-testid":"space-members-list"},j.map(U=>React.createElement(IdentityListItem,{key:U.identity.identityKey.toHex(),identity:U.identity,presence:U.presence,onClick:_&&(()=>_(U))}))):React.createElement("div",{role:"none",className:"grow flex items-center p-2"},React.createElement("p",{className:mx(descriptionText,"text-center is-full mlb-2")},I("empty space members message")))},iconProps={weight:"duotone",width:24,height:24,x:8,y:8},DeviceListItem=React.forwardRef(({device:$,onClickAdd:_,onClickEdit:I,onClickReset:j,onClickJoinExisting:U,classNames:q,connectionState:G,onAgentDestroy:K,...J},Y)=>{var re,ae;const{t:X}=useTranslation("os"),Q=keyToFallback($.deviceKey),Z=useId$1("identityListItem__label"),ee=$.profile?X("device name placeholder",{os:$.profile.os,platform:$.profile.platform}):generateName($.deviceKey.toHex()),te=$.kind===halo.DeviceKind.CURRENT;return React.createElement(ListItem.Root,{...J,classNames:["flex gap-2 items-center mlb-2",q],"data-testid":`device-list-item${te?"-current":""}`,labelId:Z,ref:Y},React.createElement(Avatar.Root,{status:te&&G===mesh.ConnectionState.OFFLINE?"error":$.presence===halo.Device.PresenceState.ONLINE?"active":"inactive",labelId:Z,hue:Q.hue,variant:"square"},React.createElement(Avatar.Frame,{classNames:"place-self-center"},(re=$.profile)!=null&&re.type?$.profile.type===halo.DeviceType.AGENT_MANAGED?React.createElement(react.Database,{...iconProps}):$.profile.type===halo.DeviceType.BROWSER?React.createElement(react.Compass,{...iconProps}):$.profile.type===halo.DeviceType.NATIVE?React.createElement(react.Desktop,{...iconProps}):[halo.DeviceType.AGENT,halo.DeviceType.AGENT_MANAGED].includes($.profile.type)?React.createElement(react.Robot,{...iconProps}):$.profile.type===halo.DeviceType.MOBILE?React.createElement(react.DeviceMobile,{...iconProps}):React.createElement(react.Devices,{...iconProps}):React.createElement(Avatar.Fallback,{text:Q.emoji})),React.createElement(Avatar.Label,{classNames:"flex-1 text-sm truncate"},ee),te&&React.createElement(Tag,{color:"primary"},X("current device tag label")),((ae=$.profile)==null?void 0:ae.type)===halo.DeviceType.AGENT_MANAGED?React.createElement(Tooltip.Root,null,React.createElement(Tooltip.Trigger,{asChild:!0},React.createElement(Button,{variant:"ghost",classNames:"pli-0 is-[--rail-action] bs-[--rail-action]","data-testid":"agent.destroy",onClick:K},React.createElement("span",{className:"sr-only"},X("destroy agent label")),React.createElement(react.Power,{className:getSize(5)}))),React.createElement(Tooltip.Portal,null,React.createElement(Tooltip.Content,{side:"bottom",classNames:"z-50"},X("destroy agent label")))):$.kind===halo.DeviceKind.CURRENT&&React.createElement(DropdownMenu2.Root,null,React.createElement(DropdownMenu2.Trigger,{asChild:!0},React.createElement(Button,{variant:"ghost",classNames:"pli-0 is-[--rail-action] bs-[--rail-action]","data-testid":`device-list-item${te?"-current":""}.options`},React.createElement("span",{className:"sr-only"},X("more options label")),React.createElement(react.DotsThree,{className:getSize(5)}))),React.createElement(DropdownMenu2.Content,null,React.createElement(DropdownMenu2.Viewport,null,React.createElement(DropdownMenu2.Item,{"data-testid":"device-list-item-current.join-existing",onClick:U},React.createElement(react.ShareFat,{className:getSize(5)}),X("choose join new identity label")),React.createElement(DropdownMenu2.Item,{"data-testid":"device-list-item-current.reset",onClick:j},React.createElement(react.Power,{className:getSize(5)}),X("reset device label")))))))}),DeviceList=({devices:$,connectionState:_,onClickAdd:I,onClickEdit:j,onClickReset:U,onClickJoinExisting:q,onAgentDestroy:G})=>{const{t:K}=useTranslation("os");return React.createElement(React.Fragment,null,React.createElement("h2",{className:mx(descriptionText,"text-center mbs-4")},K("devices heading")),$.length>0&&React.createElement(List,null,$.map(J=>React.createElement(DeviceListItem,{key:J.deviceKey.toHex(),device:J,onClickEdit:()=>j==null?void 0:j(J),onClickReset:U,onClickJoinExisting:q,connectionState:_,onAgentDestroy:G}))),React.createElement(Button,{variant:"ghost",classNames:"justify-start gap-2 !pis-0 !pie-3 is-full","data-testid":"devices-panel.create-invitation",onClick:I},React.createElement("div",{role:"img",className:mx(getSize(8),"m-1 rounded-sm bg-input grid place-items-center")},React.createElement(react.Plus,{weight:"light",className:getSize(6)})),React.createElement("span",{className:"grow font-medium text-start"},K("choose add device label")),React.createElement(react.CaretRight,{weight:"bold",className:getSize(4)})))},minutesInMonth=43200,minutesInDay=1440;function getTimezoneOffsetInMilliseconds($){const _=toDate($),I=new Date(Date.UTC(_.getFullYear(),_.getMonth(),_.getDate(),_.getHours(),_.getMinutes(),_.getSeconds(),_.getMilliseconds()));return I.setUTCFullYear(_.getFullYear()),+$-+I}function compareAsc($,_){const I=toDate($),j=toDate(_),U=I.getTime()-j.getTime();return U<0?-1:U>0?1:U}function differenceInCalendarMonths($,_){const I=toDate($),j=toDate(_),U=I.getFullYear()-j.getFullYear(),q=I.getMonth()-j.getMonth();return U*12+q}function getRoundingMethod($){return _=>{const j=($?Math[$]:Math.trunc)(_);return j===0?0:j}}function differenceInMilliseconds($,_){return+toDate($)-+toDate(_)}function endOfDay($){const _=toDate($);return _.setHours(23,59,59,999),_}function endOfMonth($){const _=toDate($),I=_.getMonth();return _.setFullYear(_.getFullYear(),I+1,0),_.setHours(23,59,59,999),_}function isLastDayOfMonth($){const _=toDate($);return+endOfDay(_)==+endOfMonth(_)}function differenceInMonths($,_){const I=toDate($),j=toDate(_),U=compareAsc(I,j),q=Math.abs(differenceInCalendarMonths(I,j));let G;if(q<1)G=0;else{I.getMonth()===1&&I.getDate()>27&&I.setDate(30),I.setMonth(I.getMonth()-U*q);let K=compareAsc(I,j)===-U;isLastDayOfMonth(toDate($))&&q===1&&compareAsc($,j)===1&&(K=!1),G=U*(q-Number(K))}return G===0?0:G}function differenceInSeconds($,_,I){const j=differenceInMilliseconds($,_)/1e3;return getRoundingMethod(I==null?void 0:I.roundingMethod)(j)}function formatDistance($,_,I){const j=getDefaultOptions(),U=(I==null?void 0:I.locale)??j.locale??enUS$1,q=2520,G=compareAsc($,_);if(isNaN(G))throw new RangeError("Invalid time value");const K=Object.assign({},I,{addSuffix:I==null?void 0:I.addSuffix,comparison:G});let J,Y;G>0?(J=toDate(_),Y=toDate($)):(J=toDate($),Y=toDate(_));const X=differenceInSeconds(Y,J),Q=(getTimezoneOffsetInMilliseconds(Y)-getTimezoneOffsetInMilliseconds(J))/1e3,Z=Math.round((X-Q)/60);let ee;if(Z<2)return I!=null&&I.includeSeconds?X<5?U.formatDistance("lessThanXSeconds",5,K):X<10?U.formatDistance("lessThanXSeconds",10,K):X<20?U.formatDistance("lessThanXSeconds",20,K):X<40?U.formatDistance("halfAMinute",0,K):X<60?U.formatDistance("lessThanXMinutes",1,K):U.formatDistance("xMinutes",1,K):Z===0?U.formatDistance("lessThanXMinutes",1,K):U.formatDistance("xMinutes",Z,K);if(Z<45)return U.formatDistance("xMinutes",Z,K);if(Z<90)return U.formatDistance("aboutXHours",1,K);if(Z<minutesInDay){const te=Math.round(Z/60);return U.formatDistance("aboutXHours",te,K)}else{if(Z<q)return U.formatDistance("xDays",1,K);if(Z<minutesInMonth){const te=Math.round(Z/minutesInDay);return U.formatDistance("xDays",te,K)}else if(Z<minutesInMonth*2)return ee=Math.round(Z/minutesInMonth),U.formatDistance("aboutXMonths",ee,K)}if(ee=differenceInMonths(Y,J),ee<12){const te=Math.round(Z/minutesInMonth);return U.formatDistance("xMonths",te,K)}else{const te=ee%12,re=Math.trunc(ee/12);return te<3?U.formatDistance("aboutXYears",re,K):te<9?U.formatDistance("overXYears",re,K):U.formatDistance("almostXYears",re+1,K)}}function formatDistanceToNow($,_){return formatDistance($,Date.now(),_)}var SpaceState;(function($){$[$.INVALID=0]="INVALID",$[$.SPACE_INACTIVE=2]="SPACE_INACTIVE",$[$.SPACE_ACTIVE=6]="SPACE_ACTIVE",$[$.SPACE_CLOSED=1]="SPACE_CLOSED",$[$.SPACE_CONTROL_ONLY=7]="SPACE_CONTROL_ONLY",$[$.SPACE_INITIALIZING=4]="SPACE_INITIALIZING",$[$.SPACE_READY=3]="SPACE_READY",$[$.SPACE_ERROR=5]="SPACE_ERROR",$[$.SPACE_REQUIRES_MIGRATION=8]="SPACE_REQUIRES_MIGRATION"})(SpaceState||(SpaceState={}));var Invitation;(function($){(function(_){_[_.INTERACTIVE=0]="INTERACTIVE",_[_.DELEGATED=1]="DELEGATED",_[_.MULTIUSE=2]="MULTIUSE"})($.Type||($.Type={})),function(_){_[_.DEVICE=0]="DEVICE",_[_.SPACE=1]="SPACE"}($.Kind||($.Kind={})),function(_){_[_.NONE=0]="NONE",_[_.SHARED_SECRET=1]="SHARED_SECRET",_[_.KNOWN_PUBLIC_KEY=2]="KNOWN_PUBLIC_KEY"}($.AuthMethod||($.AuthMethod={})),function(_){_[_.INIT=0]="INIT",_[_.CONNECTING=1]="CONNECTING",_[_.CONNECTED=2]="CONNECTED",_[_.READY_FOR_AUTHENTICATION=3]="READY_FOR_AUTHENTICATION",_[_.AUTHENTICATING=4]="AUTHENTICATING",_[_.SUCCESS=5]="SUCCESS",_[_.CANCELLED=6]="CANCELLED",_[_.TIMEOUT=7]="TIMEOUT",_[_.ERROR=8]="ERROR",_[_.EXPIRED=9]="EXPIRED"}($.State||($.State={}))})(Invitation||(Invitation={}));var SystemStatus;(function($){$[$.ACTIVE=0]="ACTIVE",$[$.INACTIVE=1]="INACTIVE"})(SystemStatus||(SystemStatus={}));var GetDiagnosticsRequest;(function($){(function(_){_[_.NONE=0]="NONE",_[_.TRUNCATE=1]="TRUNCATE",_[_.HUMANIZE=2]="HUMANIZE"})($.KEY_OPTION||($.KEY_OPTION={}))})(GetDiagnosticsRequest||(GetDiagnosticsRequest={}));var Platform;(function($){(function(_){_[_.BROWSER=0]="BROWSER",_[_.SHARED_WORKER=1]="SHARED_WORKER",_[_.NODE=2]="NODE"})($.PLATFORM_TYPE||($.PLATFORM_TYPE={}))})(Platform||(Platform={}));var DeviceKind;(function($){$[$.CURRENT=0]="CURRENT",$[$.TRUSTED=1]="TRUSTED"})(DeviceKind||(DeviceKind={}));var Device;(function($){(function(_){_[_.OFFLINE=0]="OFFLINE",_[_.ONLINE=1]="ONLINE",_[_.REMOVED=2]="REMOVED"})($.PresenceState||($.PresenceState={}))})(Device||(Device={}));var SpaceMember;(function($){(function(_){_[_.OFFLINE=0]="OFFLINE",_[_.ONLINE=1]="ONLINE"})($.PresenceState||($.PresenceState={}))})(SpaceMember||(SpaceMember={}));var CreateEpochRequest;(function($){(function(_){_[_.NONE=0]="NONE",_[_.INIT_AUTOMERGE=1]="INIT_AUTOMERGE",_[_.PRUNE_AUTOMERGE_ROOT_HISTORY=2]="PRUNE_AUTOMERGE_ROOT_HISTORY",_[_.FRAGMENT_AUTOMERGE_ROOT=3]="FRAGMENT_AUTOMERGE_ROOT",_[_.REPLACE_AUTOMERGE_ROOT=4]="REPLACE_AUTOMERGE_ROOT",_[_.MIGRATE_REFERENCES_TO_DXN=5]="MIGRATE_REFERENCES_TO_DXN"})($.Migration||($.Migration={}))})(CreateEpochRequest||(CreateEpochRequest={}));var QueryInvitationsResponse;(function($){(function(_){_[_.ADDED=0]="ADDED",_[_.REMOVED=1]="REMOVED",_[_.SAVED=2]="SAVED",_[_.LOAD_COMPLETE=3]="LOAD_COMPLETE"})($.Action||($.Action={})),function(_){_[_.CREATED=0]="CREATED",_[_.ACCEPTED=1]="ACCEPTED"}($.Type||($.Type={}))})(QueryInvitationsResponse||(QueryInvitationsResponse={}));var ConnectionState;(function($){$[$.OFFLINE=0]="OFFLINE",$[$.ONLINE=1]="ONLINE"})(ConnectionState||(ConnectionState={}));var LogLevel;(function($){$[$.NONE=0]="NONE",$[$.TRACE=5]="TRACE",$[$.DEBUG=10]="DEBUG",$[$.INFO=11]="INFO",$[$.WARN=12]="WARN",$[$.ERROR=13]="ERROR"})(LogLevel||(LogLevel={}));var QueryLogsRequest;(function($){(function(_){_[_.NONE=0]="NONE",_[_.INCLUSIVE=1]="INCLUSIVE",_[_.EXPLICIT=2]="EXPLICIT"})($.MatchingOptions||($.MatchingOptions={}))})(QueryLogsRequest||(QueryLogsRequest={}));var ContextDisposedError=class extends Error{constructor(){super("Context disposed.")}};function _ts_decorate$1($,_,I,j){var U=arguments.length,q=U<3?_:j===null?j=Object.getOwnPropertyDescriptor(_,I):j,G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate($,_,I,j);else for(var K=$.length-1;K>=0;K--)(G=$[K])&&(q=(U<3?G(q):U>3?G(_,I,q):G(_,I))||q);return U>3&&q&&Object.defineProperty(_,I,q),q}var __dxlog_file$6="/home/runner/work/dxos/dxos/packages/common/context/src/context.ts",MAX_SAFE_DISPOSE_CALLBACKS=300,DEFAULT_ERROR_HANDLER=($,_)=>{if(!($ instanceof ContextDisposedError))throw _.dispose(),$},CONTEXT_FLAG_IS_DISPOSED=1,CONTEXT_FLAG_LEAK_DETECTED=2,_a$1,_b,Context=(dn=class{constructor(_={},I){rn(this,Kt);rn(this,Jt);rn(this,an);rn(this,fn);rn(this,bn);rn(this,Pn);rn(this,Yt);rn(this,ln);Vt(this,Jt,[]),Vt(this,an,void 0),Vt(this,fn,void 0),Vt(this,Yt,0),Vt(this,ln,void 0),this.maxSafeDisposeCallbacks=MAX_SAFE_DISPOSE_CALLBACKS,this[_a$1]="Context",this[_b]=()=>this.toString(),Vt(this,an,getContextName(_,I)),Vt(this,fn,_.parent),Vt(this,bn,_.attributes??{}),Vt(this,Pn,_.onError??DEFAULT_ERROR_HANDLER)}static default(){return new dn}get disposed(){return At(this,Kt,Vn)}get disposeCallbacksLength(){return At(this,Jt).length}onDispose(_){if(At(this,Kt,Vn)&&(async()=>{try{await _()}catch(I){log$2.catch(I,{context:At(this,an)},{F:__dxlog_file$6,L:119,S:this,C:(j,U)=>j(...U)})}})(),At(this,Jt).push(_),At(this,Jt).length>this.maxSafeDisposeCallbacks&&!At(this,Kt,Lr)){Vt(this,Kt,!0,Br);const I=new StackTrace().getStackArray(1)[0].trim();log$2.warn("Context has a large number of dispose callbacks (this might be a memory leak).",{context:At(this,an),callSite:I,count:At(this,Jt).length},{F:__dxlog_file$6,L:128,S:this,C:(j,U)=>j(...U)})}return()=>{const I=At(this,Jt).indexOf(_);I!==-1&&At(this,Jt).splice(I,1)}}async dispose(_=!1){if(At(this,ln))return At(this,ln);Vt(this,Kt,!0,Fr);let I;const j=new Promise(J=>{I=J});Vt(this,ln,j);const U=Array.from(At(this,Jt)).reverse();At(this,Jt).length=0;let q=0,G=!0;const K=[];for(const J of U)try{await J(),q++}catch(Y){G=!1,_?K.push(Y):log$2.catch(Y,{context:At(this,an),callback:q,count:U.length},{F:__dxlog_file$6,L:188,S:this,C:(X,Q)=>X(...Q)})}if(K.length>0)throw new AggregateError(K);return I(G),G}raise(_){if(!At(this,Kt,Vn))try{At(this,Pn).call(this,_,this)}catch(I){Promise.reject(I)}}derive({onError:_,attributes:I}={}){const j=new dn({onError:async q=>{if(!_)this.raise(q);else try{await _(q,this)}catch{this.raise(q)}},attributes:I}),U=this.onDispose(()=>j.dispose());return j.onDispose(U),j}getAttribute(_){if(_ in At(this,bn))return At(this,bn)[_];if(At(this,fn))return At(this,fn).getAttribute(_)}toString(){return`Context(${At(this,Kt,Vn)?"disposed":"active"})`}async[(_a$1=Symbol.toStringTag,_b=export_inspect.custom,Symbol.asyncDispose)](){await this.dispose()}},Jt=new WeakMap,an=new WeakMap,fn=new WeakMap,bn=new WeakMap,Pn=new WeakMap,Yt=new WeakMap,ln=new WeakMap,Kt=new WeakSet,Vn=function(){return!!(At(this,Yt)&CONTEXT_FLAG_IS_DISPOSED)},Fr=function(_){Vt(this,Yt,_?At(this,Yt)|CONTEXT_FLAG_IS_DISPOSED:At(this,Yt)&~CONTEXT_FLAG_IS_DISPOSED)},Lr=function(){return!!(At(this,Yt)&CONTEXT_FLAG_LEAK_DETECTED)},Br=function(_){Vt(this,Yt,_?At(this,Yt)|CONTEXT_FLAG_LEAK_DETECTED:At(this,Yt)&~CONTEXT_FLAG_LEAK_DETECTED)},dn);Context=_ts_decorate$1([safeInstanceof("Context")],Context);var getContextName=($,_)=>{var I;if($.name)return $.name;if((I=_==null?void 0:_.F)!=null&&I.length){const j=_==null?void 0:_.F.split("/");return`${j[j.length-1]}#${(_==null?void 0:_.L)??0}`}},LifecycleState;(function($){$.CLOSED="CLOSED",$.OPEN="OPEN",$.ERROR="ERROR"})(LifecycleState||(LifecycleState={}));var Observable$2={};Object.defineProperty(Observable$2,"__esModule",{value:!0}),Observable$2.Observable=void 0;const hasSymbol=$=>!!Symbol[$],getSymbol=$=>hasSymbol($)?Symbol[$]:"@@"+$,SymbolIterator=getSymbol("iterator"),SymbolObservable=getSymbol("observable"),SymbolSpecies=getSymbol("species");function getMethod($,_){let I=$[_];if(I!=null){if(typeof I!="function")throw new TypeError(I+" is not a function");return I}}function getSpecies($){let _=$.constructor;return _!==void 0&&(_=_[SymbolSpecies],_===null&&(_=void 0)),_!==void 0?_:Observable$1}function isObservable$1($){return $ instanceof Observable$1}function hostReportError($){hostReportError.log?hostReportError.log($):setTimeout(()=>{throw $})}function enqueue($){Promise.resolve().then(()=>{try{$()}catch(_){hostReportError(_)}})}function cleanupSubscription($){let _=$._cleanup;if(_!==void 0&&($._cleanup=void 0,!!_))try{if(typeof _=="function")_();else{let I=getMethod(_,"unsubscribe");I&&I.call(_)}}catch(I){hostReportError(I)}}function closeSubscription($){$._observer=void 0,$._queue=void 0,$._state="closed"}function flushSubscription($){let _=$._queue;if(_){$._queue=void 0,$._state="ready";for(let I=0;I<_.length&&(notifySubscription($,_[I].type,_[I].value),$._state!=="closed");++I);}}function notifySubscription($,_,I){$._state="running";let j=$._observer;try{let U=getMethod(j,_);switch(_){case"next":U&&U.call(j,I);break;case"error":if(closeSubscription($),U)U.call(j,I);else throw I;break;case"complete":closeSubscription($),U&&U.call(j);break}}catch(U){hostReportError(U)}$._state==="closed"?cleanupSubscription($):$._state==="running"&&($._state="ready")}function onNotify($,_,I){if($._state!=="closed"){if($._state==="buffering"){$._queue.push({type:_,value:I});return}if($._state!=="ready"){$._state="buffering",$._queue=[{type:_,value:I}],enqueue(()=>flushSubscription($));return}notifySubscription($,_,I)}}class Subscription{constructor(_,I){this._cleanup=void 0,this._observer=_,this._queue=void 0,this._state="initializing";let j=this,U={get closed(){return j._state==="closed"},next(q){onNotify(j,"next",q)},error(q){onNotify(j,"error",q)},complete(){onNotify(j,"complete")}};try{this._cleanup=I.call(void 0,U)}catch(q){U.error(q)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(closeSubscription(this),cleanupSubscription(this))}}let Observable$1=class rr{constructor(_){if(!(this instanceof rr))throw new TypeError("Observable cannot be called as a function");if(typeof _!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=_}subscribe(_){return(typeof _!="object"||_===null)&&(_={next:_,error:arguments[1],complete:arguments[2]}),new Subscription(_,this._subscriber)}forEach(_){return new Promise((I,j)=>{if(typeof _!="function"){j(new TypeError(_+" is not a function"));return}function U(){q.unsubscribe(),I()}let q=this.subscribe({next(G){try{_(G,U)}catch(K){j(K),q.unsubscribe()}},error:j,complete:I})})}map(_){if(typeof _!="function")throw new TypeError(_+" is not a function");let I=getSpecies(this);return new I(j=>this.subscribe({next(U){try{U=_(U)}catch(q){return j.error(q)}j.next(U)},error(U){j.error(U)},complete(){j.complete()}}))}filter(_){if(typeof _!="function")throw new TypeError(_+" is not a function");let I=getSpecies(this);return new I(j=>this.subscribe({next(U){try{if(!_(U))return}catch(q){return j.error(q)}j.next(U)},error(U){j.error(U)},complete(){j.complete()}}))}reduce(_){if(typeof _!="function")throw new TypeError(_+" is not a function");let I=getSpecies(this),j=arguments.length>1,U=!1,G=arguments[1];return new I(K=>this.subscribe({next(J){let Y=!U;if(U=!0,!Y||j)try{G=_(G,J)}catch(X){return K.error(X)}else G=J},error(J){K.error(J)},complete(){if(!U&&!j)return K.error(new TypeError("Cannot reduce an empty sequence"));K.next(G),K.complete()}}))}async all(){let _=[];return await this.forEach(I=>_.push(I)),_}concat(..._){let I=getSpecies(this);return new I(j=>{let U,q=0;function G(K){U=K.subscribe({next(J){j.next(J)},error(J){j.error(J)},complete(){q===_.length?(U=void 0,j.complete()):G(I.from(_[q++]))}})}return G(this),()=>{U&&(U.unsubscribe(),U=void 0)}})}flatMap(_){if(typeof _!="function")throw new TypeError(_+" is not a function");let I=getSpecies(this);return new I(j=>{let U=[],q=this.subscribe({next(K){if(_)try{K=_(K)}catch(Y){return j.error(Y)}let J=I.from(K).subscribe({next(Y){j.next(Y)},error(Y){j.error(Y)},complete(){let Y=U.indexOf(J);Y>=0&&U.splice(Y,1),G()}});U.push(J)},error(K){j.error(K)},complete(){G()}});function G(){q.closed&&U.length===0&&j.complete()}return()=>{U.forEach(K=>K.unsubscribe()),q.unsubscribe()}})}[SymbolObservable](){return this}static from(_){let I=typeof this=="function"?this:rr;if(_==null)throw new TypeError(_+" is not an object");let j=getMethod(_,SymbolObservable);if(j){let U=j.call(_);if(Object(U)!==U)throw new TypeError(U+" is not an object");return isObservable$1(U)&&U.constructor===I?U:new I(q=>U.subscribe(q))}if(hasSymbol("iterator")&&(j=getMethod(_,SymbolIterator),j))return new I(U=>{enqueue(()=>{if(!U.closed){for(let q of j.call(_))if(U.next(q),U.closed)return;U.complete()}})});if(Array.isArray(_))return new I(U=>{enqueue(()=>{if(!U.closed){for(let q=0;q<_.length;++q)if(U.next(_[q]),U.closed)return;U.complete()}})});throw new TypeError(_+" is not observable")}static of(..._){let I=typeof this=="function"?this:rr;return new I(j=>{enqueue(()=>{if(!j.closed){for(let U=0;U<_.length;++U)if(j.next(_[U]),j.closed)return;j.complete()}})})}static get[SymbolSpecies](){return this}};Observable$2.Observable=Observable$1,Object.defineProperty(Observable$1,Symbol("extensions"),{value:{symbol:SymbolObservable,hostReportError},configurable:!0});var zenObservable=Observable$2.Observable;const Observable=getDefaultExportFromCjs(zenObservable);var readableBrowser={exports:{}},streamBrowser=eventsExports.EventEmitter,buffer={},base64Js={};base64Js.byteLength=byteLength,base64Js.toByteArray=toByteArray,base64Js.fromByteArray=fromByteArray;for(var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i$1=0,len=code.length;i$1<len;++i$1)lookup[i$1]=code[i$1],revLookup[code.charCodeAt(i$1)]=i$1;revLookup[45]=62,revLookup[95]=63;function getLens($){var _=$.length;if(_%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var I=$.indexOf("=");I===-1&&(I=_);var j=I===_?0:4-I%4;return[I,j]}function byteLength($){var _=getLens($),I=_[0],j=_[1];return(I+j)*3/4-j}function _byteLength($,_,I){return(_+I)*3/4-I}function toByteArray($){var _,I=getLens($),j=I[0],U=I[1],q=new Arr(_byteLength($,j,U)),G=0,K=U>0?j-4:j,J;for(J=0;J<K;J+=4)_=revLookup[$.charCodeAt(J)]<<18|revLookup[$.charCodeAt(J+1)]<<12|revLookup[$.charCodeAt(J+2)]<<6|revLookup[$.charCodeAt(J+3)],q[G++]=_>>16&255,q[G++]=_>>8&255,q[G++]=_&255;return U===2&&(_=revLookup[$.charCodeAt(J)]<<2|revLookup[$.charCodeAt(J+1)]>>4,q[G++]=_&255),U===1&&(_=revLookup[$.charCodeAt(J)]<<10|revLookup[$.charCodeAt(J+1)]<<4|revLookup[$.charCodeAt(J+2)]>>2,q[G++]=_>>8&255,q[G++]=_&255),q}function tripletToBase64($){return lookup[$>>18&63]+lookup[$>>12&63]+lookup[$>>6&63]+lookup[$&63]}function encodeChunk($,_,I){for(var j,U=[],q=_;q<I;q+=3)j=($[q]<<16&16711680)+($[q+1]<<8&65280)+($[q+2]&255),U.push(tripletToBase64(j));return U.join("")}function fromByteArray($){for(var _,I=$.length,j=I%3,U=[],q=16383,G=0,K=I-j;G<K;G+=q)U.push(encodeChunk($,G,G+q>K?K:G+q));return j===1?(_=$[I-1],U.push(lookup[_>>2]+lookup[_<<4&63]+"==")):j===2&&(_=($[I-2]<<8)+$[I-1],U.push(lookup[_>>10]+lookup[_>>4&63]+lookup[_<<2&63]+"=")),U.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ieee754.read=function($,_,I,j,U){var q,G,K=U*8-j-1,J=(1<<K)-1,Y=J>>1,X=-7,Q=I?U-1:0,Z=I?-1:1,ee=$[_+Q];for(Q+=Z,q=ee&(1<<-X)-1,ee>>=-X,X+=K;X>0;q=q*256+$[_+Q],Q+=Z,X-=8);for(G=q&(1<<-X)-1,q>>=-X,X+=j;X>0;G=G*256+$[_+Q],Q+=Z,X-=8);if(q===0)q=1-Y;else{if(q===J)return G?NaN:(ee?-1:1)*(1/0);G=G+Math.pow(2,j),q=q-Y}return(ee?-1:1)*G*Math.pow(2,q-j)},ieee754.write=function($,_,I,j,U,q){var G,K,J,Y=q*8-U-1,X=(1<<Y)-1,Q=X>>1,Z=U===23?Math.pow(2,-24)-Math.pow(2,-77):0,ee=j?0:q-1,te=j?1:-1,re=_<0||_===0&&1/_<0?1:0;for(_=Math.abs(_),isNaN(_)||_===1/0?(K=isNaN(_)?1:0,G=X):(G=Math.floor(Math.log(_)/Math.LN2),_*(J=Math.pow(2,-G))<1&&(G--,J*=2),G+Q>=1?_+=Z/J:_+=Z*Math.pow(2,1-Q),_*J>=2&&(G++,J/=2),G+Q>=X?(K=0,G=X):G+Q>=1?(K=(_*J-1)*Math.pow(2,U),G=G+Q):(K=_*Math.pow(2,Q-1)*Math.pow(2,U),G=0));U>=8;$[I+ee]=K&255,ee+=te,K/=256,U-=8);for(G=G<<U|K,Y+=U;Y>0;$[I+ee]=G&255,ee+=te,G/=256,Y-=8);$[I+ee-te]|=re*128};/*!
|
|
995
995
|
* The buffer module from node.js, for the browser.
|
|
996
996
|
*
|
|
997
997
|
* @author Feross Aboukhadijeh <https://feross.org>
|