@notis_ai/cli 0.2.20 → 0.2.21
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.
|
@@ -14,5 +14,5 @@ ${lines}
|
|
|
14
14
|
`)}function applyCommentPatches(comments,patches){return comments.map(comment=>{let patch=patches[comment.recordKey];return!patch||patch.revision!=null&&comment.revision>=patch.revision?comment:{...comment,...patch.fields,revision:Math.max(comment.revision,patch.revision??0)}})}var COMMENT_CHECK_ANSWERS=["Looks good","Undo"],COMMENT_TEXT_FILE=/\.(txt|md|markdown|csv|tsv|json|ya?ml|html?|xml|srt|vtt)$/i;function clipCommentAnswer(body){return body.length>500?`${body.slice(0,497)}...`:body}function newCommentId(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}function commentRelativeTime(iso,locale,now){let at=commentTimeOf(iso);if(!Number.isFinite(at))return"";let seconds=Math.round((at-now)/1e3),format=new Intl.RelativeTimeFormat(locale,{numeric:"auto",style:"short"}),abs=Math.abs(seconds);return abs<45?format.format(0,"second"):abs<3600?format.format(Math.round(seconds/60),"minute"):abs<86400?format.format(Math.round(seconds/3600),"hour"):format.format(Math.round(seconds/86400),"day")}async function writeCommentClipboard(text,host){try{if(typeof navigator<"u"&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(text),!0}catch{}if(!host)return!1;try{let doc=host.ownerDocument,area=doc.createElement("textarea");area.value=text,area.setAttribute("readonly",""),area.style.position="absolute",area.style.opacity="0",area.style.pointerEvents="none",host.appendChild(area),area.select();let ok=doc.execCommand("copy");return area.remove(),ok}catch{return!1}}function scrollCommentIntoView(element){let view=element.ownerDocument.defaultView;if(!view)return;let box=element.parentElement;for(;box&&box.tagName!=="BODY";){let style=view.getComputedStyle(box);if(/(auto|scroll)/.test(style.overflowY)&&box.scrollHeight>box.clientHeight+1)break;box=box.parentElement}if(!box||box.tagName==="BODY")return;let outer=box.getBoundingClientRect(),at=element.getBoundingClientRect(),delta=at.top<outer.top?at.top-outer.top-8:at.bottom>outer.bottom?at.bottom-outer.bottom+8:0;delta&&typeof box.scrollBy=="function"&&box.scrollBy({top:delta,behavior:"smooth"})}var COMMENT_WORDS=Object.freeze({comments:w("Comments","Commentaires"),thisAnchor:w("This item","Cet \xE9l\xE9ment"),all:w("All","Tous"),open:w("Open","Ouverts"),resolved:w("Resolved","R\xE9solu"),resolvedFilter:w("Resolved","R\xE9solus"),status:w("Status","Statut"),scope:w("Show","Afficher"),copy:w("Copy changes since last turn","Copier depuis le dernier tour"),copiedOne:w("Copied 1 change","1 changement copi\xE9"),copiedMany:w("Copied {n} changes","{n} changements copi\xE9s"),copyFailed:w("Could not copy. Try again.","Copie impossible. R\xE9essaie."),anchorLabel:w("Item {n}","\xC9l\xE9ment {n}"),reply:w("Reply","R\xE9pondre"),replyToReopen:w("Reply to reopen","R\xE9pondre pour rouvrir"),newComment:w("New comment","Nouveau commentaire"),newCommentOn:w("New comment on item {n}","Nouveau commentaire sur l\u2019\xE9l\xE9ment {n}"),newCommentWhole:w("New comment on all of item {n}","Nouveau commentaire sur tout l\u2019\xE9l\xE9ment {n}"),commentOnAnchor:w("Comment on all of item {n}","Commenter tout l\u2019\xE9l\xE9ment {n}"),pinHint:w("Click where the comment goes.","Clique l\xE0 o\xF9 va le commentaire."),zoneHint:w("Click to pin a spot, or hold and drag to mark a zone.","Clique pour \xE9pingler un point, ou maintiens et fais glisser pour marquer une zone."),commentPlaceholder:w("Add a comment","Ajouter un commentaire"),send:w("Send","Envoyer"),cancel:w("Cancel","Annuler"),resolve:w("Resolve","R\xE9soudre"),reopen:w("Reopen","Rouvrir"),delete:w("Delete","Supprimer"),deleteTitle:w("Delete this comment thread?",`Supprimer ce fil de commentaires${NNBSP}?`),deleteBody:w("It disappears from the page. The next copy still tells agents you deleted it.","Il dispara\xEEt de la page. La prochaine copie indique quand m\xEAme aux agents que tu l\u2019as supprim\xE9."),needs:w("{who} needs","{who} a besoin de"),needCheck:w("Your check on the change","Ta validation du changement"),needChoice:w("A choice","Un choix"),needInput:w("A file or text","Un fichier ou du texte"),looksGood:w("Looks good","\xC7a me va"),undo:w("Undo","Annuler le changement"),attach:w("Attach a file","Joindre un fichier"),paste:w("Paste text","Coller du texte"),sent:w("{answer}, sent to the agent","{answer}, envoy\xE9 \xE0 l\u2019agent"),example:w("Example","Exemple"),emptyAnchor:w("No comments here yet.","Aucun commentaire ici pour le moment."),emptyAll:w("No comments yet.","Aucun commentaire pour le moment."),emptyResolved:w("No resolved comments.","Aucun commentaire r\xE9solu."),saveError:w("Could not save that change. Try again.","Impossible d\u2019enregistrer ce changement. R\xE9essaie."),textOnly:w("Only text files can be attached here.","Seuls les fichiers texte peuvent \xEAtre joints ici."),newActivity:w("New since last turn","Nouveau depuis le dernier tour"),pin:w("{who}: {body}",`{who}${NNBSP}: {body}`),zone:w("{who}, on a zone: {body}",`{who}, sur une zone${NNBSP}: {body}`)});function commentWords(overrides){return overrides?Object.freeze({...COMMENT_WORDS,...overrides}):COMMENT_WORDS}function commentCopiedWords(words,n){return n===1?words.copiedOne:fillWords(words.copiedMany,{n})}import{useCallback as useCallback19,useEffect as useEffect24,useMemo as useMemo20,useRef as useRef23,useState as useState23}from"react";var ZONE_MIN_PX=4,NO_ANCHORS=Object.freeze([]);function useComments(options={}){let{list="comments",database="comments",scope=null,anchors=NO_ANCHORS,anchorKey=null,me="Flo",authors,fallbackAuthor="Notis",pageSize=500,live=!0}=options,runtime=useNotisRuntime(),locale=useToolkitLocale(),words=useMemo20(()=>commentWords(options.words),[options.words]),say=useCallback19((key,vars)=>pick(vars?fillWords(words[key],vars):words[key],locale),[words,locale]),columns=useMemo20(()=>commentColumns(options.columns),[options.columns]),latest=useRef23(options);latest.current=options;let query=useShown(list,{pageSize}),refetch=query.refetch,refetchRef=useRef23(refetch);refetchRef.current=refetch,useEffect24(()=>{if(!live||!runtime?.subscribeDatabase)return;let stop2=runtime.subscribeDatabase(database,()=>{refetchRef.current()});return()=>{stop2?.()}},[runtime,database,live]);let insertMutation=useNativeMutation(database,"insert"),updateMutation=useNativeMutation(database,"update"),toaster=useToast(),notify=toaster.notify,[patches,setPatches]=useState23({}),[drafts,setDrafts]=useState23([]),[busy,setBusy]=useState23(()=>new Set),[marker,setMarker]=useState23(null),authorsKey=authors?.join("|")??null,serverComments=useMemo20(()=>commentRowsOf(query.data).map(row=>readCommentRow(row,{columns,authors:authorsKey?.split("|"),fallbackAuthor})),[query.data,columns,authorsKey,fallbackAuthor]),comments=useMemo20(()=>{let serverKeys=new Set(serverComments.map(comment=>comment.recordKey)),pending=drafts.filter(draft=>!draft.serverKey||!serverKeys.has(draft.serverKey)).map(draft=>draft.comment);return[...applyCommentPatches(serverComments,patches),...pending]},[serverComments,patches,drafts]);useEffect24(()=>{let serverKeys=new Set(serverComments.map(comment=>comment.recordKey));setDrafts(current=>current.some(draft=>draft.serverKey&&serverKeys.has(draft.serverKey))?current.filter(draft=>!(draft.serverKey&&serverKeys.has(draft.serverKey))):current),setPatches(current=>{let changed=!1,next={};for(let[key,patch]of Object.entries(current)){let row=serverComments.find(comment=>comment.recordKey===key);if(row&&patch.revision!=null&&row.revision>=patch.revision){changed=!0;continue}next[key]=patch}return changed?next:current})},[serverComments]);let scopeKey=scope?`${scope.id}|${scope.recordKey}`:null,inScope=useMemo20(()=>comments.filter(comment=>inCommentScope(comment,scope)),[comments,scopeKey]),threads=useMemo20(()=>commentThreads(inScope,anchors).filter(thread=>thread.root.status!=="Deleted"),[inScope,anchors]),checkpoint=useMemo20(()=>{let saved=scope?.checkpoint??null;return marker&&(commentTimeOf(saved)||0)<commentTimeOf(marker)?marker:saved},[scope?.checkpoint,marker]),changes=useMemo20(()=>commentChangesSince(inScope,checkpoint,me),[inScope,checkpoint,me]),lastTurn=commentTimeOf(checkpoint)||0,isNew=useCallback19(comment=>comment.author!==me&&(commentTimeOf(comment.createdAt)||0)>lastTurn,[me,lastTurn]),threadsOn=useCallback19(key=>threads.filter(thread=>(thread.anchor?.recordKey??null)===(key??null)),[threads]),numberOf3=useCallback19(thread=>threadsOn(thread.anchor?.recordKey).findIndex(item=>item.root.recordKey===thread.root.recordKey)+1,[threadsOn]),anchor=useMemo20(()=>anchors.find(item=>item.recordKey===anchorKey),[anchors,anchorKey]),[filter,setFilter]=useState23("anchor"),[statusFilter,setStatusFilter]=useState23("open"),[threadKey,setThreadKey]=useState23(null),[draftPin,setDraftPin]=useState23(null),[deleting,setDeleting]=useState23(null),[commenting,setCommentingState]=useState23(!1),[copying,setCopying]=useState23(!1),effectiveFilter=anchors.length?filter:"all",visibleThreads=useMemo20(()=>{let wanted=statusFilter==="resolved"?"Resolved":"Open";return(effectiveFilter==="anchor"?threadsOn(anchorKey):threads).filter(thread=>thread.root.status===wanted)},[effectiveFilter,statusFilter,threadsOn,anchorKey,threads]),selectThread=useCallback19(thread=>{setThreadKey(thread.root.recordKey),setDraftPin(null),setCommentingState(!1),setStatusFilter(thread.root.status==="Resolved"?"resolved":"open"),latest.current.onSelectThread?.(thread)},[]),[now,setNow]=useState23(()=>Date.now());useEffect24(()=>{let id=setInterval(()=>setNow(Date.now()),3e4);return()=>clearInterval(id)},[]);let schemaRevision=query.data?.schema_revision,fail=useCallback19(error=>{console.warn("[comments] write failed",error),notify(words.saveError,{tone:"danger"})},[notify,words]),setBusyKey=useCallback19((key,on)=>setBusy(current=>{let next=new Set(current);return on?next.add(key):next.delete(key),next}),[]),commentsRef=useRef23(comments);commentsRef.current=comments;let patchesRef=useRef23(patches);patchesRef.current=patches;let updateRoot=useCallback19(async(root,fields,properties)=>{if(schemaRevision==null)return fail(new Error("Comments schema revision unknown")),!1;let key=root.recordKey,previous=patchesRef.current[key],revision=commentsRef.current.find(comment=>comment.recordKey===key)?.revision??root.revision;setPatches(current=>({...current,[key]:{fields:{...current[key]?.fields??{},...fields},revision:null}})),setBusyKey(key,!0);try{let receipt=await updateMutation.mutate({record_key:key,expected_revision:revision,properties},{schemaRevision,requestId:newCommentId()});return setPatches(current=>current[key]?{...current,[key]:{...current[key],revision:receipt.revision}}:current),refetch(),!0}catch(error){return setPatches(current=>{let next={...current};return previous?next[key]=previous:delete next[key],next}),fail(error),!1}finally{setBusyKey(key,!1)}},[schemaRevision,updateMutation,refetch,fail,setBusyKey]),changeProps=useCallback19((change,at,extra={})=>({...extra,[columns.change]:change,[columns.changedAt]:at}),[columns]),insert=useCallback19(async fields=>{if(schemaRevision==null)return fail(new Error("Comments schema revision unknown")),!1;let at=new Date().toISOString(),tempKey=`draft-${newCommentId()}`,currentScope=latest.current.scope??null,comment={id:tempKey,recordKey:tempKey,revision:0,body:fields.body,scopeIds:currentScope?[currentScope.id]:[],anchorIds:fields.anchor?[fields.anchor.id]:[],thread:fields.thread,author:me,x:fields.x,y:fields.y,w:columns.w&&columns.h?fields.w:null,h:columns.w&&columns.h?fields.h:null,status:"Open",needs:"none",options:[],answer:"",answeredAt:null,change:fields.change,changedAt:at,example:!1,createdAt:at};setDrafts(current=>[...current,{comment,serverKey:null}]);let properties={[columns.author]:me,[columns.status]:"Open",[columns.needs]:"none",[columns.example]:!1,...changeProps(fields.change,at)};columns.scope&¤tScope&&(properties[columns.scope]=[currentScope.id]),columns.anchor&&fields.anchor&&(properties[columns.anchor]=[fields.anchor.id]),fields.thread&&(properties[columns.thread]=fields.thread),fields.x!=null&&fields.y!=null&&(properties[columns.x]=Number(fields.x.toFixed(4)),properties[columns.y]=Number(fields.y.toFixed(4)),columns.w&&columns.h&&fields.w!=null&&fields.h!=null&&(properties[columns.w]=Number(fields.w.toFixed(4)),properties[columns.h]=Number(fields.h.toFixed(4))));try{let receipt=await insertMutation.mutate({columns:{title:fields.body},properties},{schemaRevision,requestId:newCommentId()});return setDrafts(current=>current.map(draft=>draft.comment.recordKey===tempKey?{...draft,serverKey:receipt.record_key}:draft)),refetch(),receipt.record_key}catch(error){return setDrafts(current=>current.filter(draft=>draft.comment.recordKey!==tempKey)),fail(error),!1}},[schemaRevision,me,columns,changeProps,insertMutation,refetch,fail]),actions=useMemo20(()=>({reply:async(thread,body)=>{let{root}=thread;if(root.recordKey.startsWith("draft-"))return!1;let rootFields={},rootProps={},at=new Date().toISOString();if(root.status==="Resolved"&&(Object.assign(rootFields,{status:"Open",change:"reopened",changedAt:at}),Object.assign(rootProps,changeProps("reopened",at,{[columns.status]:"Open"}))),root.needs==="input"&&!root.answer){let answer=clipCommentAnswer(body);Object.assign(rootFields,{answer,answeredAt:at}),Object.assign(rootProps,{[columns.answer]:answer,[columns.answeredAt]:at})}let[inserted]=await Promise.all([insert({body,anchor:thread.anchor,thread:root.recordKey,x:null,y:null,w:null,h:null,change:"replied"}),Object.keys(rootProps).length?updateRoot(root,rootFields,rootProps):Promise.resolve(!0)]);return inserted&&root.status==="Resolved"&&setStatusFilter("open"),!!inserted},answer:(root,answer)=>{let at=new Date().toISOString();updateRoot(root,{answer,answeredAt:at,change:"answered",changedAt:at},changeProps("answered",at,{[columns.answer]:answer,[columns.answeredAt]:at}))},setStatus:(root,status)=>{let at=new Date().toISOString(),change=status==="Resolved"?"resolved":"reopened";updateRoot(root,{status,change,changedAt:at},changeProps(change,at,{[columns.status]:status}))},askDelete:root=>setDeleting(root),notify:text=>notify(text)}),[insert,updateRoot,changeProps,columns,notify]),confirmDelete=useCallback19(async()=>{let root=deleting;if(!root)return;let at=new Date().toISOString();setDeleting(null),setThreadKey(current=>current===root.recordKey?null:current),await updateRoot(root,{status:"Deleted",change:"deleted",changedAt:at},changeProps("deleted",at,{[columns.status]:"Deleted"}))},[deleting,updateRoot,changeProps,columns]),placePin=useCallback19((key,x,y,w2=null,h=null)=>{setCommentingState(!1),setDraftPin({anchorKey:key,x,y,w:x==null||y==null?null:w2,h:x==null||y==null?null:h}),setThreadKey(null),setFilter("anchor"),setStatusFilter("open")},[]),placePinFromEvent=useCallback19((event,key)=>{if(!commenting)return!1;let rect=event.currentTarget.getBoundingClientRect(),x=rect.width?Math.min(1,Math.max(0,(event.clientX-rect.left)/rect.width)):.5,y=rect.height?Math.min(1,Math.max(0,(event.clientY-rect.top)/rect.height)):.5;return placePin(key,x,y),!0},[commenting,placePin]),cancelPin=useCallback19(()=>setDraftPin(null),[]),zones=!!(columns.w&&columns.h),[dragZone,setDragZone]=useState23(null),dragRef=useRef23(null),endDrag=useCallback19(()=>{dragRef.current=null,setDragZone(null)},[]),zoneHandlers=useCallback19(key=>{let zoneOf=(drag,clientX,clientY)=>{let{rect}=drag,clamp2=value=>Math.min(1,Math.max(0,value)),ax=clamp2((drag.x0-rect.left)/(rect.width||1)),ay=clamp2((drag.y0-rect.top)/(rect.height||1)),bx=clamp2((clientX-rect.left)/(rect.width||1)),by=clamp2((clientY-rect.top)/(rect.height||1));return{anchorKey:drag.key,x:Math.min(ax,bx),y:Math.min(ay,by),w:Math.abs(bx-ax),h:Math.abs(by-ay)}};return{onPointerDown:event=>{if(!(!commenting||event.button!==0)){event.preventDefault(),event.stopPropagation();try{event.currentTarget.setPointerCapture(event.pointerId)}catch{}dragRef.current={key,rect:event.currentTarget.getBoundingClientRect(),x0:event.clientX,y0:event.clientY,pointerId:event.pointerId,moved:!1}}},onPointerMove:event=>{let drag=dragRef.current;!drag||drag.pointerId!==event.pointerId||!zones||!drag.moved&&Math.abs(event.clientX-drag.x0)<ZONE_MIN_PX&&Math.abs(event.clientY-drag.y0)<ZONE_MIN_PX||(drag.moved=!0,setDragZone(zoneOf(drag,event.clientX,event.clientY)))},onPointerUp:event=>{let drag=dragRef.current;if(!drag||drag.pointerId!==event.pointerId)return;event.stopPropagation();let{rect}=drag,wide=Math.abs(event.clientX-drag.x0)>=ZONE_MIN_PX&&rect.width>0,high=Math.abs(event.clientY-drag.y0)>=ZONE_MIN_PX&&rect.height>0;if(endDrag(),zones&&drag.moved&&wide&&high){let zone=zoneOf(drag,event.clientX,event.clientY);placePin(drag.key,zone.x,zone.y,zone.w,zone.h);return}let x=rect.width?Math.min(1,Math.max(0,(drag.x0-rect.left)/rect.width)):.5,y=rect.height?Math.min(1,Math.max(0,(drag.y0-rect.top)/rect.height)):.5;placePin(drag.key,x,y)},onPointerCancel:()=>endDrag()}},[commenting,zones,placePin,endDrag]),sendNew=useCallback19(async body=>{let pin=draftPin;if(!pin||!body.trim())return!1;let target=anchors.find(item=>item.recordKey===pin.anchorKey),key=await insert({body:body.trim(),anchor:target,thread:"",x:pin.x,y:pin.y,w:pin.w,h:pin.h,change:"created"});return key?(setDraftPin(null),setThreadKey(key),!0):!1},[draftPin,anchors,insert]),setCommenting=useCallback19(on=>{on?setDraftPin(null):endDrag(),setCommentingState(on)},[endDrag]),toggleCommenting=useCallback19(()=>{setDraftPin(null),endDrag(),setCommentingState(current=>!current)},[endDrag]);useEscapeLayer(`comments.${database}.mode`,()=>(endDrag(),setCommentingState(!1),!0),{priority:ESCAPE_PRIORITY.selection+2,enabled:commenting});let copyChanges=useCallback19(async host=>{if(!changes.length||copying)return!1;setCopying(!0);let at=new Date().toISOString(),count=changes.length,text=commentDigest({scope:scope?{...scope,checkpoint}:null,comments:inScope,anchors,changes,nowIso:at},{me,columns:options.columns,...latest.current.digest??{}});if(!await writeCommentClipboard(text,host))return notify(words.copyFailed,{tone:"danger"}),setCopying(!1),!1;notify(commentCopiedWords(words,count));let previous=marker;setMarker(at);try{await latest.current.onCheckpoint?.(at)}catch(error){setMarker(previous),fail(error)}finally{setCopying(!1)}return!0},[changes,copying,scope,checkpoint,inScope,anchors,me,options.columns,notify,words,marker,fail]);return{comments:inScope,threads,visibleThreads,changes,checkpoint,isNew,threadsOn,numberOf:numberOf3,scope,anchors,anchorKey,anchor,filter:effectiveFilter,setFilter,statusFilter,setStatusFilter,threadKey,setThreadKey,selectThread,actions,commenting,setCommenting,toggleCommenting,draftPin,placePin,placePinFromEvent,cancelPin,sendNew,zones,dragZone,zoneHandlers,deleting,cancelDelete:()=>setDeleting(null),confirmDelete,copyChanges,copying,busy,now,toaster,words,say,locale,me,loading:query.loading&&!query.hasData,hasData:query.hasData,error:query.error??null,refetch}}import{useEffect as useEffect25,useRef as useRef24,useState as useState24}from"react";import{Fragment as Fragment13,jsx as jsx28,jsxs as jsxs24}from"react/jsx-runtime";function CommentAvatar({author,me,className}){return jsx28("span",{"aria-hidden":"true",className:cx("nui-comment-avatar",className),"data-me":author===me?"":void 0,children:(author.trim().slice(0,1)||"?").toUpperCase()})}function IconAction({label,icon,onClick,disabled}){return jsx28(Tooltip,{label,children:jsx28(Button,{variant:"ghost",size:"sm",className:"nui-comment-icon-btn","aria-label":label,disabled,onClick,icon:jsx28(Icon,{name:icon})})})}function answerLabel(controller,answer){return answer===COMMENT_CHECK_ANSWERS[0]?controller.say("looksGood"):answer===COMMENT_CHECK_ANSWERS[1]?controller.say("undo"):answer}function stop(event){event.stopPropagation()}function sendsOnEnter(event){return event.key==="Enter"&&!event.shiftKey&&!event.nativeEvent.isComposing}function CommentThreadCard({controller,thread,showAnchor=!1}){let{root,replies,anchor}=thread,{actions,locale,now,isNew,me}=controller,[draft,setDraft]=useState24(""),[sending,setSending]=useState24(!1),replyRef=useRef24(null),fileRef=useRef24(null),cardRef=useRef24(null),resolved=root.status==="Resolved",selected=controller.threadKey===root.recordKey,busy=controller.busy.has(root.recordKey),number=controller.numberOf(thread);useEffect25(()=>{selected&&cardRef.current&&scrollCommentIntoView(cardRef.current)},[selected]);let send=async()=>{let body=draft.trim();if(!body||sending)return;setSending(!0);let ok=await actions.reply(thread,body);setSending(!1),ok&&setDraft("")},attach=async file=>{if(!file)return;if(!(file.type.startsWith("text/")||COMMENT_TEXT_FILE.test(file.name))){actions.notify(controller.words.textOnly);return}let content=(await file.text()).slice(0,8e3);setDraft(current=>`${current?`${current}
|
|
15
15
|
|
|
16
16
|
`:""}${file.name}
|
|
17
|
-
${content}`),replyRef.current?.focus()},select=()=>controller.selectThread(thread),onCardKey=event=>{event.target===event.currentTarget&&(event.key==="Enter"||event.key===" ")&&(event.preventDefault(),select())},needsLabel=root.needs==="check"?controller.say("needCheck"):root.needs==="choice"?controller.say("needChoice"):controller.say("needInput"),choices=root.needs==="check"?[...COMMENT_CHECK_ANSWERS]:root.options,meta=[commentRelativeTime(root.createdAt,locale,now),showAnchor&&anchor?controller.say("anchorLabel",{n:anchor.order}):"",number>0&&root.x!=null?`#${number}`:""].filter(Boolean).join(" \xB7 "),replyLabel=resolved?controller.say("replyToReopen"):controller.say("reply"),newDot=comment=>isNew(comment)?jsx28("span",{className:"nui-comment-new",role:"img","aria-label":controller.say("newActivity")}):null;return jsxs24("article",{ref:cardRef,className:"nui-comment-card","data-thread":root.recordKey,"data-selected":selected?"":void 0,"data-resolved":resolved?"":void 0,"aria-current":selected?"true":void 0,"aria-label":controller.say("pin",{who:root.author,body:root.body}),tabIndex:0,onClick:select,onKeyDown:onCardKey,children:[jsxs24("header",{className:"nui-comment-head",children:[jsx28(CommentAvatar,{author:root.author,me}),jsxs24("div",{className:"nui-comment-who",children:[jsx28("span",{className:"nui-comment-author",children:root.author}),jsx28("span",{className:"nui-comment-meta",children:meta}),newDot(root)]}),jsxs24("div",{className:"nui-comment-actions",onClick:stop,onKeyDown:stop,children:[resolved?jsx28(IconAction,{label:controller.say("reopen"),icon:"arrow-counter-clockwise",disabled:busy,onClick:()=>actions.setStatus(root,"Open")}):jsx28(IconAction,{label:controller.say("resolve"),icon:"check",disabled:busy,onClick:()=>actions.setStatus(root,"Resolved")}),jsx28(IconAction,{label:controller.say("delete"),icon:"trash",disabled:busy,onClick:()=>actions.askDelete(root)})]})]}),root.example||resolved?jsxs24("div",{className:"nui-comment-badges",children:[root.example?jsx28(Badge,{children:controller.words.example}):null,resolved?jsx28(Badge,{children:controller.words.resolved}):null]}):null,jsx28("p",{className:"nui-comment-body",children:root.body}),root.needs!=="none"?jsxs24("div",{className:"nui-comment-ask",onClick:stop,onKeyDown:stop,children:[jsxs24("p",{className:"nui-comment-ask-label",children:[jsx28("span",{className:"nui-comment-ask-who",children:controller.say("needs",{who:root.author})})," ",needsLabel]}),root.answer?jsxs24("p",{className:"nui-comment-answer",children:[jsx28(Icon,{name:"check"}),jsx28("span",{children:controller.say("sent",{answer:answerLabel(controller,root.answer)})})]}):root.needs==="input"?jsxs24("div",{className:"nui-comment-choices",children:[jsx28(Button,{size:"sm",variant:"secondary",disabled:busy,icon:"paperclip",onClick:()=>fileRef.current?.click(),children:controller.words.attach}),jsx28(Button,{size:"sm",variant:"secondary",disabled:busy,icon:"clipboard-text",onClick:()=>replyRef.current?.focus(),children:controller.words.paste}),jsx28("input",{ref:fileRef,type:"file",className:"nui-sr-only",tabIndex:-1,"aria-hidden":"true",accept:"text/*,.md,.txt,.csv,.json",onChange:event=>{attach(event.target.files?.[0]),event.target.value=""}})]}):jsx28("div",{className:"nui-comment-choices",role:"group","aria-label":needsLabel,children:choices.map(choice=>jsx28(Button,{size:"sm",variant:"secondary",disabled:busy,onClick:()=>actions.answer(root,choice),children:answerLabel(controller,choice)},choice))})]}):null,replies.length?jsx28("ol",{className:"nui-comment-replies",children:replies.map(reply=>jsxs24("li",{className:"nui-comment-reply",children:[jsx28(CommentAvatar,{author:reply.author,me}),jsxs24("div",{className:"nui-comment-reply-text",children:[jsxs24("div",{className:"nui-comment-who",children:[jsx28("span",{className:"nui-comment-author",children:reply.author}),jsx28("span",{className:"nui-comment-meta",children:commentRelativeTime(reply.createdAt,locale,now)}),newDot(reply)]}),jsx28("p",{className:"nui-comment-body",children:reply.body})]})]},reply.recordKey))}):null,jsxs24("div",{className:"nui-comment-compose",onClick:stop,onKeyDown:stop,children:[jsx28("textarea",{ref:replyRef,className:"nui-comment-input",value:draft,rows:1,placeholder:replyLabel,"aria-label":replyLabel,onChange:event=>setDraft(event.target.value),onKeyDown:event=>{sendsOnEnter(event)&&(event.preventDefault(),send())}}),jsx28(IconAction,{label:controller.say("send"),icon:"paper-plane-right",disabled:!draft.trim()||sending,onClick:()=>{send()}})]})]})}function NewCommentBox({controller}){let pin=controller.draftPin,[body,setBody]=useState24(""),[sending,setSending]=useState24(!1),ref=useRef24(null),cancel=controller.cancelPin,where=pin?.anchorKey??null;if(useEffect25(()=>{ref.current?.focus({preventScroll:!0})},[where]),useEscapeLayer("comments.new",()=>(cancel(),!0),{priority:ESCAPE_PRIORITY.selection+1,enabled:pin!=null}),!pin)return null;let anchor=controller.anchors.find(item=>item.recordKey===pin.anchorKey),heading=anchor&&pin.x==null?controller.say("newCommentWhole",{n:anchor.order}):anchor?controller.say("newCommentOn",{n:anchor.order}):controller.say("newComment"),send=async()=>{if(!body.trim()||sending)return;setSending(!0);let ok=await controller.sendNew(body.trim());setSending(!1),ok&&setBody("")};return jsxs24("div",{className:"nui-comment-new-box",role:"group","aria-label":heading,children:[jsx28("p",{className:"nui-comment-new-title",children:heading}),jsx28("textarea",{ref,className:"nui-comment-input",value:body,rows:2,placeholder:controller.say("commentPlaceholder"),"aria-label":controller.say("commentPlaceholder"),onChange:event=>setBody(event.target.value),onKeyDown:event=>{sendsOnEnter(event)&&(event.preventDefault(),send()),event.key==="Escape"&&!event.nativeEvent.isComposing&&(event.preventDefault(),body.trim()?event.currentTarget.blur():cancel())}}),jsxs24("div",{className:"nui-comment-new-actions",children:[jsx28(Button,{size:"sm",variant:"ghost",onClick:cancel,children:controller.words.cancel}),jsx28(Button,{size:"sm",variant:"primary",disabled:!body.trim()||sending,icon:"paper-plane-right",onClick:()=>{send()},children:controller.words.send})]})]})}function CommentPins({controller,anchorKey,onOpen}){let key=anchorKey===void 0?controller.anchorKey:anchorKey,pins=controller.threadsOn(key).filter(thread=>thread.root.x!=null&&thread.root.y!=null),draft=controller.draftPin,drag=controller.dragZone,here=key??null,open=(event,thread)=>{event.stopPropagation(),onOpen?onOpen(thread):controller.selectThread(thread)},box=zone=>({left:`${zone.x*100}%`,top:`${zone.y*100}%`,width:`${zone.w*100}%`,height:`${zone.h*100}%`});return jsxs24(Fragment13,{children:[controller.commenting?jsx28("div",{className:"nui-comment-capture","aria-hidden":"true",...controller.zoneHandlers(here),onClick:event=>event.stopPropagation()}):null,pins.filter(thread=>isCommentZone(thread.root)).map(thread=>jsx28("span",{className:"nui-comment-zone","aria-hidden":"true","data-selected":thread.root.recordKey===controller.threadKey?"":void 0,"data-resolved":thread.root.status==="Resolved"?"":void 0,style:box({x:thread.root.x,y:thread.root.y,w:thread.root.w,h:thread.root.h})},`zone-${thread.root.recordKey}`)),pins.map(thread=>jsx28("button",{type:"button",className:"nui-comment-pin","data-agent":thread.root.author!==controller.me?"":void 0,"data-selected":thread.root.recordKey===controller.threadKey?"":void 0,"data-resolved":thread.root.status==="Resolved"?"":void 0,style:{left:`${thread.root.x*100}%`,top:`${thread.root.y*100}%`},"aria-label":controller.say(isCommentZone(thread.root)?"zone":"pin",{who:thread.root.author,body:thread.root.body}),onClick:event=>open(event,thread),children:controller.numberOf(thread)},thread.root.recordKey)),drag&&drag.anchorKey===here?jsx28("span",{className:"nui-comment-zone","data-draft":"","data-selected":"","aria-hidden":"true",style:box(drag)}):null,draft&&draft.anchorKey===here&&draft.x!=null&&draft.y!=null?jsxs24(Fragment13,{children:[isCommentZone(draft)?jsx28("span",{className:"nui-comment-zone","data-draft":"","data-selected":"","aria-hidden":"true",style:box({x:draft.x,y:draft.y,w:draft.w,h:draft.h})}):null,jsx28("span",{className:"nui-comment-pin","data-draft":"","data-selected":"","aria-hidden":"true",style:{left:`${draft.x*100}%`,top:`${draft.y*100}%`},children:"+"})]}):null]})}function CommentPane({controller,title,showCopy=!0,className}){let rootRef=useRef24(null),heading=title??controller.say("comments"),{threads,visibleThreads,changes,draftPin,filter,statusFilter,anchors,anchorKey}=controller,scoped=filter==="anchor"?controller.threadsOn(anchorKey):threads,openCount=scoped.filter(thread=>thread.root.status==="Open").length,resolvedCount=scoped.filter(thread=>thread.root.status==="Resolved").length,emptyTitle=statusFilter==="resolved"?controller.say("emptyResolved"):filter==="anchor"?controller.say("emptyAnchor"):controller.say("emptyAll");return jsxs24("aside",{ref:rootRef,className:cx("nui-comment-pane",className),"aria-label":heading,children:[jsxs24("div",{className:"nui-comment-pane-head",children:[jsx28("h2",{className:"nui-comment-pane-title",children:heading}),anchors.length?jsx28(SegmentedControl,{label:controller.words.scope,value:filter,onChange:value=>controller.setFilter(value),options:[{value:"anchor",label:controller.words.thisAnchor,count:controller.threadsOn(anchorKey).length},{value:"all",label:controller.words.all,count:threads.length}]}):null]}),jsx28(SegmentedControl,{label:controller.words.status,value:statusFilter,onChange:value=>controller.setStatusFilter(value),options:[{value:"open",label:controller.words.open,count:openCount},{value:"resolved",label:controller.words.resolvedFilter,count:resolvedCount}]}),showCopy?jsxs24(Button,{variant:"secondary",className:"nui-comment-copy",icon:"copy",disabled:!changes.length||controller.copying,onClick:()=>{controller.copyChanges(rootRef.current)},children:[jsx28("span",{className:"nui-comment-copy-label",children:controller.say("copy")}),jsx28("span",{className:"nui-comment-count",children:changes.length})]}):null,draftPin?jsx28(NewCommentBox,{controller}):anchors.length&&controller.anchor?jsxs24("div",{className:"nui-comment-start",children:[jsx28(Button,{variant:"secondary",icon:"chat-circle-text",onClick:()=>controller.placePin(anchorKey,null,null),children:controller.say("commentOnAnchor",{n:controller.anchor.order})}),controller.commenting?jsx28("p",{className:"nui-comment-hint",children:controller.say(controller.zones?"zoneHint":"pinHint")}):null]}):null,visibleThreads.length?jsx28("div",{className:"nui-comment-list",children:visibleThreads.map(thread=>jsx28(CommentThreadCard,{controller,thread,showAnchor:filter==="all"},thread.root.recordKey))}):!draftPin&&!controller.loading?jsx28(EmptyState,{className:"nui-comment-empty",icon:"chat-circle-text",title:emptyTitle}):null,jsx28(Dialog,{open:controller.deleting!=null,onClose:controller.cancelDelete,title:controller.say("deleteTitle"),description:controller.say("deleteBody"),role:"alertdialog",children:jsxs24("div",{className:"nui-comment-dialog-actions",children:[jsx28(Button,{variant:"ghost","data-dialog-cancel":"",onClick:controller.cancelDelete,children:controller.words.cancel}),jsx28(Button,{variant:"danger","data-dialog-confirm":"",onClick:()=>{controller.confirmDelete()},children:controller.words.delete})]})}),jsx28(ActionToast,{toast:controller.toaster.toast,onUndo:()=>{controller.toaster.undo()},onDismiss:controller.toaster.dismiss})]})}var PRESENT_WORDS=Object.freeze({audienceTitle:{en:"Presentation",fr:"Pr\xE9sentation"},fillScreen:{en:"Click to fill this screen",fr:"Clique pour remplir cet \xE9cran"},dragToScreen:{en:"Drag this window to the other screen, then click to fill it",fr:"Fais glisser cette fen\xEAtre sur l\u2019autre \xE9cran, puis clique pour la remplir"},pressAgain:{en:"Press Present again to show it on the other screen",fr:"Appuie de nouveau sur Pr\xE9senter pour l\u2019afficher sur l\u2019autre \xE9cran"},blocked:{en:"The presentation window was blocked. Allow pop-ups for Notis, then press Present again.",fr:"La fen\xEAtre de pr\xE9sentation a \xE9t\xE9 bloqu\xE9e. Autorise les fen\xEAtres pop-up pour Notis, puis appuie de nouveau sur Pr\xE9senter."},onOtherScreen:{en:"Showing on the other screen",fr:"Affich\xE9 sur l\u2019autre \xE9cran"}});var AUDIENCE_WINDOW_NAME="notis-presenter-audience";function hasSecondScreen(win){return win?.screen?.isExtended===!0}function sameArea(a,b){return a.availLeft===b.availLeft&&a.availTop===b.availTop&&a.availWidth===b.availWidth&&a.availHeight===b.availHeight}function pickAudienceScreen(screens,current){let others=screens.filter(screen=>!(current&&(screen===current||sameArea(screen,current))));return others.length===0?null:[...others].sort((a,b)=>{let external=+(a.isInternal===!0)-+(b.isInternal===!0);return external!==0?external:b.availWidth*b.availHeight-a.availWidth*a.availHeight})[0]}function audienceFeatures(screen){if(!screen)return"popup,width=960,height=540";let{availLeft:left,availTop:top,availWidth:width,availHeight:height}=screen;return`popup,left=${Math.round(left)},top=${Math.round(top)},width=${Math.round(width)},height=${Math.round(height)}`}var KEY_ACTIONS=Object.freeze({ArrowRight:"next",ArrowDown:"next",PageDown:"next"," ":"next",Enter:"next",ArrowLeft:"previous",ArrowUp:"previous",PageUp:"previous",Home:"first",End:"last",Escape:"stop"}),FIELD='input,textarea,select,[contenteditable=""],[contenteditable="true"]',ACTIVE="a[href],button,label,summary,details,video,audio,[role=button],[role=link],[role=tab],[onclick],[tabindex]";function inside(target,selector){let element=target;return!!(element&&typeof element.closest=="function"&&element.closest(selector))}function keyAction(event){let action=KEY_ACTIONS[event.key];return!action||event.defaultPrevented||event.altKey||event.ctrlKey||event.metaKey||inside(event.target,FIELD)||(event.key===" "||event.key==="Enter")&&inside(event.target,ACTIVE)?null:action}function clickHasOwnTarget(target){return inside(target,FIELD)||inside(target,ACTIVE)}function fillsScreen(win){if(win.document.fullscreenElement)return!0;let{width,height}=win.screen;return width>0&&height>0&&win.innerWidth>=width-1&&win.innerHeight>=height-1}function sheetText2(sheet){try{return Array.from(sheet.cssRules,rule=>rule.cssText).join(`
|
|
18
|
-
`)}catch{return""}}function copyNodes(target,source){for(let node of Array.from(source.querySelectorAll('link[rel~="stylesheet"],style')))if(node.localName==="link"){let link=target.createElement("link");link.rel="stylesheet",link.href=node.href;let media=node.getAttribute("media");media&&(link.media=media),target.head.append(link)}else{let style=target.createElement("style");style.textContent=node.textContent,target.head.append(style)}}function copyAdopted(target,sheets){for(let sheet of sheets??[]){let text=sheetText2(sheet);if(!text)continue;let style=target.createElement("style");style.textContent=text,target.head.append(style)}}function copyStylesInto(target,source,shadowRoot){copyNodes(target,source),copyAdopted(target,source.adoptedStyleSheets),shadowRoot&&(copyNodes(target,shadowRoot),copyAdopted(target,shadowRoot.adoptedStyleSheets));let from=source.documentElement,to=target.documentElement;from.className&&(to.className=from.className);let style=from.getAttribute("style");style?to.setAttribute("style",style):to.removeAttribute("style")}import{useCallback as useCallback20,useEffect as useEffect26,useRef as useRef25,useState as useState25}from"react";import{createPortal as createPortal6}from"react-dom";import{jsx as jsx29,jsxs as jsxs25}from"react/jsx-runtime";async function windowManagementState(win){if(typeof win.getScreenDetails!="function")return"unsupported";try{return(await win.navigator.permissions.query({name:"window-management"})).state}catch{return"prompt"}}async function screenDetails(win){try{return await win.getScreenDetails()}catch{return null}}var AUDIENCE_BASE_CSS=["html,body{height:100%;margin:0;overflow:hidden;background:hsl(0 0% 0%)}","[data-notis-audience-root]{position:fixed;inset:0;display:flex;flex-direction:column}"].join("");function setUpWindow(win,anchor,title,locale){let doc=win.document,root=anchor?.getRootNode(),shadow=typeof ShadowRoot<"u"&&root instanceof ShadowRoot?root:null;doc.head.replaceChildren();let charset=doc.createElement("meta");charset.setAttribute("charset","utf-8"),doc.head.append(charset),doc.title=title,doc.documentElement.lang=locale,copyStylesInto(doc,document,shadow);let base=doc.createElement("style");base.textContent=AUDIENCE_BASE_CSS,doc.head.append(base);let appRoot=anchor?.closest("[data-notis-app-root]")??null,container=doc.createElement("div");container.setAttribute("data-notis-app-root",""),container.setAttribute("data-notis-audience-root","");let theme=appRoot?.getAttribute("data-notis-theme");theme&&container.setAttribute("data-notis-theme",theme);let style=appRoot?.getAttribute("style");style&&container.setAttribute("style",style);let layer=doc.createElement("div");return layer.setAttribute(LAYER_ROOT_ATTRIBUTE,""),doc.body.replaceChildren(container,layer),{win,container,layer,placed:!1}}function AudienceView({audience,children}){let t=useT(),{win}=audience,[filled,setFilled]=useState25(()=>fillsScreen(win));useEffect26(()=>{let update=()=>setFilled(fillsScreen(win));return update(),win.addEventListener("resize",update),win.document.addEventListener("fullscreenchange",update),()=>{win.removeEventListener("resize",update),win.document.removeEventListener("fullscreenchange",update)}},[win]);let fill=useCallback20(event=>{event.preventDefault(),event.stopPropagation(),win.document.documentElement.requestFullscreen?.({navigationUI:"hide"})?.catch(()=>{})},[win]);return jsxs25(LayerRootProvider,{root:audience.layer,children:[children,filled?null:jsx29("button",{type:"button","data-notis-audience-fill":"",onClick:fill,className:"fixed inset-0 z-[1000] flex cursor-pointer items-end justify-center bg-transparent p-8",children:jsx29("span",{className:"rounded-full bg-popover px-4 py-2 text-sm text-popover-foreground shadow-lg ring-1 ring-border",children:t(audience.placed?PRESENT_WORDS.fillScreen:PRESENT_WORDS.dragToScreen)})})]})}function useAudienceScreen(options){let t=useT(),locale=useToolkitLocale(),optionsRef=useRef25(options);optionsRef.current=options;let[secondScreen,setSecondScreen]=useState25(()=>typeof window>"u"?!1:hasSecondScreen(window)),[audience,setAudience]=useState25(null),audienceRef=useRef25(null),teardownRef=useRef25(null);useEffect26(()=>{if(typeof window>"u")return;let screen=window.screen,update=()=>setSecondScreen(hasSecondScreen(window));if(update(),typeof screen.addEventListener=="function")return screen.addEventListener("change",update),()=>screen.removeEventListener?.("change",update)},[]);let finish=useCallback20(closeWindow=>{let current=audienceRef.current;current&&(audienceRef.current=null,teardownRef.current?.(),teardownRef.current=null,closeWindow&&!current.win.closed&¤t.win.close(),setAudience(null),optionsRef.current.onClose?.())},[]),close=useCallback20(()=>finish(!0),[finish]),open=useCallback20(async anchor=>{let current=audienceRef.current;if(current&&!current.win.closed)return current.win.focus(),"opened";if(typeof window>"u"||!hasSecondScreen(window))return"one-screen";let state=await windowManagementState(window),target=null;if(state==="granted"||state==="prompt"){let details=await screenDetails(window);details&&(target=pickAudienceScreen(details.screens,details.currentScreen))}let win=window.open("",AUDIENCE_WINDOW_NAME,audienceFeatures(target));if(!win)return state==="prompt"?"press-again":"blocked";let next=setUpWindow(win,anchor??null,t(optionsRef.current.title??PRESENT_WORDS.audienceTitle),locale);next.placed=target!==null;let onKey=event=>{let action=keyAction(event);action&&(event.preventDefault(),optionsRef.current.onAction(action))},onClick=event=>{event.defaultPrevented||event.button!==0||clickHasOwnTarget(event.target)||optionsRef.current.onAction("next")},onContextMenu=event=>{event.defaultPrevented||clickHasOwnTarget(event.target)||(event.preventDefault(),optionsRef.current.onAction("previous"))},onGone=()=>finish(!1),onLeave=()=>finish(!0);win.addEventListener("keydown",onKey),win.addEventListener("click",onClick),win.addEventListener("contextmenu",onContextMenu),win.addEventListener("pagehide",onGone),window.addEventListener("pagehide",onLeave);let poll=window.setInterval(()=>{win.closed&&finish(!1)},500);return teardownRef.current?.(),teardownRef.current=()=>{window.clearInterval(poll),window.removeEventListener("pagehide",onLeave),win.removeEventListener("keydown",onKey),win.removeEventListener("click",onClick),win.removeEventListener("contextmenu",onContextMenu),win.removeEventListener("pagehide",onGone)},audienceRef.current=next,setAudience(next),win.focus(),"opened"},[finish,locale,t]);useEffect26(()=>()=>finish(!0),[finish]);let portal=useCallback20(node=>audience?createPortal6(jsx29(AudienceView,{audience,children:node}),audience.container):null,[audience]);return{secondScreen,isOpen:audience!==null,open,close,portal}}export{ACTION_TOAST_MS,ACTION_WORDS,AUDIENCE_WINDOW_NAME,ActionToast,Area2 as Area,AreaChart,AttachmentGallery,BLOCK_WORDS,BOARD_WORDS,Badge,Bar2 as Bar,BarChart,BoardView,Button,CALENDAR_NARROW_MAX,CALENDAR_TRAY_SIDE_MIN,CALENDAR_VIEWS,CALENDAR_WORDS,CHART_WORDS,CHAT_NARROWED_ATTRIBUTE,CHAT_PANEL_DEFAULT_WIDTH_PX,CHAT_PANEL_DESKTOP_MEDIA_QUERY,CHAT_PANEL_KEYBOARD_STEP_PX,CHAT_PANEL_MIN_CONTENT_WIDTH_PX,CHAT_PANEL_MIN_WIDTH_PX,CHAT_PANEL_OVERLAP_PROPERTY,CHAT_PANEL_PAGE_HOVER_DELAY_MS,CHAT_PANEL_PAGE_PEEK_PX,CHAT_PANEL_WIDTH_PROPERTY,CHAT_PANEL_WIDTH_STORAGE_KEY,COMMENT_CHECK_ANSWERS,COMMENT_COLUMNS,COMMENT_TEXT_FILE,COMMENT_WORDS,COMPARES,COMPARE_WORDS,CalendarView,CartesianGrid2 as CartesianGrid,Cell2 as Cell,Chart,ChartContainer,ChartLegend,ChartStyle,ChartTable,ChartTooltip,ChartTooltipContent,CommentAvatar,CommentPane,CommentPins,CommentThreadCard,ComposedChart2 as ComposedChart,DEFAULT_COMPARE,DEFAULT_PRESET,DayPicker,EMPTY_SELECTION,ESCAPE_PRIORITY,EditableFields,EmptyState,FIELDS_ESCAPE_PRIORITY,FIELDS_SAVE_KEYS,FIELD_WORDS,FieldDisclosure,FieldList,FieldLongText,FieldMultiSelect,FieldRow,FieldSelect,FieldText,GALLERY_WORDS,HelpSheet,IDLE_ROW_STATE,IMAGE_VIEWER_ZOOM_LEVELS,Icon,ImageViewer,KeyboardEngine,KeyboardEngineCore,Keycap,KeycapSurface,LAYER_ROOT_ATTRIBUTE,LIST_DRAG_TYPE,LIST_READER_WORDS,LabelList,LayerRootProvider,Legend,Line2 as Line,LineChart,ListReader,ListSkeleton,MANAGER_PHONE_LAYOUT_BELOW_PX,Menu,MenuItem,MenuSeparator,MenuSub,Metric,NativeSelect,NewCommentBox,Notice,NotisKeyClash,OPEN_MODES,OPEN_MODE_CACHE_PREFIX,OPEN_MODE_ICONS,OPEN_MODE_WORDS,OpenAsMenu,OpenModeStoreProvider,PAGE_VIEWPORT_ATTRIBUTE,PANELS_HOVER_DELAY_MS,PANELS_KEYBOARD_STEP_PX,PANELS_LIST_MIN_PX,PANELS_READER_MIN_PX,PANELS_READER_PEEK_PX,PANELS_READER_WANT_PX,PANELS_READER_WANT_WIDE_PX,PANELS_READER_WIDE_FROM_PX,PERIOD_PICKER_TWO_MONTHS_MIN,PERIOD_WORDS,PRESENT_WORDS,PRESETS,PRESET_WORDS,Pagination,Panels,PeriodPicker,Pie,PieChart,Popover,REORDER_DRAG_TYPE,REORDER_WORDS,ROOT_OWNER,ROW_ID_ATTRIBUTE,ROW_INTERACTIVE_SELECTOR,ROW_TIME_WORDS,ReferenceDot,ReferenceLine,RenderChartData,ResponsiveContainer2 as ResponsiveContainer,Row,RowIdContext,RowMore,RowStateContext,SELECTION_BAR_BOOST,SELECTION_BAR_MAX_INLINE,SEQUENCE_TIMEOUT_MS,STAR_WORDS,STATUS_WORDS,Scatter,Section,SegmentedControl,SelectionBar,ShortcutRegistry,ShortcutScope,Sparkline,StarMark,StatRow,StatusIcon,Switch,TABROW_WORDS,TABS_WORDS,TIMELINE_WORDS,TIMELINE_ZOOMS,TabRow,Tabs,TimelineView,ToggleGroup,Tooltip,VS_WORDS,XAxis2 as XAxis,YAxis2 as YAxis,adoptToolkitStyles,applyCommentPatches,audienceFeatures,availableActions,barLabel,barShape,binUnit,dropIndex as boardDropIndex,boardOrder,boardStep,buildBins,chainReorderProps,changedFieldKeys,chatPanelMaxWidth,chatPanelOverlap,chatPanelPageWidth,chatPanelPushLimit,chooseFit,clampChatPanelWidth,clampReaderWidth,clickHasOwnTarget,clipCommentAnswer,commentAnchorOf,commentChangesSince,commentColumns,commentCopiedWords,commentDigest,commentRelativeTime,commentRowsOf,commentThreads,commentTimeOf,commentWords,compareRange,copyStylesInto,createChatPanelEdge,customPeriod,dayCount,dayNumberLabel,detectLocale,detectPlatform,dropIndex2 as dropIndex,failedItemsWords,fillsScreen,findLayerRoot,findRow,formatDateRange,formatDayHeading,formatDelta,formatLongDay,formatMonthYear,formatNumber,formatPeriodParam,formatReaderAgo,formatRowAgo,formatRowTime,formatShortDay,formatValue,fromIsoDay,galleryItemKind,galleryItemName,getOpenModeStore,getSharedInstance,getToolkitStyleSheet,getToolkitStyleText,gridColumns,hasIcon,hasSecondScreen,inCommentScope,intlLocale,isCommentZone,isCompareId,isOpenMode,isPresetId,keyAction,layoutTimeline,localStorageOpenModeStore,metricView,neighbourColumn,newCommentId,normalizeAllowed,normalizePeriod,overlap,pageViewport,panelMath_exports as panelMath,parsePeriodParam,parseRowDate,parseStoredChatPanelWidth,parseStoredWidth,periodRanges,periodSeries,pickAudienceScreen,place,presetRange,pushLimit,rangeBetween,rankActions,readCommentRow,readOpenModeCache,readerMaxWidth,readerWantWidth,registerToolkitStyles,renderIcon,resolveActions,samePeriod,scrollCommentIntoView,selectionReducer,seriesColor,setOpenModeStore,sparkPaths,splitBreakpoint,splitFits,statusGroup,stepCursor,stepTab,successorOf,tabIds,tabPanelProps,timelineWindow,toIsoDay,toggleFieldValue,total,useActions,useAudienceScreen,useChart,useComments,useEngineCore,useEscapeBlocker,useEscapeLayer,useFieldDraft,useHelpSheet,useKeyLabel,useLayerRoot,useListKeys,useMenu,useOpenMode,useOpenModeKey,useOpenModeStore,usePanels,usePeriod,useRegistryVersion,useReorder,useRowState,useSelection,useSelectionBar,useShortcut,useShortcutOwner,useShortcutScope,useShortcuts,useToast,useToolkitLocale,useToolkitPlatform,useToolkitSettings,userSettingsOpenModeStore,weekdayNames,writeCommentClipboard,writeOpenModeCache};
|
|
17
|
+
${content}`),replyRef.current?.focus()},select=()=>controller.selectThread(thread),onCardKey=event=>{event.target===event.currentTarget&&(event.key==="Enter"||event.key===" ")&&(event.preventDefault(),select())},needsLabel=root.needs==="check"?controller.say("needCheck"):root.needs==="choice"?controller.say("needChoice"):controller.say("needInput"),choices=root.needs==="check"?[...COMMENT_CHECK_ANSWERS]:root.options,meta=[commentRelativeTime(root.createdAt,locale,now),showAnchor&&anchor?controller.say("anchorLabel",{n:anchor.order}):"",number>0&&root.x!=null?`#${number}`:""].filter(Boolean).join(" \xB7 "),replyLabel=resolved?controller.say("replyToReopen"):controller.say("reply"),newDot=comment=>isNew(comment)?jsx28("span",{className:"nui-comment-new",role:"img","aria-label":controller.say("newActivity")}):null;return jsxs24("article",{ref:cardRef,className:"nui-comment-card","data-thread":root.recordKey,"data-selected":selected?"":void 0,"data-resolved":resolved?"":void 0,"aria-current":selected?"true":void 0,"aria-label":controller.say("pin",{who:root.author,body:root.body}),tabIndex:0,onClick:select,onKeyDown:onCardKey,children:[jsxs24("header",{className:"nui-comment-head",children:[jsx28(CommentAvatar,{author:root.author,me}),jsxs24("div",{className:"nui-comment-who",children:[jsx28("span",{className:"nui-comment-author",children:root.author}),jsx28("span",{className:"nui-comment-meta",children:meta}),newDot(root)]}),jsxs24("div",{className:"nui-comment-actions",onClick:stop,onKeyDown:stop,children:[resolved?jsx28(IconAction,{label:controller.say("reopen"),icon:"arrow-counter-clockwise",disabled:busy,onClick:()=>actions.setStatus(root,"Open")}):jsx28(IconAction,{label:controller.say("resolve"),icon:"check",disabled:busy,onClick:()=>actions.setStatus(root,"Resolved")}),jsx28(IconAction,{label:controller.say("delete"),icon:"trash",disabled:busy,onClick:()=>actions.askDelete(root)})]})]}),root.example||resolved?jsxs24("div",{className:"nui-comment-badges",children:[root.example?jsx28(Badge,{children:controller.words.example}):null,resolved?jsx28(Badge,{children:controller.words.resolved}):null]}):null,jsx28("p",{className:"nui-comment-body",children:root.body}),root.needs!=="none"?jsxs24("div",{className:"nui-comment-ask",onClick:stop,onKeyDown:stop,children:[jsxs24("p",{className:"nui-comment-ask-label",children:[jsx28("span",{className:"nui-comment-ask-who",children:controller.say("needs",{who:root.author})})," ",needsLabel]}),root.answer?jsxs24("p",{className:"nui-comment-answer",children:[jsx28(Icon,{name:"check"}),jsx28("span",{children:controller.say("sent",{answer:answerLabel(controller,root.answer)})})]}):root.needs==="input"?jsxs24("div",{className:"nui-comment-choices",children:[jsx28(Button,{size:"sm",variant:"secondary",disabled:busy,icon:"paperclip",onClick:()=>fileRef.current?.click(),children:controller.words.attach}),jsx28(Button,{size:"sm",variant:"secondary",disabled:busy,icon:"clipboard-text",onClick:()=>replyRef.current?.focus(),children:controller.words.paste}),jsx28("input",{ref:fileRef,type:"file",className:"nui-sr-only",tabIndex:-1,"aria-hidden":"true",accept:"text/*,.md,.txt,.csv,.json",onChange:event=>{attach(event.target.files?.[0]),event.target.value=""}})]}):jsx28("div",{className:"nui-comment-choices",role:"group","aria-label":needsLabel,children:choices.map(choice=>jsx28(Button,{size:"sm",variant:"secondary",disabled:busy,onClick:()=>actions.answer(root,choice),children:answerLabel(controller,choice)},choice))})]}):null,replies.length?jsx28("ol",{className:"nui-comment-replies",children:replies.map(reply=>jsxs24("li",{className:"nui-comment-reply",children:[jsx28(CommentAvatar,{author:reply.author,me}),jsxs24("div",{className:"nui-comment-reply-text",children:[jsxs24("div",{className:"nui-comment-who",children:[jsx28("span",{className:"nui-comment-author",children:reply.author}),jsx28("span",{className:"nui-comment-meta",children:commentRelativeTime(reply.createdAt,locale,now)}),newDot(reply)]}),jsx28("p",{className:"nui-comment-body",children:reply.body})]})]},reply.recordKey))}):null,jsxs24("div",{className:"nui-comment-compose",onClick:stop,onKeyDown:stop,children:[jsx28("textarea",{ref:replyRef,className:"nui-comment-input",value:draft,rows:1,placeholder:replyLabel,"aria-label":replyLabel,onChange:event=>setDraft(event.target.value),onKeyDown:event=>{sendsOnEnter(event)&&(event.preventDefault(),send())}}),jsx28(IconAction,{label:controller.say("send"),icon:"paper-plane-right",disabled:!draft.trim()||sending,onClick:()=>{send()}})]})]})}function NewCommentBox({controller}){let pin=controller.draftPin,[body,setBody]=useState24(""),[sending,setSending]=useState24(!1),ref=useRef24(null),cancel=controller.cancelPin,where=pin?.anchorKey??null;if(useEffect25(()=>{ref.current?.focus({preventScroll:!0})},[where]),useEscapeLayer("comments.new",()=>(cancel(),!0),{priority:ESCAPE_PRIORITY.selection+1,enabled:pin!=null}),!pin)return null;let anchor=controller.anchors.find(item=>item.recordKey===pin.anchorKey),heading=anchor&&pin.x==null?controller.say("newCommentWhole",{n:anchor.order}):anchor?controller.say("newCommentOn",{n:anchor.order}):controller.say("newComment"),send=async()=>{if(!body.trim()||sending)return;setSending(!0);let ok=await controller.sendNew(body.trim());setSending(!1),ok&&setBody("")};return jsxs24("div",{className:"nui-comment-new-box",role:"group","aria-label":heading,children:[jsx28("p",{className:"nui-comment-new-title",children:heading}),jsx28("textarea",{ref,className:"nui-comment-input",value:body,rows:2,placeholder:controller.say("commentPlaceholder"),"aria-label":controller.say("commentPlaceholder"),onChange:event=>setBody(event.target.value),onKeyDown:event=>{sendsOnEnter(event)&&(event.preventDefault(),send()),event.key==="Escape"&&!event.nativeEvent.isComposing&&(event.preventDefault(),body.trim()?event.currentTarget.blur():cancel())}}),jsxs24("div",{className:"nui-comment-new-actions",children:[jsx28(Button,{size:"sm",variant:"ghost",onClick:cancel,children:controller.words.cancel}),jsx28(Button,{size:"sm",variant:"primary",disabled:!body.trim()||sending,icon:"paper-plane-right",onClick:()=>{send()},children:controller.words.send})]})]})}function CommentPins({controller,anchorKey,onOpen}){let key=anchorKey===void 0?controller.anchorKey:anchorKey,pins=controller.threadsOn(key).filter(thread=>thread.root.x!=null&&thread.root.y!=null),draft=controller.draftPin,drag=controller.dragZone,here=key??null,open=(event,thread)=>{event.stopPropagation(),onOpen?onOpen(thread):controller.selectThread(thread)},box=zone=>({left:`${zone.x*100}%`,top:`${zone.y*100}%`,width:`${zone.w*100}%`,height:`${zone.h*100}%`});return jsxs24(Fragment13,{children:[controller.commenting?jsx28("div",{className:"nui-comment-capture","aria-hidden":"true",...controller.zoneHandlers(here),onClick:event=>event.stopPropagation()}):null,pins.filter(thread=>isCommentZone(thread.root)).map(thread=>jsx28("span",{className:"nui-comment-zone","aria-hidden":"true","data-selected":thread.root.recordKey===controller.threadKey?"":void 0,"data-resolved":thread.root.status==="Resolved"?"":void 0,style:box({x:thread.root.x,y:thread.root.y,w:thread.root.w,h:thread.root.h})},`zone-${thread.root.recordKey}`)),pins.map(thread=>jsx28("button",{type:"button",className:"nui-comment-pin","data-agent":thread.root.author!==controller.me?"":void 0,"data-selected":thread.root.recordKey===controller.threadKey?"":void 0,"data-resolved":thread.root.status==="Resolved"?"":void 0,style:{left:`${thread.root.x*100}%`,top:`${thread.root.y*100}%`},"aria-label":controller.say(isCommentZone(thread.root)?"zone":"pin",{who:thread.root.author,body:thread.root.body}),onClick:event=>open(event,thread),children:controller.numberOf(thread)},thread.root.recordKey)),drag&&drag.anchorKey===here?jsx28("span",{className:"nui-comment-zone","data-draft":"","data-selected":"","aria-hidden":"true",style:box(drag)}):null,draft&&draft.anchorKey===here&&draft.x!=null&&draft.y!=null?jsxs24(Fragment13,{children:[isCommentZone(draft)?jsx28("span",{className:"nui-comment-zone","data-draft":"","data-selected":"","aria-hidden":"true",style:box({x:draft.x,y:draft.y,w:draft.w,h:draft.h})}):null,jsx28("span",{className:"nui-comment-pin","data-draft":"","data-selected":"","aria-hidden":"true",style:{left:`${draft.x*100}%`,top:`${draft.y*100}%`},children:"+"})]}):null]})}function CommentPane({controller,title,showCopy=!0,className}){let rootRef=useRef24(null),heading=title??controller.say("comments"),{threads,visibleThreads,changes,draftPin,filter,statusFilter,anchors,anchorKey}=controller,scoped=filter==="anchor"?controller.threadsOn(anchorKey):threads,openCount=scoped.filter(thread=>thread.root.status==="Open").length,resolvedCount=scoped.filter(thread=>thread.root.status==="Resolved").length,emptyTitle=statusFilter==="resolved"?controller.say("emptyResolved"):filter==="anchor"?controller.say("emptyAnchor"):controller.say("emptyAll");return jsxs24("aside",{ref:rootRef,className:cx("nui-comment-pane",className),"aria-label":heading,children:[jsxs24("div",{className:"nui-comment-pane-head",children:[jsx28("h2",{className:"nui-comment-pane-title",children:heading}),anchors.length?jsx28(SegmentedControl,{label:controller.words.scope,value:filter,onChange:value=>controller.setFilter(value),options:[{value:"anchor",label:controller.words.thisAnchor,count:controller.threadsOn(anchorKey).length},{value:"all",label:controller.words.all,count:threads.length}]}):null]}),jsx28(SegmentedControl,{label:controller.words.status,value:statusFilter,onChange:value=>controller.setStatusFilter(value),options:[{value:"open",label:controller.words.open,count:openCount},{value:"resolved",label:controller.words.resolvedFilter,count:resolvedCount}]}),showCopy?jsxs24(Button,{variant:"secondary",className:"nui-comment-copy",icon:"copy",disabled:!changes.length||controller.copying,onClick:()=>{controller.copyChanges(rootRef.current)},children:[jsx28("span",{className:"nui-comment-copy-label",children:controller.say("copy")}),jsx28("span",{className:"nui-comment-count",children:changes.length})]}):null,draftPin?jsx28(NewCommentBox,{controller}):anchors.length&&controller.anchor?jsxs24("div",{className:"nui-comment-start",children:[jsx28(Button,{variant:"secondary",icon:"chat-circle-text",onClick:()=>controller.placePin(anchorKey,null,null),children:controller.say("commentOnAnchor",{n:controller.anchor.order})}),controller.commenting?jsx28("p",{className:"nui-comment-hint",children:controller.say(controller.zones?"zoneHint":"pinHint")}):null]}):null,visibleThreads.length?jsx28("div",{className:"nui-comment-list",children:visibleThreads.map(thread=>jsx28(CommentThreadCard,{controller,thread,showAnchor:filter==="all"},thread.root.recordKey))}):!draftPin&&!controller.loading?jsx28(EmptyState,{className:"nui-comment-empty",icon:"chat-circle-text",title:emptyTitle}):null,jsx28(Dialog,{open:controller.deleting!=null,onClose:controller.cancelDelete,title:controller.say("deleteTitle"),description:controller.say("deleteBody"),role:"alertdialog",children:jsxs24("div",{className:"nui-comment-dialog-actions",children:[jsx28(Button,{variant:"ghost","data-dialog-cancel":"",onClick:controller.cancelDelete,children:controller.words.cancel}),jsx28(Button,{variant:"danger","data-dialog-confirm":"",onClick:()=>{controller.confirmDelete()},children:controller.words.delete})]})}),jsx28(ActionToast,{toast:controller.toaster.toast,onUndo:()=>{controller.toaster.undo()},onDismiss:controller.toaster.dismiss})]})}var PRESENT_WORDS=Object.freeze({audienceTitle:{en:"Presentation",fr:"Pr\xE9sentation"},fillScreen:{en:"Click to fill this screen",fr:"Clique pour remplir cet \xE9cran"},dragToScreen:{en:"Drag this window to the other screen, then click to fill it",fr:"Fais glisser cette fen\xEAtre sur l\u2019autre \xE9cran, puis clique pour la remplir"},pressAgain:{en:"Press Present again to show it on the other screen",fr:"Appuie de nouveau sur Pr\xE9senter pour l\u2019afficher sur l\u2019autre \xE9cran"},blocked:{en:"The presentation window was blocked. Allow pop-ups for Notis, then press Present again.",fr:"La fen\xEAtre de pr\xE9sentation a \xE9t\xE9 bloqu\xE9e. Autorise les fen\xEAtres pop-up pour Notis, puis appuie de nouveau sur Pr\xE9senter."},onOtherScreen:{en:"Showing on the other screen",fr:"Affich\xE9 sur l\u2019autre \xE9cran"}});var AUDIENCE_WINDOW_NAME="notis-presenter-audience";function hasSecondScreen(win){return win?.screen?.isExtended===!0}function sameArea(a,b){return a.availLeft===b.availLeft&&a.availTop===b.availTop&&a.availWidth===b.availWidth&&a.availHeight===b.availHeight}function pickAudienceScreen(screens,current){let others=screens.filter(screen=>!(current&&(screen===current||sameArea(screen,current))));return others.length===0?null:[...others].sort((a,b)=>{let external=+(a.isInternal===!0)-+(b.isInternal===!0);return external!==0?external:b.availWidth*b.availHeight-a.availWidth*a.availHeight})[0]}function audienceFeatures(screen){if(!screen)return"popup,width=960,height=540";let{availLeft:left,availTop:top,availWidth:width,availHeight:height}=screen;return`popup,left=${Math.round(left)},top=${Math.round(top)},width=${Math.round(width)},height=${Math.round(height)}`}var KEY_ACTIONS=Object.freeze({ArrowRight:"next",ArrowDown:"next",PageDown:"next"," ":"next",Enter:"next",ArrowLeft:"previous",ArrowUp:"previous",PageUp:"previous",Home:"first",End:"last",Escape:"stop"}),FIELD='input,textarea,select,[contenteditable=""],[contenteditable="true"]',ACTIVE="a[href],button,label,summary,details,video,audio,[role=button],[role=link],[role=tab],[onclick],[tabindex]";function inside(target,selector){let element=target;return!!(element&&typeof element.closest=="function"&&element.closest(selector))}function keyAction(event){let action=KEY_ACTIONS[event.key];return!action||event.defaultPrevented||event.altKey||event.ctrlKey||event.metaKey||inside(event.target,FIELD)||(event.key===" "||event.key==="Enter")&&inside(event.target,ACTIVE)?null:action}function clickHasOwnTarget(target){return inside(target,FIELD)||inside(target,ACTIVE)}function fillsScreen(win){if(win.document.fullscreenElement)return!0;let{width,height}=win.screen;return width>0&&height>0&&win.innerWidth>=width-1&&win.innerHeight>=height-1&&win.outerWidth>0&&win.outerHeight>0&&Math.abs(win.outerWidth-win.innerWidth)<=1&&Math.abs(win.outerHeight-win.innerHeight)<=1}function resolveSheetUrls(css,base){let decode=value=>value.replace(/\\([\da-f]{1,6}\s?|\r\n|[\n\r\f]|[^\n\r\f])/gi,(_,escape)=>{if(/^[\da-f]/i.test(escape)){let point=parseInt(escape.trim(),16);return point>0&&point<=1114111&&!(point>=55296&&point<=57343)?String.fromCodePoint(point):"\uFFFD"}return/^[\n\r\f]/.test(escape)?"":escape});return css.replace(/\/\*[\s\S]*?\*\/|url\(\s*(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)'|((?:\\.|[^)\\])*))\s*\)|@import\s+(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)')|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'/gi,(token,double,single,bare,importDouble,importSingle)=>{let value=double??single??bare?.trim()??importDouble??importSingle;if(value===void 0)return token;let decoded=decode(value);if(decoded.startsWith("#"))return token;try{let url=JSON.stringify(new URL(decoded,base).href);return importDouble!==void 0||importSingle!==void 0?`@import ${url}`:`url(${url})`}catch{return token}})}function sheetText2(sheet){if(!sheet)return null;try{let text=Array.from(sheet.cssRules,rule=>rule.cssText).join(`
|
|
18
|
+
`);return sheet.href?resolveSheetUrls(text,sheet.href):text}catch{return null}}function copyNodes(target,source){for(let node of Array.from(source.querySelectorAll('link[rel~="stylesheet"],style'))){let sheetNode=node;if(sheetNode.disabled||sheetNode.sheet?.disabled)continue;let text=sheetText2(sheetNode.sheet),copy;if(node.localName==="link"&&text===null){let link=target.createElement("link");link.rel="stylesheet",link.href=node.href,copy=link}else{let style=target.createElement("style");style.textContent=text??node.textContent,copy=style}let media=node.getAttribute("media");media&&(copy.media=media),target.head.append(copy)}}function copyAdopted(target,sheets){for(let sheet of sheets??[]){if(sheet.disabled)continue;let text=sheetText2(sheet);if(!text)continue;let style=target.createElement("style");style.textContent=text,target.head.append(style)}}function copyStylesInto(target,source,shadowRoot){copyNodes(target,source),copyAdopted(target,source.adoptedStyleSheets),shadowRoot&&(copyNodes(target,shadowRoot),copyAdopted(target,shadowRoot.adoptedStyleSheets));let from=source.documentElement,to=target.documentElement;from.className&&(to.className=from.className);let style=from.getAttribute("style");style?to.setAttribute("style",style):to.removeAttribute("style")}import{useCallback as useCallback20,useEffect as useEffect26,useRef as useRef25,useState as useState25}from"react";import{createPortal as createPortal6}from"react-dom";import{jsx as jsx29,jsxs as jsxs25}from"react/jsx-runtime";async function windowManagementState(win){if(typeof win.getScreenDetails!="function")return"unsupported";try{return(await win.navigator.permissions.query({name:"window-management"})).state}catch{return"prompt"}}async function screenDetails(win){try{return await win.getScreenDetails()}catch{return null}}var AUDIENCE_BASE_CSS=["html,body{height:100%;margin:0;overflow:hidden;background:hsl(0 0% 0%)}","[data-notis-audience-root]{position:fixed;inset:0;display:flex;flex-direction:column}"].join("");function setUpWindow(win,anchor,title,locale){let doc=win.document,root=anchor?.getRootNode(),shadow=typeof ShadowRoot<"u"&&root instanceof ShadowRoot?root:null;doc.head.replaceChildren();let charset=doc.createElement("meta");charset.setAttribute("charset","utf-8"),doc.head.append(charset),doc.title=title,doc.documentElement.lang=locale,copyStylesInto(doc,document,shadow);let base=doc.createElement("style");base.textContent=AUDIENCE_BASE_CSS,doc.head.append(base);let appRoot=anchor?.closest("[data-notis-app-root]")??null,container=doc.createElement("div");container.setAttribute("data-notis-app-root",""),container.setAttribute("data-notis-audience-root","");let theme=appRoot?.getAttribute("data-notis-theme");theme&&container.setAttribute("data-notis-theme",theme);let style=appRoot?.getAttribute("style");style&&container.setAttribute("style",style);let layer=doc.createElement("div");return layer.setAttribute(LAYER_ROOT_ATTRIBUTE,""),doc.body.replaceChildren(container,layer),{win,container,layer,placed:!1}}function AudienceView({audience,children}){let t=useT(),{win}=audience,[filled,setFilled]=useState25(()=>fillsScreen(win));useEffect26(()=>{let update=()=>setFilled(fillsScreen(win));return update(),win.addEventListener("resize",update),win.document.addEventListener("fullscreenchange",update),()=>{win.removeEventListener("resize",update),win.document.removeEventListener("fullscreenchange",update)}},[win]);let fill=useCallback20(event=>{event.preventDefault(),event.stopPropagation(),win.document.documentElement.requestFullscreen?.({navigationUI:"hide"})?.catch(()=>{})},[win]);return jsxs25(LayerRootProvider,{root:audience.layer,children:[children,filled?null:jsx29("button",{type:"button","data-notis-audience-fill":"",onClick:fill,className:"fixed inset-0 z-[1000] flex cursor-pointer items-end justify-center bg-transparent p-8",children:jsx29("span",{className:"rounded-full bg-popover px-4 py-2 text-sm text-popover-foreground shadow-lg ring-1 ring-border",children:t(audience.placed?PRESENT_WORDS.fillScreen:PRESENT_WORDS.dragToScreen)})})]})}function useAudienceScreen(options){let t=useT(),locale=useToolkitLocale(),optionsRef=useRef25(options);optionsRef.current=options;let[secondScreen,setSecondScreen]=useState25(()=>typeof window>"u"?!1:hasSecondScreen(window)),[audience,setAudience]=useState25(null),audienceRef=useRef25(null),teardownRef=useRef25(null);useEffect26(()=>{if(typeof window>"u")return;let screen=window.screen,update=()=>setSecondScreen(hasSecondScreen(window));if(update(),typeof screen.addEventListener=="function")return screen.addEventListener("change",update),()=>screen.removeEventListener?.("change",update)},[]);let finish=useCallback20(closeWindow=>{let current=audienceRef.current;current&&(audienceRef.current=null,teardownRef.current?.(),teardownRef.current=null,closeWindow&&!current.win.closed&¤t.win.close(),setAudience(null),optionsRef.current.onClose?.())},[]),close=useCallback20(()=>finish(!0),[finish]),open=useCallback20(async anchor=>{let current=audienceRef.current;if(current&&!current.win.closed)return current.win.focus(),"opened";if(typeof window>"u"||!hasSecondScreen(window))return"one-screen";let state=await windowManagementState(window),target=null;if(state==="granted"||state==="prompt"){let details=await screenDetails(window);details&&(target=pickAudienceScreen(details.screens,details.currentScreen))}let win=window.open("",AUDIENCE_WINDOW_NAME,audienceFeatures(target));if(!win)return state==="prompt"?"press-again":"blocked";let next=setUpWindow(win,anchor??null,t(optionsRef.current.title??PRESENT_WORDS.audienceTitle),locale);next.placed=target!==null;let onKey=event=>{let action=keyAction(event);action&&(event.preventDefault(),optionsRef.current.onAction(action))},onClick=event=>{event.defaultPrevented||event.button!==0||clickHasOwnTarget(event.target)||optionsRef.current.onAction("next")},onContextMenu=event=>{event.defaultPrevented||clickHasOwnTarget(event.target)||(event.preventDefault(),optionsRef.current.onAction("previous"))},onGone=()=>finish(!1),onLeave=()=>finish(!0);win.addEventListener("keydown",onKey),win.addEventListener("click",onClick),win.addEventListener("contextmenu",onContextMenu),win.addEventListener("pagehide",onGone),window.addEventListener("pagehide",onLeave);let poll=window.setInterval(()=>{win.closed&&finish(!1)},500);return teardownRef.current?.(),teardownRef.current=()=>{window.clearInterval(poll),window.removeEventListener("pagehide",onLeave),win.removeEventListener("keydown",onKey),win.removeEventListener("click",onClick),win.removeEventListener("contextmenu",onContextMenu),win.removeEventListener("pagehide",onGone)},audienceRef.current=next,setAudience(next),win.focus(),"opened"},[finish,locale,t]);useEffect26(()=>()=>finish(!0),[finish]);let portal=useCallback20(node=>audience?createPortal6(jsx29(AudienceView,{audience,children:node}),audience.container):null,[audience]);return{secondScreen,isOpen:audience!==null,open,close,portal}}export{ACTION_TOAST_MS,ACTION_WORDS,AUDIENCE_WINDOW_NAME,ActionToast,Area2 as Area,AreaChart,AttachmentGallery,BLOCK_WORDS,BOARD_WORDS,Badge,Bar2 as Bar,BarChart,BoardView,Button,CALENDAR_NARROW_MAX,CALENDAR_TRAY_SIDE_MIN,CALENDAR_VIEWS,CALENDAR_WORDS,CHART_WORDS,CHAT_NARROWED_ATTRIBUTE,CHAT_PANEL_DEFAULT_WIDTH_PX,CHAT_PANEL_DESKTOP_MEDIA_QUERY,CHAT_PANEL_KEYBOARD_STEP_PX,CHAT_PANEL_MIN_CONTENT_WIDTH_PX,CHAT_PANEL_MIN_WIDTH_PX,CHAT_PANEL_OVERLAP_PROPERTY,CHAT_PANEL_PAGE_HOVER_DELAY_MS,CHAT_PANEL_PAGE_PEEK_PX,CHAT_PANEL_WIDTH_PROPERTY,CHAT_PANEL_WIDTH_STORAGE_KEY,COMMENT_CHECK_ANSWERS,COMMENT_COLUMNS,COMMENT_TEXT_FILE,COMMENT_WORDS,COMPARES,COMPARE_WORDS,CalendarView,CartesianGrid2 as CartesianGrid,Cell2 as Cell,Chart,ChartContainer,ChartLegend,ChartStyle,ChartTable,ChartTooltip,ChartTooltipContent,CommentAvatar,CommentPane,CommentPins,CommentThreadCard,ComposedChart2 as ComposedChart,DEFAULT_COMPARE,DEFAULT_PRESET,DayPicker,EMPTY_SELECTION,ESCAPE_PRIORITY,EditableFields,EmptyState,FIELDS_ESCAPE_PRIORITY,FIELDS_SAVE_KEYS,FIELD_WORDS,FieldDisclosure,FieldList,FieldLongText,FieldMultiSelect,FieldRow,FieldSelect,FieldText,GALLERY_WORDS,HelpSheet,IDLE_ROW_STATE,IMAGE_VIEWER_ZOOM_LEVELS,Icon,ImageViewer,KeyboardEngine,KeyboardEngineCore,Keycap,KeycapSurface,LAYER_ROOT_ATTRIBUTE,LIST_DRAG_TYPE,LIST_READER_WORDS,LabelList,LayerRootProvider,Legend,Line2 as Line,LineChart,ListReader,ListSkeleton,MANAGER_PHONE_LAYOUT_BELOW_PX,Menu,MenuItem,MenuSeparator,MenuSub,Metric,NativeSelect,NewCommentBox,Notice,NotisKeyClash,OPEN_MODES,OPEN_MODE_CACHE_PREFIX,OPEN_MODE_ICONS,OPEN_MODE_WORDS,OpenAsMenu,OpenModeStoreProvider,PAGE_VIEWPORT_ATTRIBUTE,PANELS_HOVER_DELAY_MS,PANELS_KEYBOARD_STEP_PX,PANELS_LIST_MIN_PX,PANELS_READER_MIN_PX,PANELS_READER_PEEK_PX,PANELS_READER_WANT_PX,PANELS_READER_WANT_WIDE_PX,PANELS_READER_WIDE_FROM_PX,PERIOD_PICKER_TWO_MONTHS_MIN,PERIOD_WORDS,PRESENT_WORDS,PRESETS,PRESET_WORDS,Pagination,Panels,PeriodPicker,Pie,PieChart,Popover,REORDER_DRAG_TYPE,REORDER_WORDS,ROOT_OWNER,ROW_ID_ATTRIBUTE,ROW_INTERACTIVE_SELECTOR,ROW_TIME_WORDS,ReferenceDot,ReferenceLine,RenderChartData,ResponsiveContainer2 as ResponsiveContainer,Row,RowIdContext,RowMore,RowStateContext,SELECTION_BAR_BOOST,SELECTION_BAR_MAX_INLINE,SEQUENCE_TIMEOUT_MS,STAR_WORDS,STATUS_WORDS,Scatter,Section,SegmentedControl,SelectionBar,ShortcutRegistry,ShortcutScope,Sparkline,StarMark,StatRow,StatusIcon,Switch,TABROW_WORDS,TABS_WORDS,TIMELINE_WORDS,TIMELINE_ZOOMS,TabRow,Tabs,TimelineView,ToggleGroup,Tooltip,VS_WORDS,XAxis2 as XAxis,YAxis2 as YAxis,adoptToolkitStyles,applyCommentPatches,audienceFeatures,availableActions,barLabel,barShape,binUnit,dropIndex as boardDropIndex,boardOrder,boardStep,buildBins,chainReorderProps,changedFieldKeys,chatPanelMaxWidth,chatPanelOverlap,chatPanelPageWidth,chatPanelPushLimit,chooseFit,clampChatPanelWidth,clampReaderWidth,clickHasOwnTarget,clipCommentAnswer,commentAnchorOf,commentChangesSince,commentColumns,commentCopiedWords,commentDigest,commentRelativeTime,commentRowsOf,commentThreads,commentTimeOf,commentWords,compareRange,copyStylesInto,createChatPanelEdge,customPeriod,dayCount,dayNumberLabel,detectLocale,detectPlatform,dropIndex2 as dropIndex,failedItemsWords,fillsScreen,findLayerRoot,findRow,formatDateRange,formatDayHeading,formatDelta,formatLongDay,formatMonthYear,formatNumber,formatPeriodParam,formatReaderAgo,formatRowAgo,formatRowTime,formatShortDay,formatValue,fromIsoDay,galleryItemKind,galleryItemName,getOpenModeStore,getSharedInstance,getToolkitStyleSheet,getToolkitStyleText,gridColumns,hasIcon,hasSecondScreen,inCommentScope,intlLocale,isCommentZone,isCompareId,isOpenMode,isPresetId,keyAction,layoutTimeline,localStorageOpenModeStore,metricView,neighbourColumn,newCommentId,normalizeAllowed,normalizePeriod,overlap,pageViewport,panelMath_exports as panelMath,parsePeriodParam,parseRowDate,parseStoredChatPanelWidth,parseStoredWidth,periodRanges,periodSeries,pickAudienceScreen,place,presetRange,pushLimit,rangeBetween,rankActions,readCommentRow,readOpenModeCache,readerMaxWidth,readerWantWidth,registerToolkitStyles,renderIcon,resolveActions,samePeriod,scrollCommentIntoView,selectionReducer,seriesColor,setOpenModeStore,sparkPaths,splitBreakpoint,splitFits,statusGroup,stepCursor,stepTab,successorOf,tabIds,tabPanelProps,timelineWindow,toIsoDay,toggleFieldValue,total,useActions,useAudienceScreen,useChart,useComments,useEngineCore,useEscapeBlocker,useEscapeLayer,useFieldDraft,useHelpSheet,useKeyLabel,useLayerRoot,useListKeys,useMenu,useOpenMode,useOpenModeKey,useOpenModeStore,usePanels,usePeriod,useRegistryVersion,useReorder,useRowState,useSelection,useSelectionBar,useShortcut,useShortcutOwner,useShortcutScope,useShortcuts,useToast,useToolkitLocale,useToolkitPlatform,useToolkitSettings,userSettingsOpenModeStore,weekdayNames,writeCommentClipboard,writeOpenModeCache};
|
|
@@ -567,6 +567,7 @@ $$typeof
|
|
|
567
567
|
?resource=<id>
|
|
568
568
|
@/components/ui/*
|
|
569
569
|
@container
|
|
570
|
+
@import
|
|
570
571
|
@media
|
|
571
572
|
@notis/sdk
|
|
572
573
|
@notis/sdk/config
|
|
@@ -1046,6 +1047,7 @@ Zoom
|
|
|
1046
1047
|
\u0002
|
|
1047
1048
|
\u0003
|
|
1048
1049
|
\u202f
|
|
1050
|
+
\ufffd
|
|
1049
1051
|
\x60()]*?)\s*from\s*([
|
|
1050
1052
|
],[contenteditable=
|
|
1051
1053
|
],style
|
|
@@ -3203,6 +3205,7 @@ uppercase
|
|
|
3203
3205
|
upsert
|
|
3204
3206
|
upsert({
|
|
3205
3207
|
url
|
|
3208
|
+
url(...)
|
|
3206
3209
|
use
|
|
3207
3210
|
useActionQuery
|
|
3208
3211
|
useActions
|
|
@@ -3399,6 +3402,7 @@ zoom
|
|
|
3399
3402
|
{who}
|
|
3400
3403
|
{who},
|
|
3401
3404
|
{who}:
|
|
3405
|
+
|((?:\\.|[^)\\])*))\s*\)|@import\s+(?:
|
|
3402
3406
|
}).format(date)}
|
|
3403
3407
|
Ça
|
|
3404
3408
|
Échec
|
|
@@ -26,10 +26,10 @@ export declare function audienceFeatures(screen: ScreenArea | null): string;
|
|
|
26
26
|
export declare function keyAction(event: Pick<KeyboardEvent, 'key' | 'altKey' | 'ctrlKey' | 'metaKey' | 'defaultPrevented' | 'target'>): PresentAction | null;
|
|
27
27
|
/** True when a click lands on something of its own (a field, a button, a link) rather than on the slide. */
|
|
28
28
|
export declare function clickHasOwnTarget(target: EventTarget | null): boolean;
|
|
29
|
-
/**
|
|
29
|
+
/** Fullscreen, or a borderless full-size desktop window. A large browser popup can still have a URL bar. */
|
|
30
30
|
export declare function fillsScreen(win: Window): boolean;
|
|
31
31
|
/**
|
|
32
|
-
* Copy the page's styles into the audience window: the document's
|
|
32
|
+
* Copy the page's styles into the audience window: the document's loaded rules (links only when unreadable), then
|
|
33
33
|
* those of the Space's shadow root (its bundle and the toolkit). Constructed sheets cannot move between documents, so
|
|
34
34
|
* they are copied as text. The `<html>` class and style (light or dark) come along.
|
|
35
35
|
*/
|