@jsnote-zeina/local-client 1.0.13 → 1.0.14

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.
@@ -1893,8 +1893,8 @@ Project '${b.projectName}' (${mY[b.projectKind]}) ${d}
1893
1893
  Additional information: BADCLIENT: Bad error code, ${H} not found in range ${m}..${b} (found: ${$.join(", ")})`),A}return i?y.map(w=>this.mapCodeFixAction(w)):y}getCombinedCodeFix({scope:t,fixId:i},o){ie.assert(t.type==="file");const{file:l,project:d}=this.getFileAndProject(t.args),m=d.getLanguageService().getCombinedCodeFix({type:"file",fileName:l},i,this.getFormatOptions(l),this.getPreferences(l));return o?{changes:this.mapTextChangesToCodeEdits(m.changes),commands:m.commands}:m}applyCodeActionCommand(t){const i=t.command;for(const o of yf(i)){const{file:l,project:d}=this.getFileAndProject(o);d.getLanguageService().applyCodeActionCommand(o,this.getFormatOptions(l)).then(m=>{},m=>{})}return{}}getStartAndEndPosition(t,i){let o,l;return t.startPosition!==void 0?o=t.startPosition:(o=i.lineOffsetToPosition(t.startLine,t.startOffset),t.startPosition=o),t.endPosition!==void 0?l=t.endPosition:(l=i.lineOffsetToPosition(t.endLine,t.endOffset),t.endPosition=l),{startPosition:o,endPosition:l}}mapCodeAction({description:t,changes:i,commands:o}){return{description:t,changes:this.mapTextChangesToCodeEdits(i),commands:o}}mapCodeFixAction({fixName:t,description:i,changes:o,commands:l,fixId:d,fixAllDescription:m}){return{fixName:t,description:i,changes:this.mapTextChangesToCodeEdits(o),commands:l,fixId:d,fixAllDescription:m}}mapPasteEditsAction({edits:t,fixId:i}){return{edits:this.mapTextChangesToCodeEdits(t),fixId:i}}mapTextChangesToCodeEdits(t){return t.map(i=>this.mapTextChangeToCodeEdit(i))}mapTextChangeToCodeEdit(t){const i=this.projectService.getScriptInfoOrConfig(t.fileName);return!!t.isNewFile==!!i&&(i||this.projectService.logErrorForScriptInfoNotFound(t.fileName),ie.fail("Expected isNewFile for (only) new files. "+JSON.stringify({isNewFile:!!t.isNewFile,hasScriptInfo:!!i}))),i?{fileName:t.fileName,textChanges:t.textChanges.map(o=>ETt(o,i))}:CTt(t)}convertTextChangeToCodeEdit(t,i){return{start:i.positionToLineOffset(t.span.start),end:i.positionToLineOffset(t.span.start+t.span.length),newText:t.newText?t.newText:""}}getBraceMatching(t,i){const{file:o,languageService:l}=this.getFileAndLanguageServiceForSyntacticOperation(t),d=this.projectService.getScriptInfoForNormalizedPath(o),m=this.getPosition(t,d),b=l.getBraceMatchingAtPosition(o,m);return b?i?b.map(y=>oA(y,d)):b:void 0}getDiagnosticsForProject(t,i,o){if(this.suppressDiagnosticEvents)return;const{fileNames:l,languageServiceDisabled:d}=this.getProjectInfoWorker(o,void 0,!0,void 0,!0);if(d)return;const m=l.filter(se=>!se.includes("lib.d.ts"));if(m.length===0)return;const b=[],y=[],w=[],A=[],F=B_(o),$=this.projectService.ensureDefaultProjectForFile(F);for(const se of m)this.getCanonicalFileName(se)===this.getCanonicalFileName(o)?b.push(se):this.projectService.getScriptInfo(se).isScriptOpen()?y.push(se):t1(se)?A.push(se):w.push(se);const te=[...b,...y,...w,...A].map(se=>({fileName:se,project:$}));this.updateErrorCheck(t,te,i,!1)}configurePlugin(t){this.projectService.configurePlugin(t)}getSmartSelectionRange(t,i){const{locations:o}=t,{file:l,languageService:d}=this.getFileAndLanguageServiceForSyntacticOperation(t),m=ie.checkDefined(this.projectService.getScriptInfo(l));return Dn(o,b=>{const y=this.getPosition(b,m),w=d.getSmartSelectionRange(l,y);return i?this.mapSelectionRange(w,m):w})}toggleLineComment(t,i){const{file:o,languageService:l}=this.getFileAndLanguageServiceForSyntacticOperation(t),d=this.projectService.getScriptInfo(o),m=this.getRange(t,d),b=l.toggleLineComment(o,m);if(i){const y=this.projectService.getScriptInfoForNormalizedPath(o);return b.map(w=>this.convertTextChangeToCodeEdit(w,y))}return b}toggleMultilineComment(t,i){const{file:o,languageService:l}=this.getFileAndLanguageServiceForSyntacticOperation(t),d=this.projectService.getScriptInfoForNormalizedPath(o),m=this.getRange(t,d),b=l.toggleMultilineComment(o,m);if(i){const y=this.projectService.getScriptInfoForNormalizedPath(o);return b.map(w=>this.convertTextChangeToCodeEdit(w,y))}return b}commentSelection(t,i){const{file:o,languageService:l}=this.getFileAndLanguageServiceForSyntacticOperation(t),d=this.projectService.getScriptInfoForNormalizedPath(o),m=this.getRange(t,d),b=l.commentSelection(o,m);if(i){const y=this.projectService.getScriptInfoForNormalizedPath(o);return b.map(w=>this.convertTextChangeToCodeEdit(w,y))}return b}uncommentSelection(t,i){const{file:o,languageService:l}=this.getFileAndLanguageServiceForSyntacticOperation(t),d=this.projectService.getScriptInfoForNormalizedPath(o),m=this.getRange(t,d),b=l.uncommentSelection(o,m);if(i){const y=this.projectService.getScriptInfoForNormalizedPath(o);return b.map(w=>this.convertTextChangeToCodeEdit(w,y))}return b}mapSelectionRange(t,i){const o={textSpan:oA(t.textSpan,i)};return t.parent&&(o.parent=this.mapSelectionRange(t.parent,i)),o}getScriptInfoFromProjectService(t){const i=B_(t),o=this.projectService.getScriptInfoForNormalizedPath(i);return o||(this.projectService.logErrorForScriptInfoNotFound(i),$4.ThrowNoProject())}toProtocolCallHierarchyItem(t){const i=this.getScriptInfoFromProjectService(t.file);return{name:t.name,kind:t.kind,kindModifiers:t.kindModifiers,file:t.file,containerName:t.containerName,span:oA(t.span,i),selectionSpan:oA(t.selectionSpan,i)}}toProtocolCallHierarchyIncomingCall(t){const i=this.getScriptInfoFromProjectService(t.from.file);return{from:this.toProtocolCallHierarchyItem(t.from),fromSpans:t.fromSpans.map(o=>oA(o,i))}}toProtocolCallHierarchyOutgoingCall(t,i){return{to:this.toProtocolCallHierarchyItem(t.to),fromSpans:t.fromSpans.map(o=>oA(o,i))}}prepareCallHierarchy(t){const{file:i,project:o}=this.getFileAndProject(t),l=this.projectService.getScriptInfoForNormalizedPath(i);if(l){const d=this.getPosition(t,l),m=o.getLanguageService().prepareCallHierarchy(i,d);return m&&S1e(m,b=>this.toProtocolCallHierarchyItem(b))}}provideCallHierarchyIncomingCalls(t){const{file:i,project:o}=this.getFileAndProject(t),l=this.getScriptInfoFromProjectService(i);return o.getLanguageService().provideCallHierarchyIncomingCalls(i,this.getPosition(t,l)).map(m=>this.toProtocolCallHierarchyIncomingCall(m))}provideCallHierarchyOutgoingCalls(t){const{file:i,project:o}=this.getFileAndProject(t),l=this.getScriptInfoFromProjectService(i);return o.getLanguageService().provideCallHierarchyOutgoingCalls(i,this.getPosition(t,l)).map(m=>this.toProtocolCallHierarchyOutgoingCall(m,l))}getCanonicalFileName(t){const i=this.host.useCaseSensitiveFileNames?t:bu(t);return T0(i)}exit(){}notRequired(t){return t&&this.doOutput(void 0,t.command,t.seq,!0,this.performanceData),{responseRequired:!1,performanceData:this.performanceData}}requiredResponse(t){return{response:t,responseRequired:!0,performanceData:this.performanceData}}addProtocolHandler(t,i){if(this.handlers.has(t))throw new Error(`Protocol handler already exists for command "${t}"`);this.handlers.set(t,i)}setCurrentRequest(t){ie.assert(this.currentRequestId===void 0),this.currentRequestId=t,this.cancellationToken.setRequest(t)}resetCurrentRequest(t){ie.assert(this.currentRequestId===t),this.currentRequestId=void 0,this.cancellationToken.resetRequest(t)}executeWithRequestId(t,i,o){const l=this.performanceData;try{return this.performanceData=o,this.setCurrentRequest(t),i()}finally{this.resetCurrentRequest(t),this.performanceData=l}}executeCommand(t){const i=this.handlers.get(t.command);if(i){const o=this.executeWithRequestId(t.seq,()=>i(t),void 0);return this.projectService.enableRequestedPlugins(),o}else return this.logger.msg(`Unrecognized JSON command:${iO(t)}`,"Err"),this.doOutput(void 0,"unknown",t.seq,!1,void 0,`Unrecognized JSON command: ${t.command}`),{responseRequired:!1}}onMessage(t){var i,o,l,d,m,b,y;this.gcTimer.scheduleCollect();let w;const A=this.performanceData;this.logger.hasLevel(2)&&(w=this.hrtime(),this.logger.hasLevel(3)&&this.logger.info(`request:${UX(this.toStringMessage(t))}`));let F,$;try{F=this.parseMessage(t),$=F.arguments&&F.arguments.file?F.arguments:void 0,(i=Lo)==null||i.instant(Lo.Phase.Session,"request",{seq:F.seq,command:F.command}),(o=Lo)==null||o.push(Lo.Phase.Session,"executeCommand",{seq:F.seq,command:F.command},!0);const{response:H,responseRequired:te,performanceData:se}=this.executeCommand(F);if((l=Lo)==null||l.pop(),this.logger.hasLevel(2)){const me=pTt(this.hrtime(w)).toFixed(4);te?this.logger.perftrc(`${F.seq}::${F.command}: elapsed time (in milliseconds) ${me}`):this.logger.perftrc(`${F.seq}::${F.command}: async elapsed time (in milliseconds) ${me}`)}(d=Lo)==null||d.instant(Lo.Phase.Session,"response",{seq:F.seq,command:F.command,success:!!H}),H?this.doOutput(H,F.command,F.seq,!0,se):te&&this.doOutput(void 0,F.command,F.seq,!1,se,"No content available.")}catch(H){if((m=Lo)==null||m.popAll(),H instanceof xD){(b=Lo)==null||b.instant(Lo.Phase.Session,"commandCanceled",{seq:F==null?void 0:F.seq,command:F==null?void 0:F.command}),this.doOutput({canceled:!0},F.command,F.seq,!0,this.performanceData);return}this.logErrorWorker(H,this.toStringMessage(t),$),(y=Lo)==null||y.instant(Lo.Phase.Session,"commandError",{seq:F==null?void 0:F.seq,command:F==null?void 0:F.command,message:H.message}),this.doOutput(void 0,F?F.command:"unknown",F?F.seq:0,!1,this.performanceData,"Error processing request. "+H.message+`
1894
1894
  `+H.stack)}finally{this.performanceData=A}}parseMessage(t){return JSON.parse(t)}toStringMessage(t){return t}getFormatOptions(t){return this.projectService.getFormatCodeOptions(t)}getPreferences(t){return this.projectService.getPreferences(t)}getHostFormatOptions(){return this.projectService.getHostFormatCodeOptions()}getHostPreferences(){return this.projectService.getHostPreferences()}};function yYe(e){const t=e.diagnosticsDuration&&gs(e.diagnosticsDuration,([i,o])=>({...o,file:i}));return{...e,diagnosticsDuration:t}}function oA(e,t){return{start:t.positionToLineOffset(e.start),end:t.positionToLineOffset(Ci(e))}}function h6e(e,t,i){const o=oA(e,i),l=t&&oA(t,i);return l?{...o,contextStart:l.start,contextEnd:l.end}:o}function ETt(e,t){return{start:vYe(t,e.span.start),end:vYe(t,Ci(e.span)),newText:e.newText}}function vYe(e,t){return c6e(e)?TTt(e.getLineAndCharacterOfPosition(t)):e.positionToLineOffset(t)}function STt(e,t){const i=e.ranges.map(o=>({start:t.positionToLineOffset(o.start),end:t.positionToLineOffset(o.start+o.length)}));return e.wordPattern?{ranges:i,wordPattern:e.wordPattern}:{ranges:i}}function TTt(e){return{line:e.line+1,offset:e.character+1}}function CTt(e){ie.assert(e.textChanges.length===1);const t=ql(e.textChanges);return ie.assert(t.span.start===0&&t.span.length===0),{fileName:e.fileName,textChanges:[{start:{line:0,offset:0},end:{line:0,offset:0},newText:t.newText}]}}function g6e(e,t,i,o){const l=kTt(e,t,o),{line:d,character:m}=tt(Ne(l),i);return{line:d+1,offset:m+1}}function kTt(e,t,i){for(const{fileName:o,textChanges:l}of i)if(o===t)for(let d=l.length-1;d>=0;d--){const{newText:m,span:{start:b,length:y}}=l[d];e=e.slice(0,b)+m+e.slice(b+y)}return e}function bYe(e,{fileName:t,textSpan:i,contextSpan:o,isWriteAccess:l,isDefinition:d},{disableLineTextInReferences:m}){const b=ie.checkDefined(e.getScriptInfo(t)),y=h6e(i,o,b),w=m?void 0:DTt(b,y);return{file:t,...y,lineText:w,isWriteAccess:l,isDefinition:d}}function DTt(e,t){const i=e.lineToTextSpan(t.start.line-1);return e.getSnapshot().getText(i.start,Ci(i)).replace(/\r|\n/g,"")}function ATt(e){return e===void 0||e&&typeof e=="object"&&typeof e.exportName=="string"&&(e.fileName===void 0||typeof e.fileName=="string")&&(e.ambientModuleName===void 0||typeof e.ambientModuleName=="string"&&(e.isPackageJsonImport===void 0||typeof e.isPackageJsonImport=="boolean"))}var vH=4,x6e=(e=>(e[e.PreStart=0]="PreStart",e[e.Start=1]="Start",e[e.Entire=2]="Entire",e[e.Mid=3]="Mid",e[e.End=4]="End",e[e.PostEnd=5]="PostEnd",e))(x6e||{}),wTt=class{constructor(){this.goSubtree=!0,this.lineIndex=new ure,this.endBranch=[],this.state=2,this.initialText="",this.trailingText="",this.lineIndex.root=new bH,this.startPath=[this.lineIndex.root],this.stack=[this.lineIndex.root]}get done(){return!1}insertLines(e,t){t&&(this.trailingText=""),e?e=this.initialText+e+this.trailingText:e=this.initialText+this.trailingText;const o=ure.linesFromText(e).lines;o.length>1&&o[o.length-1]===""&&o.pop();let l,d;for(let b=this.endBranch.length-1;b>=0;b--)this.endBranch[b].updateCounts(),this.endBranch[b].charCount()===0&&(d=this.endBranch[b],b>0?l=this.endBranch[b-1]:l=this.branchNode);d&&l.remove(d);const m=this.startPath[this.startPath.length-1];if(o.length>0)if(m.text=o[0],o.length>1){let b=new Array(o.length-1),y=m;for(let F=1;F<o.length;F++)b[F-1]=new Lce(o[F]);let w=this.startPath.length-2;for(;w>=0;){const F=this.startPath[w];b=F.insertAt(y,b),w--,y=F}let A=b.length;for(;A>0;){const F=new bH;F.add(this.lineIndex.root),b=F.insertAt(this.lineIndex.root,b),A=b.length,this.lineIndex.root=F}this.lineIndex.root.updateCounts()}else for(let b=this.startPath.length-2;b>=0;b--)this.startPath[b].updateCounts();else{this.startPath[this.startPath.length-2].remove(m);for(let y=this.startPath.length-2;y>=0;y--)this.startPath[y].updateCounts()}return this.lineIndex}post(e,t,i){i===this.lineCollectionAtBranch&&(this.state=4),this.stack.pop()}pre(e,t,i,o,l){const d=this.stack[this.stack.length-1];this.state===2&&l===1&&(this.state=1,this.branchNode=d,this.lineCollectionAtBranch=i);let m;function b(y){return y.isLeaf()?new Lce(""):new bH}switch(l){case 0:this.goSubtree=!1,this.state!==4&&d.add(i);break;case 1:this.state===4?this.goSubtree=!1:(m=b(i),d.add(m),this.startPath.push(m));break;case 2:this.state!==4?(m=b(i),d.add(m),this.startPath.push(m)):i.isLeaf()||(m=b(i),d.add(m),this.endBranch.push(m));break;case 3:this.goSubtree=!1;break;case 4:this.state!==4?this.goSubtree=!1:i.isLeaf()||(m=b(i),d.add(m),this.endBranch.push(m));break;case 5:this.goSubtree=!1,this.state!==1&&d.add(i);break}this.goSubtree&&this.stack.push(m)}leaf(e,t,i){this.state===1?this.initialText=i.text.substring(0,e):this.state===2?(this.initialText=i.text.substring(0,e),this.trailingText=i.text.substring(e+t)):this.trailingText=i.text.substring(e+t)}},NTt=class{constructor(e,t,i){this.pos=e,this.deleteLen=t,this.insertedText=i}getTextChangeRange(){return ca(Wc(this.pos,this.deleteLen),this.insertedText?this.insertedText.length:0)}},Kxe=class Nq{constructor(){this.changes=[],this.versions=new Array(Nq.maxVersions),this.minVersion=0,this.currentVersion=0}versionToIndex(t){if(!(t<this.minVersion||t>this.currentVersion))return t%Nq.maxVersions}currentVersionToIndex(){return this.currentVersion%Nq.maxVersions}edit(t,i,o){this.changes.push(new NTt(t,i,o)),(this.changes.length>Nq.changeNumberThreshold||i>Nq.changeLengthThreshold||o&&o.length>Nq.changeLengthThreshold)&&this.getSnapshot()}getSnapshot(){return this._getSnapshot()}_getSnapshot(){let t=this.versions[this.currentVersionToIndex()];if(this.changes.length>0){let i=t.index;for(const o of this.changes)i=i.edit(o.pos,o.deleteLen,o.insertedText);t=new EYe(this.currentVersion+1,this,i,this.changes),this.currentVersion=t.version,this.versions[this.currentVersionToIndex()]=t,this.changes=[],this.currentVersion-this.minVersion>=Nq.maxVersions&&(this.minVersion=this.currentVersion-Nq.maxVersions+1)}return t}getSnapshotVersion(){return this._getSnapshot().version}getAbsolutePositionAndLineText(t){return this._getSnapshot().index.lineNumberToInfo(t)}lineOffsetToPosition(t,i){return this._getSnapshot().index.absolutePositionOfStartOfLine(t)+(i-1)}positionToLineOffset(t){return this._getSnapshot().index.positionToLineOffset(t)}lineToTextSpan(t){const i=this._getSnapshot().index,{lineText:o,absolutePosition:l}=i.lineNumberToInfo(t+1),d=o!==void 0?o.length:i.absolutePositionOfStartOfLine(t+2)-l;return Wc(l,d)}getTextChangesBetweenVersions(t,i){if(t<i)if(t>=this.minVersion){const o=[];for(let l=t+1;l<=i;l++){const d=this.versions[this.versionToIndex(l)];for(const m of d.changesSincePreviousVersion)o.push(m.getTextChangeRange())}return bc(o)}else return;else return Js}getLineCount(){return this._getSnapshot().index.getLineCount()}static fromString(t){const i=new Nq,o=new EYe(0,i,new ure);i.versions[i.currentVersion]=o;const l=ure.linesFromText(t);return o.index.load(l.lines),i}};Kxe.changeNumberThreshold=8,Kxe.changeLengthThreshold=256,Kxe.maxVersions=8;var Qxe=Kxe,EYe=class N2r{constructor(t,i,o,l=gg){this.version=t,this.cache=i,this.index=o,this.changesSincePreviousVersion=l}getText(t,i){return this.index.getText(t,i-t)}getLength(){return this.index.getLength()}getChangeRange(t){if(t instanceof N2r&&this.cache===t.cache)return this.version<=t.version?Js:this.cache.getTextChangesBetweenVersions(t.version,this.version)}},ure=class Kzt{constructor(){this.checkEdits=!1}absolutePositionOfStartOfLine(t){return this.lineNumberToInfo(t).absolutePosition}positionToLineOffset(t){const{oneBasedLine:i,zeroBasedColumn:o}=this.root.charOffsetToLineInfo(1,t);return{line:i,offset:o+1}}positionToColumnAndLineText(t){return this.root.charOffsetToLineInfo(1,t)}getLineCount(){return this.root.lineCount()}lineNumberToInfo(t){const i=this.getLineCount();if(t<=i){const{position:o,leaf:l}=this.root.lineNumberToInfo(t,0);return{absolutePosition:o,lineText:l&&l.text}}else return{absolutePosition:this.root.charCount(),lineText:void 0}}load(t){if(t.length>0){const i=[];for(let o=0;o<t.length;o++)i[o]=new Lce(t[o]);this.root=Kzt.buildTreeFromBottom(i)}else this.root=new bH}walk(t,i,o){this.root.walk(t,i,o)}getText(t,i){let o="";return i>0&&t<this.root.charCount()&&this.walk(t,i,{goSubtree:!0,done:!1,leaf:(l,d,m)=>{o=o.concat(m.text.substring(l,l+d))}}),o}getLength(){return this.root.charCount()}every(t,i,o){o||(o=this.root.charCount());const l={goSubtree:!0,done:!1,leaf(d,m,b){t(b,d,m)||(this.done=!0)}};return this.walk(i,o-i,l),!l.done}edit(t,i,o){if(this.root.charCount()===0)return ie.assert(i===0),o!==void 0?(this.load(Kzt.linesFromText(o).lines),this):void 0;{let l;if(this.checkEdits){const b=this.getText(0,this.root.charCount());l=b.slice(0,t)+o+b.slice(t+i)}const d=new wTt;let m=!1;if(t>=this.root.charCount()){t=this.root.charCount()-1;const b=this.getText(t,1);o?o=b+o:o=b,i=0,m=!0}else if(i>0){const b=t+i,{zeroBasedColumn:y,lineText:w}=this.positionToColumnAndLineText(b);y===0&&(i+=w.length,o=o?o+w:w)}if(this.root.walk(t,i,d),d.insertLines(o,m),this.checkEdits){const b=d.lineIndex.getText(0,d.lineIndex.getLength());ie.assert(l===b,"buffer edit mismatch")}return d.lineIndex}}static buildTreeFromBottom(t){if(t.length<vH)return new bH(t);const i=new Array(Math.ceil(t.length/vH));let o=0;for(let l=0;l<i.length;l++){const d=Math.min(o+vH,t.length);i[l]=new bH(t.slice(o,d)),o=d}return this.buildTreeFromBottom(i)}static linesFromText(t){const i=Ne(t);if(i.length===0)return{lines:[],lineMap:i};const o=new Array(i.length),l=i.length-1;for(let m=0;m<l;m++)o[m]=t.substring(i[m],i[m+1]);const d=t.substring(i[l]);return d.length>0?o[l]=d:o.pop(),{lines:o,lineMap:i}}},bH=class Qzt{constructor(t=[]){this.children=t,this.totalChars=0,this.totalLines=0,t.length&&this.updateCounts()}isLeaf(){return!1}updateCounts(){this.totalChars=0,this.totalLines=0;for(const t of this.children)this.totalChars+=t.charCount(),this.totalLines+=t.lineCount()}execWalk(t,i,o,l,d){return o.pre&&o.pre(t,i,this.children[l],this,d),o.goSubtree?(this.children[l].walk(t,i,o),o.post&&o.post(t,i,this.children[l],this,d)):o.goSubtree=!0,o.done}skipChild(t,i,o,l,d){l.pre&&!l.done&&(l.pre(t,i,this.children[o],this,d),l.goSubtree=!0)}walk(t,i,o){if(this.children.length===0)return;let l=0,d=this.children[l].charCount(),m=t;for(;m>=d;)this.skipChild(m,i,l,o,0),m-=d,l++,d=this.children[l].charCount();if(m+i<=d){if(this.execWalk(m,i,o,l,2))return}else{if(this.execWalk(m,d-m,o,l,1))return;let b=i-(d-m);for(l++,d=this.children[l].charCount();b>d;){if(this.execWalk(0,d,o,l,3))return;b-=d,l++,d=this.children[l].charCount()}if(b>0&&this.execWalk(0,b,o,l,4))return}if(o.pre){const b=this.children.length;if(l<b-1)for(let y=l+1;y<b;y++)this.skipChild(0,0,y,o,5)}}charOffsetToLineInfo(t,i){if(this.children.length===0)return{oneBasedLine:t,zeroBasedColumn:i,lineText:void 0};for(const d of this.children){if(d.charCount()>i)return d.isLeaf()?{oneBasedLine:t,zeroBasedColumn:i,lineText:d.text}:d.charOffsetToLineInfo(t,i);i-=d.charCount(),t+=d.lineCount()}const o=this.lineCount();if(o===0)return{oneBasedLine:1,zeroBasedColumn:0,lineText:void 0};const l=ie.checkDefined(this.lineNumberToInfo(o,0).leaf);return{oneBasedLine:o,zeroBasedColumn:l.charCount(),lineText:void 0}}lineNumberToInfo(t,i){for(const o of this.children){const l=o.lineCount();if(l>=t)return o.isLeaf()?{position:i,leaf:o}:o.lineNumberToInfo(t,i);t-=l,i+=o.charCount()}return{position:i,leaf:void 0}}splitAfter(t){let i;const o=this.children.length;t++;const l=t;if(t<o){for(i=new Qzt;t<o;)i.add(this.children[t]),t++;i.updateCounts()}return this.children.length=l,i}remove(t){const i=this.findChildIndex(t),o=this.children.length;if(i<o-1)for(let l=i;l<o-1;l++)this.children[l]=this.children[l+1];this.children.pop()}findChildIndex(t){const i=this.children.indexOf(t);return ie.assert(i!==-1),i}insertAt(t,i){let o=this.findChildIndex(t);const l=this.children.length,d=i.length;if(l<vH&&o===l-1&&d===1)return this.add(i[0]),this.updateCounts(),[];{const m=this.splitAfter(o);let b=0;for(o++;o<vH&&b<d;)this.children[o]=i[b],o++,b++;let y=[],w=0;if(b<d){w=Math.ceil((d-b)/vH),y=new Array(w);let A=0;for(let $=0;$<w;$++)y[$]=new Qzt;let F=y[0];for(;b<d;)F.add(i[b]),b++,F.children.length===vH&&(A++,F=y[A]);for(let $=y.length-1;$>=0;$--)y[$].children.length===0&&y.pop()}m&&y.push(m),this.updateCounts();for(let A=0;A<w;A++)y[A].updateCounts();return y}}add(t){this.children.push(t),ie.assert(this.children.length<=vH)}charCount(){return this.totalChars}lineCount(){return this.totalLines}},Lce=class{constructor(e){this.text=e}isLeaf(){return!0}walk(e,t,i){i.leaf(e,t,this)}charCount(){return this.text.length}lineCount(){return 1}},SYe=class I2r{constructor(t,i,o,l,d,m){this.telemetryEnabled=t,this.logger=i,this.host=o,this.globalTypingsCacheLocation=l,this.event=d,this.maxActiveRequestCount=m,this.activeRequestCount=0,this.requestQueue=Bn(),this.requestMap=new Map,this.requestedRegistry=!1,this.packageInstallId=0}isKnownTypesPackageName(t){var i;return xP.validatePackageName(t)!==xP.NameValidationResult.Ok?!1:(this.requestedRegistry||(this.requestedRegistry=!0,this.installer.send({kind:"typesRegistry"})),!!((i=this.typesRegistryCache)!=null&&i.has(t)))}installPackage(t){this.packageInstallId++;const i={kind:"installPackage",...t,id:this.packageInstallId},o=new Promise((l,d)=>{(this.packageInstalledPromise??(this.packageInstalledPromise=new Map)).set(this.packageInstallId,{resolve:l,reject:d})});return this.installer.send(i),o}attach(t){this.projectService=t,this.installer=this.createInstallerProcess()}onProjectClosed(t){this.installer.send({projectName:t.getProjectName(),kind:"closeProject"})}enqueueInstallTypingsRequest(t,i,o){const l=C4e(t,i,o);this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling throttled operation:${iO(l)}`),this.activeRequestCount<this.maxActiveRequestCount?this.scheduleRequest(l):(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Deferring request for: ${l.projectName}`),this.requestQueue.enqueue(l),this.requestMap.set(l.projectName,l))}handleMessage(t){var i,o;switch(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Received response:${iO(t)}`),t.kind){case Ehe:this.typesRegistryCache=new Map(Object.entries(t.typesRegistry));break;case eue:{const l=(i=this.packageInstalledPromise)==null?void 0:i.get(t.id);ie.assertIsDefined(l,"Should find the promise for package install"),(o=this.packageInstalledPromise)==null||o.delete(t.id),t.success?l.resolve({successMessage:t.message}):l.reject(t.message),this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case Ike:{const l={message:t.message};this.event(l,"typesInstallerInitializationFailed");break}case She:{const l={eventId:t.eventId,packages:t.packagesToInstall};this.event(l,"beginInstallTypes");break}case The:{if(this.telemetryEnabled){const m={telemetryEventName:"typingsInstalled",payload:{installedPackages:t.packagesToInstall.join(","),installSuccess:t.installSuccess,typingsInstallerVersion:t.typingsInstallerVersion}};this.event(m,"telemetry")}const l={eventId:t.eventId,packages:t.packagesToInstall,success:t.installSuccess};this.event(l,"endInstallTypes");break}case Zoe:{this.projectService.updateTypingsForProject(t);break}case Qoe:{for(this.activeRequestCount>0?this.activeRequestCount--:ie.fail("TIAdapter:: Received too many responses");!this.requestQueue.isEmpty();){const l=this.requestQueue.dequeue();if(this.requestMap.get(l.projectName)===l){this.requestMap.delete(l.projectName),this.scheduleRequest(l);break}this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Skipping defunct request for: ${l.projectName}`)}this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case nte:this.projectService.watchTypingLocations(t);break}}scheduleRequest(t){this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling request for: ${t.projectName}`),this.activeRequestCount++,this.host.setTimeout(()=>{this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Sending request:${iO(t)}`),this.installer.send(t)},I2r.requestDelayMillis,`${t.projectName}::${t.kind}`)}};SYe.requestDelayMillis=100;var TYe=SYe,CYe={};T(CYe,{ActionInvalidate:()=>Zoe,ActionPackageInstalled:()=>eue,ActionSet:()=>Qoe,ActionWatchTypingLocations:()=>nte,Arguments:()=>Che,AutoImportProviderProject:()=>H4e,AuxiliaryProject:()=>W4e,CharRangeSection:()=>x6e,CloseFileWatcherEvent:()=>Uxe,CommandNames:()=>lYe,ConfigFileDiagEvent:()=>Lxe,ConfiguredProject:()=>q4e,ConfiguredProjectLoadKind:()=>Z4e,CreateDirectoryWatcherEvent:()=>jxe,CreateFileWatcherEvent:()=>Bxe,Errors:()=>$4,EventBeginInstallTypes:()=>She,EventEndInstallTypes:()=>The,EventInitializationFailed:()=>Ike,EventTypesRegistry:()=>Ehe,ExternalProject:()=>wxe,GcTimer:()=>P4e,InferredProject:()=>V4e,LargeFileReferencedEvent:()=>Oxe,LineIndex:()=>ure,LineLeaf:()=>Lce,LineNode:()=>bH,LogLevel:()=>S4e,Msg:()=>T4e,OpenFileInfoTelemetryEvent:()=>G4e,Project:()=>t$,ProjectInfoTelemetryEvent:()=>Mxe,ProjectKind:()=>mY,ProjectLanguageServiceStateEvent:()=>Rxe,ProjectLoadingFinishEvent:()=>Fxe,ProjectLoadingStartEvent:()=>Pxe,ProjectService:()=>u6e,ProjectsUpdatedInBackgroundEvent:()=>Pce,ScriptInfo:()=>R4e,ScriptVersionCache:()=>Qxe,Session:()=>xYe,TextStorage:()=>L4e,ThrottledOperations:()=>I4e,TypingsInstallerAdapter:()=>TYe,allFilesAreJsOrDts:()=>U4e,allRootFilesAreJsOrDts:()=>j4e,asNormalizedPath:()=>RXe,convertCompilerOptions:()=>Fce,convertFormatOptions:()=>xH,convertScriptKindName:()=>$xe,convertTypeAcquisition:()=>Y4e,convertUserPreferences:()=>K4e,convertWatchOptions:()=>sre,countEachFileTypes:()=>rre,createInstallTypingsRequest:()=>C4e,createModuleSpecifierCache:()=>f6e,createNormalizedPathMap:()=>MXe,createPackageJsonCache:()=>p6e,createSortedArray:()=>N4e,emptyArray:()=>gg,findArgument:()=>MBe,formatDiagnosticToProtocol:()=>ore,formatMessage:()=>d6e,getBaseConfigFileName:()=>Axe,getDetailWatchInfo:()=>Hxe,getLocationInNewDocument:()=>g6e,hasArgument:()=>RBe,hasNoTypeScriptSource:()=>z4e,indent:()=>UX,isBackgroundProject:()=>ire,isConfigFile:()=>c6e,isConfiguredProject:()=>XN,isDynamicFileName:()=>_Y,isExternalProject:()=>nre,isInferredProject:()=>gH,isInferredProjectName:()=>k4e,isProjectDeferredClose:()=>are,makeAutoImportProviderProjectName:()=>A4e,makeAuxiliaryProjectName:()=>w4e,makeInferredProjectName:()=>D4e,maxFileSize:()=>Ixe,maxProgramSizeForNonTsFiles:()=>Nxe,normalizedPathToPath:()=>hH,nowString:()=>BBe,nullCancellationToken:()=>oYe,nullTypingsInstaller:()=>Oce,protocol:()=>F4e,scriptInfoIsContainedByBackgroundProject:()=>M4e,scriptInfoIsContainedByDeferredClosedProject:()=>B4e,stringifyIndented:()=>iO,toEvent:()=>_6e,toNormalizedPath:()=>B_,tryConvertScriptKindName:()=>zxe,typingsInstaller:()=>E4e,updateProjectIfDirty:()=>NT}),typeof console<"u"&&(ie.loggingHost={log(e,t){switch(e){case 1:return console.error(t);case 2:return console.warn(t);case 3:return console.log(t);case 4:return console.log(t)}}})})({get exports(){return f},set exports(_){f=_,n.exports&&(n.exports=_)}})})(T2r);var ijn=T2r.exports;const ajn=CV(ijn),Uie=new Map,Zzt=new Set;let P2r=[];const sjn=()=>{P2r=Array.from(Uie.entries()).map(([n,u])=>({pkg:n,status:u}))},F2r=()=>{sjn(),Zzt.forEach(n=>n())},Zbe=(n,u)=>{Uie.get(n)!==u&&(Uie.set(n,u),F2r())},ojn=n=>{Uie.has(n)&&(Uie.delete(n),F2r())},ujn=()=>Array.from(Uie.keys()),O2r=n=>Uie.has(n),cjn=n=>Uie.get(n),ljn=n=>(Zzt.add(n),()=>{Zzt.delete(n)}),Opr=()=>P2r,fjn=({currentImports:n,knownTypos:u,knownTyped:f})=>{for(const _ of ujn())n.has(_)||ojn(_);for(const _ of n)O2r(_)||(u.has(_)?Zbe(_,"not-found"):f.has(_)?Zbe(_,"typed"):Zbe(_,"loading"))},pjn=({expectedImports:n,receivedThisBatch:u})=>{for(const f of n)u.has(f)?Zbe(f,"typed"):cjn(f)==="loading"&&Zbe(f,"no-types")},djn=n=>{let u="",f=0,_=null;for(;f<n.length;){const v=n[f],T=n[f+1];if(_){if(v==="\\"){u+=v+(T??""),f+=2;continue}v===_&&(_=null),u+=v,f+=1;continue}if(v==='"'||v==="'"||v==="`"){_=v,u+=v,f+=1;continue}if(v==="/"&&T==="/"){for(;f<n.length&&n[f]!==`
1895
1895
  `;)f+=1;continue}if(v==="/"&&T==="*"){for(f+=2;f<n.length&&!(n[f]==="*"&&n[f+1]==="/");)f+=1;f+=2;continue}u+=v,f+=1}return u},_jn=n=>{const u=[],f=/\bimport\s+([^'"`;]+?)\s+from\s+['"]([^'"`]+)['"]/g;let _;for(;(_=f.exec(n))!==null;){const v=_[1].trim(),T=_[2];let I=null,M=v;const J=v.match(/^([A-Za-z_$][\w$]*)\s*(?:,\s*(.+))?$/);if(J&&!J[1].startsWith("{")&&!J[1].startsWith("*")&&(I=J[1],M=J[2]??""),I&&u.push({localName:I,reference:"default",source:T}),M=M.trim(),!M)continue;const W=M.match(/^\*\s+as\s+([A-Za-z_$][\w$]*)$/);if(W){u.push({localName:W[1],reference:"namespace",source:T});continue}const K=M.match(/^\{(.+)\}$/);if(K){const V=K[1].split(",");for(const ve of V){const ue=ve.trim();if(!ue||/^type\s/.test(ue))continue;const de=ue.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);de?u.push({localName:de[2],reference:{named:de[1]},source:T}):/^[A-Za-z_$][\w$]*$/.test(ue)&&u.push({localName:ue,reference:{named:ue},source:T})}}}return u},mjn=n=>{const u=new Set,f=n.split(`
1896
- `);for(const _ of f){if(/^\s/.test(_)||/^\s*(?:import|export)\b/.test(_))continue;let v=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*[=:;]/);if(v){u.add(v[1]);continue}if(v=_.match(/^function\s*\*?\s*([A-Za-z_$][\w$]*)/),v){u.add(v[1]);continue}if(v=_.match(/^class\s+([A-Za-z_$][\w$]*)/),v){u.add(v[1]);continue}if(v=_.match(/^async\s+function\s*\*?\s*([A-Za-z_$][\w$]*)/),v){u.add(v[1]);continue}}return u},hjn=n=>n.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),gjn=n=>{const u=djn(n),f=_jn(u),_=mjn(u),v=new Map;for(const I of f)v.set(I.localName,I);for(const I of v.keys())_.delete(I);if(v.size===0&&_.size===0)return"";const T=[];T.push("// Auto-generated by jsnote — do not edit."),T.push("// Mirrors the bundler's cross-cell scope for Monaco."),T.push("declare global {");for(const I of v.values()){const M=`'${hjn(I.source)}'`;I.reference==="default"?T.push(` const ${I.localName}: typeof import(${M}).default;`):I.reference==="namespace"?T.push(` const ${I.localName}: typeof import(${M});`):T.push(` const ${I.localName}: typeof import(${M}).${I.reference.named};`)}for(const I of _)T.push(` const ${I}: any;`);return T.push("}"),T.push("export {};"),T.join(`
1897
- `)},xjn="__notebook__.d.ts",yjn=400,vjn=n=>{const u=[/\/v1\/package\/resolve\/npm\/(@[^/]+\/[^/?@]+|[^/?@]+)/,/\/v1\/package\/npm\/(@[^/]+\/[^/?@]+|[^/?@]+)/,/cdn\.jsdelivr\.net\/npm\/(@[^/@]+\/[^/@]+|[^/@]+)/,/unpkg\.com\/(@[^/]+\/[^/?@]+|[^/?@]+)/];for(const f of u){const _=n.match(f);if(_)return _[1]}return null},bjn=n=>{const u=n.match(/^\/node_modules\/(@types\/)?(.+?)(\/.*)?$/);if(!u)return null;const f=u[2];if(!!!u[1]){if(f.startsWith("@")){const v=f.split("/");return v.length>=2?`${v[0]}/${v[1]}`:f}return f.split("/")[0]}return f.includes("__")?`@${f.replace("__","/")}`:f},Ejn=()=>{const n=qw(({cells:{order:M,data:J}})=>M.map(W=>J[W]).filter(W=>W.type==="code").map(W=>W.content).join(`
1896
+ `);for(const _ of f){if(/^\s/.test(_)||/^\s*(?:import|export)\b/.test(_))continue;let v=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*[=:;]/);if(v){u.add(v[1]);continue}if(v=_.match(/^function\s*\*?\s*([A-Za-z_$][\w$]*)/),v){u.add(v[1]);continue}if(v=_.match(/^class\s+([A-Za-z_$][\w$]*)/),v){u.add(v[1]);continue}if(v=_.match(/^async\s+function\s*\*?\s*([A-Za-z_$][\w$]*)/),v){u.add(v[1]);continue}}return u},hjn=n=>n.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),gjn=n=>{const u=djn(n),f=_jn(u),_=mjn(u),v=new Map;for(const I of f)v.set(I.localName,I);for(const I of v.keys())_.delete(I);if(v.size===0&&_.size===0)return"";const T=[];T.push("// Auto-generated by jsnote — do not edit."),T.push("// Mirrors the bundler's cross-cell scope for Monaco."),T.push(n),T.push(""),T.push("declare global {");for(const I of v.values()){const M=`'${hjn(I.source)}'`;I.reference==="default"?T.push(` const ${I.localName}: typeof import(${M}).default;`):I.reference==="namespace"?T.push(` const ${I.localName}: typeof import(${M});`):T.push(` const ${I.localName}: typeof import(${M}).${I.reference.named};`)}for(const I of _)T.push(` const ${I}: typeof ${I};`);return T.push("}"),T.push("export {};"),T.join(`
1897
+ `)},xjn="__notebook__.tsx",yjn=400,vjn=n=>{const u=[/\/v1\/package\/resolve\/npm\/(@[^/]+\/[^/?@]+|[^/?@]+)/,/\/v1\/package\/npm\/(@[^/]+\/[^/?@]+|[^/?@]+)/,/cdn\.jsdelivr\.net\/npm\/(@[^/@]+\/[^/@]+|[^/@]+)/,/unpkg\.com\/(@[^/]+\/[^/?@]+|[^/?@]+)/];for(const f of u){const _=n.match(f);if(_)return _[1]}return null},bjn=n=>{const u=n.match(/^\/node_modules\/(@types\/)?(.+?)(\/.*)?$/);if(!u)return null;const f=u[2];if(!!!u[1]){if(f.startsWith("@")){const v=f.split("/");return v.length>=2?`${v[0]}/${v[1]}`:f}return f.split("/")[0]}return f.includes("__")?`@${f.replace("__","/")}`:f},Ejn=()=>{const n=qw(({cells:{order:M,data:J}})=>M.map(W=>J[W]).filter(W=>W.type==="code").map(W=>W.content).join(`
1898
1898
  `)),u=Oo.useRef(null),f=Oo.useRef(null),_=Oo.useRef(new Set),v=Oo.useRef(new Set),T=Oo.useRef(new Set),I=Oo.useRef(n);I.current=n,Oo.useEffect(()=>{Hwn(M=>{u.current||(u.current=tjn({typescript:ajn,logger:{log:()=>{},error:()=>{},groupCollapsed:()=>{},groupEnd:()=>{}},fetcher:async(J,W)=>{const K=await fetch(J,W);if(K.status===404){const V=typeof J=="string"?J:J instanceof Request?J.url:String(J),ve=vjn(V);ve&&O2r(ve)&&(Zbe(ve,"not-found"),T.current.add(ve))}return K},delegate:{receivedFile:(J,W)=>{Jwn(W,J);const K=bjn(W);K&&(_.current.add(K),v.current.add(K))},finished:()=>{pjn({expectedImports:new Set(vcr(I.current)),receivedThisBatch:_.current}),_.current=new Set,M.editor.getEditors().forEach(J=>{J.trigger("ata","editor.action.triggerParameterHints",{})})}}}))})},[]),Oo.useEffect(()=>(f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{const M=u.current;M&&(fjn({currentImports:new Set(vcr(n)),knownTypos:T.current,knownTyped:v.current}),M(n),qwn(xjn,gjn(n)))},yjn),()=>{f.current&&clearTimeout(f.current)}),[n])},Sjn=()=>{JBn(),Ejn();const n=qw(({cells:{order:W,data:K}})=>W.map(V=>K[V])),u=qw(({cells:W})=>W.loading),{fetchCells:f,saveCells:_,focusCell:v,updateCell:T}=Wie(),I=Y$t();Oo.useEffect(()=>{f()},[f]),Oo.useEffect(()=>{const W=K=>{const V=K.target;V&&(V.closest("[data-cell-wrapper]")||v(null))};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[v]),Oo.useEffect(()=>{const W=K=>{if(!(K.metaKey||K.ctrlKey)||K.key!=="s")return;K.preventDefault();const V=I.getState().cells;N1r(V.data,T),_()};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[_,T,I]);const M=!u&&n.length===0,J=n.map((W,K)=>ii.jsxs(Oo.Fragment,{children:[ii.jsx(zBn,{cell:W,index:K+1}),ii.jsx(Xjt,{previousCellId:W.id})]},W.id));return M?ii.jsx("div",{className:"w-full px-4 sm:px-6 pb-14 flex flex-col items-center",children:ii.jsxs("div",{className:"w-full max-w-4xl flex flex-col gap-10 sm:gap-14",children:[ii.jsxs("section",{className:"border-2 border-zine-border rounded-[2px] bg-zine-surface/30 overflow-hidden",children:[ii.jsxs("header",{className:"flex items-center justify-between border-b-2 border-zine-border bg-zine-bg/70 px-4 sm:px-5 h-10 select-none",children:[ii.jsxs("p",{className:"text-[10px] uppercase tracking-[0.22em] font-medium",children:[ii.jsx("span",{className:"text-zine-accent",children:"$"}),ii.jsx("span",{className:"text-zine-ink-2 ml-2.5",children:"jsnote new"})]}),ii.jsxs("span",{className:"text-[10px] uppercase tracking-[0.22em] font-medium text-zine-alt",children:[ii.jsx("span",{className:"text-zine-ink-3",children:"["}),"new file",ii.jsx("span",{className:"text-zine-ink-3",children:"]"})]})]}),ii.jsxs("div",{className:"px-5 sm:px-10 py-8 sm:py-10",children:[ii.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-4 sm:gap-x-8 gap-y-2.5 text-xs sm:text-sm mb-8",children:[ii.jsx("dt",{className:"text-zine-ink-3 uppercase tracking-[0.18em] text-[10px] sm:text-[11px] pt-0.5",children:"notebook"}),ii.jsx("dd",{className:"text-zine-ink-2 font-mono break-all",children:"./notebook.js"}),ii.jsx("dt",{className:"text-zine-ink-3 uppercase tracking-[0.18em] text-[10px] sm:text-[11px] pt-0.5",children:"runtime"}),ii.jsxs("dd",{className:"text-zine-ink-2",children:["esbuild-wasm ",ii.jsx("span",{className:"text-zine-border mx-1",children:"·"})," ","sandboxed iframe"]}),ii.jsx("dt",{className:"text-zine-ink-3 uppercase tracking-[0.18em] text-[10px] sm:text-[11px] pt-0.5",children:"persist"}),ii.jsxs("dd",{className:"text-zine-ink-2",children:["auto ",ii.jsx("span",{className:"text-zine-border mx-1",children:"·"})," ",ii.jsxs("kbd",{className:"inline-flex items-center gap-1",children:[ii.jsx("span",{className:"inline-flex items-center justify-center min-w-[20px] h-5 px-1 rounded-[2px] border border-zine-border bg-zine-bg text-zine-accent font-mono text-[10px] leading-none",children:"⌘"}),ii.jsx("span",{className:"inline-flex items-center justify-center min-w-[20px] h-5 px-1 rounded-[2px] border border-zine-border bg-zine-bg text-zine-accent font-mono text-[10px] leading-none",children:"s"})]})," ","to force-save"]}),ii.jsx("dt",{className:"text-zine-ink-3 uppercase tracking-[0.18em] text-[10px] sm:text-[11px] pt-0.5",children:"render"}),ii.jsxs("dd",{className:"text-zine-ink-2",children:["call"," ",ii.jsx("code",{className:"text-zine-accent font-mono",children:"show()"})," on any value, object, or component"]})]}),ii.jsxs("div",{"aria-hidden":"true",className:"flex items-center gap-3 mb-8 text-zine-border select-none",children:[ii.jsx("span",{className:"text-[10px]",children:"├"}),ii.jsx("span",{className:"flex-1 border-t border-dashed border-zine-border"}),ii.jsx("span",{className:"text-[10px] uppercase tracking-[0.22em] text-zine-ink-3",children:"bootstrap"}),ii.jsx("span",{className:"flex-1 border-t border-dashed border-zine-border"}),ii.jsx("span",{className:"text-[10px]",children:"┤"})]}),ii.jsxs("p",{className:"text-[11px] sm:text-xs uppercase tracking-[0.22em] text-center mb-5",children:[ii.jsx("span",{className:"text-zine-accent",children:"▸"}),ii.jsx("span",{className:"text-zine-ink-2 ml-3",children:"add your first cell to begin"})]}),ii.jsx("div",{className:"flex justify-center",children:ii.jsx(Xjt,{forceVisible:!0,previousCellId:null})})]})]}),ii.jsx(v2r,{}),ii.jsx("footer",{className:"text-center pb-4 select-none",children:ii.jsxs("p",{className:"text-[10px] uppercase tracking-[0.28em] text-zine-ink-3",children:[ii.jsx("span",{className:"text-zine-border",children:"└"}),ii.jsx("span",{className:"mx-3",children:"end of transmission"}),ii.jsx("span",{className:"text-zine-border",children:"┘"})]})})]})}):ii.jsxs("div",{className:"mx-[25px]",children:[ii.jsx(Xjt,{previousCellId:null}),J]})},Tjn=n=>{const u=Math.floor(n/1e3);if(u<5)return"just now";if(u<60)return`${u}s ago`;const f=Math.floor(u/60);return f<60?`${f}m ago`:`${Math.floor(f/60)}h ago`},Kjt=({label:n,tone:u})=>{const f=u==="error"||u==="active"?"text-zine-accent":"text-zine-ink-2";return ii.jsxs("span",{className:`font-medium tracking-[0.18em] ${f}`,children:[ii.jsx("span",{className:"text-zine-ink-3",children:"["}),n,ii.jsx("span",{className:"text-zine-ink-3",children:"]"})]})},Cjn=()=>{const n=qw(T=>T.cells.saving),u=qw(T=>T.cells.lastSavedAt),f=qw(T=>T.cells.error),[,_]=Oo.useState(Date.now());Oo.useEffect(()=>{const T=setInterval(()=>_(Date.now()),5e3);return()=>clearInterval(T)},[]);const v="fixed top-3 right-4 z-30 inline-flex items-center gap-2 h-7 px-2.5 rounded-[2px] text-[10px] uppercase bg-zine-bg/80 backdrop-blur-sm border-2 border-zine-border text-zine-ink-2 pointer-events-none select-none";return n?ii.jsxs("div",{className:v,role:"status","aria-live":"polite",children:[ii.jsx(Kjt,{label:"saving",tone:"active"}),ii.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-zine-accent animate-pulse"})]}):f?ii.jsxs("div",{className:v,role:"status","aria-live":"polite",children:[ii.jsx(Kjt,{label:"error",tone:"error"}),ii.jsx("span",{className:"normal-case tracking-normal text-zine-ink-3 truncate max-w-[14rem]",children:f})]}):u?ii.jsxs("div",{className:v,role:"status","aria-live":"polite",children:[ii.jsx(Kjt,{label:"saved",tone:"idle"}),ii.jsx("span",{className:"normal-case tracking-normal text-zine-ink-3",children:Tjn(Date.now()-u)})]}):null},Lpr="fixed top-3 right-44 z-30 inline-flex items-center gap-2 h-7 px-2.5 rounded-[2px] text-[10px] uppercase bg-zine-bg/80 backdrop-blur-sm border-2 border-zine-border text-zine-ink-2 pointer-events-none select-none max-w-[60vw]",Rpr=({children:n,tone:u="idle"})=>ii.jsxs("span",{className:`font-medium tracking-[0.18em] ${u==="active"?"text-zine-accent":"text-zine-ink-2"}`,children:[ii.jsx("span",{className:"text-zine-ink-3",children:"["}),n,ii.jsx("span",{className:"text-zine-ink-3",children:"]"})]}),kjn=()=>{const n=Oo.useSyncExternalStore(ljn,Opr,Opr);if(n.length===0)return null;const u=n.filter(I=>I.status==="loading"),f=n.filter(I=>I.status==="typed"),_=n.filter(I=>I.status==="no-types"),v=n.filter(I=>I.status==="not-found");if(u.length>0){const I=u.length===1?`${u[0].pkg} ↓`:`${u.length} packages ↓`;return ii.jsxs("div",{className:Lpr,role:"status","aria-live":"polite",children:[ii.jsx(Rpr,{tone:"active",children:"types"}),ii.jsx("span",{className:"normal-case tracking-normal text-zine-accent truncate",children:I}),ii.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-zine-accent animate-pulse motion-reduce:animate-none"})]})}const T=[];return T.push(ii.jsxs("span",{children:[ii.jsx("span",{className:"text-zine-alt",children:f.length})," typed"]},"typed")),v.length>0&&T.push(ii.jsxs("span",{children:[ii.jsx("span",{className:"text-zine-accent",children:v.length})," not found"]},"not-found")),_.length>0&&T.push(ii.jsxs("span",{children:[ii.jsx("span",{className:"text-zine-ink-2",children:_.length})," no types"]},"no-types")),ii.jsxs("div",{className:Lpr,role:"status","aria-live":"polite",children:[ii.jsx(Rpr,{children:"types"}),ii.jsx("span",{className:"normal-case tracking-normal text-zine-ink-3",children:T.map((I,M)=>ii.jsxs("span",{children:[M>0&&ii.jsx("span",{className:"text-zine-border mx-2",children:"·"}),I]},M))})]})},Djn=()=>ii.jsxs("header",{className:"w-full px-4 sm:px-6 pt-8 sm:pt-12 pb-6 sm:pb-10 text-center select-none",children:[ii.jsx("pre",{"aria-hidden":"true",className:"hidden sm:block text-zine-accent text-[10px] md:text-[11px] leading-[1.05] font-mono whitespace-pre overflow-x-auto mx-auto",children:` ██╗███████╗███╗ ██╗ ██████╗ ████████╗███████╗
1899
1899
  ██║██╔════╝████╗ ██║██╔═══██╗╚══██╔══╝██╔════╝
1900
1900
  ██║███████╗██╔██╗ ██║██║ ██║ ██║ █████╗
package/build/index.html CHANGED
@@ -33,7 +33,7 @@
33
33
  browser: true,
34
34
  };
35
35
  </script>
36
- <script type="module" crossorigin src="/assets/index-Cvozqz1l.js"></script>
36
+ <script type="module" crossorigin src="/assets/index-sF11BWRi.js"></script>
37
37
  <link rel="stylesheet" crossorigin href="/assets/index-zM5UP17a.css">
38
38
  </head>
39
39
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsnote-zeina/local-client",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },