{"version":3,"sources":["components/config.js","components/Home.js","components/utils.js","queries/questionTitleQuery.js","components/Spinner.js","reducers/searchExpressionsListReducer.js","actions/searchExpressionsListActions.js","reducers/searchAuthorsListReducer.js","actions/searchAuthorsListActions.js","reducers/searchWorkGroupsListReducer.js","actions/searchWorkGroupsListActions.js","reducers/searchExpressionTypesListReducer.js","components/Search3Parameters.js","actions/searchExpressionTypesListActions.js","components/searchUtils.js","components/Search3.js","components/Print.js","components/Queries.js","components/TextOutline.js","components/TextOutlineWrapper.js","components/OSDInstance.js","components/Image.js","components/LineText.js","components/ImageTextWrapper.js","components/ImageLogo.js","components/Surface2.js","components/XmlView.js","components/Window/WindowNavBar.js","components/NextPrevBar.js","components/TextCompareItem.js","components/TextCompare.js","queries/ngramRelatedQuery.js","components/NgramDisplay.js","components/TextCompareWrapper.js","components/PersonInfo.js","queries/personInfoQuery.js","components/Comments2TagSuggestions.js","components/Comment2Create.js","components/Comment2Item.js","components/Comments2ImportExport.js","firebase/firebase.js","components/Comments2.js","components/Citation.js","components/CitationExplanation.js","components/ManifestationList.js","components/CitationWrapper.js","components/CodexToc.js","components/TextPreviewWrapper.js","queries/TextPreviewWrapperQueries.js","components/SurfaceInfo.js","queries/SurfaceInfoQuery.js","components/WorkGroupInfo.js","components/Dictionary.js","components/Window/WindowUtil.js","components/Window/Window2.js","components/MemberBanner.js","components/TextNavBar.js","components/Text.js","components/Item.js","components/AuthorCollection.js","components/VersionChain.js","components/Collection.js","components/Surface3.js","components/Surface3Wrapper.js","components/Codex.js","components/ExpressionType.js","queries/expressionTypeQuery.js","components/TextWrapper.js","components/TextArticle.js","components/ResourceTypeList.js","queries/resourceTypeQuery.js","components/TextSwitch.js","components/About.js","components/LoginPage.js","components/NavBar.js","components/Footer.js","components/AppRouter.js","serviceWorker.js","i18n.js","index.js"],"names":["sparqlEndpoint","Home","props","t","useTranslation","console","log","className","Container","id","fluid","Jumbotron","Button","to","style","color","loadXMLDoc","url","Promise","resolve","req","XMLHttpRequest","open","XSLTProcessor","responseType","e","onload","this","responseXML","send","convertXMLDoc","xmlurl","xslurl","reject","all","then","data","xsltProcessor","importStylesheet","resultDocument","transformToFragment","document","reason","Error","copyToClipboard","string","dummy","createElement","body","appendChild","value","select","execCommand","removeChild","runQuery","query","Axios","get","params","scrollToParagraph","hash","highlight","element","$","addClass","removeClass","children","includes","setTimeout","length","stop","animate","scrollTop","offset","top","nodeFilterCheck","node","check","parentElement","NodeFilter","FILTER_REJECT","nodeValue","FILTER_ACCEPT","cleanText","selectedText","replace","getInstanceNumber","wordArray","wordPosition","number","i","getStringBeforeWord","text","word","instanceNumber","first","splitText","split","join","goToGitHubEdit","selectedElementTargetId","newRawUrl","d","findElement","newLineCount","afterText","regexp","RegExp","getLineNumber","editUrl","window","textReduce","wordRange","wordTokenStart","wordTokenEnd","filter","Boolean","slice","questionTitleQuery","searchParameters","searchTerm","workGroupQuery","searchWorkGroup","expressionTypeQuery","searchEType","authorQuery","searchAuthor","eidQuery","searchEid","Spinner","animation","role","variant","searchExpressionsListReducer","state","action","type","expressions","fetchExpressionsList","dispatch","workGroupSparql","expressionAuthorTypeSparql","expressionAuthorType","authorSparql","res","searchWorks","results","bindings","map","result","expression","expressionShortId","expressionTitle","workGroup","workGroupTitle","author","authorTitle","searchAuthorsListReducer","authors","fetchAuthorsList","authorShortId","completeAuthorsFetch","searchWorkGroupsListReducer","workGroups","fetchWorkGroupsList","completeWorkGroupsListFetch","searchExpressionTypesListReducer","expressionTypes","Search3Parameters","useState","searchType","setSearchType","setSearchTerm","setSearchAuthor","setSearchEid","setSearchEType","setSearchWorkGroup","resultsFilter","setResultsFilter","useReducer","searchExpressionTypesList","searchExpressionTypesListDispatch","searchExpressionsList","searchExpressionsListDispatch","searchAuthorsList","searchAuthorsListDispatch","searchWorkGroupsList","searchWorkGroupsListDispatch","displayAllParameters","setDisplayAllParameters","availableFigureTagsList","sort","useEffect","handleSetSearchParameters","searchExpressionsListActions","searchAuthorsListActions","searchWorkGroupsListActions","expressionType","expressionTypeTitle","completeExpressionTypesListFetch","searchExpressionTypesListActions","InputGroup","size","Prepend","Text","Form","Control","as","placeholder","onChange","target","ft","content","key","showAdvancedParameters","onClick","retrieveSearchResults","searchETypeId","workGroupShortId","expressionTypeShortId","queryParameters","push","displayTextResults","idTitleMap","textResults","r","textString","previous","hit","next","range","start","end","longTitle","pid","dangerouslySetInnerHTML","__html","displayQuestionResults","displayResults","resource","qtitle","toLowerCase","toUpperCase","Search3","urlParams","URLSearchParams","location","search","defaultSearchTerm","undefined","defaultSearchWorkGroup","setSearchParameters","setResults","questionResults","setQuestionResults","setIdTitleMap","setOffset","showMore","setShowMore","filterQuestionResults","filterResults","getValueLongTitlesAndAuthors","forEach","b","createIdTitleMap","Array","isArray","moreResults","handleRunSearch","preventDefault","newResults","combinedString","hidden","onSubmit","parameters","showLabels","showSubmit","marginRight","figureResults","imgurl","src","alt","displayFigureResults","defaultProps","Print","getPdf","bind","status","pdf","printApiUrlBase","hashWithExtension","setState","Status","prevProps","newUrl","width","height","href","React","Component","basicInfoQuery","itemExpressionUri","partsInfoQuery","resourceurl","getSurfaceInfo","surfaceid","getCodexInfo","codexid","getCodexInfoFromManifest","manifestid","getCodexInfoFromSurface","getCodexInfoFromCanvas","canvasid","TextOutline","handleToggleChildren","mounted","parts","showChildren","isPartOf","prevState","resourceid","getChildParts","newData","part","title","level","structureType","questionTitle","isPartOfId","isPartOfTitle","retrieveParts","membersOf","displayChildren","p","bold","focusResourceid","showFirstLevelChildren","mtFocus","showAuthor","collectionLink","showParentLink","indent","rel","TextOutlineWrapper","getMembersOf","memberOf","retrieveMembersOf","OSDInstance","instance","setInstance","w","h","viewerWidthHeight","setViewerWidthHeight","uuidv4","viewerId","coords","computeViewerWidthHeight","imageurl","addTiledImage","tileSource","sc","getScalarCoordinates","rect","OpenSeadragon","Rect","x","y","setBounds","setOverlay","lineFocusCoords","lsc","linerect","setGoHome","viewport","fitBounds","prefixUrl","preserveViewport","visibilityRatio","minZoomLevel","defaultZoomLevel","tileSources","controlsFadeDelay","controlsFadeLength","addHandler","elt","addOverlay","goHome","inputCoords","imageH","imageW","ar","parseInt","displayWidth","Image","imageUrl","LineText","label","ImageTextWrapper","searchText","targetLabel","canvas","canvasShort","ImageLogo","logoUrl","setLogoUrl","logo","catch","error","margin","Surface2","mount","handleNext","handlePrevious","handleLineFocusNext","handleLineFocusPrev","isLineNumberLast","isLineNumberFirst","handleToggleTextLines","handleToggleAllLines","currentSurfaceId","manifest","region","annotationsDisplay","showAllLines","handleSurfaceFocusChange","alUrl","d2","surfaceTitle","next_surface","previous_surface","annotations","resources","currentLineNumber","lineFocusId","newLineArray","pop","toString","handleLineFocusChange","previousLineArray","total","retrieveSurfaceInfo","displayImage","chars","on","surfaceButton","imageTextWrappers","displayImages","XmlView","retrieveXML","xmlstring","tresourceid","language","docco","showLineNumbers","WindowNavBar","Nav","availableTabs","idx","show","Item","name","Link","active","windowLoad","desc","handleTabChange","windowId","icon","openWidthHeight","handleMinimize","handleMiddlize","handleMaximize","handleClose","altWindowState","handleDuplicateWindow","windowType","NextPrevBar","customResourceTarget","setCustomResourceTarget","showCustomResourceTarget","setShowCustomResourceTarget","handleUpArrow","selectionRange","handleBlockFocusChange","info","parent","topLevel","display","justifyContent","FormControl","onKeyPress","charCode","handleFocusChange","handelOnEnterPress","TextCompareItem","handleToggleShow","handleToggleCompare","showCompare","showCompareType","compareText","rawText","levenshteinDistance","usedBase","usedCompareTranscription","showImage","punctuationless","base","transcription","reducedText","isMainText","targetRange","relationLabel","isRelatedToRange","dmp","Diff","diff_match_patch","diff","diff_main","textClean","diff_cleanupSemantic","diff_levenshtein","compareDisplayHtml","getHtmlDiff","compare","diff_prettyHtml","compareTranscription","showImages","createCompare","newManifestations","manifestation","manifestationTitle","manifestations","focusedManifestation","surfaceWidth","hideSelectionList","isDependentSurface3","startWord","endWord","isBase","levenNum","heatColor","borderLeft","paddingLeft","handleChangeBase","compareTranscriptionDoc","fontSize","ref","displayComparison","TextCompare","handleToggleShowAll","handleToggleShowAllImages","baseText","manifestationCTranscription","transcriptionDoc","manifestationCTranscriptionDoc","inbox","cdoc","cxml","topLevelExpression","cmanifestation","ctranscription","arrangeTextInfo","getTextInfo","expressionid","relatedExpressions","padding","referringResource","handleShowCollationOverlay","fullEid","handleAddCtRelatedExpressions","m","runNgramQuery","createExpressionsList","count","NgramDisplay","setRelatedExpressions","intersectionTotal","setIntersectionTotal","tokenizedText","ngramArray","ngramId","ngramIds","ngramFragmentQuery","ngramRelatedQuery","displayExpressions","index","marked","markedExpressions","find","parentBlock","marginLeft","TextCompareWrapper","handleCustomUpdateRelatedExpressions","handleSetCustomExpressionId","handleToggleAllChildren","handleToggleAllChildrenImages","getText","expressionsCumulative","page","intendedPage","pagesize","nextPage","previousPage","rangeStart","rangeEnd","customExpressionId","customExpressionObject","showAllChildren","showAllChildrenImages","expressionObject","newExpressions","_this","rangeFilter","getRelatedExpressions","bindings2","isRelatedTo","isRelatedToRangeStart","isRelatedToRangeEnd","concat","startPage","newExpression","displayPagination","Object","keys","inline","PersonInfo","setAuthorTitle","authorImageUrl","setAuthorImageUrl","authorDescription","setAuthorDescription","birthDate","setAuthorBirthDate","deathDate","setAuthorDeathDate","mentionedByFrequency","setMentionedByFrequency","mentionsFrequency","setMentionsFrequency","personid","pd","personTitle","wikidataid","getWikiDataInfo","fd","sortFrequencyResults","item","getPersonMentionsFrequency","a","nameA","nameB","wikidataShortId","wd","imageslug","entities","claims","P18","mainsnak","datavalue","description","descriptions","P569","time","P570","d3","pages","imageinfo","Comments2TagSuggestions","tags","tagFilter","setTagFilter","handleOnClickTag","placeHolderText","tagsList","Comment2Create","comment","setComment","motivation","setMotivation","editedTextDefault","textEdited","editedText","setEditedText","noTarget","setNoTarget","orderNumber","inputTags","setInputTags","rows","checked","newInputTags","ot","handleDropTag","availableTagsList","commentType","submitComment","block","Comment2Item","editable","setEditable","source","selectedFragment","selectedFragmentRange","selector","exact","editedValue","getTagOrderNumber","annoid","annoShortId","order","update","updateComment","tagsWithOrder","fullTag","getTagsWithOrderNumbers","link","match","strings","l","linkComponent","linkCopy","prunedString","addSCTALinksToValue","created","removeComment","ImportExport","newListUrl","setNewListUrl","showImport","setShowImport","pdfStatus","setPdfStatus","handleGetPdfStatus","post","printApiEndpoint","currentList","reader","FileReader","readAsText","files","fileName","list","handleImportList","JSON","parse","stringify","encodeURI","packageData","download","currentListName","Date","toISOString","firebase","apiKey","authDomain","databaseURL","projectId","storageBucket","messagingSenderId","appId","measurementId","db","googleAuthProvider","GoogleAuthProvider","Comments2","lists","setLists","filterTags","setFilterTags","setAnnotations","setTags","showFocusComments","setShowFocusComments","commentFilter","setCommentFilter","mentionedBy","setMentionedBy","userId","setUserId","tagsToDelete","setTagsToDelete","showManageTags","setShowManageTags","once","snapshot","dbResult","val","generateTagList","akey","tagsPerComment","tagsOrderMap","tagid","tagsNewList","nt","generateAnnoTagBlock","tagsBlock","prefixedId","handleAddSingleFilterTag","clonedAnnotations","affectedTags","clonedTags","at","targetComment","getMentionedBy","c","set","generateFullList","fullList","newAnnotations","every","k","annoId","dateObject","selectorText","annotation","esource","annotationsNewList","textEdit","disabled","newFilterTags","handleDropFilterTag","displayComments","focused","handleOnClickComment","newTagsToDelete","handleDropTagToDelete","tagsToRemove","modifiedAnnos","annosToModify","alert","handleRemoveTags","Comments2ImportExport","listname","parsedList","Citation","eurl","etitle","murl","mtitle","turl","fetching","transcriptionid","allBindings","manifestationid","eLongTitle","editorTitle","editor","datasource","codexTitle","retrieveCitation","fullCitationString","CitationExplanation","toggleCitationExplanation","showCitationExplanation","ManifestationList","toggleAlternativeManifestations","showAlternativeManifestations","optionalDisplay","displayManifestations","propTypes","PropTypes","isRequired","array","bool","func","CitationWrapper","CodexToc","items","setItems","codexResourceType","surface","unique","v","indexOf","expressionList","item_expression_title","surface_title","item_expression_question_title","displayItems","TextPreviewWrapper","handleToggleShowTokenPosition","showTokenPosition","textPreviewResourceId","getTranscriptionId","textPreviewStart","textPreviewEnd","referringRange","referringSelectionRange","handleTextPreviewFocusChange","context","SurfaceInfo","handleToggleRelatedDiscussion","handleSurface3Manifestations","handleToggleShowQuery","handleToggleShowImages","surfaceMap","showTextRegion","showQuery","eid","codexSlug","surface3FocusedManifestation","surface3Manifestations","showComments","showRelatedSurfaces","responseData","mShort","handleToggleRelatedSurfaces","WorkGroupInfo","Dictionary","dictionary","getAvailableComponents","resourceType","showComponents","Window2","handleToggleTextLinesView","handleChangeManifestation","mountStatus","textCompare","surface3","comments","xml","textOutline","citation","collationTableWithRange","view","manifestationSlug","newMountStatus","tempNewMount","focus","handleSwitchWindow","focusSet","displayComponents","getAvailableTabs","defaultManifestationSlug","itemFocus","textPreviewObjects","expressionIds","ctRelatedExpressions","handleOnSegDoubleClick","displayChild","MemberBanner","ipAddress","setIpAddress","ipAddressRange","setIpAddressRange","getIp","ip","ipRangeLogoMap","memberInfo","indexValue","Math","floor","random","keyValue","getMemberInfo","linkUrl","withTranslation","Navbar","bg","expand","fixed","Toggle","aria-controls","Collapse","pdfView","handleTogglePdfView","retrieveText","handleShowToolTip","handleHideToolTip","handleHideFootnoteToolTip","handleShowFootnoteToolTip","handleOnToolTipClick","selectionCoords","doc","scrollTo","docFragment","topLevelFragment","getElementById","innerHTML","setEvents","mark","sel","getSelection","rangeCount","rng","getRangeAt","pAncestor","nodeType","tagName","getContainingP","commonAncestorContainer","cnt","cloneContents","remove","textContent","clone","startOffset","startContainer","selectionText","precedingTextLength","n","getRangeWordCount","root","endContainer","endOffset","ownerDocument","createRange","setStart","setEnd","oRect","getBoundingClientRect","click","attr","setFocus","openWindow","markWithElement","figureid","paragraphid","closest","ln","html","footnoteOffset","footnoteText","targetText","targetParagraph","splitTargetId","splitTargetRange","targetObjects","addEventListener","markElementRemove","container","startWordOffset","endWordOffset","nodeIter","createNodeIterator","SHOW_TEXT","breaks","wordLength","nextNode","previousSibling","getAttribute","nodeTextArray","newWordLength","toRange","extractContents","backgroundColor","insertNode","handleUpdateSelectionRange","contents","unwrap","s","ReactTooltip","hide","fooRef","foonoteRef","scrollToNew","displayText","position","left","data-tip","data-for","clickable","place","AuthorCollection","retrieveAuthorCollectionInfo","handleItemFilter","itemFilter","createRef","authorArticles","textArticles","itemsPromise","err","authorCollectionInfo","arrangeItems","refs","Table","striped","bordered","hover","VersionChain","getVersionHistory","handleToggleShowVersions","versions","currentVersion","showVersions","transcriptionUri","reviewUrl","reviewObject","img_url","reviewid","ipfsHash","html_link","rubric_link","summary","newVersion","versionTranscription","version","versionLabel","version_label","versionOrderNumber","order_number","versionReview","review","versionDoc","versionReviewInfo","Alert","currentlyViewing","gitHubEdit","gitHubIssues","displayAlert","Collection","retrieveCollectionInfo","makeRequests","handleFilter","partsPromise","partsObject","pId","partTitle","partType","partQuestionTitle","partLevel","itemsObject","itemId","itemTitle","itemType","itemQuestionTitle","itemAuthor","itemAuthorTitle","cm","cmTitle","ct","expressionsInfo","partsInfo","arrangeParts","collectionInfo","newResourceId","retrieveWorkGroupInfo","Row","Col","xs","Surface3","surfaces","d1","z","firstLine","lastLine","last","newSurface","fl","flcanvas","flcanvasShort","flcoords","ll","llcoords","lly","llh","llbottom","Surface3Wrapper","handleGetCustomManifestations","handleChangeCustomManifestation","userAddedExpressionId","userAddedManifestations","focusedCustomManifestation","hideDisplayChoice","marginTop","Codex","retrieveCodexInfo","handleToggleShowContents","focusedSurface","relatedCodices","showContents","handleSetFocus","surfaceFocus","ExpressionType","setExpressions","expressionTypeId","TextWrapper","setFocus2","windows","window1","window2","blockFocus","altWindowId","expressionId","fullid","handleUpdateUrlResource","newid","arrangeFocusInfo","arrangeItemFocusInfo","itemFocusInfo","retrieveFocusInfo","mFocus","tFocus","itemTranscriptionId","setItemFocus","tokenRange","textClassNames","resourceTitle","TextArticle","articleType","toggleClass","noteDisplay","ResourceTypeList","setResources","setFilter","resourceTypeId","TextSwitch","displayType","blockDivFocus","history","attemptNumber","itemParent","getArticleTranscriptionDoc","articleDoc","getItemTranscriptionFromBlockDiv","blockDivExpression","secondTryResourceId","Qs","ignoreQueryPrefix","getInfo","Helmet","About","LoginPage","user","displayName","userDisplayName","setUserDisplayName","photoURL","userPicture","setPicture","auth","signOut","signInWithPopup","additionalUserInfo","profile","picture","NavBar","borderBottom","flexGrow","Footer","AppRouter","uid","fallback","forceRefresh","path","render","hostname","i18n","use","Backend","LanguageDetector","initReactI18next","init","fallbackLng","debug","interpolation","escapeValue","renderApp","ReactDOM","onAuthStateChanged","navigator","serviceWorker","ready","registration","unregister"],"mappings":"wSAGaA,EAAiB,oC,SCmCfC,MA5Bf,SAAcC,GACZ,IAAOC,EAAKC,cAALD,EAsBP,OAfEE,QAAQC,IAAI,aAAcJ,GAExB,yBAAKK,UAAU,QACb,kBAACC,EAAA,EAAD,CAAWC,GAAG,WAAWC,OAAK,GAC1B,kBAACF,EAAA,EAAD,KACE,kBAACG,EAAA,EAAD,CAAWF,GAAG,aACb,4BAAKN,EAAE,UACN,2BAAIA,EAAE,aACN,kBAACS,EAAA,EAAD,KAAQ,kBAAC,IAAD,CAAML,UAAU,WAAWM,GAAI,kDAAwCC,MAAO,CAACC,MAAO,UAAWZ,EAAE,gB,gDCrBpH,SAASa,EAAWC,GAEzB,OAAO,IAAIC,SAAQ,SAASC,GAC1B,IAAIC,EAAM,IAAIC,eAEd,GADAD,EAAIE,KAAK,MAAOL,GACa,qBAAlBM,cACV,IACEH,EAAII,aAAe,iBAErB,MAAOC,GACLpB,QAAQC,IAAI,QAASmB,GAGxBL,EAAIM,OAAS,WACZP,EAAQQ,KAAKC,cAEdR,EAAIS,UAID,SAASC,EAAcC,EAAQC,GAEpC,OAAO,IAAId,SAAQ,SAASC,EAASc,GACnCf,QAAQgB,IAAI,CAAClB,EAAWe,GAASf,EAAWgB,KAAUG,MAAK,SAASC,GAClE,IAAMC,EAAgB,IAAId,cAE1B,GADAc,EAAcC,iBAAiBF,EAAK,IAChCA,EAAK,GAAG,CACV,IAAMG,EAAiBF,EAAcG,oBAAoBJ,EAAK,GAAIK,UAClEtB,EAA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GACA,yGACA,0FACA,mEACA,8DACA,IACA,IAAMA,EAAoB,6DAC1B,IACE,IAAMA,EAAoB,iFAC5B,IACA,QACA,IACE,IAAMA,EAAoB,4CAC1B,SAAWA,EAAoB,8BACjC,IACA,aACA,IAAMA,EAAoB,uDAC1B,IACA,aACA,4EACA,iEACA,IACA,aACA,IAAMA,EAAoB,6CAC1B,IACA,aACA,IAAMA,EAAoB,qDAC1B,IACA,aACA,IAAMA,EAAoB,kDAC1B,IACA,IAAMA,EAAoB,+CAC1B,IACA,mBAAmB3M,KAAK,IA6DjB,SAAS4M,GAAeC,GAoB3B,MAnBY,CACZ,gGACA,WACA,IAAMA,EAAc,qDACpB,IAAMA,EAAc,iEACpB,IAAMA,EAAc,+CACpB,6DACA,uEACA,aACA,uEACA,IACA,aACA,uDACA,IACA,aACA,yEACA,IACA,IACA,8BAA8B7M,KAAK,IAqIlC,SAAS8M,GAAeC,GAkC3B,MAjCY,CACZ,yHACE,IACF,IAAMA,EAAY,4DAClB,IAAMA,EAAY,wDAClB,aACC,IAAMA,EAAY,qDACnB,IACA,aACC,IAAMA,EAAY,6DACf,IACJ,aACC,qEACA,iEACA,iEACD,IACA,4DACA,YACC,2EACD,IACA,YACA,iEACI,IACD,iEACA,6CACD,YACA,8DACD,IACA,YACC,sEACD,IACC,KAAK/M,KAAK,IA4ON,SAASgN,GAAaC,GAwB7B,MAvBe,CACZ,gMACA,IACE,SAAWA,EAAU,kBACrB,gEACA,aACA,6DACA,iEACA,+DACA,8DACA,oEACA,oEACA,uGACA,+EACA,6EACA,+EACA,2DACA,aACG,0FACF,IACF,IACD,IACA,2BAA2BjN,KAAK,IAG9B,SAASkN,GAAyBC,GAyBtC,MAxBY,CACZ,gMACA,IACE,4DAA8DA,EAAa,MAC3E,4DACA,gEACA,aACA,6DACA,iEACA,+DACA,8DACA,oEACA,oEACA,uGACA,+EACA,6EACA,+EACA,2DACA,aACG,0FACF,IACF,IACD,IACA,2BAA2BnN,KAAK,IAI1B,SAASo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,KAAKzB,MAAMie,eAAenX,UAAUwH,IAAM,GACrGlL,EhBpGvB,SAA+BuP,EAAmBpO,EAAQghB,EAAUG,EAAYC,GAErF,IAAIQ,EAuMF,OAtMET,GAAcC,IACjBQ,EAAc,CAAC,kCAAoCR,EAAW,IAChD,oCAAsCD,EAAa,KAAK1f,KAAK,MAuH/D,CACd,yIACA,QACA,KACE,UAAY2M,EAAqB,oBACjC,IACE,IAAMA,EAAqB,uBAC3B,mDACA,uDACA,yDACA,yDACA,2DACA,kEACA,2DACA,IACA,QACF,IACE,IACA,IAAMA,EAAqB,8FACzB,UAAYA,EAAqB,mBACnC,KACA,QACA,IACE,oDAAsDA,EAAqB,QAC7E,IACA,KA7IE+S,GAAeC,EAeF,CAAC,oDAChB,wDACA,+EACA,2EACAQ,GAAangB,KAAK,KAlBL,CACb,IACE,6DACA,oCACF,IACA,QACA,IACA,oDACA,wDACA,+EACA,2EACA,KAAKA,KAAK,KAmIN,IACE,iHACA,+BACF,IACA,QACA,IACE,+GACA,6BACF,IACF,KACJ,KACA,QACA,KACA,KACE,UAAY2M,EAAqB,oBACjC,KACA,SACA,KACA,oDAAsDA,EAAqB,QAC3E,IA3IE+S,GAAeC,EAaH,CAAC,wDACjB,oDACA,+EACA,2EACAQ,GAAangB,KAAK,KAhBF,CAAC,IACT,6DACF,IACE,QACF,IACE,wDACA,oDACA,+EACA,2EACF,KAAKA,KAAK,KAmId,IACA,sHACA,oCACA,KACA,QACA,KACE,mHACA,uCACF,IACA,WACA,IACE,iFAGF,IACF,IACA,mEACA,8DACA,gDACA,YACA,KACE,8DACA,iEACF,KACF,KACA,wBACA,SAAWuf,EACX,UAAYhhB,GACZyB,KAAK,KgBpGiCogB,CAAsBtS,EAAYvP,EAAQghB,EAAUG,EAAYC,IAEjF1jB,MAAK,SAACmE,GACvBjG,QAAQC,IAAI,4CAA6CgG,GACzD,IAAMigB,EAAYjgB,EAAElE,KAAK8G,QAAQC,SAC3BV,EAAc,GAIlBA,EAAYoF,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AKJT,GAAf,EAAeA,ICjBTU,GAAY,SAAClC,GAEfmC,IAASb,OAEL,kBAAC,GAAD,CAAWtB,KAAMA,IAEnB/pC,SAASy6B,eAAe,UAM9BjO,GAAS8d,OAAO6B,oBAAmB,SAACpC,GAClC,GAAIA,EACFnsC,QAAQC,IAAI,UACZouC,GAAUlC,OAEP,CACHnsC,QAAQC,IAAI,WAEZouC,GADa,CAAChB,IAAK,aFiGjB,kBAAmBmB,WACrBA,UAAUC,cAAcC,MAAM5sC,MAAK,SAAA6sC,GACjCA,EAAaC,kB","file":"static/js/main.c1c165d0.chunk.js","sourcesContent":["//export const sparqlEndpoint = \"http://localhost:3030/ds/query\"\n//export const sparqlEndpoint = \"https://sparql-docker.scta.info/ds/query\"\n//export const sparqlEndpoint = \"https://sparql-staging.scta.info/ds/query\"\nexport const sparqlEndpoint = \"https://sparql.scta.info/ds/query\"\n\n\nexport const resourceEndpoint = \"http://scta.info/resource/scta\"\n","import React from 'react';\nimport Container from 'react-bootstrap/Container';\nimport Jumbotron from 'react-bootstrap/Jumbotron';\nimport Button from 'react-bootstrap/Button';\nimport {Link} from 'react-router-dom';\nimport {resourceEndpoint} from './config';\nimport {useTranslation} from 'react-i18next'\n\n\n\nfunction Home(props) {\n const {t} = useTranslation();\n //const resourceid = props.location ? Qs.parse(props.location.search, { ignoreQueryPrefix: true }).resourceid : null;\n const displayBody = () => {\n // if (resourceid){\n // return <Text resourceid={props.location.search.resourceid}/>\n // }\n // else\n console.log(\"home props\", props)\n return (\n <div className=\"Home\">\n <Container id=\"lbp-home\" fluid>\n <Container>\n <Jumbotron id=\"lbp-jumbo\">\n \t<h1>{t(\"Title\")}</h1>\n <p>{t(\"Subtitle\")}</p>\n <Button><Link className=\"nav-link\" to={\"/text?resourceid=\" + resourceEndpoint} style={{color: \"black\"}}>{t(\"Enter\")}</Link></Button>\n </Jumbotron>\n </Container>\n </Container>\n </div>\n )\n }\n return (\n displayBody()\n )\n}\n\nexport default Home;\n","import Axios from 'axios'\nimport {sparqlEndpoint} from './config';\nimport $ from 'jquery';\n\n\nexport function loadXMLDoc(url){\n //See https://github.com/martin-honnen/martin-honnen.github.io/blob/master/xslt/arcor-archive/2016/test2016081501.html\n return new Promise(function(resolve) {\n var req = new XMLHttpRequest();\n req.open(\"GET\", url);\n if (typeof XSLTProcessor === 'undefined') {\n try {\n req.responseType = 'msxml-document';\n }\n catch (e) {\n console.log('error', e)\n }\n }\n req.onload = function() {\n resolve(this.responseXML)\n }\n req.send();\n });\n}\n\nexport function convertXMLDoc(xmlurl, xslurl){\n //See https://github.com/martin-honnen/martin-honnen.github.io/blob/master/xslt/arcor-archive/2016/test2016081501.html\n return new Promise(function(resolve, reject){\n Promise.all([loadXMLDoc(xmlurl), loadXMLDoc(xslurl)]).then(function(data) {\n const xsltProcessor = new XSLTProcessor();\n xsltProcessor.importStylesheet(data[1]);\n if (data[0]){\n const resultDocument = xsltProcessor.transformToFragment(data[0], document);\n resolve(resultDocument)\n }\n else{\n const reason = new Error('xml document could not be retrieved');\n reject(reason); // reject\n }\n })\n })\n}\n\nexport function loadHtmlResultDocFromExist(url){\n return Axios.get(\"https://exist.scta.info/exist/apps/scta-app/xslt-conversion.xq?xmlurl=\" + url)\n}\n\nexport function nsResolver(prefix) {\n if(prefix === \"tei\") {\n return 'http://www.tei-c.org/ns/1.0'\n }\n}\n\nexport function copyToClipboard(string){\n var dummy = document.createElement(\"textarea\");\n document.body.appendChild(dummy);\n dummy.value = string;\n dummy.select();\n document.execCommand(\"copy\");\n document.body.removeChild(dummy);\n}\n\nexport function runQuery(query){\n //const sparqlEndpoint = \"https://sparql-docker.scta.info/ds/query\"\n //const sparqlEndpoint = sparqlEndpoint\n const queryPromise = Axios.get(sparqlEndpoint, { params: { \"query\": query, \"output\": \"json\" } })\n return queryPromise\n}\n\n//handles scroll to paragraph procedure\nexport function scrollToParagraph(hash, highlight){\n const element = $(\"#\" + hash);\n\n // TODO: refactor. this could be a lot simpler\n if (highlight){\n element.addClass(\"highlightNone\");\n $(\".paragraphnumber\").removeClass(\"highlight2\")\n $(\".plaoulparagraph\").removeClass(\"highlightNone\")\n $(\".lbp-quote\").removeClass(\"highlightNone\")\n $(\".lbp-quote\").removeClass(\"highlight\")\n $(\".lbp-ref\").removeClass(\"highlightNone\")\n $(\".lbp-ref\").removeClass(\"highlight\")\n $(\".plaoulparagraph\").removeClass(\"highlight\")\n element.children(\".paragraphnumber\").addClass(\"highlight2\")\n element.addClass( \"highlight\");\n \n // TODO: Refactor\n // conditional to ensure fire of next conditional ONLY IF element[0] is found\n // prevents error with include method below when element does not exist\n if (element[0]){\n // condition set to prevent fade if element is quote or ref \n if (!element[0].className.includes('lbp-quote') && !element[0].className.includes('lbp-ref')){\n setTimeout(function(){\n $(\".lbp-ref\").removeClass(\"highlight\")\n $(\".lbp-quote\").removeClass(\"highlight\")\n $(\".plaoulparagraph\").removeClass(\"highlight\")\n element.addClass(\"highlightNone\");\n }, 2000);\n }\n }\n\n }\n \tif (element.length > 0) {\n \t $('html, body')\n .stop()\n .animate({\n scrollTop: element.offset().top - 100\n }, 1000);\n }\n\n }\n\n // adopted from https://github.com/hypothesis/client/blob/master/src/annotator/anchoring/text-position.js\n /**\n * Convert `start` and `end` character offset positions within the `textContent`\n * of a `root` element into a `Range`.\n *\n * Throws if the `start` or `end` offsets are outside of the range `[0,\n * root.textContent.length]`.\n *\n * @param {HTMLElement} root\n * @param {number} start - Character offset within `root.textContent`\n * @param {number} end - Character offset within `root.textContent`\n * @return {Range} Range spanning text from `start` to `end`\n */\n\nfunction nodeFilterCheck(node){\n \n const check = node.parentElement.className\n // skip text nodes if their parent has the following classes\n if (check.includes(\"paragraphnumber\") \n || check.includes(\"lbp-line-number\")\n || check.includes(\"appnote\") \n || check.includes(\"paragraphnumber\")\n || check.includes(\"footnote\")\n || check.includes(\"lbp-reg\")\n || check.includes(\"lbp-folionumber\")\n || check.includes(\"js-show-folio-image\") // removes folio number\n ){\n return NodeFilter.FILTER_REJECT\n }\n else if (!node.nodeValue){\n return NodeFilter.FILTER_REJECT\n }\n else{\n return NodeFilter.FILTER_ACCEPT;\n }\n \n}\n\nexport function toRange(root, start, end) {\n // The `filter` and `expandEntityReferences` arguments are mandatory in IE\n // although optional according to the spec.\n //console.log(\"root\", root)\n const nodeIter = root.ownerDocument.createNodeIterator(\n root,\n NodeFilter.SHOW_TEXT,\n nodeFilterCheck, // filter\n true // expandEntityReferences\n );\n\n let startContainer;\n let startOffset;\n let startWordOffset\n let endContainer;\n let endOffset;\n let endWordOffset;\n let breaks = 0;\n\n // let textLength = 0;\n let wordLength = 0;\n let node;\n\n \n while ((node = nodeIter.nextNode()) && (!startContainer || !endContainer)) {\n // keep running total of break words and then use this to adjust word count \n // in comparison to word count with broken words; then adjust;\n // NOTE: requires xslt to add data-break='no' to line break span\n if (node.previousSibling){\n if (node.previousSibling.getAttribute){\n if (node.previousSibling && node.previousSibling.getAttribute(\"data-break\") === \"no\"){\n breaks += 1\n }\n }\n }\n const nodeText = node.nodeValue;\n // get array of words in node\n const nodeTextArray = cleanText(nodeText).split(\" \").filter(n=>n)\n // use clean text to remove punctuation and unwanted white space, then filter to get rid of blank array items, then count\n const newWordLength = nodeTextArray.length\n \n // if start word is greater than length of word count in preceding nodes, but less than or equal \n // to word count of of preceding plus this node, then selection starts somewhere within this node\n // select node, then find precise word and character position start\n if (\n !startContainer &&\n start + breaks >= wordLength &&\n start + breaks <= wordLength + newWordLength\n ) {\n startContainer = node;\n startWordOffset = (start + breaks) - wordLength;\n \n // get the occurrence instance within the node (needed in case there are two more instances of the same word in the node)\n const instanceNumber = getInstanceNumber(nodeTextArray, startWordOffset - 1)\n // calculate character offset of word within containing node\n startOffset = getStringBeforeWord(node.nodeValue, nodeTextArray[startWordOffset - 1], instanceNumber, true)\n }\n // similar to above only for final position\n if (\n !endContainer &&\n end + breaks >= wordLength &&\n end + breaks <= wordLength + newWordLength\n ) {\n endContainer = node;\n endWordOffset = (end + breaks) - wordLength;\n // get the occurrence instance within the node (needed in case there are two more instances of the same word in the node)\n const instanceNumber = getInstanceNumber(nodeTextArray, endWordOffset - 1)\n // calculate character offset of word within containing node\n endOffset = getStringBeforeWord(node.nodeValue, nodeTextArray[endWordOffset - 1], instanceNumber, false)\n }\n\n //textLength += nodeText.length;\n wordLength += newWordLength\n \n \n }\n\n const range = root.ownerDocument.createRange();\n //conditional here to if container exists before calling it.\n //usual reason a end container doesn't exist is the end number in the request does not exist in the paragraph \n // for example, asking for end word 40 when there are only 39 words in the paragraph\n startContainer ? range.setStart(startContainer, startOffset) : console.log(\"no container or invalid end offset\")\n endContainer ? range.setEnd(endContainer, endOffset) : console.log(\"no container invalid end offset\")\n\n return range;\n}\n\n// function to remove spaces from selected html text\nexport function cleanText(selectedText){\n selectedText = selectedText.replace(/^[ ]+|[ ]+$/g,''); // remove leading and trailing white space\n // remove all punctuation with escape slashes; escape slashes don't seem needed as the line below with slashes seems to work.\n // this line with extra slashes produces lint errors\n // selectedText = selectedText.replace(/[.,\\/#!$%\\^&\\*;:{}=\\-_`~()\"]/g,\"\") //remove all punctuation\n selectedText = selectedText.replace(/[.,/#!$%^&*;:{}=\\-_`~()\"/\\u00B6/|/\\u204B/]/g,\"\") //remove all punctuation including pilcrows\n \n selectedText = selectedText.replace(/\\s+/gi, ' ' ) // condences 1 or more space to single space\n return selectedText\n}\n\n/**\n * @description returns identical instance number of a certain item in array,\n * e.g. if we have array [1, 2, 3, 4, 5, 1, 2, 3] \n * and we ask for the instanceNumber of index position 5, \n * the function will return 2, as this is the second instance of the number 1 in this array\n * @param {array} wordArray \n * @param {number} wordPosition \n */\nfunction getInstanceNumber(wordArray, wordPosition){\n let number = 0\n // using <= to include self in count\n for (let i=0; i <= wordPosition; i++){\n if (wordArray[i] === wordArray[wordPosition]){\n number++\n }\n }\n return number\n}\n/**\n * @description get strings before nth instance of a word\n * @param {string} text - string to be search\n * @param {string} word - word to be matched\n * @param {number} instanceNumber - number instance of word to be matched\n * modified from https://stackoverflow.com/questions/14480345/how-to-get-the-nth-occurrence-in-a-string\n */\nfunction getStringBeforeWord(text, word, instanceNumber, first) {\n const splitText = text.split(word, instanceNumber).join(word); \n if (first){\n const characterOffset = splitText.length\n return characterOffset\n }\n else{\n const characterOffset = splitText.length + word.length\n return characterOffset\n\n }\n}\n/**\n * @description creates a range\n * @param {*} root \n * @param {*} startContainer \n * @param {number} startOffset start character relative to containing node\n * @param {*} endContainer \n * @param {number} endOffset - end character length relative to containing node\n */\n\nexport function createRange(root, startContainer, startOffset, endContainer, endOffset){\n const range = root.ownerDocument.createRange();\n range.setStart(startContainer, startOffset);\n range.setEnd(endContainer, endOffset);\n return range;\n}\n/**\n * @description takes a range object and computes the Word Count after filtering elements nodes not to be counted\n * @param {Range} rng - must take a Range object\n */\nexport function getRangeWordCount(rng){\n var cnt = rng.cloneContents();\n $(cnt).find(\".lbp-line-number, .paragraphnumber, br, .lbp-folionumber, .appnote, .footnote, .lbp-reg\").remove();\n const selectionText = cleanText(cnt.textContent)\n const length = selectionText.split(\" \").filter(n=>n).length\n return length;\n}\n\n \n/**\n * @description gets the containing paragraph node for a node somewhere within the paragraph node\n * @param {node} node \n */\nexport function getContainingP(node) {\n while (node) {\n if (node.nodeType === 1 && node.tagName.toLowerCase() === \"p\") {\n return node;\n }\n node = node.parentElement;\n }\n}\n\n/**\n * @description retrieves plain text and counts line breaks based on input\n */\nexport function getLineNumber(url, selectedText, selectedElementTargetId){\n //https://github.com/scta-texts/plaoulcommentary/edit/master/lectio1/lectio1.xml#L117\n //https://raw.githubusercontent.com/scta-texts/plaoulcommentary/master/lectio1/lectio1.xml\n //https://raw.githubusercontent.com/scta-texts/plaoulcommentarymaster/lectio1/lectio1.xml\n const newRawUrl = url.replace(\"https://github.com\", \"https://raw.githubusercontent.com\").replace(\"/raw/\", '/')\n const file = Axios.get(newRawUrl)\n const data = file.then((d) => {\n const findElement = \"xml:id=\\\"\" + selectedElementTargetId + \"\\\"\"\n const splitText = d.data.split(findElement);\n const beforeText = splitText[0]\n const splitBeforeText = beforeText.split('\\n');\n const newLineCount = splitBeforeText.length\n \n const afterText = splitText[1]\n const regexp = new RegExp(`\\\\W${selectedText}\\\\W`, 'gi')\n const elementBeforeText = afterText.split(regexp)[0] // this is flawed, first instance of the same text will be used\n const splitElementBeforeText = elementBeforeText.split('\\n');\n const newElementLineCount = splitElementBeforeText.length\n return newLineCount + newElementLineCount - 1\n })\n return data\n}\n\nexport function goToGitHubEdit(url, selectedText, selectedElementTargetId){\n console.log(url, selectedText, selectedElementTargetId)\n const data = getLineNumber(url, selectedText, selectedElementTargetId)\n //https://github.com/scta-texts/plaoulcommentary/raw/master/lectio1/lectio1.xml\n data.then((d) => {\n const editUrl = url.replace(\"raw\", \"edit\") + \"#L\" + d\n window.open(editUrl,\"gitHubEditWindow\",'height=750,width=750');\n //window.open(editUrl, \"_blank\"); \n\n })\n \n //window.location = \n \n}\n\nexport function textReduce(text, wordRange){\n const wordTokenStart = wordRange.split(\"-\")[0]\n const wordTokenEnd = wordRange.split(\"-\")[1]\n const wordTokens = text.split(\" \")\n // NOTE: I'm not sure what this .filter(Boolean) is doing??\n const wordTokensClean = wordTokens.filter(Boolean)\n //const wordTokensBefore = wordTokensClean.slice(0, wordTokenStart - 1);\n //const wordTokensAfter = wordTokensClean.slice(wordTokenEnd)\n const wordTokensFocus = wordTokensClean.slice(wordTokenStart - 1, wordTokenEnd)\n const reducedText = wordTokensFocus.join(\" \")\n return reducedText\n // let textElement = \"\"\n // if (context){\n // textElement = \"<p class='text'><span>\" + wordTokensBefore.join(\" \") + \"</span> <span style='font-weight: bold'>\" + wordTokensFocus.join(\" \") + \"</span> <span>\" + wordTokensAfter.join(\" \") +\"</span></p>\"\n // }\n // else{\n // textElement = \"<p class='text'>\" + wordTokensFocus.join(\" \") + \"</p>\"\n // }\n // return textElement\n}\n\n// a function to remove spaces and punctuation from a string;\n// currently I'm using this in the comments component to create valid key for a annotaiton list\nexport function camelCase(str) {\n // remove punctuation\n const newStr = str.replace(/[\\p{P}$+<=>^`|~]/gu, '')\n //return string camelCased at spaces\n return newStr.replace(/(?:^\\w|[A-Z]|\\b\\w)/g, function(word, index)\n {\n return index === 0 ? word.toLowerCase() : word.toUpperCase();\n }).replace(/\\s+/g, '');\n}\n\n//copied from TextCompareItem\n//TODO: TextCompareItem instances should be removed and this function should be used\nexport function textClean(text){\n // remove most punctuation\n let punctuationless = text.replace(/[.,/#!$%^&*;:{}=\\-_`~()/\\u00B6/|/\\u204B/]/g,\"\");\n //convert v->u, ae->e, oe-e>\n punctuationless = punctuationless.replace(/v/g, \"u\");\n punctuationless = punctuationless.replace(/ae/g, \"e\");\n punctuationless = punctuationless.replace(/oe/g, \"e\");\n punctuationless = punctuationless.replace(/oe/g, \"e\");\n punctuationless = punctuationless.replace(/y/g, \"i\");\n //remove space\n punctuationless = punctuationless.replace(/\\s{2,}/g,\" \");\n //lowercase\n const finalFinalString = punctuationless.toLowerCase()\n return finalFinalString\n\n}","export function questionTitleQuery(searchParameters){\n const searchTerm = searchParameters.searchTerm\n let workGroupQuery = \"\";\n if (searchParameters.searchWorkGroup){\n workGroupQuery = [\n \"BIND(<\" + searchParameters.searchWorkGroup + \"> AS ?workGroup) .\",\n \"?workGroup <http://scta.info/property/hasExpression> ?topLevel .\"\n ].join(' ')\n }\n let expressionTypeQuery = \"\";\n if (searchParameters.searchEType){\n expressionTypeQuery = [\n \"BIND(<\" + searchParameters.searchEType + \"> AS ?expressionType) .\",\n \"{\",\n \"?resource <http://scta.info/property/expressionType> ?expressionType .\",\n \"}\",\n \"UNION\",\n \"{\",\n \"?resource <http://scta.info/property/isMemberOf> ?ancestor .\",\n \"?ancestor <http://scta.info/property/expressionType> ?expressionType .\",\n \"}\"].join(' ')\n }\n let authorQuery = \"\";\n if (searchParameters.searchAuthor){\n authorQuery = \"BIND(<\" + searchParameters.searchAuthor + \"> AS ?author).\"\n }\n let eidQuery = \"\";\n if (searchParameters.searchEid){\n eidQuery = \"BIND(<\" + searchParameters.searchEid + \"> AS ?topLevel).\"\n }\n const query = [\n \"SELECT ?resource ?qtitle ?resourceTitle ?structureType ?longTitle ?author ?authorTitle\",\n \"WHERE\",\n \"{\",\n\n \"?resource <http://scta.info/property/questionTitle> ?qtitle .\",\n \"?resource <http://purl.org/dc/elements/1.1/title> ?resourceTitle .\",\n \"?resource <http://scta.info/property/structureType> ?structureType .\",\n \"?resource <http://scta.info/property/longTitle> ?longTitle .\",\n expressionTypeQuery,\n eidQuery,\n \"?resource <http://scta.info/property/isPartOfTopLevelExpression> ?topLevel .\",\n authorQuery,\n \"?topLevel <http://www.loc.gov/loc.terms/relators/AUT> ?author .\",\n \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle .\",\n workGroupQuery,\n \"FILTER (REGEX(STR(?qtitle), '\" + searchTerm + \"', 'i')) .\",\n \"}\"\n ].join(' ');\n return query\n }\n","import React from 'react';\nimport BSpinner from 'react-bootstrap/Spinner';\n\nfunction Spinner() {\n return (\n <div className=\"spinner\" style={{\"padding\": \"20px 5px\"}}>\n <BSpinner animation=\"grow\" role=\"status\">\n <span className=\"sr-only\">Loading...</span>\n </BSpinner>\n <BSpinner animation=\"grow\" variant=\"primary\" />\n <BSpinner animation=\"grow\" variant=\"secondary\" />\n <BSpinner animation=\"grow\" variant=\"success\" />\n <BSpinner animation=\"grow\" variant=\"danger\" />\n <BSpinner animation=\"grow\" variant=\"warning\" />\n <BSpinner animation=\"grow\" variant=\"info\" />\n </div>\n );\n}\n\nexport default Spinner;\n","const searchExpressionsListReducer = (state, action) => {\n if (action){\n switch (action.type){\n case 'START_EXPRESSIONS_FETCH':\n return {\n\n }\n case 'COMPLETE_EXPRESSIONS_FETCH':\n return [...action.expressions]\n default:\n return state\n }\n }\n}\n\nexport {searchExpressionsListReducer as default}\n","import Axios from 'axios'\nimport {sparqlEndpoint} from '../components/config';\n\nexport var startExpressionsFetch = () => {\n return{\n type: \"START_EXPRESSIONS_FETCH\"\n };\n};\nexport var completeExpressionsFetch = (expressions) => {\n return{\n type: \"COMPLETE_EXPRESSIONS_FETCH\",\n expressions\n };\n};\nexport var fetchExpressionsList = (searchParameters, dispatch) =>{\n let workGroupSparql = \"\"\n if (searchParameters.searchWorkGroup){\n workGroupSparql = [\n \"<\" + searchParameters.searchWorkGroup + \"> <http://scta.info/property/hasExpression> ?expression .\"\n ].join(' ');\n }\n let expressionAuthorTypeSparql = \"\"\n if (searchParameters.expressionAuthorType){\n expressionAuthorTypeSparql = [\n \"?expression <http://www.loc.gov/loc.terms/relators/AUT> ?expressionAuthor . \",\n \"?expressionAuthor <http://scta.info/property/personType> <http://scta.info/resource/\" + searchParameters.expressionAuthorType + \"> .\"\n ].join('');\n }\n\n let authorSparql = \"\"\n if (searchParameters.searchAuthor){\n authorSparql = [\n \"?expression <http://www.loc.gov/loc.terms/relators/AUT> <\" + searchParameters.searchAuthor + \"> .\"\n ].join('');\n }\n var query = [\n \"SELECT ?type ?expression ?expressionShortId ?expressionTitle ?author ?authorTitle ?workGroup ?workGroupTitle\",\n \"WHERE { \",\n \"?expression a <http://scta.info/resource/expression> .\",\n \"?expression a ?type .\",\n \"?expression <http://scta.info/property/level> '1' . \",\n expressionAuthorTypeSparql,\n workGroupSparql,\n authorSparql,\n \"?expression <http://scta.info/property/shortId> ?expressionShortId .\",\n \"?expression <http://scta.info/property/shortId> ?expressionShortId .\",\n \"?expression <http://purl.org/dc/elements/1.1/title> ?expressionTitle .\",\n \"?expression <http://www.loc.gov/loc.terms/relators/AUT> ?author . \",\n \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle .\",\n \"?expression <http://purl.org/dc/terms/isPartOf> ?workGroup .\",\n \"?workGroup <http://purl.org/dc/elements/1.1/title> ?workGroupTitle .\",\n \"}\",\n \"ORDER BY ?expressionTitle\"].join('');\n\n dispatch(startExpressionsFetch());\n Axios.get(sparqlEndpoint, {params: {\"query\" : query, \"output\": \"json\"}}).then(function(res){\n var results = res.data.results.bindings;\n var searchWorks = results.map((result) => {\n var workInfo = {\n expression: result.expression.value,\n expressionShortId: result.expressionShortId ? result.expressionShortId.value : \"\",\n expressionTitle: result.expressionTitle.value,\n workGroup: result.workGroup ? result.workGroup.value : \"\",\n workGroupTitle: result.workGroupTitle ? result.workGroupTitle.value : \"\",\n author: result.author ? result.author.value : \"\",\n authorTitle: result.author ? result.authorTitle.value : \"\",\n type: result.type.value\n\n }\n return workInfo\n\n });\n dispatch(completeExpressionsFetch(searchWorks));\n });\n\n};\n","const searchAuthorsListReducer = (state, action) => {\n if (action){\n switch (action.type){\n case 'START_AUTHORS_FETCH':\n return {\n\n }\n case 'COMPLETE_AUTHORS_FETCH':\n return [...action.authors]\n default:\n return state\n }\n }\n}\n\nexport {searchAuthorsListReducer as default}\n","import Axios from 'axios'\nimport {sparqlEndpoint} from '../components/config';\n\nexport var startAuthorsFetch = () => {\n return{\n type: \"START_AUTHORS_FETCH\"\n };\n};\nexport var completeAuthorsFetch = (authors) => {\n return{\n type: \"COMPLETE_AUTHORS_FETCH\",\n authors\n };\n};\nexport var fetchAuthorsList = (searchParameters, dispatch) =>{\n let workGroupSparql = \"\";\n if (searchParameters.searchWorkGroup){\n workGroupSparql = \"<\" + searchParameters.searchWorkGroup + \"> <http://scta.info/property/hasExpression> ?resource .\"\n }\n const query = [\n \"SELECT DISTINCT ?author ?authorTitle ?authorShortId \",\n \"WHERE { \",\n \"?author a <http://scta.info/resource/person> .\",\n \"?resource a <http://scta.info/resource/expression> .\",\n \"?resource <http://scta.info/property/level> '1' .\",\n workGroupSparql,\n \"?resource <http://www.loc.gov/loc.terms/relators/AUT> ?author .\",\n \"?author <http://scta.info/property/shortId> ?authorShortId .\",\n \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle .\",\n \"}\",\n \"ORDER BY ?authorTitle\"].join('');\n dispatch(startAuthorsFetch());\n Axios.get(sparqlEndpoint, {params: {\"query\" : query, \"output\": \"json\"}}).then(function(res){\n var results = res.data.results.bindings;\n var authors = results.map((result) => {\n var authorInfo = {\n author: result.author.value,\n authorShortId: result.authorShortId.value,\n authorTitle: result.authorTitle.value,\n }\n return authorInfo\n\n });\n dispatch(completeAuthorsFetch(authors));\n });\n };\n","const searchWorkGroupsListReducer = (state, action) => {\n if (action){\n switch (action.type){\n case 'START_WORK_GROUPS_LIST_FETCH':\n return {\n\n }\n case 'COMPLETE_WORK_GROUPS_LIST_FETCH':\n return [...action.workGroups]\n default:\n return state\n }\n }\n}\n\nexport {searchWorkGroupsListReducer as default}\n","import Axios from 'axios'\nimport {sparqlEndpoint} from '../components/config';\n\nexport var startWorkGroupsListFetch = () => {\n return{\n type: \"START_WORK_GROUPS_LIST_FETCH\"\n };\n};\nexport var completeWorkGroupsListFetch = (workGroups) => {\n return{\n type: \"COMPLETE_WORK_GROUPS_LIST_FETCH\",\n workGroups\n };\n};\nexport var fetchWorkGroupsList = (searchParameters, dispatch) =>{\n let authorQuery = \"\";\n if (searchParameters.searchAuthor){\n authorQuery = [\n \"?workGroup <http://scta.info/property/hasExpression> ?expression .\",\n \"?expression <http://www.loc.gov/loc.terms/relators/AUT> <\" + searchParameters.searchAuthor + \"> .\"\n ].join('');\n }\n // // Begin Author date sparql filters\n // let quotationAuthorDateSparql = \"\";\n // if (searchParameters.quotationAuthorDateAfter || searchParameters.quotationAuthorDateBefore){\n // quotationAuthorDateSparql = \"?author <http://scta.info/property/dateOfBirth> ?dateOfBirth .\"\n // }\n // let quotationAuthorDateAfterSparqlFilter = \"\";\n // if (searchParameters.quotationAuthorDateAfter){\n // quotationAuthorDateAfterSparqlFilter = \"FILTER (?dateOfBirth >= '\" + searchParameters.quotationAuthorDateAfter + \"').\"\n // }\n // let quotationAuthorDateBeforeSparqlFilter = \"\";\n // if (searchParameters.quotationAuthorDateBefore){\n // quotationAuthorDateBeforeSparqlFilter = \"FILTER (?dateOfBirth <= '\" + searchParameters.quotationAuthorDateBefore + \"').\"\n // }\n // END author date sparql filter\n var query = [\n \"SELECT DISTINCT ?workGroup ?workGroupTitle \",\n \"WHERE { \",\n \"?workGroup a <http://scta.info/resource/workGroup> .\",\n \"?workGroup <http://purl.org/dc/elements/1.1/title> ?workGroupTitle .\",\n authorQuery,\n \"}\",\n \"ORDER BY ?workGroupTitle\"].join(' ');\n dispatch(startWorkGroupsListFetch());\n Axios.get(sparqlEndpoint, {params: {\"query\" : query, \"output\": \"json\"}}).then(function(res){\n var results = res.data.results.bindings;\n var workGroups = results.map((result) => {\n var workGroupInfo = {\n workGroup: result.workGroup.value,\n workGroupTitle: result.workGroupTitle.value,\n }\n return workGroupInfo\n\n });\n dispatch(completeWorkGroupsListFetch(workGroups));\n });\n };\n","const searchExpressionTypesListReducer = (state, action) => {\n if (action){\n switch (action.type){\n case 'START_EXPRESSION_TYPES_LIST_FETCH':\n return {\n\n }\n case 'COMPLETE_EXPRESSION_TYPES_LIST_FETCH':\n return [...action.expressionTypes]\n default:\n return state\n }\n }\n}\n\nexport {searchExpressionTypesListReducer as default}\n","import React, {useState, useEffect, useReducer} from 'react';\nimport searchExpressionsListReducer from '../reducers/searchExpressionsListReducer'\nimport * as searchExpressionsListActions from '../actions/searchExpressionsListActions'\nimport searchAuthorsListReducer from '../reducers/searchAuthorsListReducer'\nimport * as searchAuthorsListActions from '../actions/searchAuthorsListActions'\nimport searchWorkGroupsListReducer from '../reducers/searchWorkGroupsListReducer'\nimport * as searchWorkGroupsListActions from '../actions/searchWorkGroupsListActions'\nimport searchExpressionTypesListReducer from '../reducers/searchExpressionTypesListReducer'\nimport * as searchExpressionTypesListActions from '../actions/searchExpressionTypesListActions'\nimport Form from 'react-bootstrap/Form';\nimport Button from 'react-bootstrap/Button';\nimport InputGroup from 'react-bootstrap/InputGroup';\n\nconst Search3Parameters = (props) => {\n const [searchType, setSearchType] = useState(props.searchType ? props.searchType : \"text\")\n const [searchTerm, setSearchTerm] = useState(props.searchTerm)\n const [searchAuthor, setSearchAuthor] = useState(props.searchAuthor)\n const [searchEid, setSearchEid] = useState(props.searchEid)\n const [searchEType, setSearchEType] = useState(props.searchEType)\n const [searchWorkGroup, setSearchWorkGroup] = useState(props.searchWorkGroup ? props.searchWorkGroup : \"http://scta.info/resource/scta\")\n\n const [resultsFilter, setResultsFilter] = useState(\"\")\n\n const [searchExpressionTypesList, searchExpressionTypesListDispatch] = useReducer(searchExpressionTypesListReducer, [])\n const [searchExpressionsList, searchExpressionsListDispatch] = useReducer(searchExpressionsListReducer, [])\n const [searchAuthorsList, searchAuthorsListDispatch] = useReducer(searchAuthorsListReducer, [])\n const [searchWorkGroupsList, searchWorkGroupsListDispatch] = useReducer(searchWorkGroupsListReducer, [])\n const searchParameters = {searchTerm, searchAuthor, searchEid, searchWorkGroup, searchType, searchEType, resultsFilter}\n\n const [displayAllParameters, setDisplayAllParameters] = useState(false)\n\n // this is temporary to allow list of figure tags to be viewed; it is not a final solution; if keeping tags is important, available tags should be received from a service -->\n const availableFigureTagsList = [\"light/shadow\", \"physical objects\", \"concrete elements\", \"letters\", \"text\", \"woodcut\", \"integrated in the layout\", \"3d and perspective\", \"plasticity\", \"tree\", \"related to an experiment\", \"specimen\", \"material\", \"polarity\", \"magnetic force\", \"scientific\", \"analogy, allegory and symbols\", \"practice\", \"geometrical forms\", \"abstract elements\", \"inclination\", \"arrows\", \"knife\", \"hand\", \"persons or human body\"]\n availableFigureTagsList.sort()\n\n const handleSetSearchParameters = () => {\n props.handleSetSearchParameters(searchParameters)\n }\n const handleSetResultsFilter = (content) => {\n setResultsFilter(content)\n }\n\n //begin effects to update hooks when props change\n // perhaps this could be combined into a single custom hook\n useEffect(() => {\n setSearchType(props.searchType ? props.searchType : \"text\")\n }, [props.searchType])\n useEffect(() => {\n setSearchAuthor(props.searchAuthor)\n }, [props.searchAuthor])\n useEffect(() => {\n setSearchEid(props.searchEid)\n }, [props.searchEid])\n useEffect(() => {\n setSearchEType(props.searchEType)\n }, [props.searchEType])\n useEffect(() => {\n setSearchWorkGroup(props.searchWorkGroup)\n }, [props.searchWorkGroup])\n useEffect(() => {\n setSearchTerm(props.searchTerm)\n }, [props.searchTerm])\n //end effects to update hooks when props change\n //begin other effects\n useEffect(handleSetSearchParameters, [searchTerm, searchAuthor, searchEid, searchWorkGroup, searchType, searchEType, resultsFilter])\n useEffect(() => {\n searchExpressionsListDispatch(searchExpressionsListActions.fetchExpressionsList(searchParameters, searchExpressionsListDispatch))\n searchAuthorsListDispatch(searchAuthorsListActions.fetchAuthorsList(searchParameters, searchAuthorsListDispatch))\n searchWorkGroupsListDispatch(searchWorkGroupsListActions.fetchWorkGroupsList(searchParameters, searchWorkGroupsListDispatch))\n searchExpressionTypesListDispatch(searchExpressionTypesListActions.fetchExpressionTypesList(searchParameters, searchExpressionTypesListDispatch))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n useEffect(() => {\n searchExpressionsListDispatch(searchExpressionsListActions.fetchExpressionsList(searchParameters, searchExpressionsListDispatch))\n searchWorkGroupsListDispatch(searchWorkGroupsListActions.fetchWorkGroupsList(searchParameters, searchWorkGroupsListDispatch))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchAuthor])\n useEffect(() => {\n searchExpressionsListDispatch(searchExpressionsListActions.fetchExpressionsList(searchParameters, searchExpressionsListDispatch))\n searchAuthorsListDispatch(searchAuthorsListActions.fetchAuthorsList(searchParameters, searchAuthorsListDispatch))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchWorkGroup])\n\n return(\n <div>\n <InputGroup size=\"sm\" className=\"mb-2\">\n <InputGroup.Prepend>\n <InputGroup.Text>Search Term</InputGroup.Text>\n </InputGroup.Prepend>\n <Form.Control as=\"input\" type=\"text\" placeholder=\"search term\" onChange={(e) => setSearchTerm(e.target.value)} value={searchParameters.searchTerm}/>\n </InputGroup>\n {/* {NOTE filter results parameter is useful only when results are of manageable size;\n when results are big, javascript locks up while filtering\n if paging is used, then this could prevent performance slow down \n but paging makes the tool less than useful, because it will only filter what is on the page\n TODO: reconsider if you want to keep this; or this is not worth the trouble\n NOTE: if this parameters is removed, then filterResults() and filterQuestionResults() functions \n in Search3 should be removed\n } */}\n\n {displayAllParameters &&\n <div>\n {searchType === 'figure' && \n <InputGroup size=\"sm\" className=\"mb-2\">\n <InputGroup.Prepend>\n <InputGroup.Text>Search by Figure Tag</InputGroup.Text>\n </InputGroup.Prepend>\n <Form.Control as=\"select\" onChange={(e) => {setSearchTerm(e.target.value)}} value={searchParameters.searchTerm}>\n <option value=\"\"></option>\n {availableFigureTagsList.map((ft) => {\n return <option value={\"'\" + ft + \"'\"}>{ft}</option>\n })}\n </Form.Control>\n </InputGroup>\n }\n \n <InputGroup size=\"sm\" className=\"mb-2\">\n <InputGroup.Prepend>\n <InputGroup.Text>Filter Results</InputGroup.Text>\n </InputGroup.Prepend>\n <Form.Control as=\"input\" type=\"secondary results filter\" placeholder=\"secondary results filter\" onChange={(e) => handleSetResultsFilter(e.target.value)} value={resultsFilter}/>\n </InputGroup>\n \n <InputGroup size=\"sm\" className=\"mb-2\">\n <InputGroup.Prepend>\n <InputGroup.Text>Search Type</InputGroup.Text>\n </InputGroup.Prepend>\n <Form.Control as=\"select\" onChange={(e) => {setSearchType(e.target.value)}} value={searchParameters.searchType}>\n <option value=\"questionTitles\">Questions Titles</option>\n <option value=\"text\">Text</option>\n <option value=\"figure\">Figure</option>\n </Form.Control>\n </InputGroup>\n <InputGroup size=\"sm\" className=\"mb-2\">\n <InputGroup.Prepend>\n <InputGroup.Text>Work Group</InputGroup.Text>\n </InputGroup.Prepend>\n <Form.Control as=\"select\" onChange={(e) => {setSearchWorkGroup(e.target.value)}} value={searchParameters.searchWorkGroup}>\n <option value=\"\">All</option>\n {searchWorkGroupsList && searchWorkGroupsList.map((e, i) => {\n return (<option key={e.workGroup + \"-\" + i} value={e.workGroup}>{e.workGroupTitle}</option>)\n })\n }\n </Form.Control>\n </InputGroup>\n <InputGroup size=\"sm\" className=\"mb-2\">\n <InputGroup.Prepend>\n <InputGroup.Text>Expression Type</InputGroup.Text>\n </InputGroup.Prepend>\n <Form.Control as=\"select\" onChange={(e) => {setSearchEType(e.target.value)}} value={searchParameters.searchEType}>\n <option value=\"\">All</option>\n {searchExpressionTypesList && searchExpressionTypesList.map((e, i) => {\n return (<option key={e.expressionType + \"-\" + i} value={e.expressionType}>{e.expressionTypeTitle}</option>)\n })\n }\n </Form.Control>\n </InputGroup>\n <InputGroup size=\"sm\" className=\"mb-2\">\n <InputGroup.Prepend>\n <InputGroup.Text>Author</InputGroup.Text>\n </InputGroup.Prepend>\n <Form.Control as=\"select\" onChange={(e) => {setSearchAuthor(e.target.value)}} value={searchParameters.searchAuthor}>\n <option value=\"\">All</option>\n {searchAuthorsList && searchAuthorsList.map((e, i) => {\n return (<option key={e.author + \"-\" + i} value={e.author}>{e.authorTitle}</option>)\n })\n }\n </Form.Control>\n </InputGroup>\n <InputGroup size=\"sm\" className=\"mb-2\">\n <InputGroup.Prepend>\n <InputGroup.Text>Text</InputGroup.Text>\n </InputGroup.Prepend>\n <Form.Control as=\"select\" onChange={(e) => {setSearchEid(e.target.value)}} value={searchParameters.searchEid}>\n <option value=\"\">All</option>\n {searchExpressionsList && searchExpressionsList.map((e, i) => {\n return (<option key={e.expression + \"-\" + i} value={e.expression}>{e.authorTitle}: {e.expressionTitle}</option>)\n })\n }\n </Form.Control>\n </InputGroup>\n </div>\n }\n <InputGroup.Prepend size=\"sm\" className=\"mb-2\">\n {props.children}\n {props.showAdvancedParameters && <Button className=\"btn-sm\" onClick={() => {setDisplayAllParameters(!displayAllParameters)}}>{displayAllParameters ? \"Hide\" : \"Show\"} More Filter Options</Button>} \n </InputGroup.Prepend>\n \n \n </div>\n )\n}\n\nexport {Search3Parameters as default}\n","import Axios from 'axios'\nimport {sparqlEndpoint} from '../components/config';\n\nexport var startExpressionTypesListFetch = () => {\n return{\n type: \"START_EXPRESSION_TYPES_LIST_FETCH\"\n };\n};\nexport var completeExpressionTypesListFetch = (expressionTypes) => {\n return{\n type: \"COMPLETE_EXPRESSION_TYPES_LIST_FETCH\",\n expressionTypes\n };\n};\nexport var fetchExpressionTypesList = (searchParameters, dispatch) =>{\n //TODO: delete this or uncomment if authorQuery should be included in expressionTypeList Fetch\n // let authorQuery = \"\";\n // if (searchParameters.searchAuthor){\n // authorQuery = [\n // \"?workGroup <http://scta.info/property/hasExpression> ?expression .\",\n // \"?expression <http://www.loc.gov/loc.terms/relators/AUT> <\" + searchParameters.searchAuthor + \"> .\"\n // ].join('');\n // }\n\n var query = [\n \"SELECT DISTINCT ?expressionType ?expressionTypeTitle \",\n \"WHERE { \",\n \"?expressionType a <http://scta.info/resource/expressionType> .\",\n \"?expressionType <http://purl.org/dc/elements/1.1/title> ?expressionTypeTitle .\",\n \"}\",\n \"ORDER BY ?expressionTypeTitle\"].join(' ');\n dispatch(startExpressionTypesListFetch());\n Axios.get(sparqlEndpoint, {params: {\"query\" : query, \"output\": \"json\"}}).then(function(res){\n const results = res.data.results.bindings;\n const expressionTypes = results.map((result) => {\n return {\n expressionType: result.expressionType.value,\n expressionTypeTitle: result.expressionTypeTitle.value,\n }\n });\n dispatch(completeExpressionTypesListFetch(expressionTypes));\n });\n };\n","import React from 'react';\nimport {Link} from 'react-router-dom';\nimport Axios from 'axios'\n\n\n//TODO: these retrieves need to be refactored into; \n// if exist db api is improved then a single request should be easier\n\n// // TODO; the following should be deleted; now that new search script has been made\n// export function retrieveExpressionResults(searchTerm, searchEid){\n// const expressionShortId = searchEid === \"all\" ? searchEid : searchEid.split(\"/resource/\")[1]\n// const url = \"https://exist.scta.info/exist/apps/scta-app/jsonsearch/json-search-text-by-expressionid.xq?query=\" + searchTerm + \"&expressionid=\" + expressionShortId\n// const queryPromise = Axios.get(url)\n// return queryPromise\n// }\n// // TODO; the following should be deleted; now that new search script has been made\n// export function retrieveAuthorResults(searchTerm, searchAuthor){\n// const authorShortId = searchAuthor.split(\"/resource/\")[1]\n// const url = \"https://exist.scta.info/exist/apps/scta-app/jsonsearch/json-search-text-by-authorid.xq?query=\" + searchTerm + \"&authorid=\" + authorShortId\n// const queryPromise = Axios.get(url)\n// return queryPromise\n\n// }\n// // TODO; the following should be deleted; now that new search script has been made\n// export function retrieveWorkGroupResults(searchTerm, searchWorkGroup){\n// const workGroupShortId = searchWorkGroup.split(\"/resource/\")[1]\n// const url = \"https://exist.scta.info/exist/apps/scta-app/jsonsearch/json-search-text-by-workGroupId.xq?query=\" + searchTerm + \"&workGroupId=\" + workGroupShortId\n// const queryPromise = Axios.get(url)\n// return queryPromise\n\n// }\nexport function retrieveFigureResults(searchTerm, searchEid){\n const expressionShortId = searchEid === \"all\" ? searchEid : searchEid.split(\"/resource/\")[1]\n const url = \"https://exist2.scta.info/exist/apps/scta-app/jsonsearch/json-search-text-by-figure.xq?query=\" + searchTerm + \"&expressionid=\" + expressionShortId\n const queryPromise = Axios.get(url)\n return queryPromise\n}\n\nexport function retrieveSearchResults(searchTerm, searchEid, searchWorkGroup, searchAuthor, searchETypeId, searchType, offset){\n const workGroupShortId = searchWorkGroup && searchWorkGroup.split(\"/resource/\")[1]\n const expressionShortId = searchEid && searchEid.split(\"/resource/\")[1]\n const expressionTypeShortId = searchETypeId && searchETypeId.split(\"/resource/\")[1]\n const authorShortId = searchAuthor && searchAuthor.split(\"/resource/\")[1]\n const queryParameters = []\n if (expressionShortId){\n queryParameters.push(\"eid=\" + expressionShortId)\n }\n if (expressionTypeShortId){\n queryParameters.push(\"etid=\" + expressionTypeShortId)\n }\n if (authorShortId){\n queryParameters.push(\"aid=\" + authorShortId)\n }\n if (workGroupShortId){\n queryParameters.push(\"wgid=\" + workGroupShortId)\n }\n if (searchType){\n queryParameters.push(\"searchType=\" + searchType)\n }\n if (offset){\n queryParameters.push(\"offset=\" + offset)\n }\n const queryString = \"?query=\" + searchTerm + \"&\" + queryParameters.join(\"&\");\n const url = \"https://exist2.scta.info/exist/apps/scta-app/jsonsearch/json-search-text.xq\" + queryString\n const queryPromise = Axios.get(url)\n return queryPromise\n}\n\nexport function displayFigureResults(results, idTitleMap){\n if (!results || results.length === 0){\n return (<div>\n <p>No results found</p>\n </div>)\n }\n else if (results.length > 0){\n console.log(\"results\", results)\n const figureResults = results.map((r, i) => {\n const imgurl = r.imgurl\n const longTitle = idTitleMap[\"http://scta.info/resource/\" + r.pid] ? idTitleMap[\"http://scta.info/resource/\" + r.pid].longTitle : \"\"\n //const author = idTitleMap[\"http://scta.info/resource/\" + r.pid] ? idTitleMap[\"http://scta.info/resource/\" + r.pid].author : \"\"\n const authorTitle = idTitleMap[\"http://scta.info/resource/\" + r.pid] ? idTitleMap[\"http://scta.info/resource/\" + r.pid].authorTitle : \"\"\n return (\n <div key={i} className=\"figure-tile\">\n {/* <Link to={\"/text?resourceid=http://scta.info/resource/\" + r.pid}><img src={imgurl} alt=\"figure\"></img></Link> */}\n <Link to={\"/text?resourceid=http://scta.info/resource/\" + r.pid}>\n <span className=\"image-description\">{authorTitle + \", \" + longTitle + \" (\" + r.pid + \")\"}</span>\n <img src={imgurl} alt=\"figure\"></img>\n </Link>\n \n </div>\n )\n })\n return (\n <div className=\"figure-grid\">\n {/* <p>{results.length + \" results\"}</p> */}\n {figureResults}\n </div>\n )\n }\n // TODO: i think this can be deleted\n // else if (results){\n // const r = results\n // const imgurl = r.imgurl\n // return (\n // <div>\n // <p>{1 + \" results\"}</p>\n // <div key={results.pid}>\n // <p><Link to={\"/text?resourceid=http://scta.info/resource/\" + r.pid}>{r.pid}</Link></p>\n // <img src={imgurl} alt=\"figure\" style={{\"width\": \"300px\"}}></img>\n // </div>\n // </div>\n // )\n // }\n else {\n return (\n <div><p>No results</p></div>\n )\n }\n } \n\n\nexport function displayTextResults(results, idTitleMap){\n if (!results || results.length === 0){\n return (<div>\n <p>No results found</p>\n </div>)\n }\n else {\n if (results.length > 0){\n const textResults = results.map((r, i) => {\n const textString = r.previous + \" <span class='highlight'>\" + r.hit + \"</span> \" + r.next\n const range = r.start + \"-\" + r.end\n const longTitle = idTitleMap[\"http://scta.info/resource/\" + r.pid] ? idTitleMap[\"http://scta.info/resource/\" + r.pid].longTitle : \"\"\n //const author = idTitleMap[\"http://scta.info/resource/\" + r.pid] ? idTitleMap[\"http://scta.info/resource/\" + r.pid].author : \"\"\n const authorTitle = idTitleMap[\"http://scta.info/resource/\" + r.pid] ? idTitleMap[\"http://scta.info/resource/\" + r.pid].authorTitle : \"\"\n return (\n <div key={i}>\n {/* <p><Link to={\"/text?resourceid=http://scta.info/resource/\" + r.pid + \"@\" + range}>{r.pid + \"@\" + range}</Link></p> */}\n <p><Link to={\"/text?resourceid=http://scta.info/resource/\" + r.pid + \"@\" + range}>{authorTitle + \", \" + longTitle + \" (\" + r.pid + \"@\" + range + \")\"}</Link></p>\n <p dangerouslySetInnerHTML={{ __html: textString}}/>\n </div>\n )\n \n })\n return (\n <div>\n {textResults}\n </div>\n )\n }\n // don't think this is necessary now that I've forced all results to be an array \n // else if (results){\n // const r = results\n // const textString = r.previous + \" <span class='highlight'>\" + r.hit + \"</span> \" + r.next\n // const range = r.start + \"-\" + r.end\n // return (\n // <div>\n // <p>{1 + \" results\"}</p>\n // <div key={results.pid}>\n // <p><Link to={\"/text?resourceid=http://scta.info/resource/\" + r.pid + \"@\" + range}>{r.pid + \"@\" + range}</Link></p>\n // <p dangerouslySetInnerHTML={{ __html: textString}}/>\n // </div>\n // </div>\n // )\n // }\n else{\n return (\n <div><p>No results</p></div>\n )\n }\n }\n}\n\nexport function displayQuestionResults(results, searchParameters){\n if (results.length > 0){\n const displayResults = results.map((r, i) => {\n return (\n <div key={r.resource.value + \"-\" + i}>\n <p><Link to={\"/text?resourceid=\" + r.author.value}>{r.authorTitle.value}</Link>: <Link to={\"/text?resourceid=\" + r.resource.value}>{r.longTitle.value}</Link></p>\n <p>{r.qtitle.value.toLowerCase().replace(searchParameters.searchTerm.toLowerCase(), searchParameters.searchTerm.toUpperCase())}</p>\n </div>\n )\n })\n return (\n <div>\n <p>{displayResults.length + \" results\"}</p>\n {displayResults}\n </div>\n )\n }\n else{\n return (\n <div>\n <p>No results</p>\n </div>\n )\n\n }\n}\n\nexport const getValueLongTitlesAndAuthors = (results) => {\n let values = []\n if (results){\n //if (results.length > 0){\n values = results.map((r) => {\n return \"<http://scta.info/resource/\" + r.pid + \">\"\n })\n //}\n // else {\n // values = [\"<http://scta.info/resource/\" + results.pid + \">\"]\n // }\n const valuesString = values.join(\" \")\n\n const query = [\n \"SELECT DISTINCT ?id ?longTitle ?author ?authorTitle \",\n \"{\",\n \"VALUES ?id {\" + valuesString + \"}\",\n \"?id <http://scta.info/property/longTitle> ?longTitle .\",\n \"OPTIONAL {\",\n \"?id <http://scta.info/property/isPartOfTopLevelExpression> ?topLevel .\",\n \"?topLevel <http://www.loc.gov/loc.terms/relators/AUT> ?author .\",\n \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle .\",\n \"}\",\n \"}\"].join('')\n return query\n }\n}\n\nexport const createIdTitleMap = (bindings) => {\n const idTitleMap = {}\n bindings.forEach((b) => {\n idTitleMap[b.id.value] = {\n longTitle: b.longTitle.value, \n author: b.author && b.author.value, \n authorTitle: b.authorTitle && b.authorTitle.value}\n })\n return idTitleMap\n}\n","import React, {useEffect, useState} from 'react';\nimport Form from 'react-bootstrap/Form';\nimport Button from 'react-bootstrap/Button';\nimport {runQuery} from './utils'\nimport {questionTitleQuery} from '../queries/questionTitleQuery'\nimport Spinner from './Spinner';\nimport Container from 'react-bootstrap/Container';\nimport Search3Parameters from './Search3Parameters';\nimport {retrieveSearchResults, displayTextResults, displayFigureResults, displayQuestionResults, createIdTitleMap, getValueLongTitlesAndAuthors} from './searchUtils'\n\nconst Search3 = (props) => {\n const urlParams = new URLSearchParams(window.location.search);\n const defaultSearchTerm = urlParams?.get(\"searchTerm\") || undefined\n const defaultSearchWorkGroup = !defaultSearchTerm ? undefined : \"http://scta.info/resource/scta\"\n\n const [searchParameters, setSearchParameters] = useState({\"searchTerm\": defaultSearchTerm, \"searchWorkGroup\": defaultSearchWorkGroup})\n const [results, setResults] = useState([])\n const [questionResults, setQuestionResults] = useState([])\n const [idTitleMap, setIdTitleMap] = useState()\n const [offset, setOffset] = useState(1)\n const [showMore, setShowMore] = useState(true)\n \n // TODO: check this; i don't think it is doing anything\n useEffect(() => {\n if (searchParameters.searchType === \"questionTitles\"){\n displayQuestionResults(filterQuestionResults(questionResults, searchParameters.resultsFilter), searchParameters)\n }\n if (searchParameters.searchType === \"figure\"){\n displayQuestionResults(filterQuestionResults(results, searchParameters.resultsFilter), searchParameters.resultsFilter, )\n }\n else if (searchParameters.searchType === \"text\"){\n displayTextResults(filterResults(results, searchParameters.resultsFilter), idTitleMap)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchParameters.resultsFilter])\n // TODO check above; might be deletable \n\n useEffect(() => {\n if (results !== \"fetching\"){\n const idTitleArray = runQuery(getValueLongTitlesAndAuthors(results))\n idTitleArray.then((d) => {\n setIdTitleMap(createIdTitleMap(d.data.results.bindings))\n })\n }\n }, [results])\n \n useEffect(() => {\n if (results !== \"fetching\"){\n setResults([])\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchParameters.searchType])\n\n \n\n useEffect(() => {\n if (searchParameters.searchEid || searchParameters.searchAuthor || searchParameters.searchWorkGroup || searchParameters.searchEType){\n \n const textResults = retrieveSearchResults(searchParameters.searchTerm, \n searchParameters.searchEid, \n searchParameters.searchWorkGroup, \n searchParameters.searchAuthor, \n searchParameters.searchEType,\n searchParameters.searchType,\n offset)\n setResults(\"fetching\")\n textResults.then((d) => {\n if (d.data.results){\n if (Array.isArray(d.data.results)){\n setResults(d.data.results) \n const showMore = d.data.results[0].moreResults === \"true\" ? true : false\n setShowMore(showMore)\n }\n else{\n setResults([d.data.results]) \n const showMore = d.data.results[0].moreResults === \"true\" ? true : false\n setShowMore(showMore)\n } \n }\n else{\n setResults([])\n }\n })\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [offset])\n \n const handleSetSearchParameters = (parameters) => {\n setSearchParameters(parameters)\n }\n\n const handleRunSearch = (e = null) => {\n if (e){\n e.preventDefault()\n }\n setShowMore(true)\n setOffset(1)\n if (!searchParameters.searchTerm){\n setResults([])\n }\n else{\n if (searchParameters.searchType === \"text\" || searchParameters.searchType === \"figure\"){\n setResults(\"fetching\")\n setQuestionResults([])\n if (searchParameters.searchEid || searchParameters.searchAuthor || searchParameters.searchWorkGroup || searchParameters.searchEType){\n const textResults = retrieveSearchResults(searchParameters.searchTerm, \n searchParameters.searchEid, \n searchParameters.searchWorkGroup, \n searchParameters.searchAuthor, \n searchParameters.searchEType,\n searchParameters.searchType,\n offset)\n textResults.then((d) => {\n if (d.data.results){\n if (Array.isArray(d.data.results)){\n setResults(d.data.results) \n const showMore = d.data.results[0].moreResults === \"true\" ? true : false\n setShowMore(showMore)\n }\n else{\n setResults([d.data.results]) \n const showMore = d.data.results.moreResults === \"true\" ? true : false\n setShowMore(showMore)\n } \n }\n else{\n setResults([])\n }\n })\n }\n }\n else if (searchParameters.searchType === \"questionTitles\"){\n const questionResults = runQuery(questionTitleQuery(searchParameters))\n setQuestionResults(\"fetching\")\n setResults([])\n questionResults.then((d) => {\n setQuestionResults(d.data.results.bindings)\n })\n }\n }\n }\n const displayResults = (results) => {\n if (results === \"fetching\" || questionResults === \"fetching\"){ \n return <Spinner/>\n }\n else if (searchParameters.searchType === \"questionTitles\"){\n return displayQuestionResults(filterQuestionResults(questionResults, searchParameters.resultsFilter), searchParameters)\n }\n else if (searchParameters.searchType === \"figure\"){\n return displayFigureResults(results, idTitleMap);\n }\n else if (searchParameters.searchType === \"text\"){\n return displayTextResults(filterResults(results, searchParameters.resultsFilter), idTitleMap)\n }\n }\n const filterResults = (results, resultsFilter) => {\n let newResults = [] \n if (!results || results.length === 0){\n newResults = [] \n }\n else if ((results.length > 0) && results !== \"fetching\"){\n results.forEach((r) => {\n if (r.previous && r.hit && r.next){\n const combinedString = [ r.previous.toLowerCase(), r.hit.toLowerCase(), r.next.toLowerCase()].join(\" \")\n if (combinedString.includes(resultsFilter.toLowerCase())){\n newResults.push(r)\n }\n }\n })\n }\n else if (results){\n const r = results;\n if (r.previous && r.hit && r.next){\n const combinedString = [r.previous.toLowerCase(), r.hit.toLowerCase(), r.next.toLowerCase()].join(\" \")\n newResults = combinedString.includes(resultsFilter.toLowerCase()) ? results : \"\";\n }\n }\n return newResults\n }\n // similar filter to above; but modified to handle question title data structure\n const filterQuestionResults = (results, resultsFilter) => {\n let newResults = [] \n if (!results || results.length === 0){\n newResults = [] \n }\n else if (results.length > 0){\n results.forEach((r) => {\n if (r.qtitle && r.qtitle.value.toLowerCase().includes(resultsFilter.toLowerCase())){\n newResults.push(r)\n }\n })\n }\n return newResults\n }\n return(\n <Container className={props.hidden ? \"hidden\" : \"showing\"}>\n <br/>\n <Form onSubmit={handleRunSearch}>\n <Search3Parameters\n handleSetSearchParameters={handleSetSearchParameters}\n searchAuthor={props.searchAuthor}\n searchEid={props.searchEid}\n searchEType={props.searchEType}\n searchWorkGroup={props.searchWorkGroup || defaultSearchWorkGroup}\n showAdvancedParameters={props.showAdvancedParameters}\n showLabels={props.showLabels}\n searchType={props.searchType}\n searchTerm={props.searchTerm || defaultSearchTerm}\n >\n {props.showSubmit && <Button onClick={handleRunSearch} className=\"btn-sm\" style={{marginRight: \"5px\"}}>Submit</Button>}\n </Search3Parameters>\n \n \n </Form>\n {results && results !== \"fetching\" && results.length > 0 && <p>{(offset !==1) && <span onClick={(() => {setOffset(offset - 30)})}>Show Previous</span>} \n <span> | </span>\n {/* <span>{\"page \" + offset + \" (results\" + results.length + \")\"}</span> */}\n {results && results !== \"fetching\" && showMore === true && <span onClick={(() => {setOffset(offset + 30)})}>Show More</span>}</p>}\n {displayResults(results)}\n \n </Container>\n\n )\n}\n\nSearch3.defaultProps = {\n showLabels: true,\n showAdvancedParameters: true,\n searchAuthor: \"\",\n searchEid: \"\",\n showSubmit: true\n};\n\nexport {Search3 as default}\n","//Vendor Imports\nimport React from 'react';\nimport Axios from 'axios'\nimport PropTypes from 'prop-types';\n\nclass Print extends React.Component {\n constructor(props){\n super(props)\n this.getPdf = this.getPdf.bind(this)\n this.state = {\n status: \"\",\n pdf: \"\",\n }\n }\n getPdf(url){\n const printApiUrlBase = \"https://print.lombardpress.org\"\n //const printApiUrlBase = \"localhost:5000\"\n Axios.get(printApiUrlBase + \"/api/v1/resource?url=\" + url)\n .then((data) => {\n console.log(data)\n if (data.data.url){\n console.log(\"first condition passed\", data.data.url)\n const hashWithExtension = data.data.url\n //window.location = \"http://print.lombardpress.org/api/v1/cache/\" + hashWithExtension\n this.setState({pdf: printApiUrlBase + \"/api/v1/cache/\" + hashWithExtension})\n }\n else{\n this.setState({status: data.data.Status + \"Please check back in a few minutes\", pdf: \"\"})\n }\n })\n\n }\n componentDidMount(){\n const url = this.props.url\n this.getPdf(url)\n }\n \n componentDidUpdate(prevProps){\n const newUrl = this.props.url\n const oldUrl = prevProps.url\n if (newUrl !== oldUrl){\n this.getPdf(newUrl)\n }\n }\n render(){\n\n return (\n <div style={{\"width\": \"100%\", \"height\": \"77vh\", \"margin\": \"auto\"}}>\n {this.state.pdf ?\n <object data={this.state.pdf} type=\"application/pdf\" width=\"100%\" height=\"100%\">\n alt : <a href={this.state.pdf}>{this.state.pdf}</a>\n </object>\n :\n <p>{this.state.status}</p>\n }\n </div>\n );\n }\n}\n\nPrint.propTypes = {\n /**\n * url to raw xml source file\n */\n url: PropTypes.string.isRequired,\n}\n\nexport default Print;\n","//note; each query here represents an attempt an efficient single request for related information\n//each query therefore could be tranformed into a restful api\n\n//NOTE: this query does not work as expected when using Fuseking version 3 it only works as expected using version 2.0\n// with version 3, it seems to get all quotes from the entire corpus, suggested something may not be working with the \"bind\" method\n export function getRelatedExpressions(itemExpressionUri, offset, pagesize, rangeStart, rangeEnd){\n\n let rangeFilter;\n if (rangeStart && rangeEnd){\n rangeFilter = [\"FILTER (?isRelatedToRangeEnd <=\" + rangeEnd + \")\",\n \"FILTER (?isRelatedToRangeStart >=\" + rangeStart + \")\"].join(\" \")\n }\n let activeSource; \n if (!rangeStart && !rangeEnd){\n activeSource = [ \n \"{\",\n \"?element <http://scta.info/property/source> ?isRelatedTo .\",\n \"FILTER (!isBlank(?isRelatedTo)) .\",\n \"}\",\n \"UNION\",\n \"{\",\n \"?element <http://scta.info/property/source> ?bn .\",\n \"?bn <http://scta.info/property/source> ?isRelatedTo .\",\n \"?bn <http://scta.info/property/canonicalRangeStart> ?isRelatedToRangeStart .\",\n \"?bn <http://scta.info/property/canonicalRangeEnd> ?isRelatedToRangeEnd .\",\n \"}\"].join(\" \")\n }\n else{\n activeSource = [\"?element <http://scta.info/property/source> ?bn .\",\n \"?bn <http://scta.info/property/source> ?isRelatedTo .\",\n \"?bn <http://scta.info/property/canonicalRangeStart> ?isRelatedToRangeStart .\",\n \"?bn <http://scta.info/property/canonicalRangeEnd> ?isRelatedToRangeEnd .\",\n rangeFilter].join(\" \")\n }\n \n let inverseSource;\n if (!rangeStart && !rangeEnd){\n inverseSource = [\"{\",\n \"?isRelatedTo <http://scta.info/property/source> ?element .\",\n \"}\",\n \"UNION\",\n \"{\",\n \"?isRelatedTo <http://scta.info/property/source> ?bn .\",\n \"?bn <http://scta.info/property/source> ?element .\",\n \"?bn <http://scta.info/property/canonicalRangeStart> ?isRelatedToRangeStart .\",\n \"?bn <http://scta.info/property/canonicalRangeEnd> ?isRelatedToRangeEnd .\",\n \"}\"].join(\" \")\n }\n else{\n inverseSource = [\"?isRelatedTo <http://scta.info/property/source> ?bn .\",\n \"?bn <http://scta.info/property/source> ?element .\",\n \"?bn <http://scta.info/property/canonicalRangeStart> ?isRelatedToRangeStart .\",\n \"?bn <http://scta.info/property/canonicalRangeEnd> ?isRelatedToRangeEnd .\",\n rangeFilter].join(\" \")\n }\n //OLD QUERY THAT STOPPED WORKING As part of update to fuseki 4.3\n // const query = [\n // \"SELECT DISTINCT ?isRelatedTo ?label ?element ?longTitle ?author ?authorTitle ?isRelatedToRangeStart ?isRelatedToRangeEnd \",\n // \"WHERE\",\n // \"{ \",\n // \"BIND (<\" + itemExpressionUri + \"> as ?resource)\",\n // \"{\",\n // \"?resource ?o ?isRelatedTo .\",\n // \"?o a <http://scta.info/resource/textRelation> .\",\n // \"FILTER (?o != <http://scta.info/property/quotes>)\",\n // \"FILTER (?o != <http://scta.info/property/quotedBy>)\", \n // \"FILTER (?o != <http://scta.info/property/references>)\", \n // \"FILTER (?o != <http://scta.info/property/referencedBy>)\", \n // \"?o <http://www.w3.org/1999/02/22-rdf-syntax-ns#label> ?label . \",\n // \"?isRelatedTo a <http://scta.info/resource/expression> .\",\n // \"}\",\n // \"UNION\",\n // \"{\",\n // \"{\",\n // \"?resource <http://scta.info/property/structureType> <http://scta.info/resource/structureElement> .\",\n // \"BIND (?resource as ?element)\",\n // \"}\",\n // \"UNION\",\n // \"{\",\n // \"?element <http://scta.info/property/isMemberOf> ?resource .\",\n // \"}\",\n // \"{\",\n // activeSource,\n // \"?element <http://scta.info/property/structureElementType> <http://scta.info/resource/structureElementQuote> .\",\n // \"BIND ('quotes' as ?label) .\",\n // \"}\",\n // \"UNION\",\n // \"{\",\n // activeSource,\n // \"?element <http://scta.info/property/structureElementType> <http://scta.info/resource/structureElementRef> .\",\n // \"BIND ('refs' as ?label) .\",\n // \"}\",\n // \"}\",\n // \"UNION\", \n // \"{\",\n // \"{\",\n // \"BIND (?resource as ?element)\",\n // \"}\",\n // \"UNION\",\n // \"{\",\n // \"?element <http://scta.info/property/isMemberOf> ?resource .\",\n // \"}\",\n // \"{\",\n // inverseSource,\n // \"?isRelatedTo <http://scta.info/property/structureElementType> <http://scta.info/resource/structureElementQuote> .\",\n // \"BIND ('isQuotedBy' as ?label) .\",\n // \"}\",\n // \"UNION\",\n // \"{\",\n // inverseSource,\n // //\"?isRelatedTo <http://scta.info/property/source> ?element.\",\n // \"?isRelatedTo <http://scta.info/property/structureElementType> <http://scta.info/resource/structureElementRef> .\",\n // \"BIND ('isReferencedBy' as ?label) .\",\n // \"}\",\n // \"}\",\n // \"?isRelatedTo <http://scta.info/property/longTitle> ?longTitle .\",\n // \"?isRelatedTo <http://scta.info/property/isMemberOf> ?mem .\",\n // \"?mem <http://scta.info/property/level> '1' .\",\n // \"OPTIONAL\",\n // \"{\",\n // \"?mem <http://www.loc.gov/loc.terms/relators/AUT> ?author .\",\n // \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle\",\n // \"}\",\n // \"}\",\n // \"ORDER BY ?authorTitle\",\n // \"LIMIT \" + pagesize,\n // \"OFFSET \" + offset\n // ].join(' ');\n\n const query = [\n \"SELECT DISTINCT ?isRelatedTo ?label ?element ?longTitle ?author ?authorTitle ?isRelatedToRangeStart ?isRelatedToRangeEnd ?parentBlock \",\n \"WHERE\",\n \"{ \",\n \"BIND (<\" + itemExpressionUri + \"> AS ?resource) .\",\n \"{\",\n \"<\" + itemExpressionUri + \"> ?o ?isRelatedTo . \",\n \"?o a <http://scta.info/resource/textRelation> . \", \n \"FILTER (?o != <http://scta.info/property/quotes>) . \",\n \"FILTER (?o != <http://scta.info/property/quotedBy>) . \",\n \"FILTER (?o != <http://scta.info/property/references>).\",\n \"FILTER (?o != <http://scta.info/property/referencedBy>).\", \n \"?o <http://www.w3.org/1999/02/22-rdf-syntax-ns#label> ?label . \",\n \"?isRelatedTo a <http://scta.info/resource/expression> . \",\n \"}\", \n \"UNION\", \n \"{\",\n \"{\",\n \"<\" + itemExpressionUri + \"> <http://scta.info/property/structureType> <http://scta.info/resource/structureElement> . \",\n \"BIND (<\" + itemExpressionUri + \"> as ?element) .\",\n \"} \",\n \"UNION\", \n \"{\",\n \"?element <http://scta.info/property/isMemberOf> <\" + itemExpressionUri + \"> . \",\n \"}\",\n \"{ \",\n activeSource,\n \"{\",\n \"?element <http://scta.info/property/structureElementType> <http://scta.info/resource/structureElementQuote> . \",\n \"BIND ('quotes' as ?label) . \",\n \"}\",\n \"UNION\",\n \"{\",\n \"?element <http://scta.info/property/structureElementType> <http://scta.info/resource/structureElementRef> . \",\n \"BIND ('refs' as ?label) . \",\n \"}\",\n \"} \",\n \"} \",\n \"UNION\",\n \"{ \",\n \"{ \",\n \"BIND (<\" + itemExpressionUri + \"> as ?element) .\",\n \"} \",\n \"UNION \",\n \"{ \",\n \"?element <http://scta.info/property/isMemberOf> <\" + itemExpressionUri + \"> . \",\n \"}\",\n inverseSource,\n \"{\",\n \" ?isRelatedTo <http://scta.info/property/structureElementType> <http://scta.info/resource/structureElementQuote> . \",\n \" BIND ('isQuotedBy' as ?label) . \",\n \"} \",\n \"UNION\", \n \"{ \",\n \"?isRelatedTo <http://scta.info/property/structureElementType> <http://scta.info/resource/structureElementRef> . \",\n \"BIND ('isReferencedBy' as ?label) . \",\n \"}\",\n \"OPTIONAL\",\n \"{\",\n \"?isRelatedTo <http://scta.info/property/isPartOfStructureBlock> ?parentBlock .\",\n //\"?isRelatedTo <http://scta.info/property/isMemberOf> ?parentBlock .\",\n //\"?parentBlock <http://scta.info/property/structureType> <http://scta.info/resource/stuctureBlock> .\",\n \"}\",\n \"}\",\n \"?isRelatedTo <http://scta.info/property/longTitle> ?longTitle . \",\n \"?isRelatedTo <http://scta.info/property/isMemberOf> ?mem . \",\n \"?mem <http://scta.info/property/level> '1' . \",\n \"OPTIONAL \",\n \"{ \",\n \"?mem <http://www.loc.gov/loc.terms/relators/AUT> ?author . \",\n \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle .\",\n \"} \",\n \"} \",\n \"ORDER BY ?authorTitle\",\n \"LIMIT \" + pagesize,\n \"OFFSET \" + offset\n].join(' ');\n return query\n }\n//get Related Expressions\n// export function getRelatedExpressions(itemExpressionUri){\n// const query = [\n// \"SELECT DISTINCT ?isRelatedTo \",\n// \"WHERE { \",\n// \"{\",\n// \"<\" + itemExpressionUri + \"> <http://scta.info/property/isRelatedTo> ?isRelatedTo .\",\n// \"}\",\n// \"UNION\",\n// \"{\",\n// \"<\" + itemExpressionUri + \"> <http://scta.info/property/quotes> ?quote .\",\n// \"?quote a <http://scta.info/resource/quotation> .\",\n// \"?quote <http://scta.info/property/source> ?isRelatedTo .\",\n// \"}\",\n// \"UNION\",\n// \"{\",\n// \"<\" + itemExpressionUri + \"> <http://scta.info/property/quotes> ?quote .\",\n// \"?quote a <http://scta.info/resource/expression> .\",\n// \"<\" + itemExpressionUri + \"> <http://scta.info/property/quotes> ?isRelatedTo .\",\n// \"}\",\n// \"UNION\",\n// \"{\",\n// \"<\" + itemExpressionUri + \"> <http://scta.info/property/quotedBy> ?isRelatedTo .\",\n// \"}\",\n// \"UNION\",\n// \"{\",\n// \"<\" + itemExpressionUri + \"> <http://scta.info/property/abbreviates> ?isRelatedTo .\",\n// \"}\",\n// \"UNION\",\n// \"{\",\n// \"<\" + itemExpressionUri + \"> <http://scta.info/property/abbreviatedBy> ?isRelatedTo .\",\n// \"}\",\n// \"UNION\",\n// \"{\",\n// \"<\" + itemExpressionUri + \"> <http://scta.info/property/references> ?isRelatedTo .\",\n// \"}\",\n// \"UNION\",\n// \"{\",\n// \"<\" + itemExpressionUri + \"> <http://scta.info/property/referencedBy> ?isRelatedTo .\",\n// \"}\",\n// \"UNION\",\n// \"{\",\n// \"<\" + itemExpressionUri + \"> <http://scta.info/property/copies> ?isRelatedTo .\",\n// \"}\",\n// \"UNION\",\n// \"{\",\n// \"<\" + itemExpressionUri + \"> <http://scta.info/property/isCopiedBy> ?isRelatedTo .\",\n// \"}\",\n// \"}\"\n// ].join('');\n//\n// return query\n// }\n\n// query info block, division, or item (possible also collection)\nexport function basicInfoQuery(itemExpressionUri){\n const query = [\n \"SELECT DISTINCT ?title ?structureType ?cmanifestation ?cmanifestationTitle ?manifestation ?manifestationTitle ?ctranscription ?manifestationCTranscription ?manifestationCTranscriptionDoc ?cdoc ?cxml ?expressionShortId ?longTitle ?topLevelExpression ?next ?previous ?inbox ?author ?authorTitle ?parent \",\n \"WHERE { \",\n \"<\" + itemExpressionUri + \"> <http://purl.org/dc/elements/1.1/title> ?title .\",\n \"<\" + itemExpressionUri + \"> <http://scta.info/property/structureType> ?structureType .\",\n \"<\" + itemExpressionUri + \"> <http://scta.info/property/hasCanonicalManifestation> ?cmanifestation .\",\n \"?cmanifestation <http://purl.org/dc/elements/1.1/title> ?cmanifestationTitle .\",\n \"<\" + itemExpressionUri + \"> <http://scta.info/property/hasManifestation> ?manifestation .\",\n \"?manifestation <http://purl.org/dc/elements/1.1/title> ?manifestationTitle .\",\n \"OPTIONAL {\",\n \"?manifestation <http://scta.info/property/hasCanonicalTranscription> ?manifestationCTranscription .\",\n \"?manifestationCTranscription <http://scta.info/property/hasDocument> ?manifestationCTranscriptionDoc .\",\n \"?cmanifestation <http://scta.info/property/hasCanonicalTranscription> ?ctranscription .\",\n \"?ctranscription <http://scta.info/property/hasDocument> ?cdoc . \",\n \"?ctranscription <http://scta.info/property/hasXML> ?cxml . \",\n \"}\",\n \"<\" + itemExpressionUri + \"> <http://scta.info/property/shortId> ?expressionShortId .\",\n \"{\",\n \"<\" + itemExpressionUri + \"> <http://scta.info/property/isPartOfTopLevelExpression> ?topLevelExpression .\",\n \"}\",\n \"UNION\",\n \"{\",\n \"<\" + itemExpressionUri + \"> <http://scta.info/property/level> '1' .\",\n \"BIND(<\" + itemExpressionUri + \"> AS ?topLevelExpression) .\", \n \"}\",\n \"OPTIONAL {\",\n \"<\" + itemExpressionUri + \"> <http://scta.info/property/longTitle> ?longTitle .\",\n \"}\",\n \"OPTIONAL {\",\n \"?topLevelExpression <http://www.loc.gov/loc.terms/relators/AUT> ?author .\",\n \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle .\",\n \"}\",\n \"OPTIONAL {\",\n \"<\" + itemExpressionUri + \"> <http://scta.info/property/next> ?next .\",\n \"}\",\n \"OPTIONAL {\",\n \"<\" + itemExpressionUri + \"> <http://scta.info/property/previous> ?previous .\",\n \"}\",\n \"OPTIONAL {\",\n \"<\" + itemExpressionUri + \"> <http://purl.org/dc/terms/isPartOf> ?parent .\",\n \"}\",\n \"<\" + itemExpressionUri + \"> <http://www.w3.org/ns/ldp#inbox> ?inbox . \",\n \"}\",\n \"ORDER BY ?title\"].join('');\n\n return query\n }\n\n export function itemTranscriptionInfoQuery(itemTranscriptionUri){\n const query = [\n \"SELECT DISTINCT ?title ?manifestation ?doc ?xml ?expression ?expressionShortId ?longTitle ?topLevelExpression ?next ?previous ?inbox ?t \",\n \"WHERE { \",\n \"BIND(<\" + itemTranscriptionUri + \"> as ?t) . \",\n \"?t <http://purl.org/dc/elements/1.1/title> ?title .\",\n \"?t <http://scta.info/property/isTranscriptionOf> ?manifestation .\",\n \"?t <http://scta.info/property/hasDocument> ?doc . \",\n \"?t <http://scta.info/property/hasXML> ?xml . \",\n \"?manifestation <http://scta.info/property/isManifestationOf> ?expression .\",\n \"?expression <http://purl.org/dc/elements/1.1/title> ?expressionTitle .\",\n \"?expression <http://scta.info/property/shortId> ?expressionShortId .\",\n \"?expression <http://scta.info/property/longTitle> ?longTitle .\",\n \"?expression <http://scta.info/property/isPartOfTopLevelExpression> ?topLevelExpression .\",\n \"OPTIONAL {\",\n \"?expression <http://scta.info/property/next> ?next .\",\n \"}\",\n \"OPTIONAL {\",\n \"?expression <http://scta.info/property/previous> ?previous .\",\n \"}\",\n \"?expression <http://www.w3.org/ns/ldp#inbox> ?inbox . \",\n \"}\",\n \"ORDER BY ?expressionTitle\"].join('');\n\n return query\n }\n // gets all structure items with basic item information\n export function basicStructureAllItemsInfoQuery(topLevelExpressionUrl){\n const query = [\n \"SELECT DISTINCT ?item ?itemTitle ?topLevel ?itemQuestionTitle ?cm ?cmTitle ?ct ?next ?previous ?itemType ?doc \",\n \"WHERE { \",\n \"<\" + topLevelExpressionUrl + \"> <http://scta.info/property/hasStructureItem> ?item .\",\n \"?item <http://scta.info/property/isPartOfTopLevelExpression> ?topLevel .\",\n \"?item <http://purl.org/dc/elements/1.1/title> ?itemTitle .\",\n \"?item <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?itemType . \",\n \"OPTIONAL {\",\n \"?item <http://scta.info/property/questionTitle> ?itemQuestionTitle .\",\n \"}\",\n \"OPTIONAL\",\n \"{\",\n \"?item <http://scta.info/property/next> ?next .\",\n \"}\",\n \"OPTIONAL\",\n \"{\",\n \"?item <http://scta.info/property/previous> ?previous .\",\n \"}\",\n \"?item <http://scta.info/property/hasCanonicalManifestation> ?cm .\",\n \"?item <http://scta.info/property/totalOrderNumber> ?totalOrderNumber .\",\n \"?cm <http://purl.org/dc/elements/1.1/title> ?cmTitle .\",\n \"?cm <http://scta.info/property/hasCanonicalTranscription> ?ct .\",\n \"?ct <http://scta.info/property/hasDocument> ?doc .\",\n \"}\",\n \"ORDER BY ?totalOrderNumber\"].join('');\n return query\n }\n // gets all parts\n export function partsInfoQuery(resourceurl){\n const query = [\n \"SELECT DISTINCT ?title ?description ?part ?partTitle ?partQuestionTitle ?partType ?partLevel \",\n \"WHERE { \",\n \"<\" + resourceurl + \"> <http://purl.org/dc/elements/1.1/title> ?title .\",\n \"<\" + resourceurl + \"> <http://purl.org/dc/elements/1.1/description> ?description .\",\n \"<\" + resourceurl + \"> <http://purl.org/dc/terms/hasPart> ?part .\",\n \"?part <http://purl.org/dc/elements/1.1/title> ?partTitle .\",\n \"?part <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?partType . \",\n \"OPTIONAL {\",\n \"?part <http://scta.info/property/questionTitle> ?partQuestionTitle .\",\n \"}\",\n \"OPTIONAL {\",\n \"?part <http://scta.info/property/level> ?partLevel .\",\n \"}\",\n \"OPTIONAL {\",\n \"?part <http://scta.info/property/totalOrderNumber> ?totalOrderNumber .\",\n \"}\",\n \"}\",\n \"ORDER BY ?totalOrderNumber\"].join('');\n return query\n }\n // gets all expressions for work Group\n export function workGroupExpressionQuery(resourceurl){\n const query = [\n \"SELECT DISTINCT ?item ?itemTitle ?itemAuthor ?itemAuthorTitle ?itemType \",\n \"WHERE { \",\n \"<\" + resourceurl + \"> <http://scta.info/property/hasExpression> ?item .\",\n \"?item <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?itemType . \",\n \"?item <http://purl.org/dc/elements/1.1/title> ?itemTitle .\",\n \"?item <http://www.loc.gov/loc.terms/relators/AUT> ?itemAuthor .\",\n \"?itemAuthor <http://purl.org/dc/elements/1.1/title> ?itemAuthorTitle .\",\n \"}\",\n \"ORDER BY ?itemAuthorTitle\"].join('');\n return query\n }\n export function getArticleTranscriptionDoc(resourceurl){\n const query = [\n \"SELECT DISTINCT ?doc ?articleType \",\n \"WHERE { \",\n \"<\" + resourceurl + \"> <http://scta.info/property/hasCanonicalTranscription> ?ctranscription . \",\n \"<\" + resourceurl + \"> <http://scta.info/property/articleType> ?articleType .\",\n \"?ctranscription <http://scta.info/property/hasXML> ?doc . \",\n \"}\"].join('');\n return query\n }\n export function getItemTranscriptionFromBlockDiv(resourceurl){\n const query = [\n \"SELECT DISTINCT ?ctranscription ?blockDivExpression \",\n \"WHERE { \",\n \"OPTIONAL\",\n \"{\",\n //\"<\" + resourceurl + \"> <http://scta.info/property/isPartOfStructureItem> ?itemParent . \",\n //\"<\" + resourceurl + \"> <http://scta.info/property/isMemberOf> ?itemParent . \",\n \"{\",\n \"<\" + resourceurl + \"> <http://scta.info/property/isPartOfStructureItem> ?itemParent . \",\n \"}\",\n \"UNION\",\n \"{\",\n \"<\" + resourceurl + \"> <http://scta.info/property/isPartOfStructureBlock> ?blockParent .\",\n \"?blockParent <http://scta.info/property/isPartOfStructureItem> ?itemParent . \",\n \"}\",\n\n \"?itemParent <http://scta.info/property/structureType> <http://scta.info/resource/structureItem> . \",\n \"{\",\n \"{\",\n \"?itemParent <http://scta.info/property/hasCanonicalManifestation> ?cmanifestation . \",\n \"?cmanifestation <http://scta.info/property/hasCanonicalTranscription> ?ctranscription . \",\n \"}\",\n \"UNION\",\n \"{\",\n \"?itemParent <http://scta.info/property/hasCanonicalTranscription> ?ctranscription . \",\n \"}\",\n \"}\",\n \"}\",\n \"OPTIONAL\",\n \"{\",\n \"{\",\n \"<\" + resourceurl + \"> <http://scta.info/property/isManifestationOf> ?blockDivExpression . \",\n \"}\",\n \"UNION\",\n \"{\",\n \"<\" + resourceurl + \"> <http://scta.info/property/isTranscriptionOf> ?blockDivManifestation . \",\n \"?blockDivManifestation <http://scta.info/property/isManifestationOf> ?blockDivExpression . \",\n \"}\",\n \"}\",\n \"}\"].join('');\n return query\n }\n /**\n * @description constructs query needed for initial textSwitch component; captures resource type information and related \n * details needed to allow the textSwitch component decide what kind of display is necessary\n * \n * @param {string} resourceurl - resource url should be full scta url id\n * @returns {string} - returns query as string\n */\n export function getStructureType(resourceurl){\n const query = [\n \"SELECT DISTINCT ?type ?structureType ?level ?topLevel ?itemParent ?resourceTitle ?author ?authorTitle ?ctranscription \",\n \"WHERE { \",\n \"<\" + resourceurl + \"> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type . \",\n \"OPTIONAL {\",\n \"<\" + resourceurl + \"> <http://www.loc.gov/loc.terms/relators/AUT> ?author .\",\n \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle .\",\n \"}\",\n \"OPTIONAL {\",\n \"<\" + resourceurl + \"> <http://purl.org/dc/elements/1.1/title> ?resourceTitle .\",\n \"}\",\n \"OPTIONAL {\",\n \"<\" + resourceurl + \"> <http://scta.info/property/structureType> ?structureType . \",\n \"}\",\n \"OPTIONAL {\",\n \"<\" + resourceurl + \"> <http://scta.info/property/level> ?level . \",\n \"}\",\n \"OPTIONAL {\",\n \"<\" + resourceurl + \"> <http://scta.info/property/isPartOfTopLevelExpression> ?topLevel . \",\n \"}\",\n \"OPTIONAL {\",\n \"<\" + resourceurl + \"> <http://scta.info/property/isPartOfTopLevelManifestation> ?topLevel . \",\n \"}\",\n \"OPTIONAL {\",\n \"<\" + resourceurl + \"> <http://scta.info/property/isPartOfTopLevelTransription> ?topLevel . \",\n \"}\",\n \"OPTIONAL {\",\n \"{\",\n \"<\" + resourceurl + \"> <http://scta.info/property/isPartOfStructureItem> ?itemParent . \",\n \"}\",\n \"UNION\",\n \"{\",\n \"<\" + resourceurl + \"> <http://scta.info/property/isPartOfStructureBlock> ?blockParent . \",\n \"?blockParent <http://scta.info/property/isPartOfStructureItem> ?itemParent .\",\n \"}\",\n \"}\",\n \"OPTIONAL {\",\n \"{\",\n \"<\" + resourceurl + \"> <http://scta.info/property/hasCanonicalManifestation> ?cmanifestation . \",\n \"?cmanifestation <http://scta.info/property/hasCanonicalTranscription> ?ctranscription . \",\n \"}\",\n \"UNION\",\n \"{\",\n \"<\" + resourceurl + \"> <http://scta.info/property/hasCanonicalTranscription> ?ctranscription . \",\n \"}\",\n \"UNION\",\n \"{\",\n \"<\" + resourceurl + \"> a <http://scta.info/resource/transcription> . \",\n \"BIND(<\" + resourceurl + \"> AS ?ctranscription) .\",\n \"}\",\n \"}\",\n \"}\"].join('');\n return query\n }\n //surface id query, gets canvas and manifestation\n export function getSurfaceInfo(surfaceid){\n const query = [\n \"SELECT DISTINCT ?surfaceTitle ?isurface ?isurfaceTitle ?icodexTitle ?canvas ?imageurl ?next_surface ?previous_surface \",\n \"{\",\n \t\t\t\t\"<\" + surfaceid + \"> <http://purl.org/dc/elements/1.1/title> ?surfaceTitle .\",\n \t\t\t\t\"<\" + surfaceid + \"> <http://scta.info/property/hasISurface> ?isurface .\",\n \t\t\t\t\"OPTIONAL {\",\n \t\t\t\t\t\"<\" + surfaceid + \"> <http://scta.info/property/next> ?next_surface .\",\n \t\t\t\t\"}\",\n \t\t\t\t\"OPTIONAL {\",\n \t\t\t\t\t\"<\" + surfaceid + \"> <http://scta.info/property/previous> ?previous_surface .\",\n \"}\",\n \t\t\t\t\"OPTIONAL {\",\n \t\t\t\t\t\"?isurface <http://purl.org/dc/elements/1.1/title> ?isurfaceTitle .\",\n \t\t\t\t\t\"?isurface <http://purl.org/dc/elements/1.1/isPartOf> ?icodex .\",\n \t\t\t\t\t\"?icodex <http://purl.org/dc/elements/1.1/title> ?icodexTitle .\",\n \t\t\t\t\"}\",\n \t\t\t\t\"?isurface <http://scta.info/property/hasCanvas> ?canvas .\",\n \t\t\t\t\"OPTIONAL{\",\n \t\t\t\t\t\"?canvas <http://iiif.io/api/presentation/2#hasImageAnnotations> ?blank .\",\n \t\t\t\t\"}\",\n \t\t\t\t\"OPTIONAL{\",\n \t\t\t\t\"?canvas <http://www.w3.org/2003/12/exif/ns#height> ?c_height .\",\n \"}\",\n \t\t \"?blank <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> ?o .\",\n \t\t \"?o <http://www.w3.org/ns/oa#hasBody> ?o2 .\",\n \t\t \"OPTIONAL{\",\n \t\t\t\t\t \"?o2 <http://rdfs.org/sioc/services#has_service> ?imageurl .\",\n \t\t\t\t \"}\",\n \t\t\t\t \"OPTIONAL{\",\n \t\t\t\t\t \"?o2 <http://www.shared-canvas.org/ns/hasRelatedService> ?imageurl .\",\n \t\t\t\t \"}\",\n \"}\"].join('');\n\n return query\n }\n\n//surface id query, gets canvas and manifestation\nexport function getAuthorInformation(authorid){\n const query = [\n \"PREFIX dc: <http://purl.org/dc/elements/1.1/>\",\n \"CONSTRUCT\",\n \"{\",\n \"?author dc:title ?authorTitle ;\",\n \"<http://scta.info/property/hasTopLevelExpression> ?expression ;\",\n \"<http://scta.info/property/authorArticle> ?authorArticle;\",\n \"<http://scta.info/property/textArticle> ?textArticle .\",\n \t\"?authorArticle dc:title ?authorArticleTitle . \",\n \"?textArticle dc:title ?textArticleTitle . \",\n \t\"?expression dc:title ?topLevelExpressionTitle .\",\n \"}\",\n \"WHERE \",\n \"{\",\n \"BIND(<\" + authorid + \"> as ?author) . \",\n \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle .\",\n \"OPTIONAL\",\n \"{\",\n \"?expression <http://www.loc.gov/loc.terms/relators/AUT> ?author .\",\n \"?expression a <http://scta.info/resource/expression> .\",\n \"?expression <http://scta.info/property/level> '1' .\",\n \"?expression <http://purl.org/dc/elements/1.1/title> ?topLevelExpressionTitle .\",\n \"}\",\n \"OPTIONAL\",\n \"{\",\n \"?expression2 <http://www.loc.gov/loc.terms/relators/AUT> ?author .\",\n \"?textArticle <http://scta.info/property/isArticleOf> ?expression2 .\",\n \"?textArticle <http://purl.org/dc/elements/1.1/title> ?textArticleTitle .\",\n \"}\",\n \"OPTIONAL\",\n \"{\",\n \"?authorArticle <http://scta.info/property/isArticleOf> ?author .\",\n \"?authorArticle <http://purl.org/dc/elements/1.1/title> ?authorArticleTitle\",\n \"}\",\n \"}\"].join('');\n return query\n }\n\n export function versionHistoryInfo(transcriptionUri){\n \t \tconst query = [\n \t \t\t\"SELECT ?version ?version_shortId ?order_number ?version_label ?review ?doc\",\n \t \"{\",\n \"{\",\n \"BIND(<\" + transcriptionUri + \"> as ?version) . \",\n \t \"?version <http://scta.info/property/shortId> ?version_shortId .\",\n \"?version <http://scta.info/property/hasDocument> ?doc . \",\n \t \"?version <http://scta.info/property/versionOrderNumber> ?order_number .\",\n \t\t\t\t\t \"?version <http://scta.info/property/versionLabel> ?version_label .\",\n \t\t\t\t\t \"OPTIONAL {\",\n \t\t\t\t\t \t\"?version <http://scta.info/property/hasReview> ?review .\",\n \t\t\t\t \"}\",\n \t\t\t\t \"}\",\n \t \"UNION\",\n \"{\",\n \t \"<\" + transcriptionUri + \"> <http://scta.info/property/hasAncestor> ?version .\",\n \t\t\t\t\t \"?version <http://scta.info/property/shortId> ?version_shortId .\",\n \"?version <http://scta.info/property/hasDocument> ?doc . \",\n \t \"?version <http://scta.info/property/versionOrderNumber> ?order_number .\",\n \t\t\t\t\t \"?version <http://scta.info/property/versionLabel> ?version_label .\",\n \t\t\t\t\t \"OPTIONAL {\",\n \t\t\t\t\t \t\"?version <http://scta.info/property/hasReview> ?review .\",\n \t\t\t\t \"}\",\n \t\t\t\t \"}\",\n \t \"UNION\",\n \t \"{\",\n \t \"<\" + transcriptionUri + \"> <http://scta.info/property/hasDescendant> ?version .\",\n \t\t\t\t\t \"?version <http://scta.info/property/shortId> ?version_shortId .\",\n \"?version <http://scta.info/property/hasDocument> ?doc . \",\n \t \"?version <http://scta.info/property/versionOrderNumber> ?order_number .\",\n \t\t\t\t\t \"?version <http://scta.info/property/versionLabel> ?version_label .\",\n \t\t\t\t\t \"OPTIONAL {\",\n \t\t\t\t\t \t\"?version <http://scta.info/property/hasReview> ?review .\",\n \t\t\t\t \"}\",\n \t\t\t\t \"}\",\n \t \"}\",\n \t \"ORDER BY DESC(?order_number)\"].join('');\n return query\n }\n\n //gets lines and zone order for\n export function getBlockLines(manifestationBlockId){\n const query = [\n \"SELECT ?first ?last ?order ?surface\",\n \"{\",\n \"<\" + manifestationBlockId + \"> <http://scta.info/property/isOnZone> ?zone . \",\n \"?zone <http://scta.info/property/isOnZone> ?zone2 .\",\n \"?zone2 <http://scta.info/property/firstLine> ?first .\",\n \"?zone2 <http://scta.info/property/lastLine> ?last .\",\n \"?zone2 <http://scta.info/property/isPartOfSurface> ?surface .\",\n \"?zone <http://scta.info/property/isOnZoneOrder> ?order .\",\n \"}\"].join('');\n return query\n }\n\n //gets lines and zone order for\n export function getChildParts(resourceid){\n const query = [\n \"SELECT ?part ?title ?level ?order ?structureType ?questionTitle ?author ?authorTitle ?isPartOf ?isPartOfTitle \",\n \"{\",\n \"<\" + resourceid + \"> <http://purl.org/dc/terms/hasPart> ?part . \",\n \"?part <http://purl.org/dc/elements/1.1/title> ?title .\",\n \"OPTIONAL {\",\n \"?isPartOf <http://purl.org/dc/terms/hasPart> <\" + resourceid + \"> .\",\n \"?isPartOf <http://purl.org/dc/elements/1.1/title> ?isPartOfTitle .\",\n \"}\",\n \"OPTIONAL {\",\n \"?part <http://www.loc.gov/loc.terms/relators/AUT> ?author .\",\n \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle .\",\n \"}\",\n \"OPTIONAL\",\n \"{\",\n \"?part <http://scta.info/property/level> ?level .\",\n \"}\",\n \"OPTIONAL\",\n \"{\",\n \"?part <http://scta.info/property/structureType> ?structureType .\",\n \"}\",\n \"OPTIONAL\",\n \"{\",\n \"{\",\n \"?part <http://scta.info/property/sectionOrderNumber> ?order .\",\n \"}\",\n \"UNION\",\n \"{\",\n \"?part <http://scta.info/property/isTranscriptionOf> ?mpart . \",\n \"?mpart <http://scta.info/property/isManifestationOf> ?epart . \",\n \"?epart <http://scta.info/property/sectionOrderNumber> ?order .\",\n \"}\",\n \"UNION\",\n \"{\",\n \"?part <http://scta.info/property/isManifestationOf> ?epart . \",\n \"?epart <http://scta.info/property/sectionOrderNumber> ?order .\",\n \"}\",\n \"}\",\n \"OPTIONAL\",\n \"{\",\n \"?part <http://scta.info/property/questionTitle> ?questionTitle .\",\n \"}\",\n \"}\",\n \"ORDER BY ?order ?authorTitle\"].join('');\n return query\n }\n //gets lines and zone order for\n export function getMembersOf(resourceid){\n const query = [\n \"SELECT ?memberOf\",\n \"{\",\n \"<\" + resourceid + \"> <http://scta.info/property/isMemberOf> ?memberOf . \",\n \"}\"].join('');\n return query\n }\n\n export function getManifestationCitationInfo(transcriptionid){\n var query = [\n \"SELECT DISTINCT ?manifestation ?manifestationTitle ?manifestationSurface ?surfaceTitle ?codexTitle ?datasource ?eLongTitle ?author ?authorTitle ?expression ?editor ?editorTitle\",\n \"{\",\n \"<\" + transcriptionid + \"> <http://scta.info/property/isTranscriptionOf> ?manifestation .\",\n \"<\" + transcriptionid + \"> <http://scta.info/property/hasXML> ?datasource . \",\n \"?manifestation <http://purl.org/dc/elements/1.1/title> ?manifestationTitle .\",\n \"{\",\n \"?manifestation <http://scta.info/property/isPartOfTopLevelManifestation> ?topLevelManifestation .\",\n \"}\",\n \"UNION\",\n \"{\",\n \"?manifestation <http://scta.info/property/level> '1' .\",\n \"BIND (?manifestation AS ?topLevelManifestation) .\",\n \"}\",\n \"OPTIONAL {\",\n \"?topLevelManifestation <http://scta.info/property/editor> ?editor .\",\n \"?editor <http://purl.org/dc/elements/1.1/title> ?editorTitle .\",\n \"}\",\n \"?manifestation <http://scta.info/property/isManifestationOf> ?expression .\",\n \"{\",\n \"?expression <http://scta.info/property/isPartOfTopLevelExpression> ?topLevelExpression .\",\n \"}\",\n \"UNION\",\n \"{\",\n \"?expression <http://scta.info/property/level> '1' .\",\n \"BIND (?expression AS ?topLevelExpression) .\",\n \"}\",\n \"OPTIONAL {\",\n \"?expression <http://scta.info/property/longTitle> ?eLongTitle\",\n \"}\",\n \"OPTIONAL {\",\n \"?topLevelExpression <http://www.loc.gov/loc.terms/relators/AUT> ?author .\",\n \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle .\",\n \"}\",\n // # TODO isOnSurface should become more uniform across manifestations in order to simplify this\n \"OPTIONAL\",\n \"{\",\n // #option 1 get surfaces for elements and blocks\n \"{\",\n \"?manifestation <http://scta.info/property/isOnZone> ?bn . \",\n \"?bn <http://scta.info/property/isOnZone> ?zone .\",\n \"?zone <http://scta.info/property/isPartOfSurface> ?manifestationSurface .\",\n \"}\",\n \"UNION\",\n //#option 2 get surface for divisions and items\n \"{\",\n \"?manifestation <http://scta.info/property/hasStructureBlock> ?block .\",\n \"?block <http://scta.info/property/isOnSurface> ?manifestationSurface .\",\n \"}\",\n \"UNION\",\n //#option 3 get surfaces for collections\"\n \"{\",\n \"?manifestation <http://scta.info/property/hasStructureItem> ?item .\",\n \"?item <http://scta.info/property/isOnSurface> ?manifestationSurface .\",\n \"}\",\n \"?manifestationSurface <http://purl.org/dc/elements/1.1/title> ?surfaceTitle .\",\n \"?manifestationSurface <http://scta.info/property/order> ?surface_order .\",\n \"?codex <http://scta.info/property/hasSurface> ?manifestationSurface .\",\n \"?codex <http://purl.org/dc/elements/1.1/title> ?codexTitle .\",\n \"}\",\n \"}\",\n \"ORDER BY ?surface_order\"].join('');\n return query\n }\n \n\n export function getCodices(){\n const query = [\n \"SELECT ?codex ?codex_title\",\n \t \"{\",\n\t\t\t\t \"?codex a <http://scta.info/resource/codex> .\",\n\t\t\t\t \"?codex <http://purl.org/dc/elements/1.1/title> ?codex_title\",\n\t\t\t\t\"}\",\n\t\t\t \"ORDER BY ?codex_title\"].join('')\n return query\n }\n export function getCodexInfo(codexid){\n const query = [\n \"SELECT DISTINCT ?codex ?expression ?codex_title ?item_expression_title ?item_expression_question_title ?surface ?surface_title ?surface_order ?manifestation ?manifestation_short_id ?status \",\n \"{\",\n \"BIND(<\" + codexid + \"> as ?codex) . \",\n \"?codex <http://purl.org/dc/elements/1.1/title> ?codex_title .\",\n \"OPTIONAL {\",\n \"?icodex <http://scta.info/property/isCodexItemOf> ?codex .\",\n \"?isurface <http://purl.org/dc/elements/1.1/isPartOf> ?icodex .\",\n \"?surface <http://scta.info/property/hasISurface> ?isurface .\",\n \"?surface <http://scta.info/property/order> ?surface_order .\",\n \"?surface <http://purl.org/dc/elements/1.1/title> ?surface_title .\",\n \"?manifestation <http://scta.info/property/isOnSurface> ?surface .\",\n \"?manifestation <http://scta.info/property/structureType> <http://scta.info/resource/structureItem> .\",\n \"?manifestation <http://scta.info/property/shortId> ?manifestation_short_id .\",\n \"?manifestation <http://scta.info/property/isManifestationOf> ?expression .\",\n \"?expression <http://purl.org/dc/elements/1.1/title> ?item_expression_title .\",\n \"?expression <http://scta.info/property/status> ?status .\",\n \"OPTIONAL {\",\n \"?expression <http://scta.info/property/questionTitle> ?item_expression_question_title .\",\n \"}\",\n \"}\",\n \"}\",\n \"ORDER BY ?surface_order\"].join('')\n return query\n }\n export function getCodexInfoFromManifest(manifestid){\n const query = [\n \"SELECT DISTINCT ?codex ?expression ?codex_title ?item_expression_title ?item_expression_question_title ?surface ?surface_title ?surface_order ?manifestation ?manifestation_short_id ?status \",\n \"{\",\n \"?icodex <http://scta.info/property/hasOfficialManifest> <\" + manifestid + \"> .\",\n \"?codex <http://scta.info/property/hasCodexItem> ?icodex .\",\n \"?codex <http://purl.org/dc/elements/1.1/title> ?codex_title .\",\n \"OPTIONAL {\",\n \"?icodex <http://scta.info/property/isCodexItemOf> ?codex .\",\n \"?isurface <http://purl.org/dc/elements/1.1/isPartOf> ?icodex .\",\n \"?surface <http://scta.info/property/hasISurface> ?isurface .\",\n \"?surface <http://scta.info/property/order> ?surface_order .\",\n \"?surface <http://purl.org/dc/elements/1.1/title> ?surface_title .\",\n \"?manifestation <http://scta.info/property/isOnSurface> ?surface .\",\n \"?manifestation <http://scta.info/property/structureType> <http://scta.info/resource/structureItem> .\",\n \"?manifestation <http://scta.info/property/shortId> ?manifestation_short_id .\",\n \"?manifestation <http://scta.info/property/isManifestationOf> ?expression .\",\n \"?expression <http://purl.org/dc/elements/1.1/title> ?item_expression_title .\",\n \"?expression <http://scta.info/property/status> ?status .\",\n \"OPTIONAL {\",\n \"?expression <http://scta.info/property/questionTitle> ?item_expression_question_title .\",\n \"}\",\n \"}\",\n \"}\",\n \"ORDER BY ?surface_order\"].join('')\n return query\n }\n\n export function getCodexInfoFromSurface(surfaceid){\n const query = [\n \"SELECT DISTINCT ?codex ?expression ?codex_title ?item_expression_title ?item_expression_question_title ?surface ?surface_title ?surface_order ?manifestation ?manifestation_short_id ?status \",\n \"{\",\n \"?codex <http://scta.info/property/hasSurface> <\" + surfaceid + \"> .\",\n \"?codex <http://purl.org/dc/elements/1.1/title> ?codex_title .\",\n \"OPTIONAL {\",\n \"?icodex <http://scta.info/property/isCodexItemOf> ?codex .\",\n \"?isurface <http://purl.org/dc/elements/1.1/isPartOf> ?icodex .\",\n \"?surface <http://scta.info/property/hasISurface> ?isurface .\",\n \"?surface <http://scta.info/property/order> ?surface_order .\",\n \"?surface <http://purl.org/dc/elements/1.1/title> ?surface_title .\",\n \"?manifestation <http://scta.info/property/isOnSurface> ?surface .\",\n \"?manifestation <http://scta.info/property/structureType> <http://scta.info/resource/structureItem> .\",\n \"?manifestation <http://scta.info/property/shortId> ?manifestation_short_id .\",\n \"?manifestation <http://scta.info/property/isManifestationOf> ?expression .\",\n \"?expression <http://purl.org/dc/elements/1.1/title> ?item_expression_title .\",\n \"?expression <http://scta.info/property/status> ?status .\",\n \"OPTIONAL {\",\n \"?expression <http://scta.info/property/questionTitle> ?item_expression_question_title .\",\n \"}\",\n \"}\",\n \"}\",\n \"ORDER BY ?surface_order\"].join('')\n return query\n }\n\n export function getCodexInfoFromCanvas(canvasid){\n const query = [\n \"SELECT DISTINCT ?codex ?surfaceFocus ?expression ?codex_title ?item_expression_title ?item_expression_question_title ?surface ?surface_title ?surface_order ?manifestation ?manifestation_short_id ?status \",\n \"{\",\n \"?isurfaceFocus <http://scta.info/property/hasCanvas> <\" + canvasid + \"> .\",\n \"?surfaceFocus <http://scta.info/property/hasISurface> ?isurfaceFocus .\",\n \"?codex <http://scta.info/property/hasSurface> ?surfaceFocus .\",\n \"?codex <http://purl.org/dc/elements/1.1/title> ?codex_title .\",\n \"OPTIONAL {\",\n \"?icodex <http://scta.info/property/isCodexItemOf> ?codex .\",\n \"?isurface <http://purl.org/dc/elements/1.1/isPartOf> ?icodex .\",\n \"?surface <http://scta.info/property/hasISurface> ?isurface .\",\n \"?surface <http://scta.info/property/order> ?surface_order .\",\n \"?surface <http://purl.org/dc/elements/1.1/title> ?surface_title .\",\n \"?manifestation <http://scta.info/property/isOnSurface> ?surface .\",\n \"?manifestation <http://scta.info/property/structureType> <http://scta.info/resource/structureItem> .\",\n \"?manifestation <http://scta.info/property/shortId> ?manifestation_short_id .\",\n \"?manifestation <http://scta.info/property/isManifestationOf> ?expression .\",\n \"?expression <http://purl.org/dc/elements/1.1/title> ?item_expression_title .\",\n \"?expression <http://scta.info/property/status> ?status .\",\n \"OPTIONAL {\",\n \"?expression <http://scta.info/property/questionTitle> ?item_expression_question_title .\",\n \"}\",\n \"}\",\n \"}\",\n \"ORDER BY ?surface_order\"].join('')\n return query\n }\n\n export function getSearchExpressionList(filters){\n //filters should be an ojbect\n let authorFilter = \"\"\n if (filters.authorId){\n authorFilter = \"BIND(<\" + filters.authorId + \"> as ?author) . \"\n }\n const query = [\n \"SELECT DISTINCT ?expressionid ?expressionTitle ?author ?authorTitle \",\n \"{\",\n authorFilter,\n \"?author a <http://scta.info/resource/person> .\",\n \"?expressionid <http://www.loc.gov/loc.terms/relators/AUT> ?author .\",\n \"?expressionid a <http://scta.info/resource/expression> .\",\n \"?expressionid <http://scta.info/property/level> '1' .\",\n \"?expressionid <http://purl.org/dc/elements/1.1/title> ?expressionTitle .\",\n \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle .\",\n \"}\",\n \"ORDER BY ?authorTitle\"].join('')\n return query\n }\n export function getSearchAuthorList(filters){\n //filters should be an ojbect\n const query = [\n \"SELECT DISTINCT ?author ?authorTitle \",\n \"{\",\n \"?author a <http://scta.info/resource/person> .\",\n \"?expressionid <http://www.loc.gov/loc.terms/relators/AUT> ?author .\",\n \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle .\",\n\n \"}\",\n \"ORDER BY ?authorTitle\"].join('')\n return query\n }\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport {FaExternalLinkAlt, FaChevronDown, FaChevronUp} from 'react-icons/fa';\nimport {Link} from 'react-router-dom';\n\nimport {runQuery} from './utils'\nimport {getChildParts} from './Queries'\n\n/**\n* creates a text outline section\n*/\nclass TextOutline extends React.Component {\n constructor(props){\n super(props)\n this.handleToggleChildren = this.handleToggleChildren.bind(this)\n this.mounted = \"\"\n this.state = {\n parts: [],\n showChildren: false,\n isPartOf: {}\n }\n\n }\n /**\n @public\n * toggles state.showChildren indicating whether or not section children should be mounted\n */\n handleToggleChildren(e){\n e.preventDefault();\n this.setState((prevState) => {\n return {showChildren: !prevState.showChildren}\n })\n }\n retrieveParts(resourceid){\n\n const partsInfo = runQuery(getChildParts(resourceid))\n partsInfo.then((data) => {\n\n // async seems to be working pretty well and efficiently.\n // if a section has many parts, it will be fired several times.\n // if it has a 100 parts, it will fire 100 times.\n // But 100 doesn't seem to causing serious performance issues.\n //console.log(\"async test; fired\")\n const newData = data.data.results.bindings.map((d) => {\n\n return {\n part: d.part.value,\n title: d.title.value,\n level: d.level ? d.level.value : \"\",\n author: d.author ? d.author.value : \"\",\n authorTitle: d.authorTitle ? d.authorTitle.value : \"\",\n structureType: d.structureType ? d.structureType.value : \"\",\n questionTitle: d.questionTitle ? d.questionTitle.value : \"\"\n }\n })\n\n let isPartOf = {isPartOfId: \"\", isPartOfTitle: \"\"}\n if (data.data.results.bindings[0]){\n if (data.data.results.bindings[0].isPartOf){\n isPartOf.isPartOfId = data.data.results.bindings[0].isPartOf.value\n isPartOf.isPartOfTitle = data.data.results.bindings[0].isPartOfTitle.value\n }\n }\n\n\n if (this.mounted){\n this.setState({parts: newData, isPartOf: isPartOf})\n }\n })\n }\n componentDidMount(){\n //this.setState({showChildren: this.props.showChildren})\n this.mounted = true;\n this.retrieveParts(this.props.resourceid)\n \n if (this.props.membersOf){\n if (this.props.membersOf.includes(this.props.resourceid)) {\n this.setState({showChildren: true})\n\n }\n }\n\n }\n // UNSAFE_componentWillReceiveProps(newProps){\n // if (newProps.resourceid !== this.props.resourceid){\n // this.retrieveParts(this.props.resourceid)\n // }\n // if (newProps.resourceid !== this.props.resourceid || newProps.membersOf !== this.props.membersOf){\n // if (newProps.membersOf){\n // if (newProps.membersOf.includes(newProps.resourceid)) {\n // this.setState({showChildren: true})\n // }\n // // else{\n // // this.setState({showChildren: false})\n // // }\n // }\n // }\n\n // }\n componentDidUpdate(prevProps){\n if (this.props.resourceid !== prevProps.resourceid){\n this.retrieveParts(this.props.resourceid)\n }\n if (this.props.resourceid !== prevProps.resourceid || this.props.membersOf !== prevProps.membersOf){\n if (this.props.membersOf){\n if (this.props.membersOf.includes(this.props.resourceid)) {\n this.setState({showChildren: true})\n }\n // else{\n // this.setState({showChildren: false})\n // }\n }\n }\n\n }\n componentWillUnmount(){\n this.mounted = false;\n }\n render(){\n const displayChildren = () => {\n const parts = this.state.parts.map((p) => {\n let bold = \"\"\n if (this.props.membersOf){\n if (this.props.membersOf.includes(p.part) || p.part === this.props.focusResourceid) {\n bold = \"bold\"\n //showChildren = true;\n }\n }\n return <TextOutline\n bold={bold}\n key={p.part}\n focusResourceid={this.props.focusResourceid}\n showChildren={this.state.showChildren}\n showFirstLevelChildren={false}\n resourceid={p.part}\n title={p.title}\n level={p.level}\n author={p.author}\n authorTitle={p.authorTitle}\n structureType={p.structureType}\n membersOf={this.props.membersOf}\n questionTitle={p.questionTitle}\n mtFocus={this.props.mtFocus}\n showAuthor={this.props.showAuthor}\n collectionLink={p.structureType === \"http://scta.info/resource/structureCollection\" ? this.props.collectionLink : false}\n showParentLink={false}\n />\n\n\n })\n return parts\n }\n const indent = this.props.level * 5\n return (\n <div id=\"outline\" style={{\"paddingLeft\": indent + \"px\"}}>\n <p className={this.props.bold}>\n {(this.state.isPartOf.isPartOfId && this.props.showParentLink) && <Link to={\"/text?resourceid=\" + this.state.isPartOf.isPartOfId}><FaChevronUp/></Link>}\n {(this.props.author && this.props.showAuthor && this.props.level === \"1\") &&\n <span>\n <span>{this.props.authorTitle}: </span>\n <Link to={\"/text?resourceid=\" + this.props.author}><FaExternalLinkAlt/></Link>\n </span>\n }\n {this.props.title}\n {this.props.questionTitle && <span>: {this.props.questionTitle}</span>}\n \n {!this.props.showFirstLevelChildren &&\n <>\n {(this.state.parts.length > 0 && !this.state.showChildren) && <span className=\"outlineArrow\" onClick={this.handleToggleChildren}><FaChevronDown/></span>}\n {(this.state.parts.length > 0 && this.state.showChildren) && <span className=\"outlineArrow\" onClick={this.handleToggleChildren}><FaChevronUp/></span>}\n </>\n }\n \n {/** Note this conditional below (\"this.props.resourceid &&\"\") was added mostly to allow current tests to pass; if required documentation of required props is improved; tests could be improved and this conditional likely wouldn't be necessary */}\n {this.props.resourceid && <Link to={\"/text?resourceid=\" + this.props.resourceid + this.props.mtFocus} ><FaExternalLinkAlt/></Link>}\n {this.props.collectionLink && <a href={\"https://mirador.scta.info?resourceid=\" + this.props.resourceid} target=\"_blank\" rel=\"noopener noreferrer\"> <img alt=\"view in mirador\" style={{width: \"12px\", height: \"12px\"}} src=\"https://projectmirador.org/img/mirador-logo.svg\"></img></a>}\n </p>\n {this.props.showFirstLevelChildren ? displayChildren() : this.state.showChildren && displayChildren()}\n </div>\n );\n }\n}\n\nTextOutline.propTypes = {\n /**\n * resource id of focused passage, e.g. paragraph or div structure\n */\n focusedResourceid: PropTypes.string,\n /**\n * resource id of current section\n */\n resourceid: PropTypes.string,\n /**\n * title of current section\n */\n title: PropTypes.string,\n /**\n * hide entire outline\n */\n hidden: PropTypes.bool,\n /**\n * manifestation and transcription slug\n * used to create links in outline to specific manifestation\n * or transcription\n\n */\n mtFocus: PropTypes.string,\n /**\n * indicates if section heading should be bold with string \"bold\", indicating that focusedResourceId falls within this section\n\n * TODO: \"bold\" value would be better as boolean, true false\n */\n bold: PropTypes.string,\n /**\n * indicates whether children should be shown\n */\n showChildren: PropTypes.bool,\n /**\n * indicates whether level of section with number as string\n\n * TODO: would be better if level propType was number.\n */\n level: PropTypes.string,\n /**\n * indicates structureType of current section (e.g. collection, item, division, block)\n */\n structureType: PropTypes.string,\n /**\n * an array of ids, that focused section is a member of\n */\n membersOf: PropTypes.array,\n /**\n * question title associated with section\n */\n questionTitle: PropTypes.string,\n /**\n * indications whether a link at the collection level should be set or not\n */\n collectionLink: PropTypes.bool\n}\n\nexport default TextOutline;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport TextOutline from './TextOutline'\n\nimport {runQuery} from './utils'\nimport {getMembersOf} from './Queries'\n\n/**\n* creates a text outline starting from top level expression\n\n*/\nclass TextOutlineWrapper extends React.Component {\n constructor(props){\n super(props)\n this.mounted = \"\"\n this.state = {\n membersOf: [],\n }\n }\n retrieveMembersOf(resourceid){\n const membersOfInfo = runQuery(getMembersOf(resourceid))\n membersOfInfo.then((data) => {\n const newData = data.data.results.bindings.map((d) => {\n return d.memberOf.value\n })\n if (this.mounted){\n this.setState({membersOf: newData})\n }\n })\n }\n componentDidMount(){\n this.mounted = true;\n this.retrieveMembersOf(this.props.focusResourceid)\n }\n componentDidUpdate(prevProps){\n if (this.props.focusResourceid !== prevProps.focusResourceid){\n this.retrieveMembersOf(this.props.focusResourceid)\n }\n }\n componentWillUnmount(){\n this.mounted = false;\n}\n render(){\n return (\n <div className={this.props.hidden ? \"hidden\" : \"showing\"}>\n\n <TextOutline\n key={this.props.resourceid}\n showChildren={true}\n showFirstLevelChildren={this.props.showFirstLevelChildren}\n focusResourceid={this.props.focusResourceid}\n resourceid={this.props.resourceid}\n title={this.props.title}\n level={\"1\"}\n structureType={\"http://scta.info/resource/structureCollection\"}\n membersOf={this.state.membersOf}\n mtFocus={this.props.mtFocus}\n collectionLink={this.props.collectionLink}\n showAuthor={this.props.showAuthor}\n showParentLink={this.props.showParentLink}\n />\n </div>\n );\n }\n}\n\nTextOutlineWrapper.propTypes = {\n /**\n * resource id of focused passage, e.g. paragraph or div structure\n */\n focusedResourceid: PropTypes.string,\n /**\n * resource id of current section\n */\n resourceid: PropTypes.string,\n /**\n * title of current section\n */\n title: PropTypes.string,\n /**\n * hide entire outline\n */\n hidden: PropTypes.bool,\n /**\n * manifestation and transcription slug\n * used to create links in outline to specific manifestation\n * or transcription\n */\n mtFoucs: PropTypes.string,\n /**\n * indications whether a link at the collection level should be set or not\n */\n collectionLink: PropTypes.bool\n}\nexport default TextOutlineWrapper;\n","import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport OpenSeadragon from 'openseadragon';\nimport Axios from 'axios'\nimport uuidv4 from 'uuid/v4';\n\nconst OSDInstance = (props) => {\n const [instance, setInstance] = useState()\n const [viewerWidthHeight, setViewerWidthHeight] = useState({ w: \"\", h: \"\" })\n const [viewerId] = useState(uuidv4())\n useEffect(() => {\n if (props.coords){\n setViewerWidthHeight(computeViewerWidthHeight(props.coords.split(\",\")[2], props.coords.split(\",\")[3]))\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props.coords])\n useEffect(() => {\n Axios.get(props.imageurl + \"/info.json\").then((d) => {\n if (instance) {\n // Modify tile source as needed to already existing instance\n instance.addTiledImage({\n tileSource: d.data\n });\n if (props.coords) {\n // this should be another way to get Scalar coordinates, but it doesn't seem to be working\n //const newRect = instance.viewport.imageToViewportRectangle(x, y, w, h)\n const sc = getScalarCoordinates(props.coords, d.data.height, d.data.width)\n const rect = new OpenSeadragon.Rect(sc.x, sc.y, sc.w, sc.h)\n setBounds(instance, rect)\n setOverlay(instance, rect)\n if (props.lineFocusCoords){\n const lsc = getScalarCoordinates(props.lineFocusCoords, d.data.height, d.data.width)\n const linerect = new OpenSeadragon.Rect(lsc.x, lsc.y, lsc.w, lsc.h)\n setOverlay(instance, linerect)\n \n }\n setGoHome(instance, rect)\n instance.viewport.fitBounds(rect)\n }\n }\n else {\n const id = \"osd-\" + viewerId\n const instance = OpenSeadragon({\n id: id,\n prefixUrl: \"/img/openseadragon/\",\n preserveViewport: true, //this helps to keep the viewer in the same spot when toggling full screen\n visibilityRatio: 1,\n minZoomLevel: 1,\n defaultZoomLevel: 1,\n tileSources: [d.data],\n controlsFadeDelay: 0,\n controlsFadeLength: 25\n })\n if (props.coords) {\n // this should be another way to get Scalar coordinates, but it doesn't seem to be working\n //const newRect = instance.viewport.imageToViewportRectangle(x, y, w, h)\n const sc = getScalarCoordinates(props.coords, d.data.height, d.data.width)\n const rect = new OpenSeadragon.Rect(sc.x, sc.y, sc.w, sc.h)\n setBounds(instance, rect)\n setOverlay(instance, rect)\n if (props.lineFocusCoords){\n const lsc = getScalarCoordinates(props.lineFocusCoords, d.data.height, d.data.width)\n const linerect = new OpenSeadragon.Rect(lsc.x, lsc.y, lsc.w, lsc.h)\n setOverlay(instance, linerect)\n }\n setGoHome(instance, rect)\n }\n setInstance(instance)\n }\n })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props.imageurl, props.coords])\n\n const setOverlay = (instance, rect) => {\n instance.addHandler(\"open\", function () {\n const id = uuidv4()\n const elt = document.createElement(\"div\");\n elt.id = \"runtime-overlay-\" + id;\n elt.className = \"osdhighlight\";\n instance.addOverlay({\n element: elt,\n location: rect\n });\n })\n }\n const setBounds = (instance, rect) => {\n instance.addHandler(\"open\", function () {\n instance.viewport.fitBounds(rect, true);\n });\n }\n const setGoHome = (instance, rect) => {\n //OpenSeadragon.Viewport.prototype.goHome = function () {\n instance.viewport.goHome = function () {\n // Give it whatever rectangle you want\n this.fitBounds(rect);\n }\n }\n const getScalarCoordinates = (inputCoords, imageH, imageW) => {\n const coords = inputCoords.split(\",\")\n const x = parseInt(coords[0])\n const y = parseInt(coords[1])\n const w = parseInt(coords[2])\n const h = parseInt(coords[3])\n\n const ar = imageH / imageW\n const xcomp = x / imageW\n const ycomp = (y / imageH) * ar\n const wcomp = w / imageW\n const hcomp = (h / imageH) * ar\n return { x: xcomp, y: ycomp, w: wcomp, h: hcomp }\n }\n const computeViewerWidthHeight = (w, h) => {\n const displayWidth = props.displayWidth\n const newHeight = displayWidth * (parseInt(h) / parseInt(w))\n return { w: displayWidth, h: newHeight }\n }\n return (\n <div>\n {\n //<p onClick={handleAddOverlay}>Add overlay</p>\n }\n {\n props.coords ? <div id={\"osd-\" + viewerId} className=\"open-seadragon-container\" style={{ height: viewerWidthHeight.h + \"px\", width: viewerWidthHeight.w + \"px\" }}></div>\n : <div id={\"osd-\" + viewerId} className=\"open-seadragon-container\" style={{ height: \"100vh\" }}></div>\n }\n\n </div>\n )\n}\n\nOSDInstance.defaultProps = {\n imageurl: \"https://loris2.scta.info/vat/V145v.jpg\",\n displayWidth: 1000\n};\nOSDInstance.propTypes = {\n /**\n * imageurl (without iiif parameters) for which logo will be requested\n **/\n imageurl: PropTypes.string.isRequired,\n\n}\n\nexport default OSDInstance;","import React from 'react';\nimport OSDInstance from './OSDInstance';\nimport PropTypes from 'prop-types';\n\n// TODO: osd component makes this component fairly obsolete or a least exchangeable\nfunction Image(props) {\n //TODO comment when ready to build a conditional based on prop to allow switch between using static image or OSDInstance\n // let newCoords = \"\"\n // if (props.coords){\n // const coordsSplitArray = props.coords.split(\",\")\n // //const x = parseInt(coordsSplitArray[0]) - 20\n // const x = parseInt(coordsSplitArray[0])\n // const y = coordsSplitArray[1]\n // //const w = parseInt(coordsSplitArray[2]) + 40\n // const w = parseInt(coordsSplitArray[2])\n // const h = coordsSplitArray[3]\n // newCoords = x + \",\" + y + \",\" + w + \",\" + h\n // }\n //const imageLink = props.imageUrl + \"/\" + newCoords + \"/\" + props.displayWidth + \",/0/default.jpg\"\n return (\n //<img alt=\"manuscript\" src={imageLink}/>\n <OSDInstance imageurl={props.imageUrl} coords={props.coords} displayWidth={props.displayWidth} lineFocusCoords={props.lineFocusCoords}/>\n );\n}\n\nImage.propTypes = {\n /**\n * the Url for the image resource\n **/\n imageUrl: PropTypes.string.isRequired,\n /**\n * width of the image to be displayed\n *\n * TODO: might be better to make this a number/integer and not required;\n * when not preset perhaps it should just default to the widths listed in the coords\n **/\n displayWidth: PropTypes.string.isRequired,\n /**\n * string in the form of \"x,y,w,h\"\n *\n **/\n coords: PropTypes.string.isRequired\n}\nexport default Image;\n","import React from 'react';\n\nfunction LineText(props) {\n return (\n <div className=\"text\" style={{\"whiteSpace\": \"nowrap\"}}>\n {props.number && <span>{props.label.split(\"(\")[0]}/</span>} \n {props.number && <span>{props.number}</span>}\n <span dangerouslySetInnerHTML={{__html: props.text}} />\n </div>\n );\n}\n\nexport default LineText;\n","// Note this component is a near duplicate of Image Text Wrapper in Paleographinator\n// TODO: This shoud be the target for a refactored independent React Component\n\nimport React, { Component } from 'react';\nimport Image from './Image';\nimport LineText from './LineText';\n\nclass ImageTextWrapper extends Component {\n constructor(props) {\n super(props);\n this.state = {\n searchText: \"\"\n }\n }\n render() {\n // const getClass = () => {\n // if (this.props.targetLabel === this.props.label){\n // return \"ImageTextWrapper target\"\n // }\n // else {\n // return \"ImageTextWrapper\"\n // }\n // }\n return (\n <div className={this.props.targetLabel === this.props.label ? \"ImageTextWrapper target\" : \"ImageTextWrapper\"}>\n <div className=\"labelImageWrapper\">\n <Image\n imageUrl={this.props.imageUrl}\n canvas={this.props.canvas}\n coords={this.props.coords}\n canvasShort={this.props.canvasShort}\n displayWidth={this.props.displayWidth}\n lineFocusCoords={this.props.lineFocusCoords}\n />\n </div>\n <LineText text={this.props.text} number={this.props.number} label={this.props.label}/>\n </div>\n );\n }\n}\n\nexport default ImageTextWrapper;\n","import React, {useState, useEffect} from 'react';\nimport PropTypes from 'prop-types';\nimport Axios from 'axios'\n\nconst ImageLogo = (props) => {\n const [logoUrl, setLogoUrl] = useState(\"\")\n useEffect(() => {\n // conditional set in order prevent ajax request if props.imagurl does not exist\n if (props.imageurl){\n Axios.get(props.imageurl + \"/info.json\").then((d) => {\n const logo = d.data.logo[\"@id\"]\n setLogoUrl(logo)\n }).catch((error) => {\n console.log(\"no logo found\", error)\n setLogoUrl(\"\")\n })\n }\n }, [props.imageurl])\n return (\n <>{logoUrl && <img src={logoUrl} style={{margin: props.margin, height: props.height}} alt=\"imagelogo\"/>}</>\n )\n}\n\nImageLogo.defaultProps = {\n height: \"20px\",\n margin: \"5px\"\n};\n\nImageLogo.propTypes = {\n /**\n * imageurl (without iiif parameters) for which logo will be requested\n **/\n imageurl: PropTypes.string.isRequired,\n margin: PropTypes.string,\n height: PropTypes.string\n\n}\nexport default ImageLogo;\n","import React from 'react';\nimport Container from 'react-bootstrap/Container';\nimport Axios from 'axios'\nimport Button from 'react-bootstrap/Button';\n\nimport ImageTextWrapper from './ImageTextWrapper';\nimport ImageLogo from './ImageLogo';\nimport OSDInstance from './OSDInstance';\n\nimport {runQuery} from './utils'\nimport {getSurfaceInfo} from './Queries'\n\n\n\nclass Surface2 extends React.Component {\n constructor(props){\n super(props)\n this.mount = false\n this.handleNext = this.handleNext.bind(this)\n this.handlePrevious = this.handlePrevious.bind(this)\n this.handleLineFocusNext = this.handleLineFocusNext.bind(this)\n this.handleLineFocusPrev = this.handleLineFocusPrev.bind(this)\n this.isLineNumberLast = this.isLineNumberLast.bind(this)\n this.isLineNumberFirst = this.isLineNumberFirst.bind(this)\n this.handleToggleTextLines = this.handleToggleTextLines.bind(this)\n this.handleToggleAllLines = this.handleToggleAllLines.bind(this)\n this.state = {\n currentSurfaceId: \"\",\n manifest: \"\",\n canvas: \"\",\n region: \"full\",\n width: \"1000\",\n next: \"\",\n previous: \"\",\n imageurl: \"\",\n annotationsDisplay: true,\n showAllLines: false\n }\n\n }\n handleNext(){\n //this.retrieveSurfaceInfo(this.state.next)\n this.props.handleSurfaceFocusChange(this.state.next)\n }\n handlePrevious(){\n //this.retrieveSurfaceInfo(this.state.previous)\n this.props.handleSurfaceFocusChange(this.state.previous)\n\n }\n handleToggleTextLines(){\n //this.retrieveSurfaceInfo(this.state.previous)\n this.setState((prevState) => {\n return {annotationsDisplay: !prevState.annotationsDisplay}\n })\n }\n handleToggleAllLines(){\n this.setState((prevState) => {\n return {showAllLines: !prevState.showAllLines}\n })\n }\n retrieveSurfaceInfo(surfaceid){\n // manifest id should be retrieved from query\n // this is a temporary measure until db is corrected and query is posible\n\n //const manifest = \"http://scta.info/iiif/\" + this.props.topLevel.split(\"/resource/\")[1] + \"/\" + surfaceid.split(\"/resource/\")[1].split(\"/\")[0] + \"/manifest\";\n const manifest = \"\";\n const surfaceInfo = runQuery(getSurfaceInfo(surfaceid))\n surfaceInfo.then((d) => {\n const b = d.data.results.bindings[0]\n // only preceed if sparql query returns results\n if (b){\n //second nested async call for annotation list\n const alUrl = \"https://exist.scta.info/exist/apps/scta-app/folio-annotaiton-list-from-simpleXmlCoordinates.xq?surfaceid=\" + surfaceid.split(\"/resource/\")[1] + \"&coords=loose\"\n Axios.get(alUrl).then((d2) => {\n if (this.mount){\n this.setState({\n currentSurfaceId: surfaceid,\n surfaceTitle: b.surfaceTitle.value,\n manifest: manifest,\n canvas: b.canvas.value,\n imageurl: b.imageurl.value,\n next: b.next_surface ? b.next_surface.value : \"\",\n previous: b.previous_surface ? b.previous_surface.value : \"\",\n annotations: d2.data ? d2.data.resources : \"\"\n })\n }\n }).catch((error) => {\n console.log(\"failed retrieving annotationlist: \", error)\n if (this.mount){\n this.setState({\n currentSurfaceId: surfaceid,\n surfaceTitle: b.surfaceTitle.value,\n manifest: manifest,\n canvas: b.canvas.value,\n imageurl: b.imageurl.value,\n next: b.next_surface ? b.next_surface.value : \"\",\n previous: b.previous_surface ? b.previous_surface.value : \"\",\n annotations: \"\"\n })\n }\n })\n }\n })\n}\n// next for functions are used to compute next and previous Lines\n// this is a little bit hacky, since there are no resources for lines yet.\n// thus the line id is computed by breaking the line id apart,\n// using the line number to compute the next and the reassembling the line RDF id.\n// this will become unnecessary if/when each lines become and RDF resource and contains a next previous property\nhandleLineFocusNext() {\n const currentLineNumber = parseInt(this.props.lineFocusId.split(\"/\")[this.props.lineFocusId.split(\"/\").length - 1])\n const newLineArray = this.props.lineFocusId.split(\"/\")\n newLineArray.pop()\n newLineArray.push((currentLineNumber + 1).toString())\n this.props.handleLineFocusChange(newLineArray.join(\"/\"))\n}\nhandleLineFocusPrev(){\n const currentLineNumber = parseInt(this.props.lineFocusId.split(\"/\")[this.props.lineFocusId.split(\"/\").length - 1])\n const previousLineArray = this.props.lineFocusId.split(\"/\")\n previousLineArray.pop()\n previousLineArray.push((currentLineNumber - 1).toString())\n this.props.handleLineFocusChange(previousLineArray.join(\"/\"))\n}\nisLineNumberFirst(){\n const lineNumber = parseInt(this.props.lineFocusId.split(\"/\")[this.props.lineFocusId.split(\"/\").length - 1])\n\n if (lineNumber === 1){\n return true\n }\n else {\n return false\n }\n}\nisLineNumberLast(){\n const total = this.state.annotations ? this.state.annotations.length : \"\"\n const lineNumber = parseInt(this.props.lineFocusId.split(\"/\")[this.props.lineFocusId.split(\"/\").length - 1])\n if (lineNumber === total){\n return true\n }\n else{\n return false\n }\n}\ncomponentDidMount(){\n this.mount = true\n if (this.props.surfaceid){\n this.retrieveSurfaceInfo(this.props.surfaceid)\n }\n this.setState({annotationsDisplay: this.props.annotationsDisplay})\n }\n componentDidUpdate(prevProps){\n if (this.props.surfaceid !== prevProps.surfaceid){\n this.retrieveSurfaceInfo(this.props.surfaceid)\n }\n }\n componentWillUnmount(){\n this.mount = false\n }\n\n render() {\n const displayImage = (h, i) => {\n const text = h.resource.chars;\n const canvas = h.on.split(\"#xywh=\")[0];\n const canvasShort = canvas.split(\"/\")[canvas.split(\"/\").length - 1];\n const coords = h.on.split(\"#xywh=\")[1];\n const imageUrl = h.imageUrl\n const label = h.label\n if (this.state.showAllLines || (parseInt(this.props.lineFocusId.split(\"/\")[this.props.lineFocusId.split(\"/\").length - 1]) === (i + 1) ) || !this.props.lineFocusId){\n return (\n <ImageTextWrapper key={i}\n imageUrl={imageUrl}\n canvas={canvas}\n coords={coords}\n canvasShort={canvasShort}\n text={text}\n label={label}\n number={i + 1}\n targetLabel={this.props.targetLabel}\n surfaceButton={false}\n displayWidth={this.props.width ? this.props.width : this.state.width}\n />\n )\n }\n else{\n return null\n }\n\n }\n const displayImages = () => {\n if (this.state.annotations && this.state.annotationsDisplay){\n let imageTextWrappers = []\n if (!this.state.annotations.length){\n const imageResult = displayImage(this.state.annotations, 0)\n imageTextWrappers = imageResult\n }\n else{\n imageTextWrappers = this.state.annotations.map((h, i) => {\n return displayImage(h, i)\n });\n }\n return imageTextWrappers\n }\n else{\n //TODO uncommnent when ready to make a switch between using OSD or Image\n //const width = this.props.width ? this.props.width : this.state.width\n //return <img alt=\"manuscript\" src={this.state.imageurl + \"/\" + this.state.region + \"/\" + width + \",/0/default.jpg\"}/>\n return <OSDInstance imageurl={this.state.imageurl}/>\n }\n }\n return (\n <Container className={this.props.hidden ? \"hidden\" : \"showing\"}>\n {this.state.currentSurfaceId ?\n <div>\n <div className=\"surface-navigation\">\n <p>{this.state.surfaceTitle}</p>\n {(this.props.handleSurfaceFocusChange) &&\n <div>\n {this.state.previous && <Button size=\"sm\" onClick={this.handlePrevious}>Previous Page</Button>}\n {this.state.next && <Button size=\"sm\" onClick={this.handleNext}>Next Page</Button>}\n </div>\n }\n {(this.props.handleLineFocusChange && !this.state.showAllLines) &&\n <div>\n {!this.isLineNumberFirst() && <Button size=\"sm\" onClick={this.handleLineFocusPrev}>Previous Line</Button>}\n {!this.isLineNumberLast() && <Button size=\"sm\" onClick={this.handleLineFocusNext}>Next Line</Button>}\n </div>\n }\n <div>\n\n {this.props.lineFocusId && <Button size=\"sm\" onClick={this.handleToggleAllLines}>Toggle All/Focus Lines</Button>}\n {(this.state.annotations) && <Button size=\"sm\" onClick={this.handleToggleTextLines}>Toggle Show Text Lines</Button>}\n </div>\n <ImageLogo imageurl={this.state.imageurl}/>\n </div>\n {displayImages()}\n </div> : <p>No surface selected</p>}\n </Container>\n\n );\n }\n\n}\nSurface2.defaultProps = {\n annotationsDisplay: true\n};\nexport default Surface2;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport Axios from 'axios'\nimport { Light as SyntaxHighlighter } from 'react-syntax-highlighter';\nimport { docco } from 'react-syntax-highlighter/dist/cjs/styles/hljs';\n/**\n* XML view show component\n**/\nclass XmlView extends React.Component {\n\n constructor(props){\n super(props)\n this.mount = false\n this.retrieveXML = this.retrieveXML.bind(this)\n this.state = {\n xmlstring: \"\"\n }\n }\n retrieveXML(tresourceid){\n const xmlurl = \"https://exist.scta.info/exist/apps/scta-app/document/\" + tresourceid.split(\"/resource/\")[1]\n Axios.get(xmlurl).then((d) => {\n if (this.mount){\n this.setState({xmlstring: d.data})\n }\n })\n\n }\n componentDidMount(){\n this.mount = true\n //condition to make sure tresourceid is defined before trying to parse and retrieve\n // though this should never since tresourceid is a required prop\n if (this.props.tresourceid){\n this.retrieveXML(this.props.tresourceid)\n }\n\n }\n componentDidUpdate(prevProps){\n if (this.props.tresourceid !== prevProps.tresourceid){\n this.retrieveXML(this.props.tresourceid)\n }\n }\n componentWillUnmount(){\n this.mount = false\n }\n\n render(){\n return (\n <div className={this.props.hidden ? \"hidden\" : \"showing\"}>\n <SyntaxHighlighter language=\"xml\" style={docco} showLineNumbers>\n {this.state.xmlstring}\n </SyntaxHighlighter>\n </div>\n )\n }\n}\n\nXmlView.propTypes = {\n /**\n * transcription resource id of transcription for desired xml view\n *\n * TODO: Component is currently splitting the id and constructing the xml based\n * on a prior knowledge of where xml is; this really should be retrieved from the resource id\n * but the xml look up should happen outside of the XmlView Component in order to keep this component simple\n * and making only request directly to the xml file\n */\n tresourceid: PropTypes.string.isRequired,\n /**\n * hidden designates whether the component should be hidden after mounting\n */\n hidden: PropTypes.bool,\n}\nexport default XmlView;\n","import React from 'react';\nimport Nav from 'react-bootstrap/Nav';\n\nimport {FaRegWindowRestore, FaRegWindowMaximize, FaRegWindowMinimize, FaRegWindowClose, FaClone} from 'react-icons/fa';\n// reimport these if you want to use the change window location functions: FaAngleDoubleDown, FaAngleDoubleLeft,\n\nfunction WindowNavBar(props) {\n const displayTabs = () => {\n const tabs = props.availableTabs && props.availableTabs.map((t, idx) => {\n if (t.show){\n return (\n <Nav.Item key={\"tab-\" + t.name}>\n <Nav.Link active={props.windowLoad === t.name} title={t.desc} onClick={() => {props.handleTabChange(t.name, props.windowId)}}>{t.icon}</Nav.Link>\n </Nav.Item>\n )\n }\n else{\n return null\n }\n })\n return tabs\n }\n return (\n <Nav variant=\"tabs\">\n {displayTabs()}\n \n\n {props.openWidthHeight !== \"minimum\" &&\n <Nav.Item>\n <Nav.Link title=\"Minimize Window\" onClick={() => {props.handleMinimize(props.windowId)}}><FaRegWindowMinimize/></Nav.Link>\n </Nav.Item>}\n {props.openWidthHeight !== \"middle\" &&\n <Nav.Item>\n <Nav.Link title=\"Half Size Window\" onClick={() => {props.handleMiddlize(props.windowId)}}><FaRegWindowRestore/></Nav.Link>\n </Nav.Item>\n }\n {props.openWidthHeight !== \"maximum\" &&\n <Nav.Item>\n <Nav.Link title=\"Maximize Window\" onClick={() => {props.handleMaximize(props.windowId)}}><FaRegWindowMaximize/></Nav.Link>\n </Nav.Item>\n }\n {props.windowId !== \"window1\"\n &&\n <Nav.Item>\n <Nav.Link title=\"Close Window\" onClick={() => {props.handleClose(props.windowId)}}><FaRegWindowClose/></Nav.Link>\n </Nav.Item>\n }\n {/* commented to prevent window moving; this insures window 1 is always side window and window 2 is bottom window\n uncomment if this behavior is desired\n <Nav.Item>\n <Nav.Link title=\"Move Window\" onClick={() => {props.handleSwitchWindow(props.windowId, props.windowType)}}>{props.windowType === \"sideWindow\" ? <FaAngleDoubleDown/> : <FaAngleDoubleLeft/>}</Nav.Link>\n </Nav.Item>\n */\n }\n <Nav.Item>\n {!props.altWindowState && <Nav.Link title=\"Clone Window\" onClick={() => {props.handleDuplicateWindow(props.windowId, props.windowType)}}>{<FaClone/>}</Nav.Link>}\n </Nav.Item>\n\n\n</Nav>\n\n );\n}\n\nexport default WindowNavBar;\n","import React, {useState} from 'react';\nimport FormControl from 'react-bootstrap/FormControl';\nimport { FaAngleLeft, FaAngleRight, FaAngleUp} from 'react-icons/fa';\nimport Nav from 'react-bootstrap/Nav';\n\nfunction NextPrevBar(props) {\n const [customResourceTarget, setCustomResourceTarget] = useState(\"\")\n const [showCustomResourceTarget, setShowCustomResourceTarget] = useState(false)\n const handleUpArrow = () => {\n if (props.selectionRange && props.selectionRange.wordRange){\n props.handleBlockFocusChange(props.info.resourceid)\n }\n else{\n props.handleBlockFocusChange(props.info.parent)\n }\n }\n const getTitle = () => {\n if (props.selectionRange && props.selectionRange.wordRange){\n return props.info.title + \"@\" + props.selectionRange.wordRange.start + \"-\" + props.selectionRange.wordRange.end\n }\n else{\n return props.info.title\n }\n }\n const handelOnEnterPress = (e) => {\n if (e.charCode === 13) {\n let target = e.target.value\n if (target.includes(\"https://scta.info/resource/\")){\n target = target.replace(\"https://scta.info/resource/\", \"http://scta.info/resource/\")\n }\n else if (target.includes(\"sctar:\")){\n target = target.replace(\"sctar:\", \"http://scta.info/resource/\")\n }\n else if (target.includes(\"http://scta.info/resource/\")){\n\n }\n else(\n target = \"http://scta.info/resource/\" + target\n )\n props.handleFocusChange(target)\n setCustomResourceTarget(\"\")\n //setShowCustomResourceTarget(false)\n }\n }\n const displayNextPrevBar = () => {\n if (props.info){\n return (\n <Nav variant=\"tabs\">\n <Nav.Link onClick={() => {props.handleBlockFocusChange(props.info.resourceid)}}>{getTitle()}</Nav.Link>\n <Nav.Item>\n {(props.info.previous && props.info.previous !== \"http://scta.info/resource/\") && <Nav.Link title=\"Move Up to Previous Sibling Resource\" onClick={() => {props.handleBlockFocusChange(props.info.previous)}}><FaAngleLeft/></Nav.Link>}\n </Nav.Item>\n <Nav.Item>\n {(props.info.next && props.info.next !== \"http://scta.info/resource/\") && <Nav.Link title=\"Move Up to Next Sibling Resource\" onClick={() => {props.handleBlockFocusChange(props.info.next)}}><FaAngleRight/></Nav.Link>}\n </Nav.Item>\n <Nav.Item>\n {(props.info.resourceid !== props.info.topLevel) && (props.info.parent !== \"http://scta.info/resource/\") \n && <Nav.Link title=\"Move Up to Parent Resource\" onClick={handleUpArrow}><FaAngleUp/></Nav.Link>}\n </Nav.Item>\n {showCustomResourceTarget ? \n <div style={{display: 'flex', justifyContent: \"space-between\", width: \"100%\"}}>\n <Nav.Item><Nav.Link><span onClick={() => {setShowCustomResourceTarget(false)}}><FaAngleUp/></span></Nav.Link></Nav.Item>\n <FormControl style={{width: \"90%\"}} type=\"text\" value={customResourceTarget} placeholder=\"supply scta resource id\" className=\"mr-sm-2\" onKeyPress={((e) => {handelOnEnterPress(e)})} onChange={(e) => {setCustomResourceTarget(e.target.value)}}/>\n </div>\n :\n <Nav.Item onClick={() => {setShowCustomResourceTarget(true)}}><Nav.Link>Go to: <FaAngleRight/></Nav.Link></Nav.Item>\n }\n </Nav>\n \n )\n }\n else{\n return null\n }\n }\n return (\n displayNextPrevBar()\n );\n}\n\nexport default NextPrevBar;\n","import React from 'react';\nimport Diff from 'diff-match-patch'\nimport Axios from 'axios'\nimport PropTypes from 'prop-types';\n\nimport { getHtmlDiff } from 'ngram-diff';\nimport Spinner from './Spinner';\nimport {Link} from 'react-router-dom';\nimport { FaEyeSlash, FaEdit, FaEye, FaStar, FaToggleOn, FaToggleOff, FaRegImage} from 'react-icons/fa';\n\n\nimport {textReduce, goToGitHubEdit} from './utils'\n\n//import Surface3Wrapper from './Surface3Wrapper'\nimport {Surface3Wrapper} from \"@jeffreycwitt/lbp2.surface3wrapper\"\n\nclass TextCompareItem extends React.Component {\n constructor(props){\n super(props)\n this.handleToggleShow = this.handleToggleShow.bind(this)\n this.handleToggleCompare = this.handleToggleCompare.bind(this)\n this.mounted = \"\"\n this.state = {\n showCompare: true,\n showCompareType: \"ngram\", //could also be editDistance\n compareText: \"\",\n rawText: \"\",\n show: true,\n levenshteinDistance: undefined, \n usedBase: undefined,\n usedCompareTranscription: undefined,\n showImage: false\n }\n }\n handleToggleShow(){\n this.setState((prevState) => {\n return{\n show: !prevState.show\n }\n })\n }\n handleToggleCompare(){\n this.setState((prevState) => {\n return{\n showCompare: !prevState.showCompare\n }\n })\n }\n // TODO: should be replaced by function in utils.js file\n textClean(text){\n // remove most punctuation\n let punctuationless = text.replace(/[.,/#!$%^&*;:{}=\\-_`~()/\\u00B6/|/\\u204B/]/g,\"\");\n //convert v->u, ae->e, oe-e>\n punctuationless = punctuationless.replace(/v/g, \"u\");\n punctuationless = punctuationless.replace(/ae/g, \"e\");\n punctuationless = punctuationless.replace(/oe/g, \"e\");\n punctuationless = punctuationless.replace(/oe/g, \"e\");\n punctuationless = punctuationless.replace(/y/g, \"i\");\n //remove space\n punctuationless = punctuationless.replace(/\\s{2,}/g,\" \");\n //lowercase\n const finalFinalString = punctuationless.toLowerCase()\n return finalFinalString\n\n }\n\n \n createCompare(base, transcription){\n Axios.get(\"https://exist.scta.info/exist/apps/scta-app/csv-pct.xq?resourceid=\" + transcription)\n .then((text) => {\n let reducedText = text.data;\n if (this.props.isMainText && this.props.targetRange){\n reducedText = textReduce(text.data, this.props.targetRange)\n }\n // this conditional should exclude most relations (or relations initated by a structureElement type)\n else if (this.props.relationLabel === 'isQuotedBy' || this.props.relationLabel === 'isReferencedBy'){\n reducedText = text.data\n }\n else if (this.props.isRelatedToRange){\n reducedText = textReduce(text.data, this.props.isRelatedToRange)\n }\n //function needed for word level comparison\n //see https://github.com/google/diff-match-patch/wiki/Line-or-Word-Diffs\n // also required for of npm google-diff-patch and then added function wordsToChars_()\n \n // eslint disable to avoid error when not using this function\n // eslint-disable-next-line\n const diff_wordMode = (text1, text2, dmp) => {\n //var dmp = new Diff.diff_match_patch();\n var a = dmp.diff_wordsToChars_(text1, text2);\n var lineText1 = a.chars1;\n var lineText2 = a.chars2;\n var lineArray = a.lineArray;\n var diffs = dmp.diff_main(lineText1, lineText2, false);\n dmp.diff_charsToLines_(diffs, lineArray);\n return diffs;\n }\n\n const dmp = new Diff.diff_match_patch();\n\n //NOTE: uncomment below if you want to switch back to character level diff\n const diff = dmp.diff_main(this.textClean(base), this.textClean(reducedText)); //character level diff\n //const diff = diff_wordMode(this.textClean(base), this.textClean(reducedText), dmp) // word level diff\n // Result: [(-1, \"Hell\"), (1, \"G\"), (0, \"o\"), (1, \"odbye\"), (0, \" World.\")]\n dmp.diff_cleanupSemantic(diff);\n const levenshteinDistance = dmp.diff_levenshtein(diff)\n //const ds = dmp.diff_prettyHtml(diff);\n\n \n const compareDisplayHtml = (this.state.showCompareType === \"ngram\") ? getHtmlDiff(base, reducedText).compare : dmp.diff_prettyHtml(diff)\n if (this.mounted === true && base){\n // TODO: setting showCompare to \"derivedState\" is an ANTI-PATTERN. Better would be to let it be entirely controlled by parent. \n // NOTE: usedBase and usedCompare transcription are used to record data used to make compare \n // so that componentDidUpdate can efficiently decide if a new comparison is or is not needed\n this.setState({compareText: compareDisplayHtml, rawText: reducedText, levenshteinDistance: levenshteinDistance, showCompare: this.props.showCompare,\n showCompareType: this.props.showCompareType, usedBase: this.props.base, usedCompareTranscription: this.props.compareTranscription})\n }\n else if(this.mounted){\n // TODO: setting showCompare to \"derivedState\" is an ANTI-PATTERN. Better would be to let it be entirely controlled by parent.\n // NOTE: usedBase and usedCompare transcription are used to record data used to make compare \n // so that componentDidUpdate can efficiently decide if a new comparison is or is not needed\n this.setState({rawText: reducedText, showCompare: this.props.showCompare, \n usedBase: this.props.base, usedCompareTranscription: this.props.compareTranscription})\n }\n }).catch((error) => {\n console.log(\"text request/comparison error\", error)\n })\n }\n\n componentDidMount(){\n this.mounted = true;\n // TODO: setting showCompare to \"derivedState\" is an ANTI-PATTERN. Better would be to let it be entirely controlled by parent.\n this.setState({rawText: \"\", compareText: \"\", showCompare: this.props.showCompare, showCompareType: this.props.showCompareType, showImage: this.props.showImages}) \n //conditional attempts to restrict async call to only those components who are intended to be visible at mount\n // NOTE: this conditional will important when scaling. (i.e. when there hundres of references and hundreds of transcriptons)\n if (this.props.show){\n this.createCompare(this.props.base, this.props.compareTranscription)\n }\n }\n\n componentDidUpdate(prevProps){\n // NOTE: conditional attempts to restrict async call to only those components who are intended to be visible \n // and for whom a previous comparison has not been made or needs to be changed.\n // need for generation of new comparison is detected by comparing props base and props compare transcription \n //to base/compare transcription used in previous comparison (or lack there of)\n // NOTE: this conditional will important when scaling. (i.e. when there are hundreds of references and hundreds of transcriptions)\n if (this.props.show && \n (\n // NOTE: check to see if the current props base/compareTranscription is different than one the last base/compareTranscription when comparison was ran. \n // If it is different, then re-run compare. If not, don't run because the comparison has already been made.\n (this.props.base !== this.state.usedBase || this.props.compareTranscription !== this.state.usedCompareTranscription))\n )\n {\n this.createCompare(this.props.base, this.props.compareTranscription)\n }\n //NOTE: setting state from props here is an anti pattern\n //view either needs to be controlled by props or state, but not both\n if (this.props.showImages !== prevProps.showImages){\n this.setState({showImage: this.props.showImages})\n }\n\n }\n\n\n\n componentWillUnmount(){\n this.mounted = false;\n }\n\n\n render(){\n \n\n const displayImage = () => {\n const newManifestations = [{\n manifestation: this.props.manifestation,\n manifestationTitle: this.props.manifestationTitle,\n transcription: \"\"\n }]\n return (\n <div>\n <span onClick={() => {this.setState((prevState)=> {return({showImage: !prevState.showImage})})}}><FaRegImage/></span> \n {this.state.showImage &&\n <div>\n <Surface3Wrapper\n manifestations={newManifestations}\n focusedManifestation={this.props.manifestation}\n width={parseInt(this.props.surfaceWidth)}\n hideSelectionList={true}\n isDependentSurface3={true}\n startWord={(this.props.isMainText && this.props.targetRange) && parseInt(this.props.targetRange.split(\"-\")[0])}\n endWord={(this.props.isMainText && this.props.targetRange) && parseInt(this.props.targetRange.split(\"-\")[1])}\n />\n </div>\n }\n </div>\n )\n\n }\n\n const displayComparison = () => {\n const isBase = this.props.base === this.state.rawText\n if (this.state.showCompare && this.props.base && this.state.compareText){\n const levenNum = this.state.levenshteinDistance\n const heatColor = levenNum * 5\n return (\n <div style={{borderLeft: \"5px solid rgba(\" + heatColor + \", 0, 255, 1)\", paddingLeft: \"5px\"}}>\n <span><Link to={\"/text?resourceid=\" + this.props.compareTranscription + ((this.props.relationLabel !== \"isQuotedBy\" && this.props.relationLabel !== \"isReferencedBy\" && this.props.isRelatedToRange) ? \"@\" + this.props.isRelatedToRange : \"\")}>{this.props.manifestationTitle}</Link> </span>\n <span> | </span>\n <span className=\"lbp-span-link\" title=\"show/hide\" onClick={() => this.handleToggleShow()}>{this.state.show ? <FaEyeSlash/> : <FaEye/>}</span>\n <span> | </span>\n <span className=\"lbp-span-link\" title=\"toggle comparison off\" onClick={() => this.handleToggleCompare()}><FaToggleOn/></span>\n {!isBase && <span> | </span>}\n {!isBase && <span className=\"lbp-span-link\" title=\"set as base\" onClick={() => this.props.handleChangeBase(this.state.rawText)}><FaStar/></span>}\n {this.props.compareTranscriptionDoc && <span> | </span>}\n {this.props.compareTranscriptionDoc && <span className=\"lbp-span-link\" title=\"edit on github\" onClick={() => {goToGitHubEdit(this.props.compareTranscriptionDoc.split(\"#\")[0], \"\", this.props.compareTranscriptionDoc.split(\"#\")[1]) }}><FaEdit/></span>}\n <span> | </span>\n <span style={{fontSize: \"14px\", paddingLeft: \"4px\"}} title=\"levenshtein distance\">{levenNum}</span>\n <div className={this.state.show ? \"unhidden\" : \"hidden\"}>\n <div ref=\"text\" dangerouslySetInnerHTML={{ __html: this.state.compareText}}></div>\n {displayImage()}\n\n </div>\n </div>\n )\n }\n else if (this.state.rawText){\n \n return (\n <div>\n <span><Link to={\"/text?resourceid=\" + this.props.compareTranscription + ((this.props.relationLabel !== \"isQuotedBy\" && this.props.relationLabel !== \"isReferencedBy\" && this.props.isRelatedToRange) ? \"@\" + this.props.isRelatedToRange : \"\")}>{this.props.manifestationTitle}</Link></span> |\n <span> | </span>\n <span className=\"lbp-span-link\" title=\"show/hide\" onClick={() => this.handleToggleShow()}>{this.state.show ? <FaEyeSlash/> : <FaEye/>}</span>\n <span> | </span>\n <span className=\"lbp-span-link\" title=\"toggle comparison on\" onClick={() => this.handleToggleCompare()}><FaToggleOff/></span>\n {!isBase && <span> | </span>}\n {!isBase && <span className=\"lbp-span-link\" title=\"set as base\" onClick={() => this.props.handleChangeBase(this.state.rawText)}><FaStar/></span>}\n {this.props.compareTranscriptionDoc && <span> | </span>}\n {this.props.compareTranscriptionDoc && <span className=\"lbp-span-link\" title=\"edit on github\" onClick={() => {goToGitHubEdit(this.props.compareTranscriptionDoc.split(\"#\")[0], \"\", this.props.compareTranscriptionDoc.split(\"#\")[1]) }}><FaEdit/></span>}\n <div className={this.state.show ? \"unhidden\" : \"hidden\"}>\n <div ref=\"text\" dangerouslySetInnerHTML={{ __html: this.state.rawText}}></div>\n {displayImage()}\n </div>\n </div>\n )\n }\n else{\n return <Spinner/>\n }\n }\n\n return (\n displayComparison()\n );\n }\n}\n\nTextCompareItem.propTypes = {\n /**\n * text comparison component\n **/\n base: PropTypes.string, // base text to perform comparison against\n compareTranscription: PropTypes.string, // transcription id of text to be used in comparison against base text\n handleChangeBase: PropTypes.func, // function to trigger base text change\n show: PropTypes.bool, // boolean to state whether text should be shown. TODO: currently competing with derivedState \"show\", needs to be resolved\n showCompare: PropTypes.bool //boolean to state whether should be shown with comparison markup. TODO: currently competing with derivedState \"showCompare\" needs to be resolved\n}\n\nexport default TextCompareItem;\n","import React from 'react';\nimport {Link} from 'react-router-dom';\nimport { FaEyeSlash, FaEye, FaTable } from 'react-icons/fa';\n\nimport {runQuery} from './utils'\nimport {basicInfoQuery} from './Queries'\nimport TextCompareItem from './TextCompareItem'\n\nclass TextCompare extends React.Component {\n constructor(props){\n super(props)\n this.handleToggleShowAll = this.handleToggleShowAll.bind(this)\n this.handleToggleShowAllImages = this.handleToggleShowAllImages.bind(this)\n this.mounted = \"\"\n this.state = {\n info: \"\",\n show: false,\n showImages: false,\n baseText: \"\"\n }\n }\n\n handleToggleShowAll(){\n this.setState((prevState) => {\n return{\n show: !prevState.show\n }\n })\n }\n handleToggleShowAllImages(){\n this.setState((prevState) => {\n return{\n showImages: !prevState.showImages\n }\n })\n }\n\n // TODO dupblicate of function in Text Component\n // needs refactoring\n arrangeTextInfo(info, resourceid){\n info.then((d) => {\n const bindings = d.data.results.bindings[0]\n const manifestations = d.data.results.bindings.map((b) => {\n return {\n manifestation: b.manifestation.value,\n manifestationTitle: b.manifestationTitle.value,\n transcription: b.manifestationCTranscription ? b.manifestationCTranscription.value : \"\",\n transcriptionDoc: b.manifestationCTranscriptionDoc?.value\n }\n })\n if (this.mounted === true && bindings){\n this.setState({\n info: {\n resourceid: resourceid,\n title: bindings.title.value,\n structureType: bindings.structureType.value,\n inbox: bindings.inbox.value,\n next: bindings.next ? bindings.next.value : \"\",\n previous: bindings.previous ? bindings.previous.value : \"\",\n cdoc: bindings.cdoc ? bindings.cdoc.value : \"\",\n cxml: bindings.cxml ? bindings.cxml.value : \"\",\n topLevel: bindings.topLevelExpression.value,\n cmanifestation: bindings.cmanifestation ? bindings.cmanifestation.value : \"\",\n ctranscription: bindings.ctranscription ? bindings.ctranscription.value : \"\",\n manifestations: manifestations\n }\n });\n }\n });\n }\n getTextInfo(id){\n const info = runQuery(basicInfoQuery(id))\n this.arrangeTextInfo(info, id)\n }\n componentDidMount(){\n this.mounted = true;\n //TODO: setting \"derivative state\" here is an anti-pattern\n //instead this should probably be controlled by parent \n //(handleToggleShowAll should probably change parent which would then pass down the required prop rather than setting prop to state)\n this.setState({show: this.props.show})\n this.setState({showImages: this.props.showImages})\n //NOTE: this conditional, does set prop to state, but there is a reason. \n // the point is that the information has already been achieved, thus we save one async call by using props. \n // otherwise an async request is called.\n // I think the \"derivate state is acceptable in this case\"\n if (this.props.isMainText){\n this.setState({info: this.props.info})\n }\n else{\n this.getTextInfo(this.props.expressionid)\n }\n }\n componentDidUpdate(prevProps){\n // conditional try to restrict new async calls to only when props.info changes\n if ((this.props.info.resourceid !== prevProps.info.resourceid) || (this.props.info.relatedExpressions !== prevProps.info.relatedExpressions)){\n if (this.props.isMainText){\n this.setState({info: this.props.info})\n }\n else{\n this.getTextInfo(this.props.expressionid)\n }\n }\n //NOTE: setting state from props here is an anti pattern; \n //view either needs to be controlled by props or state, but not both\n if (this.props.show !== prevProps.show){\n this.handleToggleShowAll()\n }\n //NOTE: setting state from props here is an anti pattern\n //view either needs to be controlled by props or state, but not both\n if (this.props.showImages !== prevProps.showImages){\n this.handleToggleShowAllImages()\n }\n }\n componentWillUnmount(){\n this.mounted = false;\n }\n render(){\n const displayComparisons = () => {\n // NOTE: this conditional here to stop attempt to display text manifestation texts at the collection level\n // collection level is usually just too big to be useful. \n if (this.props.isMainText && this.props.info.structureType === \"http://scta.info/resource/structureCollection\"){\n return <p>Text too big to display; move down the text hierarchy to focus on a smaller section</p>\n }\n else if (this.state.info.manifestations){\n const texts = this.state.info.manifestations.map((m) => {\n return (\n <TextCompareItem\n key={m.transcription}\n base={this.props.baseText}\n compareTranscription={m.transcription}\n compareTranscriptionDoc={m.transcriptionDoc}\n manifestationTitle={m.manifestationTitle}\n manifestation={m.manifestation}\n handleChangeBase={this.props.handleChangeBase}\n show={this.state.show}\n showCompare={this.props.isMainText ? true : true}\n showCompareType={this.props.isMainText ? 'editDistance' : 'ngram'}\n surfaceWidth={this.props.surfaceWidth}\n isRelatedToRange={this.props.isRelatedToRange}\n targetRange={this.props.targetRange}\n isMainText={this.props.isMainText}\n relationLabel={this.props.relationLabel}\n showImages={this.state.showImages}\n />\n )\n })\n return texts\n }\n }\n return (\n <div style={{\"borderBottom\": \"1px solid rgba(0, 0, 0, 0.1)\", padding: \"5px\"}}>\n {\n // the link to reroute is not quite working, because the base Text is not resetting, focusBlockChange might be better; but item structure will also need to be changed.\n }\n \n <div style={{fontSize: \"12px\"}}>\n {this.props.isMainText && <span>[Target] </span>}\n <span>{this.props.relationLabel}</span> \n {(this.props.referringResource && this.props.referringResource !== this.props.info.resourceid) \n && <span> (<Link to={\"/text?resourceid=\" + this.props.referringResource}>via</Link>)</span>}\n </div>\n <div>\n {this.state.info.resourceid ?\n <Link to={\"/text?resourceid=\" + this.state.info.resourceid + ((this.props.relationLabel !== \"isQuotedBy\" && this.props.relationLabel !== \"isReferencedBy\" && this.props.isRelatedToRange) ? \"@\" + this.props.isRelatedToRange : \"\")}>\n {this.props.authorTitle || this.props.longTitle ? <span> {this.props.authorTitle} {this.props.longTitle}</span> : this.state.info.resourceid}\n </Link> :\n this.props.authorTitle || this.props.longTitle ? <span> {this.props.authorTitle} {this.props.longTitle}</span> : this.state.info.resourceid\n }\n <span> | </span>\n {this.state.info.resourceid && <span className=\"lbp-span-link\" onClick={() => this.handleToggleShowAll()}>{this.state.show ? <FaEyeSlash/> : <FaEye/>}</span>}\n <span> | </span>\n {this.props.expressionid && <span className=\"lbp-span-link\" title=\"add to collation table\" onClick={this.props.isMainText ? this.props.handleShowCollationOverlay : () => \n { \n // this conditional checks checks if there is a wordRange and the target is active; if true then it adds the wordRange\n // otherwise no WordRange is added\n const fullEid = ((this.props.relationLabel !== \"isQuotedBy\" && this.props.relationLabel !== \"isReferencedBy\") && this.props.isRelatedToRange) ? this.props.expressionid + \"@\" + this.props.isRelatedToRange : this.props.expressionid\n this.props.handleAddCtRelatedExpressions(fullEid)}}><FaTable/></span>\n }\n <span> | </span>\n <a href={\"https://mirador.scta.info?blockid=\" + this.state.info.resourceid} target=\"_blank\" rel=\"noopener noreferrer\"><img alt=\"view in mirador\" style={{width: \"12px\", height: \"12px\"}} src=\"https://projectmirador.org/img/mirador-logo.svg\"></img></a>\n </div>\n <div className={this.state.show ? \"unhidden\" : \"hidden\"} style={{\"paddingLeft\": \"10px\"}}>\n {displayComparisons()}\n </div>\n </div>\n );\n }\n}\nexport default TextCompare;\n","import Axios from 'axios'\n\nexport function ngramRelatedQuery(id, intersectionTotal = 4){\n // const query = [\n // \"SELECT ?s ?start ?other ?text ?cosineScore \",\n // \"WHERE {\",\n // \"BIND (<\" + id + \"> as ?start) . \",\n // \"{\",\n // \"?s <http://www.w3.org/ns/oa#hasSource> ?start .\",\n // \"?s <http://www.w3.org/ns/oa#hasTarget> ?other .\",\n // \"?s <http://www.w3.org/ns/oa#hasBody> ?bn .\",\n // \"?bn <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> ?text .\",\n // \"}\",\n // \"UNION\",\n // \"{\",\n // \"?s <http://www.w3.org/ns/oa#hasSource> ?other .\",\n // \"?s <http://www.w3.org/ns/oa#hasTarget> ?start . \",\n // \"?s <http://www.w3.org/ns/oa#hasBody> ?bn .\",\n // \"?bn <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> ?text .\",\n // \"}\",\n // \"?s <http://scta.info/property/cosineScore> ?cosineScore .\" ,\n // \"FILTER (?cosineScore >= \" + cosineScoreLimit + \") \",\n // \"}\",\n // \"ORDER BY DESC(?cosineScore) \",\n // \"LIMIT 100\"].join(' ')\n\n\n // const query = [\n // \"SELECT ?start ?target ?targetLongTitle ?cosineScore ?intersectionTotal ?cosineScoreIntersection ?targetItem ?author ?authorTitle \",\n // \"WHERE {\",\n // \"VALUES ?start { <\" + id + \"> }\",\n // \"{\",\n // \"?start <http://scta.info/property/hasCosineSimilarity> ?bn . \",\n // \"?bn <http://scta.info/property/target> ?target . \",\n // \"?bn <http://scta.info/property/cosineScore> ?cosineScore . \",\n // \"?bn <http://scta.info/property/cosineScoreIntersection> ?cosineScoreIntersection . \",\n // \"?bn <http://scta.info/property/cosineScoreIntersectionOverBase> ?cosineScoreIntersectionOverBase . \",\n // \"?bn <http://scta.info/property/cosineScoreIntersectionOverCompare> ?cosineScoreIntersectionOverCompare . \",\n // \"?bn <http://scta.info/property/intersectionTotal> ?intersectionTotal . \",\n // \"FILTER (?cosineScore >= \" + cosineScoreFilter + \") .\",\n // //\"FILTER (?cosineScoreIntersection >= \" + cosineScoreFilter + \") \",\n // \"FILTER (?intersectionTotal >= \" + intersectionTotal + \") .\",\n // \"}\",\n // \"UNION\",\n // \"{\",\n // \"?target <http://scta.info/property/hasCosineSimilarity> ?bn . \",\n // \"?bn <http://scta.info/property/target> ?start . \",\n // \"?bn <http://scta.info/property/cosineScore> ?cosineScore . \",\n // \"?bn <http://scta.info/property/cosineScoreIntersection> ?cosineScoreIntersection . \",\n // \"?bn <http://scta.info/property/cosineScoreIntersectionOverBase> ?cosineScoreIntersectionOverBase . \",\n // \"?bn <http://scta.info/property/cosineScoreIntersectionOverCompare> ?cosineScoreIntersectionOverCompare . \",\n // \"?bn <http://scta.info/property/intersectionTotal> ?intersectionTotal . \",\n // \"FILTER (?cosineScore >= \" + cosineScoreFilter + \") .\",\n // //\"FILTER (?cosineScoreIntersection >= \" + cosineScoreFilter + \") \",\n // \"FILTER (?intersectionTotal >= \" + intersectionTotal + \") .\",\n // \"}\",\n // \"?target <http://scta.info/property/longTitle> ?targetLongTitle . \",\n // \"?target <http://scta.info/property/totalOrderNumber> ?targetTotalOrderNumber . \",\n // \"?target <http://scta.info/property/isPartOfStructureItem> ?targetItem . \",\n // \"?targetItem <http://scta.info/property/isPartOfTopLevelExpression> ?topLevel . \",\n // \"?targetItem <http://scta.info/property/totalOrderNumber> ?targetItemTotalOrderNumber .\",\n // //expression && \"FILTER(?topLevel = <\" + expression + \">) . \",\n // //expression && \"?target <http://scta.info/property/isMemberOf> <\" + expression + \"> . \",\n // //expressionType && \"?target <http://scta.info/property/isMemberOf> ?member . ?member <http://scta.info/property/expressionType> <\" + expressionType + \"> .\",\n // //workGroup && \"<\" + workGroup + \"> <http://scta.info/property/hasExpression> ?topLevel .\",\n // \"OPTIONAL{\",\n // \"?topLevel <http://www.loc.gov/loc.terms/relators/AUT> ?author . \",\n // \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle . \",\n // \"}\",\n // \"}\",\n // \"ORDER BY DESC(?intersectionTotal) DESC(?cosineScore)\",\n // //\"ORDER BY ?authorTitle ?topLevel ?targetItemTotalOrderNumber ?targetTotalOrderNumber\"\n // //\"LIMIT 1000\",\n // //\"OFFSET 2000\"\n // ].join(' ')\n\n const query = `SELECT (COUNT(*) as ?count) ?start ?target ?longTitle ?author ?authorTitle\n WHERE {\n VALUES ?start { <${id}> }\n ?ngram <http://scta.info/property/isFoundIn> ?start .\n ?ngram <http://scta.info/property/isFoundIn> ?target .\n FILTER(?start != ?target) .\n ?target <http://scta.info/property/longTitle> ?longTitle .\n ?target <http://scta.info/property/isPartOfStructureItem> ?targetItem .\n ?targetItem <http://scta.info/property/isPartOfTopLevelExpression> ?topLevel .\n OPTIONAL{\n ?topLevel <http://www.loc.gov/loc.terms/relators/AUT> ?author .\n ?author <http://purl.org/dc/elements/1.1/title> ?authorTitle . \n OPTIONAL{\n ?author <http://scta.info/property/dateOfBirth> ?authorBirthDate .\n }\n }\n }\n GROUP BY ?start ?target ?longTitle ?targetItem ?topLevel ?author ?authorTitle ?authorBirthDate\n HAVING (?count >= ${intersectionTotal})\n ORDER BY ?authorTitle ?longTitle`\n\n return query\n}\n\nexport function ngramFragmentQuery(ngramIds, intersectionTotal = 4){\n const query = `SELECT (COUNT(*) as ?count) ?target ?longTitle ?author ?authorTitle\n WHERE {\n VALUES ?ngram { ${ngramIds} }\n ?ngram <http://scta.info/property/isFoundIn> ?target .\n ?target <http://scta.info/property/longTitle> ?longTitle .\n ?target <http://scta.info/property/isPartOfStructureItem> ?targetItem .\n ?targetItem <http://scta.info/property/isPartOfTopLevelExpression> ?topLevel .\n OPTIONAL{\n ?topLevel <http://www.loc.gov/loc.terms/relators/AUT> ?author .\n ?author <http://purl.org/dc/elements/1.1/title> ?authorTitle . \n OPTIONAL{\n ?author <http://scta.info/property/dateOfBirth> ?authorBirthDate .\n }\n }\n }\n GROUP BY ?target ?longTitle ?targetItem ?topLevel ?author ?authorTitle ?authorBirthDate\n HAVING (?count >= ${intersectionTotal})\n ORDER BY ?authorTitle ?longTitle`\n return query\n}\n\nexport function runNgramQuery(query){\n const sparqlEndpoint = \"https://ngram.scta.info/ds/query\"\n const queryPromise = Axios.get(sparqlEndpoint, { params: { \"query\": query, \"output\": \"json\" } })\n return queryPromise\n}","import React, {useState, useEffect} from 'react';\n\nimport {Link} from 'react-router-dom';\n\nimport TextCompare from './TextCompare'\nimport Spinner from './Spinner'\nimport {ngramRelatedQuery} from '../queries/ngramRelatedQuery'\nimport {ngramFragmentQuery} from '../queries/ngramRelatedQuery'\nimport {runNgramQuery} from '../queries/ngramRelatedQuery'\nimport {textClean} from './utils'\n\n/**\n * \n * A comment wrapper for submitting comments to local storage test\n * @public\n */\n\nconst createExpressionsList = (bindings) => {\n const expressions = [];\n bindings.forEach((r) => {\n expressions.push({\n id: r.target.value,\n relationLabel: \"Ngram Intersections:\" + r.count.value,\n referringResource: \"\",\n author: r.author?.value,\n authorTitle: r.authorTitle?.value,\n longTitle: r.longTitle?.value,\n show: false,\n isRelatedToRange: \"\"\n })\n })\n return expressions\n}\n\nfunction NgramDisplay(props) {\n const [relatedExpressions, setRelatedExpressions] = useState([])\n const [intersectionTotal, setIntersectionTotal] = useState(4)\n useEffect(() => {\n // if targetRange is presents forces query to wait until baseText is present\n if (props.baseText && props.targetRange){\n console.log(\"firing1\")\n const tokenizedText = textClean(props.baseText).split(\" \");\n const ngramArray = [] \n console.log(\"baseText\", props.baseText)\n console.log(\"tokenizedText\", tokenizedText)\n // create a for loop the length of the number of words props.baseText\n for (let i = 0; i < (tokenizedText.length - 3); i++){\n const ngramId = `<http://scta.info/resource/ngram/${tokenizedText.slice(i, (i + 4)).join(\"\")}>`\n ngramArray.push(ngramId)\n }\n const ngramRelated = runNgramQuery(ngramFragmentQuery(ngramArray.join(\" \"), intersectionTotal));\n ngramRelated.then((d) => {\n const bindings = d.data.results.bindings;\n const expressions = createExpressionsList(bindings);\n setRelatedExpressions(expressions)\n })\n }\n // NOTE: prevents general query if a targetRange is present\n // TODO: probably needs to be refactored; useEffect can probably be used better\n else if (!props.targetRange){\n const ngramRelated = runNgramQuery(ngramRelatedQuery(props.resourceid, intersectionTotal));\n ngramRelated.then((d) => {\n const bindings = d.data.results.bindings\n const expressions = createExpressionsList(bindings);\n setRelatedExpressions(expressions)\n })\n }\n }, [props.resourceid, props.baseText, props.targetRange, intersectionTotal])\n \n const displayExpressions = () => {\n const displayExpressions = relatedExpressions.map((i, index) => {\n const marked = props.markedExpressions.find((e) => e.parentBlock === i.id)\n return (\n \n <div key={index + \"-ngram-\" + i.id}>\n {marked && <span style={{fontSize: \"12px\", paddingLeft: \"2px\", marginLeft: \"3px\", borderLeft: \"3px solid purple\"}}>Already Marked via <Link to={\"/text?resourceid=\" + marked.id}>{marked.id}</Link></span>}\n {<TextCompare\n info={props.info}\n expressionid={i.id}\n relationLabel={i.relationLabel}\n referringResource={i.referringResource}\n author={i.author}\n authorTitle={i.authorTitle}\n longTitle={i.longTitle}\n isMainText={false}\n handleChangeBase={props.handleChangeBase}\n baseText={props.baseText}\n show={i.show}\n surfaceWidth={props.surfaceWidth}\n isRelatedToRange={i.isRelatedToRange}\n handleAddCtRelatedExpressions={props.handleAddCtRelatedExpressions}\n handleShowCollationOverlay={props.handleShowCollationOverlay}\n />}\n </div>\n )\n })\n return displayExpressions\n }\n return(\n <div>\n <hr/>\n <p>\n Potential Related Passages \n <br/>\n <span style={{\"fontSize\": '12px'}}>Ngram Intersection Threshold: {intersectionTotal}\n (<span className='lbp-span-link' title=\"increase intersection threshold\" onClick={() => setIntersectionTotal(intersectionTotal + 1)}> + </span>\n {intersectionTotal > 0 && <> | <span className='lbp-span-link' title=\"decrease intersection threshold\" onClick={() => setIntersectionTotal(intersectionTotal - 1)}> - </span></>})\n </span> \n </p>\n \n {/* <input type=\"text\" value={scoreMinimumInput} onChange={(e) => setScoreMinimumInput(e.target.value)}></input>\n <button onClick={() => {setScoreMinimumUse(scoreMinimumInput)}}>Re-run Query with new minimum</button> */}\n {relatedExpressions === \"retrieving\" ? <Spinner/> : displayExpressions()}\n </div>\n )\n}\nexport default NgramDisplay;","import React from 'react';\nimport Axios from 'axios'\nimport Container from 'react-bootstrap/Container';\nimport Form from 'react-bootstrap/Form';\nimport FormControl from 'react-bootstrap/FormControl';\nimport Button from 'react-bootstrap/Button';\nimport TextCompare from './TextCompare'\nimport NgramDisplay from './NgramDisplay'\n\nimport { runQuery } from './utils'\nimport { getRelatedExpressions } from './Queries'\nimport {textReduce} from './utils'\n\nclass TextCompareWrapper extends React.Component {\n constructor(props) {\n super(props)\n this.handleToggleCompare = this.handleToggleCompare.bind(this)\n this.handleChangeBase = this.handleChangeBase.bind(this)\n this.handleCustomUpdateRelatedExpressions = this.handleCustomUpdateRelatedExpressions.bind(this)\n this.handleSetCustomExpressionId = this.handleSetCustomExpressionId.bind(this)\n this.handleToggleAllChildren = this.handleToggleAllChildren.bind(this)\n this.handleToggleAllChildrenImages = this.handleToggleAllChildrenImages.bind(this)\n this.getText = this.getText.bind(this)\n this.mounted = \"\"\n this.state = {\n expressions: [],\n expressionsCumulative: [],\n page: 1,\n intendedPage: 1,\n pagesize: 10,\n nextPage: 2,\n previousPage: undefined,\n offset: 0,\n rangeStart: 1,\n rangeEnd: 20,\n baseText: \"\",\n customExpressionId: \"\",\n customExpressionObject: {},\n showAllChildren: false,\n showAllChildrenImages: false\n }\n\n }\n handleToggleAllChildren(){\n this.setState((prevState) => {\n return{\n showAllChildren: !prevState.showAllChildren\n }\n })\n }\n handleToggleAllChildrenImages(){\n this.setState((prevState) => {\n return{\n showAllChildrenImages: !prevState.showAllChildrenImages\n }\n })\n }\n handleSetCustomExpressionId(customExpressionId) {\n this.setState({ customExpressionId: customExpressionId })\n }\n handleCustomUpdateRelatedExpressions(e) {\n e.preventDefault()\n const expressionObject = {\n resourceid: this.state.customExpressionId,\n relationLabel: \"user added comparison\"\n }\n this.setState({ customExpressionObject: expressionObject })\n }\n handleChangeBase(rawText) {\n this.setState({ baseText: rawText })\n }\n //TODO: Doesn't seem to be called; should be deleted\n handleToggleCompare(expressionid) {\n this.setState((prevState) => {\n const newExpressions = { ...prevState.expressions }\n newExpressions[expressionid].show = !newExpressions[expressionid].show\n return {\n expressions: newExpressions\n }\n })\n }\n getText(ctranscription) {\n const _this = this;\n Axios.get(\"https://exist.scta.info/exist/apps/scta-app/csv-pct.xq?resourceid=\" + ctranscription)\n .then((text) => {\n if (this.mounted) {\n let reducedText = text.data;\n if (this.props.selectionRange.wordRange){\n const wordRange = _this.props.selectionRange.wordRange.start + \"-\" + _this.props.selectionRange.wordRange.end\n reducedText = textReduce(text.data, wordRange)\n }\n _this.setState({ baseText: reducedText })\n }\n })\n }\n /**\n * @description initiates sparql requests and parses initial results.\n * @param {string} resourceid - scta url for expression object\n * @param {integer} page - page to start on in paging results\n * @param {integer} pagesize - length of page results\n */\n getRelatedExpressions(resourceid, page, pagesize) {\n const offset = (page - 1) * pagesize\n const rangeStart = (this.props.selectionRange && this.props.selectionRange.wordRange) ? this.props.selectionRange.wordRange.start : \"\" ;\n const rangeEnd = (this.props.selectionRange && this.props.selectionRange.wordRange) ? this.props.selectionRange.wordRange.end : \"\";\n const relatedExpressions = runQuery(getRelatedExpressions(resourceid, offset, pagesize, rangeStart, rangeEnd))\n \n relatedExpressions.then((d) => {\n console.log(\"result from query for related expressions\", d)\n const bindings2 = d.data.results.bindings\n const expressions = []\n // if target resource is NOT structureCollect, \n // then add first object which should be compare item for first/target resource\n \n expressions.push({\n id: this.props.info.resourceid,\n authorTitle: this.props.info.authorTitle,\n longTitle: this.props.info.longTitle,\n show: false\n });\n //arrange sparql results into an object with resourceids as keys\n bindings2.forEach((r) => {\n expressions.push({\n id: r.isRelatedTo.value,\n relationLabel: r.label.value,\n referringResource: r.element ? r.element.value : \"\",\n author: r.author ? r.author.value : \"\",\n authorTitle: r.authorTitle ? r.authorTitle.value : \"\",\n longTitle: r.longTitle ? r.longTitle.value : \"\",\n show: false,\n isRelatedToRange: r.isRelatedToRangeStart && r.isRelatedToRangeEnd ? r.isRelatedToRangeStart.value + '-' + r.isRelatedToRangeEnd.value : \"\",\n parentBlock: r.parentBlock ? r.parentBlock.value : \"\",\n\n })\n })\n // set state with new related expressions results and updates to paging information\n if (this.mounted) {\n this.setState((prevState) => {\n return {\n expressions: expressions,\n // expressionCumulative is dangerous, because the array will continue to fill up everytime paging is changed \n // even the page contents have already been added\n expressionsCumulative: prevState.expressionsCumulative.concat(expressions),\n intendedPage: page,\n nextPage: page + 1,\n previousPage: page > 1 ? page - 1 : undefined,\n offset: (page - 1) * pagesize,\n rangeStart: ((page - 1) * pagesize) + 1,\n rangeEnd: pagesize * page\n }\n })\n }\n })\n }\n componentDidMount() {\n this.mounted = true\n if (this.props.info) {\n this.getRelatedExpressions(this.props.info.resourceid, this.state.page, this.state.pagesize)\n if (this.props.info.structureType !== \"http://scta.info/resource/structureCollection\"){\n this.getText(this.props.info.ctranscription)\n }\n }\n }\n componentDidUpdate(prevProps, prevState) {\n // if resource id changes or results paging, then perform new query\n if (prevProps.info.resourceid !== this.props.info.resourceid || prevState.page !== this.state.page || prevProps.selectionRange !== this.props.selectionRange) {\n const startPage = prevProps.info.resourceid !== this.props.info.resourceid ? 1 : this.state.page\n this.getRelatedExpressions(this.props.info.resourceid, startPage, this.state.pagesize)\n if (this.props.info.structureType !== \"http://scta.info/resource/structureCollection\"){\n this.getText(this.props.info.ctranscription)\n }\n }\n // if a custom object has been added; add custom object to state.expressions\n if (prevState.customExpressionObject !== this.state.customExpressionObject) {\n const r = this.state.customExpressionObject\n const newExpression = {\n id: r.resourceid,\n relationLabel: r.relationLabel,\n }\n this.setState((prevState) => {\n return {\n expressions: [ ...prevState.expressions, newExpression ]\n }\n })\n }\n }\n componentWillUnmount() {\n this.mounted = false\n }\n render() {\n const displayExpressions = () => {\n \n const expressions = this.state.expressions.map((i, index) => {\n const isMainText = this.props.info.resourceid === i.id ? true : false\n return (\n <div key={index + \"-\" + i.id}>\n {<TextCompare\n info={this.props.info}\n expressionid={i.id}\n relationLabel={i.relationLabel}\n referringResource={i.referringResource}\n author={i.author}\n authorTitle={i.authorTitle}\n longTitle={i.longTitle}\n isMainText={isMainText}\n handleChangeBase={this.handleChangeBase}\n baseText={this.state.baseText}\n show={this.state.showAllChildren ? true : i.show}\n showImages={this.state.showAllChildrenImages ? true : i.show}\n surfaceWidth={this.props.surfaceWidth}\n isRelatedToRange={i.isRelatedToRange}\n targetRange={(this.props.selectionRange && this.props.selectionRange.wordRange) ? this.props.selectionRange.wordRange.start + \"-\" + this.props.selectionRange.wordRange.end : \"\"}\n handleAddCtRelatedExpressions={this.props.handleAddCtRelatedExpressions}\n handleShowCollationOverlay={this.props.handleShowCollationOverlay}\n />}\n </div>\n )\n })\n return expressions\n }\n const displayPagination = () => {\n return (\n <div>\n {\n (Object.keys(this.state.expressions).length > this.state.pagesize || this.state.rangeEnd > this.state.pagesize) &&\n <p className=\"small\">\n {this.state.previousPage &&\n <span>\n <span className=\"lbp-span-link\" onClick={() => this.setState({ page: this.state.previousPage })}>Previous {this.state.previousPage}</span> \n <span> | </span>\n </span>\n }\n <span>Current Page: </span>\n <FormControl style={{width: \"40px\", display: \"inline\"}} inline=\"true\" size=\"sm\" id=\"text\" type=\"text\" onChange={(e) => this.setState({ intendedPage: e.target.value })} value={this.state.intendedPage}></FormControl>\n <Button style={{display: \"inline\"}}inline=\"true\" size=\"sm\" onClick={(e) => this.setState({ page: parseInt(this.state.intendedPage) })}>Go</Button>\n \n <span>({this.state.rangeStart} - {this.state.rangeEnd})</span>\n {Object.keys(this.state.expressions).length > this.state.pagesize && \n <span>\n <span> | </span> \n <span className=\"lbp-span-link\" onClick={() => this.setState({ page: this.state.nextPage })}>Next: {this.state.nextPage}</span>\n </span>\n }\n </p>\n }\n </div>\n )\n }\n\n return (\n <Container className={this.props.hidden ? \"hidden\" : \"showing\"}>\n <h4>Text Comparisons</h4>\n {displayPagination()}\n <p className=\"small\"><a href=\"https://lombardpress.org/adfontes/\" target=\"_blank\" rel=\"noopener noreferrer\">Advanced Index and Filtering</a></p>\n <p className=\"small lbp-span-link\" onClick={this.handleToggleAllChildren}>Toggle All Children</p>\n {this.state.showAllChildren && <p className=\"small lbp-span-link\" onClick={this.handleToggleAllChildrenImages}>Toggle All Children Images</p>}\n <hr />\n {displayExpressions()}\n <hr />\n {displayPagination()}\n <div style={{ \"borderBottom\": \"1px solid rgba(0, 0, 0, 0.1)\", padding: \"5px\" }}>\n <p style={{ fontSize: \"12px\" }}>Create custom user compare</p>\n <Form onSubmit={this.handleCustomUpdateRelatedExpressions} inline=\"true\" >\n <FormControl inline=\"true\" size=\"sm\" id=\"text\" type=\"text\" value={this.state.customExpressionId} placeholder=\"expression id\" className=\"mr-sm-2\" onChange={(e) => { this.handleSetCustomExpressionId(e.target.value) }} />\n <Button inline=\"true\" size=\"sm\" type=\"submit\" style={{ margin: \"2px\" }}>Submit</Button>\n </Form>\n </div>\n\n <hr />\n <div>\n <p>Other Comparison/Connection Visualizations</p>\n <p><a target=\"_blank\" rel=\"noopener noreferrer\" href={\"http://lombardpress.org/collation-vizualizer/index.html?id=\" + this.props.info.resourceid}>Collation Overlay</a></p>\n {/* <p><span className=\"lbp-span-link\" onClick={this.props.handleShowCollationOverlay}>Collation Table Overlay</span></p> */}\n <p><a target=\"_blank\" rel=\"noopener noreferrer\" href={\"https://scta.github.io/networks-explorer/?resourceid=\" + this.props.info.resourceid}>View Reference Connections</a></p>\n <p><a target=\"_blank\" rel=\"noopener noreferrer\" href={\"https://scta.github.io/networks-explorer/topicconnections.html?resourceid=\" + this.props.info.resourceid}>View Topic Connections</a></p>\n </div>\n <div>\n <NgramDisplay info={this.props.info}\n handleChangeBase={this.handleChangeBase}\n baseText={this.state.baseText}\n surfaceWidth={this.props.surfaceWidth}\n resourceid={this.props.info.resourceid}\n markedExpressions={this.state.expressionsCumulative}\n handleAddCtRelatedExpressions={this.props.handleAddCtRelatedExpressions}\n handleShowCollationOverlay={this.props.handleShowCollationOverlay}\n targetRange={(this.props.selectionRange && this.props.selectionRange.wordRange) ? this.props.selectionRange.wordRange.start + \"-\" + this.props.selectionRange.wordRange.end : \"\"}\n />\n </div>\n\n \n \n </Container>\n\n );\n }\n}\n\nexport default TextCompareWrapper;\n","import React, {useState, useEffect} from 'react';\nimport {Link} from 'react-router-dom';\nimport Axios from 'axios'\nimport {runQuery} from './utils';\nimport Container from 'react-bootstrap/Container';\n\nimport {getPersonInfo, getPersonMentionedByFrequency, getPersonMentionsFrequency} from '../queries/personInfoQuery';\n\n\nfunction PersonInfo(props) {\n const [authorTitle, setAuthorTitle] = useState()\n const [authorImageUrl, setAuthorImageUrl] = useState()\n const [authorDescription, setAuthorDescription] = useState()\n const [birthDate, setAuthorBirthDate] = useState()\n const [deathDate, setAuthorDeathDate] = useState()\n const [mentionedByFrequency, setMentionedByFrequency] = useState([])\n const [mentionsFrequency, setMentionsFrequency] = useState([])\n useEffect(() => {\n setMentionedByFrequency([]);\n setMentionsFrequency([]);\n setAuthorImageUrl(\"\");\n setAuthorDescription(\"\");\n setAuthorBirthDate(\"\");\n setAuthorDeathDate(\"\");\n setAuthorTitle(\"\");\n\n\n const personInfo = runQuery(getPersonInfo(props.resourceid))\n personInfo.then((pd) => {\n const bindings = pd.data.results.bindings\n if (bindings.length > 0){\n const personTitle = bindings[0].authorTitle && bindings[0].authorTitle.value;\n const wikidataid = bindings[0].wikidataid && bindings[0].wikidataid.value;\n setAuthorTitle(personTitle)\n wikidataid && getWikiDataInfo(wikidataid)\n }\n })\n const mentionedByfreq = runQuery(getPersonMentionedByFrequency(props.resourceid))\n mentionedByfreq.then((fd) => {\n const bindings = fd.data.results.bindings\n //TODO; this conditional is extremely hacking; window component is passing not person id at the same time that is passing personView=true\n // this needs to be corrected, but the conditions is checking for null results when using the wrong id\n if (bindings.length > 0 && bindings[0].count.value !== \"0\"){\n \n // sort by name\n bindings.sort(sortFrequencyResults);\n const results = bindings.map((item) => {\n \n return (\n <p key={item.author.value}>\n <Link to={\"/text?resourceid=\" + item.author.value}>{item.authorTitle.value}</Link>:\n {item.count.value}\n </p>\n )\n })\n setMentionedByFrequency(results);\n \n }\n })\n \n \n\n const mentionsFreq = runQuery(getPersonMentionsFrequency(props.resourceid))\n mentionsFreq.then((fd) => {\n const bindings = fd.data.results.bindings\n //TODO; this conditional is extremely hacking; window component is passing not person id at the same time that is passing personView=true\n // this needs to be corrected, but the conditions is checking for null results when using the wrong id\n if (bindings.length > 0 && bindings[0].count.value !== \"0\"){\n // sort by name\n bindings.sort(sortFrequencyResults);\n const results = bindings.map((item, idx) => {\n \n return (\n <p key={idx + \"-\" + item.author.value}>\n <Link to={\"/text?resourceid=\" + item.author.value}>{item.authorTitle.value}</Link>: \n {item.count.value}\n </p>\n )\n })\n setMentionsFrequency(results);\n }\n })\n }, [props.resourceid]);\n\n const sortFrequencyResults = (a, b) => {\n //order by author name\n const nameA = a.authorTitle.value.toUpperCase(); // ignore upper and lowercase\n const nameB = b.authorTitle.value.toUpperCase(); // ignore upper and lowercase\n // order by frequency \n //const nameA = parseInt(a.count.value); // ignore upper and lowercase\n //const nameB = parseInt(b.count.value); // ignore upper and lowercase\n if (nameA < nameB) {\n return -1; //switch to 1 to reverse order\n }\n if (nameA > nameB) {\n return 1; //switch to -1 to reverse order\n }\n // names must be equal\n return 0;\n }\n const getWikiDataInfo = (wikidataid) => {\n const wikidataShortId = wikidataid.split(\"/entity/\")[1];\n Axios.get(\"https://www.wikidata.org/w/api.php?origin=*&action=wbgetentities&ids=\" + wikidataShortId + \"&format=json\").then((wd)=> {\n const imageslug = wd.data.entities[wikidataShortId].claims.P18 && wd.data.entities[wikidataShortId].claims.P18[0].mainsnak.datavalue.value;\n const description = wd.data.entities[wikidataShortId].descriptions[\"en\"] && wd.data.entities[wikidataShortId].descriptions[\"en\"].value;\n const birthDate = wd.data.entities[wikidataShortId].claims.P569 && wd.data.entities[wikidataShortId].claims.P569[0].mainsnak.datavalue.value.time;\n const deathDate = wd.data.entities[wikidataShortId].claims.P570 && wd.data.entities[wikidataShortId].claims.P570[0].mainsnak.datavalue.value.time;\n Axios.get(\"https://commons.wikimedia.org/w/api.php?origin=*&action=query&prop=imageinfo&iiprop=url&redirects&format=json&titles=File:\" + imageslug).then((d3) => {\n const pages = d3.data.query.pages\n const page = Object.keys(pages)[0];\n const imageurl = d3.data.query.pages[page].imageinfo && d3.data.query.pages[page].imageinfo[0].url\n \n setAuthorImageUrl(imageurl)\n setAuthorDescription(description)\n //setAuthorBirthDate(new Date(birthDate.split('+')[1]).toDateString())\n //setAuthorDeathDate(new Date(deathDate.split('+')[1]).toDateString())\n setAuthorBirthDate(parseInt(birthDate));\n setAuthorDeathDate(parseInt(deathDate));\n })\n \n \n });\n\n }\n return (\n <div className={props.hidden ? \"hidden\" : \"showing\"}>\n <Container>\n <h1>PersonInfo for {authorTitle} {birthDate && \"(\" + birthDate + \"-\" + deathDate + \")\"}</h1>\n <div style={{display: \"flex\", justifyContent: \"left\"}}>\n { authorImageUrl && <img alt=\"author\" src={authorImageUrl} width=\"100px\"/>}\n <p style={{marginLeft: \"10px\"}}>{authorDescription} {authorDescription && \"(wikidata)\"}</p>\n </div>\n <div>\n <h1>Discussed/Mentioned By Frequency</h1>\n {mentionedByFrequency}\n </div>\n <div>\n <h1>Discusses/Mentions Frequency</h1>\n {mentionsFrequency}\n </div>\n </Container>\n\n </div>\n );\n}\n\nexport default PersonInfo;","export function getPersonInfo(resourceid){\n const query = [\n \"SELECT ?author ?authorTitle ?wikidataid\",\n \"{\",\n \"BIND(<\" + resourceid + \"> AS ?author) .\",\n \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle .\" ,\n \"OPTIONAL {\",\n \"?author <http://www.w3.org/2002/07/owl#sameAs> ?wikidataid .\",\n \"FILTER(regex(str(?wikidataid), 'http://www.wikidata.org' ))\",\n \"}\",\n \"}\",\n \"ORDER BY ?authorTitle\"].join(' ')\n return query\n}\n\nexport function getPersonMentionedByFrequency(personid){\n\n var query = [\n \"select ?personTitle ?author ?authorTitle (count(?ref) as ?count)\" ,\n \"where {\",\n\n \"?ref <http://scta.info/property/structureElementType> <http://scta.info/resource/structureElementName> .\",\n\t\t\t \"?ref <http://scta.info/property/isInstanceOf> <\" + personid + \"> .\",\n \"<\" + personid + \"> <http://purl.org/dc/elements/1.1/title> ?personTitle .\",\n \"?ref <http://scta.info/property/isPartOfTopLevelExpression> ?refTopLevel .\",\n \"?refTopLevel <http://www.loc.gov/loc.terms/relators/AUT> ?author .\",\n \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle .\",\n \"}\",\n \"GROUP BY ?author ?authorTitle ?personTitle\"\n ].join('');\n\n \n return query;\n}\n\nexport function getPersonMentionsFrequency(personid){\n\n \n\n var query = [\n \"select ?author ?authorTitle (count(?ref) as ?count)\",\n \"where {\",\n \"?sourceTopLevel <http://www.loc.gov/loc.terms/relators/AUT> <\" + personid + \"> .\",\n \"?sourceTopLevel <http://scta.info/property/level> '1' .\",\n \"?ref <http://scta.info/property/isPartOfTopLevelExpression> ?sourceTopLevel .\",\n \"?ref <http://scta.info/property/structureElementType> <http://scta.info/resource/structureElementName> .\",\n \"?ref <http://scta.info/property/isInstanceOf> ?author .\",\n \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle .\",\n \"}\",\n \"GROUP BY ?author ?authorTitle\",\n ].join('');\nreturn query;\n}","import React, {useState} from 'react';\nimport FormControl from 'react-bootstrap/FormControl';\n\nfunction Comments2TagSuggestions(props) {\n const [tagFilter, setTagFilter] = useState(\"\")\n\n const handleOnClickTag = (t) => {\n setTagFilter(\"\")\n props.handleOnClickTag(t)\n }\n const displayTagSuggestions = (tags) => {\n const possibleTags = Object.keys(tags).map((t) => {\n if (tagFilter === \"?\"){\n return (<span onClick={(() => handleOnClickTag(t))} key={\"tsuggest-\" + t}>{t}</span>)\n }\n else if (t.toLowerCase().includes(tagFilter.toLowerCase())){\n return (<span onClick={(() => handleOnClickTag(t))} key={\"tsuggest-\" + t}>{t}</span>)\n }\n else {\n return null\n }\n })\n return possibleTags\n }\n const handelOnEnterPress = (e) => {\n if (e.charCode === 13) {\n props.handleOnClickTag(e.target.value)\n setTagFilter(\"\")\n }\n }\n return(\n <div>\n <FormControl size=\"sm\" type=\"text\" value={tagFilter} placeholder={props.placeHolderText} className=\"mr-sm-2\" onChange={(e) => {setTagFilter(e.target.value)}} onKeyPress={((e) => {handelOnEnterPress(e)})}/>\n {tagFilter && <div className=\"tagSuggestionList\">{displayTagSuggestions(props.tagsList)}</div>}\n </div>\n )\n}\n export default Comments2TagSuggestions;","import React, {useState, useEffect} from 'react';\nimport FormControl from 'react-bootstrap/FormControl';\nimport Button from 'react-bootstrap/Button';\nimport {useTranslation} from 'react-i18next'\nimport {FaEdit, FaComment} from 'react-icons/fa';\n\nimport Comments2TagSuggestions from './Comments2TagSuggestions'\n\nfunction Comment2Create(props) {\n const {t} = useTranslation();\n const [comment, setComment] = useState(props.comment);\n const [motivation, setMotivation] = useState(props.motivation || \"commenting\") // \"commenting\" vs \"editing\"; default \"commenting\"\n const editedTextDefault = props.selectionRange && props.selectionRange.text ? props.selectionRange.text : \"\"\n const [editedText, setEditedText] = useState((props.selectionRange && props.selectionRange.textEdited) ? props.selectionRange.textEdited : editedTextDefault);\n const [noTarget, setNoTarget] = useState(props.noTarget || false); // if noTarget is set to true, annotation is made without a target\n const [orderNumber] = useState(props.orderNumber);\n const [inputTags, setInputTags] = useState(props.tagsList || []);\n \n \n const handleOnClickTag = (t) => {\n if (!inputTags.includes(t)){\n setInputTags([...inputTags, t])\n }\n }\n const handleDropTag = (t) => {\n const newInputTags = inputTags.filter((ot) => {\n if (ot.split(\":\")[0] !== t.split(\":\")[0]){\n return ot\n }\n else{\n return null\n }\n })\n setInputTags(newInputTags)\n\n }\n const handleCommentUpdate = (e) => {\n e.preventDefault()\n const commentType = motivation;\n props.submitComment(comment, commentType, editedText, props.selectionRange, orderNumber, noTarget, inputTags)\n setComment('')\n }\n useEffect(() => {\n const editedTextDefault = props.selectionRange && props.selectionRange.text ? props.selectionRange.text : \"\"\n setEditedText((props.selectionRange && props.selectionRange.textEdited) ? props.selectionRange.textEdited : editedTextDefault)\n }, [props.selectionRange])\n useEffect(() => {\n if (motivation === \"commenting\"){\n setEditedText(props.selectionRange ? props.selectionRange.text : \"\")\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [motivation])\n\n const wordRange = (props.selectionRange && props.selectionRange.wordRange) ? props.selectionRange.wordRange.start + \"-\" + props.selectionRange.wordRange.end : \"\"\n\n return (\n <div>\n {motivation === \"editing\" && \n <div>\n <span>Suggest Edit for : \n <i>{props.selectionRange.text} </i> \n <span className=\"lbp-span-link\" title=\"leave simple comment on text\" onClick={()=>{setMotivation(\"commenting\")}}> <FaComment/> </span>\n <span> ({wordRange}) </span>\n </span> \n <FormControl as=\"textarea\" type=\"text\" id=\"editedText\" rows=\"3\" \n value={editedText} placeholder={t(\"comment\")} className=\"mr-sm-2\" onChange={(e) => {setEditedText(e.target.value)}}/>\n </div>\n }\n <div>\n {(props.selectionRange && props.selectionRange.text) &&\n <div>\n {motivation === \"editing\" ? \n <span>Leave comment on edit</span> \n : \n <span>\n Comment on: \n <i>{props.selectionRange.text} </i> \n <span className=\"lbp-span-link\" title=\"edit text\" onClick={()=>{setMotivation(\"editing\")}}> <FaEdit/> </span>\n <span> ({wordRange}) </span>\n </span>\n }\n </div>\n }\n \n <span>Has Target: <input type=\"checkbox\" inline=\"true\" label=\"has target\" checked={!noTarget} onChange={(e) => {setNoTarget(!noTarget)}} style={{display: \"inline\"}}/></span>\n <FormControl as=\"textarea\" type=\"text\" id=\"comment\" rows=\"3\" value={comment} placeholder={t(\"comment\")} className=\"mr-sm-2\" onChange={(e) => {setComment(e.target.value)}}/>\n {inputTags && <span>Selected Tags: {\n \n inputTags.map((t) => {\n return (<span key={\"tag-\"+ t}><span onClick={() => {handleDropTag(t)}}>X</span><span>{t}</span></span>)\n })\n }\n </span>\n }\n <Comments2TagSuggestions tagsList={props.availableTagsList} handleOnClickTag={handleOnClickTag} placeHolderText=\"add tags (e.g beauty, faith:1, faith:2); type ? to see in-use tags\"/>\n\n </div>\n <Button size=\"sm\" type=\"submit\" onClick={handleCommentUpdate} block style={{margin: \"2px\"}}>{t(\"Submit\")}</Button>\n </div>\n );\n}\n\nexport default Comment2Create;\n","import React, {useState} from 'react';\nimport {Link} from 'react-router-dom';\nimport {FaTrash, FaEdit, FaClipboard} from 'react-icons/fa';\nimport Comment2Create from './Comment2Create.js'\nimport {useTranslation} from 'react-i18next'\nimport {copyToClipboard} from './utils'\n\nfunction Comment2Item(props) {\n const {t} = useTranslation();\n const [editable, setEditable] = useState(false);\n \n const submitUpdate = (update, motivation, editedText, selectionRange, orderNumber, noTarget, inputTags) => {\n props.updateComment(props.comment.id, update, editedText, motivation, selectionRange, orderNumber, noTarget, inputTags)\n setEditable(false)\n }\n const addSCTALinksToValue = (value) => {\n // conversion template source: http://talkerscode.com/webtricks/convert-url-text-into-clickable-html-links-using-javascript.php \n const link = value.match(/(\\b(https?|ftp|file):\\/\\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/ig)\n if (link){\n const firstString = value.split(link[0])[0]\n let strings = [firstString]\n link.forEach((l, i) => {\n const linkComponent = <Link key={l} to={\"/res?resourceid=\" + l}>{l}</Link> \n const linkCopy = <span key={\"s-\" + l} className=\"lbp-span-link\" title=\"Copy Resource Url Clipboard\" onClick={(e) => {e.preventDefault(); copyToClipboard(l)}}><FaClipboard /></span>\n strings.push(linkComponent)\n strings.push(linkCopy)\n const afterString = value.split(l)[1]\n const prunedString = afterString.split(link[i+1])[0]\n strings.push(prunedString)\n })\n return strings\n }\n else{\n return value\n }\n }\n \n \n let target = typeof(props.comment.target) === 'string' ? props.comment.target : props.comment.target.source;\n \n\n let selectedFragment = undefined;\n let selectedFragmentRange = undefined;\n if (props.comment.target.selector){\n selectedFragment = props.comment.target.selector.filter((i) => (i.type === \"TextQuoteSelector\"))[0].exact;\n selectedFragmentRange = props.comment.target.selector.filter((i) => (i.type === \"TextPositionSelector\"))[0];\n //selectedCharacterRange = props.comment.target.selector.filter((i) => (i.type === \"TextPositionSelector\"))[0];\n target = selectedFragmentRange.start ? target + \"@\" + selectedFragmentRange.start + \"-\" + selectedFragmentRange.end : target;\n\n }\n \n const selectionRange = {\n text: selectedFragment, \n textEdited: props.comment.body.editedValue,\n wordRange: selectedFragmentRange\n }\n\n const getTagsWithOrderNumbers = (annoid, tags) => {\n const tagsWithOrder = []\n if (Object.keys(props.tagsList).length > 0){\n tags && Object.keys(tags).forEach((t) => {\n const orderNumber = getTagOrderNumber(annoid, t)\n const fullTag = orderNumber ? t + \":\" + orderNumber : t\n tagsWithOrder.push(fullTag)\n })\n }\n return tagsWithOrder // should return array\n }\n const getTagOrderNumber = (annoid, t) => {\n const annoShortId = annoid.replace(\"http://inbox.scta.info/notifications/\", \"sctan:\")\n if (props.tagsList[t] && props.tagsList[t][annoShortId] && props.tagsList[t][annoShortId].order) {\n return props.tagsList[t][annoShortId].order\n }\n else{\n return null\n }\n }\n const displayTags = (tags) => {\n if (Object.keys(props.tagsList).length > 0){\n const displayTags = tags && Object.keys(tags).map((t) => {\n const orderNumber = getTagOrderNumber(props.comment.id, t)\n return (<span key={\"tag-\" + t} className=\"lbp-span-link\" onClick={() => props.setTagFilter(t)}>{t} {orderNumber && <span>({orderNumber})</span>} </span>)\n })\n return displayTags\n }\n else{\n return null\n }\n }\n \n return (\n <div>\n {/* {!props.focused && <p>{t(\"For\")}: <Link to={\"/text?resourceid=\" + target}>{target}</Link></p>} */}\n {/* <span className=\"lbp-span-link\" onClick={() => props.handleOnClickComment(target.split(\"/resource/\")[1], selectedFragment, props.comment.body.editedValue, selectedFragmentRange, selectedCharacterRange)}>{target} {selectedFragmentRange && <span> ({selectedFragmentRange.start}-{selectedFragmentRange.end})</span>}</span> */}\n \n <p>{t(\"For\")}: <Link to={\"/text?resourceid=\" + target}>{target}</Link></p>\n {\n editable ?\n <Comment2Create submitComment={submitUpdate} \n comment={props.comment.body.value} \n selectionRange={selectionRange} \n motivation={props.comment.motivation}\n noTarget={props.comment.target ? false : true}\n orderNumber={props.orderNumber}\n tagsList={getTagsWithOrderNumbers(props.comment.id, props.comment.tags)}\n availableTagsList={props.tagsList}\n /> :\n <p>\n {\n //<span dangerouslySetInnerHTML={{ __html: addSCTALinksToValue(props.comment.body.value)}}/>\n }\n {selectedFragment && <span>Comment on: <i>{selectedFragment}</i></span>}\n <br/>\n {props.comment.motivation === \"editing\" && <span>Suggested Correction: {props.comment.body.editedValue}<br/></span>}\n \n <span>{addSCTALinksToValue(props.comment.body.value)}</span>\n <br/>\n <span>Tags: {displayTags(props.comment.tags)}</span>\n <br/>\n <span>Submitted: </span> {props.comment.created && props.comment.created.split(\"T\")[0]} | \n <span className=\"lbp-span-link\" onClick={() => {props.removeComment(props.comment.id)}}><FaTrash/> </span> | \n <span className=\"lbp-span-link\" onClick={() => setEditable(true)}> <FaEdit/></span>\n </p>\n }\n <hr/>\n </div>\n );\n}\n\nexport default Comment2Item;\n","import React, {useState} from 'react'\nimport Axios from 'axios'\nimport {FaDownload, FaCloudDownloadAlt, FaUpload} from 'react-icons/fa';\n\nconst ImportExport = (props) =>{\n //const [newListName, setNewListName] = useState('');\n const [newListUrl, setNewListUrl] = useState('');\n const [showImport, setShowImport] = useState(false);\n const [pdfStatus, setPdfStatus] = useState(null)\n\n const handleGetPdfStatus = () => {\n const printApiEndpoint = \"https://print.lombardpress.org/api/v1/\"\n //const printApiEndpoint = \"http://localhost:5000/api/v1/\"\n\n Axios.post(printApiEndpoint + \"annolist\", props.currentList).then((data) => {\n if (data.data.url){\n console.log(\"first condition passed\", data.data.url)\n const hashWithExtension = data.data.url\n //setPdfStatus({pdf: \"https://print.lombardpress.org/api/v1/\" + hashWithExtension})\n setPdfStatus({pdf: printApiEndpoint + \"cache/\" + hashWithExtension})\n }\n else{\n setPdfStatus({status: data.data.Status + \"Please check back in a few minutes\", pdf: \"\"})\n }\n })\n\n\n }\n\n\n const handleFileImport = (e) => {\n var reader = new FileReader();\n\n reader.readAsText(e.target.files[0]);\n const fileName = e.target.files[0].name\n // define callback function; aka actions to be peerformed after file is read\n reader.onload = function(e) {\n var list = reader.result;\n \n props.handleImportList(JSON.parse(list), fileName)\n }\n\n\n }\n const handleUrlImport = (e) => {\n e.preventDefault()\n Axios.get(newListUrl).then((d) => {\n console.log(\"data\", d)\n props.handleImportList(d.data, newListUrl)\n })\n\n\n }\n // const createNewList = (e) => {\n // e.preventDefault();\n // //NOTE: first argument needs to be string that will be parsed in the parent component, in this case to an array\n // props.handleImportList([], newListName)\n // setNewListName('')\n // }\n const packageData = () =>\n {\n const data = JSON.stringify(props.currentList, null, 2);\n const dataLink = \"data:application/json;charset=utf-8,\" + encodeURI(data)\n return dataLink\n }\n const downloadTitle = () =>\n {\n const title = props.currentListName.split('.json')[0] + \"-\" + new Date().toISOString().slice(0, 10)\n return title\n }\n\n const displayPdfStatus = () => {\n if (!pdfStatus){\n return (\n <p><span className=\"lbp-span-link\" onClick={handleGetPdfStatus}>Generate Pdf Text From List</span> </p>\n )\n }\n else if (pdfStatus.pdf){\n return (\n <p><a href={pdfStatus.pdf} rel=\"noopener noreferrer\">View PDF</a></p>\n )\n }\n else{\n return (\n <div>\n <p><span>{pdfStatus.status}</span></p>\n <p><span className=\"lbp-span-link\" onClick={handleGetPdfStatus}>Click here to update status</span> </p>\n </div>)\n }\n }\n\n return (\n <div>\n <span className=\"lbp-span-link\" onClick={() => setShowImport(!showImport)}>Import <FaUpload/></span> \n {showImport &&\n <div>\n <span className=\"lbp-span-link\"><FaUpload/> Load from local file</span> \n <br/>\n <input type=\"file\" id=\"files\" name=\"files[]\" onChange={handleFileImport}/>\n <br/>\n <span className=\"lbp-span-link\"><FaCloudDownloadAlt/> Load from Cloud</span>\n <form onSubmit={handleUrlImport}><input type=\"text\" value={newListUrl} onChange={(e) => {setNewListUrl(e.target.value)}}></input><input type=\"submit\"/></form>\n \n {/* <span className=\"lbp-span-link\"><FaPlusCircle/> Create New List</span> \n <form onSubmit={createNewList}><input type=\"text\" value={newListName} onChange={(e) => {setNewListName(e.target.value)}}></input><input type=\"submit\"/></form> */}\n </div>\n } \n <br/> \n <a href={packageData()} download={downloadTitle()}><span className=\"lbp-span-link\">Export <FaDownload/></span></a>\n {displayPdfStatus()}\n \n </div>\n );\n}\n\nexport default ImportExport","import * as firebase from 'firebase';\n\n\nconst config = {\n apiKey: \"AIzaSyDYqsSNAdVzipni4Zj6H0lTxFQz_bTE3XE\",\n authDomain: \"scta-65c18.firebaseapp.com\",\n databaseURL: \"https://scta-65c18-default-rtdb.firebaseio.com\",\n projectId: \"scta-65c18\",\n storageBucket: \"scta-65c18.appspot.com\",\n messagingSenderId: \"300565788198\",\n appId: \"1:300565788198:web:fcce3fafc05706de0718e7\",\n measurementId: \"G-WN007V665V\"\n};\nfirebase.initializeApp(config);\nconst db = firebase.database()\nconst googleAuthProvider = new firebase.auth.GoogleAuthProvider();\n\n// firebase.database().ref().set({\n// name: \"Jeffrey C. Witt\"\n// });\n\nexport {firebase, googleAuthProvider, db}","import React, {useState, useEffect} from 'react';\nimport {Link} from 'react-router-dom';\nimport Container from 'react-bootstrap/Container';\nimport FormControl from 'react-bootstrap/FormControl';\nimport PropTypes from 'prop-types';\nimport Comment2Create from './Comment2Create.js'\nimport Comment2Item from './Comment2Item.js'\nimport Comments2ImportExport from './Comments2ImportExport'\nimport Comments2TagSuggestions from './Comments2TagSuggestions'\n\nimport uuidv4 from 'uuid/v4';\nimport Button from 'react-bootstrap/Button';\nimport {FaClipboard} from 'react-icons/fa';\nimport {useTranslation} from 'react-i18next'\nimport {copyToClipboard} from './utils'\nimport {db } from '../firebase/firebase'\nimport {camelCase} from './utils'\n\n\n/**\n * \n * A comment wrapper for submitting comments to local storage\n * \n */\n\nfunction Comments2(props) {\n const {t} = useTranslation();\n //const [lists, setLists] = useState(JSON.parse(localStorage.getItem(\"sctaCommentsState2\"))|| {\"local\": []})\n const [lists, setLists] = useState({\"local\": []})\n const [filterTags, setFilterTags] = useState([]); // tagFilter\n const [annotations, setAnnotations] = useState({})\n const [tags, setTags] = useState({})\n const [showFocusComments, setShowFocusComments] = useState(true)\n const [commentFilter, setCommentFilter] = useState(\"\")\n const [mentionedBy, setMentionedBy] = useState([])\n //const [showFilters, setShowFilters] = useState(false)\n const [userId, setUserId] = useState(\"\")\n const [tagsToDelete, setTagsToDelete] = useState([])\n const [showManageTags, setShowManageTags] = useState(false)\n\n \n \n//retrieve annotations on mount\nuseEffect(()=>{\n setUserId(props.userId)\n if (props.userId && props.userId !== \"jeff\") {\n db.ref(props.userId)\n .once('value')\n .then((snapshot) => {\n const dbResult = snapshot.val()\n if (dbResult) {\n setAnnotations(dbResult.annotations || {})\n setTags(dbResult.tags || {})\n }\n else {\n setAnnotations({})\n setTags({})\n }\n })\n }\n }, [props.userId])\n\n\n \n\n const generateTagList = (inputTags, akey) => {\n const tagsPerComment = inputTags.map((t) => {\n return t.split(\":\")[0]\n })\n // loop through tags and create hash of tag to order, so that the tag order can be looked up\n const tagsOrderMap = {}\n inputTags.forEach((t) => {\n const order = t.split(\":\")[1]\n const tagid = t.split(\":\")[0]\n tagsOrderMap[tagid] = order ? parseInt(order) : false\n })\n\n //const tagsBlock = {}\n const tagsNewList = {...tags}\n \n tagsPerComment.forEach((t) => {\n //tagsBlock[t] = true\n // if the tag already exists\n if (tagsNewList[t]){\n // if this new entry has an order, then bump the order of all following annos\n if (tagsOrderMap[t]){\n //const renumberingCounter = tagsOrderMap[t]\n Object.keys(tagsNewList[t]).forEach((nt) => {\n if (tagsNewList[t][nt].order && tagsNewList[t][nt].order >= tagsOrderMap[t]){\n tagsNewList[t][nt].order = tagsNewList[t][nt].order + 1\n }\n })\n }\n // then add new entry\n tagsNewList[t][akey] = tagsOrderMap[t] ? {order: tagsOrderMap[t]} : true\n \n }\n else{\n tagsNewList[t] = {}\n tagsNewList[t][akey] = tagsOrderMap[t] ? {order: tagsOrderMap[t]} : true\n }\n })\n return tagsNewList\n\n }\n \n // \n const generateAnnoTagBlock = (inputTags) => {\n const tagsPerComment = inputTags.map((t) => {\n return t.split(\":\")[0]\n })\n const tagsBlock = {}\n tagsPerComment.forEach((t) => {\n tagsBlock[t] = true\n })\n return tagsBlock\n }\n\n /**\n * submit the comment\n * \n * @param {string} comment \n * @public\n */\n const submitComment = (comment, motivation, editedText, selectionRange, orderNumber, noTarget, inputTags) => {\n const randomid = uuidv4();\n const annoId = \"http://inbox.scta.info/notifications/\" + randomid\n const akey = prefixedId(annoId)\n const dateObject = new Date();\n const userId = \"http://scta.info/resource/jeffreycwitt\" //TODO; needs to adjust to user logged in info\n \n const tagsNewList = generateTagList(inputTags, akey)\n \n let start = \"\"\n let end = \"\"\n\n if (selectionRange && selectionRange.wordRange){\n start = selectionRange.wordRange.start\n end = selectionRange.wordRange.end\n }\n\n let selectorText = \"\"\n if (selectionRange && selectionRange.text){\n selectorText = selectionRange.text\n }\n const selector = [\n {\n \"type\": \"TextQuoteSelector\",\n \"exact\": selectorText\n },\n {\n \"type\": \"TextPositionSelector\",\n \"start\": start,\n \"end\": end\n }\n ]\n const annotation = {\n \"@context\": \"http://www.w3.org/ns/anno.jsonld\",\n \"id\": annoId,\n \"type\": \"Annotation\",\n \"created\": dateObject.toISOString(),\n \"creator\": userId,\n \"motivation\": motivation,\n \"tags\": generateAnnoTagBlock(inputTags),\n \"body\": {\n \"type\": \"TextualBody\",\n \"value\": comment\n },\n \"target\": !noTarget && { // changing target to object rather than string will break retrieval\n source: props.resourceid, \n esource: \"http://scta.info/resource/\" + props.resourceid.split(\"/resource/\")[1].split(\"/\")[0],\n selector: selector\n }\n \n }\n // conditionally add editedValue only if motivation is editing\n if (motivation === \"editing\"){\n annotation.body.editedValue = editedText;\n }\n else {\n delete annotation.body[\"editedValue\"];\n }\n setCommentFilter('')\n \n const annotationsNewList = {...annotations}\n annotationsNewList[akey] = annotation\n\n setAnnotations(annotationsNewList)\n setTags(tagsNewList)\n\n }\n const prefixedId = (id) => {\n const prefixedId = \"sctan:\" + id.split(\"/notifications/\")[1]\n return prefixedId\n }\n const handleRemoveTags = (tagsToRemove) => {\n let clonedAnnotations = { ...annotations};\n let clonedTags = { ...tags};\n \n const modifiedAnnos = []\n // first remove all tags from affected annotations\n tagsToRemove.forEach((t) => {\n const annosToModify = Object.keys(clonedTags[t])\n modifiedAnnos.push(annosToModify)\n annosToModify.forEach((a)=> {\n delete clonedAnnotations[a].tags[t]\n })\n // then delete tags\n delete clonedTags[t]\n })\n alert(\"Are you sure you want to remove these tags; This will modify \" + modifiedAnnos.length + \"annotations\")\n setTags(clonedTags)\n setAnnotations(clonedAnnotations)\n\n }\n // const handleRemoveTagsAndTaggedComments = () => {\n\n // }\n\n const handleDropTagToDelete = (t) => {\n const newTagsToDelete = tagsToDelete.filter((ot) => {\n if (ot.split(\":\")[0] !== t.split(\":\")[0]){\n return ot\n }\n else{\n return null\n }\n })\n setTagsToDelete(newTagsToDelete)\n\n }\n const handleOnClickTagToDelete = (t) => {\n if (!tagsToDelete.includes(t)){\n setTagsToDelete([...tagsToDelete, t])\n }\n }\n\n const handleAddFilterTag = (t) => {\n if (!filterTags.includes(t)){\n setFilterTags([...filterTags, t])\n }\n }\n const handleAddSingleFilterTag = (t) => {\n setFilterTags([t])\n }\n const handleDropFilterTag = (t) => {\n const newFilterTags = filterTags.filter((ot) => {\n if (ot.split(\":\")[0] !== t.split(\":\")[0]){\n return ot\n }\n else{\n return null\n }\n })\n setFilterTags(newFilterTags)\n\n }\n\n const removeComment = (id) => {\n //filter current list\n \n let clonedAnnotations = { ...annotations};\n \n //get list of tags who members need to be updated\n const affectedTags = Object.keys(clonedAnnotations[prefixedId(id)]?.tags || {})\n\n delete clonedAnnotations[prefixedId(id)]\n let clonedTags = { ...tags};\n affectedTags.forEach((at) => {\n delete clonedTags[at][prefixedId(id)]\n })\n \n // replace current list value with filtered list\n setAnnotations(clonedAnnotations)\n setTags(clonedTags)\n }\n const updateComment = (id, update, editedText, motivation, selectionRange, orderNumber, noTarget, inputTags) => {\n let clonedAnnotations = { ...annotations};\n const targetComment = clonedAnnotations[prefixedId(id)]\n targetComment.body.value = update\n targetComment.body.editedValue = editedText || \"\"\n targetComment.motivation = motivation\n //targetComment.orderNumber = orderNumber\n targetComment.target = noTarget ? false : targetComment.target\n targetComment.tags = generateAnnoTagBlock(inputTags)\n\n const akey = prefixedId(id)\n const tagsNewList = generateTagList(inputTags, akey)\n \n //const old_index = lists[comments].indexOf(targetComment);\n \n //reposition comment\n //see https://stackoverflow.com/questions/5306680/move-an-array-element-from-one-array-position-to-another\n //todo: this could/should be a utility function\n // if (orderNumber >= lists[comments].length) {\n // var k = orderNumber - lists[comments].length + 1;\n // while (k--) {\n // lists[comments].push(undefined);\n // }\n // }\n \n //lists[comments].splice(orderNumber, 0, lists[comments].splice(old_index, 1)[0]);\n \n setAnnotations(clonedAnnotations)\n setTags(tagsNewList)\n }\n useEffect(() => {\n setMentionedBy(getMentionedBy())\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props.resourceid])\n \n const getMentionedBy = () => {\n if (Object.keys(annotations).length > 0){\n let mentionedBy = Object.keys(annotations).map((c) => {\n if (annotations[c].body.value && annotations[c].body.value.includes(props.resourceid.split(\"/resource/\")[1].split(\"/\")[0])){\n const target = typeof(annotations[c].target) === 'string' ? annotations[c].target : annotations[c].target.source;\n return target\n }\n else{\n return undefined\n }\n })\n mentionedBy = mentionedBy.filter((i) => {return i !== undefined})\n return mentionedBy\n }\n else{\n return []\n }\n }\n // expect list to be in already parsed JSON\n const handleImportList = (list, listname) => {\n //TODO; this would need to take in annotaitonList Array and convert it to object structure \n // and then add it to annotationState which would then update db\n\n // try to load data from local storage\n try {\n const parsedList = list;\n const name = camelCase(listname) || uuidv4();\n lists[name] = parsedList\n setLists({\n ...lists\n })\n }\n // if import update fails do nothing and proceed with the default state\n catch (e) {\n console.log(\"error\", e)\n }\n }\n\n useEffect(() => {\n //localStorage.setItem(\"sctaCommentsState2\", JSON.stringify(lists))\n //NOTE/TODO: this conditional lists['local'].length > 0 is temporary and MUST BE changed\n // its currently there so that database won't be re-written on load, but it is completely acceptable for local to be 0\n // and this will prevent writing to other lists, when local list is empty\n // it is temporary to get db synch to work. \n\n if (db && Object.keys(annotations).length > 0) {\n try{\n db.ref(userId).set({annotations: annotations, tags: tags})\n }\n catch (e){\n console.log(\"error in db update\", e)\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [annotations, lists, tags])\n // bug here; lists needs to be included or update won't happen\n\n // useEffect(() => {\n // //localStorage.setItem(\"sctaCommentsState2\", JSON.stringify(lists))\n // //NOTE/TODO: this conditional lists['local'].length > 0 is temporary and MUST BE changed\n // // its currently there so that database won't be re-written on load, but it is completely acceptable for local to be 0\n // // and this will prevent writing to other lists, when local list is empty\n // // it is temporary to get db synch to work. \n\n // if (db && tags && Object.keys(tags).length > 0) {\n // console.log('firing tags', tags)\n // db.ref(\"jeff\").set({tags: tags})\n // }\n // }, [tags])\n // bug here; lists needs to be included or update won't happen\n const generateFullList = () => {\n let fullList = []\n if (!filterTags || filterTags.length === 0){\n Object.keys(annotations).forEach((k) => {\n fullList.push(annotations[k])\n })\n }\n else if (filterTags.length === 1){\n const ft = filterTags[0]\n const newAnnotations = {...annotations}\n Object.keys(newAnnotations).forEach((a) => {\n if (tags && tags[ft] && Object.keys(tags[ft]).includes(a)) {\n if (tags[ft][a].order){\n newAnnotations[a][\"order\"] = tags[ft][a].order\n }\n return fullList.push(newAnnotations[a])\n }\n else {\n return null\n }\n })\n }\n else{\n const newAnnotations = {...annotations}\n Object.keys(newAnnotations).forEach((a) => {\n if (newAnnotations[a].tags){\n if (filterTags.every(element => Object.keys(newAnnotations[a].tags).includes(element))) {\n return fullList.push(newAnnotations[a])\n }\n else {\n return null\n }\n }\n else {\n return null\n }\n })\n }\n fullList.sort((a,b) => {\n if (a.order > b.order){\n return 1\n }\n else if (a.order < b.order){\n return -1\n }\n else {\n return 0\n }\n \n })\n return fullList\n\n }\n const customSort = (list) => {\n const newList = list.sort((a,b) => {\n if (a?.order > b?.order){\n return 1\n }\n else if (a?.order < b?.order){ \n return -1 \n } \n else {\n return 0\n }\n })\n return newList\n }\n\n const displayComments = () => {\n const fullList = customSort(generateFullList())\n const displayComments = fullList.length > 0 && fullList.slice(0).map((c,i) => {\n const target = typeof(c.target) === 'string' ? c.target : c.target.source;\n if (showFocusComments){\n if (target && target.includes(props.expressionid) && (c.body.value && c.body.value.includes(commentFilter))){\n return (\n <div key={i}>\n <Comment2Item comment={c} focused={true} removeComment={removeComment} updateComment={updateComment}\n handleOnClickComment={props.handleOnClickComment} setTagFilter={handleAddSingleFilterTag} tagsList={tags}/>\n {\n //<button onClick={() => {removeNote(n.title)}}>x</button>\n }\n </div>\n )\n }\n else{\n return null\n }\n }\n else{\n if (target && target.includes(props.expressionid) && (c.body.value && c.body.value.includes(commentFilter))){\n return (\n <div key={i} style={{borderLeft: \"1px solid black\"}}>\n <Comment2Item comment={c} removeComment={removeComment} updateComment={updateComment} setTagFilter={handleAddSingleFilterTag} tagsList={tags}/>\n {\n //<button onClick={() => {removeNote(n.title)}}>x</button>\n }\n </div>\n )\n }\n else if (c.body.value && c.body.value.includes(commentFilter)){\n return (\n <div key={i}>\n <Comment2Item comment={c} removeComment={removeComment} updateComment={updateComment} setTagFilter={handleAddSingleFilterTag} tagsList={tags}/>\n {\n //<button onClick={() => {removeNote(n.title)}}>x</button>\n }\n </div>\n )\n }\n else{\n return null\n }\n }\n })\n return displayComments\n }\n return (\n <Container className={props.hidden ? \"hidden\" : \"showing\"}>\n {(props.userId && props.userId !== \"jeff\") ? \n <>\n <Comment2Create \n submitComment={submitComment} \n selectionRange={props.selectionRange}\n textEdit={props.textEdit}\n orderNumber={Object.keys(annotations).length}\n availableTagsList={tags}\n />\n <hr/>\n <div id=\"commentToggleButtons\">\n \n {showFocusComments ? <Button size=\"sm\" disabled>{t(\"Show Comments For Focused Passage\")}</Button> : <Button id=\"btnAllCommentsToggle\" size=\"sm\" onClick={() => setShowFocusComments(true)}>{t(\"Show Comments For Focused Passage\")}</Button>}\n {!showFocusComments ? <Button size=\"sm\" disabled>Show Comments Regardless of Target</Button> : <Button id=\"btnAllCommentsToggle\" size=\"sm\" onClick={() => setShowFocusComments(false)}>Show Comments Regardless of Target</Button>}\n \n </div>\n <div id=\"commentFilterInputs\">\n <div>\n <FormControl size=\"sm\" type=\"text\" value={commentFilter} placeholder={t(\"filter comments by text\")} className=\"mr-sm-2\" onChange={(e) => {setCommentFilter(e.target.value)}}/>\n </div>\n <Comments2TagSuggestions tagsList={tags} handleOnClickTag={handleAddFilterTag} placeHolderText=\"search for tags; type ? to see all tags\"/>\n </div>\n {filterTags && <span>Filter Tags: {\n \n filterTags.map((t) => {\n return (<span key={\"tag-\"+ t}><span onClick={() => {handleDropFilterTag(t)}}>X</span><span>{t}</span></span>)\n })\n }\n </span>\n }\n <hr/>\n {mentionedBy.length > 0 && \n <div>\n <span>Discussed By:</span>\n {mentionedBy.map((m) => {\n return(\n <div>\n <Link key={m} to={\"/res?resourceid=\" + m}>{m}</Link>\n <span className=\"lbp-span-link\" title=\"Copy Resource Url Clipboard\" onClick={(e) => {e.preventDefault(); copyToClipboard(m)}}><FaClipboard /></span>\n </div>\n )\n })\n }\n <hr/>\n </div>\n }\n <div>\n {displayComments()}\n </div>\n \n <div>\n <span className=\"lbp-span-link\" onClick={() => {setShowManageTags(!showManageTags)}}>Manage Tags</span>\n { showManageTags &&\n <div>\n {tagsToDelete && <span>Selected Tags: {\n \n tagsToDelete.map((t) => {\n return (<span key={\"tag-\"+ t}><span onClick={() => {handleDropTagToDelete(t)}}>X</span><span>{t}</span></span>)\n })\n }\n </span>\n }\n <div><Comments2TagSuggestions tagsList={tags} handleOnClickTag={handleOnClickTagToDelete} placeHolderText=\"search for tags; type ? to see all tags\"/></div>\n <p onClick={() => {handleRemoveTags(tagsToDelete)}}>Delete Tags</p>\n </div>\n }\n </div>\n {\n <Comments2ImportExport currentList={generateFullList()} currentListName={filterTags.join(\"-\") || \"all\"} handleImportList={handleImportList} />\n }\n </> : \n <p> You must be logged in to comment</p> }\n </Container>\n );\n}\n\nComments2.propTypes = {\n /**\n * \n * resourceid to serve as target of annotation\n *\n */\n resourceid: PropTypes.string.isRequired,\n\n}\n\nexport default Comments2;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport Container from 'react-bootstrap/Container';\nimport Spinner from './Spinner';\nimport { FaClipboard} from 'react-icons/fa';\nimport {runQuery, copyToClipboard} from './utils'\nimport {getManifestationCitationInfo} from './Queries'\n\n/**\n* citation component\n*\n* TODO: it would be better to separate the citation display, manifestation picker, citation explation\n* into three differen compoments wrapped in a citation Wrapper.\n* This way the citation display could be truly independent\n*/\nclass Citation extends React.Component{\n constructor(props){\n super(props)\n this.mounted = \"\"\n this.state = {\n eurl: \"\",\n etitle: \"\",\n murl: \"\",\n mtitle: \"\",\n turl: \"\",\n\n fetching: false\n }\n }\n\n retrieveCitation(tresourceid){\n if (tresourceid){\n this.setState({fetching: true})\n const manifestationCitationInfo = runQuery(getManifestationCitationInfo(tresourceid))\n manifestationCitationInfo.then((data) => {\n const allBindings = data.data.results.bindings\n if (allBindings.length > 0){\n const bindings = allBindings[0]\n const expressionid = bindings.expression ? bindings.expression.value : \"\"\n const manifestationid = bindings.manifestation ? bindings.manifestation.value : \"\"\n const eLongTitle = bindings.eLongTitle ? bindings.eLongTitle.value : \"\"\n const authorTitle = bindings.authorTitle ? bindings.authorTitle.value : \"\"\n const author = bindings.author ? bindings.author.value : \"\"\n const editorTitle = bindings.editorTitle ? bindings.editorTitle.value : \"\"\n const editor = bindings.editor ? bindings.editor.value : \"\"\n const datasource = bindings.datasource ? bindings.datasource.value : \"\"\n const title = bindings.codexTitle ? bindings.codexTitle.value : \"\"\n const start = bindings.surfaceTitle ? bindings.surfaceTitle.value : \"\"\n const end = allBindings[allBindings.length - 1].surfaceTitle ? allBindings[allBindings.length - 1].surfaceTitle.value : \"\"\n if (this.mounted){\n this.setState(\n {\n author: author,\n authorTitle: authorTitle,\n editor: editor,\n editorTitle: editorTitle,\n eurl: expressionid,\n etitle: eLongTitle,\n murl: manifestationid,\n mtitle: start !== end ? title + \", \" + start + \"-\" + end : title + \", \" + start,\n turl: tresourceid,\n datasource: datasource,\n fetching: false\n }\n )\n }\n //})\n }\n })\n }\n }\n componentDidMount(){\n this.mounted = true\n this.retrieveCitation(this.props.tresourceid)\n\n }\n \n componentDidUpdate(prevProps){\n if (this.props.tresourceid !== prevProps.tresourceid){\n this.retrieveCitation(this.props.tresourceid)\n }\n }\n componentWillUnmount(){\n this.mounted = false\n }\n render(){\n\n const fullCitationString = this.state.authorTitle + \", \" + this.state.etitle + \"(\" + this.state.mtitle + \") Data source: \" + this.state.datasource + \".\"\n const wordRange = this.props.selectionRange && this.props.selectionRange.wordRange && \n this.props.selectionRange.wordRange.start + \"-\" + this.props.selectionRange.wordRange.end;\n return (\n <Container>\n <h4>Citation</h4>\n {this.state.fetching ?\n <Spinner/> :\n <div>\n <p className=\"etitle\">{this.state.authorTitle}, {this.state.etitle} {wordRange && wordRange && \"@ \" + wordRange} (<a href={this.state.eurl} target=\"_blank\" rel=\"noopener noreferrer\">{this.state.eurl}{wordRange && \"@\" + wordRange}</a> <span className=\"lbp-span-link\" title=\"Copy Citation to Clipboard\" onClick={(e) => {e.preventDefault(); copyToClipboard(wordRange ? this.state.eurl + \"@\" + wordRange : this.state.eurl)}}><FaClipboard /></span>)</p>\n\n <p className=\"mtitle\">\n {this.state.editor && <span>Ed. {this.state.editorTitle}, </span>}\n \n {this.state.mtitle && this.state.mtitle + \" \"}\n \n (<a href={this.state.murl} target=\"_blank\" rel=\"noopener noreferrer\">{this.state.murl}{wordRange && \"@\" + wordRange}</a> \n \n <span className=\"lbp-span-link\" title=\"Copy Citation to Clipboard\" onClick={(e) => {e.preventDefault(); copyToClipboard(wordRange ? this.state.murl + \"@\" + wordRange : this.state.murl)}}><FaClipboard /></span>)\n </p>\n\n <p className=\"ttitle\">\n <span>Transcription Resource: </span>\n <a href={this.state.turl} target=\"_blank\" rel=\"noopener noreferrer\">{this.state.turl}{wordRange && \"@\" + wordRange}</a>\n <span className=\"lbp-span-link\" title=\"Copy Citation to Clipboard\" onClick={(e) => {e.preventDefault(); copyToClipboard(wordRange ? this.state.turl + \"@\" + wordRange : this.state.turl)}}><FaClipboard /></span>\n <br/>\n <span>Data source: </span>\n <a href={this.state.datasource} target=\"_blank\" rel=\"noopener noreferrer\"> {this.state.datasource}</a> \n <span className=\"lbp-span-link\" title=\"Copy Citation to Clipboard\" onClick={(e) => {e.preventDefault(); copyToClipboard(this.state.datasource)}}><FaClipboard /></span>\n </p>\n <p className=\"lbp-span-link\" title=\"Copy Citation to Clipboard\" onClick={(e) => {e.preventDefault(); copyToClipboard(fullCitationString)}}><FaClipboard /> Copy Full Citation to Clipboard</p>\n </div>\n }\n </Container>\n );\n }\n}\n\nCitation.propTypes = {\n /**\n * transcription resource id of focused passage,\n * transcription id is required, because a specific text passage is being complicated\n *\n * TODO: perhaps it would be good to allow the expression or manifestation id to be given\n * but the citation component would need to know what kind of resource this and would\n * need to produce a different query in each case\n */\n tresourceid: PropTypes.string.isRequired,\n\n}\n\nexport default Citation;\n","import React from 'react';\nimport Container from 'react-bootstrap/Container';\nimport {FaChevronDown, FaChevronUp} from 'react-icons/fa';\n\nclass CitationExplanation extends React.Component {\n constructor(props){\n super(props)\n this.toggleCitationExplanation = this.toggleCitationExplanation.bind(this)\n this.state = {\n showCitationExplanation: false,\n }\n }\n toggleCitationExplanation(){\n this.setState((prevState) => {\n return {showCitationExplanation: !prevState.showCitationExplanation}\n })\n }\n render(){\n return (\n <Container className=\"CitationExplanation\">\n <p onClick={this.toggleCitationExplanation}>{this.state.showCitationExplanation ? <span><FaChevronDown/>Hide Explanation of Citation Practices</span> : <span><FaChevronUp/>View Explanation of Citation Practices</span>} </p>\n {this.state.showCitationExplanation &&\n <div>\n <p>The citation of a text that has survived through a historical succession of manifestations is a complicated endeavor.\n Today, when transcriptions of these manifestations\n can be published as data, separate from any presentation,\n and thereby can be presented in a variety of ways,\n a full citation inevitably becomes even more complex.\n In order to identify the content hierarchy of the text,\n the specifical material or born digital manifestation of that text,\n and the data sources used to represent and display that manifestation,\n specificity and precision are needed.</p>\n\n <p>Full citations therefore identify three aspects of the text currently being viewed.</p>\n\n <p className=\"etitle\">First (blue) it identifies the idea of the paragraph in question situated within the conceptual hierarchy of the text.</p>\n\n <p className=\"mtitle\">Second (red) it identifies the manifestation of the text in a historical or born digital edition.</p>\n\n <p className=\"ttitle\">Third (purple) it identifies the transcription and transcription data source used to power the current text presentation.</p>\n </div>}\n </Container>\n\n );\n }\n}\n\nexport default CitationExplanation;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport Container from 'react-bootstrap/Container';\nimport {FaChevronDown, FaChevronUp} from 'react-icons/fa';\nimport {Link} from 'react-router-dom';\n\nclass ManifestationList extends React.Component {\n constructor(props){\n super(props)\n this.toggleAlternativeManifestations = this.toggleAlternativeManifestations.bind(this)\n this.state = {\n showAlternativeManifestations: true\n }\n }\n toggleAlternativeManifestations(){\n this.setState((prevState) => {\n return {showAlternativeManifestations: !prevState.showAlternativeManifestations}\n })\n }\n render(){\n const wordRange = this.props.selectionRange && this.props.selectionRange.wordRange && \n this.props.selectionRange.wordRange.start + \"-\" + this.props.selectionRange.wordRange.end;\n \n const displayManifestations = () => {\n if (this.props.manifestations){\n const manifestations = this.props.manifestations.map((i) => {\n if (this.props.tresourceid.includes(i.manifestation)){\n return (<p key={i.manifestation}>\n {i.manifestationTitle}{wordRange && \"@\" + wordRange} (Currrent Focus)\n </p>)\n }\n else{\n return (<p key={i.manifestation}>\n <Link to={wordRange ? \"/text?resourceid=\" + i.manifestation + \"@\" + wordRange : \"/text?resourceid=\" + i.manifestation}>\n {i.manifestationTitle}{wordRange && \"@\" + wordRange}</Link>\n </p>\n )\n }\n })\n return manifestations\n }\n }\n return (\n <Container className=\"ManifestationList\">\n {this.props.optionalDisplay ?\n <h4 onClick={this.toggleAlternativeManifestations}>{this.state.showAlternativeManifestations ? <span><FaChevronDown/>Hide Alternative Manifestations</span> : <span><FaChevronUp/>View Alternative Manifestations</span>} </h4>\n \n :\n <h4>Available Manifestations</h4>\n // <div>\n // <h4>Alternative Manifestations</h4>\n // <a href={\"https://mirador.scta.info?blockid=\" + this.props.resourceid} target=\"_blank\" rel=\"noopener noreferrer\">View in Mirador <img alt=\"view in mirador\" style={{width: \"12px\", height: \"12px\"}} src=\"https://projectmirador.org/img/mirador-logo.svg\"></img></a>\n // </div>\n }\n\n {this.state.showAlternativeManifestations && displayManifestations()}\n </Container>\n );\n }\n}\nManifestationList.propTypes = {\n/**\n * manifestations provides list of other mnaifestations for focused expression\n\n * TODO: it seems desireable not to require a manifestations property so that\n * one can simply provide the transcription resource id, but if the propery is not\n * the component could look it up itself. But information could also be supplied a prop\n * in the case the parent component already has the information. In this case,\n * a second look up by the component would be needless\n */\n manifestations: PropTypes.array,\n optionalDisplay: PropTypes.bool\n}\nexport default ManifestationList;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport Container from 'react-bootstrap/Container';\nimport Citation from './Citation'\nimport CitationExplanation from './CitationExplanation'\nimport ManifestationList from './ManifestationList'\n\nfunction CitationWrapper(props) {\n return (\n <Container className={props.hidden ? \"CitationWrapper hidden\" : \"CitationWrapper showing\"}>\n <Citation tresourceid={props.tresourceid} selectionRange={props.selectionRange}/>\n <CitationExplanation/>\n <hr/>\n <ManifestationList \n tresourceid={props.tresourceid}\n manifestations={props.manifestations} \n selectionRange={props.selectionRange}/>\n </Container>\n );\n}\n\nCitation.propTypes = {\n /**\n * transcription resource id of focused passage,\n * transcription id is required to be passed down to Citaiton Component\n */\n tresourceid: PropTypes.string.isRequired,\n /**\n * manifestations provides list of other mnaifestations for focused expression\n\n * TODO: it seems desireable not to require a manifestations property so that\n * one can simply provide the transcription resource id, but if the propery is not\n * the component could look it up itself. But information could also be supplied a prop\n * in the case the parent component already has the information. In this case,\n * a second look up by the component would be needless\n */\n manifestations: PropTypes.array,\n /**\n * hidden designates whether the component should be hidden after mounting\n */\n hidden: PropTypes.bool,\n /**\n * function to handle response when new manifestaiton is picked.\n * should be passed down to ManifestationList component\n */\n handleFocusChange: PropTypes.func\n}\nexport default CitationWrapper;\n","import React, {useState, useEffect} from 'react';\nimport {getCodexInfo, getCodexInfoFromSurface, getCodexInfoFromCanvas, getCodexInfoFromManifest} from './Queries'\nimport {Link} from 'react-router-dom';\nimport {runQuery} from './utils'\n\nfunction CodexToc(props) {\n const [items, setItems] = useState([])\n const retrieveCodexInfo = (id, type) => {\n \n let codexInfo = undefined\n if (type === \"surface\"){\n codexInfo = runQuery(getCodexInfoFromSurface(id))\n }\n else if (type === \"canvas\"){\n codexInfo = runQuery(getCodexInfoFromCanvas(id))\n }\n else if (type === \"manifest\"){\n codexInfo = runQuery(getCodexInfoFromManifest(id))\n }\n else{\n codexInfo = runQuery(getCodexInfo(id))\n }\n codexInfo.then((d) => {\n console.log(\"id\", id, \"type\", type, \"data\", d)\n const data = d.data.results.bindings\n if (data.length > 0 && data[0].surface){\n const expressionIdMap = data.map((d) => {\n return d.expression ? d.expression.value : \"\"\n })\n var unique = expressionIdMap.filter((v, i, a) => a.indexOf(v) === i);\n let expressionList = {}\n unique.forEach((e) => {\n expressionList[e] = []\n })\n data.forEach((d) => {\n const info = {\n expression: d.expression.value,\n expressionTitle: d.item_expression_title.value,\n manifestation: d.manifestation.value,\n surface: d.surface.value,\n surfaceTitle: d.surface_title.value,\n questionTitle: d.item_expression_question_title ? d.item_expression_question_title.value : ''\n }\n expressionList[d.expression.value].push(info)\n })\n // let focusedSurface = \"\";\n // if (type === \"surface\"){\n // focusedSurface = id\n // }\n // else if (type === \"canvas\"){\n // focusedSurface = data[0].surfaceFocus.value\n // }\n // else{\n // focusedSurface = data[0].surface.value\n // }\n setItems(expressionList)\n ///this.setState({items: expressionList, focusedSurface: focusedSurface})\n\n }\n })\n }\n useEffect(() => {\n retrieveCodexInfo(props.resourceid, props.codexResourceType)\n // eslint-disable-next-line\n }, [props.resourceid])\n \n const displayItems = () => {\n const displayItems = Object.keys(items).map((key) => {\n return (\n <p key={items[key][0].expression}>\n <span>\n <Link to={\"/text?resourceid=\" + items[key][0].surface}>{items[key][0].surfaceTitle}</Link>\n -\n <Link to={\"/text?resourceid=\" + items[key][items[key].length - 1].surface}>{items[key][items[key].length - 1].surfaceTitle}</Link>\n </span>{\": \"}\n <Link to={\"/text?resourceid=\" + items[key][0].manifestation}>{items[key][0].expressionTitle}</Link>{\": \"}\n {items[key][0].questionTitle && items[key][0].questionTitle}\n </p>\n\n )\n })\n return displayItems\n }\n return (\n <div className={props.hidden ? \"hidden\" : \"showing\"}>\n {displayItems()}\n </div>\n );\n}\n\nexport default CodexToc;","import React from 'react';\nimport {Link} from 'react-router-dom';\nimport Container from 'react-bootstrap/Container';\n//import TextPreview from '@bit/jeffreycwitt.lbp.text-preview'\nimport {TextView} from '@jeffreycwitt/lbp2.text-view'\nimport {runQuery} from './utils'\nimport {getCanonicalTranscription} from '../queries/TextPreviewWrapperQueries'\n//import {FaToggleOn, FaToggleOff} from 'react-icons/fa';\n\nclass TextPreviewWrapper extends React.Component {\n constructor(props){\n super(props)\n this.handleToggleShowTokenPosition = this.handleToggleShowTokenPosition.bind(this)\n this.mounted = false\n this.state = {\n tresourceid: \"\",\n longTitle: null,\n showTokenPosition: false\n }\n }\n handleToggleShowTokenPosition(){\n this.setState((prevState)=> {\n return {showTokenPosition: !prevState.showTokenPosition}\n })\n }\n getTranscriptionId(textPreviewResourceId){\n const info = runQuery(getCanonicalTranscription(textPreviewResourceId))\n\n info.then((d) => {\n if (this.mounted){\n this.setState(\n {\n tresourceid: d.data.results.bindings[0].ctranscription.value,\n longTitle: d.data.results.bindings[0].longTitle.value \n })\n }\n })\n .catch((e) => {\n this.setState({tresourceid: \"\"})\n //console.log(\"transcription id could not be found\", e)\n // uncomment if you want to automatically redirect\n //this.props.handleFocusChange(textPreviewResourceId)\n })\n\n\n }\n componentDidMount(){\n this.mounted = true\n this.getTranscriptionId(this.props.textPreviewResourceId)\n }\n componentDidUpdate(prevProps){\n if (prevProps.textPreviewResourceId !== this.props.textPreviewResourceId){\n this.getTranscriptionId(this.props.textPreviewResourceId)\n }\n }\n componentWillUnmount()\n {\n this.mounted = false\n }\n render(){\n const link = (this.props.textPreviewStart && this.props.textPreviewEnd) \n ? this.state.tresourceid + \"@\" + this.props.textPreviewStart + \"-\" + this.props.textPreviewEnd\n : this.state.tresourceid\n const referringRange = (this.props.referringSelectionRange && this.props.referringSelectionRange.wordRange) && this.props.referringSelectionRange.wordRange.start + \"-\" + this.props.referringSelectionRange.wordRange.end\n // const referringStart = (this.props.referringSelectionRange && this.props.referringSelectionRange.wordRange) && this.props.referringSelectionRange.wordRange.start\n // const referringEnd = (this.props.referringSelectionRange && this.props.referringSelectionRange.wordRange) && this.props.referringSelectionRange.wordRange.end\n return (\n <Container className={this.props.hidden ? \"hidden\" : \"showing\"}>\n {/* <p>Go to: <span className=\"lbp-span-link\" onClick={() => this.props.handleFocusChange(this.state.tresourceid)}>{this.state.tresourceid}</span></p> */}\n <p>Go to: <Link onClick={() => {this.props.handleTextPreviewFocusChange([{id: this.props.referringResource, range: referringRange}])}} to={\"/text?resourceid=\" + link}>{this.state.longTitle}</Link></p>\n {\n this.state.tresourceid && \n <div>\n <TextView tresourceid={this.state.tresourceid} start={parseInt(this.props.textPreviewStart)} stop={parseInt(this.props.textPreviewEnd)} context={true}/>\n {/* <span className=\"lbp-span-link\" alt=\"show word token position\" onClick={this.handleToggleShowTokenPosition}>{this.state.showTokenPosition ? <FaToggleOn/> : <FaToggleOff/>}</span> */}\n </div>\n }\n </Container>\n );\n }\n}\n\nexport default TextPreviewWrapper;\n"," export function getCanonicalTranscription(resourceid){\n const query = [\n \"SELECT DISTINCT ?ctranscription ?longTitle \",\n \"WHERE { \",\n \"{\",\n \"<\" + resourceid + \"> <http://scta.info/property/hasCanonicalManifestation> ?manifestation .\",\n \"?manifestation <http://scta.info/property/hasCanonicalTranscription> ?ctranscription .\",\n \"}\",\n \"UNION\",\n \"{\",\n \"BIND(<\" + resourceid + \"> AS ?ctranscription ) . \",\n \"?ctranscription a <http://scta.info/resource/transcription> .\",\n \"}\",\n \"UNION\",\n \"{\",\n \"<\" + resourceid + \"> <http://scta.info/property/hasCanonicalTranscription> ?ctranscription .\",\n \"}\",\n \"?ctranscription <http://scta.info/property/isTranscriptionOf> ?m .\",\n \"?m <http://scta.info/property/isManifestationOf> ?e .\",\n \"?e <http://scta.info/property/longTitle> ?longTitle .\",\n \"}\"\n ].join(' ');\n return query\n }\n","//vendor imports\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\nimport Button from 'react-bootstrap/Button';\nimport {Link} from 'react-router-dom';\nimport {FaExternalLinkAlt} from 'react-icons/fa';\n\nimport {Surface3Wrapper} from \"@jeffreycwitt/lbp2.surface3wrapper\"\n\n//internal imports\n//import Surface3Wrapper from './Surface3Wrapper'\n\n//import Comments from './Comments'\nimport {runQuery} from './utils'\nimport {getSurfaceInfo} from '../queries/SurfaceInfoQuery'\n\n\n//TODO: the result of the CONSTRUCT query is returning prefixed uris, and arrays for multiple results and objects for single results; \n// it is creating all kind of type confusion that requires extra conditionals\n// it would be better stop using the CONSTRUCT query or abstract this variations away into a separate utility function\n\nclass SurfaceInfo extends React.Component {\n constructor(props){\n super(props)\n this.handleToggleRelatedDiscussion = this.handleToggleRelatedDiscussion.bind(this)\n this.handleSurface3Manifestations = this.handleSurface3Manifestations.bind(this)\n this.handleToggleShowQuery = this.handleToggleShowQuery.bind(this)\n this.handleToggleShowImages = this.handleToggleShowImages.bind(this)\n this.state = {\n expressions: [],\n surfaceMap: {},\n showTextRegion: false,\n showQuery: false,\n query: \"\"\n }\n }\n handleToggleShowQuery(){\n this.setState((prevState) => {\n return {\n showQuery: !prevState.showQuery\n }\n })\n }\n handleSurface3Manifestations(manifestations, eid){\n let newManifestations = \"\"\n \n //if (typeof manifestations === \"object\"){\n if (manifestations instanceof Array){\n newManifestations = manifestations.map((m) =>{\n return {\n manifestation: m[\"@id\"],\n manifestationTitle: m[\"@id\"].split(\"/resource/\")[1],\n transcription: \"\"\n }\n })\n }\n // sometimes there is only manifestation not in an array\n else if (manifestations){\n newManifestations = [{\n manifestation: manifestations[\"@id\"],\n manifestationTitle: manifestations[\"@id\"].split(\"/resource/\")[1],\n transcription: \"\"\n }]\n }\n console.log(\"newManifestations\", newManifestations)\n const split1 = this.props.surfaceid.split(\"/resource/\")[1]\n const codexSlug = split1.split(\"/\")[0]\n const surface3FocusedManifestation = newManifestations ? newManifestations.filter((m) => m.manifestation.includes(codexSlug))[0].manifestation : \"\"\n\n return {\n surface3Manifestations: newManifestations,\n surface3FocusedManifestation: surface3FocusedManifestation\n } \n }\n \n handleToggleRelatedDiscussion(eid){\n this.setState((prevState) => {\n const target = prevState.expressions.find((e) => e.expressionid === eid )\n target.showComments = !target.showComments\n const newExpressions = [...prevState.expressions]\n return {\n expressions: newExpressions\n }\n })\n\n }\n handleToggleRelatedSurfaces(eid){\n this.setState((prevState) => {\n const target = prevState.expressions.find((e) => e.expressionid === eid )\n target.showRelatedSurfaces = !target.showRelatedSurfaces\n const newExpressions = [...prevState.expressions]\n return {\n expressions: newExpressions\n }\n })\n\n }\n handleToggleShowImages(eid){\n this.setState((prevState) => {\n const target = prevState.expressions.find((e) => e.expressionid === eid )\n target.showImages = !target.showImages\n const newExpressions = [...prevState.expressions]\n return {\n expressions: newExpressions\n }\n })\n\n }\n\n \n retrieveSurfaceInfo(surfaceid){\n const query = getSurfaceInfo(surfaceid)\n const surfaceInfo = runQuery(query)\n surfaceInfo.then((d) => {\n // I'm getting super weird behavior with the fuseki construct query response\n // the way the prefixes are being returned is not consistent\n // so i'm going to stringify the response, and convert all the variations to full the url\n let responseData = JSON.stringify(d.data);\n responseData = responseData.replace(/scta:resource\\//g, 'http://scta.info/resource/');\n responseData = responseData.replace(/scta:property\\//g, 'http://scta.info/property/');\n responseData = responseData.replace(/sctap:/g, 'http://scta.info/property/');\n responseData = responseData.replace(/sctar:/g, 'http://scta.info/resource/');\n responseData = responseData.replace(/j.0:/g, 'http://scta.info/property/');\n responseData = JSON.parse(responseData);\n\n if (responseData[\"@graph\"]){\n const data = responseData[\"@graph\"]\n console.log(\"data\", data)\n const expressions = [] \n data.forEach((e) => {\n if (e[\"http://scta.info/property/hasManifestation\"]){\n const surface3Manifestations = this.handleSurface3Manifestations(e[\"http://scta.info/property/hasManifestation\"], e[\"@id\"])\n expressions.push({\n expressionid: e[\"@id\"],\n manifestations: e[\"http://scta.info/property/hasManifestation\"],\n surface3Manifestations: surface3Manifestations,\n showComments: false,\n showRelatedSurfaces: false,\n showImages: false,\n })\n }\n else{\n return null\n }\n })\n let surfaceMap = {}\n data.forEach((e) => {\n if (e[\"http://scta.info/property/isOnSurface\"]){\n surfaceMap[e[\"@id\"]] = e[\"http://scta.info/property/isOnSurface\"][\"@id\"]\n }\n })\n this.setState({\n expressions: expressions,\n surfaceMap: surfaceMap,\n query: query\n })\n }\n })\n }\n\n componentDidMount(){\n this.retrieveSurfaceInfo(this.props.surfaceid)\n }\n componentDidUpdate(prevProps){\n if (this.props.surfaceid !== prevProps.surfaceid){\n this.retrieveSurfaceInfo(this.props.surfaceid)\n }\n }\n render(){\n const displayExpressions = () => {\n if (this.state.expressions.length > 0){\n const expressions = this.state.expressions.map((e) => {\n let manifestations = \"\"\n // sometimes there are several manifestations\n if (Array.isArray(e.manifestations)){\n manifestations = e.manifestations.map((mShort) => {\n const m = mShort[\"@id\"]\n return (\n <div key={m}>\n <span>{m} <Link to={\"/text?resourceid=\" + m}><FaExternalLinkAlt/></Link></span>\n <br/>\n <span style={{\"textIndent\": \"10px\"}}>...Appearing on Surface {this.state.surfaceMap[m]} <Link to={\"/text?resourceid=\" + this.state.surfaceMap[m]}><FaExternalLinkAlt/></Link></span>\n <br/>\n <br/>\n </div>\n )\n })\n }\n // sometimes there is only manifestation\n else if (e.manifestations){\n const m = e.manifestations[\"@id\"]\n manifestations = (\n <div key={m}>\n <span>{m} <Link to={\"/text?resourceid=\" + m}><FaExternalLinkAlt/></Link></span>\n <br/>\n <span style={{\"textIndent\": \"10px\"}}>...Appearing on Surface {this.state.surfaceMap[m]} <Link to={\"/text?resourceid=\" + this.state.surfaceMap[m]}><FaExternalLinkAlt/></Link></span>\n <br/>\n <br/>\n </div>\n )\n }\n else{\n manifestations = []\n }\n return (\n <div key={e.expressionid}>\n <hr/>\n <p>{e.expressionid} <Link to={\"/text?resourceid=\" + e.expressionid}><FaExternalLinkAlt/></Link></p>\n <Button variant=\"outline-primary\" size=\"sm\" block onClick={() => this.handleToggleShowImages(e.expressionid)}>{e.showImages ? \"Hide Images\" : \"Show Images\"}</Button>\n <br/>\n {(e.showImages && (e.surface3Manifestations && e.surface3Manifestations.surface3Manifestations.length > 0)) &&\n <Surface3Wrapper key={e.expressionid} manifestations={e.surface3Manifestations.surface3Manifestations} focusedManifestation={e.surface3Manifestations.surface3FocusedManifestation} annotationsDisplay=\"paragraph\" width=\"501\" hidden={false}/>\n }\n {e.showRelatedSurfaces ?\n <div>\n <Button variant=\"outline-primary\" size=\"sm\" block onClick={() => {this.handleToggleRelatedSurfaces(e.expressionid)}}>Hide Related Codices</Button>\n <br/>\n {manifestations}\n </div> :\n <div>\n <Button variant=\"outline-primary\" size=\"sm\" block onClick={() => {this.handleToggleRelatedSurfaces(e.expressionid)}}>Show Related Codices</Button>\n <br/>\n </div>\n }\n </div>\n )\n })\n return expressions\n }\n else{\n return null\n }\n }\n\n return (\n <div className={this.props.hidden ? \"hidden\" : \"showing\"}>\n <h1>Page Info</h1>\n <div style={{\"fontSize\": \"16px\"}}>\n <h1>Text objects on this page <Button size=\"sm\" className=\"lbp-span-link\" onClick={this.handleToggleShowQuery}>{this.state.showQuery ? \"Hide Proof\" : \"Prove It!\"}</Button></h1>\n {this.state.showQuery && <p>{this.state.query}</p>}\n {displayExpressions()}\n </div>\n\n </div>\n );\n }\n}\n\nSurfaceInfo.propTypes = {\n /**\n * SCTA rdf url surfaceid to use when performing SPARQL query\n */\n surfaceid: PropTypes.string.isRequired,\n /**\n * a parent function to be triggered to indicate a new view display; namely \"swithc to viewTextFocused Region\"\n */\n handleSurface3Manifestations: PropTypes.func\n}\n\n\nexport default SurfaceInfo;\n","//note; each query here represents an attempt an efficient single request for related information\n//each query therefore could be tranformed into a restful api\n\n\n export function getSurfaceInfo(surfaceid){\n const query = [\n \"PREFIX sctap: <http://scta.info/property/>\",\n \"CONSTRUCT\",\n \"{\",\n \"?expression sctap:hasManifestation ?manifestation2 .\",\n \"?manifestation2 sctap:isOnSurface ?surface2 .\",\n \"}\",\n \"WHERE\",\n \"{\",\n \"?manifestation <http://scta.info/property/isOnSurface> <\" + surfaceid + \"> .\",\n \"?manifestation <http://scta.info/property/structureType> <http://scta.info/resource/structureBlock> .\",\n \"?manifestation <http://scta.info/property/isManifestationOf> ?expression .\",\n \"?expression <http://scta.info/property/totalOrderNumber> ?order .\",\n \"?expression <http://scta.info/property/hasManifestation> ?manifestation2 .\",\n \"?manifestation2 <http://scta.info/property/isOnSurface> ?surface2 .\",\n \"?codex <http://scta.info/property/hasSurface> ?surface2 .\",\n \"}\"\n ].join('');\n return query\n }\n","import React from 'react';\n\nfunction WorkGroupInfo(props) {\n return (\n <div className={props.hidden ? \"hidden\" : \"showing\"}>\n <h1>WorkGroupInfo</h1>\n\n </div>\n );\n}\n\nexport default WorkGroupInfo;\n","import React, {useState} from 'react';\n//import Nav from 'react-bootstrap/Nav';\n//import {FaBook} from 'react-icons/fa';\n\nfunction Dictionary(props) {\n //const [dictionary, setDictionary] = useState(\"logeion\")\n const [dictionary] = useState(\"logeion\")\n\n return (\n <div className={props.hidden ? \"hidden dict-container\" : \"showing dict-container\"} >\n {/* commented out because whitaker's words does not run over https and therefore is not accessible as iframe on https sites<Nav>\n {(dictionary === 'whitakerswords') ? \n <Nav.Link title=\"select logeion\" onClick={()=>setDictionary(\"logeion\")}><FaBook/> Logeion</Nav.Link>\n : \n <Nav.Link title=\"select whitaker's words\" onClick={()=>setDictionary(\"whitakerswords\")}><FaBook/> Whitaker's Words</Nav.Link>}\n </Nav> */}\n {(props.text && props.text.split(\" \").length === 1) && \n <div className=\"dict-container2\">\n {\n dictionary === \"logeion\" ? <iframe className=\"dict-iframe\" title=\"logeion\" src={\"https://logeion.uchicago.edu/\" + props.text }></iframe> \n : \n <iframe className=\"dict-iframe\" title=\"whitakerswords\" src={\"http://archives.nd.edu/cgi-bin/wordz.pl?keyword=\" + props.text }></iframe> \n }\n </div>\n }\n </div>\n\n \n );\n}\n\nexport default Dictionary;","export function getAvailableComponents(resourceType) {\n let showComponents = []\n switch (resourceType){\n case \"collection\":\n showComponents.push(\"textCitation\")\n showComponents.push(\"textCompare\")\n showComponents.push(\"comments\")\n showComponents.push(\"search\")\n break\n case \"workGroup\":\n showComponents.push(\"workGroupInfo\")\n showComponents.push(\"comments\")\n showComponents.push(\"search\")\n break;\n case \"person\":\n showComponents.push(\"personInfo\")\n showComponents.push(\"comments\")\n showComponents.push(\"search\")\n break;\n case \"codex\":\n showComponents.push(\"codex\")\n showComponents.push(\"codexToc\")\n showComponents.push(\"comments\")\n showComponents.push(\"search\")\n break;\n case \"expressionType\":\n showComponents.push(\"comments\")\n showComponents.push(\"search\")\n break;\n case \"text\":\n showComponents.push(\"textCitation\")\n showComponents.push(\"textCompare\")\n showComponents.push(\"comments\")\n showComponents.push(\"search\")\n showComponents.push(\"xml\")\n showComponents.push(\"surface3\")\n showComponents.push(\"textOutlineWrapper\")\n break;\n default:\n break;\n }\n return showComponents\n}","import React from 'react';\nimport PropTypes from 'prop-types';\nimport Surface2 from \"../Surface2\"\n//import Surface3Wrapper from \"../Surface3Wrapper\"\nimport {Surface3Wrapper} from \"@jeffreycwitt/lbp2.surface3wrapper\"\nimport {CollationTable} from \"@jeffreycwitt/lbp2.collation-table\"\nimport XmlView from \"../XmlView\"\nimport WindowNavBar from \"./WindowNavBar\"\nimport NextPrevBar from \"../NextPrevBar\"\nimport TextCompareWrapper from \"../TextCompareWrapper\"\nimport Search3 from \"../Search3\"\nimport PersonInfo from \"../PersonInfo\"\nimport Comments2 from \"../Comments2\"\nimport CitationWrapper from \"../CitationWrapper\"\nimport TextOutlineWrapper from \"../TextOutlineWrapper\"\nimport CodexToc from \"../CodexToc\"\nimport TextPreviewWrapper from \"../TextPreviewWrapper\"\nimport SurfaceInfo from \"../SurfaceInfo\"\nimport WorkGroupInfo from \"../WorkGroupInfo\"\nimport Dictionary from \"../Dictionary\"\nimport {getAvailableComponents} from \"./WindowUtil\"\n\nimport {FaSearch, FaGripVertical, FaCode, FaInfo, FaRegImage, FaComments, FaAlignLeft} from 'react-icons/fa';\n\n\n\nclass Window2 extends React.Component {\n constructor(props){\n super(props)\n this.handleToggleTextLinesView = this.handleToggleTextLinesView.bind(this)\n this.handleChangeManifestation = this.handleChangeManifestation.bind(this)\n \n this.state = {\n windowLoad: \"\",\n mountStatus: {\n textCompare: false,\n surface3: false,\n comments: false,\n xml: false,\n search: false,\n textOutline: false,\n citation: false\n },\n collationTableWithRange: false\n\n }\n }\n \n // used to control default iamge view prop for surface3 component\n handleToggleTextLinesView(view){\n this.props.handleToggleTextLinesView(this.props.windowId, view)\n }\n // used to control default manifestation prop for surface3 component\n handleChangeManifestation(manifestation){\n // to do getting manifestation slug, to apply as default view\n // TODO: it is precarious to get info like this by deconstructing identifier\n // it would better if this information were being passed from original db look up\n const manifestationSlug = manifestation.split(\"/resource/\")[1].split(\"/\")[1]\n this.props.handleChangeManifestation(this.props.windowId, manifestationSlug)\n }\n componentDidMount(){\n this.setState(\n {windowLoad: this.props.windowLoad}\n )\n }\n componentDidUpdate(prevProps){\n //when receiving props we check first to see if a new resource id is present,\n // if so, mounting status for all window child components is set back to false\n let newMountStatus = {}\n if (this.props.resourceid !== prevProps.resourceid){\n newMountStatus = {\n textCompare: false,\n surface3: false,\n comments: false,\n xml: false,\n search: false,\n textOutline: false,\n citation: false,\n }\n // then, the mount status of the opening window load is changed to true\n newMountStatus[this.props.windowLoad] = true\n this.setState(\n {\n windowLoad: this.props.windowLoad,\n mountStatus: newMountStatus,\n }\n )\n }\n else if (this.props.windowLoad !== prevProps.windowLoad){\n const tempNewMount = this.state.mountStatus\n tempNewMount[this.props.windowLoad] = true\n newMountStatus = tempNewMount\n this.setState(\n {windowLoad: this.props.windowLoad,\n mountStatus: newMountStatus}\n )\n }\n else{\n newMountStatus = this.state.mountStatus\n }\n }\n\n render(){\n const displayTextPreviewWrappers = () => {\n //TODO: start and end numbers are not yet arrays\n // so the same start and end numbers will get sent to each item\n const items = this.props.textPreviewObjects.map((i, index) => {\n return (\n <TextPreviewWrapper key={index}\n textPreviewResourceId={i.id} \n textPreviewStart={i.range ? i.range.split(\"-\")[0] : null} \n textPreviewEnd={i.range ? i.range.split(\"-\")[1] : null} \n handleFocusChange={this.props.handleFocusChange} \n hidden={this.state.windowLoad !== \"textPreview\"}\n handleTextPreviewFocusChange={this.props.handleTextPreviewFocusChange}\n referringResource={this.props.info.ctranscription}\n referringSelectionRange={this.props.selectionRange}\n />\n )\n })\n return items\n }\n const displayChild = () => {\n //NOTE possible state machine pattern based on focus structureType\n //different options should be available depending on the focus structureType\n \n //const structureType = this.props.info.structureType\n //const isCollection = structureType === \"http://scta.info/resource/structureCollection\" || false\n\n \n //TODO: use of props.info, itemFocus, focusResearceid, resourceid vs info.resourceid needs to be better organized and clarified\n //props.info.resourceid seems redundant with props.resourceid; doesn't seem to do any harm\n // but in this component props.info will not always be available so props.resourceid should be used. \n \n\n const displayComponents = getAvailableComponents(this.props.resourceType)\n return(\n <div>\n \n {\n // NOTE: performance seems a lot better when these mount only when clicked on\n // some downside as it was nice to have them pre-loaded\n // and the state doesn't remain when leaving tab and returning back to tab.\n // for this reason search is always loaded, so that search results remain when moving between tabs.\n // a compromise approach could be made for similar resources, where some components are dismounted and some are hiddden\n }\n {\n displayComponents.includes(\"textCompare\")\n && \n (this.state.windowLoad === \"textCompare\" || this.state.mountStatus.textCompare) \n && \n <TextCompareWrapper \n info={this.props.info} \n surfaceWidth={this.props.windowType === 'bottomWindow' ? \"1000\" : \"501\"}\n hidden={this.state.windowLoad !== \"textCompare\"}\n selectionRange={this.props.selectionRange}\n handleShowCollationOverlay={this.props.handleShowCollationOverlay}\n handleAddCtRelatedExpressions={this.props.handleAddCtRelatedExpressions}\n />\n }\n {\n displayComponents.includes(\"textCitation\") \n && \n (this.state.windowLoad === \"citation\" || this.state.mountStatus.citation) \n &&\n <CitationWrapper \n tresourceid={this.props.info.resourceid + this.props.mtFocus}\n resourceid={this.props.info.resourceid}\n manifestations={this.props.info.manifestations} \n handleFocusChange={this.props.handleFocusChange} \n hidden={this.state.windowLoad !== \"citation\"}\n selectionRange={this.props.selectionRange}\n />\n }\n {\n displayComponents.includes(\"personInfo\") \n && \n (this.state.windowLoad === \"citation\" || this.state.mountStatus.citation) \n && \n <PersonInfo \n resourceid={this.props.resourceid} \n hidden={this.state.windowLoad !== \"citation\"}\n />\n }\n {\n displayComponents.includes(\"workGroupInfo\") \n && \n (this.state.windowLoad === \"citation\" || this.state.mountStatus.citation) \n && \n <WorkGroupInfo \n resourceid={this.props.resourceid} \n hidden={this.state.windowLoad !== \"citation\"}\n />\n }\n {\n displayComponents.includes(\"codex\") \n && \n (this.state.windowLoad === \"textCompare\" || this.state.mountStatus.textCompare) \n && \n <SurfaceInfo \n surfaceid={this.props.surfaceid} \n resourceid={this.props.resourceid} \n codexResourceType={this.props.codexResourceType}\n hidden={this.state.windowLoad !== \"textCompare\"}\n />\n }\n {\n displayComponents.includes(\"surface3\") \n && \n (this.state.windowLoad === \"surface3\" || this.state.mountStatus.surface3) \n && \n <Surface3Wrapper\n className=\"surfaceWrapper\"\n manifestations={this.props.info.manifestations}\n //expressionid={this.props.resourceid}\n focusedManifestation={this.props.defaultManifestationSlug ? this.props.resourceid + \"/\" + this.props.defaultManifestationSlug : this.props.resourceid + \"/\" + this.props.mtFocus.split(\"/\")[1]}\n annotationsDisplay={this.props.annotationsDisplay}\n handleToggleTextLinesView={this.handleToggleTextLinesView}\n handleChangeManifestation={this.handleChangeManifestation}\n width={this.props.windowType === 'bottomWindow' ? 1000 : 501}\n lineFocusId={this.props.lineFocusId}\n hidden={this.state.windowLoad !== \"surface3\"}\n startWord={this.props.selectionRange.wordRange && this.props.selectionRange.wordRange.start}\n endWord={this.props.selectionRange.wordRange && this.props.selectionRange.wordRange.end}/>\n }\n \n {\n displayComponents.includes(\"comments\") \n &&\n (this.state.windowLoad === \"comments\" || this.state.mountStatus.comments) \n && \n <Comments2 \n resourceid={this.props.resourceid + this.props.mtFocus}\n expressionid={this.props.resourceid} \n hidden={this.state.windowLoad !== \"comments\"}\n selectionRange={this.props.selectionRange} // this will only apply at resourceType=text level\n userId={this.props.userId}\n /> \n }\n {displayComponents.includes(\"xml\") \n && (this.state.windowLoad === \"xml\" || this.state.mountStatus.xml) \n && \n <XmlView \n tresourceid={this.props.info ? this.props.info.resourceid + this.props.mtFocus : this.props.itemFocus.expression + this.props.mtFocus} \n hidden={this.state.windowLoad !== \"xml\"}/>\n }\n {\n //NOTE: always load outline (i.e. don't check mountStatus) since it reduces number of calls, as most info is the same for all paragraphs\n }\n {\n displayComponents.includes(\"textOutlineWrapper\") \n &&\n <TextOutlineWrapper \n focusResourceid={this.props.info ? this.props.info.resourceid : this.props.itemFocus.expression} \n resourceid={this.props.info.topLevel} \n title={this.props.info.topLevel} \n hidden={this.state.windowLoad !== \"textOutlineWrapper\"} \n mtFocus={this.props.mtFocus}\n collectionLink={true}/> \n }\n {\n displayComponents.includes(\"codexToc\") \n &&\n <CodexToc \n resourceid={this.props.resourceid}\n codexResourceType={this.props.codexResourceType}\n hidden={this.state.windowLoad !== \"citation\"} \n />\n }\n {\n //NOTE: always load search (i.e. don't check mountStatus) to keep search results present even when navigating two different tabs\n }\n { displayComponents.includes(\"search\") \n &&\n <Search3\n hidden={this.state.windowLoad !== \"search\"}\n searchEid={this.props.info ? this.props.info.topLevel : this.props.resourceType === \"collection\" && this.props.resourceid}\n searchAuthor={this.props.info ? this.props.info.author : this.props.resourceType === \"person\" && this.props.resourceid} \n searchEType={this.props.resourceType === \"expressionType\" && this.props.resourceid}\n searchWorkGroup={this.props.resourceType === \"workGroup\" && this.props.resourceid}\n searchType=\"text\"\n showSubmit={true}\n showAdvancedParameters={true}\n showLabels={false}\n searchTerm={(this.props.selectionRange && this.props.selectionRange.text) ? '\"' + this.props.selectionRange.text + '\"' : \"\"}\n />\n }\n \n {\n // text preview wrapper -- loads a text preview from expression resource id\n this.state.windowLoad === \"textPreview\" && displayTextPreviewWrappers()\n }\n {\n (this.state.windowLoad === \"dictionary\" && this.props.selectionRange.text) &&\n <Dictionary text={this.props.selectionRange.text} hidden={this.state.windowLoad !== \"dictionary\"}/>\n }\n {\n this.state.windowLoad === \"collationTable\" && \n <div>\n {this.state.collationTableWithRange ? \n <CollationTable expressionIds={this.props.selectionRange.wordRange \n ? [this.props.resourceid + \"@\" + this.props.selectionRange.wordRange.start + \"-\" + this.props.selectionRange.wordRange.end, ...this.props.ctRelatedExpressions] \n : [this.props.resourceid, ...this.props.ctRelatedExpressions]} \n handleOnSegDoubleClick={this.props.handleFocusChange}/>\n :\n <CollationTable expressionIds={[this.props.resourceid, ...this.props.ctRelatedExpressions]} \n handleOnSegDoubleClick={this.props.handleFocusChange}/>\n }\n <p onClick={() => {this.setState({collationTableWithRange: !this.state.collationTableWithRange})}}>{this.state.collationTableWithRange ? \"Show without range constraint\" : \"Show with range constraint\"}</p>\n </div>\n }\n {\n this.state.windowLoad === \"surface2\" \n && \n <Surface2 \n surfaceid={this.props.surfaceid} \n lineFocusId={this.props.lineFocusId} \n topLevel={this.props.info.topLevel} \n handleSurfaceFocusChange={this.props.handleSurfaceFocusChange} \n handleLineFocusChange={this.props.handleLineFocusChange} \n hidden={this.state.windowLoad !== \"surface2\"}\n />\n }\n </div>\n )\n\n }\n \n // TODO/NOTE: perhaps tabs should be pushed to array with component above; the same logic should apply to component as \n // to its corresponding tab. So this should really be done once instead of twice.\n const getAvailableTabs = () => {\n const displayComponents = getAvailableComponents(this.props.resourceType)\n return [\n {\n name: \"citation\",\n desc: \"Text Citation\",\n show: displayComponents.includes(\"textCitation\") \n || displayComponents.includes(\"textCitation\")\n || displayComponents.includes(\"personInfo\")\n || displayComponents.includes(\"codexToc\")\n || displayComponents.includes(\"workGroupInfo\"),\n icon: <FaInfo/>\n },\n {\n name: \"surface3\",\n desc: \"Images\",\n show: displayComponents.includes(\"surface3\"),\n icon: <FaRegImage/>\n },\n {\n name: \"xml\",\n desc: \"Text XML Source\",\n show: displayComponents.includes(\"xml\"),\n icon: <FaCode/>\n },\n {\n name: \"textCompare\",\n desc: \"Text Comparisons\",\n show: displayComponents.includes(\"textCompare\")\n || displayComponents.includes(\"codex\"),\n icon: <FaGripVertical/>\n },\n {\n name: \"comments\",\n desc: \"Comments\",\n show: displayComponents.includes(\"comments\"),\n icon: <FaComments/>\n },\n {\n name: \"textOutlineWrapper\",\n desc: \"Text Outline\",\n show: displayComponents.includes(\"textOutlineWrapper\"),\n icon: <FaAlignLeft/>\n },\n {\n name: \"search\",\n desc: \"Text Search\",\n show: displayComponents.includes(\"search\"),\n icon: <FaSearch/>\n }\n ]\n }\n return (\n <div className={this.props.windowType + \" \" + this.props.windowType + this.props.openWidthHeight}>\n <WindowNavBar handleTabChange={this.props.handleTabChange}\n handleClose={this.props.handleClose}\n handleMinimize={this.props.handleMinimize}\n handleMaximize={this.props.handleMaximize}\n handleMiddlize={this.props.handleMiddlize}\n windowType={this.props.windowType}\n openWidthHeight={this.props.openWidthHeight}\n windowId={this.props.windowId}\n windowLoad={this.props.windowLoad}\n focus={this.props.resourceid}\n handleSwitchWindow={this.props.handleSwitchWindow}\n handleDuplicateWindow={this.props.handleDuplicateWindow}\n altWindowState={this.props.altWindowState}\n focusSet={!!this.props.info}\n availableTabs={getAvailableTabs()}\n />\n {(this.state.windowLoad !== \"surface2\" && this.state.windowLoad !== \"dictionary\" ) \n && <NextPrevBar \n info={this.props.info} \n handleBlockFocusChange={this.props.handleBlockFocusChange}\n handleFocusChange={this.props.handleFocusChange}\n selectionRange={this.props.selectionRange}\n />}\n\n {displayChild()}\n\n </div>\n );\n }\n}\n\nWindow2.propTypes = {\n /**\n * Window Component\n * \n * \n **/\n handleClose: PropTypes.func, //={this.handleClose}\n handleMinimize: PropTypes.func, //{this.handleMinimize}\n handleMaximize: PropTypes.func, //{this.handleMaximize}\n handleMiddlize: PropTypes.func, //{this.handleMiddlize} //TODO these functions could be reduced to window resize object\n handleTabChange: PropTypes.func, //{this.handleTabChange}\n handleBlockFocusChange: PropTypes.func, //={this.setFocus} //TODO this should be replaced by handleFocusChange\n handleFocusChange: PropTypes.func, //={this.setFocus2} //TODO this should replace handleBlockFocusChange\n handleSurfaceFocusChange: PropTypes.func, //={this.handleSurfaceFocusChange}\n handleSwitchWindow: PropTypes.func, //={this.handleSwitchWindow}\n handleDuplicateWindow: PropTypes.func, //{this.handleDuplicateWindow}\n resourceid: PropTypes.string, //={this.state.focus ? this.state.focus.resourceid : this.props.resourceid}\n windowType: PropTypes.string, //={this.state.windows[key].position}\n windowId: PropTypes.string, //={this.state.windows[key].windowId}\n windowLoad: PropTypes.string, //{this.state.windows[key].windowLoad}\n openWidthHeight: PropTypes.string, //{this.state.windows[key].openWidthHeight}\n surfaceid: PropTypes.string, // {this.state.surfaceid}\n lineFocusId: PropTypes.string, //{this.state.lineFocusId}\n //info: PropTypes.object, // {this.state.focus} \n //itemFocus: PropTypes.string, // ={this.state.itemFocus} //Todo standardize this as scta url id, instead of short id\n altWindowState: PropTypes.bool, // {this.state.windows[key].windowId === \"window1\" ? this.state.windows[\"window2\"].open : this.state.windows[\"window1\"].open} TODO could this be combined as part of a windowsParameter Object\n mtFocus: PropTypes.string, //{this.state.mtFocus}\n handleToggleTextLinesView: PropTypes.func, //={this.handleToggleTextLinesView}\n annotationsDisplay: PropTypes.string, //{this.state.windows[key].annotationsDisplay} //TODO; reduce and combine by just passing windows[key]\n handleChangeManifestation: PropTypes.func, //{this.handleChangeManifestation}\n defaultManifestationSlug: PropTypes.string, //={this.state.windows[key].defaultManifestationSlug}: TODO as part of windows object pass\n textPreviewObjects: PropTypes.array, //{this.state.textPreviewObjects}\n handleTextPreviewFocusChange: PropTypes.func, //{this.handleTextPreviewFocusChange}\n handleLineFocusChange: PropTypes.func, //{this.handleLineFocusChange}\n selectionRange: PropTypes.object //{this.state.selectionRange}\n}\n\nexport default Window2;\n","import React, {useEffect, useState} from 'react';\nimport Axios from 'axios';\n\nconst MemberBanner = (props) => {\n const [ipAddress, setIpAddress] = useState()\n const [ipAddressRange, setIpAddressRange] = useState()\n useEffect(() => {\n getIp()\n }, [])\n //NOTE:TODO: this function should be to the App.js component; \n //as the ip address only needs to be found once during the users visit\n //if it remain here; it will unnecessarily call this function whenever this component loads.\n const getIp = () => {\n Axios(\"https://api.ipify.org?format=json\").then((d) => {\n setIpAddress(d.data.ip)\n setIpAddressRange(d.data.ip.split(\".\")[0] + \".\" + d.data.ip.split(\".\")[1] + \".\" + d.data.ip.split(\".\")[2])\n })\n\n }\n const ipRangeLogoMap = {\n \"144.126.4\": {\n \"name\": \"Loyola Notre Dame Library\",\n \"logoUrl\": \"https://www.lndl.org/_resources/images/lndllogo.svg\",\n \"linkUrl\": \"https://www.lndl.org\"\n },\n \"192.124.249\": {\n \"name\": \"Loyola Notre Dame Library\",\n \"logoUrl\": \"https://www.lndl.org/_resources/images/lndllogo.svg\",\n \"linkUrl\": \"https://www.lndl.org\"\n }\n }\n\n // \"34.196.56\": {\n // \"name\": \"Universidad de los Andes\",\n // \"logoUrl\": \"https://uniandes.edu.co/caribe/sites/default/files/logo_negro_0.png\",\n // \"linkUrl\": \"https://uniandes.edu.co\"\n // }\n\n const getMemberInfo = () => {\n if (ipRangeLogoMap[ipAddressRange]){\n return ipRangeLogoMap[ipAddressRange]\n }\n else{\n const indexValue = Math.floor(Math.random()*Object.keys(ipRangeLogoMap).length);\n const keyValue = Object.keys(ipRangeLogoMap)[indexValue]\n return ipRangeLogoMap[keyValue]\n }\n }\n const memberInfo = getMemberInfo()\n return(\n ipAddress ?\n <div className=\"nav-link\">\n <span><a style={{\"color\": \"rgba(0, 0, 0, 0.5)\"}} href=\"https://community.scta.info/members\" target=\"_blank\" rel=\"noopener noreferrer\" title=\"find out more about membership\">Member Supported</a> by: </span>\n <a href={memberInfo.linkUrl} target=\"_blank\" rel=\"noopener noreferrer\" title={\"You are viewing content generously supported by \" + memberInfo.name}>\n <img alt=\"member logo\" height=\"25px\" src={memberInfo.logoUrl}/>\n </a>\n </div>\n \n :\n null\n )\n}\n\nexport default MemberBanner;","import React from 'react';\nimport {NavLink} from 'react-router-dom';\nimport Navbar from 'react-bootstrap/Navbar';\nimport Nav from 'react-bootstrap/Nav';\nimport { withTranslation } from 'react-i18next';\nimport MemberBanner from \"./MemberBanner\"\n\n\nconst TextNavBar = (props) => {\n \n const { t } = props;\n return (\n <Navbar bg=\"light\" variant=\"light\" expand=\"lg\" fixed=\"bottom\">\n <Navbar.Toggle aria-controls=\"basic-navbar-nav\" />\n <Navbar.Collapse id=\"basic-navbar-nav\">\n <Nav>\n {props.previous && <NavLink className=\"nav-link\" to={\"/text?resourceid=\" + props.previous + props.mtFocus}>{t(\"Previous\")}</NavLink>}\n {props.next && <NavLink className=\"nav-link\" to={\"/text?resourceid=\" + props.next + props.mtFocus}>{t(\"Next\")}</NavLink>}\n {props.topLevel && <NavLink className=\"nav-link\" to={\"/text?resourceid=\" + props.topLevel}>{t(\"Text Home\")}</NavLink>}\n {props.pdfView ? <span className=\"nav-link\" onClick={()=>props.handleTogglePdfView()}>{t(\"Web View\")}</span> : <span className=\"nav-link\" onClick={()=>props.handleTogglePdfView()}>{t(\"Print View\")}</span>}\n <MemberBanner/>\n </Nav>\n </Navbar.Collapse>\n </Navbar>\n\n );\n}\n\nexport default withTranslation()(TextNavBar);\n","\nimport React from 'react';\nimport Spinner from './Spinner';\nimport $ from 'jquery';\nimport {convertXMLDoc, scrollToParagraph, loadHtmlResultDocFromExist, toRange, cleanText, getContainingP, getRangeWordCount, createRange, goToGitHubEdit} from './utils'\nimport ReactTooltip from 'react-tooltip';\nimport Nav from 'react-bootstrap/Nav';\nimport {FaComments, FaEdit, FaInfo, FaBook, FaSearch} from 'react-icons/fa';\n\nclass Text extends React.Component {\n constructor(props){\n super(props)\n this.retrieveText = this.retrieveText.bind(this)\n this.handleShowToolTip = this.handleShowToolTip.bind(this)\n this.handleHideToolTip = this.handleHideToolTip.bind(this)\n this.handleHideFootnoteToolTip = this.handleHideFootnoteToolTip.bind(this)\n this.handleShowFootnoteToolTip = this.handleShowFootnoteToolTip.bind(this)\n this.handleOnToolTipClick = this.handleOnToolTipClick.bind(this)\n this.mounted = \"\";\n this.state = {\n fetching: false,\n // state.selectionRange is puposevively different than props.selection Range\n // it governs selection state of component without yet changing focus selection State of the entire app\n selectionRange: \"\", \n selectionCoords: \"\",\n dictionary: \"\"\n }\n }\n retrieveText(doc, topLevel, scrollTo, selectionRange){\n const _this = this;\n \n if (doc){\n //construct file url request ot exist db to get a cors enabled copy of the text (github does not serve files with cors enabled)\n const doc = this.props.doc;\n const topLevel = this.props.topLevel;\n const docFragment = doc.split(\"/master/\")[1]\n const topLevelFragment = topLevel.split(\"/resource/\")[1]\n \n let xmlurl = \"\"\n if (doc.includes(\"ipfs\")){\n xmlurl = doc\n }\n else{\n xmlurl = \"https://exist.scta.info/exist/apps/scta-app/text/\" + topLevelFragment + \"/\" + docFragment;\n }\n const xslurl = \"/xslt/main_view.xsl\"\n\n //Begin fetch and conversion\n this.setState({fetching: true})\n //frist try to request html converted by eXist\n const resultDocument = loadHtmlResultDocFromExist(xmlurl)\n resultDocument.then((data) => {\n //uncomment \"throw\" to force use of local xslt\n //throw \"test exception\" \n this.setState({fetching: false})\n //appendage to file\n //and event binding\n //happens inside promise call back\n document.getElementById(\"text\").innerHTML = \"\";\n document.getElementById(\"text\").innerHTML = data.data;\n // add event binding\n this.setEvents(_this, scrollTo, selectionRange)\n })\n .catch((e) => {\n // if eXist conversion fails, do conversion in browser\n const resultDocument = convertXMLDoc(xmlurl, xslurl)\n resultDocument.then((data) => {\n this.setState({fetching: false})\n document.getElementById(\"text\").innerHTML = \"\";\n document.getElementById(\"text\").appendChild(data)\n // add event binding\n this.setEvents(_this, scrollTo, selectionRange)\n }).catch((e) => {\n //if browswer conversion fails, log error message\n console.log(\"something went wrong\", e)\n document.getElementById(\"text\").innerHTML = \"\";\n document.getElementById(\"text\").innerHTML = \"<p>Apologies, the document is not able to be loaded at this time</p>\";\n })\n })\n }\n }\n\n setEvents(_this, scrollTo, selectionRange){\n\n $('.paragraphnumber').click(function(e) {\n e.preventDefault();\n const id = $(this).parent(\"p\").attr('id')\n _this.props.setFocus(id)\n _this.props.openWindow(\"window1\")\n });\n if (scrollTo){\n scrollToParagraph(scrollTo, true)\n }\n if(selectionRange){\n _this.markWithElement(selectionRange)\n }\n\n $('.js-show-figure-image').click(function(e) {\n e.preventDefault();\n const figureid = $(this).attr('id');\n _this.props.setFocus(figureid)\n if (scrollTo){\n scrollToParagraph(scrollTo, true)\n }\n \n });\n\n $('.js-show-folio-image').click(function(e) {\n e.preventDefault();\n const surfaceid = $(this).attr('data-surfaceid');\n const paragraphid = $(this).closest('.plaoulparagraph').attr(\"id\");\n\n _this.props.setFocus(paragraphid)\n _this.props.handleSurfaceFocusChange(\"http://scta.info/resource/\" + surfaceid)\n _this.props.openWindow(\"window2\", \"surface2\")\n });\n\n $('.lbp-line-number').click(function(e) {\n e.preventDefault();\n const surfaceid = $(this).attr('data-surfaceid');\n const ln = $(this).attr('data-ln');\n const paragraphid = $(this).closest('.plaoulparagraph').attr(\"id\");\n\n _this.props.setFocus(paragraphid)\n _this.props.handleSurfaceFocusChange(\"http://scta.info/resource/\" + surfaceid)\n _this.props.handleLineFocusChange(\"http://scta.info/resource/\" + surfaceid + \"/\" + ln)\n _this.props.openWindow(\"window2\", \"surface2\")\n });\n\n $('.appnote, .footnote').click(function(e) {\n e.preventDefault();\n $(this).attr(\"data-tip\", \"hello world\")\n const link = $(this).parent().children('.appnote, .footnote')\n const target = $(link).attr('href')\n const text = $(target).html()\n const footnoteOffset = this.getBoundingClientRect()\n _this.setState({footnoteText: text, footnoteOffset: footnoteOffset})\n _this.handleShowFootnoteToolTip()\n const targetText = $(this).parent().children(\".note-display\").attr('data-target-id')\n $(\".highlight\").removeClass(\"highlight\")\n $(\"#\" + targetText).addClass(\"highlight\")\n $(\"span[data-corresp=\" + targetText + \"]\").addClass(\"highlight\")\n \n \n });\n\n $(document).on(\"click\", '.js-show-info', function(e) {\n // this conditional is used prevent click event from binding event \n // to children (like line numbers which have their own click bind)\n if (e.target === this){\n e.preventDefault();\n const id = $(this).attr('data-pid')\n _this.props.setFocus(id)\n _this.props.openWindow(\"window1\")\n }\n });\n // this seems like a repetition of line 88\n if (scrollTo){\n scrollToParagraph(scrollTo, true)\n }\n\n $(document).on(\"click\", '.show-line-witness', function(e) {\n\n e.preventDefault();\n const surfaceid = $(this).attr('data-surfaceid');\n const ln = $(this).attr('data-ln');\n \n\n //const paragraphid = $(this).closest('.plaoulparagraph').attr(\"id\");\n //_this.props.setFocus(paragraphid)\n\n _this.props.handleSurfaceFocusChange(\"http://scta.info/resource/\" + surfaceid)\n _this.props.handleLineFocusChange(\"http://scta.info/resource/\" + surfaceid + \"/\" + ln)\n _this.props.openWindow(\"window2\", \"surface2\")\n });\n\n $(document).on(\"click\", '.js-show-reference-paragraph', function(e){\n e.preventDefault();\n \n // this conditional is used prevent click event from binding event \n // to children (like line numbers which have their own click bind) within diplomatic type transcriptions\n // but within \"critical transcriptions\" we want the event to fire even if a child node is clicked.\n // so the conditional below first checks if the data attribute data-bind-to-children is true. If it is true, then it fires\n // if it is not true, then it only fires if the e.target is the same as this.\n const transcriptionType = $(this).attr('data-bind-to-children')\n if (transcriptionType === \"true\" || e.target === this){\n \n /** @type {string} */\n const targetParagraph = $(this).attr('data-target-resource')\n /** @type {string} */\n const targetIds = $(this).attr('data-url')\n /** @type {Array} */\n const splitTargetId = targetIds.split(\" \")\n /** @type {string} */\n const targetRange = $(this).attr('data-target-range')\n /** @type {Array} */\n const splitTargetRange = targetRange ? targetRange.split(\" \") : null\n /** @type {Array} */\n const targetObjects = splitTargetId.map((i, index) => {\n return {\n id: i,\n range: splitTargetRange ? splitTargetRange[index] : null\n }\n \n })\n \n // set the desired text preview focus to the target of the reference\n _this.props.handleTextPreviewFocusChange(targetObjects)\n //opening bottomw window 2 to textPreview\n _this.props.openWindow(\"window2\", \"textPreview\")\n\n // NOTE: Order seems to make a difference here (at least in the production version)\n // calling this.props.setFocus before handleTextPreviewFocusChange and openWindow\n // was causing a reload that prevented desired functionality (but not on local version, only on production/deployed version)\n // TODO: investigate further, because even thought the re-arranged order seems to be working\n // the problem is likely to do with async timing (i.e. on job finish before another)\n //which could vary in different enviornments\n\n //setting paragraph focus for paragraph containing target footnote\n _this.props.setFocus(targetParagraph)\n }\n })\n\n\n\n \n function mark(e) {\n // hide tooltip\n _this.handleHideToolTip();\n //get selection object\n var sel = document.getSelection();\n // condition to test against invalid getRangeAt index\n if (window.getSelection().rangeCount >= 1){\n var rng = sel && sel.getRangeAt(0);\n const pAncestor = getContainingP(rng.commonAncestorContainer)\n //if selection is in a text paragraph\n //TODO: improve this so that selections within .appnote or .footnote get excluded\n if (pAncestor && pAncestor.className.includes(\"plaoulparagraph\")){\n const selectedElementTargetId = pAncestor.id;\n var cnt = rng.cloneContents();\n $(cnt).find(\".lbp-line-number, .paragraphnumber, br, .lbp-folionumber, .appnote, .footnote, .lbp-reg\").remove();\n // if selection is greater than 0 \n if (cnt.textContent.length > 0){\n //get ancestor p text\n const pClone = $(pAncestor).clone()\n pClone.find(\".lbp-line-number, .paragraphnumber, br, .lbp-folionumber, .appnote, .footnote, .lbp-reg\").remove();\n \n \n const selectionText = cleanText(cnt.textContent)\n \n \n // Get preceding word token length in order to identify start word position of selected range.\n // NOTE: this replaces \n //let precedingTextArray = pText.split(cleanText(selectionText))[0].split(\" \").filter(n=>n); \n // the above split approach was finding previous instances of the select word and giving false results.\n let startOffset;\n let startContainer;\n if (rng.startOffset === 0){\n startOffset = rng.startOffset;\n startContainer = rng.startContainer;\n }\n else{\n startOffset = rng.startOffset - 1;\n startContainer = rng.startContainer;\n\n }\n const precedingRange = createRange(pAncestor, pAncestor, 0, startContainer, startOffset)\n const precedingTextLength = getRangeWordCount(precedingRange);\n const startToken = precedingTextLength + 1\n const endToken = precedingTextLength + (selectionText.split(\" \").filter(n=>n).length) \n const wordRange = {start: startToken, end: endToken}\n \n const oRect = rng.getBoundingClientRect();\n const selectionRange = {\n text: selectionText,\n wordRange, \n selectedElementTargetId, \n }\n\n _this.handleShowToolTip(selectionRange, oRect);\n }\n }\n }\n }\n document.addEventListener('keyup', mark); // ctrl+keyup\n document.addEventListener('mouseup', mark);// ctrl+mouseup\n }\n /**\n * \n * @param {object} selectionRange \n */\n markWithElement(selectionRange){\n // remove existing mark elements\n this.markElementRemove()\n //only attempt to set mark if container can be found\n const container = document.getElementById(selectionRange.selectedElementTargetId);\n // NOTE: this conditional is a backup test, \n //required properties should already be check in didUpdate method\n if (container && selectionRange.wordRange){\n const range = toRange(container, selectionRange.wordRange.start, selectionRange.wordRange.end)\n const cnt = range.extractContents();\n const node = document.createElement('mark');\n node.style.backgroundColor = \"#BBCEBE\";\n node.appendChild(cnt);\n range.insertNode(node);\n //get selection text from clone\n const clone = $(node).clone();\n $(clone).find(\".lbp-line-number, .paragraphnumber, br, .lbp-folionumber, .appnote, .footnote, .lbp-reg\").remove();\n selectionRange.text = cleanText($(clone).text());\n this.props.handleUpdateSelectionRange(selectionRange)\n }\n }\n /**\n * @description finds any exiting mark element and removes it\n */\n markElementRemove(){\n $('mark').contents().unwrap();\n }\n handleOnToolTipClick(windowLoad, window = \"window1\"){\n const selectionRange = this.state.selectionRange\n console.log(\"selection range test\", selectionRange)\n // send selectionRange up to App State\n this.markWithElement(selectionRange);\n const s = selectionRange;\n this.props.setFocus(s.selectedElementTargetId + \"@\" + s.wordRange.start + \"-\" + s.wordRange.end)\n // open display window\n this.props.openWindow(window, windowLoad)\n }\n handleHideToolTip(){\n ReactTooltip.hide(this.fooRef)\n }\n handleHideFootnoteToolTip(){\n ReactTooltip.hide(this.foonoteRef)\n }\n /**\n * @description show tool tip relative to selected text\n * @param {{\n text: string,\n wordRange: object, \n selectedElementTargetId: string,\n }} selectionRange - object contain needed if about selectedRange\n * @param {object} - coords object resulting from from current selection\n */\n handleShowToolTip(selectionRange, selectionCoords){\n if (this.mounted) // NOTE: conditional was added because react was complaining of memory leak\n {\n this.setState({selectionRange: selectionRange, selectionCoords: selectionCoords})\n ReactTooltip.show(this.fooRef)\n }\n }\n handleShowFootnoteToolTip(){\n ReactTooltip.show(this.foonoteRef)\n }\n componentDidMount(){\n this.mounted = true;\n // NOTE: ScrollToNew helps ensure that scrollTo id is SCTA ShortID, \n // since TextWrapper is (at present) sometimes sending the shortid and sometimes the full url id\n // TODO: when TextWrapper is refactored and consistently sending the same ID type. this should be removed\n const scrollToNew = this.props.scrollTo && this.props.scrollTo.includes(\"/resource/\") ? this.props.scrollTo.split(\"/resource/\")[1] : this.props.scrollTo\n this.retrieveText(this.props.doc, this.props.topLevel, scrollToNew, this.props.selectionRange)\n }\n\n componentDidUpdate(prevProps, prevState){\n\n //check to see if doc has changed\n if (prevProps.doc !== this.props.doc){\n // NOTE: ScrollToNew helps ensure that scrollTo id is SCTA ShortID, \n // since TextWrapper is (at present) sometimes sending the shortid and sometimes the full url id\n // TODO: when TextWrapper is refactored and consistently sending the same ID type. this should be removed\n const scrollToNew = this.props.scrollTo && this.props.scrollTo.includes(\"/resource/\") ? this.props.scrollTo.split(\"/resource/\")[1] : this.props.scrollTo\n this.retrieveText(this.props.doc, this.props.topLevel, scrollToNew, this.props.selectionRange)\n }\n // if doc has already been appended, still scroll to target block\n else{\n if (this.props.scrollTo !== prevProps.scrollTo){\n // NOTE: ScrollToNew helps ensure that scrollTo id is SCTA ShortID, \n // since TextWrapper is (at present) sometimes sending the shortid and sometimes the full url id\n // TODO: when TextWrapper is refactored and consistently sending the same ID type. this should be removed\n const scrollToNew = this.props.scrollTo && this.props.scrollTo.includes(\"/resource/\") ? this.props.scrollTo.split(\"/resource/\")[1] : this.props.scrollTo\n scrollToParagraph(scrollToNew, true)\n \n // set mark if object is present with required properties\n if (this.props.selectionRange.selectedElementTargetId && this.props.selectionRange.wordRange){\n this.markWithElement(this.props.selectionRange)\n }\n else{\n this.markElementRemove()\n }\n }\n // TODO/Note: this seems to be firing even when it seems like the prevProps.doc !== this.props.doc\n // perhaps props are not changing/updating at the same time. So the doc prop has already changed\n // then the range changes and tries to mark element, but the retrieve text asynch request has not finished \n // and so the marking container element cannot be found. \n // NOTE: error solved by preventing attempt to mark if container cannot be found. \n // but it doesn't seem great that this is firing at undesired times.\n else if (this.props.selectionRange.wordRange !== prevProps.selectionRange.wordRange && this.props.selectionRange.selectedElementTargetId){\n this.markWithElement(this.props.selectionRange)\n }\n //final check if selection range required properties are removed then remove existing mark\n else if (!this.props.selectionRange.selectedElementTargetId && !this.props.selectionRange.wordRange) {\n this.markElementRemove()\n }\n }\n \n }\n componentWillUnmount(){\n this.mounted = false;\n }\n \n render(){\n const displayText = this.state.fetching ? \"none\" : \"block\"\n\n return (\n <div>\n {\n this.state.fetching\n &&\n <div style={{position: \"fixed\", top: \"50%\", left: \"50%\"}}>\n <Spinner/>\n </div>\n }\n \n {this.state.selectionRange && <p ref={ref => this.fooRef = ref} data-tip='tooltip' data-for=\"selection\" style={{position: \"fixed\", top: this.state.selectionCoords.top + 10, left: this.state.selectionCoords.left}}></p>}\n {this.state.footnoteText && <p ref={ref => this.foonoteRef = ref} data-tip='tooltip' data-for=\"footnote\" style={{position: \"fixed\", top: this.state.footnoteOffset.top + 10, left: this.state.footnoteOffset.left}}></p>}\n <ReactTooltip clickable={true} place=\"top\" id=\"selection\">\n {this.state.selectionRange &&\n <Nav>\n <Nav.Link title={this.state.selectionRange.wordRange.start + \"-\" +this.state.selectionRange.wordRange.end} onClick={() => {this.handleOnToolTipClick(\"citation\")}}><FaInfo/></Nav.Link>\n <Nav.Link onClick={() => {this.handleOnToolTipClick(\"comments\")}}><FaComments/></Nav.Link>\n {(this.state.selectionRange.text && this.state.selectionRange.text.split(\" \").length === 1) && \n <Nav.Link onClick={() => {goToGitHubEdit(this.props.doc, this.state.selectionRange.text, this.state.selectionRange.selectedElementTargetId)}}><FaEdit/></Nav.Link>\n }\n <Nav.Link onClick={() => {this.handleOnToolTipClick(\"search\")}}><FaSearch/></Nav.Link>\n {(this.state.selectionRange.text && this.state.selectionRange.text.split(\" \").length === 1) && \n <Nav.Link title=\"look up word\" onClick={()=>this.handleOnToolTipClick(\"dictionary\", \"window2\")}><FaBook/></Nav.Link>\n }\n \n </Nav>\n }\n </ReactTooltip>\n <ReactTooltip id=\"footnote\" clickable={true} place=\"top\">\n \n <p dangerouslySetInnerHTML={{ __html: this.state.footnoteText}}></p>\n </ReactTooltip>\n <div id=\"text\" style={{display: displayText}}></div>\n </div>\n\n );\n }\n}\n\nexport default Text;\n","import React from 'react';\nimport {Link} from 'react-router-dom';\nfunction Item(props) {\n const displayItem = () => {\n // conditions prevents attempt to render when props.item is not present\n if (props.item){\n return (\n <tr>\n {props.item.author && <td><Link to={\"/text?resourceid=\" + props.item.author}>{props.item.authorTitle}</Link></td>}\n <td><Link to={\"/text?resourceid=\" + props.item.id}>{props.item.title}</Link></td>\n {props.item.questionTitle && <td><Link to={\"/text?resourceid=\" + props.item.id}>{props.item.questionTitle}</Link></td>}\n </tr>\n )\n }\n else{\n return null\n }\n }\n return (\n displayItem()\n );\n}\n\nexport default Item;\n","import React from 'react';\nimport Container from 'react-bootstrap/Container';\nimport Table from 'react-bootstrap/Table';\nimport {runQuery} from './utils'\nimport {getAuthorInformation} from './Queries'\nimport Item from \"./Item\"\n\n//import Lbp from \"lbp.js/lib\"\n\n\nclass AuthorCollection extends React.Component {\n constructor(props){\n super(props)\n\n this.retrieveAuthorCollectionInfo = this.retrieveAuthorCollectionInfo.bind(this)\n this.handleItemFilter = this.handleItemFilter.bind(this)\n this.itemFilter = React.createRef();\n\n this.mount = false\n this.state = {\n authorTitle: \"\",\n authorArticles: [],\n textArticles: [],\n expressions: [],\n itemFilter: \"\",\n }\n\n }\n handleItemFilter(e){\n const item = e.target.value\n this.setState({itemFilter: item})\n\n }\n arrangeItems(itemsPromise, resourceid){\n itemsPromise.then((d) => {\n // I'm getting super weird behavior with the fuseki construct query response\n // the way the prefixes are being returned is not consistent\n // so i'm going to stringify the response, and convert all the variations to full the url\n let responseData = JSON.stringify(d.data);\n responseData = responseData.replace(/scta:resource\\//g, 'http://scta.info/resource/');\n responseData = responseData.replace(/scta:property\\//g, 'http://scta.info/property/');\n responseData = responseData.replace(/sctap:/g, 'http://scta.info/property/');\n responseData = responseData.replace(/sctar:/g, 'http://scta.info/resource/');\n responseData = responseData.replace(/j.0:/g, 'http://scta.info/property/');\n console.log(\"responseData\", responseData)\n responseData = JSON.parse(responseData);\n \n // author get with conditional fall back due to strange changing behavior in results\n let author = responseData[\"@graph\"].filter((i) => i[\"@id\"] === resourceid)[0]\n console.log(\"author\", author)\n // if (!author){\n // author = d.data[\"@graph\"].filter((i) => i[\"@id\"] === resourceid)[0]\n // }\n const authorTitle = author[\"dc:title\"]\n \n let authorArticles = null\n if(Array.isArray(author[\"http://scta.info/property/authorArticle\"])){\n authorArticles = author[\"http://scta.info/property/authorArticle\"].map((a) => {\n return {\n id: a[\"@id\"],\n //change due to fuseki 4.3.1 update \n //title: d.data[\"@graph\"].filter((i) => i[\"@id\"] === a)[0][\"http://purl.org/dc/elements/1.1/title\"]\n title: responseData[\"@graph\"].filter((i) => i[\"@id\"] === a[\"@id\"])[0][\"dc:title\"]\n }\n })\n }\n else if (author[\"http://scta.info/property/authorArticle\"]){\n authorArticles = [{id: author[\"http://scta.info/property/authorArticle\"][\"@id\"], title: responseData[\"@graph\"].filter((i) => i[\"@id\"] === author[\"http://scta.info/property/authorArticle\"][\"@id\"])[0][\"dc:title\"]}]\n }\n let textArticles = null\n if(Array.isArray(author[\"http://scta.info/property/textArticle\"])){\n textArticles = author[\"http://scta.info/property/textArticle\"].map((a) => {\n return {\n id: a[\"@id\"],\n title: responseData[\"@graph\"].filter((i) => i[\"@id\"] === a[\"@id\"])[0][\"dc:title\"]\n }\n })\n }\n else if (author[\"http://scta.info/property/textArticle\"]){\n textArticles = [{id: author[\"http://scta.info/property/textArticle\"][\"@id\"], title: responseData[\"@graph\"].filter((i) => i[\"@id\"] === author[\"http://scta.info/property/textArticle\"][\"@id\"])[0][\"dc:title\"]}]\n }\n\n let expressions = null\n if(Array.isArray(author[\"http://scta.info/property/hasTopLevelExpression\"])){\n expressions = author[\"http://scta.info/property/hasTopLevelExpression\"].map((a) => {\n return {\n id: a[\"@id\"],\n title: responseData[\"@graph\"].filter((i) => i[\"@id\"] === a[\"@id\"])[0][\"dc:title\"]\n }\n })\n }\n else if (author[\"http://scta.info/property/hasTopLevelExpression\"]){\n expressions = [{id: author[\"http://scta.info/property/hasTopLevelExpression\"][\"@id\"], title: responseData[\"@graph\"].filter((i) => i[\"@id\"] === author[\"http://scta.info/property/hasTopLevelExpression\"][\"@id\"])[0][\"dc:title\"]}]\n }\n console.log(\"expressions\", expressions)\n if (this.mount){\n this.setState({authorArticles: authorArticles, textArticles: textArticles, expressions: expressions, authorTitle: authorTitle })\n }\n \n })\n .catch((err) => {\n console.log(err)\n })\n }\n\n retrieveAuthorCollectionInfo(resourceid){\n const authorCollectionInfo = runQuery(getAuthorInformation(resourceid))\n /// add items to state\n this.arrangeItems(authorCollectionInfo, resourceid)\n }\n componentDidUpdate(prevProps){\n if (this.props.resourceid !== prevProps.resourceid){\n this.refs.itemFilter ? this.refs.itemFilter.value = \"\" :\n this.retrieveAuthorCollectionInfo(this.props.resourceid)\n }\n }\n componentDidMount(){\n this.mount = true\n this.retrieveAuthorCollectionInfo(this.props.resourceid)\n\n }\n componentWillUnmount(){\n this.mount = false\n }\n render(){\n //const resourceid = Qs.parse(this.props.location.search, { ignoreQueryPrefix: true }).resourceid;\n\n const displayItems = (list) => {\n const items = list.map((i) => {\n return (\n\n <Item key={i.id} item={i}/>\n\n )\n });\n return items\n }\n\n\n\n\n\n\n return (\n <Container className=\"collectionBody\">\n <h1>{this.state.authorTitle}</h1>\n \n {this.state.expressions &&\n <Container>\n <h1>Expressions</h1>\n <br/>\n <Table striped bordered hover size=\"sm\">\n <tbody>\n {displayItems(this.state.expressions)}\n </tbody>\n </Table>\n </Container>\n }\n {this.state.authorArticles &&\n <Container>\n <h1>Author Related Articles</h1>\n <br/>\n <Table striped bordered hover size=\"sm\">\n <tbody>\n {displayItems(this.state.authorArticles)}\n </tbody>\n </Table>\n </Container>\n }\n {this.state.textArticles &&\n <Container>\n <h1>Text Related Articles</h1>\n <br/>\n <Table striped bordered hover size=\"sm\">\n <tbody>\n {displayItems(this.state.textArticles)}\n </tbody>\n </Table>\n </Container>\n }\n </Container>\n );\n }\n}\n\nexport default AuthorCollection;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport Axios from 'axios'\nimport Alert from 'react-bootstrap/Alert';\nimport { withTranslation } from 'react-i18next';\n\nimport {runQuery} from './utils'\nimport {versionHistoryInfo} from './Queries'\n\nclass VersionChain extends React.Component {\n constructor(props){\n super(props)\n this.getVersionHistory = this.getVersionHistory.bind(this)\n this.handleToggleShowVersions = this.handleToggleShowVersions.bind(this)\n this.state = {\n versions: [],\n currentVersion: \"\",\n showVersions: false\n }\n }\n handleToggleShowVersions(){\n this.setState((prevState) => {\n return {showVersions: !prevState.showVersions}\n })\n }\n getVersionHistory(transcriptionid){\n const versionChainInfo = runQuery(versionHistoryInfo(transcriptionid))\n versionChainInfo.then((d) => {\n const b = d.data.results.bindings\n b.forEach((b, i) => {\n var reviewUrl = \"https://dll-review-registry.scta.info/api/v1/reviews/?url=\" + b.doc.value + \"?society=MAA\"\n Axios(reviewUrl).then((d2) => {\n const data = d2.data\n var reviewObject = {}\n if (data.length > 0){\n reviewObject = {\n img_url: data[0][\"badge-url\"],\n reviewid: data[0][\"id\"],\n ipfsHash: data[0][\"ipfs-hash\"],\n html_link: \"https://dll-review-registry.scta.info/reviews/\" + data[0][\"id\"] + \".html\",\n rubric_link: data[0][\"badge-rubric\"],\n summary: data[0][\"review-summary\"]\n }\n }\n this.setState((prevState) => {\n const newVersion = {\n versionTranscription: b.version ? b.version.value : \"\",\n versionLabel: b.version_label ? b.version_label.value : \"\",\n versionOrderNumber: b.order_number ? b.order_number.value : \"\",\n versionReview: b.review ? b.review.value : \"\",\n versionDoc: b.doc ? b.doc.value : \"\",\n versionReviewInfo: reviewObject,\n }\n return {\n versions: [...prevState.versions, newVersion],\n currentVersion: transcriptionid\n }\n })\n })\n })\n })\n }\n componentDidMount(){\n //prevents call when itemInfo prop is not present\n if (this.props.transcriptionid){\n this.getVersionHistory(this.props.transcriptionid)\n }\n }\n componentDidUpdate(prevProps, prevState){\n if (this.props.transcriptionid !== prevProps.transcriptionid){\n console.log('running fetch')\n this.setState({versions: []}, () => {\n this.getVersionHistory(this.props.transcriptionid)\n })\n }\n}\n render(){\n const { t } = this.props;\n const displayVersions = () => {\n const versions = this.state.versions.map((v) => {\n const currentlyViewing = v.versionTranscription === this.state.currentVersion ? \"currentlyViewing\" : \"\"\n const gitHubEdit = v.versionDoc.includes(\"github.com\") && v.versionDoc.replace(\"/raw/\", \"/edit/\")\n //NOTE this topLevel get is a precarious shortcut, it could be inherited as a prop from a previous sparql query\n const topLevelShortId = v.versionDoc.includes(\"github.com\") && v.versionDoc.split(\"/scta-texts/\")[1].split(\"/\")[0]\n const gitHubIssues = \"https://github.com/scta-texts/\" + topLevelShortId + \"issues\";\n return (<p key={v.versionTranscription} className={currentlyViewing + \" small\"}>\n {currentlyViewing ? <span>{v.versionLabel} {t(\"(Currently Viewing)\")}</span> : <span className=\"lbp-span-link\" onClick={()=>{this.props.handleFocusChange(v.versionTranscription)}}>{v.versionLabel}</span>}\n {v.versionReviewInfo.html_link && <span> {t(\"Peer Reviewed\")}: <a href={v.versionReviewInfo.html_link}><img alt=\"review\" src={v.versionReviewInfo.img_url}/></a> </span>}\n <span className=\"small\"> {t(\"Data Source\")}: <a href={v.versionDoc}>{v.versionDoc}</a> </span>\n {gitHubEdit && <span className=\"small\"> | <a href={gitHubEdit} target=\"_blank\" rel=\"noopener noreferrer\"> Edit on <img src=\"https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png\" alt=\"github\" height=\"25px\"/> Github</a> or <a href={gitHubIssues} target=\"_blank\" rel=\"noopener noreferrer\">Create a GitHub Issue</a></span>}\n </p>)\n })\n return versions\n }\n const displayAlert = () => {\n if (this.state.versions){\n if (this.state.versions.length > 1){\n return (\n <Alert variant=\"info\">\n <p onClick={this.handleToggleShowVersions} className=\"small\">{t(\"This Text Has Multiple Indexed Versions\")}</p>\n {this.state.showVersions && displayVersions()}\n </Alert>\n )\n }\n else if (this.state.versions.length === 1){\n const version = this.state.versions[0]\n const gitHubEdit = version.versionDoc.includes(\"github.com\") && version.versionDoc.replace(\"/raw/\", \"/edit/\")\n //NOTE this topLevel get is a precarious shortcut, it could be inherited as a prop from a previous sparql query\n const topLevelShortId = version.versionDoc.includes(\"github.com\") && version.versionDoc.split(\"/scta-texts/\")[1].split(\"/\")[0]\n const gitHubIssues = \"https://github.com/scta-texts/\" + topLevelShortId + \"/issues\";\n \n return (<Alert className=\"versioninfobox\" variant=\"info\">\n <span className=\"small\">{t(\"Version\")}: {version.versionLabel} \n | \n {t(\"Data Source\")}: <a href={version.versionDoc}>{version.versionDoc}</a> \n </span>\n {gitHubEdit && <span className=\"small\"> | <a href={gitHubEdit} target=\"_blank\" rel=\"noopener noreferrer\"> Edit on <img src=\"https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png\" alt=\"github\" height=\"25px\"/> Github</a> or <a href={gitHubIssues} target=\"_blank\" rel=\"noopener noreferrer\">Create a GitHub Issue</a></span>}\n </Alert>\n )\n }\n else{\n return null\n }\n }\n else {\n return null\n }\n }\n return (\n displayAlert()\n );\n }\n}\nVersionChain.propTypes = {\n /**\n * transcription resource id of focused passage,\n * transcription id is required, because a specific text passage is being complicated\n */\n transcriptionid: PropTypes.string.isRequired,\n /**\n * handleFocusChange; a function carrying desired behavior\n * when you user selects non-current version\n */\n handleFocusChange: PropTypes.func.isRequired\n}\n\nexport default withTranslation()(VersionChain);\n","import React from 'react';\nimport Container from 'react-bootstrap/Container';\nimport Row from 'react-bootstrap/Row';\nimport Col from 'react-bootstrap/Col';\nimport {Link} from 'react-router-dom';\nimport {runQuery} from './utils'\nimport {basicStructureAllItemsInfoQuery, partsInfoQuery,workGroupExpressionQuery} from './Queries'\nimport TextOutlineWrapper from \"./TextOutlineWrapper\"\n//import Lbp from \"lbp.js/lib\"\n\n\nclass Collection extends React.Component {\n constructor(props){\n super(props)\n this.retrieveCollectionInfo = this.retrieveCollectionInfo.bind(this)\n this.makeRequests = this.makeRequests.bind(this)\n this.handleFilter = this.handleFilter.bind(this)\n this.filter = React.createRef();\n this.mount = false\n this.state = {\n title: \"\",\n description: \"\",\n items: {},\n parts: {},\n filter: \"\"\n }\n\n }\n handleFilter(e){\n const item = e.target.value\n this.setState({filter: item})\n\n }\n arrangeParts(partsPromise){\n const _this = this\n partsPromise.then((d) => {\n const bindings = d.data.results.bindings\n const title = bindings[0].title.value\n const description = bindings[0].description.value\n let partsObject = {}\n bindings.forEach((b) => {\n const pId = b.part.value\n partsObject[pId] = {\n id: b.part.value,\n title: b.partTitle.value,\n type: b.partType.value,\n questionTitle: b.partQuestionTitle ? b.partQuestionTitle.value : null,\n level: b.partLevel ? b.partLevel.value : \"unknown\",\n }\n });\n if (this.mount){\n _this.setState(\n {\n title,\n description,\n parts: partsObject\n }\n )\n }\n });\n }\n arrangeItems(itemsPromise){\n const _this = this\n itemsPromise.then((d) => {\n const bindings = d.data.results.bindings\n let itemsObject = {}\n bindings.forEach((b) => {\n const itemId = b.item.value\n itemsObject[itemId] = {\n title: b.itemTitle.value,\n id: b.item.value,\n type: b.itemType.value,\n questionTitle: b.itemQuestionTitle ? b.itemQuestionTitle.value : null,\n author: b.itemAuthor ? b.itemAuthor.value : null,\n authorTitle: b.itemAuthorTitle ? b.itemAuthorTitle.value : null,\n next: b.next ? b.next.value : null,\n previous: b.previous ? b.previous.value : null,\n cm: b.cm ? b.cm.value : null,\n cmTitle: b.cmTitle ? b.cmTitle.value : null,\n ct: b.ct ? b.ct.value : null,\n topLevel: b.topLevel ? b.topLevel.value : null,\n doc: b.doc ? b.doc.value : null\n }\n });\n if (this.mount){\n _this.setState(\n {\n items: itemsObject\n }\n )\n }\n })\n .catch((err) => {\n console.log(err)\n })\n }\n\n retrieveWorkGroupInfo(resourceid){\n const expressionsInfo = runQuery(workGroupExpressionQuery(resourceid))\n const partsInfo = runQuery(partsInfoQuery(resourceid))\n this.arrangeParts(partsInfo)\n this.arrangeItems(expressionsInfo)\n }\n retrieveCollectionInfo(resourceid, structureType, topLevel){\n const collectionInfo = runQuery(basicStructureAllItemsInfoQuery(topLevel))\n const partsInfo = runQuery(partsInfoQuery(resourceid))\n\n //add parts to state\n this.arrangeParts(partsInfo)\n /// add items to state\n this.arrangeItems(collectionInfo)\n }\n makeRequests(newResourceId, structureType, topLevel, type){\n\n //\n // // get all expressions for this workGroup\n if (type === \"http://scta.info/resource/workGroup\"){\n this.retrieveWorkGroupInfo(newResourceId, structureType, topLevel)\n //this.setState({itemFocus: \"\"})\n }\n // get all items for this collection\n else if (structureType === \"http://scta.info/resource/structureCollection\"){\n this.retrieveCollectionInfo(newResourceId, structureType, topLevel)\n //this.setState({itemFocus: \"\"})\n }\n\n }\n \n componentDidMount(){\n this.mount = true\n this.setState({resourceid: this.props.resourceid})\n this.makeRequests(this.props.resourceid, this.props.structureType, this.props.topLevel, this.props.type)\n\n }\n\n // UNSAFE_componentWillReceiveProps(nextProps) {\n\n // // conditional prevents new information requestion if resource id has not changed\n // if (nextProps.resourceid !== this.props.resourceid){\n // this.setState({resourceid: nextProps.resourceid, filter: \"\"})\n // // this conditional resets form value if ref is present\n // // if (this.filter){\n // // this.filter.current.value = \"\"\n // // }\n // this.makeRequests(nextProps.resourceid, nextProps.structureType, nextProps.topLevel, nextProps.type)\n // }\n // }\n componentDidUpdate(prevProps) {\n\n // conditional prevents new information requestion if resource id has not changed\n if (this.props.resourceid !== prevProps.resourceid){\n this.setState({resourceid: this.props.resourceid, filter: \"\"})\n // this conditional resets form value if ref is present\n // if (this.filter){\n // this.filter.current.value = \"\"\n // }\n this.makeRequests(this.props.resourceid, this.props.structureType, this.props.topLevel, this.props.type)\n }\n }\n componentWillUnmount(){\n this.mount = false\n }\n render(){\n return (\n <Container className=\"collectionBody\">\n {this.state.title && <h1>{this.state.title}</h1>}\n {this.state.title && <p style={{\"textAlign\": \"center\"}}>{this.state.description}</p>}\n {\n //<p style={{\"textAlign\": \"center\"}}><Link to={\"/text?resourceid=http://scta.info/resource/scta\"}>Back to Top Level</Link></p>\n }\n\n <Row>\n <Col xs={9}>\n <Container>\n <TextOutlineWrapper\n focusResourceid={this.state.resourceid}\n resourceid={this.state.resourceid}\n title={this.state.title}\n hidden={false}\n mtFocus={\"\"}\n collectionLink={true}\n showAuthor={true}\n showParentLink={true}\n showChildren={true}\n showFirstLevelChildren={true}\n />\n </Container>\n </Col>\n </Row>\n {this.state.resourceid === \"http://scta.info/resource/scta\" &&\n <div>\n <h1>Special Collections</h1>\n <p><Link to={\"/res?resourceid=http://scta.info/resource/et-000004\"}>Magnetica</Link>: A collection of texts on \"Magnets\"</p>\n </div>}\n </Container>\n\n );\n }\n}\n\nexport default Collection;\n","import React from 'react';\nimport Container from 'react-bootstrap/Container';\nimport PropTypes from 'prop-types';\nimport Axios from 'axios'\n\nimport ImageLogo from './ImageLogo';\nimport ImageTextWrapper from './ImageTextWrapper';\n\nimport {runQuery} from './utils'\nimport {getSurfaceInfo, getBlockLines} from './Queries'\n\nclass Surface3 extends React.Component {\n constructor(props){\n super(props)\n this.mounted = \"\"\n this.handleNext = this.handleNext.bind(this)\n this.handlePrevious = this.handlePrevious.bind(this)\n this.state = {\n region: \"full\",\n surfaces: [\n ]\n }\n\n }\n handleNext(){\n //this.retrieveSurfaceInfo(this.state.next)\n this.props.handleSurfaceFocusChange(this.state.next)\n }\n handlePrevious(){\n //this.retrieveSurfaceInfo(this.state.previous)\n this.props.handleSurfaceFocusChange(this.state.previous)\n\n }\n retrieveSurfaceInfo(manifestationid){\n // manifest id should be retrieved from query\n // this is a temporary measure until db is corrected and query is posible\n const blockLineInfo = runQuery(getBlockLines(manifestationid))\n blockLineInfo.then((d1) => {\n d1.data.results.bindings.forEach((z) => {\n const surfaceid = z.surface.value\n const firstLine = z.first.value\n const lastLine = z.last.value\n const order = z.order.value\n //const manifest = \"http://scta.info/iiif/\" + this.props.topLevel.split(\"/resource/\")[1] + \"/\" + surfaceid.split(\"/resource/\")[1].split(\"/\")[0] + \"/\" + \"manifest\";\n const surfaceInfo = runQuery(getSurfaceInfo(surfaceid))\n surfaceInfo.then((d) => {\n const b = d.data.results.bindings[0]\n // only preceed if sparql query returns results\n if (b){\n //second nested async call for annotation list\n const alUrl = \"https://exist.scta.info/exist/apps/scta-app/folio-annotaiton-list-from-simpleXmlCoordinates.xq?surfaceid=\" + surfaceid.split(\"/resource/\")[1] + \"&coords=loose\"\n Axios.get(alUrl).then((d2) => {\n //const resources = d2.data.resources\n if (this.mounted){\n this.setState((prevState) => {\n const newSurface = {\n currentSurfaceId: surfaceid,\n surfaceTitle: b.surfaceTitle ? b.surfaceTitle.value : \"\",\n //manifest: manifest,\n canvas: b.canvas.value,\n imageurl: b.imageurl.value,\n next: b.next_surface ? b.next_surface.value : \"\",\n previous: b.previous_surface ? b.previous_surface.value : \"\",\n annotations: d2.data ? d2.data.resources : \"\",\n surfaceid: surfaceid,\n firstLine: firstLine,\n lastLine: lastLine,\n order: order\n\n }\n return {\n surfaces: [\n ...prevState.surfaces,\n newSurface\n ]\n }\n })\n }\n }).catch((error) => {\n if (this.mounted){\n this.setState((prevState) => {\n const newSurface = {\n currentSurfaceId: surfaceid,\n surfaceTitle: b.surfaceTitle.value,\n //manifest: manifest,\n canvas: b.canvas.value,\n imageurl: b.imageurl.value,\n next: b.next_surface ? b.next_surface.value : \"\",\n previous: b.previous_surface ? b.previous_surface.value : \"\",\n annotations: \"\",\n surfaceid: surfaceid,\n firstLine: firstLine,\n lastLine: lastLine,\n order: order\n\n }\n return {\n surfaces: [\n ...prevState.surfaces,\n newSurface\n ]\n }\n })\n }\n })\n }\n })\n })\n })\n}\ncomponentDidMount(){\n this.mounted = true\n if (this.props.manifestationid){\n this.setState((prevState) => {\n return {\n surfaces: []\n }\n },\n this.retrieveSurfaceInfo(this.props.manifestationid)\n )\n }\n }\n componentDidUpdate(prevProps){\n if (this.props.manifestationid !== prevProps.manifestationid){\n this.setState((prevState) => {\n return {\n surfaces: []\n }\n\n },\n this.retrieveSurfaceInfo(this.props.manifestationid))\n }\n }\n componentWillUnmount(){\n this.mounted = false\n }\n render() {\n const displayAllImages = () => {\n const sortedSurfaces = this.state.surfaces.sort((a, b) => {\n if (a.order > b.order) return 1;\n if (b.order > a.order) return -1;\n return 0;\n })\n const surfacesDisplay = sortedSurfaces.map((surface) => {\n return displayImages(surface)\n })\n return surfacesDisplay\n }\n const displayImages = (surface) => {\n // handle line display\n if (surface.annotations && this.props.annotationsDisplay === \"lines\"){\n const imageTextWrappers = surface.annotations.map((h, i) => {\n\n if (i + 1 >= surface.firstLine && i < surface.lastLine){\n const text = h.resource.chars;\n const canvas = h.on.split(\"#xywh=\")[0];\n const canvasShort = canvas.split(\"/\")[canvas.split(\"/\").length - 1];\n const coords = h.on.split(\"#xywh=\")[1];\n const imageUrl = h.imageUrl\n const label = h.label\n return (\n <ImageTextWrapper key={i}\n imageUrl={imageUrl}\n canvas={canvas}\n coords={coords}\n canvasShort={canvasShort}\n text={text}\n label={label}\n number={i + 1}\n targetLabel={this.props.targetLabel}\n surfaceButton={false}\n displayWidth={this.props.width}\n />\n )\n }\n else{\n return null\n }\n\n })\n return imageTextWrappers\n }\n // handle paragraph display\n else if (surface.annotations && this.props.annotationsDisplay === \"paragraph\"){\n // sometimes surface annotations is an array (tested with surface.annotations.length) sometimes (when there is only one result) it is an object\n const h = surface.annotations.length ? surface.annotations[surface.firstLine - 1] : surface.annotations;\n const fl = surface.annotations.length ? surface.annotations[surface.firstLine - 1] : surface.annotations;\n const flcanvas = fl ? fl.on.split(\"#xywh=\")[0] : \"\"\n const flcanvasShort = flcanvas.split(\"/\")[flcanvas.split(\"/\").length - 1];\n const flcoords = fl ? fl.on.split(\"#xywh=\")[1] : \"\"\n const y = flcoords.split(\",\")[1]\n const ll = surface.annotations.length ? surface.annotations[surface.lastLine - 1] : surface.annotations\n //const llcanvas = ll ? ll.on.split(\"#xywh=\")[0] : \"\"\n //const llcanvasShort = llcanvas.split(\"/\")[llcanvas.split(\"/\").length - 1];\n const llcoords = ll ? ll.on.split(\"#xywh=\")[1] : \"\"\n const lly = llcoords.split(\",\")[1]\n const llh = llcoords.split(\",\")[3]\n const llbottom = (parseInt(lly) + parseInt(llh)) - parseInt(y)\n //x widens the column by 10, but only if the x is greater than 10\n const x = parseInt(flcoords.split(\",\")[0]) > 10 ? parseInt(flcoords.split(\",\")[0]) - 10 : parseInt(flcoords.split(\",\")[0])\n const coords = x + \",\" + (parseInt(y)) + \",\" + (parseInt(flcoords.split(\",\")[2]) + 10) + \",\" + (parseInt(llbottom) + 50)\n const text = \"\"\n const imageUrl = h ? h.imageUrl : \"\"\n // check to see if an Image Url has been found.\n // if not show \"error message\"\n \n // get line coordinates for focused line\n let lineFocusCoords = \"\"\n if (this.props.lineFocusId){\n if (!surface.annotations.length){\n const h = surface.annotations;\n const i = 0;\n if (parseInt(this.props.lineFocusId.split(\"/\")[this.props.lineFocusId.split(\"/\").length - 1]) === (i + 1) ){\n lineFocusCoords = h.on.split(\"#xywh=\")[1];\n }\n }\n else{\n surface.annotations.forEach((h, i) => {\n if (parseInt(this.props.lineFocusId.split(\"/\")[this.props.lineFocusId.split(\"/\").length - 1]) === (i + 1) ){\n lineFocusCoords = h.on.split(\"#xywh=\")[1];\n }\n })\n }\n }\n if (imageUrl){\n return (\n <ImageTextWrapper\n key={surface.currentSurfaceId + \"-\" + surface.order}\n imageUrl={imageUrl}\n canvas={flcanvas}\n coords={coords}\n canvasShort={flcanvasShort}\n text={text}\n label={\"\"}\n targetLabel={\"\"}\n surfaceButton={false}\n displayWidth={this.props.width}\n lineFocusCoords={lineFocusCoords}\n />\n )\n }\n else {\n return (<p key={surface.currentSurfaceId + \"-\" + surface.order}>Sorry, this image is not yet ready</p>)\n }\n }\n else{\n return <img key={surface.currentSurfaceId + \"-\" + surface.order} alt=\"manuscript\" src={surface.imageurl + \"/full/\" + this.props.width + \",/0/default.jpg\"}/>\n }\n }\n return (\n <Container className={this.props.hidden ? \"hidden\" : \"showing\"}>\n {displayAllImages()}\n <ImageLogo imageurl={this.state.surfaces[0] ? this.state.surfaces[0].imageurl : \"\"}/>\n </Container>\n\n );\n }\n\n}\nSurface3.defaultProps = {\n width: \"501\"\n};\n\nSurface3.propTypes = {\n /**\n * a string indicating desired width in pixels for image display\n *\n * TODO: it might be desireable to change propType to an integer. I'm not sure.\n */\n width: PropTypes.string,\n /**\n * manifestation id\n */\n manifestationid: PropTypes.string,\n /**\n * indicates what kind of display is desired, \"lines, paragraph, surface/null\"\n */\n annotationsDisplay: PropTypes.string\n}\n\nexport default Surface3;\n","import React from 'react';\nimport Surface3 from './Surface3';\nimport PropTypes from 'prop-types';\nimport Form from 'react-bootstrap/Form';\nimport FormControl from 'react-bootstrap/FormControl';\nimport Button from 'react-bootstrap/Button';\nimport { FaList, FaFile, FaParagraph} from 'react-icons/fa';\n\nimport {runQuery} from './utils'\nimport {basicInfoQuery} from './Queries'\n\n//TODO: surface 3 needs to run in a wrapper which allows the user to choose between manifestations.\n//TODO: rdf dbase needs to include first line numbers for paragraphs that start in the middle of al line.\n\nclass Surface3Wrapper extends React.Component {\n constructor(props){\n super(props)\n this.handleChangeManifestation = this.handleChangeManifestation.bind(this)\n this.handleToggleTextLinesView = this.handleToggleTextLinesView.bind(this)\n this.handleSetCustomExpressionId = this.handleSetCustomExpressionId.bind(this)\n this.handleGetCustomManifestations = this.handleGetCustomManifestations.bind(this)\n this.handleChangeCustomManifestation = this.handleChangeCustomManifestation.bind(this)\n this.state = {\n focusedManifestation: \"\",\n annotationsDisplay: \"lines\",\n userAddedExpressionId: \"\",\n userAddedManifestations: [],\n focusedCustomManifestation: \"\"\n }\n }\n handleChangeCustomManifestation(value){\n this.setState({focusedCustomManifestation: value})\n }\n handleSetCustomExpressionId(value){\n this.setState({userAddedExpressionId: value})\n }\n handleGetCustomManifestations(e){\n e.preventDefault()\n const results = runQuery(basicInfoQuery(this.state.userAddedExpressionId))\n results.then((d) => {\n const manifestations = d.data.results.bindings.map((b) => {\n return {\n manifestation: b.manifestation.value,\n manifestationTitle: b.manifestationTitle.value,\n transcription: b.manifestationCTranscription ? b.manifestationCTranscription.value : \"\"\n }\n })\n this.setState({userAddedManifestations: manifestations, focusedCustomManifestation: d.data.results.bindings[0].cmanifestation.value})\n })\n \n\n }\n\n handleToggleTextLinesView(view){\n //optional prop to allow parent container to reset default view prop\n if (this.props.handleToggleTextLinesView){\n this.props.handleToggleTextLinesView(view)\n }\n else{\n this.setState((prevState) => {\n return {annotationsDisplay: view}\n })\n }\n }\n handleChangeManifestation(e){\n e.preventDefault()\n //optional prop to allow parent container to reset default view prop\n if (this.props.handleChangeManifestation){\n this.props.handleChangeManifestation(e.target.value)\n }\n else{\n this.setState({focusedManifestation: e.target.value})\n }\n }\n componentDidMount(){\n if (this.props.manifestations){\n this.setState((prevState) => {\n return {\n focusedManifestation: this.props.focusedManifestation,\n annotationsDisplay: this.props.annotationsDisplay,\n }\n })\n }\n }\n // UNSAFE_componentWillReceiveProps(nextProps){\n // if (nextProps.focusedManifestation !== this.props.focusedManifestation){\n // this.setState((prevState) => {\n // return {\n // focusedManifestation: nextProps.focusedManifestation,\n // }\n // })\n // }\n // if (nextProps.annotationsDisplay !== this.props.annotationsDisplay){\n // this.setState((prevState) => {\n // return {\n // annotationsDisplay: nextProps.annotationsDisplay,\n // }\n // })\n // }\n // }\n\n //TODO: is passing of props to state necessary? settingDerivedState is not ideal\n //thus there should be a good reason for setting a derived state. \n // the goal here is to allow the component to update the state, but for \n // the parent component to determine the default state. \n // unless there is another way to do this, this seems like a sufficient justification for the derived state.\n componentDidUpdate(prevProps){\n if (this.props.focusedManifestation !== prevProps.focusedManifestation){\n this.setState((prevState) => {\n return {\n focusedManifestation: this.props.focusedManifestation,\n }\n })\n }\n if (this.props.annotationsDisplay !== prevProps.annotationsDisplay){\n this.setState((prevState) => {\n return {\n annotationsDisplay: this.props.annotationsDisplay,\n }\n })\n }\n }\n render() {\n const displayManifestationsList = () => {\n const list = this.props.manifestations.map((m) => {\n return <option key={\"title-\" + m.manifestation} value={m.manifestation}>{m.manifestationTitle}</option>\n })\n return list\n }\n const displayManifestation = () => {\n const manifestation = this.props.manifestations.map((m) => {\n if (m.manifestation === this.state.focusedManifestation){\n return <Surface3 key={\"surface-\" + m.manifestation} \n manifestationid={m.manifestation} \n annotationsDisplay={this.state.annotationsDisplay} \n width={this.props.width}\n lineFocusId={this.props.lineFocusId}/>\n }\n else{\n return null\n }\n })\n return manifestation\n\n }\n\n return (\n <div className={this.props.hidden ? \"hidden\" : \"showing\"}>\n {!this.props.hideSelectionList &&\n <div className=\"manifestationsList\">\n <Form.Control size=\"sm\" as=\"select\" onChange={this.handleChangeManifestation} value={this.state.focusedManifestation}>\n {displayManifestationsList()}\n </Form.Control>\n </div>\n }\n <div className=\"surfaceWrapper\">\n {!this.props.hideDisplayChoice && this.state.focusedManifestation &&\n <div className=\"image-display-choice\">\n <p><span title=\"Text Line View\" onClick={() => {this.handleToggleTextLinesView(\"lines\")}}><FaList/></span></p>\n <p><span title=\"Paragraph View\" onClick={() => {this.handleToggleTextLinesView(\"paragraph\")}}><FaParagraph/></span></p>\n <p><span title=\"Full Surface View\" onClick={() => {this.handleToggleTextLinesView(\"surface\")}}><FaFile/></span></p>\n </div>\n }\n <div className=\"imagesDisplay\">\n {displayManifestation()}\n </div>\n </div>\n \n {\n this.state.userAddedManifestations.length > 0 && \n <Surface3Wrapper \n manifestations={this.state.userAddedManifestations}\n focusedManifestation={this.state.focusedCustomManifestation}\n annotationsDisplay={this.state.annotationsDisplay}\n handleToggleTextLinesView={this.props.handleToggleTextLinesView}\n handleChangeManifestation={this.handleChangeCustomManifestation}\n width={this.props.width}\n lineFocusId={\"\"}\n hidden={false}\n isDependentSurface3={true}/>\n }\n {!this.props.isDependentSurface3 &&\n <div style={{\"borderBottom\": \"1px solid rgba(0, 0, 0, 0.1)\", \"borderTop\": \"1px solid rgba(0, 0, 0, 0.1)\", marginTop: \"5px\", padding: \"5px\"}} >\n <p style={{fontSize: \"12px\"}}>Create custom user compare</p>\n <Form onSubmit={this.handleGetCustomManifestations} inline> \n <FormControl inline=\"true\" size=\"sm\" id=\"text\" type=\"text\" value={this.state.userAddedExpressionId} placeholder=\"expression id\" className=\"mr-sm-2\" onChange={(e) => {this.handleSetCustomExpressionId(e.target.value)}}/>\n <Button inline=\"true\" size=\"sm\" type=\"submit\" style={{margin: \"2px\"}}>Submit</Button>\n </Form>\n </div>\n }\n\n </div>\n );\n }\n}\n\nSurface3Wrapper.defaultProps = {\n manifestations: [],\n hidden: false,\n focusedManifestation: \"\",\n annotationsDisplay: \"paragraph\",\n width: \"500\"\n};\n\nSurface3Wrapper.propTypes = {\n /**\n * an array of manifestation ids\n */\n manifestations: PropTypes.array,\n /**\n * boolean indicating whether or not compoment should be mounted by still hidden\n */\n hidden: PropTypes.bool,\n /**\n * indicates on which manifestation component to default focus.\n * manifestation value MUST be included in manifestations array\n */\n focusedManifestation: PropTypes.string,\n /**\n * indicates what kind of display is desired, \"lines, paragraph, surface/null\"\n */\n\n annotationsDisplay: PropTypes.string,\n /**\n * optional prop to allow parent container to reset default view prop\n */\n handleToggleTextLinesView: PropTypes.func,\n /**\n * desired image width\n */\n width: PropTypes.string\n}\n\nexport default Surface3Wrapper;\n","import React from 'react';\nimport Surface2 from './Surface2'\nimport Surface3Wrapper from './Surface3Wrapper'\n//import {Link} from 'react-router-dom';\n\nimport {runQuery} from './utils'\nimport {getCodexInfo, getCodexInfoFromSurface, getCodexInfoFromCanvas, getCodexInfoFromManifest} from './Queries'\n\nclass Codex extends React.Component {\n constructor(props){\n super(props)\n this.retrieveCodexInfo = this.retrieveCodexInfo.bind(this)\n this.handleSurfaceFocusChange = this.handleSurfaceFocusChange.bind(this)\n this.handleToggleShowContents = this.handleToggleShowContents.bind(this)\n //this.handleSurface3Manifestations = this.handleSurface3Manifestations.bind(this)\n this.state = {\n items: {},\n title: \"\",\n focusedSurface: \"\",\n relatedCodices: [],\n showContents: true,\n surface3Manifestations: [],\n surface3FocusedManifestation: \"\"\n }\n }\n handleToggleShowContents(){\n this.setState((prevState) => {\n return{\n showContents: !prevState.showContents\n }\n })\n }\n \n handleSurfaceFocusChange(surfaceid){\n //this.setState({focusedSurface: surfaceid})\n this.props.handleSetFocus(surfaceid)\n }\n retrieveCodexInfo(id, type){\n let codexInfo = undefined\n if (type === \"surface\"){\n codexInfo = runQuery(getCodexInfoFromSurface(id))\n }\n else if (type === \"canvas\"){\n codexInfo = runQuery(getCodexInfoFromCanvas(id))\n }\n else if (type === \"manifest\"){\n codexInfo = runQuery(getCodexInfoFromManifest(id))\n }\n else{\n codexInfo = runQuery(getCodexInfo(id))\n }\n codexInfo.then((d) => {\n const data = d.data.results.bindings\n if (data.length > 0 && data[0].surface){\n const expressionIdMap = data.map((d) => {\n return d.expression ? d.expression.value : \"\"\n })\n var unique = expressionIdMap.filter((v, i, a) => a.indexOf(v) === i);\n let expressionList = {}\n unique.forEach((e) => {\n expressionList[e] = []\n })\n data.forEach((d) => {\n const info = {\n expression: d.expression.value,\n expressionTitle: d.item_expression_title.value,\n manifestation: d.manifestation.value,\n surface: d.surface.value,\n surfaceTitle: d.surface_title.value,\n questionTitle: d.item_expression_question_title ? d.item_expression_question_title.value : ''\n }\n expressionList[d.expression.value].push(info)\n })\n let focusedSurface = \"\"\n if (type === \"surface\"){\n focusedSurface = id\n }\n else if (type === \"canvas\"){\n focusedSurface = data[0].surfaceFocus.value\n }\n else{\n focusedSurface = data[0].surface.value\n }\n this.setState({items: expressionList, focusedSurface: focusedSurface})\n this.props.handleSurfaceFocusChange(focusedSurface)\n\n }\n })\n }\n componentDidMount(){\n this.retrieveCodexInfo(this.props.resourceid, this.props.codexResourceType)\n }\n componentDidUpdate(prevProps){\n if (this.props.resourceid && this.props.resourceid !== prevProps.resourceid){\n this.retrieveCodexInfo(this.props.resourceid, this.props.codexResourceType)\n }\n }\n\n render(){\n const displayImages = () => {\n if (this.state.surface3Manifestations.length > 0){\n return <Surface3Wrapper manifestations={this.state.surface3Manifestations} focusedManifestation={this.state.surface3FocusedManifestation} annotationsDisplay=\"paragraph\" width=\"501\" hidden={false}/>\n }\n else if (this.state.focusedSurface){\n return <Surface2 surfaceid={this.state.focusedSurface} lineFocusId=\"\" topLevel={this.props.topLevel} handleSurfaceFocusChange={this.handleSurfaceFocusChange} width={\"501\"} annotationsDisplay={false} hidden={false}/>\n }\n else{\n return null\n }\n\n }\n return (\n <div className=\"codexImage\">\n <h1>Codex Pages</h1>\n {displayImages()}\n </div>\n );\n }\n}\n\nexport default Codex;\n","import React, {useState, useEffect} from 'react';\nimport {runQuery} from './utils'\nimport {getExpressionTypeInfo} from '../queries/expressionTypeQuery'\nimport TextOutlineWrapper from \"./TextOutlineWrapper\"\nimport Container from 'react-bootstrap/Container';\n\nconst ExpressionType = (props) => {\n const [expressions, setExpressions] = useState([])\n useEffect(()=> {\n const results = runQuery(getExpressionTypeInfo(props.expressionTypeId))\n results.then((d) => {\n const bindings = d.data.results.bindings\n setExpressions(bindings)\n })\n }, [props.expressionTypeId])\n return (\n <Container className=\"collectionBody\">\n <h1>{props.expressionTypeId}</h1>\n {expressions.map((e)=> {\n return (\n <Container>\n <TextOutlineWrapper\n focusResourceid={e.expression.value}\n resourceid={e.expression.value}\n title={e.authorTitle ? e.authorTitle.value + \", \" + e.eLongTitle.value : e.eLongTitle.value }\n hidden={false}\n mtFocus={\"\"}\n collectionLink={true}\n showParentLink={true}/>\n </Container>\n )\n })}\n \n \n </Container>\n\n );\n}\n\nexport default ExpressionType;\n","export function getExpressionTypeInfo(id){\n const query = [\n \"SELECT ?expression ?eLongTitle ?expressionAuthor ?expressionAuthorTitle ?author ?authorTitle \",\n \"{\",\n \"{\",\n \"?expression <http://scta.info/property/expressionType> <\" + id + \"> .\",\n \"}\",\n \"UNION\",\n \"{\",\n \"?expression <http://scta.info/property/expressionType> ?expressionType .\",\n \"?expressionType <http://scta.info/property/isMemberOf> <\" + id + \"> .\",\n \"}\",\n \"?expression <http://scta.info/property/longTitle> ?eLongTitle .\",\n \"OPTIONAL {\",\n \"?expression <http://www.loc.gov/loc.terms/relators/AUT> ?author . \",\n \"?author <http://purl.org/dc/elements/1.1/title> ?authorTitle .\",\n \"}\",\n \"}\",\n \n\n \"ORDER BY ?authorTitle\"].join(' ')\n return query\n}\n","import React from 'react';\nimport Container from 'react-bootstrap/Container';\nimport Print from \"./Print\"\nimport PropTypes from 'prop-types';\n\nimport TextOutlineWrapper from \"./TextOutlineWrapper\"\nimport {Link} from 'react-router-dom';\n\nimport Window from \"./Window/Window2\"\nimport TextNavBar from \"./TextNavBar\"\nimport Text from \"./Text\"\nimport AuthorCollection from \"./AuthorCollection\"\nimport VersionChain from \"./VersionChain\"\nimport Collection from \"./Collection\"\nimport Codex from \"./Codex\"\nimport ExpressionType from \"./ExpressionType\"\nimport {runQuery, scrollToParagraph} from './utils'\n\nimport {basicInfoQuery, itemTranscriptionInfoQuery} from './Queries'\n\n\nclass TextWrapper extends React.Component {\n constructor(props){\n super(props)\n this.mount = false\n this.openWindow = this.openWindow.bind(this)\n this.setFocus = this.setFocus.bind(this)\n this.setFocus2 = this.setFocus2.bind(this)\n this.handleTabChange = this.handleTabChange.bind(this)\n this.handleClose = this.handleClose.bind(this)\n this.handleMinimize = this.handleMinimize.bind(this)\n this.handleMaximize = this.handleMaximize.bind(this)\n this.handleMiddlize = this.handleMiddlize.bind(this)\n this.handleSwitchWindow = this.handleSwitchWindow.bind(this)\n this.handleDuplicateWindow = this.handleDuplicateWindow.bind(this)\n this.handleSurfaceFocusChange = this.handleSurfaceFocusChange.bind(this)\n this.handleLineFocusChange = this.handleLineFocusChange.bind(this)\n this.handleToggleTextLinesView = this.handleToggleTextLinesView.bind(this)\n this.handleChangeManifestation = this.handleChangeManifestation.bind(this)\n this.handleTextPreviewFocusChange = this.handleTextPreviewFocusChange.bind(this)\n this.handleShowCollationOverlay = this.handleShowCollationOverlay.bind(this)\n this.handleAddCtRelatedExpressions = this.handleAddCtRelatedExpressions.bind(this)\n this.handleTogglePdfView = this.handleTogglePdfView.bind(this)\n this.handleUpdateSelectionRange = this.handleUpdateSelectionRange.bind(this)\n this.state = {\n ctRelatedExpressions: [],\n doc: \"\",\n focus: \"\",\n //focusRelatedExpressions: \"\",\n mtFocus: \"\",\n itemFocus: \"\",\n //collectionFocus: \"\",\n surfaceid: \"\",\n lineFocusId: \"\",\n textPreviewObjects: [],\n pdfView: false,\n selectionRange: undefined, // should be undefined or object\n windows: {\n window1: {\n windowId: \"window1\",\n open: true,\n windowLoad: \"citation\",\n position: \"sideWindow\",\n openWidthHeight: \"middle\",\n annotationsDisplay: \"paragraph\",\n defaultManifestationSlug: \"\"\n },\n window2: {\n windowId: \"window2\",\n open: false,\n windowLoad: \"citation\",\n position: \"bottomWindow\",\n openWidthHeight: \"middle\",\n annotationsDisplay: \"paragraph\",\n defaultManifestationSlug: \"\"\n }\n }\n }\n }\n\n handleTogglePdfView(){\n this.setState((prevState) => {\n return {\n pdfView: !prevState.pdfView\n }\n })\n }\n handleToggleTextLinesView(windowId, value){\n this.setState((prevState) => {\n const windows = prevState.windows\n windows[windowId].annotationsDisplay = value\n return {windows: windows}\n })\n }\n handleChangeManifestation(windowId, manifestationSlug){\n this.setState((prevState) => {\n const windows = prevState.windows\n windows[windowId].defaultManifestationSlug = manifestationSlug\n return {windows: windows}\n })\n }\n\n openWindow(id, windowLoad){\n if (!this.state.windows[id].open || this.state.windows[id].windowLoad !== windowLoad){\n this.setState((prevState) => {\n const windows = prevState.windows\n windows[id].open = true\n if (windowLoad){\n windows[id].windowLoad = windowLoad\n }\n return {\n windows: windows,\n }\n })\n }\n }\n handleClose(windowId){\n this.setState((prevState) => {\n const windows = prevState.windows\n windows[windowId].open = false\n return {windows: windows}\n\n })\n //scroll is supposed to re-align text scroll to focused paragraph after side bar close.\n //but it is not quite working\n scrollToParagraph(this.state.blockFocus, true)\n\n }\n \n handleMinimize(windowId){\n this.setState((prevState) => {\n const windows = prevState.windows\n windows[windowId].openWidthHeight = \"minimum\"\n return {windows: windows}\n\n })\n }\n handleMaximize(windowId){\n this.setState((prevState) => {\n const windows = prevState.windows\n windows[windowId].openWidthHeight = \"maximum\"\n return {windows: windows}\n\n })\n }\n handleMiddlize(windowId){\n this.setState((prevState) => {\n const windows = prevState.windows\n windows[windowId].openWidthHeight = \"middle\"\n return {windows: windows}\n\n })\n }\n \n /**\n * @description update state with selectionRangeObject\n * @param {object} selectionRange\n */\n handleUpdateSelectionRange(selectionRange){\n const s = selectionRange\n this.setState({selectionRange: s})\n }\n handleSwitchWindow(windowId, windowType){\n this.setState((prevState) => {\n const windows = prevState.windows\n if (windows[windowId].position === \"sideWindow\"){\n windows[windowId].position = \"bottomWindow\"\n // these conditionals control whether an already existing window will be closed when the other is moved\n // while commented they allow window1 and window2 to stack on top of each other\n\n // if (windowId === \"window1\"){\n // windows[\"window2\"].open = false\n // }\n // else if ((windowId === \"window2\")){\n // windows[\"window1\"].open = false\n // }\n }\n else if (windows[windowId].position === \"bottomWindow\"){\n windows[windowId].position = \"sideWindow\"\n // these conditionals control whether an already existing window will be closed when the other is moved\n // while commented they allow window1 and window2 to stack on top of each other\n\n // if (windowId === \"window1\"){\n // windows[\"window2\"].open = false\n // }\n // else if ((windowId === \"window2\")){\n // windows[\"window1\"].open = false\n // }\n }\n return {windows: windows}\n\n })\n }\n handleDuplicateWindow(windowId, windowType){\n this.setState((prevState) => {\n const windows = prevState.windows\n const altWindowId = windowId === \"window1\" ? \"window2\" : \"window1\"\n if (windows[windowId].position === \"sideWindow\"){\n windows[altWindowId].position = \"bottomWindow\"\n windows[altWindowId].open = true\n }\n else if (windows[windowId].position === \"bottomWindow\"){\n windows[altWindowId].position = \"sideWindow\"\n windows[altWindowId].open = true\n }\n return {windows: windows}\n })\n }\n handleTabChange(windowLoad, windowId){\n\n this.setState((prevState) => {\n const windows = prevState.windows\n windows[windowId].windowLoad = windowLoad\n return {windows: windows}\n\n })\n\n }\n\n handleSurfaceFocusChange(surfaceid){\n this.setState({surfaceid: surfaceid})\n }\n handleLineFocusChange(lineFocusId){\n this.setState({lineFocusId: lineFocusId})\n }\n /**\n * @description a function that handle events on main text and passes relevant information to TextPreviewWrapper Component\n * \n * @param {Object[]} targetObjects - an array of objects \n * @param {string} id - the target id\n * @param {string} range - the word range (e.g. 1-4), delimited by a dash, corresponding to the target\n */\n handleTextPreviewFocusChange(targetObjects){\n //check to see if textPreviewResourceId carries more than one id\n //if so split by white space \n this.setState({textPreviewObjects: targetObjects})\n }\n\n handleShowCollationOverlay(){\n console.log(\"firing\")\n this.openWindow(\"window2\", \"collationTable\")\n }\n \n handleAddCtRelatedExpressions(expressionId){\n this.handleShowCollationOverlay(true)\n this.setState((prevState) => {\n return{\n ctRelatedExpressions: [...prevState.ctRelatedExpressions, expressionId]\n }\n })\n\n }\n\n //TODO\n //These two function should be refactored into one\n setFocus(id){\n const range = id.split(\"@\")[1] ? \"@\" + id.split(\"@\")[1] : \"\"\n id = id.split(\"@\")[0];\n const fullid = id.includes(\"http\") ? id + this.state.mtFocus + range : \"http://scta.info/resource/\" + id + this.state.mtFocus + range;\n this.props.handleUpdateUrlResource(fullid)\n }\n setFocus2(newid){\n this.props.handleUpdateUrlResource(newid)\n }\n //END TODO\n\n\n retrieveFocusInfo(id){\n const fullid = id.includes(\"http\") ? id : \"http://scta.info/resource/\" + id\n // get info\n const info = runQuery(basicInfoQuery(fullid))\n //arrange info and set it to state\n\n this.arrangeFocusInfo(info, fullid)\n // get related expressions info\n // removed these second calls and embed the query in arrange focus info to keep information in sync.\n // TODO remove below three lines\n //const relatedExpressions = runQuery(getRelatedExpressions(fullid))\n //arrange info and set it to state\n //this.arrangeFocusRelatedInfo(relatedExpressions)\n\n //scrollToParagraph(shortid, true)\n\n }\n\n arrangeFocusInfo(info, resourceid){\n info.then((d) => {\n const bindings = d.data.results.bindings[0]\n const manifestations = d.data.results.bindings.map((b) => {\n return {\n manifestation: b.manifestation.value,\n manifestationTitle: b.manifestationTitle.value,\n transcription: b.manifestationCTranscription ? b.manifestationCTranscription.value : \"\",\n transcriptionDoc: b.manifestationCTranscriptionDoc?.value\n }\n })\n\n if (this.mount && bindings){\n this.setState({\n focus: {\n resourceid: resourceid,\n title: bindings.title.value,\n longTitle: bindings.longTitle ? bindings.longTitle.value : \"\",\n author: bindings.author ? bindings.author.value : \"\",\n authorTitle: bindings.authorTitle ? bindings.authorTitle.value : \"\",\n structureType: bindings.structureType.value,\n inbox: bindings.inbox.value,\n next: bindings.next ? bindings.next.value : \"\",\n previous: bindings.previous ? bindings.previous.value : \"\",\n parent: bindings.parent ? bindings.parent.value : \"\",\n cdoc: bindings.cdoc ? bindings.cdoc.value : \"\",\n cxml: bindings.cxml ? bindings.cxml.value : \"\",\n topLevel: bindings.topLevelExpression ? bindings.topLevelExpression.value : \"\",\n cmanifestation: bindings.cmanifestation.value,\n ctranscription: bindings.ctranscription ? bindings.ctranscription.value : \"\",\n manifestations: manifestations\n }\n });\n }\n });\n }\n /**\n * sets focus\n * @param {string} id \n * @public\n */\n setItemFocus(id){\n const fullid = id.includes(\"http\") ? id : \"http://scta.info/resource/\" + id\n // get info\n const info = runQuery(itemTranscriptionInfoQuery(fullid))\n this.arrangeItemFocusInfo(info)\n }\n arrangeItemFocusInfo(itemFocusInfo){\n itemFocusInfo.then((d) => {\n const bindings = d.data.results.bindings[0]\n if (this.mount){\n this.setState({\n itemFocus: {\n title: bindings.title.value,\n manifestation: bindings.manifestation.value,\n expression: bindings.expression.value,\n doc: bindings.doc.value,\n xml: bindings.xml.value,\n next: bindings.next ? bindings.next.value : \"\",\n previous: bindings.previous ? bindings.previous.value : \"\",\n inbox: bindings.inbox.value,\n topLevel: bindings.topLevelExpression.value,\n transcriptionid: bindings.t.value\n }\n });\n }\n });\n }\n\n componentDidMount(){\n this.mount = true\n if (this.props.resourceType === \"person\" \n || this.props.resourceType === \"workGroup\" \n || this.props.resourceType === \"codex\"\n || this.props.resourceType === \"expressionType\"){\n }\n //transcriptionid should be required Prop\n //conditional here to reinfurce that rule\n else if (this.props.resourceType === \"collection\"){\n //TODO props.expressionid is doing something very similar to blockDivFocus\n this.retrieveFocusInfo(this.props.expressionid)\n //TODO: splitting strings for this information is not ideal.\n //info should be part of original query\n const mFocus = this.props.transcriptionid ? this.props.transcriptionid.split(\"/resource/\")[1].split(\"/\")[1] : \"\"\n const tFocus = this.props.transcriptionid ? this.props.transcriptionid.split(\"/resource/\")[1].split(\"/\")[2] : \"\"\n this.setState(\n {\n mtFocus: \"/\" + mFocus + \"/\" + tFocus,\n itemFocus: \"\"\n }\n )\n }\n else{\n if (this.props.itemTranscriptionId){\n this.setItemFocus(this.props.itemTranscriptionId)\n //TODO: splitting strings for this information is not ideal.\n //info should be part of original query\n const mFocus = this.props.itemTranscriptionId.split(\"/resource/\")[1].split(\"/\")[1]\n const tFocus = this.props.itemTranscriptionId.split(\"/resource/\")[1].split(\"/\")[2]\n const selectionRange = this.props.tokenRange ? {\n wordRange: this.props.tokenRange,\n selectedElementTargetId: this.props.expressionid && this.props.expressionid.split(\"/resource/\")[1],\n } : {}\n this.setState(\n {mtFocus: \"/\" + mFocus + \"/\" + tFocus, \n selectionRange: selectionRange\n })\n\n if (this.props.expressionid){\n this.retrieveFocusInfo(this.props.expressionid)\n }\n }\n }\n }\n\n componentDidUpdate(prevProps){\n //Keep testing, but it seems like this look up only needs to fire, when the transcription id prop changes\n // not when other props changes.\n \n if (this.props.resourceType === \"person\" \n || this.props.resourceType === \"workGroup\" \n || this.props.resourceType === \"codex\"\n || this.props.resourceType === \"expressionType\"\n ){\n if (this.props.resourceid !== prevProps.resourceid){\n this.setState({\n focus: \"\",\n mtFocus: \"\"\n });\n }\n }\n else if (this.props.resourceType === \"collection\"){\n \n if (this.props.resourceid !== prevProps.resourceid){\n this.retrieveFocusInfo(this.props.expressionid)\n //TODO: splitting strings for this information is not ideal.\n //info should be part of original query\n const mFocus = this.props.transcriptionid ? this.props.transcriptionid.split(\"/resource/\")[1].split(\"/\")[1] : \"\"\n const tFocus = this.props.transcriptionid ? this.props.transcriptionid.split(\"/resource/\")[1].split(\"/\")[2] : \"\"\n this.setState(\n {\n mtFocus: \"/\" + mFocus + \"/\" + tFocus,\n itemFocus: \"\"\n }\n )\n }\n }\n else{\n \n if (this.props.itemTranscriptionId !== prevProps.itemTranscriptionId){\n this.setItemFocus(this.props.itemTranscriptionId)\n const mFocus = this.props.itemTranscriptionId.split(\"/resource/\")[1].split(\"/\")[1]\n const tFocus = this.props.itemTranscriptionId.split(\"/resource/\")[1].split(\"/\")[2]\n //clear or set parts of state when new transcription file is loaded\n this.setState((prevState) => {\n const windows = prevState.windows\n windows[\"window1\"].defaultManifestationSlug = \"\"\n windows[\"window2\"].defaultManifestationSlug = \"\"\n const selectionRange = this.props.tokenRange ? {\n ...prevState.selectionRange, \n wordRange: this.props.tokenRange,\n selectedElementTargetId: this.props.expressionid && this.props.expressionid.split(\"/resource/\")[1],\n } : {}\n return {\n mtFocus: \"/\" + mFocus + \"/\" + tFocus,\n selectionRange: selectionRange,\n windows: windows,\n ctRelatedExpressions: []\n }\n })\n }\n //TODO: seems a little dangerous to have these two different setState/async calls \n //if one depends on the other, this is a good place for things to get out of sync\n if (this.props.expressionid !== prevProps.expressionid){\n if (!this.props.expressionid){\n this.setState(\n {\n focus: \"\",\n selectionRange: \"\",\n ctRelatedExpressions: []\n });\n }\n else {\n this.setState((prevState) => {\n const selectionRange = this.props.tokenRange ? {\n ...prevState.selectionRange, \n wordRange: this.props.tokenRange,\n selectedElementTargetId: this.props.expressionid && this.props.expressionid.split(\"/resource/\")[1],\n } : {}\n return({\n selectionRange: selectionRange,\n ctRelatedExpressions: []\n }) \n })\n this.retrieveFocusInfo(this.props.expressionid)\n }\n }\n if (this.props.tokenRange !== prevProps.tokenRange){\n this.setState((prevState)=>{\n const selectionRange = this.props.tokenRange ? {\n ...prevState.selectionRange, \n wordRange: this.props.tokenRange,\n selectedElementTargetId: this.props.expressionid && this.props.expressionid.split(\"/resource/\")[1],\n } : {}\n return({\n selectionRange: selectionRange,\n ctRelatedExpressions: []\n })\n })\n }\n }\n}\n componentWillUnmount(){\n this.mount = false\n }\n render(){\n const displayWindows = () => {\n const windows = Object.keys(this.state.windows).map((key) => {\n if (this.state.windows[key].open){\n return (<Window\n key={key}\n handleClose={this.handleClose}\n handleMinimize={this.handleMinimize}\n handleMaximize={this.handleMaximize}\n handleMiddlize={this.handleMiddlize}\n handleTabChange={this.handleTabChange}\n handleBlockFocusChange={this.setFocus}\n handleFocusChange={this.setFocus2}\n handleSurfaceFocusChange={this.handleSurfaceFocusChange}\n handleSwitchWindow={this.handleSwitchWindow}\n handleDuplicateWindow={this.handleDuplicateWindow}\n resourceid={this.state.focus ? this.state.focus.resourceid : this.props.resourceid}\n resourceType={this.props.resourceType ? this.props.resourceType : \"text\" }\n windowType={this.state.windows[key].position}\n windowId={this.state.windows[key].windowId}\n windowLoad={this.state.windows[key].windowLoad}\n openWidthHeight={this.state.windows[key].openWidthHeight}\n surfaceid={this.state.surfaceid}\n lineFocusId={this.state.lineFocusId}\n info={this.state.focus}\n itemFocus={this.state.itemFocus}\n altWindowState={this.state.windows[key].windowId === \"window1\" ? this.state.windows[\"window2\"].open : this.state.windows[\"window1\"].open}\n mtFocus={this.state.mtFocus}\n handleToggleTextLinesView={this.handleToggleTextLinesView}\n annotationsDisplay={this.state.windows[key].annotationsDisplay}\n handleChangeManifestation={this.handleChangeManifestation}\n defaultManifestationSlug={this.state.windows[key].defaultManifestationSlug}\n textPreviewObjects={this.state.textPreviewObjects}\n handleTextPreviewFocusChange={this.handleTextPreviewFocusChange}\n handleLineFocusChange={this.handleLineFocusChange}\n selectionRange={this.state.selectionRange}\n codexResourceType={this.props.codexResourceType}\n userId={this.props.userId}\n handleShowCollationOverlay={this.handleShowCollationOverlay}\n handleAddCtRelatedExpressions={this.handleAddCtRelatedExpressions}\n ctRelatedExpressions={this.state.ctRelatedExpressions}\n />\n )\n }\n else{\n return null\n }\n })\n return windows\n }\n \n const textClassNames = [\"lbp-text\"]\n this.state.windows.window1.open && this.state.windows.window1.openWidthHeight === \"middle\" ? textClassNames.push(\"skinnyText\") : textClassNames.push(\"fullText\");\n this.state.windows.window2.open && textClassNames.push(\"longText\");\n this.state.pdfView ? textClassNames.push(\"hidden\"): textClassNames.push(\"showing\");\n \n const displayMain = () => {\n if (this.props.resourceType === \"codex\"){\n return (\n <Codex \n resourceid={this.props.resourceid} \n codexResourceType={this.props.codexResourceType}\n handleSetFocus={this.setFocus}\n handleSurfaceFocusChange={this.handleSurfaceFocusChange}\n />\n )\n }\n else if (this.props.resourceType === \"person\"){\n return (<AuthorCollection resourceid={this.props.resourceid}/>)\n }\n else if (this.props.resourceType === \"workGroup\"){\n return ( <Collection resourceid={this.props.resourceid} \n type=\"http://scta.info/resource/workGroup\"\n />)\n }\n else if (this.props.resourceType === \"expressionType\"){\n return (\n <ExpressionType expressionTypeId={this.props.resourceid}/>\n )\n }\n else if (this.props.resourceType === \"collection\"){\n return (<div>\n <h1>{this.state.resourceTitle}</h1>\n <p style={{\"textAlign\": \"center\"}}>By <Link to={\"/text?resourceid=\" + this.state.focus.author}>{this.state.focus.authorTitle}</Link></p>\n <TextOutlineWrapper\n //focusResourceid={this.props.expressionid}\n //resourceid={this.props.expressionid}\n focusResourceid={this.props.resourceid}\n resourceid={this.props.resourceid}\n title={this.state.focus.title}\n hidden={false}\n //mtFocus={this.state.mtFocus}\n mtFocus={\"\"}\n collectionLink={true}\n showParentLink={true}\n />\n </div>) \n }\n else{\n return (\n this.state.itemFocus && \n <>\n <VersionChain transcriptionid={this.state.itemFocus.transcriptionid} handleFocusChange={this.setFocus2}/>\n <Text\n doc={this.state.itemFocus.doc}\n topLevel={this.state.itemFocus.topLevel}\n setFocus={this.setFocus}\n handleSurfaceFocusChange={this.handleSurfaceFocusChange}\n handleLineFocusChange={this.handleLineFocusChange}\n openWindow={this.openWindow}\n // NOTE: using props instead of state; seems better, but needs full documentation\n // NOTE: itemid is shortid of item: TODO: needs documentation; or better, refactoring!\n // TODO: when scrollTo id type is consistent, remove id checker in didMount and didUpdate of Text component\n scrollTo={this.props.expressionid && this.props.expressionid.split(\"/resource/\")[1]}\n handleTextPreviewFocusChange={this.handleTextPreviewFocusChange}\n handleUpdateSelectionRange={this.handleUpdateSelectionRange}\n selectionRange={this.state.selectionRange}\n />\n </>\n )\n\n }\n }\n\n return (\n <div>\n \n { this.state.pdfView && <Print url={this.state.itemFocus.doc}/>}\n \n <Container className={textClassNames.join(\" \")}>\n {displayMain()}\n </Container>\n\n {this.state.itemFocus && <TextNavBar\n next={this.state.itemFocus && this.state.itemFocus.next}\n previous={this.state.itemFocus && this.state.itemFocus.previous}\n topLevel={this.state.itemFocus && this.state.itemFocus.topLevel}\n handleClose={this.handleClose}\n pdfView={this.state.pdfView}\n handleTogglePdfView={this.handleTogglePdfView}\n mtFocus={this.state.mtFocus}\n />}\n <div>\n \n {!this.state.pdfView && displayWindows()}\n </div>\n </div>\n );\n }\n}\n\nTextWrapper.propTypes = {\n /**\n * Text Wrapper Component\n * \n * \n **/\n resourceid: PropTypes.string, // id of focused resource (this can be a resource at any structure level and FRBR level)\n expressionid: PropTypes.string, // corresponding expression id of the focused resource'\n transcriptionid: PropTypes.string, // corresponding transcription id of the focused resource (Note: only really seems necessary at collection level)\n \n //itemid: PropTypes.string, // corresponding item expression parent (or self) corresponding to focused resource; (currently requires shortId, but (TODO) this would be good to change; seems like it would be better to call this ItemExpressionId to match ItemTranscriptionId)\n itemTranscriptionId: PropTypes.string, //corresponding item transcription parent (or self corresponding to focused resource) \n tokenRange: PropTypes.object, // an object containing word token range (tokenRange.start.int tokenRange.end.int)\n handleUpdateUrlResource: PropTypes.func, // inherited function to send up resource focus change\n \n resourceType: PropTypes.string // currently only being used to switch between collection and non-collection levels.\n\n}\nexport default TextWrapper;\n","import React from 'react';\nimport Container from 'react-bootstrap/Container';\n\nimport '../styles/timelinelist.scss';\nimport $ from 'jquery';\n\nimport {convertXMLDoc, scrollToParagraph} from './utils'\n\n///TODO: Not this is very similar to the Text component\n//it would be nice if this could be refactored to be a more generic component that could handle both\n//however, the edition text will\n\n//TODO: article componet needs to retrieve and article type and then pick a different style sheet for different types.\n\nclass TextArticle extends React.Component {\n constructor(props){\n super(props)\n this.retrieveText = this.retrieveText.bind(this)\n\n\n }\n retrieveText(doc, scrollTo, articleType){\n const _this = this;\n if (doc){\n //construct file url request ot exist db to get a cors enabled copy of the text (github does not serve files with cors enabled)\n const doc = this.props.doc;\n \n\n\n let xmlurl = \"\"\n if (doc.includes(\"ipfs\") || (doc.includes(\"zotero\"))){\n xmlurl = doc\n }\n else{\n const docFragment = doc.split(\"/master/\")[1].split(\"/\")[1]\n xmlurl = \"https://exist.scta.info/exist/apps/scta-app/text/scta-articles/\" + docFragment\n }\n let xslurl = \"\"\n if (articleType === \"http://scta.info/resource/timeline\"){\n xslurl = \"/xslt/articles/timeline.xsl\"\n }\n else if (articleType === \"http://scta.info/resource/bibliography\"){\n xslurl = \"/xslt/articles/bibliography.xsl\"\n }\n else if (articleType === \"http://scta.info/resource/biography\"){\n xslurl = \"/xslt/articles/biography.xsl\"\n }\n else{\n xslurl = \"/xslt/articles/standard.xsl\"\n }\n\n //conversion done in promise in utils.js file\n const resultDocument = convertXMLDoc(xmlurl, xslurl)\n resultDocument.then((data) => {\n //appendage to file\n //and event binding\n //happens inside promise call back\n document.getElementById(\"text\").innerHTML = \"\";\n document.getElementById(\"text\").appendChild(data);\n\n // $('.paragraphnumber').click(function(e) {\n // e.preventDefault();\n // const id = $(this).parent(\"p\").attr('id')\n // _this.props.setFocus(id)\n // _this.props.openWindow(\"window1\")\n // });\n // if (scrollTo){\n // scrollToParagraph(scrollTo, true)\n // }\n //\n // $('.js-show-folio-image').click(function(e) {\n // e.preventDefault();\n // const surfaceid = $(this).attr('data-surfaceid');\n // const paragraphid = $(this).closest('.plaoulparagraph').attr(\"id\");\n //\n // _this.props.setFocus(paragraphid)\n // _this.props.handleSurfaceFocusChange(\"http://scta.info/resource/\" + surfaceid)\n // _this.props.openWindow(\"window2\", \"surface2\")\n // });\n //\n // $('.lbp-line-number').click(function(e) {\n // e.preventDefault();\n // const surfaceid = $(this).attr('data-surfaceid');\n // const ln = $(this).attr('data-ln');\n // const paragraphid = $(this).closest('.plaoulparagraph').attr(\"id\");\n //\n // _this.props.setFocus(paragraphid)\n // _this.props.handleSurfaceFocusChange(\"http://scta.info/resource/\" + surfaceid)\n // _this.props.handleLineFocusChange(\"http://scta.info/resource/\" + surfaceid + \"/\" + ln)\n // _this.props.openWindow(\"window2\", \"surface2\")\n // });\n\n $('.appnote, .footnote').click(function(e) {\n e.preventDefault();\n\n });\n $('.appnote, .footnote').parent().click(function(e) {\n e.preventDefault();\n const link = $(this).children('.appnote, .footnote')\n const target = $(link).attr('href')\n const text = $(target).html()\n const targetText = $(this).children(\".note-display\").attr('data-target-id')\n /// toggles highlight for select text segemnts\n if (targetText){\n $(\"#\" + targetText).toggleClass(\"highlight\")\n $(\"span[data-corresp=\" + targetText + \"]\").toggleClass(\"highlight\")\n }\n\n //adds footnote text to noteDisplay Div and toggles hidden class\n const noteDisplay = $(this).children(\".note-display\")\n noteDisplay.toggleClass(\"hidden\")\n noteDisplay.html(text)\n });\n $(document).on(\"click\", '.js-show-reference-paragraph', function(e){\n e.preventDefault();\n const target = $(this).attr('data-url')\n const targetParagraph = $(this).attr('data-target-paragraph')\n //setting paragraph focus for paragraph containing target footnote\n _this.props.setFocus(targetParagraph)\n // set the desired text preview focus to the target of the reference\n _this.props.handleTextPreviewFocusChange(target)\n //opening bottomw window 2 to textPreview\n _this.props.openWindow(\"window2\", \"textPreview\")\n })\n })\n .catch((e) => {\n console.log(\"something went wrong\", e)\n document.getElementById(\"text\").innerHTML = \"\";\n document.getElementById(\"text\").innerHTML = \"<p>Apologies, the document is not able to be loaded at this time</p>\";\n })\n }\n }\n\n componentDidUpdate(prevProps, prevState){\n\n //check to see if doc has changed\n if (prevProps.doc !== this.props.doc){\n this.retrieveText(this.props.doc, this.props.scrollTo, this.props.articleType)\n }\n // if doc has already been appended, still scroll to target block\n else{\n if (this.props.scrollTo !== prevProps.scrollTo){\n scrollToParagraph(this.props.scrollTo, true)\n }\n }\n\n\n //this.retrieveText(this.props.doc, this.props.topLevel, this.props.scrollTo)\n }\n\n componentDidMount(){\n this.retrieveText(this.props.doc, this.props.scrollTo, this.props.articleType)\n }\n\n render(){\n\n return (\n <Container>\n <div id=\"text\"></div>\n </Container>\n );\n }\n}\n\nexport default TextArticle;\n","import React, {useState, useEffect} from 'react';\nimport Container from 'react-bootstrap/Container';\nimport Form from 'react-bootstrap/Form';\nimport {Link} from 'react-router-dom';\nimport Spinner from './Spinner';\nimport {runQuery} from './utils'\nimport {getResources} from '../queries/resourceTypeQuery'\n\n\nconst ResourceTypeList = (props) => {\n const [resources, setResources] = useState([])\n const [filter, setFilter] = useState(\"\")\n\n useEffect(() => {\n const results = runQuery(getResources(props.resourceTypeId))\n setResources(\"fetching\")\n results.then((d) => {\n setResources(d.data.results.bindings)\n })\n }, [props.resourceTypeId])\n return (\n <Container className=\"collectionBody\">\n <h1>{props.resourceTypeId}</h1>\n <Form.Control as=\"input\" type=\"text\" placeholder=\"filter\" onChange={(e) => setFilter(e.target.value)} value={filter}/>\n {resources === \"fetching\" ? <Spinner/> :\n resources.map((r) => {\n //check against error resources with ids\n if (r.resource.value !== \"http://scta.info/resource/\"){\n if (r.resourceTitle.value.toLowerCase().includes(filter.toLowerCase())){\n return <p key={r.resource.value}><Link to={\"/text?resourceid=\" + r.resource.value}>{r.resourceTitle.value}</Link></p>\n }\n else{\n return null\n }\n }\n else{ \n return null\n }\n })\n }\n </Container>\n\n )\n}\n\nexport default ResourceTypeList;\n","export function getResources(resourceType){\n const query = [\n \"SELECT ?resource ?resourceTitle\",\n \"{\",\n \"?resource a <\" + resourceType + \"> .\",\n \"?resource <http://purl.org/dc/elements/1.1/title> ?resourceTitle\",\n \"}\",\n \"ORDER BY ?resourceTitle\"].join('')\n return query\n}\n","import React from 'react';\nimport Qs from \"query-string\";\nimport {Helmet} from \"react-helmet\";\nimport TextWrapper from \"./TextWrapper\"\nimport TextArticle from \"./TextArticle\"\nimport ResourceTypeList from './ResourceTypeList';\n\nimport {runQuery} from './utils'\nimport {getArticleTranscriptionDoc, getItemTranscriptionFromBlockDiv, getStructureType} from './Queries'\n\nclass TextSwitch extends React.Component {\n constructor(props){\n super(props)\n this.handleUpdateUrlResource = this.handleUpdateUrlResource.bind(this)\n this.state = {\n displayType: \"\",\n resourceid: \"\",\n itemTranscriptionId: \"\",\n blockDivFocus: \"\",\n resourceTitle: \"\",\n author: \"\",\n authorTitle: \"\",\n tokenRange: \"\",\n }\n }\n\n handleUpdateUrlResource(fullid){\n this.props.history.push({search: '?resourceid=' + fullid})\n }\n getInfo(resourceid, attemptNumber){\n let tokenRange;\n if (resourceid.split(\"@\")[1]){\n tokenRange = {start: parseInt(resourceid.split(\"@\")[1].split(\"-\")[0]), end: parseInt(resourceid.split(\"@\")[1].split(\"-\")[1])}\n }\n resourceid = resourceid.split(\"@\")[0]\n\n const structureTypePromise = runQuery(getStructureType(resourceid))\n\n structureTypePromise.then((t) => {\n // reduce results to bindings variable\n const bindings = t.data.results.bindings.length > 0 ? t.data.results.bindings[0] : \"\"\n // get specific results from bindings data\n const type = bindings.type ? bindings.type.value : null\n const structureType = bindings.structureType ? bindings.structureType.value : null\n //const level = bindings.level ? bindings.level.value : null\n const topLevel = bindings.topLevel ? bindings.topLevel.value : resourceid\n const itemParent = bindings.itemParent ? bindings.itemParent.value : null\n const resourceTitle = bindings.resourceTitle ? bindings.resourceTitle.value : \"\"\n const author = bindings.author ? bindings.author.value : \"\"\n const authorTitle = bindings.authorTitle ? bindings.authorTitle.value : \"\"\n const ctranscription = bindings.ctranscription ? bindings.ctranscription.value : \"\"\n\n //const itemTranscriptionId = t.data.results.bindings[0].ctranscription ? t.data.results.bindings[0].ctranscription.value : null\n if (resourceid === \"http://scta.info/resource/person\"){\n this.setState({displayType: \"personList\", resourceid: resourceid, structureType: \"\", topLevel: \"\", type: \"\", resourceTitle: \"\"})\n }\n else if (resourceid === \"http://scta.info/resource/codex\"){\n this.setState({displayType: \"codexList\", resourceid: resourceid, structureType: \"\", topLevel: \"\", type: \"\", resourceTitle: \"\"})\n }\n else if (resourceid === \"http://scta.info/resource/expressionType\"){\n this.setState({displayType: \"expressionTypeList\", resourceid: resourceid, structureType: \"\", topLevel: \"\", type: \"\", resourceTitle: \"\"})\n }\n else if (type === \"http://scta.info/resource/expressionType\"){\n this.setState({displayType: \"expressionType\", resourceid: resourceid, structureType: \"\", topLevel: \"\", type: \"\", resourceTitle: \"\"})\n }\n else if (type === \"http://scta.info/resource/person\"){\n this.setState({displayType: \"person\", resourceid: resourceid, structureType: \"\", topLevel: \"\", type: type, resourceTitle: resourceTitle})\n }\n else if (type === \"http://scta.info/resource/article\"){\n const structureTypePromise = runQuery(getArticleTranscriptionDoc(resourceid))\n structureTypePromise.then((t) => {\n this.setState(\n {displayType: \"article\",\n articleDoc: t.data.results.bindings[0] ? t.data.results.bindings[0].doc.value : \"\", // conditional checks in case the query comes up empty; if empty it sets transcription id to \"\"\n articleType: t.data.results.bindings[0] ? t.data.results.bindings[0].articleType.value : \"\", // conditional checks in case the query comes up empty; if empty it sets transcription id to \"\"\n resourceid: resourceid,\n structureType: \"\", topLevel: \"\",\n type: type,\n resourceTitle: resourceTitle}\n )\n })\n\n }\n else if (type === \"http://scta.info/resource/codex\"){\n this.setState({displayType: \"codex\", resourceid: resourceid, structureType: \"\", topLevel: \"\", type: type, resourceTitle: resourceTitle})\n }\n else if (type === \"http://scta.info/resource/surface\"){\n this.setState({displayType: \"surface\", resourceid: resourceid, structureType: \"\", topLevel: \"\", type: type, resourceTitle: resourceTitle})\n }\n else if (type === \"http://iiif.io/api/presentation/2#Manifest\"){\n this.setState({displayType: \"manifest\", resourceid: resourceid, structureType: \"\", topLevel: \"\", type: type, resourceTitle: resourceTitle})\n }\n else if (type === \"http://iiif.io/api/presentation/2#Canvas\"){\n this.setState({displayType: \"canvas\", resourceid: resourceid, structureType: \"\", topLevel: \"\", type: type, resourceTitle: resourceTitle})\n }\n else if (type === \"http://scta.info/resource/workGroup\"){\n this.setState({displayType: \"workGroup\", resourceid: resourceid, structureType: structureType, topLevel: topLevel, type: type, resourceTitle: resourceTitle})\n }\n else if (structureType === \"http://scta.info/resource/structureCollection\"){\n this.setState({\n displayType: \"collection\", \n transcriptionid: ctranscription,\n resourceid: resourceid, \n //TODO: this is a hacky way to get expression id; it should be retrievable from the query itself\n expressionid: \"http://scta.info/resource/\" + resourceid.split(\"/resource/\")[1].split(\"/\")[0],\n structureType: structureType, \n topLevel: topLevel, \n type: type, \n resourceTitle: resourceTitle, \n author: author, \n authorTitle: authorTitle\n }\n )\n }\n else if (structureType === \"http://scta.info/resource/structureItem\" ){\n // if (type === \"http://scta.info/resource/transcription\"){\n this.setState({\n itemTranscriptionId: ctranscription,\n displayType: \"item\", \n resourceid: resourceid, // focused resource introduced via url parameter\n //TODO: this is a hacky way to get expression id; it should be retrievable from the query itself\n expressionid: \"http://scta.info/resource/\" + resourceid.split(\"/resource/\")[1].split(\"/\")[0],\n transcriptionid: ctranscription,\n resourceTitle: resourceTitle, \n tokenRange: tokenRange,\n })\n }\n else if (structureType === \"http://scta.info/resource/structureElement\" || structureType === \"http://scta.info/resource/structureBlock\" || structureType === \"http://scta.info/resource/structureDivision\" ){\n const structureTypePromise = runQuery(getItemTranscriptionFromBlockDiv(resourceid))\n structureTypePromise.then((t) => {\n // if transcription\n if (type === \"http://scta.info/resource/transcription\"){\n this.setState({\n itemTranscriptionId: itemParent, \n resourceid: resourceid, // focused resource introduced via url parameter\n expressionid: t.data.results.bindings[0].blockDivExpression.value,\n transcriptionid: resourceid,\n displayType: \"item\", \n resourceTitle: resourceTitle, \n tokenRange: tokenRange\n })\n }\n // if expression\n else if (type === \"http://scta.info/resource/expression\"){\n if (t.data.results.bindings[0].ctranscription){\n this.setState({\n itemTranscriptionId: t.data.results.bindings[0].ctranscription.value, \n resourceid: resourceid, // focused resource introduced via url parameter\n expressionid: resourceid,\n transcriptionid: \"this would be the focus transcription id\",\n displayType: \"item\", \n resourceTitle: resourceTitle, \n tokenRange: tokenRange})\n }\n else{\n this.setState({displayType: \"notFound\"})\n }\n }\n // if manifestation\n else {\n this.setState(\n {itemTranscriptionId: t.data.results.bindings[0].ctranscription.value, \n resourceid: resourceid, // focused resource introduced via url parameter\n expressionid: t.data.results.bindings[0].blockDivExpression.value,\n transcriptionid: \"this would be the focus transcription id\",\n displayType: \"item\", \n resourceTitle: resourceTitle, \n tokenRange: tokenRange})\n }\n });\n }\n else{\n // the secondTryResourceID is meant to be a fallback when a transcription or manifestation fails, \n // the fall back is meant to revert on available expression id, which will then default to the available canonical manifestation\n // NOTE: i'm not sure this is the best way to do this, but it seems to work.\n const secondTryResourceId = resourceid.split(\"/resource/\")[0] + \"/resource/\" + resourceid.split(\"/resource/\")[1].split(\"/\")[0]\n // NOTE: if secondTryResourceId is different, make a second attempt\n if (resourceid !== secondTryResourceId){\n console.log(\"no record for \" + resourceid + \". Trying second attempt with \" + secondTryResourceId)\n // update with new resource;\n this.handleUpdateUrlResource(secondTryResourceId)\n }\n else{\n console.log(\"failed on second request\")\n this.setState({displayType: \"notFound\"})\n }\n }\n });\n }\n\n componentDidMount(){\n // conditional to only get info when props.location exists\n if (this.props.location){\n const newResourceId = Qs.parse(this.props.location.search, { ignoreQueryPrefix: true }).resourceid\n if (newResourceId.includes(\"https://scta.info/\")){\n this.handleUpdateUrlResource(newResourceId.replace(\"https://scta.info/\", \"http://scta.info/\"))\n }\n else{\n this.getInfo(newResourceId)\n }\n }\n }\n \n componentDidUpdate(prevProps) {\n const newResourceId = Qs.parse(this.props.location.search, { ignoreQueryPrefix: true }).resourceid\n const oldResourceId = Qs.parse(prevProps.location.search, { ignoreQueryPrefix: true }).resourceid\n if (newResourceId !== oldResourceId){\n if (newResourceId.includes(\"https://scta.info/\")){\n this.handleUpdateUrlResource(newResourceId.replace(\"https://scta.info/\", \"http://scta.info/\"))\n }\n else{\n this.getInfo(newResourceId)\n }\n }\n }\n\n\n\n render(){\n const display = () => {\n if (this.state.displayType === \"personList\"){\n return (<ResourceTypeList resourceTypeId=\"http://scta.info/resource/person\"/>)\n }\n else if (this.state.displayType === \"codexList\"){\n return (<ResourceTypeList resourceTypeId=\"http://scta.info/resource/codex\"/>)\n }\n else if (this.state.displayType === \"expressionTypeList\"){\n return (<ResourceTypeList resourceTypeId=\"http://scta.info/resource/expressionType\"/>)\n }\n else if (this.state.displayType === \"person\"){\n return (\n // <AuthorCollection resourceid={this.state.resourceid}/>\n <TextWrapper \n resourceid={this.state.resourceid}\n resourceType=\"person\"\n handleUpdateUrlResource={this.handleUpdateUrlResource}\n userId={this.props.userId}\n />\n )\n\n }\n else if (this.state.displayType === \"article\"){\n return (<TextArticle doc={this.state.articleDoc} articleType={this.state.articleType}/>)\n\n }\n else if (this.state.displayType === \"workGroup\"){\n //TODO: this conditional should be comined with the conditional below\n return (\n // <Collection resourceid={this.state.resourceid} structureType={this.state.structureType} topLevel={this.state.topLevel} type={this.state.type}/>\n <TextWrapper \n resourceid={this.state.resourceid}\n resourceType=\"workGroup\"\n handleUpdateUrlResource={this.handleUpdateUrlResource}\n userId={this.props.userId}\n />\n )\n }\n else if (this.state.displayType === \"collection\"){\n return (\n <TextWrapper \n resourceid={this.state.resourceid}\n expressionid={this.state.expressionid}\n transcriptionid={this.state.transcriptionid}\n resourceType=\"collection\"\n handleUpdateUrlResource={this.handleUpdateUrlResource}\n userId={this.props.userId}\n />\n )\n }\n else if (this.state.displayType === \"item\"){\n // check to see if a transcription for this text has been found\n if (this.state.itemTranscriptionId){\n return (\n <TextWrapper \n resourceid={this.state.resourceid}\n expressionid={this.state.expressionid}\n transcriptionid={this.state.transcriptionid}\n tokenRange={this.state.tokenRange}\n itemTranscriptionId={this.state.itemTranscriptionId}\n handleUpdateUrlResource={this.handleUpdateUrlResource}\n userId={this.props.userId}\n />\n )\n }\n // if no transcription resource id, exists return message\n else{\n return (<p>Apologies, no transcriptions of this text are currently available.</p>)\n\n\n }\n }\n else if (this.state.displayType === \"codex\" \n || this.state.displayType === \"surface\" \n || this.state.displayType === \"canvas\" \n || this.state.displayType === \"manifest\"){\n return (\n // <Codex codexid={this.state.resourceid}/>\n <TextWrapper \n resourceid={this.state.resourceid}\n resourceType=\"codex\"\n codexResourceType={this.state.displayType}\n handleUpdateUrlResource={this.handleUpdateUrlResource}\n userId={this.props.userId}\n />\n \n )\n }\n // else if (this.state.displayType === \"surface\"){\n // return (<Codex surfaceid={this.state.resourceid}/>)\n // }\n // else if (this.state.displayType === \"canvas\"){\n // return (<Codex canvasid={this.state.resourceid}/>)\n // }\n // else if (this.state.displayType === \"manifest\"){\n // return (<Codex manifestid={this.state.resourceid}/>)\n // }\n else if (this.state.displayType === \"expressionType\"){\n return (\n <TextWrapper \n resourceid={this.state.resourceid}\n resourceType=\"expressionType\"\n handleUpdateUrlResource={this.handleUpdateUrlResource}\n userId={this.props.userId}\n />\n )\n }\n else if (this.state.displayType === \"notFound\"){\n return (<p>Apologies, this resource could not be found</p>)\n }\n else{\n return null\n }\n }\n const dctype = () => {\n if (this.state.displayType === \"codex\"){\n return <meta name=\"BIB.type\" content=\"Manuscript\"/>\n }\n else{\n return <meta name=\"DC.type\" content=\"document\"/>\n }\n }\n return (\n <div>\n <Helmet>\n <title>{this.state.resourceTitle}</title>\n <link rel=\"schema.DC\" href=\"http://purl.org/dc/elements/1.1/\" ></link>\n <link rel=\"schema.DCTERMS\" href=\"http://purl.org/dc/terms/\"/>\n <link rel=\"schema.BIB\" href=\"http://purl.org/net/biblio#\"/>\n {dctype()}\n <meta name=\"DC.identifier\" content={this.state.resourceid}/>\n {//<meta name=\"DC.description\" content=\"test description\"/>\n }\n <meta name=\"DC.title\" content={this.state.resourceTitle}/>\n <meta name=\"DC.creator\" content={this.state.authorTitle}/>\n <meta name=\"DC.Language\" content=\"la\"/>\n <meta name=\"DC.Publisher\" content=\"SCTA\"/>\n \n </Helmet>\n {display()}\n </div>\n \n );\n }\n\n}\n\nexport default TextSwitch;\n","import React from 'react';\n\nfunction About() {\n return (\n <div className=\"About\">\n <h1>About</h1>\n\n </div>\n );\n}\n\nexport default About;\n","import React, {useState, useEffect} from 'react';\nimport { firebase, googleAuthProvider } from '../firebase/firebase';\nimport Button from 'react-bootstrap/Button';\n\nfunction LoginPage(props) {\n const [userDisplayName, setUserDisplayName] = useState(props.user && props.user.displayName);\n //const [user, setUser] = useState(props.user);\n const [userPicture, setPicture] = useState(props.user && props.user.photoURL);\n const startLogin = () => {\n return firebase.auth().signInWithPopup(googleAuthProvider).then((d) => {\n setUserDisplayName(d.additionalUserInfo.profile.name)\n setPicture(d.additionalUserInfo.profile.picture)\n })\n }\n const startLogout = () => {\n setUserDisplayName()\n setPicture()\n return firebase.auth().signOut()\n }\n useEffect(() => {\n setUserDisplayName(props.user && props.user.displayName)\n //setUser(props.user)\n setPicture(props.user && props.user.photoURL)\n }, [props.user])\n return (\n <div>\n {userDisplayName ? <span><span>{userDisplayName}</span> <img src={userPicture} alt=\"usrImage\" height=\"25px\"></img> <Button size=\"sm\" onClick={startLogout}>Logout</Button> </span> : <Button size=\"sm\" onClick={startLogin}>Login</Button>}\n </div>\n );\n}\n\nexport default LoginPage;","import React from 'react';\nimport {NavLink} from 'react-router-dom';\nimport Navbar from 'react-bootstrap/Navbar';\nimport Nav from 'react-bootstrap/Nav';\n\nimport LoginPage from './LoginPage.js'\nimport {resourceEndpoint} from './config';\nimport {useTranslation} from 'react-i18next'\n\nfunction NavBar(props) {\n const {t} = useTranslation();\n\n \n return (\n <Navbar bg=\"dark\" variant=\"light\" expand=\"lg\" fixed=\"top\" style={{borderBottom: \"1px solid #dee2e6\"}}>\n <Nav>\n <NavLink className=\"nav-link\" to=\"/\">{t(\"Title\")}</NavLink>\n </Nav>\n <Navbar.Toggle aria-controls=\"basic-navbar-nav\" />\n <Navbar.Collapse id=\"basic-navbar-nav\">\n <Nav>\n\n\n\n <NavLink className=\"nav-link\" to={\"/res?resourceid=\" + resourceEndpoint}>{t(\"Texts\")}</NavLink>\n <NavLink className=\"nav-link\" to={\"/res?resourceid=http://scta.info/resource/person\"}>{t(\"People\")}</NavLink>\n <NavLink className=\"nav-link\" to={\"/res?resourceid=http://scta.info/resource/codex\"}>{t(\"Codices\")}</NavLink>\n {// example drop down\n // <NavDropdown title=\"Dropdown\" id=\"basic-nav-dropdown\">\n // <NavDropdown.Item href=\"#action/3.1\">Action</NavDropdown.Item>\n // <NavDropdown.Item href=\"#action/3.2\">Another action</NavDropdown.Item>\n // <NavDropdown.Item href=\"#action/3.3\">Something</NavDropdown.Item>\n // <NavDropdown.Divider />\n // <NavDropdown.Item href=\"#action/3.4\">Separated link</NavDropdown.Item>\n // </NavDropdown>\n }\n {/* <NavLink className=\"nav-link\" to=\"/search\">{t(\"Search\")}</NavLink> */}\n </Nav>\n\n <Nav>\n {\n //<NavLink className=\"nav-link\" to=\"/about\">{t(\"About\")}</NavLink>\n }\n <a className=\"nav-link\" href=\"https://secure.qgiv.com/for/givescta\">{t(\"Donate\")}</a>\n </Nav>\n \n </Navbar.Collapse>\n <Navbar.Collapse id=\"basic-navbar-nav-right\" className=\"float-right\" style={{flexGrow: \"0\"}}>\n <Nav>\n <LoginPage user={props.user}/>\n </Nav>\n </Navbar.Collapse>\n \n\n \n \n </Navbar>\n\n );\n}\n\nexport default NavBar;\n","import React from 'react';\n\nimport Navbar from 'react-bootstrap/Navbar';\nimport Nav from 'react-bootstrap/Nav';\nimport {useTranslation} from 'react-i18next'\n\nimport MemberBanner from \"./MemberBanner\"\n\n\n\n\nfunction Footer() {\n const {t} = useTranslation();\n return (\n\n <Navbar bg=\"light\" variant=\"light\" expand=\"lg\" fixed=\"bottom\" style={{\"zIndex\": \"1\"}}>\n <Navbar.Toggle aria-controls=\"basic-navbar-nav\" />\n <Navbar.Collapse id=\"basic-navbar-nav\">\n\n <Nav style={{\"display\": \"flex\", \"justifyContent\": \"space-around\", \"width\": \"100%\"}}>\n <Nav.Link href=\"http://github.com/lombardpress/lombardpress-webjs\">Lbp-Web.js</Nav.Link>\n <Nav.Link href=\"http://lombardpress.org\">{t(\"A LombardPress Publication\")}</Nav.Link>\n <Nav.Link href=\"http://scta.info\">{t(\"Powered by SCTA Data\")} </Nav.Link>\n <Nav.Link href=\"http://jeffreycwitt.com\">{t(\"Designed by Jeffrey C Witt\")}</Nav.Link>\n <MemberBanner/>\n </Nav>\n \n </Navbar.Collapse>\n\n </Navbar>\n\n );\n}\n\nexport default Footer;\n","import React, {Suspense} from 'react';\nimport {BrowserRouter, Route, Switch} from 'react-router-dom';\nimport Home from \"./Home\"\nimport Search3 from \"./Search3\"\nimport TextSwitch from \"./TextSwitch\"\nimport About from \"./About\"\nimport NavBar from './NavBar';\nimport Spinner from './Spinner';\nimport Footer from './Footer';\n\n\nimport 'bootstrap/dist/css/bootstrap.css'\nimport '../styles/App.scss';\n//import '../styles/index.scss';\n\nconst AppRouter = (props) => {\n \n const uid = props.user ? props.user.uid : \"\"\n return (\n <Suspense fallback={<Spinner/>}>\n <BrowserRouter forceRefresh={false}>\n <div>\n <NavBar user={props.user}/>\n <Switch>\n <Route path=\"/\" exact={true} render={(props) => <Home {...props} userId={uid}/>}/>\n <Route path=\"/res\" exact={true} render={(props) => <TextSwitch {...props} userId={uid}/>}/>\n <Route path=\"/text\" exact={true} render={(props) => <TextSwitch {...props} userId={uid}/>}/>\n <Route path=\"/about\" exact={true} render={(props) => <About {...props} userId={uid}/>}/>\n <Route path=\"/search\" exact={true} render={(props) => <Search3 {...props} userId={uid}/>}/>\n <Route path=\"/osd\" exact={true} render={(props) => <TextSwitch {...props} userId={uid}/>}/>\n {\n //<Route path=\"/edit/:id\" exact={true} component={EditExpensePage}/>\n //<Route path=\"/help\" exact={true} component={HelpPage}/>\n // <Route component={NotFoundPage}/>\n }\n </Switch>\n <Footer/>\n </div>\n </BrowserRouter>\n </Suspense>\n)\n}\n\nexport default AppRouter\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.1/8 is considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\nexport function register(config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit https://bit.ly/CRA-PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl, config) {\n navigator.serviceWorker\n .register(swUrl)\n .then(registration => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch(error => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl, config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl)\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (\n response.status === 404 ||\n (contentType != null && contentType.indexOf('javascript') === -1)\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister();\n });\n }\n}\n","import i18n from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\nimport Backend from 'i18next-xhr-backend';\nimport LanguageDetector from 'i18next-browser-languagedetector';\n// not like to use this?\n// have a look at the Quick start guide\n// for passing in lng and translations on init\n\ni18n\n // load translation using xhr -> see /public/locales\n // learn more: https://github.com/i18next/i18next-xhr-backend\n .use(Backend)\n // detect user language\n // learn more: https://github.com/i18next/i18next-browser-languageDetector\n .use(LanguageDetector)\n // pass the i18n instance to react-i18next.\n .use(initReactI18next)\n // init i18next\n // for all options read: https://www.i18next.com/overview/configuration-options\n .init({\n fallbackLng: \"en\",\n debug: true,\n\n interpolation: {\n escapeValue: false, // not needed for react as it escapes by default\n }\n });\n\n\nexport default i18n;\n","import React from 'react';\nimport ReactDOM from 'react-dom';\n//import './styles/index.scss';\nimport AppRouter from './components/AppRouter';\nimport * as serviceWorker from './serviceWorker';\nimport './i18n';\nimport './firebase/firebase';\nimport { firebase } from './firebase/firebase';\n\n//ReactDOM.render(<AppRouter/>, document.getElementById('root'));\n\n\nlet hasRendered = false; \nconst renderApp = (user) => {\n if (!hasRendered){\n ReactDOM.render(\n //<React.StrictMode> // commented out because it is causing setStates to run twice; but this should be a problem if my setState functions were pure functions as they should be; but apparently mine are not: see https://github.com/facebook/react/issues/12856#issuecomment-390206425\n <AppRouter user={user}/>,\n //</React.StrictMode>\n document.getElementById('root')\n );\n //hasRendered = true\n }\n}\n\nfirebase.auth().onAuthStateChanged((user) => {\n if (user){\n console.log(\"log in\")\n renderApp(user)\n }\n else {\n console.log(\"log out\")\n const user = {uid: \"jeff\"}\n renderApp(user)\n }\n})\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"],"sourceRoot":""}