Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • lexworkers/lexp_www
1 result
Show changes
Commits on Source (2)
...@@ -9,7 +9,9 @@ build_image: ...@@ -9,7 +9,9 @@ build_image:
services: services:
- docker:18.09.7-dind - docker:18.09.7-dind
script: script:
- docker build -t $CI_REGISTRY_IMAGE . - if [ "$CI_COMMIT_REF_NAME" == "master" ]; then TAG="latest"; else TAG="develop"; fi
- docker build -t $CI_REGISTRY_IMAGE:$TAG .
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker push $CI_REGISTRY_IMAGE - docker push $CI_REGISTRY_IMAGE:$TAG
...@@ -296,7 +296,7 @@ DocumentRoot "/usr/local/apache2/htdocs" ...@@ -296,7 +296,7 @@ DocumentRoot "/usr/local/apache2/htdocs"
# is requested. # is requested.
# #
<IfModule dir_module> <IfModule dir_module>
DirectoryIndex index.html DirectoryIndex index.shtml
</IfModule> </IfModule>
# #
...@@ -550,5 +550,5 @@ SSLRandomSeed connect builtin ...@@ -550,5 +550,5 @@ SSLRandomSeed connect builtin
</IfModule> </IfModule>
ProxyPreserveHost On ProxyPreserveHost On
ProxyPass /lexp/ http://lexp_service:8080/lex/ ProxyPass /lexp/ http://lexpservice:80/lex/
ProxyPassReverse /lexp/ http://lexp_service:8080/lex/ ProxyPassReverse /lexp/ http://lexpservice:80/lex/
\ No newline at end of file
var GraphCreator=function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([function(t,e,n){"use strict";n.r(e),n.d(e,"apiConnector",function(){return i});const o=function(t){this.url="http://graph-slowosiec.clarin-pl.eu/wordnetloom/resources/",this.cache=new Map,this.possibleLangs=["pl","en"],this.lang=t||"pl"};o.prototype.setLang=function(t){const e=this;e.possibleLangs.indexOf(t)<0?console.error('Err, Language can only be chosen to be "pl" or "en"'):e.lang!==t&&(e.cache=new Map,e.lang=t)},o.prototype.entryPoints={settings:"settings/",graph:"graphs/synsets/{id}",synsetFromSense:"senses/{id}/synset",synsetFromLemma:"synsets/search?lemma={lemma}",relationTypes:"relation-types/{id}"},o.prototype._getJson=function(t,e){const n=this;if(!e)return n._getJsonPromise(t);n.cache.has(t)?e(n.cache.get(t)):d3.request(n.url+t).header("Content-Type","application/json").header("Accept-Language",n.lang).get((o,i)=>{i=JSON.parse(i.response),n.cache.set(t,i),e(i)})},o.prototype._getJsonPromise=function(t){const e=this;let n=new class{constructor(){this.promise=new Promise((t,e)=>{this.reject=e,this.resolve=t})}};return e.cache.has(t)?n.resolve(e.cache.get(t)):d3.request(e.url+t).header("Content-Type","application/json").header("Accept-Language",e.lang).get((o,i)=>{i=JSON.parse(i.response),e.cache.set(t,i),n.resolve(i)}),n.promise},o.prototype.getRelationTypes=function(t,e){return t=t||"",this._getJson(this.entryPoints.relationTypes.replace("{id}",t),e)},o.prototype.getSettings=function(t){return this._getJson(this.entryPoints.settings,t)},o.prototype.hasInCache=function(t){return this.cache.has(t)},o.prototype.getFromCache=function(t){return this.cache.has(t)?this.cache.get(t):null},o.prototype.getGraph=function(t,e){this._getJson(this.entryPoints.graph.replace("{id}",t),function(t){e(t||null)})},o.prototype.getSynsetFromSenseId=function(t,e){const n=function(t){e(t)};d3.json(this.url+this.entryPoints.synsetFromSense.replace("{id}",t),function(t,e){n(e||null)})},o.prototype.getSensesFromLemma=function(t,e){d3.json(this.url+this.entryPoints.synsetFromLemma.replace("{lemma}",t),function(t,n){e(n||null)})};const i=new o},function(t,e,n){"use strict";n.r(e),n.d(e,"Edge",function(){return i}),n.d(e,"EdgeContainer",function(){return r});var o=n(0);function i(t,e,n,o,i,r){this.connectionPoints=n,this.pathTextSrc=o[0],this.pathTextTarget=o[1],this.color=i||"#000",this.dotted=r||!1,this.source=t,this.target=e,this.id=this.getUniqueIdentifier(),this.initColor(),this.initDotted()}function r(){this.map=new Map,this[Symbol.iterator]=this.values}i.prototype.api=o.apiConnector,i.prototype.settings=o.apiConnector.getSettings(),i.prototype.initColor=function(){const t=this;if(!t.pathTextSrc&&!t.pathTextTarget)return;const e=e=>{const n=e.relations[t.pathTextSrc]||e.relations[t.pathTextTarget];try{t.color=n.color}catch(e){console.log(e),console.log(t)}};t.api.hasInCache(t.api.entryPoints.settings)?e(t.api.getFromCache(t.api.entryPoints.settings)):t.settings.then(t=>{e(t)})},i.prototype.initDotted=function(){const t=this;if(!t.pathTextSrc&&!t.pathTextTarget)return;const e=e=>{const n=e.relations[t.pathTextSrc]||e.relations[t.pathTextTarget];try{t.dotted=n.dotted}catch(e){console.log(e),console.log(t)}};t.api.hasInCache(t.api.entryPoints.settings)?e(t.api.getFromCache(t.api.entryPoints.settings)):t.settings.then(t=>{e(t)})},i.prototype.getUniqueIdentifier=function(){return this.source.id<this.target.id?this.source.id+"|"+this.target.id:this.target.id+"|"+this.source.id},r.prototype.add=function(t){t&&this.map.set(t.id,t)},r.prototype.values=function(){return this.map.values()},r.prototype.deleteNodeEdges=function(t){let e=this;e.map.forEach(n=>{n.source!==t&&n.target!==t||e.map.delete(n.id)})}},function(t,e,n){"use strict";n.r(e),n.d(e,"consts",function(){return h}),n.d(e,"GraphCreator",function(){return p});var o=n(0),r=n(1),s=n(3),a=n(4);const d=".inner-graph-container",l=".possible-senses",c=".graph-loader",h={partOfSpeech:{1:{color:"#FED25C"},2:{color:"#ABFFAE"},3:{color:"#ABFFAE"},4:{color:"#ACFFEA"}}},p=function(t,e,n,i){const s=this;s.width=n,s.height=i;let a='<div class="graph-loader" style="display: none"></div><div class="inner-graph-container"></div>';e&&(a+='<div id="toolbox"><form id="inspected-word-form"><button type="submit" value="Submit" id="inspected-word-btn">Szukaj</button><input type="text" id="inspected-word" placeholder="Słowo którego szukasz&hellip;"></form><ul class="possible-senses" style="display: none"></ul></div>'),a+='<button id="download-picture"></button>';const p=d3.select("#"+t).html(a);s.container=p;const u=p.select(d).append("svg").attr("width",n).attr("height",i).attr("id","graph-svg");s.hiddenList=d3.select(d).append("div").attr("pointer-events","none").attr("class","hidden-list tooltip").style("opacity",1).html("FIRST LINE <br> SECOND LINE").style("display","none"),s.sensesList=d3.select(l),s.tooltip=d3.select(d).append("div").attr("id","node-tooltip").style("opacity",0),s.loadingAnimationHandle=d3.select(c).style("display","none"),s.idct=0,s.nodes=new Map,s.edges=new r.EdgeContainer,s.transformed={x:0,y:0,k:1},s.state={selectedNode:null,selectedEdge:null,mouseDownNode:null,mouseDownLink:null,justDragged:!1,justScaleTransGraph:!1,lastKeyDown:-1,shiftNodeDrag:!1,selectedText:null,brushSelect:!1},s.api=o.apiConnector,s.settings=s.api.getSettings(),s.settings.then(t=>{h.partOfSpeech=t.partsOfSpeech}),s.relationTypes=s.api.getRelationTypes();const f=u.append("svg:defs");f.append("svg:marker").attr("id","end-arrow").attr("viewBox","0 -5 10 10").attr("refX","8").attr("markerWidth",10).attr("markerHeight",10).attr("orient","auto").append("svg:path").attr("d","M0,-5L10,0L0,5L5,0"),f.append("svg:marker").attr("id","start-arrow").attr("viewBox","0 0 10 10").attr("refX",2).attr("refY",5).attr("markerWidth",10).attr("markerHeight",10).attr("orient","auto").append("svg:path").attr("d","M0,5L10,0L5,5L10,10"),f.append("pattern").attr("id","flag-pl").html('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="10" id="Flag of Poland" viewBox="0 0 16 10"><rect width="16" height="4" fill="#fff"/><rect width="16" height="5" fill="#dc143c" y="4"/></svg>').attr("width",16).attr("height",16),f.append("pattern").attr("id","flag-en").attr("width",16).attr("height",16).html('<svg x="-1.5" viewBox="0 0 60 30" width="16" height="8">\n <clipPath id="t">\n <path d="M30,15 h30 v15 z v15 h-30 z h-30 v-15 z v-15 h30 z"/>\n </clipPath>\n <path d="M0,0 v30 h60 v-30 z" fill="#00247d"/>\n <path d="M0,0 L60,30 M60,0 L0,30" stroke="#fff" stroke-width="6"/>\n <path d="M0,0 L60,30 M60,0 L0,30" clip-path="url(#t)" stroke="#cf142b" stroke-width="4"/>\n <path d="M30,0 v30 M0,15 h60" stroke="#fff" stroke-width="10"/>\n <path d="M30,0 v30 M0,15 h60" stroke="#cf142b" stroke-width="6"/>\n</svg>'),s.svg=u,s.svgOuter=u.append("g").classed("outer-zoom",!0).attr("transform","translate(0,0) scale(1)"),s.svgG=s.svgOuter.append("g").classed(s.consts.graphClass,!0).attr("id","wordnet-graph-g-element");const g=s.svgG;s.paths=g.append("g").attr("id","all-paths-id").selectAll("g"),s.pathsText=g.append("g").attr("id","all-paths-text-id").selectAll("g"),s.boats=g.append("g").attr("id","all-boats-id").selectAll("g"),s.drag=d3.drag().subject(function(t){return s.range.x.max=Math.max(t.x,s.range.x.max),s.range.y.max=Math.max(t.y,s.range.y.max),s.range.x.min=Math.min(t.x,s.range.x.min),s.range.y.min=Math.min(t.y,s.range.y.min),{x:t.x,y:t.y}}).on("drag",function(t){s.state.justDragged=!0,s.dragmove.call(s,t)}),d3.select(window).on("keydown",function(){s.svgKeyDown.call(s)}).on("keyup",function(){s.svgKeyUp.call(s)}),u.on("mousedown",function(t){s.svgMouseDown.call(s,t)}),u.on("mouseup",function(t){s.svgMouseUp.call(s,t)});const y=d3.zoom().on("zoom",function(){return!d3.event.sourceEvent.shiftKey&&(s.zoomed.call(s),!0)}).on("start",function(){var t=d3.select("#"+s.consts.activeEditId).node();t&&t.blur(),d3.event.sourceEvent.shiftKey||d3.select("body").style("cursor","move")}).on("end",function(){d3.select("body").style("cursor","auto")});s.zoom=y,u.call(y).on("dblclick.zoom",null),window.onresize=function(){s.updateWindow(u)};s.brush=d3.brush(),s.brush.graph=this,s.brush.on("brush",function(){s.brushed()}),d3.select("#inspected-word-form").on("submit",function(){d3.event.preventDefault(),console.log("on submit");let t=d3.select("#inspected-word");s.loadNewWord(t.node().value)}),d3.select("#download-picture").on("click",function(){s.exportVisualization()}),s.range={x:{min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER},y:{min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER}}};p.prototype.setLanguage=function(t){this.api.setLang(t)},p.prototype.showMiniMap=function(t,e,n,o,i,r){t=t||.25,(e=e||this.container)!==this.container&&(e=d3.select(e)),n&&i&&(i=null),null===n&&null===i&&(n=0),o&&r&&(r=null),null===o&&null===r&&(r=0);let s=d3.select("#graph-svg"),a=t;this.minimap=d3.minimap().host(this).target(s).targetShadowId("#all-boats-id").targetShadowId("#all-paths-id").minimapScale(a).x(0).y(0);let d=e.append("svg").attr("class","svg canvas").attr("width",this.width*t).attr("height",this.height*t).attr("shape-rendering","auto").style("position","absolute");null!==n&&void 0!==n&&d.style("top",n),null!==o&&void 0!==o&&d.style("right",o),null!==i&&void 0!==i&&d.style("bottom",i),null!==r&&void 0!==r&&d.style("left",r),d.call(this.minimap),this.minimap.render()},p.prototype.getHeight=function(){return this.height},p.prototype.getWidth=function(){return this.width},p.prototype.update=function(t){this.zoom.transform(this.svg,t),this.svg.property("__zoom",t)},p.prototype.updateCanvasZoomExtents=function(){var t=this.svg.property("__zoom").k,e=this.svg.attr("width"),n=this.svg.attr("height"),o=this.width,i=this.height;this.zoom.translateExtent([[-o/t,-i/t],[o/t+e,i/t+n]])},p.prototype.showLoadingAnimation=function(){this.loadingAnimationHandle.style("display","block")},p.prototype.hideLoadingAnimation=function(){this.loadingAnimationHandle.style("display","none")},p.prototype.listPossibleSenses=function(t){const e=this;if(e.hideLoadingAnimation(),t){const n=function(t){t&&e.initializeFromSynsetId(t.id)};if(0===t.length)e.sensesList.style("display","block").html("").html("<li>nic nie znaleziono</li>");else if(1===t.length)e.api.getSynsetFromSenseId(t[0].id,n);else{let o="";for(let e=0;e<t.length;e++)o+='<li class="hidden-list-item" data-sense-id="'+t[e].id+'">'+t[e].lemma.word+"</li>\n";e.sensesList.style("display","block").html("").html(o),d3.selectAll(".hidden-list-item").on("click",function(){let t=d3.select(this).attr("data-sense-id");e.api.getSynsetFromSenseId(t,n)})}}},p.prototype.loadNewWord=function(t){this.showLoadingAnimation(),this.api.getSensesFromLemma(t,this.listPossibleSenses.bind(this))},p.prototype.initFromJson=function(t){const e=this;try{e.deleteGraph(!0);const n=e.width/2-25,o=e.height/2-100,i=new s.GraphNode(t,n,o,{},e,!0,!0,!0,!0);i.childrenDownloaded=!0,e.nodes.set(i.id,i),e.updateWithChildrenNodes(i)}catch(t){console.log(t),window.alert("Error parsing json\nerror message: "+t.message)}},p.prototype.edgeNotExisting=function(t,e,n){const o=this;for(let n=0;n<o.edges.length;n++){let i=o.edges[n];if(i.source===t&&i.target===e)return!1;if(i.source===e&&i.target===t)return!1}if(void 0!==n)for(i=0;i<n.length;i++){let o=n[i];if(o.source===t&&o.target===e)return!1;if(o.source===e&&o.target===t)return!1}return!0},p.prototype.addEdgesBetweenNewNodes=function(t){const e=this;let n=function(t,n){e.edges.add(t.getConnectionWithNode(n)),e.edges.add(n.getConnectionWithNode(t))};var o;(o=t).forEach(t=>{o.forEach(e=>{t!==e&&n(t,e)})}),function(t){e.nodes.forEach(e=>{t.forEach(t=>{e!==t&&n(e,t)})})}(t)},p.prototype.updateWithChildrenNodes=function(t){const e=this;let n=[];function o(o,i,s){o&&t[i].forEach((o,a)=>{o=t[i][a],e.nodes.has(o.id)||(e.nodes.set(o.id,o),n.push(o)),o.isNodeCumulator()&&e.edges.add(new r.Edge(t,o,s,o.parentRel))})}o(t.expandedTop,"childrenTopRef",[0,2]),o(t.expandedRight,"childrenRightRef",[1,3]),o(t.expandedBottom,"childrenBottomRef",[2,0]),o(t.expandedLeft,"childrenLeftRef",[3,1]),e.addEdgesBetweenNewNodes(n),e.updateGraph()},p.prototype.consts={selectedClass:"selected",connectClass:"connect-node",boatGClass:"conceptG",graphClass:"graph",activeEditId:"active-editing",BACKSPACE_KEY:8,DELETE_KEY:46,ENTER_KEY:13,CTRL_KEY:17,nodeRadius:50,nodeDistance:225,nodeHeight:35,nodeWidth:50,maxDefaultNodesVertically:6,maxDefaultNodesHorizontally:6},p.prototype.showBrush=function(){const t=this;t.state.brushSelect=!0,t.brushHandle||(t.brushHandle=t.svg.append("g").attr("class","brush").call(t.brush))},p.prototype.destroyBrush=function(){const t=this;t.brushHandle&&(t.brushHandle.remove(),t.brushHandle=null)},p.prototype.exitBrushMode=function(){const t=this;t.state.brushSelect&&(t.unmarkAllNodes(),t.state.brushSelect=!1)},p.prototype.unmarkAllNodes=function(){this.nodes.forEach(function(t){t.unmarkSelected()}),this.updateGraph()},p.prototype.getPointInvertedTranslation=function(t,e,n){return(t-e*(1-n))/n-e},p.prototype.getPointTransform=function(t,e,n){return(t+e)*n+e*(1-n)},p.prototype.getPointTransformX=function(t){return this.getPointTransform(t,this.transformed.x,this.transformed.k)},p.prototype.getPointTransformY=function(t){return this.getPointTransform(t,this.transformed.y,this.transformed.k)},p.prototype.markNodesSelectedInRange=function(t){let e=t[0][0],n=t[1][0],o=t[0][1],i=t[1][1];const r=this.transformed.x,s=this.transformed.y,a=this.transformed.k;e=this.getPointInvertedTranslation(e,r,a),n=this.getPointInvertedTranslation(n,r,a),o=this.getPointInvertedTranslation(o,s,a),i=this.getPointInvertedTranslation(i,s,a),this.nodes.forEach(function(t){t.x>e&&t.x<n&&t.y>o&&t.y<i?t.markSelected():t.unmarkSelected()}),this.updateGraph()},p.prototype.brushed=function(){const t=this,e=d3.event.selection;null===e?t.unmarkAllNodes():t.markNodesSelectedInRange(e)},p.prototype.dragmove=function(t){const e=this;e.state.shiftNodeDrag?e.dragLine.attr("d","M"+t.x+","+t.y+"L"+d3.mouse(e.svgG.node())[0]+","+d3.mouse(this.svgG.node())[1]):(t.selected||e.exitBrushMode(),e.state.brushSelect?e.nodes.forEach(function(t){t.selected&&(t.x+=d3.event.dx,t.y+=d3.event.dy)}):(t.x+=d3.event.dx,t.y+=d3.event.dy),e.updateGraph())},p.prototype.deleteGraph=function(t){const e=this;let n=!0;t||(n=window.confirm("Press OK to delete this graph")),n&&(e.nodes=new Map,e.edges=new r.EdgeContainer,e.resetZoom())},p.prototype.selectElementContents=function(t){var e=document.createRange();e.selectNodeContents(t);var n=window.getSelection();n.removeAllRanges(),n.addRange(e)},p.prototype.getNodeTitle=function(t,e){t.append("text").attr("text-anchor","middle").attr("font-size","10px").text(e.length<18?e:String(e).slice(0,15)+"...").attr("dy","3")},p.prototype.spliceLinksForNode=function(t){const e=this;e.edges.filter(function(e){return e.source===t||e.target===t}).map(function(t){e.edges.splice(e.edges.indexOf(t),1)})},p.prototype.svgMouseDown=function(){this.state.graphMouseDown=!0,this.state.brushSelect=!1,this.sensesList.style("display","none"),this.unmarkAllNodes()},p.prototype.svgMouseUp=function(){const t=this,e=t.state;if(e.justScaleTransGraph)e.justScaleTransGraph=!1;else if(e.graphMouseDown&&d3.event.shiftKey){const e=d3.mouse(t.svgG.node()),n={id:t.idct++,title:h.defaultTitle,x:e[0],y:e[1]};t.nodes.push(n),t.updateGraph()}else e.shiftNodeDrag&&(e.shiftNodeDrag=!1,t.dragLine.classed("hidden",!0));e.graphMouseDown=!1},p.prototype.svgKeyDown=function(){const t=this,e=t.state,n=t.consts;if(-1!==e.lastKeyDown)return;e.lastKeyDown=d3.event.keyCode;const o=e.selectedNode,i=e.selectedEdge;switch(d3.event.keyCode){case n.BACKSPACE_KEY:break;case n.CTRL_KEY:t.showBrush();break;case n.DELETE_KEY:o?(t.nodes.splice(t.nodes.indexOf(o),1),t.spliceLinksForNode(o),e.selectedNode=null,t.updateGraph()):i&&(t.edges.splice(t.edges.indexOf(i),1),e.selectedEdge=null,t.updateGraph())}},p.prototype.svgKeyUp=function(){this.destroyBrush(),this.state.lastKeyDown=-1},p.prototype.removeNodeEdges=function(t){this.edges.deleteNodeEdges(t)},p.prototype.removeNode=function(t){const e=this;e.removeNodeEdges(t);const n=t.getAllChildrenRef();for(let t=0;t<n.length;t++)e.removeNode(n[t]);t.reset(),e.nodes.delete(t.id)},p.prototype.removeNodeChildren=function(t,e){const n=this;let o;o=void 0!==e?t.getChildrenAtPosition(e):t.getAllChildrenRef();for(let t=0;t<o.length;t++)n.removeNode(o[t]);n.updateGraph()},p.prototype.updateGraph=function(){const t=this,e=t.consts,n=t.state,o=Array.from(t.nodes.values());t.boats=d3.select("#all-boats-id").selectAll("g").data(o,function(t){return t.id+t.label}),t.boats.attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).classed("node-selected",function(t){return t.selected}).on("mouseover",function(e){const n=e.x,o=e.y,i=t.transformed;e.label.length>=18&&t.showTooltip(t.getPointTransformX(n)+70*i.k,t.getPointTransformY(o)-15,e.label)}).on("mouseout",function(){t.hideTooltip()});const i=t.boats.enter().append("g");i.classed(e.boatGClass,!0).attr("transform",function(e){return t.range.x.max=Math.max(e.x,t.range.x.max),t.range.y.max=Math.max(e.y,t.range.y.max),t.range.x.min=Math.min(e.x,t.range.x.min),t.range.y.min=Math.min(e.y,t.range.y.min),"translate("+e.x+","+e.y+")"}).call(t.drag),i.filter(t=>t.isNodeCumulator()).append("circle").attr("r",25).attr("stroke-width","1px").attr("stroke","black").attr("fill","#aaffaf").classed("inner-node",!0).on("contextmenu",function(e){d3.event.preventDefault(),t.lastClickedNodeCumulator=e;let n=e.getHiddenListHtml();t.hiddenList.style("left",t.transformed.x+(e.x+30)*t.transformed.k+"px").style("top",t.transformed.y+(e.y+15)*t.transformed.k+"px").style("display","block").html(n.html),e.addOnclickToCreatedNodes(t,n.createdIds,n.hiddenRef)});let r=i.filter(t=>!t.isNodeCumulator());r.append("polyline").classed("inner-node",!0).attr("points","-50,10 -10,15 10,15 50,10 50,-10 10,-15 -10,-15 -50,-10 -50,10").attr("stroke-width","1px").attr("stroke","black").attr("fill",function(t){return t.type.color||"red"}).on("click",function(t){let e=new CustomEvent("nodeClicked",{detail:{node:t}});document.dispatchEvent(e)}),t.settings.then(t=>{r.append("rect").attr("x",-37).attr("y",-13).attr("width",13).attr("height",8).attr("stroke","black").attr("stroke-width",.4).attr("fill",e=>{return`url('#flag-${t.lexicons[e.lexicon].icon}')`})}),i.each(function(e){t.appendChildrenButtons(d3.select(this),e)}),i.each(function(e){t.getNodeTitle(d3.select(this),e.label)});try{t.boats.enter().merge(d3.select("#all-boats-id").selectAll("text"))}catch(t){console.log(t)}t.boats.exit().remove();let s=Array.from(t.edges.values());const a=d3.select("#all-paths-id").selectAll("path").data(s,function(t){return t.id}).classed(e.selectedClass,function(t){return t===n.selectedEdge}).attr("d",function(t){return"M"+t.source.x+","+t.source.y+"L"+t.target.x+","+t.target.y});a.exit().remove(),a.enter().append("path").merge(a).style("marker-end","url(#end-arrow)").style("marker-start","url(#start-arrow)").style("stroke-width","1.25").classed("link",!0).classed("dotted",function(t){return t.dotted}).attr("stroke",function(t){return t.color}).attr("d",function(e){const n=t.getConnectionPoints(e);return e.target.isNodeCumulator()?"M"+n.source.x+","+n.source.y+"L"+e.target.x+","+e.target.y:"M"+n.source.x+","+n.source.y+"L"+n.target.x+","+n.target.y}).attr("id",function(t,e){return"path_"+String(t.source.id)+"-"+String(t.target.id)});const d=d3.select("#all-paths-text-id").selectAll("text").data(s,function(t,e){return String(t.source.id)+"-"+String(t.target.id)}),l=d.enter().append("text").classed("relation-text",!0).attr("dy",-5);l.exit().remove(),l.append("textPath").on("mouseover",e=>{let n=t.getRelationTooltipCoordinates(e.source,e.connectionPoints[0]);t.relationTypes.then(o=>{let i=o.find(t=>t.short_name===e.pathTextSrc);t.showTooltip(n.x,n.y,i.description)})}).on("mouseout",function(){t.hideTooltip()}).attr("startOffset","5%").attr("xlink:href",function(t){return"#path_"+String(t.source.id)+"-"+String(t.target.id)}).append("tspan").text(function(t){return t.pathTextSrc}),l.append("textPath").on("mouseover",e=>{let n=t.getRelationTooltipCoordinates(e.target,e.connectionPoints[1]);t.relationTypes.then(o=>{let i=o.find(t=>t.short_name===e.pathTextTarget);t.showTooltip(n.x,n.y,i.description)})}).on("mouseout",function(){t.hideTooltip()}).attr("startOffset","95%").attr("text-anchor","end").attr("xlink:href",function(t){return"#path_"+String(t.source.id)+"-"+String(t.target.id)}).append("tspan").text(function(t){return t.pathTextTarget}),d.exit().remove(),t.minimap&&(t.minimap.updateMaxValues(t.range),t.minimap.render())},p.prototype.showTooltip=function(t,e,n){this.tooltip.transition().duration(100).style("opacity",.9),this.tooltip.html(n).style("left",t+"px").style("top",e+"px")},p.prototype.hideTooltip=function(){this.tooltip.transition().duration(200).style("opacity",0)},p.prototype.getRelationTooltipCoordinates=function(t,e){const n=this;let o={x:n.getPointTransformX(t.x),y:n.getPointTransformY(t.y)};switch(e){case 0:o.x+=30*n.transformed.k,o.y-=70*n.transformed.k;break;case 1:o.x+=70*n.transformed.k,o.y-=15*n.transformed.k;break;case 2:o.x+=30*n.transformed.k;break;case 3:o.x-=30*n.transformed.k,o.y-=15*n.transformed.k}return o},p.prototype.appendChildrenButtons=function(t,e){const n=this;if(e.childrenTop.length>0){t.append("polyline").attr("points","-13 -15, 13 -15, 0 -5, -13 -15").attr("stroke-width","1.5px").attr("fill","blue").attr("stroke","black").classed("expanded",function(t){return t.expandedTop}).on("click",function(){e.expandTriangleClick(n,this,0)})}if(e.childrenRight.length>0){t.append("polyline").attr("points","50,10 40 0, 50 -10").attr("stroke-width","1.5px").attr("fill","blue").attr("stroke","black").classed("expanded",function(t){return t.expandedRight}).on("click",function(){e.expandTriangleClick(n,this,1)})}if(e.childrenBottom.length>0){t.append("polyline").attr("points","-13 15, 13 15, 0 5, -13 15").attr("stroke-width","1.5px").attr("fill","blue").attr("stroke","black").classed("expanded",function(t){return t.expandedBottom}).on("click",function(){e.expandTriangleClick(n,this,2)})}if(e.childrenLeft.length>0){t.append("polyline").attr("points","-50,10 -40 0, -50 -10").attr("stroke-width","1.5px").attr("fill","blue").attr("stroke","black").classed("expanded",function(t){return t.expandedLeft}).on("click",function(){e.expandTriangleClick(n,this,3)})}},p.prototype.getConnectionPoints=function(t){const e=this;try{return{source:e.getConnectionPoint(t.connectionPoints[0],t.source.x,t.source.y),target:e.getConnectionPoint(t.connectionPoints[1],t.target.x,t.target.y)}}catch(e){console.log(t)}},p.prototype.getConnectionPoint=function(t,e,n){const o=this,i={x:e,y:n};switch(t){case 0:i.y-=o.consts.nodeHeight/2-1;break;case 1:i.x+=51;break;case 2:i.y+=o.consts.nodeHeight/2-1;break;case 3:i.x-=51}return i},p.prototype.zoomed=function(t){t=t||d3.event.transform,this.state.justScaleTransGraph=!0,d3.select("."+this.consts.graphClass).attr("transform",t),this.transformed=t,this.hiddenList.style("display","none"),this.minimap&&this.minimap.update(t)},p.prototype.updateWindow=function(t){const e=document.documentElement,n=document.getElementsByTagName("body")[0],o=window.innerWidth||e.clientWidth||n.clientWidth,i=window.innerHeight||e.clientHeight||n.clientHeight;t.attr("width",o).attr("height",i)},p.prototype.initializeFromSynsetId=function(t){const e=this;e.api.getGraph(t,function(t){!function(t){t.length<1?window.alert("Sorry, could not display requested data."):e.initFromJson(t)}(t)})},p.prototype.exportVisualization=function(){const t=this.getSVGString(this.svg.node());this.svgString2Image(t,2*this.width,2*this.height,"png",function(t,e){Object(a.saveAs)(t,"wordnet-graph.png")})},p.prototype.getSVGString=function(t){t.setAttribute("xlink","http://www.w3.org/1999/xlink"),function(t,e){const n=document.createElement("style");n.setAttribute("type","text/css"),n.innerHTML=t;const o=e.hasChildNodes()?e.children[0]:null;e.insertBefore(n,o)}(function(t){let e=[];e.push("#"+t.id);for(let n=0;n<t.classList.length;n++)i("."+t.classList[n],e)||e.push("."+t.classList[n]);const n=t.getElementsByTagName("*");for(let t=0;t<n.length;t++){let o=n[t].id;i("#"+o,e)||e.push("#"+o);const r=n[t].classList;for(let t=0;t<r.length;t++)i("."+r[t],e)||e.push("."+r[t])}let o="";for(let t=0;t<document.styleSheets.length;t++){let n=document.styleSheets[t];try{if(!n.cssRules)continue}catch(t){if("SecurityError"!==t.name)throw t;continue}let r=n.cssRules;for(let t=0;t<r.length;t++)i(r[t].selectorText,e)&&(o+=r[t].cssText)}return o;function i(t,e){return!(-1===e.indexOf(t))}}(t),t);let e=(new XMLSerializer).serializeToString(t);return e=(e=e.replace(/(\w+)?:?xlink=/g,"xmlns:xlink=")).replace(/NS\d+:href/g,"xlink:href")},p.prototype.svgString2Image=function(t,e,n,o,i){o=o||"png";const r="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(t))),s=document.createElement("canvas"),a=s.getContext("2d");s.width=e,s.height=n;const d=new Image;d.onload=function(){a.clearRect(0,0,e,n),a.drawImage(d,0,0,e,n),s.toBlob(function(t){const e=Math.round(t.length/1024)+" KB";i&&i(t,e)})},d.src=r},p.prototype.resetZoom=function(){const t=this;let e=d3.zoomIdentity;t.zoomed(e),t.svg.property("__zoom",e),t.minimap&&t.minimap.resetScale()},p.prototype.resizeSVG=function(t,e){this.svg.attr("width",t).attr("height",e)}},function(t,e,n){"use strict";n.r(e),n.d(e,"GraphNode",function(){return a});var o=n(0),i=n(2),r=n(1);let s={calculateEllipseY:function(t,e,n,o,i,r){return r?o+Math.sqrt(e*e-(1-(i-n)*(i-n))/(t*t)):o-Math.sqrt(e*e-(1-(i-n)*(i-n))/(t*t))},calculateEllipseX:function(t,e,n,o,i,r){return r?n-Math.sqrt(e*e-(1-(i-o)*(i-o))/(t*t)):n+Math.sqrt(e*e-(1-(i-o)*(i-o))/(t*t))},distributeNode:function(t,e,n){return-(n*t*2)/2+2*t*(e+1)-t},assignPlace:function(t,e,n,o,r){const a=i.GraphCreator.prototype.consts;switch(r=r>=a.maxDefaultNodesHorizontally?a.maxDefaultNodesHorizontally:r,t){case"top":n.x=e.x+s.distributeNode(a.nodeWidth+2,o,r),n.y=-200+s.calculateEllipseY(8,1,e.x,e.y,n.x,!0);break;case"right":n.y=e.y+s.distributeNode(a.nodeHeight-15,o,r),n.x=200+s.calculateEllipseX(3,1,e.x,e.y,n.y,!0);break;case"bottom":n.x=e.x+s.distributeNode(a.nodeWidth+10,o,r),n.y=e.y+a.nodeDistance,n.y=200+s.calculateEllipseY(8,1,e.x,e.y,n.x,!1);break;case"left":n.x=e.x-a.nodeDistance,n.y=e.y+s.distributeNode(a.nodeHeight-15,o,r),n.x=-200+s.calculateEllipseX(3,1,e.x,e.y,n.y,!1)}}};const a=function(t,e,n,o,i,r,s,a,d){let l=this;l.graph=i,t&&(l.parentId=o.id||null,l.parent=o||null,t=l.prepareJson(t),l.id=t.id,l.label=t.label,l.partOfSpeechId=t.pos,l.lexicon=t.lex,l.assignColorBasedFromPartOfSpeech(),l.x=e||0,l.y=n||0,l.childrenTop=t.top.expanded.concat(t.top.hidden),l.childrenRight=t.right.expanded.concat(t.right.hidden),l.childrenBottom=t.bottom.expanded.concat(t.bottom.hidden),l.childrenLeft=t.left.expanded.concat(t.left.hidden),l.parentRel=t.rel,l.childrenTopRef=[],l.childrenRightRef=[],l.childrenBottomRef=[],l.childrenLeftRef=[],l.cumulativeNodes={},l.addCumulativeChildren(t),l.initChildren(t.top.expanded,t.right.expanded,t.bottom.expanded,t.left.expanded)),l.selected=!1,l.expandedTop=r||!1,l.expandedRight=s||!1,l.expandedLeft=d||!1,l.expandedBottom=a||!1,l.childrenDownloaded=!1};a.prototype.reset=function(){this.expandedTop=!1,this.expandedRight=!1,this.expandedLeft=!1,this.expandedBottom=!1},a.prototype.assignPlace=function(t,e,n){s.assignPlace(t,this.parent,this,e,n)},a.prototype.initChildren=function(t,e,n,o){const i=this;function r(t,e,n){let o,r=t.length+i[e].length;for(let s=0;s<t.length;s++)(o=i.graph.nodes.get(t[s].id))||((o=new a(t[s],0,0,i,i.graph)).assignPlace(n,s,r),i[e].push(o));i.childrenDownloaded=!0}r(t,"childrenTopRef","top"),r(e,"childrenRightRef","right"),r(n,"childrenBottomRef","bottom"),r(o,"childrenLeftRef","left")},a.prototype.prepareJson=function(t){function e(t,e){t[e]||(t[e]={expanded:[],hidden:[]}),t[e].expanded||(t[e].expanded=[]),t[e].hidden||(t[e].hidden=[])}return e(t,"top"),e(t,"right"),e(t,"bottom"),e(t,"left"),t},a.prototype.addCumulativeChildren=function(t){const e=this;function n(n){let o;e.cumulativeNodes[n]=null,t[n].hidden.length>0&&0!==t[n].expanded.length&&((o=new d({id:-t[n].hidden[0].id,type:{color:"green"},rel:[null,null]},e,t[n].hidden,n)).assignPlace(n,e["children"+n.charAt(0).toUpperCase()+n.slice(1)+"Ref"].length+1,e["children"+n.charAt(0).toUpperCase()+n.slice(1)+"Ref"].length-2),e["children"+n.charAt(0).toUpperCase()+n.slice(1)+"Ref"].push(o)),e.cumulativeNodes[n]=o}n("top"),n("right"),n("bottom"),n("left")},a.prototype.addChildrenAtPosIfNotParent=function(t,e){let n=this;n[e]=n[e].concat(t.filter(t=>t.id!==n.parentId))},a.prototype.addToCumulativeNode=function(t,e){const n=this;e=["top","right","bottom","left"][e],t.forEach(t=>{n.cumulativeNodes[e].addHiddenNode(t)})},a.prototype.updateChildrenPosition=function(t){let e=this,n=["Top","Right","Bottom","Left"][t],o=e["children"+n+"Ref"],i=o.slice(5);i.length>0&&e.addToCumulativeNode(i,t),o=o.slice(0,5),e["children"+n+"Ref"]=o,o.forEach((t,e)=>{t.assignPlace(n.toLowerCase(),e,o.length)})},a.prototype.updateChildren=function(t,e){this.childrenDownloaded||(t=this.prepareJson(t),this.addChildrenAtPosIfNotParent(t.top.hidden,"childrenTop"),this.addChildrenAtPosIfNotParent(t.right.hidden,"childrenRight"),this.addChildrenAtPosIfNotParent(t.bottom.hidden,"childrenBottom"),this.addChildrenAtPosIfNotParent(t.left.hidden,"childrenLeft"),this.childrenTopRef=[],this.childrenRightRef=[],this.childrenBottomRef=[],this.childrenLeftRef=[],this.addCumulativeChildren(t),this.initChildren(t.top.expanded,t.right.expanded,t.bottom.expanded,t.left.expanded),this.expandedTop=0===e,this.expandedRight=1===e,this.expandedBottom=2===e,this.expandedLeft=3===e,this.childrenDownloaded=!0)},a.prototype.markSelected=function(){this.selected=!0},a.prototype.unmarkSelected=function(){this.selected=!1},a.prototype.assignColorBasedFromPartOfSpeech=function(){let t;t=i.consts.partOfSpeech[this.partOfSpeechId]?i.consts.partOfSpeech[this.partOfSpeechId].color:"#F0E68C",this.type={color:t}},a.prototype.nodeType="ordinary",a.prototype.getType=function(){return"ordinary"},a.prototype.api=o.apiConnector,a.prototype.consts={DIRECTIONS:{TOP:0,RIGHT:1,BOTTOM:2,LEFT:3}},a.prototype.getChildrenWithCallback=function(t){const e=this;e.childrenDownloaded?t(e.apiData):e.api.getGraph(e.id,function(n){e.apiData=n,t(n)})},a.prototype.expandTopClick=function(t,e){this.expandedTop=!0,this.findNewPlace(t),this.getChildrenWithCallback(e)},a.prototype.expandRightClick=function(t,e){this.expandedRight=!0,this.findNewPlace(t),this.getChildrenWithCallback(e)},a.prototype.expandBottomClick=function(t,e){this.expandedBottom=!0,this.findNewPlace(t),this.getChildrenWithCallback(e)},a.prototype.expandLeftClick=function(t,e){this.expandedLeft=!0,this.findNewPlace(t),this.getChildrenWithCallback(e)},a.prototype.moveChildren=function(t){const e=this.getAllChildrenRef();for(let n=0;n<e.length;n++){let o=[e[n].x-t[0],e[n].y-t[1]];e[n].assignNewPosition(o),e[n].moveChildren(t)}},a.prototype.getChildrenAtPosition=function(t){const e=this;switch(t){case 0:return e.childrenTopRef;case 1:return e.childrenRightRef;case 2:return e.childrenBottomRef;case 3:return e.childrenLeftRef}},a.prototype.connectionPointTypes={0:[0,2],1:[1,3],2:[2,0],3:[3,1],top:[0,2],right:[1,3],bottom:[2,0],left:[3,1]},a.prototype.getConnectionWithNode=function(t){const e=this;for(let[n,o]of["childrenTop","childrenRight","childrenBottom","childrenLeft"].entries()){let i=e[o].filter(e=>e.id===t.id)[0];if(i)return new r.Edge(e,t,e.connectionPointTypes[n],i.rel)}return null},a.prototype.getAllChildren=function(){return this.childrenTop.concat(this.childrenRight,this.childrenBottom,this.childrenLeft)},a.prototype.getAllChildrenRef=function(){return this.childrenTopRef.concat(this.childrenRightRef,this.childrenBottomRef,this.childrenLeftRef)},a.prototype.assignNewPosition=function(t){this.x=t[0],this.y=t[1]},a.prototype.findNewPlace=function(t){const e=this;let n=[e.x,e.y],o=20,i=10;for(;!e.checkIfSpaceInRegion(n,t)&&i>0;)n=e.calculatePossibleNewPosition(o),o+=20,i--;return e.moveChildren([e.x-n[0],e.y-n[1]]),e.assignNewPosition(n),n},a.prototype.checkIfSpaceInRegion=function(t,e){const n=this,o=t[0],i=t[1],r=n.getAllChildrenRef();for(let[t,s]of e){if(r.indexOf(s)>-1)continue;const t=s.x,e=s.y;if(n.expandedTop&&n.checkIfPointInRange(t,e,o-500,o+500,i-500,i))return!1;if(n.expandedRight&&n.checkIfPointInRange(t,e,o,o+1e3,i-250,i+250))return!1;if(n.expandedBottom&&n.checkIfPointInRange(t,e,o-500,o+500,i,i+500))return!1;if(n.expandedLeft&&n.checkIfPointInRange(t,e,o-1e3,o,i-250,i+250))return!1}return!0},a.prototype.checkIfPointInRange=function(t,e,n,o,i,r){return t>n&&t<o&&(e>i&&e<r)},a.prototype.calculatePossibleNewPosition=function(t){const e=this,n=e.parent,o=n.x-e.x,i=n.y-e.y;let r=e.x,s=e.y;if(!e.parent.x||!e.parent.y)return[r,s];const a=i/o;return 0===o||Math.abs(o)<50?s=i>0?e.y-t:e.y+t:0===i&&o<0?r=e.x+t:i<0?a<0?(r=e.x-t,s=e.y-t*a):(r=e.x+t,s=e.y+t*a):a<0?(r=e.x+t,s=e.y+t*a):(r=e.x-t,s=e.y-t*a),[r,s]},a.prototype.isNodeCumulator=function(){return!1},a.prototype.expandTriangleClick=function(t,e,n){const o=this,i=["expandedTop","expandedRight","expandedBottom","expandedLeft"][n],r=["expandTopClick","expandRightClick","expandBottomClick","expandLeftClick"][n];o[i]?(o[i]=!1,t.removeNodeChildren(o,n),d3.select(e).classed("expanded",!1)):o[r](t.nodes,function(i){o.updateChildren(i,n),o.updateChildrenPosition(n),t.updateWithChildrenNodes(o),d3.select(e).classed("expanded",!0)})};const d=function(t,e,n,o){a.call(this,t,100,100,e,e.graph),this.hiddenNodes=n||[],this.positionRelativeToParent=o,this.label=this.hiddenNodes.length,this.hiddenButVisible=0,this.childrenTop=[],this.childrenRight=[],this.childrenBottom=[],this.childrenLeft=[]};d.prototype=new a,d.prototype.constructor=d,d.prototype.nodeType="cumulator",d.prototype.getType=function(){return"cumulator"},d.prototype.getHiddenNodes=function(){return this.hiddenNodes},d.prototype.updateCount=function(){this.label=this.hiddenNodes.length-this.hiddenButVisible},d.prototype.decrementTitle=function(){const t=this;t.label-=1,0===t.label&&this.graph.removeNode(t)},d.prototype.expandHiddenNode=function(t,e){const n=this;n.graph.hiddenList.style("display","none"),n.api.getGraph(t.id,function(e){e.rel=t.rel;let o=new a(e,n.x+100+Math.floor(20*Math.random()-10),n.y+100+ +Math.floor(20*Math.random()-10),n.parent,n.graph);o.childrenDownloaded=!0,n.parent["children"+n.positionRelativeToParent.charAt(0).toUpperCase()+n.positionRelativeToParent.slice(1)+"Ref"].push(o),n.graph.nodes.set(o.id,o);let i=n.connectionPointTypes[n.positionRelativeToParent];n.hiddenNodes.splice(n.hiddenNodes.indexOf(t),1),n.decrementTitle(),n.graph.edges.add(new r.Edge(n.parent,o,i,o.parentRel)),n.graph.addEdgesBetweenNewNodes([o]),n.graph.updateGraph()})},d.prototype.addOnclickToCreatedNodes=function(t,e,n){const o=this;for(let t=0;t<e.length;t++)!function(t){let i=e[t];d3.select(i).on("click",function(){o.expandHiddenNode(n[t],o)})}(t)},d.prototype.isNodeCumulator=function(){return!0},d.prototype.getHiddenListHtml=function(){const t=this;let e={html:"",createdIds:[],hiddenRef:[]};return e.html="<ul class='hidden-nodes-list'>",t.hiddenButVisible=0,t.hiddenNodes.forEach((n,o)=>{t.graph.nodes.has(n.id)?t.hiddenButVisible++:(e.html+="\n<li id='hidden-"+n.id+"'>"+n.label+"</li>",e.createdIds.push("#hidden-"+n.id),e.hiddenRef.push(t.hiddenNodes[o]))}),e.html+="\n</ul>",t.updateCount(),e},d.prototype.addHiddenNode=function(t){this.hiddenNodes.push({id:t.id,label:t.label,rel:t.parentRel,pos:t.partOfSpeechId}),this.label+=1}},function(t,e,n){"use strict";n.r(e),function(t){n.d(e,"saveAs",function(){return o}); var GraphCreator=function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([function(t,e,n){"use strict";n.r(e),n.d(e,"apiConnector",function(){return i});const o=function(t){this.url="https://graph-slowosiec.clarin-pl.eu/wordnetloom/resources/",this.cache=new Map,this.possibleLangs=["pl","en"],this.lang=t||"pl"};o.prototype.setLang=function(t){const e=this;e.possibleLangs.indexOf(t)<0?console.error('Err, Language can only be chosen to be "pl" or "en"'):e.lang!==t&&(e.cache=new Map,e.lang=t)},o.prototype.entryPoints={settings:"settings/",graph:"graphs/synsets/{id}",synsetFromSense:"senses/{id}/synset",synsetFromLemma:"synsets/search?lemma={lemma}",relationTypes:"relation-types/{id}"},o.prototype._getJson=function(t,e){const n=this;if(!e)return n._getJsonPromise(t);n.cache.has(t)?e(n.cache.get(t)):d3.request(n.url+t).header("Content-Type","application/json").header("Accept-Language",n.lang).get((o,i)=>{i=JSON.parse(i.response),n.cache.set(t,i),e(i)})},o.prototype._getJsonPromise=function(t){const e=this;let n=new class{constructor(){this.promise=new Promise((t,e)=>{this.reject=e,this.resolve=t})}};return e.cache.has(t)?n.resolve(e.cache.get(t)):d3.request(e.url+t).header("Content-Type","application/json").header("Accept-Language",e.lang).get((o,i)=>{i=JSON.parse(i.response),e.cache.set(t,i),n.resolve(i)}),n.promise},o.prototype.getRelationTypes=function(t,e){return t=t||"",this._getJson(this.entryPoints.relationTypes.replace("{id}",t),e)},o.prototype.getSettings=function(t){return this._getJson(this.entryPoints.settings,t)},o.prototype.hasInCache=function(t){return this.cache.has(t)},o.prototype.getFromCache=function(t){return this.cache.has(t)?this.cache.get(t):null},o.prototype.getGraph=function(t,e){this._getJson(this.entryPoints.graph.replace("{id}",t),function(t){e(t||null)})},o.prototype.getSynsetFromSenseId=function(t,e){const n=function(t){e(t)};d3.json(this.url+this.entryPoints.synsetFromSense.replace("{id}",t),function(t,e){n(e||null)})},o.prototype.getSensesFromLemma=function(t,e){d3.json(this.url+this.entryPoints.synsetFromLemma.replace("{lemma}",t),function(t,n){e(n||null)})};const i=new o},function(t,e,n){"use strict";n.r(e),n.d(e,"Edge",function(){return i}),n.d(e,"EdgeContainer",function(){return r});var o=n(0);function i(t,e,n,o,i,r){this.connectionPoints=n,this.pathTextSrc=o[0],this.pathTextTarget=o[1],this.color=i||"#000",this.dotted=r||!1,this.source=t,this.target=e,this.id=this.getUniqueIdentifier(),this.initColor(),this.initDotted()}function r(){this.map=new Map,this[Symbol.iterator]=this.values}i.prototype.api=o.apiConnector,i.prototype.settings=o.apiConnector.getSettings(),i.prototype.initColor=function(){const t=this;if(!t.pathTextSrc&&!t.pathTextTarget)return;const e=e=>{const n=e.relations[t.pathTextSrc]||e.relations[t.pathTextTarget];try{t.color=n.color}catch(e){console.log(e),console.log(t)}};t.api.hasInCache(t.api.entryPoints.settings)?e(t.api.getFromCache(t.api.entryPoints.settings)):t.settings.then(t=>{e(t)})},i.prototype.initDotted=function(){const t=this;if(!t.pathTextSrc&&!t.pathTextTarget)return;const e=e=>{const n=e.relations[t.pathTextSrc]||e.relations[t.pathTextTarget];try{t.dotted=n.dotted}catch(e){console.log(e),console.log(t)}};t.api.hasInCache(t.api.entryPoints.settings)?e(t.api.getFromCache(t.api.entryPoints.settings)):t.settings.then(t=>{e(t)})},i.prototype.getUniqueIdentifier=function(){return this.source.id<this.target.id?this.source.id+"|"+this.target.id:this.target.id+"|"+this.source.id},r.prototype.add=function(t){t&&this.map.set(t.id,t)},r.prototype.values=function(){return this.map.values()},r.prototype.deleteNodeEdges=function(t){let e=this;e.map.forEach(n=>{n.source!==t&&n.target!==t||e.map.delete(n.id)})}},function(t,e,n){"use strict";n.r(e),n.d(e,"consts",function(){return h}),n.d(e,"GraphCreator",function(){return p});var o=n(0),r=n(1),s=n(3),a=n(4);const d=".inner-graph-container",l=".possible-senses",c=".graph-loader",h={partOfSpeech:{1:{color:"#FED25C"},2:{color:"#ABFFAE"},3:{color:"#ABFFAE"},4:{color:"#ACFFEA"}}},p=function(t,e,n,i){const s=this;s.width=n,s.height=i;let a='<div class="graph-loader" style="display: none"></div><div class="inner-graph-container"></div>';e&&(a+='<div id="toolbox"><form id="inspected-word-form"><button type="submit" value="Submit" id="inspected-word-btn">Szukaj</button><input type="text" id="inspected-word" placeholder="Słowo którego szukasz&hellip;"></form><ul class="possible-senses" style="display: none"></ul></div>'),a+='<button id="download-picture"></button>';const p=d3.select("#"+t).html(a);s.container=p;const u=p.select(d).append("svg").attr("width",n).attr("height",i).attr("id","graph-svg");s.hiddenList=d3.select(d).append("div").attr("pointer-events","none").attr("class","hidden-list tooltip").style("opacity",1).html("FIRST LINE <br> SECOND LINE").style("display","none"),s.sensesList=d3.select(l),s.tooltip=d3.select(d).append("div").attr("id","node-tooltip").style("opacity",0),s.loadingAnimationHandle=d3.select(c).style("display","none"),s.idct=0,s.nodes=new Map,s.edges=new r.EdgeContainer,s.transformed={x:0,y:0,k:1},s.state={selectedNode:null,selectedEdge:null,mouseDownNode:null,mouseDownLink:null,justDragged:!1,justScaleTransGraph:!1,lastKeyDown:-1,shiftNodeDrag:!1,selectedText:null,brushSelect:!1},s.api=o.apiConnector,s.settings=s.api.getSettings(),s.settings.then(t=>{h.partOfSpeech=t.partsOfSpeech}),s.relationTypes=s.api.getRelationTypes();const f=u.append("svg:defs");f.append("svg:marker").attr("id","end-arrow").attr("viewBox","0 -5 10 10").attr("refX","8").attr("markerWidth",10).attr("markerHeight",10).attr("orient","auto").append("svg:path").attr("d","M0,-5L10,0L0,5L5,0"),f.append("svg:marker").attr("id","start-arrow").attr("viewBox","0 0 10 10").attr("refX",2).attr("refY",5).attr("markerWidth",10).attr("markerHeight",10).attr("orient","auto").append("svg:path").attr("d","M0,5L10,0L5,5L10,10"),f.append("pattern").attr("id","flag-pl").html('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="10" id="Flag of Poland" viewBox="0 0 16 10"><rect width="16" height="4" fill="#fff"/><rect width="16" height="5" fill="#dc143c" y="4"/></svg>').attr("width",16).attr("height",16),f.append("pattern").attr("id","flag-en").attr("width",16).attr("height",16).html('<svg x="-1.5" viewBox="0 0 60 30" width="16" height="8">\n <clipPath id="t">\n <path d="M30,15 h30 v15 z v15 h-30 z h-30 v-15 z v-15 h30 z"/>\n </clipPath>\n <path d="M0,0 v30 h60 v-30 z" fill="#00247d"/>\n <path d="M0,0 L60,30 M60,0 L0,30" stroke="#fff" stroke-width="6"/>\n <path d="M0,0 L60,30 M60,0 L0,30" clip-path="url(#t)" stroke="#cf142b" stroke-width="4"/>\n <path d="M30,0 v30 M0,15 h60" stroke="#fff" stroke-width="10"/>\n <path d="M30,0 v30 M0,15 h60" stroke="#cf142b" stroke-width="6"/>\n</svg>'),s.svg=u,s.svgOuter=u.append("g").classed("outer-zoom",!0).attr("transform","translate(0,0) scale(1)"),s.svgG=s.svgOuter.append("g").classed(s.consts.graphClass,!0).attr("id","wordnet-graph-g-element");const g=s.svgG;s.paths=g.append("g").attr("id","all-paths-id").selectAll("g"),s.pathsText=g.append("g").attr("id","all-paths-text-id").selectAll("g"),s.boats=g.append("g").attr("id","all-boats-id").selectAll("g"),s.drag=d3.drag().subject(function(t){return s.range.x.max=Math.max(t.x,s.range.x.max),s.range.y.max=Math.max(t.y,s.range.y.max),s.range.x.min=Math.min(t.x,s.range.x.min),s.range.y.min=Math.min(t.y,s.range.y.min),{x:t.x,y:t.y}}).on("drag",function(t){s.state.justDragged=!0,s.dragmove.call(s,t)}),d3.select(window).on("keydown",function(){s.svgKeyDown.call(s)}).on("keyup",function(){s.svgKeyUp.call(s)}),u.on("mousedown",function(t){s.svgMouseDown.call(s,t)}),u.on("mouseup",function(t){s.svgMouseUp.call(s,t)});const y=d3.zoom().on("zoom",function(){return!d3.event.sourceEvent.shiftKey&&(s.zoomed.call(s),!0)}).on("start",function(){var t=d3.select("#"+s.consts.activeEditId).node();t&&t.blur(),d3.event.sourceEvent.shiftKey||d3.select("body").style("cursor","move")}).on("end",function(){d3.select("body").style("cursor","auto")});s.zoom=y,u.call(y).on("dblclick.zoom",null),window.onresize=function(){s.updateWindow(u)};s.brush=d3.brush(),s.brush.graph=this,s.brush.on("brush",function(){s.brushed()}),d3.select("#inspected-word-form").on("submit",function(){d3.event.preventDefault(),console.log("on submit");let t=d3.select("#inspected-word");s.loadNewWord(t.node().value)}),d3.select("#download-picture").on("click",function(){s.exportVisualization()}),s.range={x:{min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER},y:{min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER}}};p.prototype.setLanguage=function(t){this.api.setLang(t)},p.prototype.showMiniMap=function(t,e,n,o,i,r){t=t||.25,(e=e||this.container)!==this.container&&(e=d3.select(e)),n&&i&&(i=null),null===n&&null===i&&(n=0),o&&r&&(r=null),null===o&&null===r&&(r=0);let s=d3.select("#graph-svg"),a=t;this.minimap=d3.minimap().host(this).target(s).targetShadowId("#all-boats-id").targetShadowId("#all-paths-id").minimapScale(a).x(0).y(0);let d=e.append("svg").attr("class","svg canvas").attr("width",this.width*t).attr("height",this.height*t).attr("shape-rendering","auto").style("position","absolute");null!==n&&void 0!==n&&d.style("top",n),null!==o&&void 0!==o&&d.style("right",o),null!==i&&void 0!==i&&d.style("bottom",i),null!==r&&void 0!==r&&d.style("left",r),d.call(this.minimap),this.minimap.render()},p.prototype.getHeight=function(){return this.height},p.prototype.getWidth=function(){return this.width},p.prototype.update=function(t){this.zoom.transform(this.svg,t),this.svg.property("__zoom",t)},p.prototype.updateCanvasZoomExtents=function(){var t=this.svg.property("__zoom").k,e=this.svg.attr("width"),n=this.svg.attr("height"),o=this.width,i=this.height;this.zoom.translateExtent([[-o/t,-i/t],[o/t+e,i/t+n]])},p.prototype.showLoadingAnimation=function(){this.loadingAnimationHandle.style("display","block")},p.prototype.hideLoadingAnimation=function(){this.loadingAnimationHandle.style("display","none")},p.prototype.listPossibleSenses=function(t){const e=this;if(e.hideLoadingAnimation(),t){const n=function(t){t&&e.initializeFromSynsetId(t.id)};if(0===t.length)e.sensesList.style("display","block").html("").html("<li>nic nie znaleziono</li>");else if(1===t.length)e.api.getSynsetFromSenseId(t[0].id,n);else{let o="";for(let e=0;e<t.length;e++)o+='<li class="hidden-list-item" data-sense-id="'+t[e].id+'">'+t[e].lemma.word+"</li>\n";e.sensesList.style("display","block").html("").html(o),d3.selectAll(".hidden-list-item").on("click",function(){let t=d3.select(this).attr("data-sense-id");e.api.getSynsetFromSenseId(t,n)})}}},p.prototype.loadNewWord=function(t){this.showLoadingAnimation(),this.api.getSensesFromLemma(t,this.listPossibleSenses.bind(this))},p.prototype.initFromJson=function(t){const e=this;try{e.deleteGraph(!0);const n=e.width/2-25,o=e.height/2-100,i=new s.GraphNode(t,n,o,{},e,!0,!0,!0,!0);i.childrenDownloaded=!0,e.nodes.set(i.id,i),e.updateWithChildrenNodes(i)}catch(t){console.log(t),window.alert("Error parsing json\nerror message: "+t.message)}},p.prototype.edgeNotExisting=function(t,e,n){const o=this;for(let n=0;n<o.edges.length;n++){let i=o.edges[n];if(i.source===t&&i.target===e)return!1;if(i.source===e&&i.target===t)return!1}if(void 0!==n)for(i=0;i<n.length;i++){let o=n[i];if(o.source===t&&o.target===e)return!1;if(o.source===e&&o.target===t)return!1}return!0},p.prototype.addEdgesBetweenNewNodes=function(t){const e=this;let n=function(t,n){e.edges.add(t.getConnectionWithNode(n)),e.edges.add(n.getConnectionWithNode(t))};var o;(o=t).forEach(t=>{o.forEach(e=>{t!==e&&n(t,e)})}),function(t){e.nodes.forEach(e=>{t.forEach(t=>{e!==t&&n(e,t)})})}(t)},p.prototype.updateWithChildrenNodes=function(t){const e=this;let n=[];function o(o,i,s){o&&t[i].forEach((o,a)=>{o=t[i][a],e.nodes.has(o.id)||(e.nodes.set(o.id,o),n.push(o)),o.isNodeCumulator()&&e.edges.add(new r.Edge(t,o,s,o.parentRel))})}o(t.expandedTop,"childrenTopRef",[0,2]),o(t.expandedRight,"childrenRightRef",[1,3]),o(t.expandedBottom,"childrenBottomRef",[2,0]),o(t.expandedLeft,"childrenLeftRef",[3,1]),e.addEdgesBetweenNewNodes(n),e.updateGraph()},p.prototype.consts={selectedClass:"selected",connectClass:"connect-node",boatGClass:"conceptG",graphClass:"graph",activeEditId:"active-editing",BACKSPACE_KEY:8,DELETE_KEY:46,ENTER_KEY:13,CTRL_KEY:17,nodeRadius:50,nodeDistance:225,nodeHeight:35,nodeWidth:50,maxDefaultNodesVertically:6,maxDefaultNodesHorizontally:6},p.prototype.showBrush=function(){const t=this;t.state.brushSelect=!0,t.brushHandle||(t.brushHandle=t.svg.append("g").attr("class","brush").call(t.brush))},p.prototype.destroyBrush=function(){const t=this;t.brushHandle&&(t.brushHandle.remove(),t.brushHandle=null)},p.prototype.exitBrushMode=function(){const t=this;t.state.brushSelect&&(t.unmarkAllNodes(),t.state.brushSelect=!1)},p.prototype.unmarkAllNodes=function(){this.nodes.forEach(function(t){t.unmarkSelected()}),this.updateGraph()},p.prototype.getPointInvertedTranslation=function(t,e,n){return(t-e*(1-n))/n-e},p.prototype.getPointTransform=function(t,e,n){return(t+e)*n+e*(1-n)},p.prototype.getPointTransformX=function(t){return this.getPointTransform(t,this.transformed.x,this.transformed.k)},p.prototype.getPointTransformY=function(t){return this.getPointTransform(t,this.transformed.y,this.transformed.k)},p.prototype.markNodesSelectedInRange=function(t){let e=t[0][0],n=t[1][0],o=t[0][1],i=t[1][1];const r=this.transformed.x,s=this.transformed.y,a=this.transformed.k;e=this.getPointInvertedTranslation(e,r,a),n=this.getPointInvertedTranslation(n,r,a),o=this.getPointInvertedTranslation(o,s,a),i=this.getPointInvertedTranslation(i,s,a),this.nodes.forEach(function(t){t.x>e&&t.x<n&&t.y>o&&t.y<i?t.markSelected():t.unmarkSelected()}),this.updateGraph()},p.prototype.brushed=function(){const t=this,e=d3.event.selection;null===e?t.unmarkAllNodes():t.markNodesSelectedInRange(e)},p.prototype.dragmove=function(t){const e=this;e.state.shiftNodeDrag?e.dragLine.attr("d","M"+t.x+","+t.y+"L"+d3.mouse(e.svgG.node())[0]+","+d3.mouse(this.svgG.node())[1]):(t.selected||e.exitBrushMode(),e.state.brushSelect?e.nodes.forEach(function(t){t.selected&&(t.x+=d3.event.dx,t.y+=d3.event.dy)}):(t.x+=d3.event.dx,t.y+=d3.event.dy),e.updateGraph())},p.prototype.deleteGraph=function(t){const e=this;let n=!0;t||(n=window.confirm("Press OK to delete this graph")),n&&(e.nodes=new Map,e.edges=new r.EdgeContainer,e.resetZoom())},p.prototype.selectElementContents=function(t){var e=document.createRange();e.selectNodeContents(t);var n=window.getSelection();n.removeAllRanges(),n.addRange(e)},p.prototype.getNodeTitle=function(t,e){t.append("text").attr("text-anchor","middle").attr("font-size","10px").text(e.length<18?e:String(e).slice(0,15)+"...").attr("dy","3")},p.prototype.spliceLinksForNode=function(t){const e=this;e.edges.filter(function(e){return e.source===t||e.target===t}).map(function(t){e.edges.splice(e.edges.indexOf(t),1)})},p.prototype.svgMouseDown=function(){this.state.graphMouseDown=!0,this.state.brushSelect=!1,this.sensesList.style("display","none"),this.unmarkAllNodes()},p.prototype.svgMouseUp=function(){const t=this,e=t.state;if(e.justScaleTransGraph)e.justScaleTransGraph=!1;else if(e.graphMouseDown&&d3.event.shiftKey){const e=d3.mouse(t.svgG.node()),n={id:t.idct++,title:h.defaultTitle,x:e[0],y:e[1]};t.nodes.push(n),t.updateGraph()}else e.shiftNodeDrag&&(e.shiftNodeDrag=!1,t.dragLine.classed("hidden",!0));e.graphMouseDown=!1},p.prototype.svgKeyDown=function(){const t=this,e=t.state,n=t.consts;if(-1!==e.lastKeyDown)return;e.lastKeyDown=d3.event.keyCode;const o=e.selectedNode,i=e.selectedEdge;switch(d3.event.keyCode){case n.BACKSPACE_KEY:break;case n.CTRL_KEY:t.showBrush();break;case n.DELETE_KEY:o?(t.nodes.splice(t.nodes.indexOf(o),1),t.spliceLinksForNode(o),e.selectedNode=null,t.updateGraph()):i&&(t.edges.splice(t.edges.indexOf(i),1),e.selectedEdge=null,t.updateGraph())}},p.prototype.svgKeyUp=function(){this.destroyBrush(),this.state.lastKeyDown=-1},p.prototype.removeNodeEdges=function(t){this.edges.deleteNodeEdges(t)},p.prototype.removeNode=function(t){const e=this;e.removeNodeEdges(t);const n=t.getAllChildrenRef();for(let t=0;t<n.length;t++)e.removeNode(n[t]);t.reset(),e.nodes.delete(t.id)},p.prototype.removeNodeChildren=function(t,e){const n=this;let o;o=void 0!==e?t.getChildrenAtPosition(e):t.getAllChildrenRef();for(let t=0;t<o.length;t++)n.removeNode(o[t]);n.updateGraph()},p.prototype.updateGraph=function(){const t=this,e=t.consts,n=t.state,o=Array.from(t.nodes.values());t.boats=d3.select("#all-boats-id").selectAll("g").data(o,function(t){return t.id+t.label}),t.boats.attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).classed("node-selected",function(t){return t.selected}).on("mouseover",function(e){const n=e.x,o=e.y,i=t.transformed;e.label.length>=18&&t.showTooltip(t.getPointTransformX(n)+70*i.k,t.getPointTransformY(o)-15,e.label)}).on("mouseout",function(){t.hideTooltip()});const i=t.boats.enter().append("g");i.classed(e.boatGClass,!0).attr("transform",function(e){return t.range.x.max=Math.max(e.x,t.range.x.max),t.range.y.max=Math.max(e.y,t.range.y.max),t.range.x.min=Math.min(e.x,t.range.x.min),t.range.y.min=Math.min(e.y,t.range.y.min),"translate("+e.x+","+e.y+")"}).call(t.drag),i.filter(t=>t.isNodeCumulator()).append("circle").attr("r",25).attr("stroke-width","1px").attr("stroke","black").attr("fill","#aaffaf").classed("inner-node",!0).on("contextmenu",function(e){d3.event.preventDefault(),t.lastClickedNodeCumulator=e;let n=e.getHiddenListHtml();t.hiddenList.style("left",t.transformed.x+(e.x+30)*t.transformed.k+"px").style("top",t.transformed.y+(e.y+15)*t.transformed.k+"px").style("display","block").html(n.html),e.addOnclickToCreatedNodes(t,n.createdIds,n.hiddenRef)});let r=i.filter(t=>!t.isNodeCumulator());r.append("polyline").classed("inner-node",!0).attr("points","-50,10 -10,15 10,15 50,10 50,-10 10,-15 -10,-15 -50,-10 -50,10").attr("stroke-width","1px").attr("stroke","black").attr("fill",function(t){return t.type.color||"red"}).on("click",function(t){let e=new CustomEvent("nodeClicked",{detail:{node:t}});document.dispatchEvent(e)}),t.settings.then(t=>{r.append("rect").attr("x",-37).attr("y",-13).attr("width",13).attr("height",8).attr("stroke","black").attr("stroke-width",.4).attr("fill",e=>{return`url('#flag-${t.lexicons[e.lexicon].icon}')`})}),i.each(function(e){t.appendChildrenButtons(d3.select(this),e)}),i.each(function(e){t.getNodeTitle(d3.select(this),e.label)});try{t.boats.enter().merge(d3.select("#all-boats-id").selectAll("text"))}catch(t){console.log(t)}t.boats.exit().remove();let s=Array.from(t.edges.values());const a=d3.select("#all-paths-id").selectAll("path").data(s,function(t){return t.id}).classed(e.selectedClass,function(t){return t===n.selectedEdge}).attr("d",function(t){return"M"+t.source.x+","+t.source.y+"L"+t.target.x+","+t.target.y});a.exit().remove(),a.enter().append("path").merge(a).style("marker-end","url(#end-arrow)").style("marker-start","url(#start-arrow)").style("stroke-width","1.25").classed("link",!0).classed("dotted",function(t){return t.dotted}).attr("stroke",function(t){return t.color}).attr("d",function(e){const n=t.getConnectionPoints(e);return e.target.isNodeCumulator()?"M"+n.source.x+","+n.source.y+"L"+e.target.x+","+e.target.y:"M"+n.source.x+","+n.source.y+"L"+n.target.x+","+n.target.y}).attr("id",function(t,e){return"path_"+String(t.source.id)+"-"+String(t.target.id)});const d=d3.select("#all-paths-text-id").selectAll("text").data(s,function(t,e){return String(t.source.id)+"-"+String(t.target.id)}),l=d.enter().append("text").classed("relation-text",!0).attr("dy",-5);l.exit().remove(),l.append("textPath").on("mouseover",e=>{let n=t.getRelationTooltipCoordinates(e.source,e.connectionPoints[0]);t.relationTypes.then(o=>{let i=o.find(t=>t.short_name===e.pathTextSrc);t.showTooltip(n.x,n.y,i.description)})}).on("mouseout",function(){t.hideTooltip()}).attr("startOffset","5%").attr("xlink:href",function(t){return"#path_"+String(t.source.id)+"-"+String(t.target.id)}).append("tspan").text(function(t){return t.pathTextSrc}),l.append("textPath").on("mouseover",e=>{let n=t.getRelationTooltipCoordinates(e.target,e.connectionPoints[1]);t.relationTypes.then(o=>{let i=o.find(t=>t.short_name===e.pathTextTarget);t.showTooltip(n.x,n.y,i.description)})}).on("mouseout",function(){t.hideTooltip()}).attr("startOffset","95%").attr("text-anchor","end").attr("xlink:href",function(t){return"#path_"+String(t.source.id)+"-"+String(t.target.id)}).append("tspan").text(function(t){return t.pathTextTarget}),d.exit().remove(),t.minimap&&(t.minimap.updateMaxValues(t.range),t.minimap.render())},p.prototype.showTooltip=function(t,e,n){this.tooltip.transition().duration(100).style("opacity",.9),this.tooltip.html(n).style("left",t+"px").style("top",e+"px")},p.prototype.hideTooltip=function(){this.tooltip.transition().duration(200).style("opacity",0)},p.prototype.getRelationTooltipCoordinates=function(t,e){const n=this;let o={x:n.getPointTransformX(t.x),y:n.getPointTransformY(t.y)};switch(e){case 0:o.x+=30*n.transformed.k,o.y-=70*n.transformed.k;break;case 1:o.x+=70*n.transformed.k,o.y-=15*n.transformed.k;break;case 2:o.x+=30*n.transformed.k;break;case 3:o.x-=30*n.transformed.k,o.y-=15*n.transformed.k}return o},p.prototype.appendChildrenButtons=function(t,e){const n=this;if(e.childrenTop.length>0){t.append("polyline").attr("points","-13 -15, 13 -15, 0 -5, -13 -15").attr("stroke-width","1.5px").attr("fill","blue").attr("stroke","black").classed("expanded",function(t){return t.expandedTop}).on("click",function(){e.expandTriangleClick(n,this,0)})}if(e.childrenRight.length>0){t.append("polyline").attr("points","50,10 40 0, 50 -10").attr("stroke-width","1.5px").attr("fill","blue").attr("stroke","black").classed("expanded",function(t){return t.expandedRight}).on("click",function(){e.expandTriangleClick(n,this,1)})}if(e.childrenBottom.length>0){t.append("polyline").attr("points","-13 15, 13 15, 0 5, -13 15").attr("stroke-width","1.5px").attr("fill","blue").attr("stroke","black").classed("expanded",function(t){return t.expandedBottom}).on("click",function(){e.expandTriangleClick(n,this,2)})}if(e.childrenLeft.length>0){t.append("polyline").attr("points","-50,10 -40 0, -50 -10").attr("stroke-width","1.5px").attr("fill","blue").attr("stroke","black").classed("expanded",function(t){return t.expandedLeft}).on("click",function(){e.expandTriangleClick(n,this,3)})}},p.prototype.getConnectionPoints=function(t){const e=this;try{return{source:e.getConnectionPoint(t.connectionPoints[0],t.source.x,t.source.y),target:e.getConnectionPoint(t.connectionPoints[1],t.target.x,t.target.y)}}catch(e){console.log(t)}},p.prototype.getConnectionPoint=function(t,e,n){const o=this,i={x:e,y:n};switch(t){case 0:i.y-=o.consts.nodeHeight/2-1;break;case 1:i.x+=51;break;case 2:i.y+=o.consts.nodeHeight/2-1;break;case 3:i.x-=51}return i},p.prototype.zoomed=function(t){t=t||d3.event.transform,this.state.justScaleTransGraph=!0,d3.select("."+this.consts.graphClass).attr("transform",t),this.transformed=t,this.hiddenList.style("display","none"),this.minimap&&this.minimap.update(t)},p.prototype.updateWindow=function(t){const e=document.documentElement,n=document.getElementsByTagName("body")[0],o=window.innerWidth||e.clientWidth||n.clientWidth,i=window.innerHeight||e.clientHeight||n.clientHeight;t.attr("width",o).attr("height",i)},p.prototype.initializeFromSynsetId=function(t){const e=this;e.api.getGraph(t,function(t){!function(t){t.length<1?window.alert("Sorry, could not display requested data."):e.initFromJson(t)}(t)})},p.prototype.exportVisualization=function(){const t=this.getSVGString(this.svg.node());this.svgString2Image(t,2*this.width,2*this.height,"png",function(t,e){Object(a.saveAs)(t,"wordnet-graph.png")})},p.prototype.getSVGString=function(t){t.setAttribute("xlink","http://www.w3.org/1999/xlink"),function(t,e){const n=document.createElement("style");n.setAttribute("type","text/css"),n.innerHTML=t;const o=e.hasChildNodes()?e.children[0]:null;e.insertBefore(n,o)}(function(t){let e=[];e.push("#"+t.id);for(let n=0;n<t.classList.length;n++)i("."+t.classList[n],e)||e.push("."+t.classList[n]);const n=t.getElementsByTagName("*");for(let t=0;t<n.length;t++){let o=n[t].id;i("#"+o,e)||e.push("#"+o);const r=n[t].classList;for(let t=0;t<r.length;t++)i("."+r[t],e)||e.push("."+r[t])}let o="";for(let t=0;t<document.styleSheets.length;t++){let n=document.styleSheets[t];try{if(!n.cssRules)continue}catch(t){if("SecurityError"!==t.name)throw t;continue}let r=n.cssRules;for(let t=0;t<r.length;t++)i(r[t].selectorText,e)&&(o+=r[t].cssText)}return o;function i(t,e){return!(-1===e.indexOf(t))}}(t),t);let e=(new XMLSerializer).serializeToString(t);return e=(e=e.replace(/(\w+)?:?xlink=/g,"xmlns:xlink=")).replace(/NS\d+:href/g,"xlink:href")},p.prototype.svgString2Image=function(t,e,n,o,i){o=o||"png";const r="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(t))),s=document.createElement("canvas"),a=s.getContext("2d");s.width=e,s.height=n;const d=new Image;d.onload=function(){a.clearRect(0,0,e,n),a.drawImage(d,0,0,e,n),s.toBlob(function(t){const e=Math.round(t.length/1024)+" KB";i&&i(t,e)})},d.src=r},p.prototype.resetZoom=function(){const t=this;let e=d3.zoomIdentity;t.zoomed(e),t.svg.property("__zoom",e),t.minimap&&t.minimap.resetScale()},p.prototype.resizeSVG=function(t,e){this.svg.attr("width",t).attr("height",e)}},function(t,e,n){"use strict";n.r(e),n.d(e,"GraphNode",function(){return a});var o=n(0),i=n(2),r=n(1);let s={calculateEllipseY:function(t,e,n,o,i,r){return r?o+Math.sqrt(e*e-(1-(i-n)*(i-n))/(t*t)):o-Math.sqrt(e*e-(1-(i-n)*(i-n))/(t*t))},calculateEllipseX:function(t,e,n,o,i,r){return r?n-Math.sqrt(e*e-(1-(i-o)*(i-o))/(t*t)):n+Math.sqrt(e*e-(1-(i-o)*(i-o))/(t*t))},distributeNode:function(t,e,n){return-(n*t*2)/2+2*t*(e+1)-t},assignPlace:function(t,e,n,o,r){const a=i.GraphCreator.prototype.consts;switch(r=r>=a.maxDefaultNodesHorizontally?a.maxDefaultNodesHorizontally:r,t){case"top":n.x=e.x+s.distributeNode(a.nodeWidth+2,o,r),n.y=-200+s.calculateEllipseY(8,1,e.x,e.y,n.x,!0);break;case"right":n.y=e.y+s.distributeNode(a.nodeHeight-15,o,r),n.x=200+s.calculateEllipseX(3,1,e.x,e.y,n.y,!0);break;case"bottom":n.x=e.x+s.distributeNode(a.nodeWidth+10,o,r),n.y=e.y+a.nodeDistance,n.y=200+s.calculateEllipseY(8,1,e.x,e.y,n.x,!1);break;case"left":n.x=e.x-a.nodeDistance,n.y=e.y+s.distributeNode(a.nodeHeight-15,o,r),n.x=-200+s.calculateEllipseX(3,1,e.x,e.y,n.y,!1)}}};const a=function(t,e,n,o,i,r,s,a,d){let l=this;l.graph=i,t&&(l.parentId=o.id||null,l.parent=o||null,t=l.prepareJson(t),l.id=t.id,l.label=t.label,l.partOfSpeechId=t.pos,l.lexicon=t.lex,l.assignColorBasedFromPartOfSpeech(),l.x=e||0,l.y=n||0,l.childrenTop=t.top.expanded.concat(t.top.hidden),l.childrenRight=t.right.expanded.concat(t.right.hidden),l.childrenBottom=t.bottom.expanded.concat(t.bottom.hidden),l.childrenLeft=t.left.expanded.concat(t.left.hidden),l.parentRel=t.rel,l.childrenTopRef=[],l.childrenRightRef=[],l.childrenBottomRef=[],l.childrenLeftRef=[],l.cumulativeNodes={},l.addCumulativeChildren(t),l.initChildren(t.top.expanded,t.right.expanded,t.bottom.expanded,t.left.expanded)),l.selected=!1,l.expandedTop=r||!1,l.expandedRight=s||!1,l.expandedLeft=d||!1,l.expandedBottom=a||!1,l.childrenDownloaded=!1};a.prototype.reset=function(){this.expandedTop=!1,this.expandedRight=!1,this.expandedLeft=!1,this.expandedBottom=!1},a.prototype.assignPlace=function(t,e,n){s.assignPlace(t,this.parent,this,e,n)},a.prototype.initChildren=function(t,e,n,o){const i=this;function r(t,e,n){let o,r=t.length+i[e].length;for(let s=0;s<t.length;s++)(o=i.graph.nodes.get(t[s].id))||((o=new a(t[s],0,0,i,i.graph)).assignPlace(n,s,r),i[e].push(o));i.childrenDownloaded=!0}r(t,"childrenTopRef","top"),r(e,"childrenRightRef","right"),r(n,"childrenBottomRef","bottom"),r(o,"childrenLeftRef","left")},a.prototype.prepareJson=function(t){function e(t,e){t[e]||(t[e]={expanded:[],hidden:[]}),t[e].expanded||(t[e].expanded=[]),t[e].hidden||(t[e].hidden=[])}return e(t,"top"),e(t,"right"),e(t,"bottom"),e(t,"left"),t},a.prototype.addCumulativeChildren=function(t){const e=this;function n(n){let o;e.cumulativeNodes[n]=null,t[n].hidden.length>0&&0!==t[n].expanded.length&&((o=new d({id:-t[n].hidden[0].id,type:{color:"green"},rel:[null,null]},e,t[n].hidden,n)).assignPlace(n,e["children"+n.charAt(0).toUpperCase()+n.slice(1)+"Ref"].length+1,e["children"+n.charAt(0).toUpperCase()+n.slice(1)+"Ref"].length-2),e["children"+n.charAt(0).toUpperCase()+n.slice(1)+"Ref"].push(o)),e.cumulativeNodes[n]=o}n("top"),n("right"),n("bottom"),n("left")},a.prototype.addChildrenAtPosIfNotParent=function(t,e){let n=this;n[e]=n[e].concat(t.filter(t=>t.id!==n.parentId))},a.prototype.addToCumulativeNode=function(t,e){const n=this;e=["top","right","bottom","left"][e],t.forEach(t=>{n.cumulativeNodes[e].addHiddenNode(t)})},a.prototype.updateChildrenPosition=function(t){let e=this,n=["Top","Right","Bottom","Left"][t],o=e["children"+n+"Ref"],i=o.slice(5);i.length>0&&e.addToCumulativeNode(i,t),o=o.slice(0,5),e["children"+n+"Ref"]=o,o.forEach((t,e)=>{t.assignPlace(n.toLowerCase(),e,o.length)})},a.prototype.updateChildren=function(t,e){this.childrenDownloaded||(t=this.prepareJson(t),this.addChildrenAtPosIfNotParent(t.top.hidden,"childrenTop"),this.addChildrenAtPosIfNotParent(t.right.hidden,"childrenRight"),this.addChildrenAtPosIfNotParent(t.bottom.hidden,"childrenBottom"),this.addChildrenAtPosIfNotParent(t.left.hidden,"childrenLeft"),this.childrenTopRef=[],this.childrenRightRef=[],this.childrenBottomRef=[],this.childrenLeftRef=[],this.addCumulativeChildren(t),this.initChildren(t.top.expanded,t.right.expanded,t.bottom.expanded,t.left.expanded),this.expandedTop=0===e,this.expandedRight=1===e,this.expandedBottom=2===e,this.expandedLeft=3===e,this.childrenDownloaded=!0)},a.prototype.markSelected=function(){this.selected=!0},a.prototype.unmarkSelected=function(){this.selected=!1},a.prototype.assignColorBasedFromPartOfSpeech=function(){let t;t=i.consts.partOfSpeech[this.partOfSpeechId]?i.consts.partOfSpeech[this.partOfSpeechId].color:"#F0E68C",this.type={color:t}},a.prototype.nodeType="ordinary",a.prototype.getType=function(){return"ordinary"},a.prototype.api=o.apiConnector,a.prototype.consts={DIRECTIONS:{TOP:0,RIGHT:1,BOTTOM:2,LEFT:3}},a.prototype.getChildrenWithCallback=function(t){const e=this;e.childrenDownloaded?t(e.apiData):e.api.getGraph(e.id,function(n){e.apiData=n,t(n)})},a.prototype.expandTopClick=function(t,e){this.expandedTop=!0,this.findNewPlace(t),this.getChildrenWithCallback(e)},a.prototype.expandRightClick=function(t,e){this.expandedRight=!0,this.findNewPlace(t),this.getChildrenWithCallback(e)},a.prototype.expandBottomClick=function(t,e){this.expandedBottom=!0,this.findNewPlace(t),this.getChildrenWithCallback(e)},a.prototype.expandLeftClick=function(t,e){this.expandedLeft=!0,this.findNewPlace(t),this.getChildrenWithCallback(e)},a.prototype.moveChildren=function(t){const e=this.getAllChildrenRef();for(let n=0;n<e.length;n++){let o=[e[n].x-t[0],e[n].y-t[1]];e[n].assignNewPosition(o),e[n].moveChildren(t)}},a.prototype.getChildrenAtPosition=function(t){const e=this;switch(t){case 0:return e.childrenTopRef;case 1:return e.childrenRightRef;case 2:return e.childrenBottomRef;case 3:return e.childrenLeftRef}},a.prototype.connectionPointTypes={0:[0,2],1:[1,3],2:[2,0],3:[3,1],top:[0,2],right:[1,3],bottom:[2,0],left:[3,1]},a.prototype.getConnectionWithNode=function(t){const e=this;for(let[n,o]of["childrenTop","childrenRight","childrenBottom","childrenLeft"].entries()){let i=e[o].filter(e=>e.id===t.id)[0];if(i)return new r.Edge(e,t,e.connectionPointTypes[n],i.rel)}return null},a.prototype.getAllChildren=function(){return this.childrenTop.concat(this.childrenRight,this.childrenBottom,this.childrenLeft)},a.prototype.getAllChildrenRef=function(){return this.childrenTopRef.concat(this.childrenRightRef,this.childrenBottomRef,this.childrenLeftRef)},a.prototype.assignNewPosition=function(t){this.x=t[0],this.y=t[1]},a.prototype.findNewPlace=function(t){const e=this;let n=[e.x,e.y],o=20,i=10;for(;!e.checkIfSpaceInRegion(n,t)&&i>0;)n=e.calculatePossibleNewPosition(o),o+=20,i--;return e.moveChildren([e.x-n[0],e.y-n[1]]),e.assignNewPosition(n),n},a.prototype.checkIfSpaceInRegion=function(t,e){const n=this,o=t[0],i=t[1],r=n.getAllChildrenRef();for(let[t,s]of e){if(r.indexOf(s)>-1)continue;const t=s.x,e=s.y;if(n.expandedTop&&n.checkIfPointInRange(t,e,o-500,o+500,i-500,i))return!1;if(n.expandedRight&&n.checkIfPointInRange(t,e,o,o+1e3,i-250,i+250))return!1;if(n.expandedBottom&&n.checkIfPointInRange(t,e,o-500,o+500,i,i+500))return!1;if(n.expandedLeft&&n.checkIfPointInRange(t,e,o-1e3,o,i-250,i+250))return!1}return!0},a.prototype.checkIfPointInRange=function(t,e,n,o,i,r){return t>n&&t<o&&(e>i&&e<r)},a.prototype.calculatePossibleNewPosition=function(t){const e=this,n=e.parent,o=n.x-e.x,i=n.y-e.y;let r=e.x,s=e.y;if(!e.parent.x||!e.parent.y)return[r,s];const a=i/o;return 0===o||Math.abs(o)<50?s=i>0?e.y-t:e.y+t:0===i&&o<0?r=e.x+t:i<0?a<0?(r=e.x-t,s=e.y-t*a):(r=e.x+t,s=e.y+t*a):a<0?(r=e.x+t,s=e.y+t*a):(r=e.x-t,s=e.y-t*a),[r,s]},a.prototype.isNodeCumulator=function(){return!1},a.prototype.expandTriangleClick=function(t,e,n){const o=this,i=["expandedTop","expandedRight","expandedBottom","expandedLeft"][n],r=["expandTopClick","expandRightClick","expandBottomClick","expandLeftClick"][n];o[i]?(o[i]=!1,t.removeNodeChildren(o,n),d3.select(e).classed("expanded",!1)):o[r](t.nodes,function(i){o.updateChildren(i,n),o.updateChildrenPosition(n),t.updateWithChildrenNodes(o),d3.select(e).classed("expanded",!0)})};const d=function(t,e,n,o){a.call(this,t,100,100,e,e.graph),this.hiddenNodes=n||[],this.positionRelativeToParent=o,this.label=this.hiddenNodes.length,this.hiddenButVisible=0,this.childrenTop=[],this.childrenRight=[],this.childrenBottom=[],this.childrenLeft=[]};d.prototype=new a,d.prototype.constructor=d,d.prototype.nodeType="cumulator",d.prototype.getType=function(){return"cumulator"},d.prototype.getHiddenNodes=function(){return this.hiddenNodes},d.prototype.updateCount=function(){this.label=this.hiddenNodes.length-this.hiddenButVisible},d.prototype.decrementTitle=function(){const t=this;t.label-=1,0===t.label&&this.graph.removeNode(t)},d.prototype.expandHiddenNode=function(t,e){const n=this;n.graph.hiddenList.style("display","none"),n.api.getGraph(t.id,function(e){e.rel=t.rel;let o=new a(e,n.x+100+Math.floor(20*Math.random()-10),n.y+100+ +Math.floor(20*Math.random()-10),n.parent,n.graph);o.childrenDownloaded=!0,n.parent["children"+n.positionRelativeToParent.charAt(0).toUpperCase()+n.positionRelativeToParent.slice(1)+"Ref"].push(o),n.graph.nodes.set(o.id,o);let i=n.connectionPointTypes[n.positionRelativeToParent];n.hiddenNodes.splice(n.hiddenNodes.indexOf(t),1),n.decrementTitle(),n.graph.edges.add(new r.Edge(n.parent,o,i,o.parentRel)),n.graph.addEdgesBetweenNewNodes([o]),n.graph.updateGraph()})},d.prototype.addOnclickToCreatedNodes=function(t,e,n){const o=this;for(let t=0;t<e.length;t++)!function(t){let i=e[t];d3.select(i).on("click",function(){o.expandHiddenNode(n[t],o)})}(t)},d.prototype.isNodeCumulator=function(){return!0},d.prototype.getHiddenListHtml=function(){const t=this;let e={html:"",createdIds:[],hiddenRef:[]};return e.html="<ul class='hidden-nodes-list'>",t.hiddenButVisible=0,t.hiddenNodes.forEach((n,o)=>{t.graph.nodes.has(n.id)?t.hiddenButVisible++:(e.html+="\n<li id='hidden-"+n.id+"'>"+n.label+"</li>",e.createdIds.push("#hidden-"+n.id),e.hiddenRef.push(t.hiddenNodes[o]))}),e.html+="\n</ul>",t.updateCount(),e},d.prototype.addHiddenNode=function(t){this.hiddenNodes.push({id:t.id,label:t.label,rel:t.parentRel,pos:t.partOfSpeechId}),this.label+=1}},function(t,e,n){"use strict";n.r(e),function(t){n.d(e,"saveAs",function(){return o});
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
var o=o||function(t){if("undefined"==typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var e=function(){return t.URL||t.webkitURL||t},n=t.document.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in n,i=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),r=t.webkitRequestFileSystem,s=t.requestFileSystem||r||t.mozRequestFileSystem,a=function(e){(t.setImmediate||t.setTimeout)(function(){throw e},0)},d="application/octet-stream",l=0,c=function(t){setTimeout(function(){"string"==typeof t?e().revokeObjectURL(t):t.remove()},4e4)},h=function(t,e,n){for(var o=(e=[].concat(e)).length;o--;){var i=t["on"+e[o]];if("function"==typeof i)try{i.call(t,n||t)}catch(t){a(t)}}},p=function(t){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t},u=function(a,u,f){f||(a=p(a));var g,y,m,x=this,v=a.type,w=!1,b=function(){h(x,"writestart progress write writeend".split(" "))},k=function(){if(y&&i&&"undefined"!=typeof FileReader){var n=new FileReader;return n.onloadend=function(){var t=n.result;y.location.href="data:attachment/file"+t.slice(t.search(/[,;]/)),x.readyState=x.DONE,b()},n.readAsDataURL(a),void(x.readyState=x.INIT)}((w||!g)&&(g=e().createObjectURL(a)),y)?y.location.href=g:void 0===t.open(g,"_blank")&&i&&(t.location.href=g);x.readyState=x.DONE,b(),c(g)},C=function(t){return function(){return x.readyState!==x.DONE?t.apply(this,arguments):void 0}},T={create:!0,exclusive:!1};return x.readyState=x.INIT,u||(u="download"),o?(g=e().createObjectURL(a),void setTimeout(function(){var t,e;n.href=g,n.download=u,t=n,e=new MouseEvent("click"),t.dispatchEvent(e),b(),c(g),x.readyState=x.DONE})):(t.chrome&&v&&v!==d&&(m=a.slice||a.webkitSlice,a=m.call(a,0,a.size,d),w=!0),r&&"download"!==u&&(u+=".download"),(v===d||r)&&(y=t),s?(l+=a.size,void s(t.TEMPORARY,l,C(function(t){t.root.getDirectory("saved",T,C(function(t){var e=function(){t.getFile(u,T,C(function(t){t.createWriter(C(function(e){e.onwriteend=function(e){y.location.href=t.toURL(),x.readyState=x.DONE,h(x,"writeend",e),c(t)},e.onerror=function(){var t=e.error;t.code!==t.ABORT_ERR&&k()},"writestart progress write abort".split(" ").forEach(function(t){e["on"+t]=x["on"+t]}),e.write(a),x.abort=function(){e.abort(),x.readyState=x.DONE},x.readyState=x.WRITING}),k)}),k)};t.getFile(u,{create:!1},C(function(t){t.remove(),e()}),C(function(t){t.code===t.NOT_FOUND_ERR?e():k()}))}),k)}),k)):void k())},f=u.prototype;return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(t,e,n){return n||(t=p(t)),navigator.msSaveOrOpenBlob(t,e||"download")}:(f.abort=function(){var t=this;t.readyState=t.DONE,h(t,"abort")},f.readyState=f.INIT=0,f.WRITING=1,f.DONE=2,f.error=f.onwritestart=f.onprogress=f.onwrite=f.onabort=f.onerror=f.onwriteend=null,function(t,e,n){return new u(t,e,n)})}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||(void 0).content);void 0!==t&&t.exports?t.exports.saveAs=o:"undefined"!=typeof define&&null!==define&&null!==n(6)&&define([],function(){return o})}.call(this,n(7)(t))},function(t,e){d3.minimap=function(){"use strict";var t=.15,e=.15,n=null,o=null,i=100,r=100,s=100,a=100,d=0,l=0,c=[];function h(p){p;var u=d3.zoom().scaleExtent([.5,5]),f=function(){var t=g.property("__zoom").k,e=parseInt(o.attr("width")),i=parseInt(o.attr("height")),r=n.getWidth(),s=n.getHeight();u.translateExtent([[-r/t,-s/t],[r/t+e,s/t+i]])};u.on("zoom",function(){if(y.attr("transform",d3.event.transform),d3.event.sourceEvent instanceof MouseEvent||d3.event.sourceEvent instanceof WheelEvent){var t=d3.event.transform,e=d3.zoomIdentity.scale(1/t.k).translate(-t.x,-t.y);n.update(e)}f()});var g=p.append("g").attr("class","minimap");g.call(u),h.node=g.node();var y=g.append("g").attr("class","frame");y.append("rect").attr("class","background").attr("width",i).attr("height",r),c.forEach(t=>{g.append("use").attr("xlink:href",t)}),h.update=function(t){var e=d3.zoomIdentity.scale(1/t.k).translate(-t.x,-t.y);u.transform(y,e),g.property("__zoom",e),f()};let m={x:null,y:null,xRatio:null,yRatio:null,widthRatio:null,heightRatio:null};h.resetScale=function(){m={x:null,y:null,xRatio:null,yRatio:null,widthRatio:null,heightRatio:null},t=e,d=0,l=0,i=s,r=a},h.render=function(){g.attr("transform","translate("+d+","+l+")scale("+t+")"),y.select(".background").attr("width",i).attr("height",r),y.node().parentNode.appendChild(y.node())},h.updateMaxValues=function(n){let o=n.x.max-n.x.min,s=n.y.max-n.y.min;if(!m.x||!m.y)return m.x=o,m.y=s,m.xRatio=o*t,void(m.yRatio=s*t);let a=Math.min(m.xRatio/o,m.yRatio/s);a<t&&(d=(i*e-i*a)/2,l=(r*e-r*a)/2,t=a)},f()}return h.targetShadowId=function(t){return c.push(t),this},h.width=function(t){return arguments.length?(i=parseInt(t,10),this):i},h.height=function(t){return arguments.length?(r=parseInt(t,10),this):r},h.x=function(t){return arguments.length?(d=parseInt(t,10),this):d},h.y=function(t){return arguments.length?(l=parseInt(t,10),this):l},h.host=function(t){return arguments.length?(n=t,this):n},h.minimapScale=function(n){return arguments.length?(e=t=n,this):t},h.target=function(t){return arguments.length?(o=t,s=i=parseInt(o.attr("width"),10),a=r=parseInt(o.attr("height"),10),this):o},h}},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e){t.exports=function(t){if(!t.webpackPolyfill){var e=Object.create(t);e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(e,"exports",{enumerable:!0}),e.webpackPolyfill=1}return e}},function(t,e){ var o=o||function(t){if("undefined"==typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var e=function(){return t.URL||t.webkitURL||t},n=t.document.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in n,i=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),r=t.webkitRequestFileSystem,s=t.requestFileSystem||r||t.mozRequestFileSystem,a=function(e){(t.setImmediate||t.setTimeout)(function(){throw e},0)},d="application/octet-stream",l=0,c=function(t){setTimeout(function(){"string"==typeof t?e().revokeObjectURL(t):t.remove()},4e4)},h=function(t,e,n){for(var o=(e=[].concat(e)).length;o--;){var i=t["on"+e[o]];if("function"==typeof i)try{i.call(t,n||t)}catch(t){a(t)}}},p=function(t){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t},u=function(a,u,f){f||(a=p(a));var g,y,m,x=this,v=a.type,w=!1,b=function(){h(x,"writestart progress write writeend".split(" "))},k=function(){if(y&&i&&"undefined"!=typeof FileReader){var n=new FileReader;return n.onloadend=function(){var t=n.result;y.location.href="data:attachment/file"+t.slice(t.search(/[,;]/)),x.readyState=x.DONE,b()},n.readAsDataURL(a),void(x.readyState=x.INIT)}((w||!g)&&(g=e().createObjectURL(a)),y)?y.location.href=g:void 0===t.open(g,"_blank")&&i&&(t.location.href=g);x.readyState=x.DONE,b(),c(g)},C=function(t){return function(){return x.readyState!==x.DONE?t.apply(this,arguments):void 0}},T={create:!0,exclusive:!1};return x.readyState=x.INIT,u||(u="download"),o?(g=e().createObjectURL(a),void setTimeout(function(){var t,e;n.href=g,n.download=u,t=n,e=new MouseEvent("click"),t.dispatchEvent(e),b(),c(g),x.readyState=x.DONE})):(t.chrome&&v&&v!==d&&(m=a.slice||a.webkitSlice,a=m.call(a,0,a.size,d),w=!0),r&&"download"!==u&&(u+=".download"),(v===d||r)&&(y=t),s?(l+=a.size,void s(t.TEMPORARY,l,C(function(t){t.root.getDirectory("saved",T,C(function(t){var e=function(){t.getFile(u,T,C(function(t){t.createWriter(C(function(e){e.onwriteend=function(e){y.location.href=t.toURL(),x.readyState=x.DONE,h(x,"writeend",e),c(t)},e.onerror=function(){var t=e.error;t.code!==t.ABORT_ERR&&k()},"writestart progress write abort".split(" ").forEach(function(t){e["on"+t]=x["on"+t]}),e.write(a),x.abort=function(){e.abort(),x.readyState=x.DONE},x.readyState=x.WRITING}),k)}),k)};t.getFile(u,{create:!1},C(function(t){t.remove(),e()}),C(function(t){t.code===t.NOT_FOUND_ERR?e():k()}))}),k)}),k)):void k())},f=u.prototype;return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(t,e,n){return n||(t=p(t)),navigator.msSaveOrOpenBlob(t,e||"download")}:(f.abort=function(){var t=this;t.readyState=t.DONE,h(t,"abort")},f.readyState=f.INIT=0,f.WRITING=1,f.DONE=2,f.error=f.onwritestart=f.onprogress=f.onwrite=f.onabort=f.onerror=f.onwriteend=null,function(t,e,n){return new u(t,e,n)})}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||(void 0).content);void 0!==t&&t.exports?t.exports.saveAs=o:"undefined"!=typeof define&&null!==define&&null!==n(6)&&define([],function(){return o})}.call(this,n(7)(t))},function(t,e){d3.minimap=function(){"use strict";var t=.15,e=.15,n=null,o=null,i=100,r=100,s=100,a=100,d=0,l=0,c=[];function h(p){p;var u=d3.zoom().scaleExtent([.5,5]),f=function(){var t=g.property("__zoom").k,e=parseInt(o.attr("width")),i=parseInt(o.attr("height")),r=n.getWidth(),s=n.getHeight();u.translateExtent([[-r/t,-s/t],[r/t+e,s/t+i]])};u.on("zoom",function(){if(y.attr("transform",d3.event.transform),d3.event.sourceEvent instanceof MouseEvent||d3.event.sourceEvent instanceof WheelEvent){var t=d3.event.transform,e=d3.zoomIdentity.scale(1/t.k).translate(-t.x,-t.y);n.update(e)}f()});var g=p.append("g").attr("class","minimap");g.call(u),h.node=g.node();var y=g.append("g").attr("class","frame");y.append("rect").attr("class","background").attr("width",i).attr("height",r),c.forEach(t=>{g.append("use").attr("xlink:href",t)}),h.update=function(t){var e=d3.zoomIdentity.scale(1/t.k).translate(-t.x,-t.y);u.transform(y,e),g.property("__zoom",e),f()};let m={x:null,y:null,xRatio:null,yRatio:null,widthRatio:null,heightRatio:null};h.resetScale=function(){m={x:null,y:null,xRatio:null,yRatio:null,widthRatio:null,heightRatio:null},t=e,d=0,l=0,i=s,r=a},h.render=function(){g.attr("transform","translate("+d+","+l+")scale("+t+")"),y.select(".background").attr("width",i).attr("height",r),y.node().parentNode.appendChild(y.node())},h.updateMaxValues=function(n){let o=n.x.max-n.x.min,s=n.y.max-n.y.min;if(!m.x||!m.y)return m.x=o,m.y=s,m.xRatio=o*t,void(m.yRatio=s*t);let a=Math.min(m.xRatio/o,m.yRatio/s);a<t&&(d=(i*e-i*a)/2,l=(r*e-r*a)/2,t=a)},f()}return h.targetShadowId=function(t){return c.push(t),this},h.width=function(t){return arguments.length?(i=parseInt(t,10),this):i},h.height=function(t){return arguments.length?(r=parseInt(t,10),this):r},h.x=function(t){return arguments.length?(d=parseInt(t,10),this):d},h.y=function(t){return arguments.length?(l=parseInt(t,10),this):l},h.host=function(t){return arguments.length?(n=t,this):n},h.minimapScale=function(n){return arguments.length?(e=t=n,this):t},h.target=function(t){return arguments.length?(o=t,s=i=parseInt(o.attr("width"),10),a=r=parseInt(o.attr("height"),10),this):o},h}},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e){t.exports=function(t){if(!t.webpackPolyfill){var e=Object.create(t);e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(e,"exports",{enumerable:!0}),e.webpackPolyfill=1}return e}},function(t,e){
/*! @source http://purl.eligrey.com/github/canvas-toBlob.js/blob/master/canvas-toBlob.js */ /*! @source http://purl.eligrey.com/github/canvas-toBlob.js/blob/master/canvas-toBlob.js */
!function(t){"use strict";var e,n=t.Uint8Array,o=t.HTMLCanvasElement,i=o&&o.prototype,r=/\s*;\s*base64\s*(?:;|$)/i,s="toDataURL";n&&(e=new n([62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,0,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51])),!o||i.toBlob&&i.toBlobHD||(i.toBlob||(i.toBlob=function(t,o){if(o||(o="image/png"),this.mozGetAsFile)t(this.mozGetAsFile("canvas",o));else if(this.msToBlob&&/^\s*image\/png\s*(?:$|;)/i.test(o))t(this.msToBlob());else{var i,a=Array.prototype.slice.call(arguments,1),d=this[s].apply(this,a),l=d.indexOf(","),c=d.substring(l+1),h=r.test(d.substring(0,l));Blob.fake?((i=new Blob).encoding=h?"base64":"URI",i.data=c,i.size=c.length):n&&(i=h?new Blob([function(t){for(var o,i,r=t.length,s=new n(r/4*3|0),a=0,d=0,l=[0,0],c=0,h=0;r--;)i=t.charCodeAt(a++),255!==(o=e[i-43])&&void 0!==o&&(l[1]=l[0],l[0]=i,h=h<<6|o,4==++c&&(s[d++]=h>>>16,61!==l[1]&&(s[d++]=h>>>8),61!==l[0]&&(s[d++]=h),c=0));return s}(c)],{type:o}):new Blob([decodeURIComponent(c)],{type:o})),t(i)}}),!i.toBlobHD&&i.toDataURLHD?i.toBlobHD=function(){s="toDataURLHD";var t=this.toBlob();return s="toDataURL",t}:i.toBlobHD=i.toBlob)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content||this)},function(t,e,n){n(8),n(4),n(0),n(1),n(3),n(5),t.exports=n(2)}]); !function(t){"use strict";var e,n=t.Uint8Array,o=t.HTMLCanvasElement,i=o&&o.prototype,r=/\s*;\s*base64\s*(?:;|$)/i,s="toDataURL";n&&(e=new n([62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,0,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51])),!o||i.toBlob&&i.toBlobHD||(i.toBlob||(i.toBlob=function(t,o){if(o||(o="image/png"),this.mozGetAsFile)t(this.mozGetAsFile("canvas",o));else if(this.msToBlob&&/^\s*image\/png\s*(?:$|;)/i.test(o))t(this.msToBlob());else{var i,a=Array.prototype.slice.call(arguments,1),d=this[s].apply(this,a),l=d.indexOf(","),c=d.substring(l+1),h=r.test(d.substring(0,l));Blob.fake?((i=new Blob).encoding=h?"base64":"URI",i.data=c,i.size=c.length):n&&(i=h?new Blob([function(t){for(var o,i,r=t.length,s=new n(r/4*3|0),a=0,d=0,l=[0,0],c=0,h=0;r--;)i=t.charCodeAt(a++),255!==(o=e[i-43])&&void 0!==o&&(l[1]=l[0],l[0]=i,h=h<<6|o,4==++c&&(s[d++]=h>>>16,61!==l[1]&&(s[d++]=h>>>8),61!==l[0]&&(s[d++]=h),c=0));return s}(c)],{type:o}):new Blob([decodeURIComponent(c)],{type:o})),t(i)}}),!i.toBlobHD&&i.toDataURLHD?i.toBlobHD=function(){s="toDataURLHD";var t=this.toBlob();return s="toDataURL",t}:i.toBlobHD=i.toBlob)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content||this)},function(t,e,n){n(8),n(4),n(0),n(1),n(3),n(5),t.exports=n(2)}]);
\ No newline at end of file
...@@ -185,7 +185,7 @@ PlWordnet.prototype.createAdditionalInfo = function(jsonData, title, titleEn, la ...@@ -185,7 +185,7 @@ PlWordnet.prototype.createAdditionalInfo = function(jsonData, title, titleEn, la
'<a href="/synsetid/plwordnet/' + element2.synset + '">' + '<a href="/synsetid/plwordnet/' + element2.synset + '">' +
'<p class="title">' + element2.lemma + '</p>' + '<p class="title">' + element2.lemma + '</p>' +
'</a>' + '</a>' +
'<img width="40" height="20" class="img-responsive show-icon" src="http://lexp-dev.clarin-pl.eu/img/lang-' + lang + '-32.png" alt="Language" />' + `<img width="40" height="20" class="img-responsive show-icon" src="/img/lang-${lang}-32.png" alt="Language" />` +
definition + definition +
horizontalLine; horizontalLine;
}); });
...@@ -195,7 +195,7 @@ PlWordnet.prototype.createAdditionalInfo = function(jsonData, title, titleEn, la ...@@ -195,7 +195,7 @@ PlWordnet.prototype.createAdditionalInfo = function(jsonData, title, titleEn, la
let data = let data =
'<div class="plwordnet-box">' + '<div class="plwordnet-box">' +
'<h2>' + '<h2>' +
'<img class="img-responsive show-icon" src="http://lexp-dev.clarin-pl.eu/img/lang-' + lang + '-32.png" alt="Language" />' + '<img class="img-responsive show-icon" src="/img/lang-' + lang + '-32.png" alt="Language" />' +
'<span lang="pl">' + title + ' (' + quantity + ')' + '</span>' + '<span lang="pl">' + title + ' (' + quantity + ')' + '</span>' +
'<span lang="en">' + titleEn + ' (' + quantity + ')' + '</span>' + '<span lang="en">' + titleEn + ' (' + quantity + ')' + '</span>' +
'</h2>' + '</h2>' +
...@@ -246,7 +246,7 @@ PlWordnet.prototype.showHTMLForSynset = function() { ...@@ -246,7 +246,7 @@ PlWordnet.prototype.showHTMLForSynset = function() {
'<div class="fixed-space category"><span lang="pl">Słowo</span><span lang="en">Word</span></div>' + '<div class="fixed-space category"><span lang="pl">Słowo</span><span lang="en">Word</span></div>' +
'<div class="fixed-space">' + '<div class="fixed-space">' +
'<h2 class="lemma">' + element.lemma + '</h2>' + '<h2 class="lemma">' + element.lemma + '</h2>' +
'<img class="img-responsive show-icon" src="http://lexp-dev.clarin-pl.eu/img/lang-' + language + '-32.png" alt="Language" />' + '<img class="img-responsive show-icon" src="/img/lang-' + language + '-32.png" alt="Language" />' +
'<p class="description">' + definition + '</p>' + '<p class="description">' + definition + '</p>' +
'</div>' + '</div>' +
'<hr />' + '<hr />' +
......