text: import { _parseURIParams } from "../../DocumentsRepository/Utils";
  import { ModelDecorator } from "../../Model/ModelDecorator";
  import { Pointer } from "../../Pointer/Pointer";
  import { URI } from "../../RDF/URI";
  import { ResolvablePointer } from "../../Repository/ResolvablePointer";
  import { isObject, isString } from "../../Utils";
  import { TransientDocument } from "../TransientDocument";
  function __parseMemberParams(resource, args) {
      var params = Array.from(args);
      var uri = isString(params[0]) && isString(Pointer.getID(params[1])) ?
          URI.resolve(resource.$id, params.shift()) : resource.$id;
      return { uri: uri, params: params };
  }
  export var LDPDocumentTrait = {
      PROTOTYPE: {
          $create: function (uriOrChildren, childrenOrSlugsOrRequestOptions, slugsOrRequestOptions, requestOptions) {
              var _a;
              var _b = _parseURIParams(this, uriOrChildren, arguments), _uri = _b._uri, _args = _b._args;
              return (_a = this.$repository).create.apply(_a, [_uri].concat(_args));
          },
          $createAndRetrieve: function (uriOrChildren, childrenOrSlugsOrRequestOptions, slugsOrRequestOptions, requestOptions) {
              if (requestOptions === void 0) { requestOptions = {}; }
              var _a;
              var _b = _parseURIParams(this, uriOrChildren, arguments), _uri = _b._uri, _args = _b._args;
              return (_a = this.$repository).createAndRetrieve.apply(_a, [_uri].concat(_args));
          },
          $addMember: function (uriOrMember, memberOrOptions, requestOptions) {
              var _a;
              var _b = __parseMemberParams(this, arguments), uri = _b.uri, params = _b.params;
              return (_a = this.$repository).addMember.apply(_a, [uri].concat(params));
          },
          $addMembers: function (uriOrMembers, membersOrOptions, requestOptions) {
              var _a;
              var _b = _parseURIParams(this, uriOrMembers, arguments), _uri = _b._uri, _args = _b._args;
              return (_a = this.$repository).addMembers.apply(_a, [_uri].concat(_args));
          },
          $removeMember: function (uriOrMember, memberOrOptions, requestOptions) {
              var _a;
              var _b = __parseMemberParams(this, arguments), uri = _b.uri, params = _b.params;
              return (_a = this.$repository).removeMember.apply(_a, [uri].concat(params));
          },
          $removeMembers: function (uriOrMembersOrOptions, membersOrOptions, requestOptions) {
              var _a;
              var _b = _parseURIParams(this, uriOrMembersOrOptions, arguments), _uri = _b._uri, _args = _b._args;
              return (_a = this.$repository).removeMembers.apply(_a, [_uri].concat(_args));
          },
      },
      isDecorated: function (object) {
          return isObject(object)
              && ModelDecorator
                  .hasPropertiesFrom(LDPDocumentTrait.PROTOTYPE, object);
      },
      decorate: function (object) {
          if (LDPDocumentTrait.isDecorated(object))
              return object;
          var target = ModelDecorator
              .decorateMultiple(object, TransientDocument, ResolvablePointer);
          return ModelDecorator
              .definePropertiesFrom(LDPDocumentTrait.PROTOTYPE, target);
      },
  };
  
  //# sourceMappingURL=LDPDocumentTrait.js.map
  