From 7ac7494d78a6f2cce334b89d9155689a1921f28f Mon Sep 17 00:00:00 2001 From: srosset81 Date: Tue, 14 Feb 2023 12:25:32 +0100 Subject: [PATCH] Upload single file --- .../semantic-data-provider/dist/index.cjs.js | 2 +- .../dist/index.cjs.js.map | 2 +- .../semantic-data-provider/dist/index.es.js | 4 +- .../dist/index.es.js.map | 2 +- .../src/dataProvider/methods/create.js | 69 +++++++++++++------ 5 files changed, 53 insertions(+), 26 deletions(-) diff --git a/src/frontend/packages/semantic-data-provider/dist/index.cjs.js b/src/frontend/packages/semantic-data-provider/dist/index.cjs.js index 2aff4a614..1e322ac78 100644 --- a/src/frontend/packages/semantic-data-provider/dist/index.cjs.js +++ b/src/frontend/packages/semantic-data-provider/dist/index.cjs.js @@ -1,4 +1,4 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("jsonld"),t=require("speakingurl"),r=require("@rdfjs/data-model"),n=require("crypto"),a=require("react-admin"),o=require("react"),i=require("@material-ui/core/styles");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=s(e),c=s(t),l=s(r),f=s(n),p=s(o);function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function h(e){for(var t=1;t=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;S(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:O(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function y(e){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function b(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){g(o,n,a,i,s,"next",e)}function s(e){g(o,n,a,i,s,"throw",e)}i(void 0)}))}}function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function w(){return(w=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,a,o=[],i=!0,s=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(s)throw a}}return o}(e,t)||j(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||j(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){if(e){if("string"==typeof e)return O(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?O(e,t):void 0}}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}var C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function A(e,t){return e(t={exports:{}},t.exports),t.exports}var P=A((function(e){var t,r;t=C,r=function(){function e(e){var t=[];if(0===e.length)return"";if("string"!=typeof e[0])throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var r=e.shift();e[0]=r+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var n=0;n0&&(a=a.replace(/^[\/]+/,"")),a=n0?"?":"")+i.join("&")}return function(){return e("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}},e.exports?e.exports=r():t.urljoin=r()})),_=function(){var e=b(v().mark((function e(t,r){var n,a,o,i;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.httpClient,a=r.jsonContext,e.next=3,n(t);case 3:if(o=e.sent,(i=o.json).id=i.id||i["@id"],i["@context"]===a){e.next=10;break}return e.next=9,u.default.compact(i,a);case 9:i=e.sent;case 10:return e.abrupt("return",i);case 11:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),L=function(e){return function(){var t=b(v().mark((function t(r,n){var a,o,i,s,u,c,l,f;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=e.resources,i=o[r]){t.next=4;break}throw new Error("Resource ".concat(r," is not mapped in resources file"));case 4:return t.next=6,_(n.id,e);case 6:if(s=t.sent,null!==(a=i.list)&&void 0!==a&&a.forceArray){c=E(null===(u=i.list)||void 0===u?void 0:u.forceArray);try{for(c.s();!(l=c.n()).done;)f=l.value,s[f]&&!Array.isArray(s[f])&&(s[f]=[s[f]])}catch(e){c.e(e)}finally{c.f()}}return t.abrupt("return",{data:s});case 9:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()},N=function(e){return e&&e.rawFile&&e.rawFile instanceof File},T=function(e){var t=Object.keys(e.dataServers).find((function(t){return e.dataServers[t].uploadsContainer}));if(t)return P(e.dataServers[t].baseUrl,e.dataServers[t].uploadsContainer)},q=function(){var e=b(v().mark((function e(t,r){var n,a;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=T(r)){e.next=3;break}throw new Error("You must define an uploadsContainer in one of the server's configuration");case 3:return console.log("upload raw file",y(t),t),e.next=6,r.httpClient(n,{method:"POST",body:t,headers:new Headers({Slug:(o=t.name,i=void 0,s=void 0,i="",s=o.split("."),s.length>1&&(i=s.pop(),o=s.join(".")),c.default(o,{lang:"fr"})+"."+i),"Content-Type":t.type})});case 6:if(201!==(a=e.sent).status){e.next=9;break}return e.abrupt("return",a.headers.get("Location"));case 9:case"end":return e.stop()}var o,i,s}),e)})));return function(t,r){return e.apply(this,arguments)}}(),U=function(){var e=b(v().mark((function e(t,r){var n,a;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=v().keys(t);case 1:if((e.t1=e.t0()).done){e.next=22;break}if(n=e.t1.value,!t.hasOwnProperty(n)){e.next=20;break}if(!Array.isArray(t[n])){e.next=16;break}a=0;case 6:if(!(a1||y[g[0]].length>1)){t.next=18;break}throw new Error("More than one container detected with types ".concat(JSON.stringify(c.types)," on server ").concat(p));case 18:f=y[g[0]][0];case 19:if(!n.data){t.next=34;break}return null!==(b=c.fieldsMapping)&&void 0!==b&&b.title&&(Array.isArray(c.fieldsMapping.title)?l.set("Slug",c.fieldsMapping.title.map((function(e){return n.data[e]})).join(" ")):l.set("Slug",n.data[c.fieldsMapping.title])),t.next=23,U(n.data,e);case 23:return n.data=t.sent,t.next=26,s(f,{method:"POST",headers:l,body:JSON.stringify(h({"@context":u,"@type":c.types},n.data))});case 26:return m=t.sent,w=m.headers,x=w.get("Location"),t.next=31,L(e)(r,{id:x});case 31:return t.abrupt("return",t.sent);case 34:if(!n.id){t.next=41;break}return l.set("Content-Type","application/sparql-update"),t.next=38,s(f,{method:"PATCH",headers:l,body:"\n PREFIX ldp: \n INSERT DATA { <".concat(f,"> ldp:contains <").concat(n.id,">. };\n ")});case 38:return t.next=40,L(e)(r,{id:n.id});case 40:return t.abrupt("return",t.sent);case 41:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()},R=function(e){return function(){var t=b(v().mark((function t(r,n){var a;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.httpClient,t.next=3,a(n.id,{method:"DELETE"});case 3:return t.abrupt("return",{data:{id:n.id}});case 4:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()},F=function(e){return function(){var t=b(v().mark((function t(r,n){var a,o,i,s,u;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a=e.httpClient,o=[],i=E(n.ids),t.prev=3,i.s();case 5:if((s=i.n()).done){t.next=17;break}return u=s.value,t.prev=7,t.next=10,a(u,{method:"DELETE"});case 10:o.push(u),t.next=15;break;case 13:t.prev=13,t.t0=t.catch(7);case 15:t.next=5;break;case 17:t.next=22;break;case 19:t.prev=19,t.t1=t.catch(3),i.e(t.t1);case 22:return t.prev=22,i.f(),t.finish(22);case 25:return t.abrupt("return",{data:o});case 26:case"end":return t.stop()}}),t,null,[[3,19,22,25],[7,13]])})));return function(e,r){return t.apply(this,arguments)}}()},H=function(e){return function(){return e.dataServers}},W=function(e){return function(){return e.resources}};var G=function(){var e=b(v().mark((function e(t,r,n,a){var o,i,s,c,l,f,p;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=a.httpClient,i=a.jsonContext,s=Object.keys(t).reduce((function(e,r){return h(h({},e),Object.fromEntries(t[r].map((function(e){return[e,r]}))))}),{}),c=Object.keys(s).map((function(e){return o(e).then((function(e){var t=e.json;return t["@context"]!==i?u.default.compact(t,i):t})).then((function(t){if(r="ldp:Container",a=(n=t).type||n["@type"],Array.isArray(a)?a.includes(r):a===r)return t["ldp:contains"];throw new Error(e+" is not a LDP container");var r,n,a}))})),e.next=5,Promise.all(c);case 5:if(0!==(l=e.sent).length){e.next=10;break}return e.abrupt("return",{data:[],total:0});case 10:return l=(f=[].concat).apply.apply(f,S(l)),p=l.map((function(e){return e.id=e.id||e["@id"],e})),n.filter&&(n.filter.a&&(n.filter.type=n.filter.a,delete n.filter.a),Object.keys(n.filter).length>0&&(p=p.filter((function(e){return Object.entries(n.filter).some((function(t){var r=k(t,2),n=r[0],a=r[1];return"q"==n?Object.entries(e).some((function(e){var t=k(e,2);t[0];var r,n=t[1];return(null==(r=n)||"object"!=typeof r||!1!==Array.isArray(r))&&(Array.isArray(n)?n.some((function(e){return e.includes(a)})):n.includes(a))})):(Array.isArray(e[n]),e[n].includes(a))}))})))),n.sort&&(p=p.sort((function(e,t){return!e[n.sort.field]||!t[n.sort.field]||("ASC"===n.sort.order?e[n.sort.field].localeCompare(t[n.sort.field]):t[n.sort.field].localeCompare(e[n.sort.field]))}))),n.pagination&&(p=p.slice((n.pagination.page-1)*n.pagination.perPage,n.pagination.page*n.pagination.perPage)),e.abrupt("return",{data:p,total:l.length});case 16:case"end":return e.stop()}}),e)})));return function(t,r,n,a){return e.apply(this,arguments)}}(),z=function(e){var t,r={};if(e){var n,a=E(e);try{for(a.s();!(n=a.n()).done;){var o=n.value;t=o.includes("/")?o.split("/").reverse():[o],r=h(h({},r),t.reduce((function(e,t){return m({},t,h({"@embed":"@last"},e))}),{}))}}catch(e){a.e(e)}finally{a.f()}return r}},J=function(e,t){if(e.startsWith("http://")||e.startsWith("https://"))return e;if("a"===e)return"http://www.w3.org/1999/02/22-rdf-syntax-ns#type";var r=k(e.split(":"),2),n=r[0],a=r[1];if(a){var o=t.find((function(e){return e.prefix===n}));if(o)return o.url+a;throw new Error("No ontology found with prefix "+n)}throw new Error('The value "'.concat(e,'" is not correct. It must include a prefix or be a full URI.'))},$=r.triple(r.variable("s1"),r.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),r.variable("type")),Y=function(e,t){var n,a;return e?(n=(a=e,a?Array.isArray(a)?a:[a]:[]).map((function(e,n){return r.triple(r.variable("s1"),r.namedNode(J(e,t)),r.variable("o"+(n+1)))})),{construct:[$].concat(S(n)),where:[$].concat(S(n.map((function(e){return{type:"optional",patterns:[e]}}))))}):{construct:n=[r.triple(r.variable("s1"),r.variable("p1"),r.variable("o1"))],where:n}},Q=A((function(e,t){var r;e.exports=r=r||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==C&&C.crypto&&(r=C.crypto),!r)try{r=f.default}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),o={},i=o.lib={},s=i.Base={extend:function(e){var t=a(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=i.WordArray=s.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,a=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[n+o>>>2]|=i<<24-(n+o)%4*8}else for(var s=0;s>>2]=r[s>>>2];return this.sigBytes+=a,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-a%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new u.init(r,t/2)}},p=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],a=0;a>>2]>>>24-a%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new u.init(r,t)}},d=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(p.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return p.parse(unescape(encodeURIComponent(e)))}},h=i.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=d.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,a=n.words,o=n.sigBytes,i=this.blockSize,s=o/(4*i),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*i,l=e.min(4*c,o);if(c){for(var f=0;f>>24)|4278255360&(a<<24|a>>>8)}var o=this._hash.words,i=e[t+0],u=e[t+1],d=e[t+2],h=e[t+3],v=e[t+4],y=e[t+5],g=e[t+6],b=e[t+7],m=e[t+8],w=e[t+9],x=e[t+10],k=e[t+11],S=e[t+12],j=e[t+13],O=e[t+14],E=e[t+15],C=o[0],A=o[1],P=o[2],_=o[3];C=c(C,A,P,_,i,7,s[0]),_=c(_,C,A,P,u,12,s[1]),P=c(P,_,C,A,d,17,s[2]),A=c(A,P,_,C,h,22,s[3]),C=c(C,A,P,_,v,7,s[4]),_=c(_,C,A,P,y,12,s[5]),P=c(P,_,C,A,g,17,s[6]),A=c(A,P,_,C,b,22,s[7]),C=c(C,A,P,_,m,7,s[8]),_=c(_,C,A,P,w,12,s[9]),P=c(P,_,C,A,x,17,s[10]),A=c(A,P,_,C,k,22,s[11]),C=c(C,A,P,_,S,7,s[12]),_=c(_,C,A,P,j,12,s[13]),P=c(P,_,C,A,O,17,s[14]),C=l(C,A=c(A,P,_,C,E,22,s[15]),P,_,u,5,s[16]),_=l(_,C,A,P,g,9,s[17]),P=l(P,_,C,A,k,14,s[18]),A=l(A,P,_,C,i,20,s[19]),C=l(C,A,P,_,y,5,s[20]),_=l(_,C,A,P,x,9,s[21]),P=l(P,_,C,A,E,14,s[22]),A=l(A,P,_,C,v,20,s[23]),C=l(C,A,P,_,w,5,s[24]),_=l(_,C,A,P,O,9,s[25]),P=l(P,_,C,A,h,14,s[26]),A=l(A,P,_,C,m,20,s[27]),C=l(C,A,P,_,j,5,s[28]),_=l(_,C,A,P,d,9,s[29]),P=l(P,_,C,A,b,14,s[30]),C=f(C,A=l(A,P,_,C,S,20,s[31]),P,_,y,4,s[32]),_=f(_,C,A,P,m,11,s[33]),P=f(P,_,C,A,k,16,s[34]),A=f(A,P,_,C,O,23,s[35]),C=f(C,A,P,_,u,4,s[36]),_=f(_,C,A,P,v,11,s[37]),P=f(P,_,C,A,b,16,s[38]),A=f(A,P,_,C,x,23,s[39]),C=f(C,A,P,_,j,4,s[40]),_=f(_,C,A,P,i,11,s[41]),P=f(P,_,C,A,h,16,s[42]),A=f(A,P,_,C,g,23,s[43]),C=f(C,A,P,_,w,4,s[44]),_=f(_,C,A,P,S,11,s[45]),P=f(P,_,C,A,E,16,s[46]),C=p(C,A=f(A,P,_,C,d,23,s[47]),P,_,i,6,s[48]),_=p(_,C,A,P,b,10,s[49]),P=p(P,_,C,A,O,15,s[50]),A=p(A,P,_,C,y,21,s[51]),C=p(C,A,P,_,S,6,s[52]),_=p(_,C,A,P,h,10,s[53]),P=p(P,_,C,A,x,15,s[54]),A=p(A,P,_,C,u,21,s[55]),C=p(C,A,P,_,m,6,s[56]),_=p(_,C,A,P,E,10,s[57]),P=p(P,_,C,A,g,15,s[58]),A=p(A,P,_,C,j,21,s[59]),C=p(C,A,P,_,v,6,s[60]),_=p(_,C,A,P,k,10,s[61]),P=p(P,_,C,A,d,15,s[62]),A=p(A,P,_,C,w,21,s[63]),o[0]=o[0]+C|0,o[1]=o[1]+A|0,o[2]=o[2]+P|0,o[3]=o[3]+_|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,a=8*t.sigBytes;r[a>>>5]|=128<<24-a%32;var o=e.floor(n/4294967296),i=n;r[15+(a+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(a+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,u=s.words,c=0;c<4;c++){var l=u[c];u[c]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return s},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,r,n,a,o,i){var s=e+(t&r|~t&n)+a+i;return(s<>>32-o)+t}function l(e,t,r,n,a,o,i){var s=e+(t&n|r&~n)+a+i;return(s<>>32-o)+t}function f(e,t,r,n,a,o,i){var s=e+(t^r^n)+a+i;return(s<>>32-o)+t}function p(e,t,r,n,a,o,i){var s=e+(r^(t|~n))+a+i;return(s<>>32-o)+t}t.MD5=o._createHelper(u),t.HmacMD5=o._createHmacHelper(u)}(Math),r.MD5)})),X=function(e){return V(e)},K=function(e){return e.includes("/")&&e.split("/")[0]},Z=function(e){return e.includes("/")?e.split("/")[1]:e},ee=function(e){return e.map((function(t){var r=t.query,n=e.find((function(e){return t.parentNode===e.node}));return void 0!==n&&(r=r.concat(n.query[0])),{type:"bgp",triples:r}}))},te=function(e,t,n){var a=[],o=function(e){var t=[];if(e){var r,n=E(e);try{for(n.s();!(r=n.n()).done;){var a=r.value;if(a.includes("/"))for(var o=a.split("/"),i=1;i<=o.length;i++)t.push(o.slice(0,i).join("/"));else t.push(a)}}catch(e){n.e(e)}finally{n.f()}}return t}(e);if(o&&n&&n.length>0){var i,s=E(o);try{for(s.s();!(i=s.n()).done;){var u=i.value,c=K(u),l=Z(u),f=X(u),p=c?X(c):"1",d=[r.triple(r.variable("s"+p),r.namedNode(J(l,n)),r.variable("s"+f)),r.triple(r.variable("s"+f),r.variable("p"+f),r.variable("o"+f))];a.push({node:u,parentNode:c,query:d,filter:""})}}catch(e){s.e(e)}finally{s.f()}return{construct:a.length>0?a.map((function(e){return e.query})).reduce((function(e,t){return e.concat(t)})):null,where:{type:"union",patterns:[t.where].concat(S(ee(a)))}}}return{construct:"",where:""}},re=l.default.literal,ne=l.default.namedNode,ae=l.default.triple,oe=l.default.variable,ie=new(0,require("sparqljs").Generator)({}),se=["q","sparqlWhere","blankNodes","_servers","_predicates"],ue=function(e){var t=e.containers,r=e.params.filter,n=e.blankNodes,a=e.predicates,o=e.ontologies,i=Y(a,o),s={queryType:"CONSTRUCT",template:i.construct,where:[],type:"query",prefixes:Object.fromEntries(o.map((function(e){return[e.prefix,e.url]})))},u=[{type:"values",values:t.map((function(e){return{"?containerUri":ne(e)}}))},ae(oe("containerUri"),ne("http://www.w3.org/ns/ldp#contains"),oe("s1")),{type:"filter",expression:{type:"operation",operator:"isiri",args:[oe("s1")]}}],c=[];if(r&&Object.keys(r).length>0){var l=r.sparqlWhere&&Object.keys(r.sparqlWhere).length>0,f=r.q&&r.q.length>0;l&&[].concat(r.sparqlWhere).forEach((function(e){c.push(e)})),f&&c.push({type:"group",patterns:[{queryType:"SELECT",variables:[oe("s1")],where:[ae(oe("s1"),oe("p1"),oe("o1")),{type:"filter",expression:{type:"operation",operator:"isliteral",args:[oe("o1")]}},{type:"filter",expression:{type:"operation",operator:"regex",args:[{type:"operation",operator:"lcase",args:[{type:"operation",operator:"str",args:[oe("o1")]}]},re(r.q.toLowerCase(),"",ne("http://www.w3.org/2001/XMLSchema#string"))]}}],type:"query"}]}),Object.entries(r).forEach((function(e){var t=k(e,2),r=t[0],n=t[1];se.includes(r)||c.unshift(ae(oe("s1"),ne(J(r,o)),ne(J(n,o))))}))}var p=te(n,i,o);return p&&p.construct?(c=c.concat(p.where),s.template=s.template.concat(p.construct)):c.push(i.where),s.where.push({type:"union",patterns:[u,{type:"graph",name:ne("http://semapps.org/mirror"),patterns:u}]},{type:"union",patterns:[c,{type:"graph",name:ne("http://semapps.org/mirror"),patterns:c}]}),ie.stringify(s)},ce=function(e,t){for(var r=[],n=0,a=Object.keys(t);n1&&void 0!==h[1]?h[1]:{},s=e.dataServers,u=e.resources,c=u[r]){t.next=5;break}throw new Error("Resource ".concat(r," is not mapped in resources file"));case 5:if(null!==(n=i.filter)&&void 0!==n&&n._servers||null===(a=c.list)||void 0===a||!a.containers){t.next=11;break}if(!Array.isArray(null===(f=c.list)||void 0===f?void 0:f.containers)){t.next=8;break}throw new Error("The list.containers property of ".concat(r," dataModel must be of type object ({ serverKey: [containerUri] })"));case 8:l=de(c.list.containers,s),t.next=12;break;case 11:l=M(c.types,(null===(p=i.filter)||void 0===p?void 0:p._servers)||(null===(d=c.list)||void 0===d?void 0:d.servers),s);case 12:if(null===(o=c.list)||void 0===o||!o.fetchContainer){t.next=16;break}return t.abrupt("return",G(l,r,i,e));case 16:return t.abrupt("return",pe(l,r,i,e));case 17:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},ve=function(e){return function(){var t=b(v().mark((function t(r,n){var a,o;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.returnFailedResources,t.next=3,Promise.all(n.ids.map((function(t){return L(e)(r,{id:"object"===y(t)?t["@id"]:t}).then((function(e){return e.data})).catch((function(){if(a)return{id:t,_error:!0}}))})));case 3:return o=(o=t.sent).filter((function(e){return e})),t.abrupt("return",{data:o});case 6:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()},ye=function(e){return function(){var t=b(v().mark((function t(r,n){return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.filter=h(h({},n.filter),{},m({},n.target,n.id)),delete n.target,t.next=4,he(e)(r,n);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()},ge=function(e){return function(){var t=b(v().mark((function t(r,n){var a,o;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.httpClient,o=e.jsonContext,t.next=3,U(n.data,e);case 3:return n.data=t.sent,t.next=6,a(n.id,{method:"PUT",body:JSON.stringify(h({"@context":o},n.data))});case 6:return t.abrupt("return",{data:n.data});case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()};function be(e){this.message=e}be.prototype=new Error,be.prototype.name="InvalidCharacterError";var me="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new be("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,a=0,o=0,i="";n=t.charAt(o++);~n&&(r=a%4?64*r+n:n,a++%4)?i+=String.fromCharCode(255&r>>(-2*a&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return i};function we(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(me(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return me(t)}}function xe(e){this.message=e}function ke(e,t){if("string"!=typeof e)throw new xe("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(we(e.split(".")[r]))}catch(e){throw new xe("Invalid token specified: "+e.message)}}xe.prototype=new Error,xe.prototype.name="InvalidTokenError";var Se=function(){var e=b(v().mark((function e(t){var r,n,a,o,i,s,u,c,l,f,p,d;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.dataServers,n=t.httpClient,a=localStorage.getItem("token"),o=I("pod",r),i=I("authServer",r),!a){e.next=24;break}return s=ke(a),u=s.webId,e.prev=6,e.next=9,n(u);case 9:l=e.sent,f=l.json,c=f,e.next=20;break;case 14:return e.prev=14,e.t0=e.catch(6),console.error(e.t0),localStorage.clear(),window.location.reload(),e.abrupt("return");case 20:o&&(t.dataServers[o].name="My Pod",t.dataServers[o].baseUrl=P(u,"data"),t.dataServers[o].sparqlEndpoint=(null===(p=c.endpoints)||void 0===p?void 0:p["void:sparqlEndpoint"])||P(u,"sparql")),i&&(t.dataServers[i].proxyUrl=null===(d=c.endpoints)||void 0===d?void 0:d.proxyUrl),e.next=24;break;case 24:case"end":return e.stop()}}),e,null,[[6,14]])})));return function(t){return e.apply(this,arguments)}}(),je=function(e){return e?Array.isArray(e)?e:[e]:void 0},Oe=function(){var e=b(v().mark((function e(t){var r,n,a,o,i,s,u,c;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object.entries(t.dataServers).filter((function(e){var t=k(e,2);return t[0],!0!==t[1].pod})).map((function(e){var r=k(e,2),n=r[0],a=r[1];return t.httpClient(new URL("/.well-known/void",a.baseUrl).toString()).then((function(e){return{key:n,datasets:e.json["@graph"]}})).catch((function(e){if(404===e.status||401===e.status)return{key:n,error:e};throw e}))})),n=[],e.prev=2,e.next=5,Promise.all(r);case 5:n=e.sent,e.next=10;break;case 8:e.prev=8,e.t0=e.catch(2);case 10:a=E(n);try{for(a.s();!(o=a.n()).done;)if(i=o.value,t.dataServers[i.key].containers=t.dataServers[i.key].containers||{},t.dataServers[i.key].blankNodes=t.dataServers[i.key].blankNodes||{},i.datasets){s=E(i.datasets);try{for(c=function(){var e=u.value,r=Object.keys(t.dataServers).find((function(r){return e["void:uriSpace"]===t.dataServers[r].baseUrl}));if(r){r===i.key&&(t.dataServers[i.key].name=t.dataServers[i.key].name||e["dc:title"],t.dataServers[i.key].description=t.dataServers[i.key].description||e["dc:description"],t.dataServers[i.key].sparqlEndpoint=t.dataServers[i.key].sparqlEndpoint||e["void:sparqlEndpoint"]),t.dataServers[i.key].containers[r]=t.dataServers[i.key].containers[r]||{};var n,a=E(je(e["void:classPartition"]));try{for(a.s();!(n=a.n()).done;){var o,s=n.value,c=E(je(s["void:class"]));try{for(c.s();!(o=c.n()).done;){var l=o.value,f=s["void:uriSpace"].replace(e["void:uriSpace"],"/");t.dataServers[i.key].containers[r][l]?t.dataServers[i.key].containers[r][l].push(f):t.dataServers[i.key].containers[r][l]=[f],je(s["semapps:blankNodes"])&&(t.dataServers[i.key].blankNodes[s["void:uriSpace"]]=je(s["semapps:blankNodes"]))}}catch(e){c.e(e)}finally{c.f()}}}catch(e){a.e(e)}finally{a.f()}}},s.s();!(u=s.n()).done;)c()}catch(e){s.e(e)}finally{s.f()}}}catch(e){a.e(e)}finally{a.f()}case 12:case"end":return e.stop()}}),e,null,[[2,8]])})));return function(t){return e.apply(this,arguments)}}(),Ee=function(e,t){return Object.keys(t).find((function(r){return t[r].pod?t[r].baseUrl&&e.startsWith(t[r].baseUrl.replace("/data","")):e.startsWith(t[r].baseUrl)}))},Ce=function(e,t){return"function"==typeof e?e(t):e},Ae=function(e){return"string"==typeof e&&e.startsWith("http")},Pe=function(e){var t=o.useContext(a.DataProviderContext),r=k(o.useState(),2),n=r[0],i=r[1];return o.useEffect((function(){t.getDataModels().then((function(t){return i(t[e])}))}),[t,e,i]),n},_e=function(){var e=o.useContext(a.DataProviderContext),t=k(o.useState(),2),r=t[0],n=t[1];return o.useEffect((function(){e.getDataServers().then((function(e){return n(e)}))}),[e,n]),r},Le=function(e,t,r){var n=[];if(Object.keys(r[t].containers[t]).length>0&&Object.keys(r[t].containers[t]).forEach((function(a){e.includes(a)&&r[t].containers[t][a].map((function(e){var a=P(r[t].baseUrl,e);n.includes(a)||n.push(a)}))})),0===n.length)throw new Error("No container found matching with types ".concat(JSON.stringify(e),". You can set explicitely the create.container property of the resource."));if(n.length>1)throw new Error("More than one container found matching with types ".concat(JSON.stringify(e),". You must set the create.server or create.container property for the resource."));return n[0]},Ne=["children","record","filter","source"],Te=function(e){var t=e.children,r=e.record,n=e.filter,a=e.source,i=x(e,Ne),s=k(o.useState(),2),u=s[0],c=s[1];return o.useEffect((function(){if(r&&a&&Array.isArray(null==r?void 0:r[a])){var e=null==r?void 0:r[a].filter((function(e){var t=!0;for(var r in n){var a=e[r];Array.isArray(a)?a.includes(n[r])||(t=!1):a!==n[r]&&(t=!1)}return t})),t=h({},r);t[a]=e.length>0?e:void 0,c(t)}}),[r,a,n]),p.default.createElement(p.default.Fragment,null,p.default.Children.map(t,(function(e,t){return p.default.cloneElement(e,h(h({},i),{},{record:u,addLabel:!0,source:a}))})))},qe=["children","groupReference","groupLabel","groupHeader","filterProperty"],Ue=["reificationClass","children"],Ie=i.makeStyles({form:{display:"flex"},input:{paddingRight:"20px"}}),De=i.makeStyles({root:{display:"none"}});exports.FilterHandler=Te,exports.GroupedReferenceHandler=function(e){var t=e.children,r=e.groupReference,n=e.groupLabel,o=e.groupHeader,i=e.filterProperty,s=x(e,qe),u=a.useQueryWithStore({type:"getList",resource:r,payload:{}}).data;return p.default.createElement(p.default.Fragment,null,null==u?void 0:u.map((function(e,r){var a={};return a[i]=e.id,p.default.createElement(p.default.Fragment,null,o&&o(h(h({},s),{},{group:e})),p.default.createElement(Te,w({},s,{filter:a,label:e[n]}),t))})))},exports.ReificationArrayInput=function(e){var t=e.reificationClass;e.children;var r=x(e,Ue),n=Ie(),o=De();return p.default.createElement(a.ArrayInput,r,p.default.createElement(a.SimpleFormIterator,{classes:{form:n.form}},p.default.Children.map(e.children,(function(e,t){return p.default.cloneElement(e,{className:n.input})})),p.default.createElement(a.TextInput,{className:o.root,source:"type",initialValue:t})))},exports.buildBlankNodesQuery=te,exports.buildSparqlQuery=ue,exports.dataProvider=function(e){if(!I("default",e.dataServers))throw new Error("You must define a default server in your dataServers config");var t;e.jsonContext||(e.jsonContext=Object.fromEntries(e.ontologies.map((function(e){return[e.prefix,e.url]})))),e.returnFailedResources||(e.returnFailedResources=!1),e.httpClient=(t=e.dataServers,function(e){var r,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=I("authServer",t),s=Ee(e,t),u=s!==i&&(null===(r=t[i])||void 0===r?void 0:r.proxyUrl)&&!0!==(null===(n=t[s])||void 0===n?void 0:n.noProxy);switch(o.headers||(o.headers=new Headers),o.method){case"POST":case"PATCH":case"PUT":o.headers.has("Accept")||o.headers.set("Accept","application/ld+json"),o.headers.has("Content-Type")||o.headers.set("Content-Type","application/ld+json");break;case"DELETE":break;case"GET":default:o.headers.has("Accept")||o.headers.set("Accept","application/ld+json")}if(u){var c=new FormData;return c.append("id",e),c.append("method",o.method||"GET"),c.append("headers",JSON.stringify(Object.fromEntries(o.headers.entries()))),o.body&&(o.body instanceof File?c.append("body",o.body,o.body.name):c.append("body",o.body)),a.fetchUtils.fetchJson(t[i].proxyUrl,{method:"POST",headers:new Headers({Authorization:"Bearer ".concat(localStorage.getItem("token"))}),body:c})}if(s===i){var l=localStorage.getItem("token");l&&o.headers.set("Authorization","Bearer ".concat(l))}return a.fetchUtils.fetchJson(e,o)});var r=Se(e),n=Oe(e),o=function(e){return b(v().mark((function t(){var a=arguments;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r;case 2:return t.next=4,n;case 4:return t.next=6,e.apply(void 0,a);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})))};return{getList:o(he(e)),getMany:o(ve(e)),getManyReference:o(ye(e)),getOne:o(L(e)),create:o(B(e)),update:o(ge(e)),updateMany:function(){throw new Error("updateMany is not implemented yet")},delete:o(R(e)),deleteMany:o(F(e)),getDataModels:o(W(e)),getDataServers:o(H(e)),getLocalDataServers:H(e),fetch:o(e.httpClient)}},exports.useContainers=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"@all",r=Pe(e),n=_e(),a=o.useState(),i=k(a,2),s=i[0],u=i[1];return o.useEffect((function(){r&&n&&u(M(r.types,t,n))}),[r,n,t]),s},exports.useCreateContainer=function(e){var t=Pe(e),r=_e(),n=k(o.useState(),2),a=n[0],i=n[1];return o.useEffect((function(){var n,a;if(t&&r)if(null!==(n=t.create)&&void 0!==n&&n.container){var o=k(Object.entries(t.create.container)[0],2),s=o[0],u=o[1];if(!s||!r[s])throw new Error("Wrong key for the dataModel.create.container config of resource "+e);i(P(r[s].baseUrl,u))}else if(null!==(a=t.create)&&void 0!==a&&a.server){var c;i(Le(t.types,null===(c=t.create)||void 0===c?void 0:c.server,r))}else{var l=I("default",r);i(Le(t.types,l,r))}}),[t,r,i]),a},exports.useDataModel=Pe,exports.useDataModels=function(){var e=o.useContext(a.DataProviderContext),t=k(o.useState(),2),r=t[0],n=t[1];return o.useEffect((function(){e.getDataModels().then((function(e){return n(e)}))}),[e,n]),r},exports.useDataServers=_e,exports.useGetExternalLink=function(e){var t=o.useContext(a.DataProviderContext).getLocalDataServers(),r=o.useMemo((function(){if(t)return Object.fromEntries(Object.values(t).map((function(e){var t=void 0!==e.externalLinks?e.externalLinks:!e.default;return[e.baseUrl,t]})))}),[t]);return o.useCallback((function(t){var n=Ce(e,t);if(!1===n)return!1;if(null==t||!t.id)return!1;var a=Object.keys(r).find((function(e){return null==t?void 0:t.id.startsWith(e)}));if(!a)return!1;var o=Ce(r[a],t);return!1!==o&&(Ae(n)?n:Ae(o)?o:t.id)}),[r,e])}; +v=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var a=t&&t.prototype instanceof f?t:f,o=Object.create(a.prototype),i=new O(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(a,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw o;return E()}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var s=x(i,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=c(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,i),o}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function f(){}function p(){}function d(){}var h={};s(h,a,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(j([])));g&&g!==t&&r.call(g,a)&&(h=g);var b=d.prototype=f.prototype=Object.create(h);function m(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){var n;this._invoke=function(a,o){function i(){return new t((function(n,i){!function n(a,o,i,s){var u=c(e[a],e,o);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,i,s)}),(function(e){n("throw",e,i,s)})):t.resolve(f).then((function(e){l.value=e,i(l)}),(function(e){return n("throw",e,i,s)}))}s(u.arg)}(a,o,n,i)}))}return n=n?n.then(i,i):i()}}function x(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var a=n.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function j(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;S(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:j(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function y(e){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function b(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){g(o,n,a,i,s,"next",e)}function s(e){g(o,n,a,i,s,"throw",e)}i(void 0)}))}}function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function w(){return(w=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,a,o=[],i=!0,s=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(s)throw a}}return o}(e,t)||O(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e){return function(e){if(Array.isArray(e))return j(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||O(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e,t){if(e){if("string"==typeof e)return j(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?j(e,t):void 0}}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}var C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function A(e,t){return e(t={exports:{}},t.exports),t.exports}var P=A((function(e){var t,r;t=C,r=function(){function e(e){var t=[];if(0===e.length)return"";if("string"!=typeof e[0])throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var r=e.shift();e[0]=r+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var n=0;n0&&(a=a.replace(/^[\/]+/,"")),a=n0?"?":"")+i.join("&")}return function(){return e("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}},e.exports?e.exports=r():t.urljoin=r()})),_=function(){var e=b(v().mark((function e(t,r){var n,a,o,i;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.httpClient,a=r.jsonContext,e.next=3,n(t);case 3:if(o=e.sent,i=o.json){e.next=7;break}throw new Error("Not a valid JSON: "+t);case 7:if(i.id=i.id||i["@id"],i["@context"]===a){e.next=12;break}return e.next=11,u.default.compact(i,a);case 11:i=e.sent;case 12:return e.abrupt("return",i);case 13:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),L=function(e){return function(){var t=b(v().mark((function t(r,n){var a,o,i,s,u,c,l,f;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=e.resources,i=o[r]){t.next=4;break}throw new Error("Resource ".concat(r," is not mapped in resources file"));case 4:return t.next=6,_(n.id,e);case 6:if(s=t.sent,null!==(a=i.list)&&void 0!==a&&a.forceArray){c=E(null===(u=i.list)||void 0===u?void 0:u.forceArray);try{for(c.s();!(l=c.n()).done;)f=l.value,s[f]&&!Array.isArray(s[f])&&(s[f]=[s[f]])}catch(e){c.e(e)}finally{c.f()}}return t.abrupt("return",{data:s});case 9:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()},N=function(e){var t="",r=e.split(".");return r.length>1&&(t=r.pop(),e=r.join(".")),c.default(e,{lang:"fr"})+"."+t},T=function(e){return e&&e.rawFile&&e.rawFile instanceof File},q=function(e){var t=Object.keys(e.dataServers).find((function(t){return e.dataServers[t].uploadsContainer}));if(t)return P(e.dataServers[t].baseUrl,e.dataServers[t].uploadsContainer)},U=function(){var e=b(v().mark((function e(t,r){var n,a;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=q(r)){e.next=3;break}throw new Error("You must define an uploadsContainer in one of the server's configuration");case 3:return e.next=5,r.httpClient(n,{method:"POST",body:t,headers:new Headers({Slug:N(t.name),"Content-Type":t.type})});case 5:if(201!==(a=e.sent).status){e.next=8;break}return e.abrupt("return",a.headers.get("Location"));case 8:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),I=function(){var e=b(v().mark((function e(t,r){var n,a;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=v().keys(t);case 1:if((e.t1=e.t0()).done){e.next=22;break}if(n=e.t1.value,!t.hasOwnProperty(n)){e.next=20;break}if(!Array.isArray(t[n])){e.next=16;break}a=0;case 6:if(!(a1||y[g[0]].length>1)){t.next=18;break}throw new Error("More than one container detected with types ".concat(JSON.stringify(c.types)," on server ").concat(p));case 18:f=y[g[0]][0];case 19:if(!n.data){t.next=47;break}if(!(v=c.types,v?Array.isArray(v)?v:[v]:void 0).includes("semapps:File")){t.next=34;break}if(1===(b=Object.keys(n.data)).length||T(n.data[b[0]])){t.next=24;break}throw new Error("For ressources of types semapps:File, you must provide a single file value");case 24:return m=n.data[b[0]].rawFile,l.set("Slug",N(m.name)),l.set("Content-Type",m.type),t.next=29,s(f,{method:"POST",headers:l,body:m});case 29:return w=t.sent,x=w.headers.get("Location"),t.abrupt("return",{data:{id:x}});case 34:return null!==(k=c.fieldsMapping)&&void 0!==k&&k.title&&(Array.isArray(c.fieldsMapping.title)?l.set("Slug",c.fieldsMapping.title.map((function(e){return n.data[e]})).join(" ")):l.set("Slug",n.data[c.fieldsMapping.title])),t.next=37,I(n.data,e);case 37:return n.data=t.sent,t.next=40,s(f,{method:"POST",headers:l,body:JSON.stringify(h({"@context":u,"@type":c.types},n.data))});case 40:return S=t.sent,O=S.headers.get("Location"),t.next=44,L(e)(r,{id:O});case 44:return t.abrupt("return",t.sent);case 45:t.next=54;break;case 47:if(!n.id){t.next=54;break}return l.set("Content-Type","application/sparql-update"),t.next=51,s(f,{method:"PATCH",headers:l,body:"\n PREFIX ldp: \n INSERT DATA { <".concat(f,"> ldp:contains <").concat(n.id,">. };\n ")});case 51:return t.next=53,L(e)(r,{id:n.id});case 53:return t.abrupt("return",t.sent);case 54:case"end":return t.stop()}var v}),t)})));return function(e,r){return t.apply(this,arguments)}}()},R=function(e){return function(){var t=b(v().mark((function t(r,n){var a;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.httpClient,t.next=3,a(n.id,{method:"DELETE"});case 3:return t.abrupt("return",{data:{id:n.id}});case 4:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()},H=function(e){return function(){var t=b(v().mark((function t(r,n){var a,o,i,s,u;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a=e.httpClient,o=[],i=E(n.ids),t.prev=3,i.s();case 5:if((s=i.n()).done){t.next=17;break}return u=s.value,t.prev=7,t.next=10,a(u,{method:"DELETE"});case 10:o.push(u),t.next=15;break;case 13:t.prev=13,t.t0=t.catch(7);case 15:t.next=5;break;case 17:t.next=22;break;case 19:t.prev=19,t.t1=t.catch(3),i.e(t.t1);case 22:return t.prev=22,i.f(),t.finish(22);case 25:return t.abrupt("return",{data:o});case 26:case"end":return t.stop()}}),t,null,[[3,19,22,25],[7,13]])})));return function(e,r){return t.apply(this,arguments)}}()},W=function(e){return function(){return e.dataServers}},G=function(e){return function(){return e.resources}};var J=function(){var e=b(v().mark((function e(t,r,n,a){var o,i,s,c,l,f,p;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=a.httpClient,i=a.jsonContext,s=Object.keys(t).reduce((function(e,r){return h(h({},e),Object.fromEntries(t[r].map((function(e){return[e,r]}))))}),{}),c=Object.keys(s).map((function(e){return o(e).then((function(e){var t=e.json;return t["@context"]!==i?u.default.compact(t,i):t})).then((function(t){if(r="ldp:Container",a=(n=t).type||n["@type"],Array.isArray(a)?a.includes(r):a===r)return t["ldp:contains"];throw new Error(e+" is not a LDP container");var r,n,a}))})),e.next=5,Promise.all(c);case 5:if(0!==(l=e.sent).length){e.next=10;break}return e.abrupt("return",{data:[],total:0});case 10:return l=(f=[].concat).apply.apply(f,S(l)),p=l.map((function(e){return e.id=e.id||e["@id"],e})),n.filter&&(n.filter.a&&(n.filter.type=n.filter.a,delete n.filter.a),Object.keys(n.filter).length>0&&(p=p.filter((function(e){return Object.entries(n.filter).some((function(t){var r=k(t,2),n=r[0],a=r[1];return"q"==n?Object.entries(e).some((function(e){var t=k(e,2);t[0];var r,n=t[1];return(null==(r=n)||"object"!=typeof r||!1!==Array.isArray(r))&&(Array.isArray(n)?n.some((function(e){return e.includes(a)})):n.includes(a))})):(Array.isArray(e[n]),e[n].includes(a))}))})))),n.sort&&(p=p.sort((function(e,t){return!e[n.sort.field]||!t[n.sort.field]||("ASC"===n.sort.order?e[n.sort.field].localeCompare(t[n.sort.field]):t[n.sort.field].localeCompare(e[n.sort.field]))}))),n.pagination&&(p=p.slice((n.pagination.page-1)*n.pagination.perPage,n.pagination.page*n.pagination.perPage)),e.abrupt("return",{data:p,total:l.length});case 16:case"end":return e.stop()}}),e)})));return function(t,r,n,a){return e.apply(this,arguments)}}(),z=function(e){var t,r={};if(e){var n,a=E(e);try{for(a.s();!(n=a.n()).done;){var o=n.value;t=o.includes("/")?o.split("/").reverse():[o],r=h(h({},r),t.reduce((function(e,t){return m({},t,h({"@embed":"@last"},e))}),{}))}}catch(e){a.e(e)}finally{a.f()}return r}},$=function(e,t){if(e.startsWith("http://")||e.startsWith("https://"))return e;if("a"===e)return"http://www.w3.org/1999/02/22-rdf-syntax-ns#type";var r=k(e.split(":"),2),n=r[0],a=r[1];if(a){var o=t.find((function(e){return e.prefix===n}));if(o)return o.url+a;throw new Error("No ontology found with prefix "+n)}throw new Error('The value "'.concat(e,'" is not correct. It must include a prefix or be a full URI.'))},Y=r.triple(r.variable("s1"),r.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),r.variable("type")),Q=function(e,t){var n,a;return e?(n=(a=e,a?Array.isArray(a)?a:[a]:[]).map((function(e,n){return r.triple(r.variable("s1"),r.namedNode($(e,t)),r.variable("o"+(n+1)))})),{construct:[Y].concat(S(n)),where:[Y].concat(S(n.map((function(e){return{type:"optional",patterns:[e]}}))))}):{construct:n=[r.triple(r.variable("s1"),r.variable("p1"),r.variable("o1"))],where:n}},V=A((function(e,t){var r;e.exports=r=r||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==C&&C.crypto&&(r=C.crypto),!r)try{r=f.default}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),o={},i=o.lib={},s=i.Base={extend:function(e){var t=a(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=i.WordArray=s.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,a=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[n+o>>>2]|=i<<24-(n+o)%4*8}else for(var s=0;s>>2]=r[s>>>2];return this.sigBytes+=a,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-a%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new u.init(r,t/2)}},p=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],a=0;a>>2]>>>24-a%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new u.init(r,t)}},d=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(p.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return p.parse(unescape(encodeURIComponent(e)))}},h=i.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=d.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,a=n.words,o=n.sigBytes,i=this.blockSize,s=o/(4*i),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*i,l=e.min(4*c,o);if(c){for(var f=0;f>>24)|4278255360&(a<<24|a>>>8)}var o=this._hash.words,i=e[t+0],u=e[t+1],d=e[t+2],h=e[t+3],v=e[t+4],y=e[t+5],g=e[t+6],b=e[t+7],m=e[t+8],w=e[t+9],x=e[t+10],k=e[t+11],S=e[t+12],O=e[t+13],j=e[t+14],E=e[t+15],C=o[0],A=o[1],P=o[2],_=o[3];C=c(C,A,P,_,i,7,s[0]),_=c(_,C,A,P,u,12,s[1]),P=c(P,_,C,A,d,17,s[2]),A=c(A,P,_,C,h,22,s[3]),C=c(C,A,P,_,v,7,s[4]),_=c(_,C,A,P,y,12,s[5]),P=c(P,_,C,A,g,17,s[6]),A=c(A,P,_,C,b,22,s[7]),C=c(C,A,P,_,m,7,s[8]),_=c(_,C,A,P,w,12,s[9]),P=c(P,_,C,A,x,17,s[10]),A=c(A,P,_,C,k,22,s[11]),C=c(C,A,P,_,S,7,s[12]),_=c(_,C,A,P,O,12,s[13]),P=c(P,_,C,A,j,17,s[14]),C=l(C,A=c(A,P,_,C,E,22,s[15]),P,_,u,5,s[16]),_=l(_,C,A,P,g,9,s[17]),P=l(P,_,C,A,k,14,s[18]),A=l(A,P,_,C,i,20,s[19]),C=l(C,A,P,_,y,5,s[20]),_=l(_,C,A,P,x,9,s[21]),P=l(P,_,C,A,E,14,s[22]),A=l(A,P,_,C,v,20,s[23]),C=l(C,A,P,_,w,5,s[24]),_=l(_,C,A,P,j,9,s[25]),P=l(P,_,C,A,h,14,s[26]),A=l(A,P,_,C,m,20,s[27]),C=l(C,A,P,_,O,5,s[28]),_=l(_,C,A,P,d,9,s[29]),P=l(P,_,C,A,b,14,s[30]),C=f(C,A=l(A,P,_,C,S,20,s[31]),P,_,y,4,s[32]),_=f(_,C,A,P,m,11,s[33]),P=f(P,_,C,A,k,16,s[34]),A=f(A,P,_,C,j,23,s[35]),C=f(C,A,P,_,u,4,s[36]),_=f(_,C,A,P,v,11,s[37]),P=f(P,_,C,A,b,16,s[38]),A=f(A,P,_,C,x,23,s[39]),C=f(C,A,P,_,O,4,s[40]),_=f(_,C,A,P,i,11,s[41]),P=f(P,_,C,A,h,16,s[42]),A=f(A,P,_,C,g,23,s[43]),C=f(C,A,P,_,w,4,s[44]),_=f(_,C,A,P,S,11,s[45]),P=f(P,_,C,A,E,16,s[46]),C=p(C,A=f(A,P,_,C,d,23,s[47]),P,_,i,6,s[48]),_=p(_,C,A,P,b,10,s[49]),P=p(P,_,C,A,j,15,s[50]),A=p(A,P,_,C,y,21,s[51]),C=p(C,A,P,_,S,6,s[52]),_=p(_,C,A,P,h,10,s[53]),P=p(P,_,C,A,x,15,s[54]),A=p(A,P,_,C,u,21,s[55]),C=p(C,A,P,_,m,6,s[56]),_=p(_,C,A,P,E,10,s[57]),P=p(P,_,C,A,g,15,s[58]),A=p(A,P,_,C,O,21,s[59]),C=p(C,A,P,_,v,6,s[60]),_=p(_,C,A,P,k,10,s[61]),P=p(P,_,C,A,d,15,s[62]),A=p(A,P,_,C,w,21,s[63]),o[0]=o[0]+C|0,o[1]=o[1]+A|0,o[2]=o[2]+P|0,o[3]=o[3]+_|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,a=8*t.sigBytes;r[a>>>5]|=128<<24-a%32;var o=e.floor(n/4294967296),i=n;r[15+(a+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(a+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,u=s.words,c=0;c<4;c++){var l=u[c];u[c]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return s},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,r,n,a,o,i){var s=e+(t&r|~t&n)+a+i;return(s<>>32-o)+t}function l(e,t,r,n,a,o,i){var s=e+(t&n|r&~n)+a+i;return(s<>>32-o)+t}function f(e,t,r,n,a,o,i){var s=e+(t^r^n)+a+i;return(s<>>32-o)+t}function p(e,t,r,n,a,o,i){var s=e+(r^(t|~n))+a+i;return(s<>>32-o)+t}t.MD5=o._createHelper(u),t.HmacMD5=o._createHmacHelper(u)}(Math),r.MD5)})),K=function(e){return X(e)},Z=function(e){return e.includes("/")&&e.split("/")[0]},ee=function(e){return e.includes("/")?e.split("/")[1]:e},te=function(e){return e.map((function(t){var r=t.query,n=e.find((function(e){return t.parentNode===e.node}));return void 0!==n&&(r=r.concat(n.query[0])),{type:"bgp",triples:r}}))},re=function(e,t,n){var a=[],o=function(e){var t=[];if(e){var r,n=E(e);try{for(n.s();!(r=n.n()).done;){var a=r.value;if(a.includes("/"))for(var o=a.split("/"),i=1;i<=o.length;i++)t.push(o.slice(0,i).join("/"));else t.push(a)}}catch(e){n.e(e)}finally{n.f()}}return t}(e);if(o&&n&&n.length>0){var i,s=E(o);try{for(s.s();!(i=s.n()).done;){var u=i.value,c=Z(u),l=ee(u),f=K(u),p=c?K(c):"1",d=[r.triple(r.variable("s"+p),r.namedNode($(l,n)),r.variable("s"+f)),r.triple(r.variable("s"+f),r.variable("p"+f),r.variable("o"+f))];a.push({node:u,parentNode:c,query:d,filter:""})}}catch(e){s.e(e)}finally{s.f()}return{construct:a.length>0?a.map((function(e){return e.query})).reduce((function(e,t){return e.concat(t)})):null,where:{type:"union",patterns:[t.where].concat(S(te(a)))}}}return{construct:"",where:""}},ne=l.default.literal,ae=l.default.namedNode,oe=l.default.triple,ie=l.default.variable,se=new(0,require("sparqljs").Generator)({}),ue=["q","sparqlWhere","blankNodes","_servers","_predicates"],ce=function(e){var t=e.containers,r=e.params.filter,n=e.blankNodes,a=e.predicates,o=e.ontologies,i=Q(a,o),s={queryType:"CONSTRUCT",template:i.construct,where:[],type:"query",prefixes:Object.fromEntries(o.map((function(e){return[e.prefix,e.url]})))},u=[{type:"values",values:t.map((function(e){return{"?containerUri":ae(e)}}))},oe(ie("containerUri"),ae("http://www.w3.org/ns/ldp#contains"),ie("s1")),{type:"filter",expression:{type:"operation",operator:"isiri",args:[ie("s1")]}}],c=[];if(r&&Object.keys(r).length>0){var l=r.sparqlWhere&&Object.keys(r.sparqlWhere).length>0,f=r.q&&r.q.length>0;l&&[].concat(r.sparqlWhere).forEach((function(e){c.push(e)})),f&&c.push({type:"group",patterns:[{queryType:"SELECT",variables:[ie("s1")],where:[oe(ie("s1"),ie("p1"),ie("o1")),{type:"filter",expression:{type:"operation",operator:"isliteral",args:[ie("o1")]}},{type:"filter",expression:{type:"operation",operator:"regex",args:[{type:"operation",operator:"lcase",args:[{type:"operation",operator:"str",args:[ie("o1")]}]},ne(r.q.toLowerCase(),"",ae("http://www.w3.org/2001/XMLSchema#string"))]}}],type:"query"}]}),Object.entries(r).forEach((function(e){var t=k(e,2),r=t[0],n=t[1];ue.includes(r)||c.unshift(oe(ie("s1"),ae($(r,o)),ae($(n,o))))}))}var p=re(n,i,o);return p&&p.construct?(c=c.concat(p.where),s.template=s.template.concat(p.construct)):c.push(i.where),s.where.push({type:"union",patterns:[u,{type:"graph",name:ae("http://semapps.org/mirror"),patterns:u}]},{type:"union",patterns:[c,{type:"graph",name:ae("http://semapps.org/mirror"),patterns:c}]}),se.stringify(s)},le=function(e,t){for(var r=[],n=0,a=Object.keys(t);n1&&void 0!==h[1]?h[1]:{},s=e.dataServers,u=e.resources,c=u[r]){t.next=5;break}throw new Error("Resource ".concat(r," is not mapped in resources file"));case 5:if(null!==(n=i.filter)&&void 0!==n&&n._servers||null===(a=c.list)||void 0===a||!a.containers){t.next=11;break}if(!Array.isArray(null===(f=c.list)||void 0===f?void 0:f.containers)){t.next=8;break}throw new Error("The list.containers property of ".concat(r," dataModel must be of type object ({ serverKey: [containerUri] })"));case 8:l=he(c.list.containers,s),t.next=12;break;case 11:l=F(c.types,(null===(p=i.filter)||void 0===p?void 0:p._servers)||(null===(d=c.list)||void 0===d?void 0:d.servers),s);case 12:if(null===(o=c.list)||void 0===o||!o.fetchContainer){t.next=16;break}return t.abrupt("return",J(l,r,i,e));case 16:return t.abrupt("return",de(l,r,i,e));case 17:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},ye=function(e){return function(){var t=b(v().mark((function t(r,n){var a,o;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.returnFailedResources,t.next=3,Promise.all(n.ids.map((function(t){return L(e)(r,{id:"object"===y(t)?t["@id"]:t}).then((function(e){return e.data})).catch((function(){if(a)return{id:t,_error:!0}}))})));case 3:return o=(o=t.sent).filter((function(e){return e})),t.abrupt("return",{data:o});case 6:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()},ge=function(e){return function(){var t=b(v().mark((function t(r,n){return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.filter=h(h({},n.filter),{},m({},n.target,n.id)),delete n.target,t.next=4,ve(e)(r,n);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()},be=function(e){return function(){var t=b(v().mark((function t(r,n){var a,o;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.httpClient,o=e.jsonContext,t.next=3,I(n.data,e);case 3:return n.data=t.sent,t.next=6,a(n.id,{method:"PUT",body:JSON.stringify(h({"@context":o},n.data))});case 6:return t.abrupt("return",{data:n.data});case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()};function me(e){this.message=e}me.prototype=new Error,me.prototype.name="InvalidCharacterError";var we="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new me("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,a=0,o=0,i="";n=t.charAt(o++);~n&&(r=a%4?64*r+n:n,a++%4)?i+=String.fromCharCode(255&r>>(-2*a&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return i};function xe(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(we(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return we(t)}}function ke(e){this.message=e}function Se(e,t){if("string"!=typeof e)throw new ke("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(xe(e.split(".")[r]))}catch(e){throw new ke("Invalid token specified: "+e.message)}}ke.prototype=new Error,ke.prototype.name="InvalidTokenError";var Oe=function(){var e=b(v().mark((function e(t){var r,n,a,o,i,s,u,c,l,f,p,d;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.dataServers,n=t.httpClient,a=localStorage.getItem("token"),o=D("pod",r),i=D("authServer",r),!a){e.next=24;break}return s=Se(a),u=s.webId,e.prev=6,e.next=9,n(u);case 9:l=e.sent,f=l.json,c=f,e.next=20;break;case 14:return e.prev=14,e.t0=e.catch(6),console.error(e.t0),localStorage.clear(),window.location.reload(),e.abrupt("return");case 20:o&&(t.dataServers[o].name="My Pod",t.dataServers[o].baseUrl=P(u,"data"),t.dataServers[o].sparqlEndpoint=(null===(p=c.endpoints)||void 0===p?void 0:p["void:sparqlEndpoint"])||P(u,"sparql")),i&&(t.dataServers[i].proxyUrl=null===(d=c.endpoints)||void 0===d?void 0:d.proxyUrl),e.next=24;break;case 24:case"end":return e.stop()}}),e,null,[[6,14]])})));return function(t){return e.apply(this,arguments)}}(),je=function(e){return e?Array.isArray(e)?e:[e]:void 0},Ee=function(){var e=b(v().mark((function e(t){var r,n,a,o,i,s,u,c;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object.entries(t.dataServers).filter((function(e){var t=k(e,2);return t[0],!0!==t[1].pod})).map((function(e){var r=k(e,2),n=r[0],a=r[1];return t.httpClient(new URL("/.well-known/void",a.baseUrl).toString()).then((function(e){return{key:n,datasets:e.json["@graph"]}})).catch((function(e){if(404===e.status||401===e.status)return{key:n,error:e};throw e}))})),n=[],e.prev=2,e.next=5,Promise.all(r);case 5:n=e.sent,e.next=10;break;case 8:e.prev=8,e.t0=e.catch(2);case 10:a=E(n);try{for(a.s();!(o=a.n()).done;)if(i=o.value,t.dataServers[i.key].containers=t.dataServers[i.key].containers||{},t.dataServers[i.key].blankNodes=t.dataServers[i.key].blankNodes||{},i.datasets){s=E(i.datasets);try{for(c=function(){var e=u.value,r=Object.keys(t.dataServers).find((function(r){return e["void:uriSpace"]===t.dataServers[r].baseUrl}));if(r){r===i.key&&(t.dataServers[i.key].name=t.dataServers[i.key].name||e["dc:title"],t.dataServers[i.key].description=t.dataServers[i.key].description||e["dc:description"],t.dataServers[i.key].sparqlEndpoint=t.dataServers[i.key].sparqlEndpoint||e["void:sparqlEndpoint"]),t.dataServers[i.key].containers[r]=t.dataServers[i.key].containers[r]||{};var n,a=E(je(e["void:classPartition"]));try{for(a.s();!(n=a.n()).done;){var o,s=n.value,c=E(je(s["void:class"]));try{for(c.s();!(o=c.n()).done;){var l=o.value,f=s["void:uriSpace"].replace(e["void:uriSpace"],"/");t.dataServers[i.key].containers[r][l]?t.dataServers[i.key].containers[r][l].push(f):t.dataServers[i.key].containers[r][l]=[f],je(s["semapps:blankNodes"])&&(t.dataServers[i.key].blankNodes[s["void:uriSpace"]]=je(s["semapps:blankNodes"]))}}catch(e){c.e(e)}finally{c.f()}}}catch(e){a.e(e)}finally{a.f()}}},s.s();!(u=s.n()).done;)c()}catch(e){s.e(e)}finally{s.f()}}}catch(e){a.e(e)}finally{a.f()}case 12:case"end":return e.stop()}}),e,null,[[2,8]])})));return function(t){return e.apply(this,arguments)}}(),Ce=function(e,t){return Object.keys(t).find((function(r){return t[r].pod?t[r].baseUrl&&e.startsWith(t[r].baseUrl.replace("/data","")):e.startsWith(t[r].baseUrl)}))},Ae=function(e,t){return"function"==typeof e?e(t):e},Pe=function(e){return"string"==typeof e&&e.startsWith("http")},_e=function(e){var t=o.useContext(a.DataProviderContext),r=k(o.useState(),2),n=r[0],i=r[1];return o.useEffect((function(){t.getDataModels().then((function(t){return i(t[e])}))}),[t,e,i]),n},Le=function(){var e=o.useContext(a.DataProviderContext),t=k(o.useState(),2),r=t[0],n=t[1];return o.useEffect((function(){e.getDataServers().then((function(e){return n(e)}))}),[e,n]),r},Ne=function(e,t,r){var n=[];if(Object.keys(r[t].containers[t]).length>0&&Object.keys(r[t].containers[t]).forEach((function(a){e.includes(a)&&r[t].containers[t][a].map((function(e){var a=P(r[t].baseUrl,e);n.includes(a)||n.push(a)}))})),0===n.length)throw new Error("No container found matching with types ".concat(JSON.stringify(e),". You can set explicitely the create.container property of the resource."));if(n.length>1)throw new Error("More than one container found matching with types ".concat(JSON.stringify(e),". You must set the create.server or create.container property for the resource."));return n[0]},Te=["children","record","filter","source"],qe=function(e){var t=e.children,r=e.record,n=e.filter,a=e.source,i=x(e,Te),s=k(o.useState(),2),u=s[0],c=s[1];return o.useEffect((function(){if(r&&a&&Array.isArray(null==r?void 0:r[a])){var e=null==r?void 0:r[a].filter((function(e){var t=!0;for(var r in n){var a=e[r];Array.isArray(a)?a.includes(n[r])||(t=!1):a!==n[r]&&(t=!1)}return t})),t=h({},r);t[a]=e.length>0?e:void 0,c(t)}}),[r,a,n]),p.default.createElement(p.default.Fragment,null,p.default.Children.map(t,(function(e,t){return p.default.cloneElement(e,h(h({},i),{},{record:u,addLabel:!0,source:a}))})))},Ue=["children","groupReference","groupLabel","groupHeader","filterProperty"],Ie=["reificationClass","children"],De=i.makeStyles({form:{display:"flex"},input:{paddingRight:"20px"}}),Me=i.makeStyles({root:{display:"none"}});exports.FilterHandler=qe,exports.GroupedReferenceHandler=function(e){var t=e.children,r=e.groupReference,n=e.groupLabel,o=e.groupHeader,i=e.filterProperty,s=x(e,Ue),u=a.useQueryWithStore({type:"getList",resource:r,payload:{}}).data;return p.default.createElement(p.default.Fragment,null,null==u?void 0:u.map((function(e,r){var a={};return a[i]=e.id,p.default.createElement(p.default.Fragment,null,o&&o(h(h({},s),{},{group:e})),p.default.createElement(qe,w({},s,{filter:a,label:e[n]}),t))})))},exports.ReificationArrayInput=function(e){var t=e.reificationClass;e.children;var r=x(e,Ie),n=De(),o=Me();return p.default.createElement(a.ArrayInput,r,p.default.createElement(a.SimpleFormIterator,{classes:{form:n.form}},p.default.Children.map(e.children,(function(e,t){return p.default.cloneElement(e,{className:n.input})})),p.default.createElement(a.TextInput,{className:o.root,source:"type",initialValue:t})))},exports.buildBlankNodesQuery=re,exports.buildSparqlQuery=ce,exports.dataProvider=function(e){if(!D("default",e.dataServers))throw new Error("You must define a default server in your dataServers config");var t;e.jsonContext||(e.jsonContext=Object.fromEntries(e.ontologies.map((function(e){return[e.prefix,e.url]})))),e.returnFailedResources||(e.returnFailedResources=!1),e.httpClient=(t=e.dataServers,function(e){var r,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=D("authServer",t),s=Ce(e,t),u=s!==i&&(null===(r=t[i])||void 0===r?void 0:r.proxyUrl)&&!0!==(null===(n=t[s])||void 0===n?void 0:n.noProxy);switch(o.headers||(o.headers=new Headers),o.method){case"POST":case"PATCH":case"PUT":o.headers.has("Accept")||o.headers.set("Accept","application/ld+json"),o.headers.has("Content-Type")||o.headers.set("Content-Type","application/ld+json");break;case"DELETE":break;case"GET":default:o.headers.has("Accept")||o.headers.set("Accept","application/ld+json")}if(u){var c=new FormData;return c.append("id",e),c.append("method",o.method||"GET"),c.append("headers",JSON.stringify(Object.fromEntries(o.headers.entries()))),o.body&&(o.body instanceof File?c.append("body",o.body,o.body.name):c.append("body",o.body)),a.fetchUtils.fetchJson(t[i].proxyUrl,{method:"POST",headers:new Headers({Authorization:"Bearer ".concat(localStorage.getItem("token"))}),body:c})}if(s===i){var l=localStorage.getItem("token");l&&o.headers.set("Authorization","Bearer ".concat(l))}return a.fetchUtils.fetchJson(e,o)});var r=Oe(e),n=Ee(e),o=function(e){return b(v().mark((function t(){var a=arguments;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r;case 2:return t.next=4,n;case 4:return t.next=6,e.apply(void 0,a);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})))};return{getList:o(ve(e)),getMany:o(ye(e)),getManyReference:o(ge(e)),getOne:o(L(e)),create:o(B(e)),update:o(be(e)),updateMany:function(){throw new Error("updateMany is not implemented yet")},delete:o(R(e)),deleteMany:o(H(e)),getDataModels:o(G(e)),getDataServers:o(W(e)),getLocalDataServers:W(e),fetch:o(e.httpClient)}},exports.useContainers=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"@all",r=_e(e),n=Le(),a=o.useState(),i=k(a,2),s=i[0],u=i[1];return o.useEffect((function(){r&&n&&u(F(r.types,t,n))}),[r,n,t]),s},exports.useCreateContainer=function(e){var t=_e(e),r=Le(),n=k(o.useState(),2),a=n[0],i=n[1];return o.useEffect((function(){var n,a;if(t&&r)if(null!==(n=t.create)&&void 0!==n&&n.container){var o=k(Object.entries(t.create.container)[0],2),s=o[0],u=o[1];if(!s||!r[s])throw new Error("Wrong key for the dataModel.create.container config of resource "+e);i(P(r[s].baseUrl,u))}else if(null!==(a=t.create)&&void 0!==a&&a.server){var c;i(Ne(t.types,null===(c=t.create)||void 0===c?void 0:c.server,r))}else{var l=D("default",r);i(Ne(t.types,l,r))}}),[t,r,i]),a},exports.useDataModel=_e,exports.useDataModels=function(){var e=o.useContext(a.DataProviderContext),t=k(o.useState(),2),r=t[0],n=t[1];return o.useEffect((function(){e.getDataModels().then((function(e){return n(e)}))}),[e,n]),r},exports.useDataServers=Le,exports.useGetExternalLink=function(e){var t=o.useContext(a.DataProviderContext).getLocalDataServers(),r=o.useMemo((function(){if(t)return Object.fromEntries(Object.values(t).map((function(e){var t=void 0!==e.externalLinks?e.externalLinks:!e.default;return[e.baseUrl,t]})))}),[t]);return o.useCallback((function(t){var n=Ae(e,t);if(!1===n)return!1;if(null==t||!t.id)return!1;var a=Object.keys(r).find((function(e){return null==t?void 0:t.id.startsWith(e)}));if(!a)return!1;var o=Ae(r[a],t);return!1!==o&&(Pe(n)?n:Pe(o)?o:t.id)}),[r,e])}; //# sourceMappingURL=index.cjs.js.map diff --git a/src/frontend/packages/semantic-data-provider/dist/index.cjs.js.map b/src/frontend/packages/semantic-data-provider/dist/index.cjs.js.map index 4493be7aa..477816009 100644 --- a/src/frontend/packages/semantic-data-provider/dist/index.cjs.js.map +++ b/src/frontend/packages/semantic-data-provider/dist/index.cjs.js.map @@ -1 +1 @@ -{"version":3,"file":"index.cjs.js","sources":["../../../node_modules/url-join/lib/url-join.js","../src/dataProvider/utils/fetchResource.js","../src/dataProvider/methods/getOne.js","../src/dataProvider/utils/uploadAllFiles.js","../src/dataProvider/utils/getServerKeyFromType.js","../src/dataProvider/utils/parseServerKeys.js","../src/dataProvider/utils/findContainersWithTypes.js","../src/dataProvider/methods/create.js","../src/dataProvider/methods/delete.js","../src/dataProvider/methods/deleteMany.js","../src/dataProvider/methods/getDataServers.js","../src/dataProvider/methods/getDataModels.js","../src/dataProvider/utils/fetchContainers.js","../node_modules/isobject/index.js","../src/dataProvider/utils/getEmbedFrame.js","../src/dataProvider/utils/resolvePrefix.js","../src/dataProvider/utils/buildBaseQuery.js","../../../node_modules/crypto-js/core.js","../../../node_modules/crypto-js/md5.js","../src/dataProvider/utils/buildBlankNodesQuery.js","../src/dataProvider/utils/buildSparqlQuery.js","../src/dataProvider/utils/getBlankNodesFromDataServers.js","../src/dataProvider/utils/fetchSparqlEndpoints.js","../src/dataProvider/utils/findContainersWithPath.js","../src/dataProvider/methods/getList.js","../src/dataProvider/methods/getMany.js","../src/dataProvider/methods/getManyReference.js","../src/dataProvider/methods/update.js","../../../node_modules/jwt-decode/build/jwt-decode.esm.js","../src/dataProvider/utils/fetchUserConfig.js","../src/dataProvider/utils/fetchVoidEndpoints.js","../src/dataProvider/utils/getServerKeyFromUri.js","../src/hooks/useGetExternalLink.js","../src/hooks/useDataModel.js","../src/hooks/useDataServers.js","../src/dataProvider/utils/findCreateContainerWithTypes.js","../src/reification/FilterHandler.js","../src/reification/ReificationArrayInput.js","../src/reification/GroupedReferenceHandler.js","../src/dataProvider/dataProvider.js","../src/dataProvider/httpClient.js","../src/hooks/useContainers.js","../src/hooks/useCreateContainer.js","../src/hooks/useDataModels.js"],"sourcesContent":["(function (name, context, definition) {\n if (typeof module !== 'undefined' && module.exports) module.exports = definition();\n else if (typeof define === 'function' && define.amd) define(definition);\n else context[name] = definition();\n})('urljoin', this, function () {\n\n function normalize (strArray) {\n var resultArray = [];\n if (strArray.length === 0) { return ''; }\n\n if (typeof strArray[0] !== 'string') {\n throw new TypeError('Url must be a string. Received ' + strArray[0]);\n }\n\n // If the first part is a plain protocol, we combine it with the next part.\n if (strArray[0].match(/^[^/:]+:\\/*$/) && strArray.length > 1) {\n var first = strArray.shift();\n strArray[0] = first + strArray[0];\n }\n\n // There must be two or three slashes in the file protocol, two slashes in anything else.\n if (strArray[0].match(/^file:\\/\\/\\//)) {\n strArray[0] = strArray[0].replace(/^([^/:]+):\\/*/, '$1:///');\n } else {\n strArray[0] = strArray[0].replace(/^([^/:]+):\\/*/, '$1://');\n }\n\n for (var i = 0; i < strArray.length; i++) {\n var component = strArray[i];\n\n if (typeof component !== 'string') {\n throw new TypeError('Url must be a string. Received ' + component);\n }\n\n if (component === '') { continue; }\n\n if (i > 0) {\n // Removing the starting slashes for each component but the first.\n component = component.replace(/^[\\/]+/, '');\n }\n if (i < strArray.length - 1) {\n // Removing the ending slashes for each component but the last.\n component = component.replace(/[\\/]+$/, '');\n } else {\n // For the last component we will combine multiple slashes to a single one.\n component = component.replace(/[\\/]+$/, '/');\n }\n\n resultArray.push(component);\n\n }\n\n var str = resultArray.join('/');\n // Each input component is now separated by a single slash except the possible first plain protocol part.\n\n // remove trailing slash before parameters or hash\n str = str.replace(/\\/(\\?|&|#[^!])/g, '$1');\n\n // replace ? in parameters with &\n var parts = str.split('?');\n str = parts.shift() + (parts.length > 0 ? '?': '') + parts.join('&');\n\n return str;\n }\n\n return function () {\n var input;\n\n if (typeof arguments[0] === 'object') {\n input = arguments[0];\n } else {\n input = [].slice.call(arguments);\n }\n\n return normalize(input);\n };\n\n});\n","import jsonld from 'jsonld';\n\nconst fetchResource = async (resourceUri, config) => {\n const { httpClient, jsonContext } = config;\n\n let { json: data } = await httpClient(resourceUri);\n\n data.id = data.id || data['@id'];\n\n // We compact only if the context is different between the frontend and the middleware\n // TODO deep compare if the context is an object\n if (data['@context'] !== jsonContext) {\n data = await jsonld.compact(data, jsonContext);\n }\n\n return data;\n};\n\nexport default fetchResource;\n","import fetchResource from '../utils/fetchResource';\n\nconst getOneMethod = config => async (resourceId, params) => {\n const { resources } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) throw new Error(`Resource ${resourceId} is not mapped in resources file`);\n\n const data = await fetchResource(params.id, config);\n\n // Transform single value into array if forceArray is set\n if (dataModel.list?.forceArray) {\n for (const forceArrayItem of dataModel.list?.forceArray) {\n if (data[forceArrayItem] && !Array.isArray(data[forceArrayItem])) {\n data[forceArrayItem] = [data[forceArrayItem]];\n }\n }\n }\n\n // TODO activate defaultFetchPlan option\n // if (dataModel.list?.defaultFetchPlan) {\n // for (const node of dataModel.list?.defaultFetchPlan) {\n // if (\n // data[node] &&\n // typeof data[node] === 'string' &&\n // data[node].startsWith('http')\n // ) {\n // try {\n // const dataToEmbed = await fetchResource(data[node], config);\n // delete dataToEmbed['@context'];\n // data[node] = dataToEmbed;\n // } catch (e) {\n // // Ignore errors (this may happen if user does not have rights to see the resource)\n // }\n // }\n // }\n // }\n\n return { data };\n};\n\nexport default getOneMethod;\n","import createSlug from 'speakingurl';\nimport urlJoin from 'url-join';\n\nexport const getSlugWithExtension = fileName => {\n let fileExtension = '';\n let splitFileName = fileName.split('.');\n if (splitFileName.length > 1) {\n fileExtension = splitFileName.pop();\n fileName = splitFileName.join('.');\n }\n return createSlug(fileName, { lang: 'fr' }) + '.' + fileExtension;\n};\n\nexport const isFile = o => o && o.rawFile && o.rawFile instanceof File;\n\nconst getUploadsContainerUri = config => {\n const serverKey = Object.keys(config.dataServers).find(key => config.dataServers[key].uploadsContainer);\n if (serverKey) {\n return urlJoin(config.dataServers[serverKey].baseUrl, config.dataServers[serverKey].uploadsContainer);\n }\n};\n\nconst uploadFile = async (rawFile, config) => {\n const uploadsContainerUri = getUploadsContainerUri(config);\n if (!uploadsContainerUri) throw new Error(\"You must define an uploadsContainer in one of the server's configuration\");\n\n console.log('upload raw file', typeof rawFile, rawFile)\n\n const response = await config.httpClient(uploadsContainerUri, {\n method: 'POST',\n body: rawFile,\n headers: new Headers({\n // We must sluggify the file name, because we can't use non-ASCII characters in the header\n // However we keep the extension apart (if it exists) so that it is not replaced with a -\n // TODO let the middleware guess the extension based on the content type\n Slug: getSlugWithExtension(rawFile.name),\n 'Content-Type': rawFile.type\n })\n });\n\n if (response.status === 201) {\n return response.headers.get('Location');\n }\n};\n\n/*\n * Look for raw files in the record data.\n * If there are any, upload them and replace the file by its URL.\n */\nconst uploadAllFiles = async (record, config) => {\n for (let property in record) {\n if (record.hasOwnProperty(property)) {\n if (Array.isArray(record[property])) {\n for (let i = 0; i < record[property].length; i++) {\n if (isFile(record[property][i])) {\n record[property][i] = await uploadFile(record[property][i].rawFile, config);\n }\n }\n } else {\n if (isFile(record[property])) {\n record[property] = await uploadFile(record[property].rawFile, config);\n }\n }\n }\n }\n return record;\n};\n\nexport default uploadAllFiles;\n","const getServerKeyFromType = (type, dataServers) => {\n return Object.keys(dataServers).find(key => {\n return dataServers[key][type];\n });\n};\n\nexport default getServerKeyFromType;\n","import getServerKeyFromType from './getServerKeyFromType';\n\nconst parseServerKey = (serverKey, dataServers) => {\n switch (serverKey) {\n case '@default':\n return getServerKeyFromType('default', dataServers);\n case '@pod':\n return getServerKeyFromType('pod', dataServers);\n case '@authServer':\n return getServerKeyFromType('authServer', dataServers);\n default:\n return serverKey;\n }\n};\n\n// Return the list of servers keys in an array\n// parsing keywords like @all, @default, @pod and @authServer\nconst parseServerKeys = (serverKeys, dataServers) => {\n if (Array.isArray(serverKeys)) {\n if (serverKeys.includes('@all')) {\n return Object.keys(dataServers);\n } else {\n return serverKeys.map(serverKey => parseServerKey(serverKey, dataServers));\n }\n } else if (typeof serverKeys === 'string') {\n if (serverKeys === '@all') {\n return Object.keys(dataServers);\n } else if (serverKeys === '@remote') {\n const defaultServerKey = getServerKeyFromType('default', dataServers);\n return Object.keys(dataServers).filter(serverKey => serverKey !== defaultServerKey);\n } else {\n return [parseServerKey(serverKeys, dataServers)];\n }\n } else {\n // If server key is empty\n return false;\n }\n};\n\nexport default parseServerKeys;\n","import urlJoin from 'url-join';\nimport parseServerKeys from './parseServerKeys';\n\nconst findContainersWithTypes = (types, serverKeys, dataServers) => {\n let containers = {};\n let existingContainers = [];\n\n serverKeys = parseServerKeys(serverKeys, dataServers);\n\n Object.keys(dataServers).forEach(key1 => {\n Object.keys(dataServers[key1].containers).forEach(key2 => {\n if (!serverKeys || serverKeys.includes(key2)) {\n Object.keys(dataServers[key1].containers[key2]).forEach(type => {\n if (types.includes(type)) {\n dataServers[key1].containers[key2][type].map(path => {\n const containerUri = urlJoin(dataServers[key2].baseUrl, path);\n\n // Avoid returning the same container several times\n if (!existingContainers.includes(containerUri)) {\n existingContainers.push(containerUri);\n\n if (!containers[key1]) containers[key1] = [];\n containers[key1].push(containerUri);\n }\n });\n }\n });\n }\n });\n });\n return containers;\n};\n\nexport default findContainersWithTypes;\n","import urlJoin from 'url-join';\nimport getOne from './getOne';\nimport uploadAllFiles from '../utils/uploadAllFiles';\nimport findContainersWithTypes from '../utils/findContainersWithTypes';\n\nconst createMethod = config => async (resourceId, params) => {\n const { dataServers, resources, httpClient, jsonContext } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) Error(`Resource ${resourceId} is not mapped in resources file`);\n\n const headers = new Headers();\n\n let containerUri, serverKey;\n if (dataModel.create?.container) {\n serverKey = Object.keys(dataModel.create.container)[0];\n containerUri = urlJoin(dataServers[serverKey].baseUrl, Object.values(dataModel.create.container)[0]);\n } else {\n serverKey = dataModel.create?.server || Object.keys(dataServers).find(key => dataServers[key].default === true);\n if (!serverKey) throw new Error('You must define a server for the creation, or a container, or a default server');\n\n const containers = findContainersWithTypes(dataModel.types, [serverKey], dataServers);\n // Extract the containerUri from the results (and ensure there is only one)\n const serverKeys = Object.keys(containers);\n\n if (!serverKeys || serverKeys.length === 0)\n throw new Error(`No container with types ${JSON.stringify(dataModel.types)} found on server ${serverKey}`);\n if (serverKeys.length > 1 || containers[serverKeys[0]].length > 1)\n throw new Error(\n `More than one container detected with types ${JSON.stringify(dataModel.types)} on server ${serverKey}`\n );\n containerUri = containers[serverKeys[0]][0];\n }\n\n if (params.data) {\n if (dataModel.fieldsMapping?.title) {\n if (Array.isArray(dataModel.fieldsMapping.title)) {\n headers.set('Slug', dataModel.fieldsMapping.title.map(f => params.data[f]).join(' '));\n } else {\n headers.set('Slug', params.data[dataModel.fieldsMapping.title]);\n }\n }\n\n // Upload files, if there are any\n params.data = await uploadAllFiles(params.data, config);\n\n const { headers: responseHeaders } = await httpClient(containerUri, {\n method: 'POST',\n headers,\n body: JSON.stringify({\n '@context': jsonContext,\n '@type': dataModel.types,\n ...params.data\n })\n });\n\n // Retrieve newly-created resource\n const resourceUri = responseHeaders.get('Location');\n return await getOne(config)(resourceId, { id: resourceUri });\n } else if (params.id) {\n headers.set('Content-Type', 'application/sparql-update');\n\n await httpClient(containerUri, {\n method: 'PATCH',\n headers,\n body: `\n PREFIX ldp: \n INSERT DATA { <${containerUri}> ldp:contains <${params.id}>. };\n `,\n });\n\n // Create must return the new data, so get them from the remote URI\n return await getOne(config)(resourceId, { id: params.id });\n }\n};\n\nexport default createMethod;\n","const deleteMethod = config => async (resourceId, params) => {\n const { httpClient } = config;\n\n await httpClient(params.id, {\n method: 'DELETE'\n });\n\n return { data: { id: params.id } };\n};\n\nexport default deleteMethod;\n","const deleteManyMethod = config => async (resourceId, params) => {\n const { httpClient } = config;\n let ids = [];\n\n for (let id of params.ids) {\n try {\n await httpClient(id, {\n method: 'DELETE'\n });\n ids.push(id);\n } catch (e) {\n // Do nothing if we fail to delete a resource\n }\n }\n\n return { data: ids };\n};\n\nexport default deleteManyMethod;\n","const getDataServers = config => () => {\n return config.dataServers;\n};\n\nexport default getDataServers;\n","const getDataModels = config => () => {\n return config.resources;\n};\n\nexport default getDataModels;\n","import jsonld from 'jsonld';\nimport isobject from 'isobject';\n\nexport const isType = (type, resource) => {\n const resourceType = resource.type || resource['@type'];\n return Array.isArray(resourceType) ? resourceType.includes(type) : resourceType === type;\n};\n\nconst fetchContainers = async (containers, resourceId, params, config) => {\n const { httpClient, jsonContext } = config;\n\n // Transform in an containerUri:serverKey object\n const containersServers = Object.keys(containers).reduce(\n (acc, serverKey) => ({\n ...acc,\n ...Object.fromEntries(containers[serverKey].map(containerUri => [containerUri, serverKey]))\n }),\n {}\n );\n\n const fetchPromises = Object.keys(containersServers).map(containerUri =>\n httpClient(containerUri)\n .then(({ json }) => {\n // If container's context is different, compact it to have an uniform result\n // TODO deep compare if the context is an object\n if (json['@context'] !== jsonContext) {\n return jsonld.compact(json, jsonContext);\n } else {\n return json;\n }\n })\n .then(json => {\n if (isType('ldp:Container', json)) {\n return json['ldp:contains'];\n } else {\n throw new Error(containerUri + ' is not a LDP container');\n }\n })\n );\n\n // Fetch simultaneously all containers\n let results = await Promise.all(fetchPromises);\n\n if (results.length === 0) {\n return { data: [], total: 0 };\n } else {\n // Merge all results in one array\n results = [].concat.apply(...results);\n\n let returnData = results.map(item => {\n item.id = item.id || item['@id'];\n return item;\n });\n\n // Apply filter to results\n if (params.filter) {\n // For SPARQL queries, we use \"a\" to filter types, but in containers it must be \"type\"\n if (params.filter.a) {\n params.filter.type = params.filter.a;\n delete params.filter.a;\n }\n\n if (Object.keys(params.filter).length > 0) {\n returnData = returnData.filter(resource => {\n return Object.entries(params.filter).some(([k, v]) => {\n if (k == 'q') {\n // if fiter is q, all properties have to be checked\n return Object.entries(resource).some(([kr, vr]) => {\n if (!isobject(vr)) {\n return Array.isArray(vr) ? vr.some(va => va.includes(v)) : vr.includes(v);\n } else {\n return false;\n }\n });\n } else {\n return Array.isArray(resource[k]) ? resource[k].includes(v) : resource[k].includes(v);\n }\n });\n });\n }\n }\n\n if (params.sort) {\n returnData = returnData.sort((a, b) => {\n if (a[params.sort.field] && b[params.sort.field]) {\n if (params.sort.order === 'ASC') {\n return a[params.sort.field].localeCompare(b[params.sort.field]);\n } else {\n return b[params.sort.field].localeCompare(a[params.sort.field]);\n }\n } else {\n return true;\n }\n });\n }\n if (params.pagination) {\n returnData = returnData.slice(\n (params.pagination.page - 1) * params.pagination.perPage,\n params.pagination.page * params.pagination.perPage\n );\n }\n\n return { data: returnData, total: results.length };\n }\n};\n\nexport default fetchContainers;\n","/*!\n * isobject \n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nexport default function isObject(val) {\n return val != null && typeof val === 'object' && Array.isArray(val) === false;\n};\n","const getEmbedFrame = blankNodes => {\n let embedFrame = {},\n predicates;\n if (blankNodes) {\n for (let blankNode of blankNodes) {\n if (blankNode.includes('/')) {\n predicates = blankNode.split('/').reverse();\n } else {\n predicates = [blankNode];\n }\n embedFrame = {\n ...embedFrame,\n ...predicates.reduce(\n (accumulator, predicate) => ({\n [predicate]: {\n '@embed': '@last',\n ...accumulator\n }\n }),\n {}\n )\n };\n }\n return embedFrame;\n }\n};\n\nexport default getEmbedFrame;\n","const resolvePrefix = (item, ontologies) => {\n if (item.startsWith('http://') || item.startsWith('https://')) {\n // Already resolved, return the URI\n return item;\n } else if (item === 'a') {\n // Special case\n return 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type';\n } else {\n const [prefix, value] = item.split(':');\n if (value) {\n const ontology = ontologies.find(ontology => ontology.prefix === prefix);\n if (ontology) {\n return ontology.url + value;\n } else {\n throw new Error('No ontology found with prefix ' + prefix);\n }\n } else {\n throw new Error(`The value \"${item}\" is not correct. It must include a prefix or be a full URI.`);\n }\n }\n};\n\nexport default resolvePrefix;\n","import { namedNode, triple, variable } from '@rdfjs/data-model';\nimport resolvePrefix from './resolvePrefix';\n\nconst defaultToArray = value => (!value ? [] : Array.isArray(value) ? value : [value]);\n\n// We need to always include the type or React-Admin will not work properly\nconst typeQuery = triple(\n variable('s1'),\n namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),\n variable('type')\n);\n\nconst buildBaseQuery = (predicates, ontologies) => {\n let baseTriples;\n if (predicates) {\n baseTriples = defaultToArray(predicates).map((predicate, i) =>\n triple(variable('s1'), namedNode(resolvePrefix(predicate, ontologies)), variable('o' + (i + 1)))\n );\n return {\n construct: [typeQuery, ...baseTriples],\n where: [typeQuery, ...baseTriples.map(triple => ({ type: 'optional', patterns: [triple] }))]\n };\n } else {\n baseTriples = [triple(variable('s1'), variable('p1'), variable('o1'))];\n return {\n construct: baseTriples,\n where: baseTriples\n };\n }\n};\n\nexport default buildBaseQuery;\n",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory();\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\troot.CryptoJS = factory();\n\t}\n}(this, function () {\n\n\t/*globals window, global, require*/\n\n\t/**\n\t * CryptoJS core components.\n\t */\n\tvar CryptoJS = CryptoJS || (function (Math, undefined) {\n\n\t var crypto;\n\n\t // Native crypto from window (Browser)\n\t if (typeof window !== 'undefined' && window.crypto) {\n\t crypto = window.crypto;\n\t }\n\n\t // Native crypto in web worker (Browser)\n\t if (typeof self !== 'undefined' && self.crypto) {\n\t crypto = self.crypto;\n\t }\n\n\t // Native crypto from worker\n\t if (typeof globalThis !== 'undefined' && globalThis.crypto) {\n\t crypto = globalThis.crypto;\n\t }\n\n\t // Native (experimental IE 11) crypto from window (Browser)\n\t if (!crypto && typeof window !== 'undefined' && window.msCrypto) {\n\t crypto = window.msCrypto;\n\t }\n\n\t // Native crypto from global (NodeJS)\n\t if (!crypto && typeof global !== 'undefined' && global.crypto) {\n\t crypto = global.crypto;\n\t }\n\n\t // Native crypto import via require (NodeJS)\n\t if (!crypto && typeof require === 'function') {\n\t try {\n\t crypto = require('crypto');\n\t } catch (err) {}\n\t }\n\n\t /*\n\t * Cryptographically secure pseudorandom number generator\n\t *\n\t * As Math.random() is cryptographically not safe to use\n\t */\n\t var cryptoSecureRandomInt = function () {\n\t if (crypto) {\n\t // Use getRandomValues method (Browser)\n\t if (typeof crypto.getRandomValues === 'function') {\n\t try {\n\t return crypto.getRandomValues(new Uint32Array(1))[0];\n\t } catch (err) {}\n\t }\n\n\t // Use randomBytes method (NodeJS)\n\t if (typeof crypto.randomBytes === 'function') {\n\t try {\n\t return crypto.randomBytes(4).readInt32LE();\n\t } catch (err) {}\n\t }\n\t }\n\n\t throw new Error('Native crypto module could not be used to get secure random number.');\n\t };\n\n\t /*\n\t * Local polyfill of Object.create\n\n\t */\n\t var create = Object.create || (function () {\n\t function F() {}\n\n\t return function (obj) {\n\t var subtype;\n\n\t F.prototype = obj;\n\n\t subtype = new F();\n\n\t F.prototype = null;\n\n\t return subtype;\n\t };\n\t }());\n\n\t /**\n\t * CryptoJS namespace.\n\t */\n\t var C = {};\n\n\t /**\n\t * Library namespace.\n\t */\n\t var C_lib = C.lib = {};\n\n\t /**\n\t * Base object for prototypal inheritance.\n\t */\n\t var Base = C_lib.Base = (function () {\n\n\n\t return {\n\t /**\n\t * Creates a new object that inherits from this object.\n\t *\n\t * @param {Object} overrides Properties to copy into the new object.\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * field: 'value',\n\t *\n\t * method: function () {\n\t * }\n\t * });\n\t */\n\t extend: function (overrides) {\n\t // Spawn\n\t var subtype = create(this);\n\n\t // Augment\n\t if (overrides) {\n\t subtype.mixIn(overrides);\n\t }\n\n\t // Create default initializer\n\t if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {\n\t subtype.init = function () {\n\t subtype.$super.init.apply(this, arguments);\n\t };\n\t }\n\n\t // Initializer's prototype is the subtype object\n\t subtype.init.prototype = subtype;\n\n\t // Reference supertype\n\t subtype.$super = this;\n\n\t return subtype;\n\t },\n\n\t /**\n\t * Extends this object and runs the init method.\n\t * Arguments to create() will be passed to init().\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var instance = MyType.create();\n\t */\n\t create: function () {\n\t var instance = this.extend();\n\t instance.init.apply(instance, arguments);\n\n\t return instance;\n\t },\n\n\t /**\n\t * Initializes a newly created object.\n\t * Override this method to add some logic when your objects are created.\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * init: function () {\n\t * // ...\n\t * }\n\t * });\n\t */\n\t init: function () {\n\t },\n\n\t /**\n\t * Copies properties into this object.\n\t *\n\t * @param {Object} properties The properties to mix in.\n\t *\n\t * @example\n\t *\n\t * MyType.mixIn({\n\t * field: 'value'\n\t * });\n\t */\n\t mixIn: function (properties) {\n\t for (var propertyName in properties) {\n\t if (properties.hasOwnProperty(propertyName)) {\n\t this[propertyName] = properties[propertyName];\n\t }\n\t }\n\n\t // IE won't copy toString using the loop above\n\t if (properties.hasOwnProperty('toString')) {\n\t this.toString = properties.toString;\n\t }\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = instance.clone();\n\t */\n\t clone: function () {\n\t return this.init.prototype.extend(this);\n\t }\n\t };\n\t }());\n\n\t /**\n\t * An array of 32-bit words.\n\t *\n\t * @property {Array} words The array of 32-bit words.\n\t * @property {number} sigBytes The number of significant bytes in this word array.\n\t */\n\t var WordArray = C_lib.WordArray = Base.extend({\n\t /**\n\t * Initializes a newly created word array.\n\t *\n\t * @param {Array} words (Optional) An array of 32-bit words.\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.create();\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\n\t */\n\t init: function (words, sigBytes) {\n\t words = this.words = words || [];\n\n\t if (sigBytes != undefined) {\n\t this.sigBytes = sigBytes;\n\t } else {\n\t this.sigBytes = words.length * 4;\n\t }\n\t },\n\n\t /**\n\t * Converts this word array to a string.\n\t *\n\t * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n\t *\n\t * @return {string} The stringified word array.\n\t *\n\t * @example\n\t *\n\t * var string = wordArray + '';\n\t * var string = wordArray.toString();\n\t * var string = wordArray.toString(CryptoJS.enc.Utf8);\n\t */\n\t toString: function (encoder) {\n\t return (encoder || Hex).stringify(this);\n\t },\n\n\t /**\n\t * Concatenates a word array to this word array.\n\t *\n\t * @param {WordArray} wordArray The word array to append.\n\t *\n\t * @return {WordArray} This word array.\n\t *\n\t * @example\n\t *\n\t * wordArray1.concat(wordArray2);\n\t */\n\t concat: function (wordArray) {\n\t // Shortcuts\n\t var thisWords = this.words;\n\t var thatWords = wordArray.words;\n\t var thisSigBytes = this.sigBytes;\n\t var thatSigBytes = wordArray.sigBytes;\n\n\t // Clamp excess bits\n\t this.clamp();\n\n\t // Concat\n\t if (thisSigBytes % 4) {\n\t // Copy one byte at a time\n\t for (var i = 0; i < thatSigBytes; i++) {\n\t var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\n\t }\n\t } else {\n\t // Copy one word at a time\n\t for (var j = 0; j < thatSigBytes; j += 4) {\n\t thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2];\n\t }\n\t }\n\t this.sigBytes += thatSigBytes;\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Removes insignificant bits.\n\t *\n\t * @example\n\t *\n\t * wordArray.clamp();\n\t */\n\t clamp: function () {\n\t // Shortcuts\n\t var words = this.words;\n\t var sigBytes = this.sigBytes;\n\n\t // Clamp\n\t words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\n\t words.length = Math.ceil(sigBytes / 4);\n\t },\n\n\t /**\n\t * Creates a copy of this word array.\n\t *\n\t * @return {WordArray} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = wordArray.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone.words = this.words.slice(0);\n\n\t return clone;\n\t },\n\n\t /**\n\t * Creates a word array filled with random bytes.\n\t *\n\t * @param {number} nBytes The number of random bytes to generate.\n\t *\n\t * @return {WordArray} The random word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.random(16);\n\t */\n\t random: function (nBytes) {\n\t var words = [];\n\n\t for (var i = 0; i < nBytes; i += 4) {\n\t words.push(cryptoSecureRandomInt());\n\t }\n\n\t return new WordArray.init(words, nBytes);\n\t }\n\t });\n\n\t /**\n\t * Encoder namespace.\n\t */\n\t var C_enc = C.enc = {};\n\n\t /**\n\t * Hex encoding strategy.\n\t */\n\t var Hex = C_enc.Hex = {\n\t /**\n\t * Converts a word array to a hex string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The hex string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var hexChars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t hexChars.push((bite >>> 4).toString(16));\n\t hexChars.push((bite & 0x0f).toString(16));\n\t }\n\n\t return hexChars.join('');\n\t },\n\n\t /**\n\t * Converts a hex string to a word array.\n\t *\n\t * @param {string} hexStr The hex string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Hex.parse(hexString);\n\t */\n\t parse: function (hexStr) {\n\t // Shortcut\n\t var hexStrLength = hexStr.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < hexStrLength; i += 2) {\n\t words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\n\t }\n\n\t return new WordArray.init(words, hexStrLength / 2);\n\t }\n\t };\n\n\t /**\n\t * Latin1 encoding strategy.\n\t */\n\t var Latin1 = C_enc.Latin1 = {\n\t /**\n\t * Converts a word array to a Latin1 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The Latin1 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var latin1Chars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t latin1Chars.push(String.fromCharCode(bite));\n\t }\n\n\t return latin1Chars.join('');\n\t },\n\n\t /**\n\t * Converts a Latin1 string to a word array.\n\t *\n\t * @param {string} latin1Str The Latin1 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\n\t */\n\t parse: function (latin1Str) {\n\t // Shortcut\n\t var latin1StrLength = latin1Str.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < latin1StrLength; i++) {\n\t words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\n\t }\n\n\t return new WordArray.init(words, latin1StrLength);\n\t }\n\t };\n\n\t /**\n\t * UTF-8 encoding strategy.\n\t */\n\t var Utf8 = C_enc.Utf8 = {\n\t /**\n\t * Converts a word array to a UTF-8 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The UTF-8 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t try {\n\t return decodeURIComponent(escape(Latin1.stringify(wordArray)));\n\t } catch (e) {\n\t throw new Error('Malformed UTF-8 data');\n\t }\n\t },\n\n\t /**\n\t * Converts a UTF-8 string to a word array.\n\t *\n\t * @param {string} utf8Str The UTF-8 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\n\t */\n\t parse: function (utf8Str) {\n\t return Latin1.parse(unescape(encodeURIComponent(utf8Str)));\n\t }\n\t };\n\n\t /**\n\t * Abstract buffered block algorithm template.\n\t *\n\t * The property blockSize must be implemented in a concrete subtype.\n\t *\n\t * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\n\t */\n\t var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\n\t /**\n\t * Resets this block algorithm's data buffer to its initial state.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm.reset();\n\t */\n\t reset: function () {\n\t // Initial values\n\t this._data = new WordArray.init();\n\t this._nDataBytes = 0;\n\t },\n\n\t /**\n\t * Adds new data to this block algorithm's buffer.\n\t *\n\t * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm._append('data');\n\t * bufferedBlockAlgorithm._append(wordArray);\n\t */\n\t _append: function (data) {\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof data == 'string') {\n\t data = Utf8.parse(data);\n\t }\n\n\t // Append\n\t this._data.concat(data);\n\t this._nDataBytes += data.sigBytes;\n\t },\n\n\t /**\n\t * Processes available data blocks.\n\t *\n\t * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n\t *\n\t * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\n\t *\n\t * @return {WordArray} The processed data.\n\t *\n\t * @example\n\t *\n\t * var processedData = bufferedBlockAlgorithm._process();\n\t * var processedData = bufferedBlockAlgorithm._process(!!'flush');\n\t */\n\t _process: function (doFlush) {\n\t var processedWords;\n\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\t var dataSigBytes = data.sigBytes;\n\t var blockSize = this.blockSize;\n\t var blockSizeBytes = blockSize * 4;\n\n\t // Count blocks ready\n\t var nBlocksReady = dataSigBytes / blockSizeBytes;\n\t if (doFlush) {\n\t // Round up to include partial blocks\n\t nBlocksReady = Math.ceil(nBlocksReady);\n\t } else {\n\t // Round down to include only full blocks,\n\t // less the number of blocks that must remain in the buffer\n\t nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\n\t }\n\n\t // Count words ready\n\t var nWordsReady = nBlocksReady * blockSize;\n\n\t // Count bytes ready\n\t var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\n\n\t // Process blocks\n\t if (nWordsReady) {\n\t for (var offset = 0; offset < nWordsReady; offset += blockSize) {\n\t // Perform concrete-algorithm logic\n\t this._doProcessBlock(dataWords, offset);\n\t }\n\n\t // Remove processed words\n\t processedWords = dataWords.splice(0, nWordsReady);\n\t data.sigBytes -= nBytesReady;\n\t }\n\n\t // Return processed words\n\t return new WordArray.init(processedWords, nBytesReady);\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = bufferedBlockAlgorithm.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone._data = this._data.clone();\n\n\t return clone;\n\t },\n\n\t _minBufferSize: 0\n\t });\n\n\t /**\n\t * Abstract hasher template.\n\t *\n\t * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\n\t */\n\t var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\n\t /**\n\t * Configuration options.\n\t */\n\t cfg: Base.extend(),\n\n\t /**\n\t * Initializes a newly created hasher.\n\t *\n\t * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\n\t *\n\t * @example\n\t *\n\t * var hasher = CryptoJS.algo.SHA256.create();\n\t */\n\t init: function (cfg) {\n\t // Apply config defaults\n\t this.cfg = this.cfg.extend(cfg);\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this hasher to its initial state.\n\t *\n\t * @example\n\t *\n\t * hasher.reset();\n\t */\n\t reset: function () {\n\t // Reset data buffer\n\t BufferedBlockAlgorithm.reset.call(this);\n\n\t // Perform concrete-hasher logic\n\t this._doReset();\n\t },\n\n\t /**\n\t * Updates this hasher with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {Hasher} This hasher.\n\t *\n\t * @example\n\t *\n\t * hasher.update('message');\n\t * hasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t // Append\n\t this._append(messageUpdate);\n\n\t // Update the hash\n\t this._process();\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the hash computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @example\n\t *\n\t * var hash = hasher.finalize();\n\t * var hash = hasher.finalize('message');\n\t * var hash = hasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Final message update\n\t if (messageUpdate) {\n\t this._append(messageUpdate);\n\t }\n\n\t // Perform concrete-hasher logic\n\t var hash = this._doFinalize();\n\n\t return hash;\n\t },\n\n\t blockSize: 512/32,\n\n\t /**\n\t * Creates a shortcut function to a hasher's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to create a helper for.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHelper: function (hasher) {\n\t return function (message, cfg) {\n\t return new hasher.init(cfg).finalize(message);\n\t };\n\t },\n\n\t /**\n\t * Creates a shortcut function to the HMAC's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to use in this HMAC helper.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHmacHelper: function (hasher) {\n\t return function (message, key) {\n\t return new C_algo.HMAC.init(hasher, key).finalize(message);\n\t };\n\t }\n\t });\n\n\t /**\n\t * Algorithm namespace.\n\t */\n\t var C_algo = C.algo = {};\n\n\t return C;\n\t}(Math));\n\n\n\treturn CryptoJS;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function (Math) {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var Hasher = C_lib.Hasher;\n\t var C_algo = C.algo;\n\n\t // Constants table\n\t var T = [];\n\n\t // Compute constants\n\t (function () {\n\t for (var i = 0; i < 64; i++) {\n\t T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;\n\t }\n\t }());\n\n\t /**\n\t * MD5 hash algorithm.\n\t */\n\t var MD5 = C_algo.MD5 = Hasher.extend({\n\t _doReset: function () {\n\t this._hash = new WordArray.init([\n\t 0x67452301, 0xefcdab89,\n\t 0x98badcfe, 0x10325476\n\t ]);\n\t },\n\n\t _doProcessBlock: function (M, offset) {\n\t // Swap endian\n\t for (var i = 0; i < 16; i++) {\n\t // Shortcuts\n\t var offset_i = offset + i;\n\t var M_offset_i = M[offset_i];\n\n\t M[offset_i] = (\n\t (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |\n\t (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)\n\t );\n\t }\n\n\t // Shortcuts\n\t var H = this._hash.words;\n\n\t var M_offset_0 = M[offset + 0];\n\t var M_offset_1 = M[offset + 1];\n\t var M_offset_2 = M[offset + 2];\n\t var M_offset_3 = M[offset + 3];\n\t var M_offset_4 = M[offset + 4];\n\t var M_offset_5 = M[offset + 5];\n\t var M_offset_6 = M[offset + 6];\n\t var M_offset_7 = M[offset + 7];\n\t var M_offset_8 = M[offset + 8];\n\t var M_offset_9 = M[offset + 9];\n\t var M_offset_10 = M[offset + 10];\n\t var M_offset_11 = M[offset + 11];\n\t var M_offset_12 = M[offset + 12];\n\t var M_offset_13 = M[offset + 13];\n\t var M_offset_14 = M[offset + 14];\n\t var M_offset_15 = M[offset + 15];\n\n\t // Working varialbes\n\t var a = H[0];\n\t var b = H[1];\n\t var c = H[2];\n\t var d = H[3];\n\n\t // Computation\n\t a = FF(a, b, c, d, M_offset_0, 7, T[0]);\n\t d = FF(d, a, b, c, M_offset_1, 12, T[1]);\n\t c = FF(c, d, a, b, M_offset_2, 17, T[2]);\n\t b = FF(b, c, d, a, M_offset_3, 22, T[3]);\n\t a = FF(a, b, c, d, M_offset_4, 7, T[4]);\n\t d = FF(d, a, b, c, M_offset_5, 12, T[5]);\n\t c = FF(c, d, a, b, M_offset_6, 17, T[6]);\n\t b = FF(b, c, d, a, M_offset_7, 22, T[7]);\n\t a = FF(a, b, c, d, M_offset_8, 7, T[8]);\n\t d = FF(d, a, b, c, M_offset_9, 12, T[9]);\n\t c = FF(c, d, a, b, M_offset_10, 17, T[10]);\n\t b = FF(b, c, d, a, M_offset_11, 22, T[11]);\n\t a = FF(a, b, c, d, M_offset_12, 7, T[12]);\n\t d = FF(d, a, b, c, M_offset_13, 12, T[13]);\n\t c = FF(c, d, a, b, M_offset_14, 17, T[14]);\n\t b = FF(b, c, d, a, M_offset_15, 22, T[15]);\n\n\t a = GG(a, b, c, d, M_offset_1, 5, T[16]);\n\t d = GG(d, a, b, c, M_offset_6, 9, T[17]);\n\t c = GG(c, d, a, b, M_offset_11, 14, T[18]);\n\t b = GG(b, c, d, a, M_offset_0, 20, T[19]);\n\t a = GG(a, b, c, d, M_offset_5, 5, T[20]);\n\t d = GG(d, a, b, c, M_offset_10, 9, T[21]);\n\t c = GG(c, d, a, b, M_offset_15, 14, T[22]);\n\t b = GG(b, c, d, a, M_offset_4, 20, T[23]);\n\t a = GG(a, b, c, d, M_offset_9, 5, T[24]);\n\t d = GG(d, a, b, c, M_offset_14, 9, T[25]);\n\t c = GG(c, d, a, b, M_offset_3, 14, T[26]);\n\t b = GG(b, c, d, a, M_offset_8, 20, T[27]);\n\t a = GG(a, b, c, d, M_offset_13, 5, T[28]);\n\t d = GG(d, a, b, c, M_offset_2, 9, T[29]);\n\t c = GG(c, d, a, b, M_offset_7, 14, T[30]);\n\t b = GG(b, c, d, a, M_offset_12, 20, T[31]);\n\n\t a = HH(a, b, c, d, M_offset_5, 4, T[32]);\n\t d = HH(d, a, b, c, M_offset_8, 11, T[33]);\n\t c = HH(c, d, a, b, M_offset_11, 16, T[34]);\n\t b = HH(b, c, d, a, M_offset_14, 23, T[35]);\n\t a = HH(a, b, c, d, M_offset_1, 4, T[36]);\n\t d = HH(d, a, b, c, M_offset_4, 11, T[37]);\n\t c = HH(c, d, a, b, M_offset_7, 16, T[38]);\n\t b = HH(b, c, d, a, M_offset_10, 23, T[39]);\n\t a = HH(a, b, c, d, M_offset_13, 4, T[40]);\n\t d = HH(d, a, b, c, M_offset_0, 11, T[41]);\n\t c = HH(c, d, a, b, M_offset_3, 16, T[42]);\n\t b = HH(b, c, d, a, M_offset_6, 23, T[43]);\n\t a = HH(a, b, c, d, M_offset_9, 4, T[44]);\n\t d = HH(d, a, b, c, M_offset_12, 11, T[45]);\n\t c = HH(c, d, a, b, M_offset_15, 16, T[46]);\n\t b = HH(b, c, d, a, M_offset_2, 23, T[47]);\n\n\t a = II(a, b, c, d, M_offset_0, 6, T[48]);\n\t d = II(d, a, b, c, M_offset_7, 10, T[49]);\n\t c = II(c, d, a, b, M_offset_14, 15, T[50]);\n\t b = II(b, c, d, a, M_offset_5, 21, T[51]);\n\t a = II(a, b, c, d, M_offset_12, 6, T[52]);\n\t d = II(d, a, b, c, M_offset_3, 10, T[53]);\n\t c = II(c, d, a, b, M_offset_10, 15, T[54]);\n\t b = II(b, c, d, a, M_offset_1, 21, T[55]);\n\t a = II(a, b, c, d, M_offset_8, 6, T[56]);\n\t d = II(d, a, b, c, M_offset_15, 10, T[57]);\n\t c = II(c, d, a, b, M_offset_6, 15, T[58]);\n\t b = II(b, c, d, a, M_offset_13, 21, T[59]);\n\t a = II(a, b, c, d, M_offset_4, 6, T[60]);\n\t d = II(d, a, b, c, M_offset_11, 10, T[61]);\n\t c = II(c, d, a, b, M_offset_2, 15, T[62]);\n\t b = II(b, c, d, a, M_offset_9, 21, T[63]);\n\n\t // Intermediate hash value\n\t H[0] = (H[0] + a) | 0;\n\t H[1] = (H[1] + b) | 0;\n\t H[2] = (H[2] + c) | 0;\n\t H[3] = (H[3] + d) | 0;\n\t },\n\n\t _doFinalize: function () {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\n\t var nBitsTotal = this._nDataBytes * 8;\n\t var nBitsLeft = data.sigBytes * 8;\n\n\t // Add padding\n\t dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\n\n\t var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);\n\t var nBitsTotalL = nBitsTotal;\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (\n\t (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) |\n\t (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)\n\t );\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (\n\t (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) |\n\t (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)\n\t );\n\n\t data.sigBytes = (dataWords.length + 1) * 4;\n\n\t // Hash final blocks\n\t this._process();\n\n\t // Shortcuts\n\t var hash = this._hash;\n\t var H = hash.words;\n\n\t // Swap endian\n\t for (var i = 0; i < 4; i++) {\n\t // Shortcut\n\t var H_i = H[i];\n\n\t H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |\n\t (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);\n\t }\n\n\t // Return final computed hash\n\t return hash;\n\t },\n\n\t clone: function () {\n\t var clone = Hasher.clone.call(this);\n\t clone._hash = this._hash.clone();\n\n\t return clone;\n\t }\n\t });\n\n\t function FF(a, b, c, d, x, s, t) {\n\t var n = a + ((b & c) | (~b & d)) + x + t;\n\t return ((n << s) | (n >>> (32 - s))) + b;\n\t }\n\n\t function GG(a, b, c, d, x, s, t) {\n\t var n = a + ((b & d) | (c & ~d)) + x + t;\n\t return ((n << s) | (n >>> (32 - s))) + b;\n\t }\n\n\t function HH(a, b, c, d, x, s, t) {\n\t var n = a + (b ^ c ^ d) + x + t;\n\t return ((n << s) | (n >>> (32 - s))) + b;\n\t }\n\n\t function II(a, b, c, d, x, s, t) {\n\t var n = a + (c ^ (b | ~d)) + x + t;\n\t return ((n << s) | (n >>> (32 - s))) + b;\n\t }\n\n\t /**\n\t * Shortcut function to the hasher's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hash = CryptoJS.MD5('message');\n\t * var hash = CryptoJS.MD5(wordArray);\n\t */\n\t C.MD5 = Hasher._createHelper(MD5);\n\n\t /**\n\t * Shortcut function to the HMAC's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hmac = CryptoJS.HmacMD5(message, key);\n\t */\n\t C.HmacMD5 = Hasher._createHmacHelper(MD5);\n\t}(Math));\n\n\n\treturn CryptoJS.MD5;\n\n}));","import md5 from 'crypto-js/md5';\nimport { namedNode, triple, variable } from '@rdfjs/data-model';\nimport resolvePrefix from './resolvePrefix';\n\n// Transform ['ont:predicate1/ont:predicate2'] to ['ont:predicate1', 'ont:predicate1/ont:predicate2']\nconst extractNodes = blankNodes => {\n let nodes = [];\n if (blankNodes) {\n for (let predicate of blankNodes) {\n if (predicate.includes('/')) {\n const nodeNames = predicate.split('/');\n for (let i = 1; i <= nodeNames.length; i++) {\n nodes.push(nodeNames.slice(0, i).join('/'));\n }\n } else {\n nodes.push(predicate);\n }\n }\n }\n return nodes;\n};\n\nconst generateSparqlVarName = node => md5(node);\n\nconst getParentNode = node => node.includes('/') && node.split('/')[0];\n\nconst getPredicate = node => (node.includes('/') ? node.split('/')[1] : node);\n\nconst buildUnionQuery = queries =>\n queries.map(q => {\n let triples = q.query;\n const firstTriple = queries.find(q2 => q.parentNode === q2.node);\n if (firstTriple !== undefined) {\n triples = triples.concat(firstTriple.query[0]);\n }\n return {\n type: 'bgp',\n triples\n };\n });\n\nconst buildBlankNodesQuery = (blankNodes, baseQuery, ontologies) => {\n let queries = [];\n const nodes = extractNodes(blankNodes);\n\n if (nodes && ontologies && ontologies.length > 0) {\n for (let node of nodes) {\n const parentNode = getParentNode(node);\n const predicate = getPredicate(node);\n const varName = generateSparqlVarName(node);\n const parentVarName = parentNode ? generateSparqlVarName(parentNode) : '1';\n\n const query = [\n triple(variable('s' + parentVarName), namedNode(resolvePrefix(predicate, ontologies)), variable('s' + varName)),\n triple(variable('s' + varName), variable('p' + varName), variable('o' + varName))\n ];\n\n queries.push({\n node,\n parentNode,\n query,\n filter: '' // `FILTER(isBLANK(?s${varName})) .`\n });\n }\n\n return {\n construct: queries.length > 0 ? queries.map(q => q.query).reduce((pre, cur) => pre.concat(cur)) : null,\n where: {\n type: 'union',\n patterns: [baseQuery.where, ...buildUnionQuery(queries)]\n }\n };\n } else {\n return {\n construct: '',\n where: ''\n };\n }\n};\n\nexport default buildBlankNodesQuery;\n","import DataFactory from '@rdfjs/data-model';\nimport buildBaseQuery from './buildBaseQuery';\nimport buildBlankNodesQuery from './buildBlankNodesQuery';\nimport resolvePrefix from './resolvePrefix';\nconst { literal, namedNode, triple, variable } = DataFactory;\n\nconst SparqlGenerator = require('sparqljs').Generator;\nconst generator = new SparqlGenerator({\n /* prefixes, baseIRI, factory, sparqlStar */\n});\n\nconst reservedFilterKeys = ['q', 'sparqlWhere', 'blankNodes', '_servers', '_predicates'];\n\nconst buildSparqlQuery = ({ containers, params: { filter }, blankNodes, predicates, ontologies }) => {\n const baseQuery = buildBaseQuery(predicates, ontologies);\n\n let sparqlJsParams = {\n queryType: 'CONSTRUCT',\n template: baseQuery.construct,\n where: [],\n type: 'query',\n prefixes: Object.fromEntries(ontologies.map(ontology => [ontology.prefix, ontology.url]))\n };\n\n let containerWhere = [\n {\n type: 'values',\n values: containers.map(containerUri => ({ '?containerUri': namedNode(containerUri) }))\n },\n triple(variable('containerUri'), namedNode('http://www.w3.org/ns/ldp#contains'), variable('s1')),\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isiri',\n args: [variable('s1')]\n }\n }\n ];\n\n let resourceWhere = [];\n\n if (filter && Object.keys(filter).length > 0) {\n const hasSPARQLFilter = filter.sparqlWhere && Object.keys(filter.sparqlWhere).length > 0;\n const hasFullTextSearch = filter.q && filter.q.length > 0;\n\n if (hasSPARQLFilter) {\n /* \n Example of usage :\n {\n \"sparqlWhere\": {\n \"type\": \"bgp\",\n \"triples\": [{\n \"subject\": {\"termType\": \"Variable\", \"value\": \"s1\"},\n \"predicate\": {\"termType\": \"NameNode\", \"value\": \"http://virtual-assembly.org/ontologies/pair#label\"},\n \"object\": {\"termType\": \"Literal\", \"value\": \"My Organization\"}\n }]\n }\n }\n */\n // initialize array in case of single value :\n [].concat(filter.sparqlWhere).forEach(sw => {\n resourceWhere.push(sw);\n });\n }\n\n if (hasFullTextSearch) {\n resourceWhere.push({\n type: 'group',\n patterns: [\n {\n queryType: 'SELECT',\n variables: [variable('s1')],\n where: [\n triple(variable('s1'), variable('p1'), variable('o1')),\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isliteral',\n args: [variable('o1')]\n }\n },\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'regex',\n args: [\n {\n type: 'operation',\n operator: 'lcase',\n args: [\n {\n type: 'operation',\n operator: 'str',\n args: [variable('o1')]\n }\n ]\n },\n literal(filter.q.toLowerCase(), '', namedNode('http://www.w3.org/2001/XMLSchema#string'))\n ]\n }\n }\n ],\n type: 'query'\n }\n ]\n });\n }\n\n // Other filters\n // SPARQL keyword a = filter based on the class of a resource (example => 'a': 'pair:OrganizationType')\n // Other filters are based on a value (example => 'petr:hasAudience': 'http://localhost:3000/audiences/tout-public')\n Object.entries(filter).forEach(([predicate, object]) => {\n if (!reservedFilterKeys.includes(predicate)) {\n resourceWhere.unshift(\n triple(\n variable('s1'),\n namedNode(resolvePrefix(predicate, ontologies)),\n namedNode(resolvePrefix(object, ontologies))\n )\n );\n }\n });\n }\n\n // Blank nodes\n const blankNodesQuery = buildBlankNodesQuery(blankNodes, baseQuery, ontologies);\n if (blankNodesQuery && blankNodesQuery.construct) {\n resourceWhere = resourceWhere.concat(blankNodesQuery.where);\n sparqlJsParams.template = sparqlJsParams.template.concat(blankNodesQuery.construct);\n } else {\n resourceWhere.push(baseQuery.where);\n }\n\n sparqlJsParams.where.push(\n {\n type: 'union',\n patterns: [\n containerWhere,\n {\n type: 'graph',\n name: namedNode('http://semapps.org/mirror'),\n patterns: containerWhere\n }\n ]\n },\n {\n type: 'union',\n patterns: [\n resourceWhere,\n {\n type: 'graph',\n name: namedNode('http://semapps.org/mirror'),\n patterns: resourceWhere\n }\n ]\n }\n );\n\n return generator.stringify(sparqlJsParams);\n};\n\nexport default buildSparqlQuery;\n","// Based on the dataServers config, returns the blank nodes for the given containers\nconst getBlankNodesFromDataServers = (containers, dataServers) => {\n const blankNodes = [];\n for (let serverKey of Object.keys(dataServers)) {\n if (dataServers[serverKey].blankNodes) {\n for (let containerUri of Object.keys(dataServers[serverKey].blankNodes)) {\n if (containers.includes(containerUri)) {\n blankNodes.push(...dataServers[serverKey].blankNodes[containerUri]);\n }\n }\n }\n }\n // Remove duplicates\n return [...new Set(blankNodes)];\n};\n\nexport default getBlankNodesFromDataServers;\n","import getEmbedFrame from './getEmbedFrame';\nimport buildSparqlQuery from './buildSparqlQuery';\nimport getBlankNodesFromDataServers from './getBlankNodesFromDataServers';\nimport jsonld from 'jsonld';\n\nconst compare = (a, b) => {\n switch (typeof a) {\n case 'string':\n return a.localeCompare(b);\n case 'number':\n case 'bigint':\n return a - b;\n default:\n return 0;\n }\n};\n\nconst fetchSparqlEndpoints = async (containers, resourceId, params, config) => {\n const { dataServers, resources, httpClient, jsonContext, ontologies } = config;\n const dataModel = resources[resourceId];\n\n const sparqlQueryPromises = Object.keys(containers).map(\n serverKey =>\n new Promise((resolve, reject) => {\n const blankNodes =\n params.filter?.blankNodes ||\n dataModel.list?.blankNodes ||\n getBlankNodesFromDataServers(containers[serverKey], dataServers);\n\n const predicates = params.filter?._predicates || dataModel.list?.predicates;\n\n // When the SPARQL request comes from the browser's URL, it comes as JSON string which must must be parsed\n if (params.filter?.sparqlWhere && (typeof params.filter.sparqlWhere === 'string' || params.filter.sparqlWhere instanceof String)) {\n params.filter.sparqlWhere = JSON.parse(decodeURIComponent(params.filter.sparqlWhere));\n }\n const sparqlQuery = buildSparqlQuery({\n containers: containers[serverKey],\n params: { ...params, filter: { ...dataModel.list?.filter, ...params.filter } },\n blankNodes,\n predicates,\n ontologies\n });\n\n httpClient(dataServers[serverKey].sparqlEndpoint, {\n method: 'POST',\n body: sparqlQuery\n })\n .then(({ json }) => {\n // By default, embed only the blank nodes we explicitly asked to dereference\n // Otherwise we may have same-type resources embedded in other resources\n // To increase performances, you can set explicitEmbedOnFraming to false (make sure the result is still OK)\n const frame =\n dataModel.list?.explicitEmbedOnFraming !== false\n ? {\n '@context': jsonContext,\n '@type': dataModel.types,\n '@embed': '@never',\n ...getEmbedFrame(blankNodes)\n }\n : {\n '@context': jsonContext,\n '@type': dataModel.types\n };\n\n // omitGraph option force results to be in a @graph, even if we have a single result\n return jsonld.frame(json, frame, { omitGraph: false });\n })\n .then(compactJson => {\n if (compactJson['@id']) {\n const { '@context': context, ...rest } = compactJson;\n compactJson = {\n '@context': context,\n '@graph': [rest]\n };\n }\n resolve(compactJson['@graph'] || []);\n })\n .catch(e => reject(e));\n })\n );\n\n // Run simultaneous SPARQL queries\n let results = await Promise.all(sparqlQueryPromises);\n\n if (results.length === 0) {\n return { data: [], total: 0 };\n } else {\n // Merge all results in one array\n results = [].concat(...results);\n\n // Add id in addition to @id, as this is what React-Admin expects\n let returnData = results.map(item => {\n item.id = item.id || item['@id'];\n return item;\n });\n\n // TODO sort and paginate the results in the SPARQL query to improve performances\n if (params.sort) {\n returnData = returnData.sort((a, b) => {\n if (a[params.sort.field] !== undefined && b[params.sort.field] !== undefined) {\n if (params.sort.order === 'ASC') {\n return compare(a[params.sort.field], b[params.sort.field]);\n } else {\n return compare(b[params.sort.field], a[params.sort.field]);\n }\n } else {\n return 0;\n }\n });\n }\n if (params.pagination) {\n returnData = returnData.slice(\n (params.pagination.page - 1) * params.pagination.perPage,\n params.pagination.page * params.pagination.perPage\n );\n }\n\n return { data: returnData, total: results.length };\n }\n};\n\nexport default fetchSparqlEndpoints;\n","import urlJoin from 'url-join';\n\nconst findContainersWithPaths = (paths, dataServers) => {\n let containers = {};\n Object.keys(paths).forEach(serverKey => {\n if (dataServers[serverKey]) {\n containers[serverKey] = [];\n paths[serverKey].forEach(path => {\n containers[serverKey].push(urlJoin(dataServers[serverKey].baseUrl, path));\n });\n } else {\n throw new Error('No server found with key ' + serverKey);\n }\n });\n return containers;\n};\n\nexport default findContainersWithPaths;\n","import findContainersWithTypes from '../utils/findContainersWithTypes';\nimport fetchContainers from '../utils/fetchContainers';\nimport fetchSparqlEndpoints from '../utils/fetchSparqlEndpoints';\nimport findContainersWithPaths from '../utils/findContainersWithPath';\n\nconst getListMethod = config => async (resourceId, params = {}) => {\n let { dataServers, resources } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) throw new Error(`Resource ${resourceId} is not mapped in resources file`);\n\n let containers;\n if (!params.filter?._servers && dataModel.list?.containers) {\n if (Array.isArray(dataModel.list?.containers))\n throw new Error(\n `The list.containers property of ${resourceId} dataModel must be of type object ({ serverKey: [containerUri] })`\n );\n // If containers are set explicitly, use them\n containers = findContainersWithPaths(dataModel.list.containers, dataServers);\n } else {\n // Otherwise find the container URIs on the given servers (either in the filter or the data model)\n containers = findContainersWithTypes(\n dataModel.types,\n params.filter?._servers || dataModel.list?.servers,\n dataServers\n );\n }\n\n if (dataModel.list?.fetchContainer) {\n return fetchContainers(containers, resourceId, params, config);\n } else {\n return fetchSparqlEndpoints(containers, resourceId, params, config);\n }\n};\n\nexport default getListMethod;\n","import getOne from './getOne';\n\nconst getManyMethod = config => async (resourceId, params) => {\n const { returnFailedResources } = config;\n\n let returnData = await Promise.all(\n params.ids.map(id =>\n getOne(config)(resourceId, { id: typeof id === 'object' ? id['@id'] : id })\n .then(({ data }) => data)\n .catch(() => {\n // Catch if one resource fails to load\n // Otherwise no references will be show if only one is missing\n // See https://github.com/marmelab/react-admin/issues/5190\n if (returnFailedResources) {\n return { id, _error: true };\n } else {\n // Returning nothing\n }\n })\n )\n );\n\n // We don't want undefined results to appear in the results as it will break with react-admin\n returnData = returnData.filter(e => e);\n\n return { data: returnData };\n};\n\nexport default getManyMethod;\n","import getList from './getList';\n\nconst getManyReferenceMethod = config => async (resourceId, params) => {\n params.filter = { ...params.filter, [params.target]: params.id };\n delete params.target;\n return await getList(config)(resourceId, params);\n};\n\nexport default getManyReferenceMethod;\n","import uploadAllFiles from '../utils/uploadAllFiles';\n\nconst updateMethod = config => async (resourceId, params) => {\n const { httpClient, jsonContext } = config;\n\n // Upload files, if there are any\n params.data = await uploadAllFiles(params.data, config);\n\n await httpClient(params.id, {\n method: 'PUT',\n body: JSON.stringify({\n '@context': jsonContext,\n ...params.data\n })\n });\n\n return { data: params.data };\n};\n\nexport default updateMethod;\n","function e(e){this.message=e}e.prototype=new Error,e.prototype.name=\"InvalidCharacterError\";var r=\"undefined\"!=typeof window&&window.atob&&window.atob.bind(window)||function(r){var t=String(r).replace(/=+$/,\"\");if(t.length%4==1)throw new e(\"'atob' failed: The string to be decoded is not correctly encoded.\");for(var n,o,a=0,i=0,c=\"\";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)o=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\".indexOf(o);return c};function t(e){var t=e.replace(/-/g,\"+\").replace(/_/g,\"/\");switch(t.length%4){case 0:break;case 2:t+=\"==\";break;case 3:t+=\"=\";break;default:throw\"Illegal base64url string!\"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,r){var t=r.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t=\"0\"+t),\"%\"+t})))}(t)}catch(e){return r(t)}}function n(e){this.message=e}function o(e,r){if(\"string\"!=typeof e)throw new n(\"Invalid token specified\");var o=!0===(r=r||{}).header?0:1;try{return JSON.parse(t(e.split(\".\")[o]))}catch(e){throw new n(\"Invalid token specified: \"+e.message)}}n.prototype=new Error,n.prototype.name=\"InvalidTokenError\";export default o;export{n as InvalidTokenError};\n//# sourceMappingURL=jwt-decode.esm.js.map\n","import jwtDecode from 'jwt-decode';\nimport getServerKeyFromType from './getServerKeyFromType';\nimport urlJoin from 'url-join';\n\nconst fetchUserConfig = async config => {\n const { dataServers, httpClient } = config;\n const token = localStorage.getItem('token');\n const podKey = getServerKeyFromType('pod', dataServers);\n const authServerKey = getServerKeyFromType('authServer', dataServers);\n\n // If the user is logged in\n if (token) {\n const { webId } = jwtDecode(token);\n let userData;\n\n try {\n const { json } = await httpClient(webId);\n userData = json;\n } catch (e) {\n console.error(e);\n // If the webId cannot be fetched, assume an invalid token and disconnect the user\n localStorage.clear();\n window.location.reload();\n return;\n }\n\n // If we have a POD server\n if (podKey) {\n // Fill the config provided to the data provider\n // We must modify the config object directly\n config.dataServers[podKey].name = 'My Pod';\n config.dataServers[podKey].baseUrl = urlJoin(webId, 'data'); // TODO find POD URI from user profile\n config.dataServers[podKey].sparqlEndpoint =\n userData.endpoints?.['void:sparqlEndpoint'] || urlJoin(webId, 'sparql');\n }\n\n if (authServerKey) {\n // Fill the config provided to the data provider\n // We must modify the config object directly\n config.dataServers[authServerKey].proxyUrl = userData.endpoints?.proxyUrl;\n }\n } else {\n // if (podKey) {\n // // If the user is not logged in, ignore the POD server\n // delete config.dataServers[podKey];\n // }\n }\n};\n\nexport default fetchUserConfig;\n","const defaultToArray = value => (!value ? undefined : Array.isArray(value) ? value : [value]);\n\nconst fetchVoidEndpoints = async config => {\n const fetchPromises = Object.entries(config.dataServers)\n .filter(([key, server]) => server.pod !== true)\n .map(([key, server]) =>\n config\n .httpClient((new URL('/.well-known/void', server.baseUrl)).toString())\n .then(result => ({ key, datasets: result.json['@graph'] }))\n .catch(e => {\n if (e.status === 404 || e.status === 401) {\n return { key, error: e };\n } else {\n throw e;\n }\n })\n );\n\n let results = [];\n\n try {\n results = await Promise.all(fetchPromises);\n } catch (e) {\n // Do not throw error if no endpoint found\n }\n\n for (let result of results) {\n config.dataServers[result.key].containers = config.dataServers[result.key].containers || {};\n config.dataServers[result.key].blankNodes = config.dataServers[result.key].blankNodes || {};\n\n // Ignore unfetchable endpoints\n if (result.datasets) {\n for (let dataset of result.datasets) {\n const datasetServerKey = Object.keys(config.dataServers).find(\n key => dataset['void:uriSpace'] === config.dataServers[key].baseUrl\n );\n\n // If the dataset is not part of a server mapped in the dataServers, ignore it\n if (datasetServerKey) {\n // If this is the local dataset, add the base information\n if (datasetServerKey === result.key) {\n config.dataServers[result.key].name = config.dataServers[result.key].name || dataset['dc:title'];\n config.dataServers[result.key].description =\n config.dataServers[result.key].description || dataset['dc:description'];\n config.dataServers[result.key].sparqlEndpoint =\n config.dataServers[result.key].sparqlEndpoint || dataset['void:sparqlEndpoint'];\n }\n\n config.dataServers[result.key].containers[datasetServerKey] =\n config.dataServers[result.key].containers[datasetServerKey] || {};\n\n for (let partition of defaultToArray(dataset['void:classPartition'])) {\n for (let type of defaultToArray(partition['void:class'])) {\n // Set containers by type\n const path = partition['void:uriSpace'].replace(dataset['void:uriSpace'], '/');\n if (config.dataServers[result.key].containers[datasetServerKey][type]) {\n config.dataServers[result.key].containers[datasetServerKey][type].push(path);\n } else {\n config.dataServers[result.key].containers[datasetServerKey][type] = [path];\n }\n\n // Set blank nodes by containers\n const blankNodes = defaultToArray(partition['semapps:blankNodes']);\n if (blankNodes) {\n config.dataServers[result.key].blankNodes[partition['void:uriSpace']] = defaultToArray(\n partition['semapps:blankNodes']\n );\n }\n }\n }\n }\n }\n }\n }\n};\n\nexport default fetchVoidEndpoints;\n","// Return the first server matching with the baseUrl\nconst getServerKeyFromUri = (uri, dataServers) => {\n return Object.keys(dataServers).find(key => {\n if (dataServers[key].pod) {\n // The baseUrl ends with /data so remove this part to match with the webId and webId-related URLs (/inbox, /outbox...)\n return dataServers[key].baseUrl && uri.startsWith(dataServers[key].baseUrl.replace('/data', ''));\n } else {\n return uri.startsWith(dataServers[key].baseUrl);\n }\n });\n};\n\nexport default getServerKeyFromUri;\n","import { useCallback, useMemo, useContext } from 'react';\nimport { DataProviderContext } from 'react-admin';\n\nconst compute = (externalLinks, record) =>\n typeof externalLinks === 'function' ? externalLinks(record) : externalLinks;\nconst isURL = url => typeof url === 'string' && url.startsWith('http');\n\nconst useGetExternalLink = componentExternalLinks => {\n // Since the externalLinks config is defined only locally, we don't need to wait for VOID endpoints fetching\n const dataProvider = useContext(DataProviderContext);\n const dataServers = dataProvider.getLocalDataServers();\n\n const serversExternalLinks = useMemo(() => {\n if (dataServers) {\n return Object.fromEntries(\n Object.values(dataServers).map(server => {\n // If externalLinks is not defined in the data server, use external links for non-default servers\n const externalLinks = server.externalLinks !== undefined ? server.externalLinks : !server.default;\n return [server.baseUrl, externalLinks];\n })\n );\n }\n }, [dataServers]);\n\n return useCallback(\n record => {\n const computedComponentExternalLinks = compute(componentExternalLinks, record);\n // If the component explicitly asks not to display as external links, use an internal link\n if (computedComponentExternalLinks === false) return false;\n\n if (!record?.id) return false;\n\n const serverBaseUrl = Object.keys(serversExternalLinks).find(baseUrl => record?.id.startsWith(baseUrl));\n // If no matching data servers could be found, assume we have an internal link\n if (!serverBaseUrl) return false;\n\n const computedServerExternalLinks = compute(serversExternalLinks[serverBaseUrl], record);\n // If the data server explicitly asks not to display as external links, use an internal link\n if (computedServerExternalLinks === false) return false;\n\n if (isURL(computedComponentExternalLinks)) {\n return computedComponentExternalLinks;\n } else if (isURL(computedServerExternalLinks)) {\n return computedServerExternalLinks;\n } else {\n return record.id;\n }\n },\n [serversExternalLinks, componentExternalLinks]\n );\n};\n\nexport default useGetExternalLink;\n","import { useContext, useState, useEffect } from 'react';\nimport { DataProviderContext } from 'react-admin';\n\nconst useDataModel = resourceId => {\n // Get the raw data provider, since useDataProvider returns a wrapper\n const dataProvider = useContext(DataProviderContext);\n const [dataModel, setDataModel] = useState();\n\n useEffect(() => {\n dataProvider.getDataModels().then(results => setDataModel(results[resourceId]));\n }, [dataProvider, resourceId, setDataModel]);\n\n return dataModel;\n};\n\nexport default useDataModel;\n","import { useContext, useState, useEffect } from 'react';\nimport { DataProviderContext } from 'react-admin';\n\nconst useDataServers = () => {\n // Get the raw data provider, since useDataProvider returns a wrapper\n const dataProvider = useContext(DataProviderContext);\n const [dataServers, setDataServers] = useState();\n\n useEffect(() => {\n dataProvider.getDataServers().then(results => setDataServers(results));\n }, [dataProvider, setDataServers]);\n\n return dataServers;\n};\n\nexport default useDataServers;\n","import urlJoin from 'url-join';\n\nconst findCreateContainerWithTypes = (types, createServerKey, dataServers) => {\n let containers = [];\n\n if (Object.keys(dataServers[createServerKey].containers[createServerKey]).length > 0) {\n Object.keys(dataServers[createServerKey].containers[createServerKey]).forEach(type => {\n if (types.includes(type)) {\n dataServers[createServerKey].containers[createServerKey][type].map(path => {\n const containerUri = urlJoin(dataServers[createServerKey].baseUrl, path);\n if (!containers.includes(containerUri)) {\n containers.push(containerUri);\n }\n });\n }\n });\n }\n\n if (containers.length === 0) {\n throw new Error(\n `No container found matching with types ${JSON.stringify(\n types\n )}. You can set explicitely the create.container property of the resource.`\n );\n } else if (containers.length > 1) {\n throw new Error(\n `More than one container found matching with types ${JSON.stringify(\n types\n )}. You must set the create.server or create.container property for the resource.`\n );\n }\n\n return containers[0];\n};\n\nexport default findCreateContainerWithTypes;\n","import React, { useState, useEffect } from 'react';\n\n/**\n * @example\n * \n * \n * \n * \n * \n * \n */\n\nconst FilterHandler = ({ children, record, filter, source, ...otherProps }) => {\n const [filtered, setFiltered] = useState();\n useEffect(() => {\n if (record && source && Array.isArray(record?.[source])) {\n const filteredData = record?.[source].filter(r => {\n let eq = true;\n for (const key in filter) {\n const value = r[key];\n if (Array.isArray(value)) {\n if (!value.includes(filter[key])) {\n eq = false;\n }\n } else {\n if (value !== filter[key]) {\n eq = false;\n }\n }\n }\n return eq;\n });\n let newRecord = {\n ...record\n };\n //undefined setted if no data to obtain no render in RightLabel or equivalent\n newRecord[source] = filteredData.length > 0 ? filteredData : undefined;\n setFiltered(newRecord);\n }\n }, [record, source, filter]);\n\n return (\n <>\n {React.Children.map(children, (child, i) => {\n return React.cloneElement(child, {\n ...otherProps,\n record: filtered,\n addLabel: true,\n source\n });\n })}\n \n );\n};\nexport default FilterHandler;\n","import React, { useEffect, useState } from 'react';\nimport { ArrayInput, SimpleFormIterator, TextInput } from 'react-admin';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useReferenceInputStyles = makeStyles({\n form: {\n display: 'flex'\n },\n input: {\n paddingRight: '20px'\n }\n});\n\nconst useHideInputStyles = makeStyles({\n root: {\n display: 'none'\n }\n});\n\nconst ReificationArrayInput = props => {\n const { reificationClass, children, ...otherProps } = props;\n const flexFormClasses = useReferenceInputStyles();\n const hideInputStyles = useHideInputStyles();\n\n return (\n \n \n {React.Children.map(props.children, (child, i) => {\n return React.cloneElement(child, {\n className: flexFormClasses.input\n });\n })}\n \n \n \n );\n};\n\nexport default ReificationArrayInput;\n","import React from 'react';\nimport { useQueryWithStore } from 'react-admin';\nimport { default as FilterHandler } from './FilterHandler';\n\n/*\n * @example Label used in examples\n * const Label = ({label, ...otherProps})=>{\n * return

{label}

\n * }\n *\n * @example show header for each group with group property thanks to groupHeader\n * }\n * filterProperty=\"property of source filtered by groupReference\"\n * addLabel={false}\n * >\n * // same props as GroupedArrayField source\n * \n * \n * \n * \n *\n * @example call chhildren with label thanks to groupLabel\n * \n *